feat: add gateway watchdog command#134
Merged
Merged
Conversation
Health-checks the standalone gateway with three independent checks: 1. Network connectivity (can we reach Linear API?) 2. Token validity (can we authenticate with current token?) 3. Gateway process (is the HTTP server responding?) Supports --fix flag for auto-repair (pm2 restart) and --json for structured output. Designed for cron/systemd timer integration. Usage: linear watchdog [--port 8091] [--fix] [--json]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
linear watchdogCLI subcommand for standalone gateway health monitoring.Three independent checks
api.linear.appat all? (Distinguishes broken network from expired token)~/.linear-gateway/token.jsonauthenticate successfully? (viewer query)/health?Auto-repair
With
--fix, automatically restarts the gateway viapm2 restart linear-gatewaywhen the health endpoint is unreachable.Usage
Cron integration
Implementation
src/standalone/watchdog.ts— Core logic, reusesFileTokenStoreandresolveLinearTokensrc/standalone/cli.ts— CLI subcommand with--port,--fix,--json,--token-storeflagssrc/__test__/watchdog.test.ts— 8 unit tests covering all failure modes and repairNo new runtime dependencies. Follows existing project conventions (ESM, strict TS, Biome, Vitest).