create-harness-vibe-coding 0.1.9 → 0.2.0

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 (57) hide show
  1. package/README.md +177 -32
  2. package/package.json +5 -2
  3. package/src/generator.js +407 -53
  4. package/src/index.js +236 -22
  5. package/templates/common/.claude/agents/architect.md +4 -4
  6. package/templates/common/.claude/agents/debugger.md +1 -1
  7. package/templates/common/.claude/agents/docs-researcher.md +4 -4
  8. package/templates/common/.claude/agents/implementer.md +1 -1
  9. package/templates/common/.claude/agents/planner.md +3 -3
  10. package/templates/common/.claude/agents/researcher.md +4 -4
  11. package/templates/common/.claude/agents/reviewer.md +1 -1
  12. package/templates/common/.claude/agents/test-writer.md +2 -2
  13. package/templates/common/.claude/agents/verifier.md +1 -1
  14. package/templates/common/.claude/commands/wf.md +18 -0
  15. package/templates/common/.claude/rules/ecc/common.md +16 -6
  16. package/templates/common/.claude/skills/harness-build-loop/SKILL.md +4 -3
  17. package/templates/common/.claude/skills/harness-context/SKILL.md +4 -3
  18. package/templates/common/.claude/skills/harness-lifecycle/SKILL.md +3 -3
  19. package/templates/common/.claude/skills/harness-research/SKILL.md +4 -4
  20. package/templates/common/.claude/skills/harness-router/SKILL.md +7 -5
  21. package/templates/common/.claude/skills/readme-optimizer/SKILL.md +48 -0
  22. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +36 -0
  23. package/templates/common/.claude/skills/wf-mode/SKILL.md +48 -0
  24. package/templates/common/AGENTS.md +2 -2
  25. package/templates/common/CLAUDE.md +39 -71
  26. package/templates/common/MEMORY.md +42 -33
  27. package/templates/common/README.md +41 -0
  28. package/templates/common/SETUP.md +149 -41
  29. package/templates/common/docs/README.md +72 -47
  30. package/templates/common/docs/domain/ports.md +1 -1
  31. package/templates/common/docs/features/_template.md +20 -10
  32. package/templates/common/docs/harness/PLAN.md +25 -2
  33. package/templates/common/docs/harness/WF.md +136 -0
  34. package/templates/common/docs/harness/agent-workflow.md +8 -8
  35. package/templates/common/docs/harness/context-loading.md +17 -14
  36. package/templates/common/docs/harness/data-flow.md +1 -1
  37. package/templates/common/docs/harness/dispatch.md +6 -0
  38. package/templates/common/docs/harness/extension.md +20 -8
  39. package/templates/common/docs/harness/lifecycle.md +2 -2
  40. package/templates/common/docs/harness/subagents.md +140 -0
  41. package/templates/common/docs/research/PRD.md +1 -1
  42. package/templates/common/docs/research/README.md +5 -5
  43. package/templates/common/memory/agent-lessons-patterns.md +21 -0
  44. package/templates/common/memory/tool-usage-reflections.md +21 -0
  45. package/templates/common/memory/user-corrections-preferences.md +21 -0
  46. package/templates/common/scripts/validate-harness.mjs +217 -46
  47. package/templates/optional/catalog.json +43 -0
  48. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +42 -0
  49. package/templates/optional/skills/browser-e2e/docs/workflows/browser-e2e.md +42 -0
  50. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +40 -0
  51. package/templates/optional/skills/github-pr-review/docs/workflows/github-pr-review.md +28 -0
  52. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +40 -0
  53. package/templates/optional/skills/python-backend/docs/workflows/python-backend.md +34 -0
  54. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +43 -0
  55. package/templates/optional/skills/ts-react-frontend/docs/workflows/ts-react-frontend.md +35 -0
  56. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +40 -0
  57. package/templates/optional/skills/ui-ux-review/docs/workflows/ui-ux-review.md +26 -0
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  <h1 align="center">create-harness-vibe-coding</h1>
9
9
  <p align="center">
10
10
  <b>0-1 product harness scaffold for AI-assisted engineering.</b><br>
11
- <sub>Idea -> Research -> PRD -> Architecture -> docs/harness/PLAN.md -> Build -> Verify -> Feedback.</sub>
11
+ <sub>Idea -> Research -> PRD -> Architecture -> Harness/PLAN.md -> Build -> Verify -> Feedback.</sub>
12
12
  </p>
13
13
 
14
14
  ---
@@ -21,8 +21,10 @@ npx create-harness-vibe-coding@latest my-project
21
21
 
22
22
  | What You Get | Purpose |
23
23
  |-------------|---------|
24
- | `CLAUDE.md` + `docs/README.md` | Short entry and dynamic doc router |
25
- | `docs/harness/PLAN.md` | Active execution state for multi-step work |
24
+ | `CLAUDE.md` + `Harness/README.md` | Thin root entry and dynamic doc router |
25
+ | `Harness/PLAN.md` | Active execution state, heartbeat, and handoffs |
26
+ | `Harness/WF.md` + `/wf` | Long-task workflow: explore, second-plan, build, review, verify, recover |
27
+ | `Harness/subagents.md` + `subagent-orchestrator` | Controller-led multi-agent orchestration with source-attributed methods |
26
28
  | Research + PRD templates | Clarify idea, scope, non-goals, acceptance criteria |
27
29
  | Research protocol | Route research agents, source search, and fallback tools |
28
30
  | Built-in common agents | Research, planning, architecture, testing, implementation, debugging, review, verification |
@@ -30,9 +32,10 @@ npx create-harness-vibe-coding@latest my-project
30
32
  | Dispatch protocol | Lightweight parallel-agent coordination without a scheduler |
31
33
  | Extension contract | Keep stack-specific agents and skills compatible |
32
34
  | Context-loading protocol | Inject only the right docs into each subagent |
35
+ | README optimizer skill | Optional README preservation, tables, and approved architecture diagrams |
33
36
  | Skill-style loaders | `.claude/skills/*` route lifecycle, context, and build loops |
34
37
  | Harness validator | Checks required files and unresolved project placeholders |
35
- | `.claude/` skeleton | Built-in common agents plus room for stack-specific assets |
38
+ | `.claude/` skeleton | Root runtime integration for Claude Code agents, skills, commands, and rules |
36
39
 
37
40
  ---
38
41
 
@@ -48,6 +51,7 @@ Most 0-1 AI coding projects fail before code quality matters:
48
51
  | Process drift is invisible | validator checks core harness readiness |
49
52
  | Architecture drifts silently | ports, data-flow, and state docs mark boundary changes |
50
53
  | Tests come after implementation | workflow requires failing test or manual check first |
54
+ | Long tasks stall after failures | `/wf` adds heartbeat, recovery, debugger, review, and verifier loops |
51
55
 
52
56
  ---
53
57
 
@@ -55,10 +59,10 @@ Most 0-1 AI coding projects fail before code quality matters:
55
59
 
56
60
  ```text
57
61
  npx scaffold
58
- -> Claude reads SETUP.md
59
- -> docs router selects only needed harness docs
62
+ -> Claude reads Harness/SETUP.md
63
+ -> Harness router selects only needed harness docs
60
64
  -> PRD/research/architecture/PLAN are filled
61
- -> first vertical slice is built, tested, reviewed, and fed back
65
+ -> first vertical slice is built, tested, reviewed, verified, and fed back
62
66
  -> validator catches missing project facts before release
63
67
  ```
64
68
 
@@ -74,41 +78,52 @@ The scaffold does not prebuild business code. It gives agents a compact process
74
78
  my-project/
75
79
  ├── CLAUDE.md ← Short startup rules + context discipline
76
80
  ├── AGENTS.md ← Coding agent entry
77
- ├── MEMORY.md ← Cross-session resource index
78
- ├── SETUP.md ← Temporary init guide (delete after setup)
81
+ ├── README.md ← Project build/test/git/run notes
79
82
  ├── .gitignore
80
- ├── docs/
83
+ ├── Harness/
81
84
  │ ├── README.md ← Dynamic doc router
82
- │ ├── harness/
83
- ├── PLAN.md Active execution plan and handoffs
84
- ├── lifecycle.md 0-1 product flow
85
- ├── context-loading.md Subagent context packs
86
- ├── dispatch.md Lightweight parallel-agent protocol
87
- ├── extension.md Stack-specific agent/skill contract
88
- ├── architecture.md Layer rules, components, ADRs
89
- ├── agent-workflow.md TDD loop, subagent roles, write sets
90
- ├── data-flow.md Event lifecycle: normal + failure paths
91
- │ └── state-machines.md State enums, transition tables, guards
85
+ │ ├── SETUP.md ← Temporary init guide (delete after setup)
86
+ │ ├── MEMORY.md Cross-session resource index
87
+ │ ├── PLAN.md Active execution plan, handoffs, heartbeat
88
+ │ ├── WF.md Long-task workflow and recovery loop
89
+ │ ├── lifecycle.md 0-1 product flow
90
+ │ ├── subagents.md Controller-led subagent orchestration
91
+ │ ├── context-loading.md Subagent context packs
92
+ │ ├── dispatch.md Lightweight parallel-agent protocol
93
+ │ ├── extension.md Stack-specific agent/skill contract
94
+ ├── architecture.md Layer rules, components, ADRs
95
+ │ ├── agent-workflow.md ← TDD loop, subagent roles, write sets
96
+ │ ├── data-flow.md ← Event lifecycle: normal + failure paths
97
+ │ ├── state-machines.md ← State enums, transition tables, guards
92
98
  │ ├── domain/
93
- │ │ └── ports.md ← Port contracts: pre/postconditions, errors
99
+ │ │ └── ports.md ← Port contracts: pre/postconditions, errors
94
100
  │ ├── features/
95
- │ │ └── _template.md ← Kiro-lite feature doc template
96
- └── research/
97
- ├── README.md ← Research-agent protocol and tool fallbacks
98
- ├── PRD.md ← MVP scope & acceptance template
99
- └── research-results.md ← Tech research results and decisions
100
- ├── scripts/
101
- └── validate-harness.mjs ← Lightweight harness readiness check
101
+ │ │ └── _template.md ← Kiro-lite feature doc template
102
+ ├── research/
103
+ ├── README.md
104
+ ├── PRD.md
105
+ └── research-results.md
106
+ ├── memory/
107
+ │ ├── tool-usage-reflections.md
108
+ │ │ ├── user-corrections-preferences.md
109
+ │ │ └── agent-lessons-patterns.md
110
+ │ ├── workflows/ ← Optional workflow docs
111
+ │ └── scripts/
112
+ │ └── validate-harness.mjs
102
113
  ├── .claude/
103
114
  │ ├── settings.json ← Base permissions
104
115
  │ ├── agents/ ← Built-in common agents + stack-specific agents later
105
116
  │ ├── skills/ ← Harness loaders + stack-specific skills
117
+ │ ├── commands/
118
+ │ │ └── wf.md ← Slash-command bridge into wf-mode
106
119
  │ ├── hooks/ ← Configure automation after stack choice
107
120
  │ └── rules/ecc/
108
121
  │ └── common.md ← Universal coding rules
109
122
  └── tests/ ← Your test suite goes here
110
123
  ```
111
124
 
125
+ `Harness/` is the default home for harness-owned docs, state, memory, workflows, and validation. The root `.claude/` directory remains at the project root because Claude Code discovers agents, skills, commands, settings, hooks, and rules there.
126
+
112
127
  ---
113
128
 
114
129
  ## Ecosystem Compatibility
@@ -130,6 +145,70 @@ my-project/
130
145
  npx create-harness-vibe-coding@latest
131
146
  ```
132
147
 
148
+ ### Existing Project
149
+
150
+ The scaffold is designed to be added to an existing repository without silently replacing project files.
151
+
152
+ Chinese README: [README-CN.md](README-CN.md)
153
+
154
+ One-sentence agent prompt: `Follow the README at https://github.com/zingspark/create-harness-vibe-coding to configure this project with create-harness-vibe-coding; before editing, ask the Agent-link install intake questions; for a new project run the 0-1 bootstrap, and for an existing project or legacy architecture run a dry-run first, preserve existing files, merge only missing Harness guidance, then follow Harness/SETUP.md.`
155
+
156
+ There are two installation paths:
157
+
158
+ - **npx install**: deterministic scaffold writes with explicit conflict policy. Use this when you want predictable files and a clear dry-run plan.
159
+ - **Agent-link install**: paste the one-sentence prompt above into Claude Code, Codex, Cursor, Gemini CLI, or another coding agent. This path is more flexible: the agent should read this README, inspect the existing project, run or emulate a dry-run, and propose a minimal migration plan before editing.
160
+
161
+ Agent-link install intake, asked before editing:
162
+
163
+ Ask only questions that affect writes, architecture, security, or workflow. Ask at most three blocking questions up front, record safe defaults for the rest, and ask follow-ups only when that choice becomes active.
164
+
165
+ | Topic | Ask When | Default If Unanswered |
166
+ | --- | --- | --- |
167
+ | Root agent entry | `CLAUDE.md`, `AGENTS.md`, `.claude/`, or other agent entry files already exist | Preserve files; ask before merging the Harness entry contract |
168
+ | Harness location | `docs/` is already used for GitHub Pages, product docs, or generated docs | Use root `Harness/`; do not write harness docs into `docs/` |
169
+ | README ownership | root `README.md` is a public product page, package docs, or heavily customized | Preserve existing README and propose a minimal Development section |
170
+ | README optimization | existing README is stale, sparse, missing command tables, or the user asks for diagrams/polished docs | Offer `readme-optimizer`; default to append-only Development notes until the user approves a structure pass or full rewrite |
171
+ | Extensions | ECC, Superpowers, custom rules, or stack-specific skills may be useful | Recommend first; install only after user approval |
172
+ | Skills | stack is known and optional skills could improve testing, frontend, backend, review, or browser evidence | Install 1-2 relevant skills only after user approval |
173
+ | CI/CD | CI config exists or the project lacks a test/build gate | Document existing commands first; add CI/CD only after user approval |
174
+ | Verification depth | browser-visible, API, database, auth, payment, or deployment behavior is affected | Require real command evidence; require browser/API evidence when relevant |
175
+ | Memory/privacy | repo contains sensitive domain data, customer data, secrets, or private workflows | Enable memory index only; never record secrets or private data |
176
+ | Branch/worktree | project has uncommitted changes, risky migration, or parallel implementation lanes | Preserve current worktree; propose branch/worktree before broad edits |
177
+ | Package manager/stack | multiple package managers, monorepo apps, or unclear stack boundaries exist | Ask which workspace/app is in scope before writing |
178
+
179
+ If `CLAUDE.md` already exists, the agent must tell the user it is the root agent entry contract and ask for confirmation before refactoring, merging, backing up, or replacing it. The correct outcome is a user-approved merge that preserves project-specific rules while adding the Harness startup, memory, router, workflow, and subagent orchestration contract.
180
+
181
+ ```bash
182
+ # Preview the write plan first. No files or directories are created.
183
+ npx create-harness-vibe-coding@latest my-app . -y --dry-run
184
+
185
+ # Preserve existing files and add only missing harness files.
186
+ npx create-harness-vibe-coding@latest my-app . -y --on-conflict skip
187
+ ```
188
+
189
+ By default, conflicts fail before writing. This protects existing `CLAUDE.md`, `AGENTS.md`, `README.md`, `.claude/`, `.gitignore`, project docs, and scripts from accidental replacement.
190
+
191
+ | Conflict mode | Meaning | Risk |
192
+ |---------------|---------|------|
193
+ | `fail` | Default. Stop if a target file already exists. | Safest for existing projects; requires a follow-up decision. |
194
+ | `skip` | Keep existing files and create only missing files. | Existing root entries may need manual links to new `Harness/` docs or workflows. |
195
+ | `backup` | Rename the existing file to `<name>.harness-backup`, then write the scaffold file. | Review backups before deleting; repeated runs may need cleanup. |
196
+ | `overwrite` | Replace existing files with scaffold versions. | Destructive. Use only after reviewing `--dry-run` output or with explicit approval. |
197
+
198
+ Recommended bootstrap for agents:
199
+
200
+ ```bash
201
+ node bin/create-harness-vibe-coding.js my-app . -y --dry-run
202
+ node bin/create-harness-vibe-coding.js my-app . -y --on-conflict skip
203
+ node Harness/scripts/validate-harness.mjs
204
+ ```
205
+
206
+ After files are installed, agents must follow `Harness/SETUP.md` before normal project work. `CLAUDE.md` only points to the required Harness routers; setup details belong in `Harness/SETUP.md`.
207
+
208
+ If `AGENTS.md` already exists, the agent must ask for user consent before merging or replacing it. `AGENTS.md` is part of the root agent entry contract, just like `CLAUDE.md`.
209
+
210
+ Development commands, build scripts, git conventions, and release process belong in root `README.md`. Code architecture belongs in `Harness/architecture.md` or feature docs, not in `CLAUDE.md`.
211
+
133
212
  ### Agent / CI/CD
134
213
 
135
214
  Agents and automation can skip all prompts with `-y`:
@@ -143,23 +222,89 @@ npx create-harness-vibe-coding@latest my-app -y
143
222
 
144
223
  # Named project, explicit directory
145
224
  npx create-harness-vibe-coding@latest my-app ./dist/my-app -y
225
+
226
+ # CI-safe existing-project preview
227
+ npx create-harness-vibe-coding@latest my-app . -y --dry-run
228
+
229
+ # CI-safe existing-project add without replacing files
230
+ npx create-harness-vibe-coding@latest my-app . -y --on-conflict skip
146
231
  ```
147
232
 
148
233
  | Flag | Purpose |
149
234
  |------|---------|
150
235
  | `-y`, `--yes` | Skip all prompts. Uses positional args or defaults. |
236
+ | `--dry-run` | Print the planned creates, skips, backups, overwrites, and conflicts without writing. |
237
+ | `--on-conflict <mode>` | Choose `fail`, `skip`, `backup`, or `overwrite` when files already exist. |
238
+ | `--list-options` | Print the optional workflow catalog and presets. |
239
+ | `--with <ids>` | Add optional workflows by comma-separated id. |
240
+ | `--without <ids>` | Remove optional workflows selected by `--preset` or `--with`. |
241
+ | `--preset <name>` | Add a named workflow preset such as `web-app` or `fullstack`. |
151
242
  | `-h`, `--help` | Print usage and exit. |
152
243
 
153
244
  > [!TIP]
154
245
  > Agents should always pass `-y` to avoid hanging on interactive prompts.
155
- > If the agent needs to discover the CLI surface first, run with `--help`.
246
+ > If the agent needs to discover the CLI surface first, run with `--help` and `--list-options`.
247
+
248
+ ### Optional Workflows
249
+
250
+ Optional workflows are local template assets selected explicitly at generation time. They do not install package dependencies or fetch a remote marketplace.
251
+
252
+ ```bash
253
+ # Show available optional workflow ids and presets
254
+ npx create-harness-vibe-coding@latest --list-options
255
+
256
+ # Add individual workflows
257
+ npx create-harness-vibe-coding@latest my-app -y --with browser-e2e,ts-react-frontend
258
+
259
+ # Add a preset for common web app work
260
+ npx create-harness-vibe-coding@latest my-app -y --preset web-app
261
+
262
+ # Add a broader frontend/backend/PR-review preset
263
+ npx create-harness-vibe-coding@latest my-app -y --preset fullstack
264
+
265
+ # Trim a preset without restating every selected workflow
266
+ npx create-harness-vibe-coding@latest my-app -y --preset fullstack --without github-pr-review
267
+ ```
268
+
269
+ Built-in optional workflow ids:
270
+
271
+ | Workflow | Use when |
272
+ |----------|----------|
273
+ | `browser-e2e` | Browser smoke tests, screenshots, traces, and UI evidence. |
274
+ | `ui-ux-review` | Screenshot-driven responsive, accessibility, and polish review. |
275
+ | `github-pr-review` | PR diff, checks, review findings, and CI evidence. |
276
+ | `python-backend` | Python API/backend work with unittest or pytest verification. |
277
+ | `ts-react-frontend` | TypeScript React work with typecheck, component tests, build, and browser smoke. |
278
+
279
+ Presets:
280
+
281
+ | Preset | Includes |
282
+ |--------|----------|
283
+ | `web-app` | `ts-react-frontend`, `browser-e2e`, `ui-ux-review` |
284
+ | `fullstack` | `ts-react-frontend`, `python-backend`, `browser-e2e`, `github-pr-review` |
285
+
286
+ ### Verification
287
+
288
+ ```bash
289
+ # Run repository tests
290
+ npm test
291
+
292
+ # Confirm optional workflow catalog output
293
+ node bin/create-harness-vibe-coding.js --list-options
294
+
295
+ # After generating a project, validate the harness from that project root
296
+ node Harness/scripts/validate-harness.mjs
297
+ ```
298
+
299
+ The harness validator checks scaffold consistency. It is not a full React, Playwright, Chrome DevTools Protocol, or browser matrix test suite.
156
300
 
157
301
  ### After scaffolding, tell Claude:
158
302
 
159
303
  ```
160
- "Read SETUP.md. Bootstrap this project from idea to first vertical slice."
161
- "Read SETUP.md. This is a React TypeScript SaaS idea. Clarify PRD first, then plan the first slice."
162
- "Read SETUP.md. This is a Python data product. Research the stack, define the MVP, then create docs/harness/PLAN.md."
304
+ "Read Harness/SETUP.md. Bootstrap this project from idea to first vertical slice."
305
+ "Read Harness/SETUP.md. This is a React TypeScript SaaS idea. Clarify PRD first, then plan the first slice."
306
+ "Read Harness/SETUP.md. This is a Python data product. Research the stack, define the MVP, then create Harness/PLAN.md."
307
+ "Use /wf for this long migration. Explore first, make a second plan, then implement, review, verify, and recover with heartbeat updates."
163
308
  ```
164
309
 
165
310
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-harness-vibe-coding",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Scaffold a 0-1 product harness for AI-assisted research, PRD, planning, architecture, build, test, and feedback loops",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,10 @@
12
12
  "templates/"
13
13
  ],
14
14
  "scripts": {
15
- "start": "node src/index.js"
15
+ "start": "node src/index.js",
16
+ "test": "node --test tests/*.test.js",
17
+ "test:smoke": "node --test tests/cli-smoke.test.js",
18
+ "pack:smoke": "node --test tests/pack-smoke.test.js"
16
19
  },
17
20
  "dependencies": {
18
21
  "@clack/prompts": "^0.7.0",