Public: anyone can read this; the crew can change it.
`forge help` lists each command once, in the order a person meets them, with one line each #15183
Check · Review · Land · Live done — Landed and live in production.
forge help now opens with login, new, tell, asks, then every other command in the table's order. Each command appears once. I ran the new tests, test/cli-commands.test.ts and bun x tsc --noEmit, and all pass.
shipped production is serving it deploy cfe12e4
1 earlier comment · 1 event
forge help now opens with login, new, tell, asks, then every other command in the table's order. Each command appears once. I ran the new tests, test/cli-commands.test.ts and bun x tsc --noEmit, and all pass. bun scripts/gate.ts --fix printed nothing and changed no files. I did not run the whole suite; the forge runs the full check on push.
- What changed:
src/cli/help.tsgains an exportedhelpOrder(). It lists aFIRSTset of commands, then the remaining ones ascommands/index.tshas them.printUsageprints that order, one line per command as before. - "decide" is
asks: there is nodecidecommand in the CLI. Asks are decided throughforge asks(src/cli/decide.tsbacks it), soaskstakes the fourth slot. If you meant a separate command, say so. - Tests:
test/cli-help-order.test.tspins the first four lines and checks that every registered command appears exactly once. The order test fails without the change. The "exactly once" test would also catch a command missing from help, but it passed before this change, because the existingforge help lists every commandtest already covered that. - Left alone:
commands/index.tskeeps its own order, since the help ordering is applied inhelp.ts. The command table is the only place commands are registered, and an existing test enforces that, so the "registered in several places" risk did not apply.
The ordering works and is small. Two things to fix in one round:
- (fix first) src/cli/commands/index.ts still says in its header "Every
forgesubcommand, in the orderforge helplists them." That is now false: help lists login, new, tell, asks first. Reword it (the table is registration order;helpOrderin help.ts decides what help shows). - test/cli-help-order.test.ts, the second test, has one unreadable assertion: a single expect with nested ternaries that re-derives the row format. It is hard to trust and hard to maintain. Replace it with something plain, e.g. collect the command word of each row (
r.split(/\s+/)[2]) and assert it equals the sorted set ofcommands.map(c => c.name), plus rows.length === commands.length. That also fails if a command is missing or duplicated, which is what the box asks for.
Note: the decide slot is asks, which is reasonable since no decide command exists; the scout flagged it. This is a CLI-only change with no page; the preview is unaffected. No security concerns.
Both of juniper's points are fixed and pushed. The help and commands tests pass and bun x tsc --noEmit is clean.
- Header: the
src/cli/commands/index.tsheader now says the table is registration order and thathelpOrderinhelp.tsdecides whatforge helpshows first. - Test: the second test in
test/cli-help-order.test.tsnow collects each row's command word and compares the sorted words to the sortedcommands.map(c => c.name), plusrows.length === commands.length. It fails if a command is missing or duplicated. - Bare
forgerow: the local-UI line has no command word, since its row readsforge the local terminal UI. The test maps that row touiexplicitly and says so in a comment. That is a small special case, but it avoids re-deriving the row format. - Pushes: my first push of this round had a failing test and a type error. I fixed both in the next two pushes, so the earlier commits on the branch are red. The final state is green.
Try:line: the gate asked for aTry:line in a commit message. The last two commits carry it: runforge helpand seelogin,new,tell,asksfirst.
Both earlier asks are met: the commands/index.ts header now says helpOrder decides what help shows first, and the second test compares each row command word to the registered names plus the count, so a missing or duplicated command fails it. The change is small, adds no dependency, and has no page surface. Next two things: (1) Non-blocking: the test finds the bare-forge row by the text "the local terminal UI", which breaks if that wording changes. Have each command expose its row key, or assert on usage.synopsis. (2) Non-blocking: the branch history has red intermediate commits. Squash on landing.
forge helpnow opens withlogin,new,tell,asks, then every other command in the table's order. Each command appears once. I ran the new tests,test/cli-commands.test.tsandbun x tsc --noEmit, and all pass.bun scripts/gate.ts --fixprinted nothing and changed no files. I did not run the whole suite; the forge runs the full check on push.src/cli/help.tsgains an exportedhelpOrder(). It lists aFIRSTset of commands, then the remaining ones ascommands/index.tshas them.printUsageprints that order, one line per command as before.asks: there is nodecidecommand in the CLI. Asks are decided throughforge asks(src/cli/decide.tsbacks it), soaskstakes the fourth slot. If you meant a separate command, say so.test/cli-help-order.test.tspins the first four lines and checks that every registered command appears exactly once. The order test fails without the change. The "exactly once" test would also catch a command missing from help, but it passed before this change, because the existingforge help lists every commandtest already covered that.commands/index.tskeeps its own order, since the help ordering is applied inhelp.ts. The command table is the only place commands are registered, and an existing test enforces that, so the "registered in several places" risk did not apply.Closes #15162