create-harness-vibe-coding 0.6.0 → 0.6.2

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.
package/README.md CHANGED
@@ -26,7 +26,7 @@ Follow the README at https://github.com/zingspark/create-harness-vibe-coding to
26
26
 
27
27
  That's it. Two paths into the harness — you type `npx`, or your agent reads the sentence.
28
28
 
29
- [README-CN.md](README-CN.md) (中文)
29
+ Chinese README: [README-CN.md](README-CN.md)
30
30
 
31
31
  ---
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-harness-vibe-coding",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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": {
package/src/generator.js CHANGED
@@ -2,7 +2,9 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
 
5
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+ const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8'));
6
8
  const TEMPLATES_DIR = path.resolve(__dirname, '..', 'templates', 'common');
7
9
  const OPTIONAL_DIR = path.resolve(__dirname, '..', 'templates', 'optional');
8
10
  const OPTIONAL_CATALOG = path.join(OPTIONAL_DIR, 'catalog.json');
@@ -327,7 +329,11 @@ export function generate({
327
329
 
328
330
  // Resolve targetDir relative to cwd
329
331
  const resolvedDir = path.resolve(process.cwd(), targetDir);
330
- const vars = { projectName };
332
+ const vars = {
333
+ projectName,
334
+ generatorVersion: pkg.version,
335
+ generatedTimestamp: new Date().toISOString(),
336
+ };
331
337
 
332
338
  const optional = resolveOptionalSelection({ withOptions, withoutOptions, preset });
333
339
  const fileSpecs = [
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: context-master
3
3
  description: Use when context exceeds ~85% of the window, or during WF closeout to extract durable knowledge before compression. Read-only analysis except for writing compression suggestions to PROGRESS.md#Heartbeat.
4
- tools: Read, Grep, Glob
4
+ tools: Read, Grep, Glob, Write
5
5
  model: haiku
6
6
  skills: harness-context
7
7
  ---
@@ -17,9 +17,10 @@ Cross-model peer review. Invokes the OTHER agent CLI to review changes from a fr
17
17
 
18
18
  ## CLI Detection
19
19
 
20
- - If `codex` is available: use `codex exec` for code review
21
- - If only `claude` is available: use `claude -p` for code review
22
- - Try `codex exec` first, fall back to `claude -p`
20
+ - Check `which codex && echo CODEX || echo NO_CODEX` to detect Codex
21
+ - Check `which claude && echo CLAUDE || echo NO_CLAUDE` to detect Claude
22
+ - Use the OTHER CLI the one NOT running this session. Never self-review.
23
+ - If only one CLI is available: warn the user, suggest installing the other CLI. Do NOT proceed with self-review.
23
24
 
24
25
  ## Flow
25
26
 
@@ -18,6 +18,7 @@
18
18
  "WebSearch"
19
19
  ],
20
20
  "deny": [
21
+ "EnterPlanMode",
21
22
  "Bash(rm -rf *)",
22
23
  "Bash(sudo *)",
23
24
  "Bash(curl *)",
@@ -14,19 +14,20 @@ Cross-model peer review via the OTHER agent CLI. Fresh eyes on your changes.
14
14
 
15
15
  ## How It Works
16
16
 
17
- 1. **Detect runtime**: Check `which codex` and `which claude`
17
+ 1. **Detect available CLIs**: Check `which codex` and `which claude`. Use the OTHER CLI — never the one running this session.
18
18
  2. **Prepare context**: Gather diff (`git diff`), relevant architecture docs, the specific question
19
19
  3. **Invoke the OTHER CLI** — the one we're NOT currently running under
20
20
  4. **Read and synthesize**: Present the raw output, then add analysis
21
21
 
22
22
  ## CLI Commands
23
23
 
24
- | Current Runtime | Review Command |
24
+ | Runtime | Review Command |
25
25
  |---|---|
26
- | Claude Code | `git diff \| codex exec "review prompt"` |
27
- | Claude Code (commit) | `codex exec "review this commit: $(git log -1 --format=%B)"` |
28
- | Codex | `git diff \| claude -p "review prompt"` |
29
- | Either | fallback: try the other CLI, warn if neither available |
26
+ | Claude Codex | `git diff \| codex exec "..."` (include full diff, not just commit message) |
27
+ | Codex Claude | `git diff \| claude -p "..."` |
28
+ | Either (fallback) | warn user, suggest installing the other CLI. Do NOT proceed with same-model review. |
29
+
30
+ **Anti-self-review rule**: Detect which runtime we're in, then use the OTHER one. Never invoke the same CLI that's running the session.
30
31
 
31
32
  ## Context to Include
32
33
 
@@ -73,3 +73,4 @@ Root entry for Claude Code. Keep this file short.
73
73
 
74
74
  - Never call `EnterPlanMode` — delegate planning to `planner` subagents (see `Harness/WF.md`).
75
75
  - Never write code directly in `/wf` or `/wf-max` mode — delegate all implementation to subagents (see `Harness/WF-MAX.md`).
76
+ - **Enforcement**: `.claude/settings.json` hooks prevent `EnterPlanMode` calls. Settings include `allowTools: ["!EnterPlanMode"]` for the main session.
@@ -103,7 +103,7 @@ Routing priority: if a request explicitly says `/wf <task>`, `/wf-max [task]`, `
103
103
  ```text
104
104
  Harness/README.md router only
105
105
  Harness/MEMORY.md resource index
106
- Harness/PLAN.md active project plan
106
+ Harness/PLAN.md project-level plan (redirects to tasks/<id>/PLAN.md)
107
107
  Harness/SETUP.md install/bootstrap contract
108
108
  Harness/PROGRESS.md global task index and cross-task decisions
109
109
  Harness/tasks/<id>/PROGRESS.md per-task progress, phase, heartbeat
@@ -115,7 +115,7 @@ Harness/WF-MAX.md max-parallelism workflow with wave dispatch
115
115
  .claude/skills/wf-review/SKILL.md cross-model peer review skill
116
116
  .claude/commands/wf-max.md /wf-max slash command bridge
117
117
  .claude/commands/learn.md /wf-learn slash command bridge
118
- .claude/commands/review.md /wf-review slash command bridge
118
+ .claude/commands/wf-review.md /wf-review slash command bridge
119
119
  Harness/lifecycle.md 0-1 product flow
120
120
  Harness/subagents.md controller-led subagent orchestration
121
121
  Harness/context-loading.md dynamic loading and subagent packs
@@ -22,7 +22,7 @@ CEO(1) ──┬── Manager₁(span) ──┬── Worker₁..ₙ
22
22
  ```
23
23
 
24
24
  - CEO: intent, scope, integration, final verification. Direct reports 3-5 Managers. **CEO never writes code directly** — dispatch Workers for all file changes. CEO only synthesizes results and decides next waves.
25
- - Manager: domain partition → parallel dispatch → synthesize → report. Serial across domains; parallel within domain.
25
+ - Manager: domain partition → parallel dispatch → synthesize → report. Serial across domains; parallel within domain. **Manager agents must be defined by the project** (not shipped by the harness) — create them under `.claude/agents/` with the `Agent` tool enabled for nested spawning.
26
26
  - Worker: single file per write Worker (implementer, one file_claim). Single dimension/topic per read Worker (reviewer, researcher). File claims must be file-level disjoint. Topic-level splitting within a single file is only allowed for read-only Workers.
27
27
  - depth ≥3: Manager spawns Sub-Manager (span ≤7) instead of Worker. Recursive until leaf condition met.
28
28
 
@@ -1,114 +1,126 @@
1
- # Harness Architecture {{projectName}}
1
+ # Harness Architecture - create-harness-vibe-coding
2
2
 
3
- > **Responsibility**: Defines the system layering structure, component overview, and key design decisions.
4
- > **Does NOT cover**: Code details (AI can read code), API documentation (placed in docstrings).
5
- >
6
- > Philosophical sources: arc42 Chapter 5 (Building Block View) + C4 Model Level 3 (Component) + matklad's lightweight ARCHITECTURE.md.
3
+ > **Responsibility**: Define the repository structure and scaffold generation boundaries.
4
+ > **Does NOT cover**: Generated target-project business architecture.
7
5
 
8
6
  ---
9
7
 
10
8
  ## 1. Layering Rules
11
9
 
12
- <!-- This is the hardest constraint in the entire architecture. Each layer's "allowed dependencies" must be explicit. -->
10
+ ```text
11
+ bin/
12
+ CLI executable shim. Calls src/index.js.
13
13
 
14
- ```
15
- ┌──────────────────────────┐
16
- │ interfaces/ │ User entry (CLI / API / UI)
17
- │ May depend on: harness│
18
- ├──────────────────────────┤
19
- │ harness/ │ Generic runtime shell: orchestration,
20
- │ May depend on: │ security, auditing, scheduling
21
- │ application │ Contains no business rules
22
- ├──────────────────────────┤
23
- │ application/ │ Business use-case orchestration
24
- │ May depend on: domain
25
- ├──────────────────────────┤
26
- │ domain/ │ ← Pure business objects + port protocols
27
- │ Only depends on: │ Depends on no external implementations
28
- │ standard library │
29
- ├──────────────────────────┤
30
- │ infrastructure/ │ ← Adapter implementations (data sources,
31
- │ Implements domain │ external services)
32
- │ ports │
33
- └──────────────────────────┘
14
+ src/
15
+ CLI orchestration and scaffold generation logic.
16
+ May read templates/ and write the chosen target directory.
17
+
18
+ templates/
19
+ Source of generated scaffold assets.
20
+ Must stay declarative: markdown, skill files, agent files, scripts, and optional workflow docs.
21
+
22
+ Harness/ and .claude/
23
+ Dogfood runtime for this repository's own agent work.
24
+ Must not be treated as package source unless intentionally copied into templates/.
25
+
26
+ tests/
27
+ Node test suite for CLI behavior, generator behavior, package contents, and generated harness validation.
34
28
  ```
35
29
 
36
- **Hard Constraints**:
37
- - domain must never import infrastructure/ or interfaces/
38
- - application only depends on domain
39
- - harness coordinates workflows but contains no domain business rules
40
- - All cross-layer communication goes through port protocols defined in domain
30
+ Hard constraints:
41
31
 
42
- ---
32
+ - `templates/common/**` and `templates/optional/**` are the source of generated output.
33
+ - Root `Harness/**` is this repository's operating harness; changing it does not change generated projects.
34
+ - Generated output paths are normalized by `harnessDest()` in `src/generator.js`.
35
+ - Existing-project safety is owned by conflict planning in `src/generator.js`, not by template prose alone.
36
+ - Package publication is constrained by `package.json#files`; root dogfood files are not package contents.
43
37
 
44
38
  ## 2. Interface Decoupling
45
39
 
46
- Use interfaces or ports to protect real boundaries, not to create abstraction for its own sake.
47
-
48
- - Define a port when code crosses a layer, process, network, storage, SDK, browser, or permission boundary.
49
- - Keep domain and application logic independent from infrastructure adapters.
50
- - Pass data through explicit contracts instead of reaching into another feature's internals.
51
- - Prefer direct calls inside the same cohesive module when there is only one caller, one implementation, and no boundary to protect.
52
- - Avoid speculative abstraction: do not add factories, plugin systems, service locators, generic repositories, or config layers until the feature has a concrete second use or a real testability/replacement need.
40
+ Use interfaces and module boundaries to protect real seams in the generator, not to decorate straightforward code.
53
41
 
54
- ---
42
+ - `src/index.js` owns CLI/user interaction; `src/generator.js` owns planning and file writes.
43
+ - Template files are declarative inputs; source code should not depend on root dogfood `Harness/**`.
44
+ - Optional catalog structure is the extension contract for presets and optional skills.
45
+ - Avoid speculative abstraction: do not add plugin systems, generic runners, extra config layers, or service containers until a real second use or testability boundary exists.
46
+ - When a boundary is real, express it with a small data contract and test it through generated output behavior.
55
47
 
56
48
  ## 3. State Design
57
49
 
58
- State must have one owner, legal transitions, and observable recovery behavior.
50
+ State in this repo should be explicit, serializable, and owned by one layer.
59
51
 
60
- - Identify durable state, runtime cache, derived UI state, external system state, and audit/event history separately.
61
- - Name the owner of each state slice; do not let UI, application services, and infrastructure all mutate the same state directly.
62
- - Model long-running workflows with explicit states, guards, and failure transitions in `Harness/state-machines.md`.
63
- - Store resumable progress and recovery decisions in `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` or project-owned durable storage, not only in chat.
64
- - Keep state minimal: derive values when cheap, persist only what must survive reload, retry, or handoff.
52
+ - Generator plan state is computed in memory and returned as `plan`/`summary`; file writes consume that plan instead of re-deciding conflicts.
53
+ - Filesystem state is authoritative only through existence/type checks and write results.
54
+ - Optional selection state comes from CLI flags plus `templates/optional/catalog.json`; do not duplicate it in template prose.
55
+ - Release state lives in `package.json`, npm, git tags, and GitHub; document commands in `README.md`, not `CLAUDE.md`.
56
+ - Long-running agent work records resumable status in `Harness/tasks/<task-id>/PLAN.md#Heartbeat`.
65
57
 
66
- ---
58
+ ## 4. Core Components
67
59
 
68
- ## 4. Harness Core Components
60
+ ### 4.1 CLI Entry
69
61
 
70
- ### 4.1 Runner / Loop
62
+ - **Location**: `bin/create-harness-vibe-coding.js`, `src/index.js`
63
+ - **Responsibility**: Parse flags, handle interactive/non-interactive modes, print plans/results, and call the generator.
64
+ - **Does NOT handle**: Template walking, conflict classification, or file writing internals.
71
65
 
72
- - **Responsibility**: Drives a task from input to completion: loading context, calling application use-cases, handling stop conditions.
73
- - **Design Decision**:
74
- - Runner only orchestrates, does not interpret domain meaning — Rationale: keeps harness reusable across different business domains
75
- - Stop conditions are explicitly modeled — Rationale: prevents agent loops from running indefinitely or silently half-completing
76
- - **Does NOT handle**: Business rules, domain object creation details, external service implementations
66
+ ### 4.2 Prompt Layer
77
67
 
78
- ### 4.2 Permission Policy
68
+ - **Location**: `src/prompts.js`
69
+ - **Responsibility**: Ask basic interactive npx questions: project name and target directory.
70
+ - **Does NOT handle**: Agent-link install intake. That matrix is read by coding agents from `README.md` and `Harness/SETUP.md`.
79
71
 
80
- - **Responsibility**: Decides whether a given tool, file, network, or external action is allowed to execute.
81
- - **Design Decision**:
82
- - High-risk actions are denied by default, allow rules are explicitly declared — Rationale: the platform must first guarantee security boundaries
83
- - **Does NOT handle**: Judging whether a business action is correct
72
+ ### 4.3 Generator Core
84
73
 
85
- ### 4.3 Event Bus / Audit Trail
74
+ - **Location**: `src/generator.js`
75
+ - **Responsibility**: Resolve optional selections, map template paths to destination paths, detect conflicts, render templates, register optional workflows, and write files.
76
+ - **Critical functions**:
77
+ - `harnessDest()` maps legacy template source paths such as `docs/harness/*` into generated root `Harness/*`.
78
+ - `createPlan()` and `addFileActions()` classify directories and file actions before writes.
79
+ - `registerOptionalContent()` updates generated router/memory docs when optional workflows are selected.
86
80
 
87
- - **Responsibility**: Records task lifecycle, tool invocations, failures, human approvals, and final results.
88
- - **Design Decision**:
89
- - Events are append-only, audit records cannot be overwritten in place — Rationale: facilitates replay, debugging, and post-mortem analysis
90
- - **Does NOT handle**: Saving final data on behalf of business systems
81
+ ### 4.4 Template Assets
91
82
 
92
- ### 4.4 State / Checkpoint Store
83
+ - **Location**: `templates/common/**`, `templates/optional/**`
84
+ - **Responsibility**: Define generated `CLAUDE.md`, `AGENTS.md`, `README.md`, `Harness/**`, `.claude/**`, optional skills, and optional workflows.
85
+ - **Does NOT handle**: Existing-project decisions. Templates state contracts; generator and agents apply them safely.
93
86
 
94
- - **Responsibility**: Saves recoverable state, context summaries, task progress, and interrupt points.
95
- - **Design Decision**:
96
- - State format must be serializable — Rationale: enables replay, resume, testing, and migration
97
- - **Does NOT handle**: Long-term business database modeling
87
+ ### 4.5 Validator
98
88
 
99
- ### 4.5 Tool Registry
89
+ - **Source template**: `templates/common/scripts/validate-harness.mjs`
90
+ - **Generated location**: `Harness/scripts/validate-harness.mjs`
91
+ - **Responsibility**: Validate required scaffold files, skill/agent registrations, router invariants, optional workflow registrations, and strict project-fact placeholders.
100
92
 
101
- - **Responsibility**: Registers callable tools along with their input/output contracts, permission labels, and error semantics.
102
- - **Design Decision**:
103
- - Tool contracts explicitly specify input, output, errors, and side effects — Rationale: reduces the probability of agent tool misuse
104
- - **Does NOT handle**: Internal business implementation of tools
93
+ ### 4.6 Dogfood Runtime
105
94
 
106
- ---
95
+ - **Location**: root `Harness/**`, `.claude/**`, `CLAUDE.md`, `AGENTS.md`, `MEMORY.md`
96
+ - **Responsibility**: Govern future AI-agent work in this repository.
97
+ - **Does NOT handle**: Changing package output unless edits are made to `templates/**` or source code.
98
+
99
+ ## 5. Data Flow
100
+
101
+ ```text
102
+ CLI args / prompts
103
+ -> src/index.js parse and display
104
+ -> src/generator.js resolve optional catalog
105
+ -> walk templates/common and selected templates/optional
106
+ -> harnessDest maps source paths to generated destinations
107
+ -> createPlan/addFileActions classify create/skip/backup/overwrite/conflict
108
+ -> renderTemplate substitutes projectName
109
+ -> registerOptionalContent updates generated Harness router/memory
110
+ -> write files or return dry-run/json plan
111
+ -> tests and generated validator verify behavior
112
+ ```
113
+
114
+ ## 6. Architectural Constraints
115
+
116
+ - Do not add generated-output behavior by editing only root `Harness/`; edit `templates/common/**` or `templates/optional/**`.
117
+ - Do not add user-facing CLI behavior without tests in `tests/cli-smoke.test.js` or `tests/generator.test.js`.
118
+ - Do not add required generated files without updating `templates/common/scripts/validate-harness.mjs` and relevant tests.
119
+ - Do not write Harness docs into generated `docs/`; `Harness/` is the generated root for harness-owned docs.
120
+ - Do not make root `CLAUDE.md` a dumping ground for build commands, architecture, or release process.
107
121
 
108
- ## 5. Architectural Constraints (Non-Negotiable)
122
+ ## 7. Known Follow-Up Risks
109
123
 
110
- - `domain/` only defines business models, business invariants, and port protocols; does not import `harness/`, `infrastructure/`, or `interfaces/`.
111
- - `harness/` may orchestrate workflows, security gates, auditing, and stop conditions, but must not determine business meaning.
112
- - All cross-layer external capabilities are expressed through `domain` ports; adapter implementations live in `infrastructure/`.
113
- - Rejections and failures must be testable or documented with manual verification steps in the feature doc.
114
- - Audit events are append-only, never overwritten in place.
124
+ - Interactive confirmation currently happens before full conflict-plan display in interactive mode.
125
+ - Some README tests assert exact prose and can be made more structural.
126
+ - `wf-mode` and `subagent-orchestrator` routing priority should continue to be tightened in templates.
@@ -6,7 +6,7 @@ Purpose: guide agent research. Record conclusions in [research-results.md](resea
6
6
 
7
7
  Use this before PRD, stack choice, external API use, public dependency choice, pricing/legal/security assumptions, or any fact likely to change.
8
8
 
9
- Skip only when the task is local, narrow, and fully answerable from existing project files. Record the skip reason in `Harness/tasks/<task-id>/PROGRESS.md`.
9
+ Skip only when the task is local, narrow, and fully answerable from existing project files. Record the skip reason in `Harness/tasks/<task-id>/PLAN.md`.
10
10
 
11
11
  ## Research Agent
12
12
 
@@ -104,7 +104,7 @@ Use these patterns when turning research into PRD or feature docs:
104
104
 
105
105
  ## Write Target
106
106
 
107
- - Research process, queries, and limitations: this file or `Harness/tasks/<task-id>/PROGRESS.md`.
107
+ - Research process, queries, and limitations: this file or `Harness/tasks/<task-id>/PLAN.md`.
108
108
  - Final research decisions: [research-results.md](research-results.md).
109
109
  - Product scope: [PRD.md](PRD.md).
110
110
  - Architecture consequences: `Harness/architecture.md` and `Harness/domain/ports.md`.