Repository navigation
feat: add --version flag and /api/server/status endpoint - #41
Conversation
`webtty --version` / `-v` prints the version from package.json, and
`GET /api/server/status` returns it as `{ "version": "..." }`.
The version is read at runtime rather than inlined at build time: the
release workflow builds before semantic-release bumps package.json, so a
build-time value would ship as 0.0.0-development. Dev checkouts report
0.0.0-development.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The living specifications need updating, and bundled runtime behavior lacks automated coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Adds runtime version reporting through the CLI and server API.
Changes:
- Resolves the version from the nearest webtty
package.json. - Adds
-v/--versionCLI flags. - Adds
GET /api/server/status.
| File | Description |
|---|---|
src/version.ts |
Implements runtime version resolution. |
src/version.test.ts |
Tests source-tree version resolution. |
src/cli/index.ts |
Adds version flags and help text. |
src/server/routes.ts |
Adds the status endpoint. |
src/server/routes.test.ts |
Tests the status response. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| row('config', 'Open the config file in $VISUAL, $EDITOR, or a default editor'), | ||
| row('key', 'Capture a key combo and print its chars value for keyboardBindings'), | ||
| row('help', 'Show this help message'), | ||
| row('-v, --version', 'Print the webtty version'), |
There was a problem hiding this comment.
Fixed in 7807246. docs/specs/cli.md now has --version/-v in the command table, a short "Version flag" section (including why the version is read at runtime rather than at build time), and a Features row. One note: cli.md is 62 lines, so there was no line 95. I assumed the second occurrence meant the Features table, and updated it too.
- Test the bundled dist/cli and dist/server entries under Bun and Node against a throwaway package with a distinctive version, so a bundler/import.meta.url regression fails CI. - Document `--version`/`-v` in docs/specs/cli.md and `GET /api/server/status` in docs/specs/webtty.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>


Description
webtty --version/webtty -vprints the version (also listed inwebtty help).GET /api/server/statusreturns{ "version": "..." }.The version comes from
package.json, read at runtime bysrc/version.ts(it walks up from the running file to the nearestpackage.jsonnamedwebtty, so it works fromsrc/and from the bundleddist/clianddist/server). It is not inlined at build time because the release workflow runsbun run buildbefore semantic-release bumpspackage.json, which would ship0.0.0-development. Dev checkouts report0.0.0-development.Tested: lint and the full test suite pass; the CLI reports the version from source, from
distunder Bun, and fromdistunder Node, and the built server serves the status endpoint. Not tested against a real released version number.ADRs
N/A — small CLI/API addition.
🤖 Generated with Claude Code