fix(cli): repair --help layout; feat(web): show server version on login - #56
Merged
Conversation
The login page had no version indicator, so anyone reporting a bug from a deployment had to guess which build they were on — the version was only reachable after signing in, via the About dialog. Append it to the copyright line rather than giving it its own row: the footer is already the page's meta-info zone, and a six-character string does not earn a full line. When the version is unknown (still loading, or the request failed) the copyright renders alone, with no orphaned separator left behind. Add GET /api/version for this. /health answers the same question, but only after probing the database, both data directories and every execution engine — far too much work, and far too much detail, to drag into an unauthenticated page load. The About dialog was doing exactly that via an inline fetch, so point both surfaces at one shared useVersion() hook and let them share its cache. getVersion() moves to lib/ so the two routes resolve the version identically. The hook resolves to null instead of rejecting on failure: every surface showing the version is decorative, and the login page should never have to render an error state for it.
`a2wave --help` rendered each command with a blank-looking line after it, and long descriptions broke mid-sentence at column 0. The cause was not description length: citty's `formatLineColumns` pads *every* column to the widest entry, including the last one. The 250-character `api` description therefore padded all 24 rows out to 332 columns, and any terminal narrower than that wrapped the trailing whitespace into a second line. Two further defects compounded it: the renderer never consulted the terminal width, so overflowing descriptions lost the column alignment entirely, and it right-aligned command names with `padStart`, making the left edge step in and out raggedly. Replace citty's `renderUsage` with our own. Post-processing could not fix this — the padding is applied inside citty's function, so there is no seam to patch from outside, and stripping trailing spaces afterwards cannot recover text already wrapped at the wrong width. The layout now matches what every mainstream CLI uses (claude, codex, lark-cli): two-space indent, left-aligned names, one gutter, descriptions wrapped with a hanging indent, and no trailing whitespace on any line. Descriptions are kept whole rather than truncated; the page wraps to the terminal width, falling back to a fixed 100 columns when stdout is not a TTY so that agent-facing output stays byte-stable across runs and machines. Two bugs surfaced while fixing this and are pinned by tests: - The pipe-joined subcommand list is a single space-free token (165 chars for the root's 24 commands), which word-wrapping alone cannot split. It now breaks after `|`. - The renderer never falls back to `process.argv[1]` the way citty does, so the published binary's absolute path can no longer leak into a usage line whose `meta.name` is missing. The preformatted AGENT QUICKSTART block keeps its hand-alignment: an indented line is passed through unreflowed rather than rewrapped. Verified across --help, agents, runs list, setup and api: zero overflowing lines and zero trailing-space lines.
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.
Two independent changes that happened to share a branch.
1.
fix(cli):--helpwrapped every command onto a blank second linea2wave --helprendered a blank-looking line after each command, and long descriptions broke mid-sentence at column 0.The cause was not description length. citty's
formatLineColumnspads every column to the widest entry, including the last one. The 250-characterapidescription padded all 24 rows out to 332 columns, so any terminal narrower than that wrapped the trailing whitespace into a second line. Two defects compounded it: the renderer never consulted the terminal width, and it right-aligned names withpadStart, making the left edge step in and out raggedly.Before (every row padded to 332 cols → wraps):
After:
citty's
renderUsageis replaced rather than post-processed: the padding is applied inside citty's function, so there is no seam to patch from outside, and stripping trailing spaces afterwards cannot recover text already wrapped at the wrong width. The layout now matches claude / codex / lark-cli — two-space indent, left-aligned names, one gutter, hanging-indent wrapping, no trailing whitespace.Descriptions are kept whole rather than truncated. The page wraps to the terminal width, falling back to a fixed 100 columns when stdout is not a TTY, so agent-facing output stays byte-stable across runs and machines.
Two further bugs surfaced while fixing this, both pinned by tests:
|.process.argv[1]the way citty does, so the published binary's absolute path can no longer leak into a usage line whosemeta.nameis missing.The preformatted AGENT QUICKSTART block keeps its hand-alignment — an indented line is passed through unreflowed rather than rewrapped.
New:
apps/cli/src/lib/usage.ts(wrapping/column primitives) andapps/cli/src/lib/render-usage.ts(page renderer), with 31 tests written red-first.2.
feat(web): server version in the login footerAdds
GET /api/version, ause-versionhook, and the login-page footer.Verification
Help output checked across
--help,agents,runs list,setup,api: zero overflowing lines, zero trailing-space lines.Also deployed to a local PostgreSQL-backed install to confirm
/api/versionserves JSON (it previously fell through to the HTML app shell).Note for reviewers
apps/cliis not built into the container image, so the CLI fix ships via the npm package only; the web change ships in the image.