Skip to content

feat: add --version flag and /api/server/status endpoint - #41

Merged
jesse23 merged 2 commits into
mainfrom
feat/version-flag
Sep 21, 2026
Merged

jesse23 merged 2 commits into
mainfrom
feat/version-flag

Conversation

@jesse23

@jesse23 jesse23 commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Description

  • webtty --version / webtty -v prints the version (also listed in webtty help).
  • New GET /api/server/status returns { "version": "..." }.

The version comes from package.json, read at runtime by src/version.ts (it walks up from the running file to the nearest package.json named webtty, so it works from src/ and from the bundled dist/cli and dist/server). It is not inlined at build time because the release workflow runs bun run build before semantic-release bumps package.json, which would ship 0.0.0-development. Dev checkouts report 0.0.0-development.

Tested: lint and the full test suite pass; the CLI reports the version from source, from dist under Bun, and from dist under 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

`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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity · 2 Low severity

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/--version CLI 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.

Comment thread src/version.test.ts
Comment thread src/cli/index.ts
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'),

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/server/routes.ts
- 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>
@jesse23
jesse23 merged commit d0be54a into main Sep 21, 2026
3 checks passed
@jesse23
jesse23 deleted the feat/version-flag branch September 21, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants