# Test plan > **Plan quality: A** (92/100) — APPROVE > > Generated by trekplan v6.1.1 on 2026-10-06 — `plan_version: 1.9` · `ceremony: architectural` ## Context Why: the brief asks for a parser CLI. ## Design ### Architecture Two modules: a parser and a CLI on top of it. ### Data Flow CLI argv → parser → result JSON on stdout. ### Interfaces `parse(text) → {ok, items}` ### Data Models `Item = {name: string, n: number}` ### Error Handling Unreadable input → exit 2; invalid input → exit 1. ### Module Map ```mermaid graph TD cli[src/cli.mjs] --> parser[src/parser.mjs] parser --> util[src/util.mjs] ``` ### Architecture Rules | Rule | Enforced by | Proof | |------|-------------|-------| | The parser never imports the CLI | checked by `node_modules/.bin/depcruise --config .dependency-cruiser.cjs src` | Step 1 | | Prefer pure functions in the parser | advisory — `.claude/rules/parser.md` | — | ### Requirements Check No conflicts or gaps found between the brief's requirements. ## Implementation Plan ### Step 1: Build module 1 - **Files:** `src/mod1.mjs` - **Changes:** Add `run1()` to `src/mod1.mjs`. (new file) - **Test first:** - File: `tests/mod1.test.mjs` (new) - Verifies: run1() returns the value the next step reads - Pattern: `tests/lib/plan-schema.test.mjs` - **Verify:** `node --test tests/mod1.test.mjs` → expected: pass - **On failure:** revert — `git checkout -- src/mod1.mjs` - **Checkpoint:** `git commit -m "feat(x): step 1"` - **Manifest:** ```yaml manifest: expected_paths: - src/mod1.mjs - tests/mod1.test.mjs min_file_count: 2 commit_message_pattern: "^feat\\(x\\):" bash_syntax_check: [] forbidden_paths: [] must_contain: [] ``` ### Step 2: Build module 2 - **Files:** `src/mod2.mjs` - **Changes:** Add `run2()` to `src/mod2.mjs`. (new file) - **Test first:** - File: `tests/mod2.test.mjs` (new) - Verifies: run2() returns the value the next step reads - Pattern: `tests/lib/plan-schema.test.mjs` - **End-to-end:** `bash tests/e2e.sh` → expected: exit 0 and the CLI prints a result - **Verify:** `node --test tests/mod2.test.mjs` → expected: pass - **On failure:** revert — `git checkout -- src/mod2.mjs` - **Checkpoint:** `git commit -m "feat(x): step 2"` - **Manifest:** ```yaml manifest: expected_paths: - src/mod2.mjs - tests/mod2.test.mjs min_file_count: 2 commit_message_pattern: "^feat\\(x\\):" bash_syntax_check: [] forbidden_paths: [] must_contain: [] ``` ## Test Strategy - **Framework:** node:test ## Verification - [ ] `npm test` → expected: exit 0 - [ ] `bash tests/e2e.sh` → expected: exit 0