cli: torb completions <shell> #807

Closed
opened 2026-11-15 01:47:37 +00:00 by orion · 5 comments
Collaborator

Goal

torb completions <shell> prints the completion script of torb for bash, zsh, fish or PowerShell, generated from the declaration of torb itself (torbCommand() in compiler/src/cli/declaration.trb) by Command.completion of std/cli. This is the compiler half of CLI slice 3; the std/cli half landed in #125 (PR #785).

Requirements

  • R1. When a user runs torb completions <shell> with bash, zsh, fish or powershell, the compiler shall print torbCommand().completion(<Shell>) to standard output and exit 0, writing no file.
  • R2. If the shell name is missing or unknown, torb completions shall print the valid names to standard error and exit non-zero, through the usual std/cli error path.
  • R3. The completions subcommand shall be a declared command of torbCommand() with a positional shell argument, so it appears in torb --help and in its own completion script.
  • R4. The printed script of each shell shall equal the output of Command.completion for the current declaration (no second list of commands or flags).

Done when

  • A test in the compiler's CLI tests parses completions bash|zsh|fish|powershell and shows the declared command, and that an unknown shell is refused with the valid names.
  • A test compares the printed text for one shell with torbCommand().completion(...), and checks that the script lists completions itself.
  • docs/design/CLI.md slice 3 row and docs/standard-library/cli.md mention the subcommand as done; regenerated skills/.
  • sh tools/gates.sh a green in forge CI; tools/check-commits.sh clean; one Conventional Commit (feat(cli): torb completions <shell>).

Seed

The compiler imports std/cli through the seed. Shell and Command.completion exist in the seed only after a seed refresh that contains PR #785, so this issue cannot compile before that refresh. It adds no syntax, native or driver flag, and no std name looked up by string, so the two-commit rule does not apply: it is a single commit that uses the new API once the seed has it. The seed refresh itself stays Torben's (outside the loop).

Readiness

Not ready: held until a seed containing Command.completion is published. Set ready when seed/ (or the seed in use by the bootstrap) is refreshed past f823aa3f. Related: #124 (CLI slice 2, the declaration it extends; not blocking).

Source

Dependencies

  • Depends on #125 (std/cli completion scripts; landed in PR #785) and on a seed refresh (Torben's).
## Goal `torb completions <shell>` prints the completion script of `torb` for bash, zsh, fish or PowerShell, generated from the declaration of `torb` itself (`torbCommand()` in `compiler/src/cli/declaration.trb`) by `Command.completion` of `std/cli`. This is the compiler half of CLI slice 3; the `std/cli` half landed in #125 (PR #785). ## Requirements - R1. When a user runs `torb completions <shell>` with `bash`, `zsh`, `fish` or `powershell`, the compiler shall print `torbCommand().completion(<Shell>)` to standard output and exit 0, writing no file. - R2. If the shell name is missing or unknown, `torb completions` shall print the valid names to standard error and exit non-zero, through the usual `std/cli` error path. - R3. The `completions` subcommand shall be a declared command of `torbCommand()` with a positional `shell` argument, so it appears in `torb --help` and in its own completion script. - R4. The printed script of each shell shall equal the output of `Command.completion` for the current declaration (no second list of commands or flags). ## Done when - [ ] A test in the compiler's CLI tests parses `completions bash|zsh|fish|powershell` and shows the declared command, and that an unknown shell is refused with the valid names. - [ ] A test compares the printed text for one shell with `torbCommand().completion(...)`, and checks that the script lists `completions` itself. - [ ] `docs/design/CLI.md` slice 3 row and `docs/standard-library/cli.md` mention the subcommand as done; regenerated `skills/`. - [ ] `sh tools/gates.sh a` green in forge CI; `tools/check-commits.sh` clean; one Conventional Commit (`feat(cli): torb completions <shell>`). ## Seed The compiler imports `std/cli` through the seed. `Shell` and `Command.completion` exist in the seed only after a seed refresh that contains PR #785, so this issue cannot compile before that refresh. It adds no syntax, native or driver flag, and no std name looked up by string, so the two-commit rule does not apply: it is a single commit that uses the new API once the seed has it. The seed refresh itself stays Torben's (outside the loop). ## Readiness Not `ready`: held until a seed containing `Command.completion` is published. Set `ready` when `seed/` (or the seed in use by the bootstrap) is refreshed past f823aa3f. Related: #124 (CLI slice 2, the declaration it extends; not blocking). ## Source - [docs/design/CLI.md](https://git.torb.dev/torbscript/language/src/branch/main/docs/design/CLI.md) section 2 point 2 and section 3 slice 3 ## Dependencies - Depends on #125 (`std/cli` completion scripts; landed in PR #785) and on a seed refresh (Torben's).
Author
Collaborator

[loop:torbscript] intake: in scope (CLI slice 3, compiler half), no duplicate. The seed precondition is met: the nightly published seed 56ea5b416d on 2026-11-15, newer than PR #785 (f823aa3f, 2026-11-14), so Shell and Command.completion exist in the seed. Requirements and done criteria are complete and testable; one commit, no seed change of its own. decided by the loop: ready.
next: implement (ready)

[loop:torbscript] intake: in scope (CLI slice 3, compiler half), no duplicate. The seed precondition is met: the nightly published seed 56ea5b416df5 on 2026-11-15, newer than PR #785 (f823aa3f, 2026-11-14), so `Shell` and `Command.completion` exist in the seed. Requirements and done criteria are complete and testable; one commit, no seed change of its own. decided by the loop: ready. next: implement (ready)
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-807-impl until 2026-11-16T02:35:00Z

[loop:torbscript] claim implement by session:loop-torbscript-807-impl until 2026-11-16T02:35:00Z
Author
Collaborator

[loop:torbscript] release implement: #825

One commit feat(cli): torb completions <shell>, Argus requested. tools/check-commits.sh is clean. Not verified: build, format, tests and tools/gates.sh a (CI only, result unknown); the skills/ copy of cli.md is hand-mirrored, not regenerated; the book session satisfying command-pages.test.trb is checked by inspection only.

[loop:torbscript] release implement: https://git.torb.dev/torbscript/language/pulls/825 One commit `feat(cli): torb completions <shell>`, Argus requested. `tools/check-commits.sh` is clean. Not verified: build, format, tests and `tools/gates.sh a` (CI only, result unknown); the `skills/` copy of `cli.md` is hand-mirrored, not regenerated; the book session satisfying `command-pages.test.trb` is checked by inspection only.
Author
Collaborator

[loop:torbscript] claim implement by loop-torbscript-807-fix until 2026-11-16T04:40:23Z

[loop:torbscript] claim implement by loop-torbscript-807-fix until 2026-11-16T04:40:23Z
Author
Collaborator

[loop:torbscript] release implement: fixed red CI on PR #825 (dd0d1a6b)

Cause: ci / tier A (linux-x64) failed only in the format --check gate (2 of 1780 files would change: compiler/src/cli/declaration.trb, compiler/tests/cli-declaration.test.trb); every other tier A gate was green. ci / gates is the aggregate job that failed because of it.

Fix: fix(cli): format the completions declaration and its test. Ok(torbCommand().completion(shell)) becomes Ok torbCommand().completion(shell), and assert x == false gets its parentheses. The formatter of this PR's CI-built torb was run on the two files outside the gateway (format --check now lists 0 files); tools/check-commits.sh origin/main HEAD is clean. No local build or gate run; CI reruns on the new head.

next: waiting (CI on dd0d1a6b, then the merge gate)

[loop:torbscript] release implement: fixed red CI on PR #825 (dd0d1a6b) Cause: `ci / tier A (linux-x64)` failed only in the `format --check` gate (2 of 1780 files would change: `compiler/src/cli/declaration.trb`, `compiler/tests/cli-declaration.test.trb`); every other tier A gate was green. `ci / gates` is the aggregate job that failed because of it. Fix: `fix(cli): format the completions declaration and its test`. `Ok(torbCommand().completion(shell))` becomes `Ok torbCommand().completion(shell)`, and `assert x == false` gets its parentheses. The formatter of this PR's CI-built `torb` was run on the two files outside the gateway (`format --check` now lists 0 files); `tools/check-commits.sh origin/main HEAD` is clean. No local build or gate run; CI reruns on the new head. next: waiting (CI on dd0d1a6b, then the merge gate)
argus closed this issue 2026-11-16 01:38:14 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#807
No description provided.