feat(cli): roamcode status — service, reachability, and running build at a glance#75
Open
dchaudhari7177 wants to merge 1 commit into
Open
feat(cli): roamcode status — service, reachability, and running build at a glance#75dchaudhari7177 wants to merge 1 commit into
roamcode status — service, reachability, and running build at a glance#75dchaudhari7177 wants to merge 1 commit into
Conversation
… at a glance 'Is it actually running? On which port? Which build?' previously needed launchctl/systemctl incantations. `roamcode status` now answers directly: - reads <dataDir>/service.json (via the server's own resolveDataDir) and prints the installed service manager + label, or a 'run roamcode install' hint when none was ever installed - probes GET /health on 127.0.0.1:<PORT> (PORT env or 4280) with a ~2s timeout and exits 0 when reachable, 1 when not, so scripts can gate on it - best-effort GET /version (token from ACCESS_TOKEN or <dataDir>/token) enriches the output to 'running (v… · <sha>)'; any failure there quietly degrades to plain 'running' Unit tests follow the existing deps-injection style — no real network or data dir anywhere. Closes burakgon#69
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.
Closes #69
What
New
roamcode statussubcommand (packages/cli/src/status.ts, lazily imported likeinstallso the serve path stays lean):<dataDir>/service.jsonvia the server's ownresolveDataDir(so it sees exactly whatroamcode installwrote) and printsService: <manager> · <label>, ornone installed, with aroamcode installhint — and still probes the port in that case.GET http://127.0.0.1:<PORT>/health(PORT env when it's a usable positive integer, else 4280 —PORT=0means "pick a free port" at serve time, so status falls back to the default) with a 2sAbortSignal.timeout. Exit 0 when reachable, 1 when not, so scripts canroamcode status && …./versionis token-gated, so when a token is available (ACCESS_TOKENenv wins, else the persisted<dataDir>/token— same precedence as the server) the output becomesrunning at … (v0.4.2 · abc1234). No token / 401 / timeout quietly degrades to plainrunning— never contradicting the/healthanswer already in hand.args.tsaccepts the leadingstatuspositional (same pattern asinstall/uninstall) and the help text gains a line.Tests
packages/cli/test/status.test.tsfollows the existing deps-injection style (injectedfetchFn+ in-memoryreadFile, no real network or data dir): not-installed+unreachable→exit 1, installed+up+token→full detail line, no-token→/versionnever fetched, stale-token 401→plain running,PORTenv +ACCESS_TOKEN-beats-file precedence,PORT=0→default 4280, corruptservice.jsontolerated. Plus astatusparse case inargs.test.ts.Verification
pnpm typecheckgreen;vitest run packages/cli— all 31 status/args/run tests that pass onmainstill pass plus the 8 new ones (the 4 pre-existinginstallfailures on a Windows checkout — backslashjoin()paths and chmod-mode asserts — are unchanged and don't occur on Linux CI).Service: none installed…/Server: not reachable at http://127.0.0.1:4280, exit 1. Against a stub/health+/versionserver withACCESS_TOKENset →Server: running at http://127.0.0.1:4280 (v0.9.9 · cafe123), exit 0.