M2 evidence: the command line
On this page
Date: 2026-11-17. Machine: macOS 26.3, Apple silicon, Node 22.17.1, npm 11.5.2.
Commits 4119897 to 09e886f, 141 commits, 58 of them the board's own (chore(board)),
then the commits that file this evidence and close CLA-12 and M2's epic.
The brief's proof for M2: "scripted lifecycles and golden files". It also asks that from here
on Clara's remaining work lives in its own .clara, worked as agent:claude with
review.mode set to gates, and that DECISIONS tells the maintainers to switch it to
human after launch.
Acceptance
| Check | Result |
|---|---|
| D4's commands, except the agent and planning commands | 50 commands, listed in docs/CLI.md, which is generated from the command table and checked by the docs gate |
| Scripted lifecycles pass | 31 tests in test/integration/cli-lifecycle.test.ts, listed below |
| Output for people pinned by golden files | 21 files in test/fixtures/cli/, compared byte for byte by test/integration/cli-golden.test.ts |
| Every operation that declares the CLI door has a command | test/unit/cli/commands.test.ts |
Every clara … hint names a command and flags that exist |
test/unit/cli/hints.test.ts |
| Library line coverage at least 90% | 98.96% lines, 96.09% branches |
clara list on 1,000 tickets under 200 ms |
101.8 ms warm, 159.8 ms on the first run; hosted CI 124.2 ms on Ubuntu, 151.6 ms on macOS, and 303.8 ms on Windows, where the limit is 400 ms (D-071) |
| D15 items that exist are tested | 34 tests in test/security/, listed below; docs/SECURITY-MODEL.md |
| Clara's remaining work is on its own board, reviewed by gates | .clara/, 46 tickets; D-043; the doctor gate runs on it |
DECISIONS tells the maintainers to switch to human after launch |
D-043, "For the maintainers" |
npm run ci exits 0 in a clean checkout |
yes, before every push, last at the commit that closes CLA-12 |
| Hosted CI on Linux, macOS, Windows and Bun | passed on all seven jobs at e8dc257, after a first run that failed on Windows; see Hosted CI |
Tests and coverage
$ npx vitest run --coverage
Test Files 81 passed (81)
Tests 2689 passed | 1 skipped (2690)
Statements : 98.35% ( 4896/4978 )
Branches : 96.09% ( 3102/3228 )
Functions : 98.96% ( 954/964 )
Lines : 98.96% ( 4101/4144 )
The gate covers library/, as the brief asks (90% of lines, 85% of branches). The CLI is not
in the gate. Measured once for this file, with the same suite:
$ npx vitest run --coverage --coverage.include='cli/**/*.ts'
Statements : 92.38% ( 1565/1694 )
Branches : 84.61% ( 1265/1495 )
Functions : 92.38% ( 279/302 )
Lines : 93.13% ( 1343/1442 )
The lowest are cli/custom.ts at 69% of branches and cli/output.ts at 75%. cli/main.ts,
which answers --version, asks questions at a terminal and hands process to run(), shows
0% because the suite calls run() in-process. It runs as a real program in the budgets, in
the package smoke test and in every command of the board loop below.
The one skipped test parses the fish completion script with fish, which is not installed here. CI's Linux jobs have the shells they test.
Lifecycles
test/integration/cli-lifecycle.test.ts drives the CLI the way a person and a script do: real
folders, real git where it matters, the exit codes and both output streams checked.
a ticket from idea to done
goes through every step a team takes, with the exit codes a script relies on
editing and undo
takes one acceptance criterion a flag, commas and all
puts the ticket file back byte for byte
archives and restores, and lists archived tickets only when asked
says when a list leaves out a ticket it cannot read, and opens that file to fix it
says which flag holds a bad value, and points at the command's help
takes numbers in plain digits, and says the plain form of another
shows how to keep text that starts with a dash, and the way shown works
says which tickets an unfinished archive leaves waiting, and how to go on
searches for every word on its own, in any case
says links in full, whatever form the target was given in
sprints, releases and views
plans a sprint and a release and shows them
output for scripts and terminals
prints only JSON on stdout with --json, and errors as JSON on stderr
colours a terminal, and never when NO_COLOR is set or output is a pipe
shows the control characters in what the board holds, and never sends them
colours with --color, even into a pipe or with NO_COLOR set
takes the actor from --as, then CLARA_ACTOR, then git, and an empty --as as none
opens a ticket in the editor only in a terminal, and prints its path otherwise
works from a folder below the board, and from -C
refuses a flag inside unquoted text, and records nothing anywhere (CLA-38)
config
reads and changes settings, and suggests the setting meant
refuses to write a mistyped setting, and doctor names one already written (CLA-39)
checks, trust and verify
runs nothing until the commands are trusted, then records a pass for the commit
asks again when a command changes, and forgets on revoke
says the checks approved the work when the board reviews by gates
records a failure, shows its output and exits 1, and complete stays refused
refuses to check a checkout with changes that are not committed
shows a command to trust whole, however long, with nothing in it hidden
has nothing to run on a board with no checks
git worktrees
shares the main checkout's board, and checks the worktree's own commit
will not set up a board from a worktree (CLA-33)
The first test starts with no board and walks two tickets through init, add, show,
claim, block, inbox, answer, comment, checkpoint, complete, approve, log and
doctor. It checks the exit code of each refusal a script relies on: 1 for an error such as
no board or no such ticket, 2 for a usage error such as a mistyped command, 3 for a rule such
as claiming held work or an agent approving its own. The tests after it cover edit, undo,
archive, restore and the rest.
Golden files
test/integration/cli-golden.test.ts builds one board "in the middle of a week" with a fixed
clock: an active sprint, a planned release, work in progress, a blocked ticket with a
question, work waiting for review, comments that mention someone, and an archived ticket. It
then compares what each command prints with a file in test/fixtures/cli/:
board.txt help-add.txt inbox.txt next.txt show-json.txt
complete-gates.txt help-sprint.txt list-filtered.txt release-show.txt show.txt
help-verify.txt help.txt list.txt search.txt sprint-list.txt
home.txt log.txt show-blocked.txt sprint-show.txt standup.txt
status.txt
A change in what Clara prints fails this test until the file is written again with
npx vitest run -u and the difference is read in the commit.
Security
Each D15 item that exists has tests in test/security/. What they protect, and what is not
built yet, is in docs/SECURITY-MODEL.md.
$ npx vitest run test/security --reporter=verbose
commands.test.ts
runs none of them in a fresh clone, whatever is typed, until a person trusts them
asks again when a pull changes a command, and runs nothing until then
counts setup commands as commands to trust
keeps the answer on this machine, never in the repository, and per checkout
never takes trust from the environment or from the repository
takes trust only from a person, never from an agent
paths.test.ts
refuses every id or name that is not one, at every command that takes one
takes a name made of file-name characters only, and says which
refuses a .clara that is a link, and writes nothing where it points
never reads or writes through a link inside .clara
terminal.test.ts
sends no control character from the board to the terminal, from any command
keeps the hostile text whole in --json, where a program reads it
sends no control character back from an argument, in an error or a confirmation
secrets.test.ts
keeps none of them in the board or the output, from a passing or a failing check
privacy.test.ts
notices a call when one is made, so an empty trap means something
makes none from any command, as a person or an agent, from setup to release
loads none of the modules that talk to the network
starts programs from four places only, each for a reason a person chose
asks git only what it can answer from the checkout, never a remote
supply-chain.test.ts
runs no script of its own when installed
pulls in no other package when installed
ships no native module, and loads none
is committed, and agrees with the manifest
pins every package to the npm registry by content hash
is installed in CI without running any package's install script
exist, so the checks below read something
pin every action to a full commit hash, named by its version
install tools at a version someone chose, never whatever is newest
read by default, and write only where a job needs it
give a pull request from a fork no token that can write, and run none of its code with one
pass what a stranger can type into a script through the environment, never inline
check out without keeping the token on disk
starts only when a person starts it
publishes with provenance, after every gate, from the version a person confirmed
Tests 34 passed (34)
The supply-chain tests were checked against weakened code: 13 weakenings of the workflows and the manifest, and four floating Bun versions, each caught (D-067).
Budgets
$ node scripts/budgets.mjs
node itself starts in 26.5 ms on this machine, and git config in 13.0 ms
Budget Measured Limit
clara --version cold start 31.2 ms 100 ms ok
Packed npm tarball 0.20 MB 3 MB ok
Board data for 10,000 tickets, warm 50.7 ms 500 ms ok
clara list on 1,000 tickets 101.8 ms 200 ms ok
clara list on 1,000 tickets, first run 159.8 ms 200 ms ok, reported: parses every file and writes the cache (D-042)
clara list runs the built dist/cli.js as its own process. The warm number is enforced; the
first run, which parses every ticket and writes the cache, is reported. Windows has a limit of
its own, 400 ms, set from the hosted CI's measurement there (D-071, CLA-13). The hosted
numbers for every system and the method are in docs/BENCHMARKS.md.
The package from an empty folder
$ node scripts/pack-smoke.mjs
clara --version -> 0.1.0
clara-pm --version -> 0.1.0
import { VERSION } from 'clara' -> 0.1.0
require('clara').VERSION -> 0.1.0
types -> ./dist/types/library/index.d.ts
clara/node types -> ./dist/types/library/node.d.ts
clara/node board on disk -> GEN-1 in_progress agent:claude
clara/schemas/ticket.schema.json -> Clara ticket
package smoke test passed
Clara on its own board
From the start of M2, Clara's remaining work has been tickets in this repository's .clara
(D-043). Every ticket was claimed, checkpointed, verified and completed as agent:claude
with the CLI built from the repository as it stood, and every step is a chore(board)
commit. With review.mode set to gates, clara complete was approved only after lint,
typecheck and the full test suite passed on the commit it names. The board while this file
was written, with CLA-12 in progress:
$ clara status
Clara (CLA)
Tickets (46)
backlog 8
todo 10
in progress 1
blocked 0
in review 0
done 27
Sprint none active
Review gates
Checks lint, typecheck, test
People sherwin-vishesh-jathanna, bharat
The 8 in the backlog are the epics of M4 to M11. The 10 in todo are M2's epic, which closes
with this file, M3's epic and M3's eight tickets, filed ahead.
Using Clara on itself found real problems that the tests had not:
- CLA-31: with
review.mode: gates,clara completesaid to wait for a reviewer after the checks had already approved the work. - CLA-32:
clara list -status:done, the waydocs/QUERY.mdsays to leave tickets out, was read as an unknown flag. - CLA-33:
clara initin a git worktree wrote the board into the main checkout.
Hosted CI
Started by hand when the milestone's work was done (D-028).
| Run | Commit | Result |
|---|---|---|
| 44197512471 | 1c128f5 |
Failed on Windows in 8 tests. Ubuntu on Node 22, 24 and 26, macOS and Bun passed. |
| 44199352044 | e8dc257 |
Passed on all seven jobs: Ubuntu on Node 22, 24 and 26, macOS and Windows on Node 24, Bun running the CLI, and the plan job. |
The second run's test totals: Ubuntu 2,688 passed and 2 skipped, macOS 2,689 and 1, Windows 2,685 and 5. Each skip is a test of something that system lacks: a shell to parse a completion script with (fish on macOS; fish and zsh on Ubuntu; all three on Windows), and on Windows the two tests of finding programs by POSIX file modes.
The Windows failure was the first time the CLI ran there. CLA-46 fixed it:
- A worktree on Windows did not find the trust its main checkout was given, because one path
was spelled with the system's short folder names and the other with the long ones. Trust
and the board cache now name a checkout by the system's own real path (
97dd809). - A check that timed out on Windows was never stopped: ending the shell left the program it
started holding the output, and
clara verifywaited for good. A timeout now ends the whole tree withtaskkill /t /f, and once a check's command has ended, the run waits at most a second more for output held by something it left running, and says so (1f21fa9, D-070). The same wait could catch a check on any system that leaves a server running. - Five tests in three files assumed POSIX paths and programs (
343a776), and a security test looked for a path in JSON text without reading the JSON, where Windows escapes its backslashes (97dd809).
The second run also measured clara list on 1,000 tickets on Windows at 303.8 ms, best of
15. CLA-13 set the Windows limit from it: 400 ms, enforced (D-071).
What was not verified
- The CLI is tested by calling
run()in-process with a recorded terminal. The built program runs in the budgets, the package smoke test and the board loop above, but no test runs every command from the installed tarball. Thee2egate is "not built yet" until M4 brings browser tests. - Bun: not installed on this machine. The
bunCI job runs the built CLI under Bun. release.ymlhas never run. Its dry run needs thenpmenvironment a person creates.- Agent CLIs other than Claude Code are not installed here; M2 runs none.
Fresh-eyes review
A subagent that had not written the CLI read it against the brief and tried to break it, each attempt a script in a throwaway repository. It was asked for the ten most serious problems with a repro for each, and gave ten, all reproduced. All ten are fixed, each with a regression test that fails without the fix.
| # | Problem | Severity | Fixed in |
|---|---|---|---|
| 1 | doctor --fix lost a ticket when two branches created the same number in the same second: the two looked like one ticket edited on both sides |
data loss | 9ecc6ee (CLA-36): the log decides, by counting created events for the id, and the lost one is matched by event id |
| 2 | --json, -q, --as and -C were taken out of unquoted free text: a comment lost words, was signed by someone else, or went to another board's ticket |
wrong actor, wrong board | 037f1f9 (CLA-38): a global flag inside the words of a text is refused, and nothing is recorded |
| 3 | What a check printed, secrets included, was kept in the committed activity log, for passing checks too | security (D15) | 5b31bf7, 94b007c (CLA-37, D-059): a passing check keeps no output; a failing one keeps its tail with secret values and token shapes hidden |
| 4 | clara config wrote a mistyped setting name (revew.mode), which then did nothing, and doctor called the board healthy |
wrong result | 58dbaad (CLA-39): a setting name Clara does not know is refused with the nearest one, and doctor names one already written |
| 5 | A ticket whose file could not be read was "not found" in show and open, and lists left it out without a word |
misleading error (C4.6) | 1e717cf: show says why it cannot be read; 5739345 (CLA-45, D-069): every list warns, and open opens the file to fix it |
| 6 | Archiving an unfinished dependency kept its dependents waiting for good, while docs/CLI.md said it counted as finished |
wrong result, doc mismatch | f22aa4a (CLA-40): the doc says what happens, and the warning names the tickets left waiting and how to go on |
| 7 | Text that starts with a dash, as in clara add "--help is broken", was an unknown flag, and the hint never mentioned -- |
misleading hint (C4.6) | ca1d848 (CLA-41): the hint shows the command with --, and that command works |
| 8 | A bad value was reported as ticket.create: due: must be a date, naming the operation's field, not the flag |
misleading hint (C4.6) | 0697e8b (CLA-42): the CLI names the flag and the command's help |
| 9 | After doctor renumbered a ticket, clara log kept its creation on the old number |
wrong result | fd703fa (CLA-43, D-065): the log follows the renumber |
| 10 | Number flags took JavaScript's other forms: --points 0x10 stored 16 |
surprise | c6cb475 (CLA-44, D-066): plain digits only, and the hint gives the plain form |
Found while closing the milestone, not by the review:
- An agent could grant trust to a board's commands with
clara trust --yes --as agent:claude. Fixed inb821f7f(D-068), and tested intest/security/commands.test.ts. - The Windows problems above, found by the first hosted run (CLA-46).
The reviewer also checked and did not report: path traversal through every name and id;
links inside .clara; eight concurrent claims (one wins, seven exit 3) and twenty parallel
adds (none lost); CRLF, BOM and unknown keys surviving an edit; query errors with a position;
valid --json everywhere with errors on stderr; every form of id; epic, parent and sprint
references; agents unable to approve their own work; the trust prompt without a terminal;
titles with YAML-special characters and escape codes; completion scripts that read only file
names.
One of the reviewer's probes printed this machine's environment, a real token among it, into a file in its own scratch folder outside the repository. The reviewer said so and deleted the folder. A search of the repository's whole history for GitHub, npm and Anthropic token shapes finds only the made-up ones the tests use.