cli: new, init and upgrade parse with std/cli (step 4 of #124) #568
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 4 of #124 (
torbparses its command line withstd/cli). Steps 2 (#502, PR #521) and 3 (#550, PR #556, landed asb471d025) are onmain:compiler/src/cli/declaration.trbdeclarescheck,build,run,test,manifest,ir,natives,parse,tokens,astandhighlight, andmain.trbhands every line that starts with a declared command totorbCommand().parse(...). This step moves the commands that scaffold or replace the toolchain:new,initandupgrade. They read their options throughnewOptionsOf,initOptionsOf(both onscaffoldChoicesOfincompiler/src/cli/template.trb) andupgradeOptionsOf, all inmain.trb.Source
compiler/src/cli/declaration.trb,compiler/src/main.trb(the arms["new", ...],["init", ...],["upgrade", ...],newOptionsOf,initOptionsOf,upgradeOptionsOf),compiler/src/cli/template.trb(scaffoldChoicesOf,ScaffoldChoices,ciValues,licenseValues,scaffoldFlags),compiler/src/cli/usage.trb(theirCommandUsageblocks)Design (decided by the loop, internal)
torbCommand()anddeclaredCommands();main.trbgets one morematch parsed.pathcase each, callingrunNew,runInitandrunUpgradeas today. The work stays inmain.trb(Resultwith?).new <path>: options--template <name|url>,--name,--owner,--ci <github|forgejo|both|none>,--license <mit|apache-2.0|none>,--git/--no-git(a pair,Nonewhen neither is given),--yes,--offline.--ciand--licensevalues are checked againstciValuesandlicenseValues(aStringoption with the check in the reader, or anArgumenttype; the loop's choice for the worker is the reader check, which keeps the messages ofscaffoldChoicesOf).inithas the same options and no path; a path is a wrong line.upgrade [<version>] --channel <name> --list:versionoptional positional,--channelan optional option,--lista flag.scaffoldChoicesFrom(input): Result<ScaffoldChoices, String>indeclaration.trbreplacesscaffoldChoicesOf's flag loop fornewandinit;scaffoldChoicesOfandscaffoldFlagsgo oncecompiler/tests/template.test.trb("scaffoldChoicesOf" group) is rewritten to argument lists through the declaration. The interactive questions,ScaffoldChoicesand the scaffolding itself are untouched.CliErrorpath of #502 (exit 2, message names command and argument).--versionstays the special case it is.CommandUsageblocks leavecli/usage.trb;torb --helplists them throughdeclaredUsageLines()(flags intorb <command> --help, which must list every flag the old block listed, including the accepted--ciand--licensevalues).repl(sandboxSettingsOfwith its pattern and module validation) is not part of this step; it moves to the tooling-commands step.Acceptance criteria
torb new,initandupgradeparse their command line withstd/clithroughtorbCommand(); every flag and argument each has today is accepted with the same meaning and listed intorb <command> --help.torb newwithout a path,torb initwith a path, an unknown flag, a missing option value,--ci gitlaband--license gplexit 2 with a message that names the command and the argument;torb upgrade --channelwithout a name exits 2.--gitand--no-gitstill giveSome(true)andSome(false), neither givesNone;torb upgradewithout arguments still means "latest of the current channel".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 three commands.compiler/tests/(extendcli-declaration.test.trb;template.test.trbandnew.test.trbmove with their command): argument lists per command, parsed values,--help, wrong lines.CommandUsageblocks,newOptionsOf,initOptionsOf,upgradeOptionsOfand the deadscaffoldChoicesOfloop are removed; no dead code left behind (refuseUnknownFlagstays while a remaining arm uses it).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 new, init and upgrade parse their command line with std/cliand, if needed,docs(cli): ...(CLI.md status line for step 4; 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 and for padded expected-output lines; keep lines short and compute help text fromCommand.helpbefore editing.expectedfiles.Dependencies
None open (#502 and #550 landed,
mainCI green). 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) #124[loop:torbscript] claim implement by session:loop-torbscript-20261029 until 2026-10-29T12:46Z
[loop:torbscript] implement checkpoint: read the spec and the code (declaration.trb, main.trb, template.trb, usage.trb, tests). Worktree code/wt/torbscript-language-568, branch loop/568-cli-new-init-upgrade (from main). Next: edit declaration.trb/main.trb/usage.trb/template.trb and the tests, push, open PR, wait for CI.
[loop:torbscript] implement checkpoint: PR #571 open (branch loop/568-cli-new-init-upgrade, worktree code/wt/torbscript-language-568). Waiting for tier A in forge CI; next: fix rounds on the same branch if red.
torbparses its command line withstd/cli(CLI slice 2) #124[loop:torbscript] implement: #571, CI pending (first push failed the bootstrap on a parse error in
Ok InitOptions choices, fixed asOk InitOptions(choices)and force-pushed to the loop branch as77d10d51, checks queued 30+ min), worker usage ~600k tokens, next: waiting (CI tier A result, then merge gate: argus review requested)[loop:torbscript] claim fix by session:loop-torbscript-20261029 until 2026-10-29T14:36Z
[loop:torbscript] review (checkpoint): tier A on
77d10d51was red only informat --check(compiler/src/cli/declaration.trb, compiler/tests/cli-declaration.test.trb would change; all other gates in that lane green,gatesred as the aggregate). Fixed withtorb formaton both files, pushed6b5c737b(chore(cli): torb format layout of the new, init and upgrade declarations, check-commits green, no rebase). Forge CI on6b5c737bis queued (runs 2265/2266 waiting behind other PRs' runs since ~10:46, none started at 11:40), so the verdict is still open. Next: wait for CI, then re-request review from argus once green. Tokens: ~60k.