feat(cli): torb manifest, ir, natives, parse, tokens, ast and highlight use std/cli #551

Merged
argus merged 2 commits from loop/550-cli-std-cli-step3 into main 2026-10-28 18:21:27 +00:00
Collaborator

What

torb manifest, ir, natives, parse, tokens, ast and highlight parse their command line with std/cli through torbCommand() (step 3 of #124, the same pattern as #502 / #521). Closes nothing: Refs #124, implements #550.

  • compiler/src/cli/declaration.trb: seven more command blocks, declaredCommands() lists them, and small readers (manifestOptionsFrom, irOptionsFrom, nativesDirectoryFrom, parsePathsFrom, singleFileFrom, highlightSourceFrom) turn the parsed Input into what main.trb calls as before (runManifest, printIr, writeNativesHeader, checkSyntax, printTokens, printTree, runHighlight).
  • compiler/src/main.trb: the seven hand-written arms and their flag handling are gone; match parsed.path gets one case per command. refuseUnknownFlag stays (still used by repl, debug, upgrade, new, init).
  • compiler/src/cli/usage.trb: the seven CommandUsage blocks are removed; torb --help lists the commands through declaredUsageLines(), flags are in torb <command> --help.
  • Wrong lines exit 2 and name command and argument: unknown flag (error: torb ir: unknown flag '--frobnicate', see torb ir --help``), tokens/ast without or with more than one file, natives without --header, parse without a path, highlight with neither file nor --stdin.
  • One behavior change beyond the message text: torb natives --header a b refuses b instead of silently ignoring it.
  • tests/command-line/arguments.expected changes only on the lines of the seven commands (three message lines, five new wrong lines in tools/command-line.sh); tests/test-report/arguments.expected is untouched.
  • Docs: CLI.md status/slice table and docs/standard-library/cli.md, skills/ regenerated (second commit).

Does not touch the seed (no syntax, native, driver flag or looked-up name), so the two-commit seed rule does not apply.

Test

  • torb format --check on the four touched .trb files: clean.
  • torb check compiler/src/main.trb compiler/tests/cli-declaration.test.trb: 299 files, no problems.
  • torb test compiler/tests/cli-declaration.test.trb (installed nightly toolchain, VM): 38 passed, 0 failed (new groups per command: argument lists, parsed values, --help, wrong lines).
  • torb docs skill docs skills --check: up to date. tools/check-commits.sh origin/main HEAD: clean.
  • Gates, tools/command-line.sh and tier A run in forge CI.

Refs #124
Refs #550

## What `torb manifest`, `ir`, `natives`, `parse`, `tokens`, `ast` and `highlight` parse their command line with `std/cli` through `torbCommand()` (step 3 of #124, the same pattern as #502 / #521). Closes nothing: `Refs #124`, implements #550. - `compiler/src/cli/declaration.trb`: seven more `command` blocks, `declaredCommands()` lists them, and small readers (`manifestOptionsFrom`, `irOptionsFrom`, `nativesDirectoryFrom`, `parsePathsFrom`, `singleFileFrom`, `highlightSourceFrom`) turn the parsed `Input` into what `main.trb` calls as before (`runManifest`, `printIr`, `writeNativesHeader`, `checkSyntax`, `printTokens`, `printTree`, `runHighlight`). - `compiler/src/main.trb`: the seven hand-written arms and their flag handling are gone; `match parsed.path` gets one case per command. `refuseUnknownFlag` stays (still used by `repl`, `debug`, `upgrade`, `new`, `init`). - `compiler/src/cli/usage.trb`: the seven `CommandUsage` blocks are removed; `torb --help` lists the commands through `declaredUsageLines()`, flags are in `torb <command> --help`. - Wrong lines exit 2 and name command and argument: unknown flag (`error: torb ir: unknown flag '--frobnicate', see `torb ir --help``), `tokens`/`ast` without or with more than one file, `natives` without `--header`, `parse` without a path, `highlight` with neither file nor `--stdin`. - One behavior change beyond the message text: `torb natives --header a b` refuses `b` instead of silently ignoring it. - `tests/command-line/arguments.expected` changes only on the lines of the seven commands (three message lines, five new wrong lines in `tools/command-line.sh`); `tests/test-report/arguments.expected` is untouched. - Docs: CLI.md status/slice table and `docs/standard-library/cli.md`, `skills/` regenerated (second commit). Does not touch the seed (no syntax, native, driver flag or looked-up name), so the two-commit seed rule does not apply. ## Test - `torb format --check` on the four touched `.trb` files: clean. - `torb check compiler/src/main.trb compiler/tests/cli-declaration.test.trb`: 299 files, no problems. - `torb test compiler/tests/cli-declaration.test.trb` (installed nightly toolchain, VM): 38 passed, 0 failed (new groups per command: argument lists, parsed values, `--help`, wrong lines). - `torb docs skill docs skills --check`: up to date. `tools/check-commits.sh origin/main HEAD`: clean. - Gates, `tools/command-line.sh` and tier A run in forge CI. Refs #124 Refs #550
The seven commands join the declaration of `check`, `build`, `run` and `test`: their command lines are read by
`torbCommand()`, `torb <command> --help` is generated, and a wrong line (unknown flag, `tokens` or `ast` without
or with more than one file, `natives` without `--header`, `parse` without a path, `highlight` without a file or
`--stdin`) names command and argument and exits 2. The hand-written usage blocks and flag handling are gone.
`torb natives --header` refuses a second directory instead of ignoring it.

Refs #124, #550
docs(cli): torb manifest, ir, natives, parse, tokens, ast and highlight use std/cli
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 11s
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 2m37s
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 14m12s
ci / tier A (linux-x64) (pull_request) Successful in 27m58s
ci / pack the seed (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m55s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m33s
ci / every host emits the same C (pull_request) Successful in 5m15s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
4b4f8bdeae
Refs #124, #550
argus approved these changes 2026-10-28 18:21:26 +00:00
argus left a comment

$Review of 4b4f8bd - approved.\n\n- Tests: ok. cli-declaration.test.trb adds groups per command (defaults, parsed values, wrong lines, --help). CI green on this head (gates, tier A/B, bootstrap linux-x64, pdisc, commit messages); tools/command-line.sh expectations updated for the 3 changed messages and 5 new wrong lines.\n- Correctness: ok. Defaults preserved (manifest/ir -> ".", natives -> "../runtime", ownership pass unless --no-ownership); wrong lines exit 2 naming command and argument; the removed hand-written arms have matching cases in match parsed.path. The natives --header a b refusal is the one behavior change and is stated in the PR body.\n- Scope: ok. Step 3 of #124 / #550, same pattern as #502/#521; no seed change.\n- Security/secrets, data: ok, nothing touched.\n- Docs: ok. CLI.md, std/cli doc and regenerated skill copy updated.\n- Architecture/placement/release: n/a, no boundary change, no post-merge steps.\n\nNon-blocking: none.

$Review of 4b4f8bd - approved.\n\n- Tests: ok. cli-declaration.test.trb adds groups per command (defaults, parsed values, wrong lines, --help). CI green on this head (gates, tier A/B, bootstrap linux-x64, pdisc, commit messages); tools/command-line.sh expectations updated for the 3 changed messages and 5 new wrong lines.\n- Correctness: ok. Defaults preserved (manifest/ir -> ".", natives -> "../runtime", ownership pass unless --no-ownership); wrong lines exit 2 naming command and argument; the removed hand-written arms have matching cases in `match parsed.path`. The `natives --header a b` refusal is the one behavior change and is stated in the PR body.\n- Scope: ok. Step 3 of #124 / #550, same pattern as #502/#521; no seed change.\n- Security/secrets, data: ok, nothing touched.\n- Docs: ok. CLI.md, std/cli doc and regenerated skill copy updated.\n- Architecture/placement/release: n/a, no boundary change, no post-merge steps.\n\nNon-blocking: none.
argus merged commit 6a8bb0199b into main 2026-10-28 18:21:27 +00:00
argus deleted branch loop/550-cli-std-cli-step3 2026-10-28 18:21:27 +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!551
No description provided.