Skip to content

Commit bf6067d

Browse files
committed
fix: correct doc-code inconsistencies found by cross-reference review
Check 1 (Absolute Claims): - Scoped "all other code" to "programmatic consumers" and listed --help text as an exception alongside cleanupFiles.ts Check 7 (Doc-Code Sync): - cloneRepo: added fetch tags step and onProgress param to table - installPackages: documented custom-mode fallback to pnpm i - cleanupFiles: added onProgress param to table - Validation order: added step 7 (empty-after-parse check) - Security: stderr is piped (not suppressed) for error diagnostics - AGENTS.md: semicolons are asNeeded not no, trailing commas are all not none, mocking pattern includes exec.test.ts spawn mock
1 parent f471b2f commit bf6067d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ A CLI installer tool for dAppBooster projects. It supports two modes:
2626

2727
## Code Style
2828

29-
- **Semicolons:** no
29+
- **Semicolons:** as needed (Biome `asNeeded` — omitted unless required by ASI)
3030
- **Quotes:** single
3131
- **Print width:** 100
32-
- **Trailing commas:** none (Biome default)
32+
- **Trailing commas:** all (Biome default)
3333
- **Indent:** spaces, width 2
3434
- **Imports:** explicit `.js` extensions (ESM, `"type": "module"`)
3535

@@ -64,7 +64,7 @@ Key directories:
6464
- **Structure:** `source/__tests__/` mirrors `source/` layout. Operations tests live in `source/__tests__/operations/`
6565
- **What to test:** Non-interactive agentic flow (validation, JSON output), operations (correct shell commands), config, utils
6666
- **What not to test:** React/Ink components
67-
- **Mocking pattern:** Operations tests mock `exec`/`execFile` from `source/operations/exec.js`. Non-interactive tests mock the entire operations layer
67+
- **Mocking pattern:** Operations tests mock `exec`/`execFile` from `source/operations/exec.js`. `exec.test.ts` mocks `child_process.spawn` directly to test the helpers themselves. Non-interactive tests mock the entire operations layer
6868
- **Coverage:** Focus on the agentic interface. Test files and `source/components/` are excluded from coverage
6969

7070
## Guardrails

architecture.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,18 @@ featureDefinitions: Record<FeatureName, {
7575

7676
`featureNames` is derived as `Object.keys(featureDefinitions)`.
7777

78-
When adding a new feature, add it here. All other code (validation, cleanup, info output, TUI selection) picks it up automatically — except `cleanupFiles.ts` which needs explicit cleanup rules.
78+
When adding a new feature, add it here. Programmatic consumers (validation, info output, TUI selection) pick it up automatically — except `cleanupFiles.ts` (which needs explicit cleanup rules) and the CLI `--help` text in `cli.tsx` (which maintains its own copy).
7979

8080
### Operations Layer (`source/operations/`)
8181

8282
Plain async functions with no UI dependencies. Each operation receives explicit arguments (project folder, mode, features) and performs file system or shell work. Multi-step operations accept an optional `onProgress` callback that the TUI uses to render per-step progress; the non-interactive path omits it.
8383

8484
| Function | What it does |
8585
|---|---|
86-
| `cloneRepo(projectName)` | Shallow clone, checkout latest tag, rm .git, git init. Uses `execFile` (no shell) for all commands except `git checkout $(...)` which needs shell substitution. |
86+
| `cloneRepo(projectName, onProgress?)` | Shallow clone, fetch tags, checkout latest tag, rm .git, git init. Uses `execFile` (no shell) for all commands except `git checkout $(...)` which needs shell substitution. |
8787
| `createEnvFile(projectFolder)` | Copy .env.example to .env.local |
88-
| `installPackages(projectFolder, mode, features)` | Full: `pnpm i`. Custom: `pnpm remove` deselected packages + postinstall. Uses `execFile` exclusively (no shell). |
89-
| `cleanupFiles(projectFolder, mode, features)` | Remove files/folders for deselected features, patch package.json scripts, remove .install-files. Uses `execFile` exclusively (no shell). |
88+
| `installPackages(projectFolder, mode, features, onProgress?)` | Full: `pnpm i`. Custom with packages to remove: `pnpm remove` + postinstall. Custom with all features: `pnpm i`. Uses `execFile` exclusively (no shell). |
89+
| `cleanupFiles(projectFolder, mode, features, onProgress?)` | Remove files/folders for deselected features, patch package.json scripts, remove .install-files. Uses `execFile` exclusively (no shell). |
9090

9191
### Shell Execution (`source/operations/exec.ts`)
9292

@@ -122,10 +122,11 @@ default → dynamic import ink + App → TUI
122122
2. `--mode` required
123123
3. `--name` matches `/^[a-zA-Z0-9_]+$/`
124124
4. `--mode` is `full` or `custom`
125-
5. Full mode: skip to step 8 (features ignored, all installed)
125+
5. Full mode: skip to step 9 (features ignored, all installed)
126126
6. `--features` required for custom mode
127-
7. All feature names are valid keys in `featureDefinitions`
128-
8. Project directory does not already exist
127+
7. Parsed features list is non-empty (rejects trailing commas, whitespace-only entries)
128+
8. All feature names are valid keys in `featureDefinitions`
129+
9. Project directory does not already exist
129130

130131
**Non-interactive execution order:**
131132
`cloneRepo``createEnvFile``installPackages``cleanupFiles` → success JSON
@@ -188,4 +189,4 @@ Steps 1 and 4 are always required. Steps 2-3 only apply if the feature has files
188189
- User input (`projectName`) is validated against `/^[a-zA-Z0-9_]+$/` before any use
189190
- Operations use `execFile` (no shell) for commands that include user input
190191
- `exec` (shell) is reserved for commands needing shell substitution, and never receives user input in the command string
191-
- Non-interactive output suppresses child process stdout/stderr to guarantee clean JSON on stdout
192+
- Child process stdout is ignored and stderr is piped (captured for error diagnostics only), guaranteeing clean JSON on the parent's stdout

0 commit comments

Comments
 (0)