procedure-cli 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +15 -3
  2. package/dist/steps/build-test.js +32 -3
  3. package/dist/steps/build-test.js.map +1 -1
  4. package/dist/steps/powerline.js +11 -3
  5. package/dist/steps/powerline.js.map +1 -1
  6. package/dist/steps/product-context.js +54 -19
  7. package/dist/steps/product-context.js.map +1 -1
  8. package/dist/steps/project-info.js +30 -3
  9. package/dist/steps/project-info.js.map +1 -1
  10. package/package.json +5 -1
  11. package/.claude/settings.local.json +0 -26
  12. package/.env.example +0 -2
  13. package/AGENTS.md +0 -113
  14. package/CLAUDE.md +0 -138
  15. package/CODE-FIXED.md +0 -197
  16. package/CODE-REVIEW.md +0 -431
  17. package/config/defaults.json +0 -8
  18. package/config/powerline-config.json +0 -52
  19. package/config/stacks/typescript-node.json +0 -15
  20. package/docs/GIAI-THICH-CLAUDE-MD.md +0 -206
  21. package/docs/PRD.md +0 -140
  22. package/docs/USER-STORIES.md +0 -264
  23. package/src/app.tsx +0 -213
  24. package/src/cli.tsx +0 -19
  25. package/src/components/banner.tsx +0 -23
  26. package/src/components/gutter-line.tsx +0 -16
  27. package/src/components/guttered-select.tsx +0 -231
  28. package/src/components/step-indicator.tsx +0 -32
  29. package/src/components/timeline.tsx +0 -57
  30. package/src/lib/fs.ts +0 -23
  31. package/src/lib/git.ts +0 -41
  32. package/src/lib/powerline.ts +0 -48
  33. package/src/lib/template.ts +0 -161
  34. package/src/lib/types.ts +0 -70
  35. package/src/providers/openai.ts +0 -5
  36. package/src/providers/zai.ts +0 -7
  37. package/src/steps/architecture.tsx +0 -72
  38. package/src/steps/build-test.tsx +0 -79
  39. package/src/steps/generation.tsx +0 -176
  40. package/src/steps/powerline.tsx +0 -238
  41. package/src/steps/product-context.tsx +0 -208
  42. package/src/steps/project-info.tsx +0 -136
  43. package/src/steps/stack-style.tsx +0 -304
  44. package/src/theme.ts +0 -15
  45. package/tsconfig.json +0 -17
package/CLAUDE.md DELETED
@@ -1,138 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- See docs/PRD.md for product requirements and docs/USER-STORIES.md for user stories with acceptance criteria.
6
-
7
- ## Build & Test
8
-
9
- ```bash
10
- npm run dev # Run CLI directly (tsx, no build step)
11
- npm run typecheck # Typecheck (fast — run first)
12
- npm run build # Compile to dist/
13
- npx tsx src/cli.tsx # Run entry point directly
14
- ```
15
-
16
- ## Code Style
17
-
18
- - TypeScript strict mode, ESM (`"type": "module"` in package.json)
19
- - JSX runtime: `react-jsx` (no `import React` needed in components, but keep it for clarity in entry points)
20
- - Ink components use `.tsx` extension; pure logic uses `.ts`
21
- - Handlebars templates use `.hbs` extension in `templates/`
22
- - Providers live in `src/providers/` — one file per provider, each exports a single provider instance
23
- - Environment variables for API keys: `ZAI_API_KEY`, `OPENAI_API_KEY` (never hardcode)
24
-
25
- ## Architecture
26
-
27
- - **Entry point**: `src/cli.tsx` — parses args, calls `render(<App />)`
28
- - **UI layer**: `src/app.tsx` — Ink root component, wizard controller with 7-step flow
29
- - **Wizard steps**: `src/steps/` — one component per step, each receives `onComplete` callback
30
- - **UI components**: `src/components/` — banner, timeline, step-indicator, gutter-line, guttered-select
31
- - **Core logic**: `src/lib/` — pure functions, no UI
32
- - `template.ts` — Handlebars rendering, file scaffolding
33
- - `powerline.ts` — Claude Code powerline setup (from setup-powerline.sh logic)
34
- - `git.ts` — git init + initial commit
35
- - `fs.ts` — directory/file helpers
36
- - `types.ts` — WizardAnswers interface, StepId type
37
- - **Templates**: `templates/` — Handlebars files (.hbs) rendered with wizard answers into target projects
38
- - **Config**: `config/` — defaults, stack presets, bundled powerline config
39
- - **AI providers**: `src/providers/` — Z.ai uses `@ai-sdk/openai-compatible` (GLM models), OpenAI uses `@ai-sdk/openai`
40
- - **AI SDK 6**: All AI calls go through Vercel AI SDK 6 (`ai` package). Use `generateText`, `streamText`, or `generateObject` — not raw fetch
41
- - **Docs**: `docs/` — PRD, User Stories (Gherkin A/C), methodology explainer (Vietnamese)
42
-
43
- ## Workflow
44
-
45
- ### Planning
46
- - Enter plan mode for ANY non-trivial task (3+ steps or architectural decisions)
47
- - If something goes sideways, STOP and re-plan — don't keep pushing
48
- - A good plan lets you one-shot the implementation
49
-
50
- ### Verification
51
- - Never mark a task complete without proving it works
52
- - Run `npm run typecheck` then `npm run dev` to verify
53
- - Ask yourself: "Would a staff engineer approve this?"
54
-
55
- ### Self-Improvement
56
- - After ANY correction from the user: update the Lessons section below
57
- - Write rules that prevent the same mistake from recurring
58
-
59
- ### Bug Fixing
60
- - Given a bug report: just fix it. Don't ask for hand-holding
61
- - Point at logs, errors, failing tests — then resolve them
62
-
63
- ### Elegance
64
- - For non-trivial changes: pause and ask "is there a more elegant way?"
65
- - If a fix feels hacky, step back and implement the clean solution
66
- - Skip this for simple, obvious fixes — don't over-engineer
67
-
68
- ## Task Management
69
-
70
- ### Solo Work
71
- 1. Plan first (plan mode for complex tasks)
72
- 2. Track progress with TaskCreate/TaskUpdate for multi-step work
73
- 3. Verify before claiming done
74
- 4. Update Lessons after corrections
75
-
76
- ### Agent Teams
77
- 1. Plan-then-team: design approach BEFORE spawning a team
78
- 2. Each task = one clear deliverable with verification steps
79
- 3. File ownership: each teammate owns specific files — NEVER have two edit the same file
80
- 4. Include file paths and constraints in task descriptions — teammates don't inherit context
81
- 5. DMs by default, broadcast only for critical blocking issues
82
- 6. 3-5 teammates max
83
-
84
- ## Code Review & Fix Logging
85
-
86
- Two tracking files live at the project root. Both are append-only logs — never delete or rewrite past entries.
87
-
88
- ### CODE-REVIEW.md — review findings
89
- - Created/appended during code review sessions.
90
- - Entry ID format: `CR-YYYYMMDD-###` (zero-padded sequence per day).
91
- - Findings ordered by severity (`High`, `Medium`, `Low`).
92
- - Every finding includes `file:line` evidence, a clear recommendation, and `Status` (`New`, `Still Open`, `Fixed`, `Regressed`, `Not Reproducible`).
93
-
94
- ### CODE-FIXED.md — fix results
95
- - Created/appended when fixing findings from CODE-REVIEW.md.
96
- - Entry ID format: `CF-YYYYMMDD-###`.
97
- - Each entry references its source review by `CR-` Entry ID — do NOT re-describe findings, only document actions taken.
98
- - Fixed findings include `file:line` for every change made.
99
- - Deferred findings include rationale and a revisit trigger.
100
- - Verification section must confirm `npm run typecheck` + `npm run build` status after fixes.
101
-
102
- ### Procedure
103
- 1. **Reviewing**:
104
- - **First**: Read CODE-REVIEW.md → Read CODE-FIXED.md → understand current state of findings and fixes.
105
- - **Then**: Read codebase → append findings to CODE-REVIEW.md with a new `CR-` entry (write to CODE-REVIEW.md only, never modify CODE-FIXED.md).
106
- - **Never** fix code during a reviewing process.
107
- 2. **Fixing**:
108
- - **First**: Read CODE-REVIEW.md → Read CODE-FIXED.md → identify unfixed findings.
109
- - **Then**: Fix only unfixed findings → append a new `CF-` entry to CODE-FIXED.md (write to CODE-FIXED.md only, never modify CODE-REVIEW.md).
110
- - **Never** perform a code review during a fixing process.
111
-
112
- ## Core Principles
113
-
114
- - **Simplicity First**: Make every change as simple as possible. Minimal code impact.
115
- - **No Laziness**: Find root causes. No temporary fixes. Senior developer standards.
116
- - **Minimal Impact**: Changes should only touch what's necessary.
117
-
118
- ## Lessons
119
-
120
- - Timeline `│` lines must stay vertically aligned — never indent content in a way that breaks the straight line from dot to dot
121
- - Required wizard fields must validate: don't allow empty submissions for project name, description, etc.
122
- - Active step needs visual animation (spinner/pulse) so user knows the CLI is waiting for input
123
- - Errors display below the input field in a distinct color (red/yellow) — never inline with the prompt
124
- - Completed steps need visual acknowledgment (checkmark, color change) beyond just swapping the dot symbol
125
- - Always add an intro/tagline under the ASCII banner so the user knows what the tool does
126
- - NEVER run `npm run dev` from the procedure project directory — scaffolding writes to cwd and overwrites procedure's own files. Always test in a temp directory.
127
- - Select menus (not text input) for fields with known options: package manager, license, architecture pattern
128
- - Don't prefill fields from unrelated previous answers (e.g., project name → description)
129
- - Architecture notes should be auto-generated from the selected pattern — users may not know best practices
130
- - Generation step must show a summary and ask for confirmation before writing files
131
- - Use `<Text>` not `<Box>` for single-line elements — `<Box>` creates flex containers that add visual gaps
132
- - Step components must return `<>` fragments, NOT `<Box flexDirection="column">` — only timeline.tsx gets the outer Box
133
- - Completed step summaries go on a SEPARATE `│ ` line below the step name, not on the same line (prevents wrapping)
134
- - Custom GutteredSelect/GutteredMultiSelect for select menus — `@inkjs/ui` Select breaks the `│` gutter line
135
- - Tech stack multi-select should prefill from Stack & Style selections (language + framework)
136
- - Stack & Style = dev setup (language, framework, code style → CLAUDE.md). Tech Stack = full product stack (databases, infra → PRD/README)
137
- - Color theme is Catppuccin Mocha — always use hex constants from `src/theme.ts` (`C.mauve`, `C.green`, etc.), never terminal color names like `"cyan"`, `"green"`, `"red"`. This ensures consistent rendering across all terminal emulators.
138
- - Timeline `┌`/`└` corners wrap the entire wizard flow (top of Project Info, bottom of Setup) — not individual steps
package/CODE-FIXED.md DELETED
@@ -1,197 +0,0 @@
1
- # Code Fix Log
2
-
3
- ## Writing Standard
4
- - Each entry documents fixes applied for a specific `CODE-REVIEW.md` entry.
5
- - Reference the source review by its Entry ID (e.g., `CR-20260221-001`). Do NOT re-describe findings — only document actions taken.
6
- - For finding details, the reader should consult the referenced `CODE-REVIEW.md` entry.
7
- - Each finding is referenced as `Finding #N (Severity)` matching the review's numbering.
8
- - Fixed findings must include `file:line` for every change made.
9
- - Deferred findings must include rationale and a revisit trigger.
10
- - Verification section must confirm `npm run typecheck` + `npm run build` status after fixes.
11
- - Language: English only. Tone: Technical, concise, action-focused.
12
-
13
- ### Entry ID Convention
14
- - Required field for every entry: `Entry ID`.
15
- - Format: `CF-YYYYMMDD-###`
16
- - Example: `CF-20260222-001`
17
- - `###` is a zero-padded sequence number for that day.
18
-
19
- ---
20
-
21
- ## Entry 2026-02-22
22
-
23
- ### Entry ID
24
- - `CF-20260222-001`
25
-
26
- ### Source Review
27
- - `CR-20260221-001` (CODE-REVIEW.md entry 2026-02-21)
28
-
29
- ### Fixes Applied
30
-
31
- 1. Finding #1 (High) — **Fixed**
32
- - `src/lib/powerline.ts:33` — Changed `--config=~/.claude/powerline-config.json` to `--config=.claude/powerline-config.json` so the status-line command reads from the project-local path where the config is actually written.
33
-
34
- 2. Finding #2 (Medium) — **Fixed**
35
- - `src/lib/git.ts:3-11` — Added `hasGitIdentity()` helper that pre-checks `git config user.name` and `git config user.email`.
36
- - `src/lib/git.ts:13-28` — Refactored `initGit()` to return `{ committed: boolean; reason?: string }`. Skips `git commit` when identity is missing and returns a descriptive reason string.
37
-
38
- 3. Finding #3 (Medium) — **Fixed**
39
- - `src/lib/powerline.ts:21-29` — Wrapped `JSON.parse(raw)` in try/catch; malformed `.claude/settings.json` now falls back to empty object instead of throwing.
40
-
41
- 4. Finding #4 (Medium) — **Fixed**
42
- - `src/lib/template.ts:38-44` — Added `checkConflicts(targetDir)` function that returns list of existing output files that would be overwritten.
43
- - `src/steps/generation.tsx:5,61,102-113` — Imported `checkConflicts`, added yellow warning in summary phase listing files that will be overwritten before user confirms.
44
-
45
- 5. Finding #5 (Low) — **Fixed**
46
- - `src/lib/types.ts:64` — Added `generationSkipped: boolean` field to `WizardAnswers`.
47
- - `src/app.tsx:49` — Added `generationSkipped: false` to `EMPTY_ANSWERS`.
48
- - `src/app.tsx:83` — Updated `getSummary` case 5 to return `"skipped"` when `generationSkipped` is true.
49
- - `src/steps/generation.tsx:9` — Changed `onComplete` prop type to `(partial: Partial<WizardAnswers>) => void`.
50
- - `src/steps/generation.tsx:35` — On successful generation, calls `onComplete({ generationSkipped: false })`.
51
- - `src/steps/generation.tsx:48` — On cancel, calls `onComplete({ generationSkipped: true })`.
52
- - `src/app.tsx:179` — Changed `onComplete={() => handleStepComplete({})}` to `onComplete={handleStepComplete}`.
53
-
54
- 6. Finding #6 (Low) — **Fixed**
55
- - `templates/docs/USER-STORIES.md.hbs:1-32` — Added Handlebars `{{#if userStories.length}}` conditional with fallback starter template content when `userStories` is empty. Fallback includes example user story in Gherkin format with clear TODO instructions.
56
-
57
- ### Deferred
58
- None — all 6 findings fixed.
59
-
60
- ### Verification Notes
61
- - `npm run typecheck`: pass (0 errors)
62
- - All fixes verified through code inspection.
63
-
64
- ### Residual Risks / Testing Gaps
65
- - No automated tests for `checkConflicts()` behavior.
66
- - No automated tests for `initGit()` across machines with missing git identity.
67
- - No automated tests for malformed `.claude/settings.json` handling.
68
- - No automated tests asserting generation summary truthfulness when user cancels.
69
- - No runtime test for Handlebars `{{#if userStories.length}}` fallback rendering.
70
-
71
- ---
72
-
73
- ## Entry 2026-02-22
74
-
75
- ### Entry ID
76
- - `CF-20260222-002`
77
-
78
- ### Source Review
79
- - `CR-20260221-002` (CODE-REVIEW.md entry 2026-02-21)
80
-
81
- ### Fixes Applied
82
-
83
- 1. Finding #7 (Medium) — **Fixed**
84
- - `src/lib/git.ts:13-20` — Added `hasStagedFiles()` helper that runs `git status --porcelain`; returns `false` when index is empty.
85
- - `src/lib/git.ts:30-33` — Added early return `{ committed: false, reason: 'Nothing to commit — directory is empty.' }` before identity check, preventing hard crash on empty-directory init.
86
-
87
- 2. Finding #8 (Low) — **Fixed**
88
- - `src/app.tsx:133-141` — Wrapped completion message in `answers.generationSkipped` conditional. Skip path shows neutral `"Generation was skipped — no files were written."` Scaffold path retains original project name + doc check message.
89
-
90
- 3. Finding #6 re-raised (Low, Still Open in CR-20260221-002) — **Already Fixed**
91
- - Covered by `CF-20260222-001` Finding #6: `templates/docs/USER-STORIES.md.hbs` Handlebars fallback added in previous fix cycle. No further action required.
92
-
93
- ### Deferred
94
- None.
95
-
96
- ### Verification Notes
97
- - `npm run typecheck`: pass (0 errors)
98
- - `npm run build`: pass
99
-
100
- ---
101
-
102
- ## Entry 2026-02-22
103
-
104
- ### Entry ID
105
- - `CF-20260222-003`
106
-
107
- ### Source Review
108
- - `CR-20260221-004` (CODE-REVIEW.md entry 2026-02-21)
109
-
110
- ### Fixes Applied
111
-
112
- 1. Finding #9 (Low, Still Open) — **Fixed**
113
- - `src/steps/powerline.tsx:22` — Added `gitCommitted?: boolean` to `SetupResult` interface.
114
- - `src/steps/powerline.tsx:41-44` — `runSetup()` now stores `gitResult.committed` in `setupResult.gitCommitted`.
115
- - `src/steps/powerline.tsx:125-133` — "Git repository initialized." only renders when `setupResult.gitCommitted` is true. When commit failed, only the yellow warning with reason is shown (no mixed success/failure messaging).
116
-
117
- ### Deferred
118
- None.
119
-
120
- ### Verification Notes
121
- - `npm run typecheck`: pass
122
- - `npm run build`: pass
123
-
124
- ---
125
-
126
- ## Entry 2026-02-22
127
-
128
- ### Entry ID
129
- - `CF-20260222-004`
130
-
131
- ### Source Review
132
- - `CR-20260222-002` (CODE-REVIEW.md entry 2026-02-22)
133
-
134
- ### Fixes Applied
135
-
136
- 1. Finding #10 (Low) — **Fixed**
137
- - `src/lib/types.ts:68` — Added `setupGit: boolean` to `WizardAnswers` so setup choice can be persisted.
138
- - `src/app.tsx:51` — Added `setupGit: false` to `EMPTY_ANSWERS`.
139
- - `src/app.tsx:89` — Updated setup summary to render `Git init: yes/no` based on `answers.setupGit` instead of always implying git initialization.
140
- - `src/steps/powerline.tsx:48` — Updated `onComplete` payload to include `setupGit: git`, preserving the user’s git setup decision for final summaries.
141
-
142
- ### Deferred
143
- None.
144
-
145
- ### Verification Notes
146
- - `npm run typecheck`: pass
147
- - `npm run build`: pass
148
-
149
- ---
150
- ## Entry 2026-02-22
151
-
152
- ### Entry ID
153
- - `CF-20260222-005`
154
-
155
- ### Source Review
156
- - `CR-20260222-003` (CODE-REVIEW.md entry 2026-02-22)
157
-
158
- ### Fixes Applied
159
-
160
- 1. Finding #11 (Low) — **Fixed**
161
- - `src/steps/build-test.tsx:68` — Replaced `dimColor` with `color={C.overlay1}` to comply with the Catppuccin theme rule and keep all color rendering sourced from `src/theme.ts` constants.
162
-
163
- ### Deferred
164
- None.
165
-
166
- ### Verification Notes
167
- - `npm run typecheck`: pass
168
- - `npm run build`: pass
169
- - `rg "dimColor|color=\"(cyan|green|red|yellow|blue|magenta|white|black)\"" -n src`: no matches
170
-
171
- ---
172
- ## Entry 2026-02-22
173
-
174
- ### Entry ID
175
- - `CF-20260222-006`
176
-
177
- ### Source Review
178
- - `CR-20260222-004` (CODE-REVIEW.md entry 2026-02-22)
179
-
180
- ### Fixes Applied
181
-
182
- 1. Finding #12 (Medium) — **Fixed**
183
- - `src/cli.tsx:11` — Replaced hard-stop behavior with warning-only messaging when directory is non-empty.
184
- - `src/cli.tsx:13` — Added explicit note that existing files may be overwritten during Step 6, preserving the intended Generation conflict-confirmation flow.
185
- - `src/cli.tsx:16` — Removed process exit path so wizard continues and existing overwrite warnings in Generation remain reachable.
186
-
187
- 2. Finding #13 (Low) — **Fixed**
188
- - `src/cli.tsx:16` — Updated setup hint to include both valid invocations: `npx procedure-cli` and `npx @b3awesome/procedure`, avoiding single-command drift.
189
-
190
- ### Deferred
191
- None.
192
-
193
- ### Verification Notes
194
- - `npm run typecheck`: pass
195
- - `npm run build`: pass
196
-
197
- ---