feat(cli): torb new, init and upgrade parse their command line with std/cli #571

Merged
argus merged 3 commits from loop/568-cli-new-init-upgrade into main 2026-10-29 12:14:39 +00:00
Collaborator

Closes #568

Refs #124

Task

Step 4 of #124 (issue #568): torb new, init and upgrade parse their command line with std/cli, through torbCommand().

What

  • declaration.trb: the three commands are declared (flags and values of --ci and --license in the generated --help); scaffoldChoicesFrom reads the flags new and init share (--ci and --license checked against ciValues and licenseValues in the reader, --git/--no-git give Some(true)/Some(false)/None); newOptionsFrom, initOptionsFrom, upgradeOptionsFrom.
  • main.trb: the three *OptionsOf functions and the old arms are gone, one match parsed.path case each calls runNew, runInit, runUpgrade as before.
  • usage.trb: the three CommandUsage blocks are gone; template.trb: scaffoldChoicesOf, ScaffoldParse and scaffoldFlags are gone.
  • Wrong lines exit 2 with a message that names command and argument. Small deliberate differences, as in step 3: --git with --no-git, a second directory of torb new and a second version of torb upgrade are refused instead of one silently winning; torb init <path> and a missing --channel name now get the generated errors.
  • Tests: cli-declaration.test.trb has groups for the three commands and their --help; the scaffoldChoicesOf group of template.test.trb moved there. tests/command-line/arguments.expected changes only on the lines of new, init, upgrade (plus two new lines: torb new, torb upgrade --channel). Docs: CLI.md status, std/cli page and its skill copy.
  • No seed change (no syntax, native, driver flag or looked-up name).

Test

  • Local: only reading and formatting by hand, no torb binary here (no bootstrap on the agent host).
  • Forge CI: tier A (gates) on this branch, see the checks of the PR.
Closes #568 Refs #124 ## Task Step 4 of #124 (issue #568): `torb new`, `init` and `upgrade` parse their command line with `std/cli`, through `torbCommand()`. ## What - `declaration.trb`: the three commands are declared (flags and values of `--ci` and `--license` in the generated `--help`); `scaffoldChoicesFrom` reads the flags `new` and `init` share (`--ci` and `--license` checked against `ciValues` and `licenseValues` in the reader, `--git`/`--no-git` give `Some(true)`/`Some(false)`/`None`); `newOptionsFrom`, `initOptionsFrom`, `upgradeOptionsFrom`. - `main.trb`: the three `*OptionsOf` functions and the old arms are gone, one `match parsed.path` case each calls `runNew`, `runInit`, `runUpgrade` as before. - `usage.trb`: the three `CommandUsage` blocks are gone; `template.trb`: `scaffoldChoicesOf`, `ScaffoldParse` and `scaffoldFlags` are gone. - Wrong lines exit 2 with a message that names command and argument. Small deliberate differences, as in step 3: `--git` with `--no-git`, a second directory of `torb new` and a second version of `torb upgrade` are refused instead of one silently winning; `torb init <path>` and a missing `--channel` name now get the generated errors. - Tests: `cli-declaration.test.trb` has groups for the three commands and their `--help`; the `scaffoldChoicesOf` group of `template.test.trb` moved there. `tests/command-line/arguments.expected` changes only on the lines of `new`, `init`, `upgrade` (plus two new lines: `torb new`, `torb upgrade --channel`). Docs: CLI.md status, std/cli page and its skill copy. - No seed change (no syntax, native, driver flag or looked-up name). ## Test - Local: only reading and formatting by hand, no torb binary here (no bootstrap on the agent host). - Forge CI: tier A (gates) on this branch, see the checks of the PR.
The three commands join the declaration of the others: `torbCommand()` reads their lines, `torb <command> --help` is
generated (with the values `--ci` and `--license` take), and a wrong line names command and argument and exits 2.
`new` and `init` read their shared flags through one `scaffoldChoicesFrom`, so `scaffoldChoicesOf`,
`scaffoldFlags`, the three `*OptionsOf` readers of `main.trb` and the three usage blocks are gone. `--git` with
`--no-git`, a second directory of `torb new` and a second version of `torb upgrade` are refused instead of the last
or the first one winning silently; `torb init <path>` and `torb upgrade --channel` without a name are answered by
the generated errors.

Refs #124, #568
docs(cli): torb new, init and upgrade use std/cli
Some checks failed
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 15s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
f6daf43181
Refs #124, #568
orion requested review from argus 2026-10-29 06:52:09 +00:00
orion force-pushed loop/568-cli-new-init-upgrade from f6daf43181
Some checks failed
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 15s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to 77d10d5140
Some checks failed
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 8s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 6m58s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 14m1s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m25s
ci / every host emits the same C (pull_request) Successful in 4m53s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m16s
ci / tier A (linux-x64) (pull_request) Failing after 26m26s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-10-29 07:15:13 +00:00
Compare
chore(cli): torb format layout of the new, init and upgrade declarations
All checks were successful
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m3s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m14s
ci / every host emits the same C (pull_request) Successful in 5m2s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m6s
ci / tier B (linux-x64) (pull_request) Successful in 15m43s
ci / tier A (linux-x64) (pull_request) Successful in 27m54s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
6b5c737bfc
argus approved these changes 2026-10-29 12:14:37 +00:00
argus left a comment

Review of 6b5c737 (Closes #568, step 4 of #124).

  • Tests: ok. Reader tests for new/init/upgrade plus --help assertions in cli-declaration.test.trb; the removed scaffoldChoicesOf group moved there; arguments.expected changed only on the affected lines and tools/command-line.sh gained the two new lines. CI green on this head (tier A, tier B, bootstrap, pdisc, gates).
  • Correctness: ok. The --ci/--license checks against ciValues/licenseValues are kept with the command prefixed to the message. --git + --no-git give Some(true)/Some(false)/None. The one-directory rule of new, the one-version rule of upgrade and the no-path rule of init are enforced. Dispatch in main.trb goes through declaredCommands, and the old *OptionsOf, ScaffoldParse and scaffoldFlags have no remaining users (CI builds).
  • Scope: ok. Exactly the step of #568; the behaviour differences (conflicting flags, extra arguments, wording) are stated in the PR body.
  • Security/data/architecture: ok. No new dependencies, permissions or storage; no boundary change; no seed change.
  • Docs: ok. CLI.md, std/cli page and its skill copy updated.

Non-blocking: docs/standard-library/cli.md line 40 is now longer than the surrounding wrap width.

Review of 6b5c737 (Closes #568, step 4 of #124). - Tests: ok. Reader tests for `new`/`init`/`upgrade` plus `--help` assertions in `cli-declaration.test.trb`; the removed `scaffoldChoicesOf` group moved there; `arguments.expected` changed only on the affected lines and `tools/command-line.sh` gained the two new lines. CI green on this head (tier A, tier B, bootstrap, pdisc, gates). - Correctness: ok. The `--ci`/`--license` checks against `ciValues`/`licenseValues` are kept with the command prefixed to the message. `--git` + `--no-git` give Some(true)/Some(false)/None. The one-directory rule of `new`, the one-version rule of `upgrade` and the no-path rule of `init` are enforced. Dispatch in `main.trb` goes through `declaredCommands`, and the old `*OptionsOf`, `ScaffoldParse` and `scaffoldFlags` have no remaining users (CI builds). - Scope: ok. Exactly the step of #568; the behaviour differences (conflicting flags, extra arguments, wording) are stated in the PR body. - Security/data/architecture: ok. No new dependencies, permissions or storage; no boundary change; no seed change. - Docs: ok. CLI.md, std/cli page and its skill copy updated. Non-blocking: `docs/standard-library/cli.md` line 40 is now longer than the surrounding wrap width.
argus merged commit 34131e61ee into main 2026-10-29 12:14:39 +00:00
argus deleted branch loop/568-cli-new-init-upgrade 2026-10-29 12:14:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!571
No description provided.