cli: ir, manifest, parse, tokens, ast, highlight and natives parse with std/cli (step 3 of #124) #550
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Step 3 of #124 (
torbparses its command line withstd/cli). Step 2 (#502, PR #521) landed:compiler/src/cli/declaration.trbholds the command tree forcheck,build,runandtest, andmain.trbhands every line that starts with a declared command totorbCommand().parse(...). This step moves the commands whose command line is only flags and paths and that have no option reader of their own:ir,manifest,parse,tokens,ast,highlight,natives. (new,init,upgradeandreplread options throughnewOptionsOf,initOptionsOf,upgradeOptionsOfandsandboxSettingsOf; they are the next step.)Source
compiler/src/cli/declaration.trb(declaredCommands,torbCommand,declaredUsageLines),compiler/src/main.trb(the arms["manifest", ...],["ir", ...],["natives", "--header", ...],["parse", ...],["tokens", path],["ast", path],["highlight", ...];refuseUnknownFlag),compiler/src/cli/usage.trb(theirCommandUsageblocks)Design (decided by the loop, internal)
torbCommand()and todeclaredCommands(); the existing arm[first, ...more] if declaredCommands().contains(first)parses once and gets one morematch parsed.pathcase per command, calling the same functions as today (runManifest,printIr,writeNativesHeader,checkSyntax,printTokens,printTree,runHighlight).manifest [paths...] --check;ir [paths...] --statistics --no-ownership --bytecode --debug;natives --header [directory];parse <paths...>;tokens <file>,ast <file>;highlight <file>or--stdin. A linetokens/astwith no file, or with more than one, is a wrong line (exit 2, message names command and argument);torb nativeswithout--headerstays a wrong line.CliErrorpath of #502 (error: torb <cmd>: ..., seetorb --help``);refuseUnknownFlagandreportUnknownFlagstay while a remaining arm uses them and go with the last user.CommandUsageblocks leavecli/usage.trb;torb --helplists the commands throughdeclaredUsageLines()(flags intorb <command> --help).--versionstays the special case it is.run { _ => }no-op handlers of #502 are the pattern for the declaration; the work stays inmain.trb(Resultwith?, top-level tasks).Acceptance criteria
torb ir,manifest,parse,tokens,ast,highlightandnativesparse their command line withstd/clithroughtorbCommand(); every flag and argument each has today is still accepted with the same meaning and listed intorb <command> --help.torb highlight --stdinstill reads the source from standard input;torb natives --header [directory]still defaults to../runtime;irandmanifeststill default to..tokens,ast,highlight,nativeswithout--header) exits 2 and the message names the command and the argument.new,init,upgrade,repl,format,docs ...,add, ...) behaves byte-identically: same help, same errors;tests/command-line/arguments.expectedandtests/test-report/arguments.expectedchange only on the lines of the seven commands.compiler/tests/(extendcli-declaration.test.trb): argument lists per command, parsed values,--help, wrong lines.CommandUsageblocks and the arms' own flag handling are removed; no dead code left behind.Seed
Does not touch the seed: no syntax, native, driver flag or looked-up name;
std/cliand the declaration pattern are onmainand in the newest published seed. The two-commit seed rule does not apply. If tier A cannot compile it, stop and comment on this issue, do not force it.Size
One PR, two Conventional Commits at most:
feat(cli): torb ir, manifest, parse, tokens, ast, highlight and natives parse their command line with std/cliand, if needed,docs(cli): ...(CLI.md status line for step 3; regenerateskills/if docs change). Checks:torb format --checkon touched files, tier A in forge CI viaci-wait.sh; no local bootstrap. Note for the worker: #502 needed fix rounds for 120-column formatting of the declaration and for colored/padded expected-output lines; keep lines short and compute help text fromCommand.helpbefore editing.expectedfiles.Dependencies
None open (#502 landed in
da964275, CI green on that commit). Blocks the next step of #124.Part of #124 (the PR says
Refs #124, notCloses).torbparses its command line withstd/cli(CLI slice 2) #124torbparses its command line withstd/cli(CLI slice 2) #124torbparses its command line withstd/cli(CLI slice 2) #124[loop:torbscript] claim implement by session:loop-torbscript-20261028 until 2026-10-28T22:42:53Z
[loop:torbscript] implement:
torb manifest,ir,natives,parse,tokens,astandhighlightnow parse withstd/cli(declarations, readers and tests incompiler/src/cli/declaration.trb, dispatch inmain.trb, the oldCommandUsageblocks removed,tools/command-line.shextended, docs regenerated). PR #551 (Refs #124, #550). Forge CI green on4b4f8bde: commit messages, gates (bootstrap, tier A, tier B, release-sync/registry, same-C, playground) and pdisc. One behaviour change:torb natives --header a bnow refusesbinstead of ignoring it. next: review[loop:torbscript] review: PR #551 landed on
mainas6a8bb0199b;mainCI on that commit is still running, next: waiting (main CI on the landed commit, then close with the commit link)[loop:torbscript] claim main-ci-fix by session:loop-torbscript-20261028 until 2026-10-28T21:06:00Z
[loop:torbscript] main-ci-fix checkpoint: cause found. Run 2113 job
tier B (linux-x64)fails in the conformance suite: 19 programs over their allocation budget (e.g. absolute-path-form 155 vs 30, file-atomic-replace 1615 vs 326), nothing else red. The cause is the Into change of std/fs (4398f186b, #549), whose PR did not run tier B (std/-only); the main runs of877b4bdf0and9e7746636were cancelled by the next push, so the first finished tier B on a commit with that change is6a8bb0199. Real regression of the budgets, not flaky. Fix PR #556 (the 19 .allocations files set to the CI-reported counts); waiting for its CI.[loop:torbscript] main-ci-fix: finding: main run 2113 (
6a8bb0199), jobtier B (linux-x64)failed in the conformance suite step: 19 of 335 programs over their allocation budget (absolute-path-form 155 vs 30, file-atomic-replace 1615 vs 326, files 182 vs 78, resource-missing 504 vs 217, io-eight-files +174, ...), all other steps green. Cause: refactor(fs)4398f186b(#549, Into for every path parameter of std/fs) makes each std/fs call build a Path, so programs that call std/fs allocate more. #549 touched only std/ + docs, so its PR run skipped tier B; the main runs of877b4bdf0and9e7746636(#544) started tier B but were cancelled by the next push (concurrency), so the first finished tier B on a commit with the change is6a8bb0199(it ran because #551 touched tools/). A real regression of the budgets, not flaky, not an interaction of #544/#551. Did: branch loop/550-main-ci-fix, one commit test(conformance) setting the 19 .allocations files to the counts CI printed (tests data only), PR #556 (Refs #550). Its PR run (2168) skips tier B by design (tests/ only), so the verification is tier B of the main run after landing; the PR run was still queued for a runner on tier A at 19:51Z (commit messages, scope, runners, bootstrap green). Worker usage: none (done inline). Open: making the Into conversion cheaper and a tier B scope covering std/ are follow-ups, not filed. next: waiting (PR #556 review by argus / main CI re-run on the landed commit)std/json-schema:$id,$ref,$defs,$anchorand a registry of supplied documents (step 2a of #80) #553[loop:torbscript] close: PR #556 is merged (
b471d025); closing #550 needsmainCI green on the landed commit, its push run is still pending. next: waiting (main CI green onb471d025, then close #550)[loop:torbscript] close: PR #556 landed as
b471d025(b471d025) and main CI is green on38d3edd4(38d3edd4ab), which contains it. Closing.new,initandupgradeparse withstd/cli(step 4 of #124) #568torbparses its command line withstd/cli(CLI slice 2) #124torbparses its command line withstd/cli(CLI slice 2) #124