create-harness-vibe-coding 0.8.7 → 0.8.9

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 (126) hide show
  1. package/README-CN.md +163 -105
  2. package/README.md +179 -244
  3. package/bin/create-harness-vibe-coding.js +2 -2
  4. package/docs/images/harness-architecture-light.png +0 -0
  5. package/docs/images/harness-architecture.drawio +164 -0
  6. package/docs/images/harness-icon.png +0 -0
  7. package/package.json +47 -44
  8. package/src/generator.js +41 -5
  9. package/src/index.js +86 -13
  10. package/src/prompts.js +37 -37
  11. package/templates/common/.claude/agents/architect-manager.md +45 -45
  12. package/templates/common/.claude/agents/architect.md +31 -31
  13. package/templates/common/.claude/agents/codebase-explorer.md +45 -0
  14. package/templates/common/.claude/agents/context-master.md +75 -75
  15. package/templates/common/.claude/agents/debugger.md +41 -41
  16. package/templates/common/.claude/agents/docs-researcher.md +41 -41
  17. package/templates/common/.claude/agents/explore-manager.md +41 -41
  18. package/templates/common/.claude/agents/implement-manager.md +49 -49
  19. package/templates/common/.claude/agents/implementer.md +40 -40
  20. package/templates/common/.claude/agents/memory-master.md +82 -64
  21. package/templates/common/.claude/agents/planner.md +34 -34
  22. package/templates/common/.claude/agents/researcher.md +41 -41
  23. package/templates/common/.claude/agents/review-manager.md +56 -56
  24. package/templates/common/.claude/agents/reviewer.md +34 -34
  25. package/templates/common/.claude/agents/task-scribe.md +70 -0
  26. package/templates/common/.claude/agents/verifier.md +29 -29
  27. package/templates/common/.claude/commands/wf-help.md +9 -5
  28. package/templates/common/.claude/commands/wf-update.md +24 -0
  29. package/templates/common/.claude/rules/ecc/common.md +57 -44
  30. package/templates/common/.claude/settings.json +13 -0
  31. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +8 -4
  32. package/templates/common/.claude/skills/wf/SKILL.md +15 -8
  33. package/templates/common/.claude/skills/wf-auto/SKILL.md +10 -7
  34. package/templates/common/.claude/skills/wf-learn/SKILL.md +9 -2
  35. package/templates/common/.claude/skills/wf-max/SKILL.md +23 -5
  36. package/templates/common/.claude/skills/wf-readme/SKILL.md +49 -49
  37. package/templates/common/.claude/skills/wf-remove/SKILL.md +7 -7
  38. package/templates/common/.claude/skills/wf-update/SKILL.md +15 -2
  39. package/templates/common/.codex/hooks.json +17 -0
  40. package/templates/common/.harness-version +130 -45
  41. package/templates/common/.opencode/agents/architect-manager.md +52 -0
  42. package/templates/common/.opencode/agents/architect.md +35 -0
  43. package/templates/common/.opencode/agents/codebase-explorer.md +45 -0
  44. package/templates/common/.opencode/agents/context-master.md +81 -0
  45. package/templates/common/.opencode/agents/debugger.md +43 -0
  46. package/templates/common/.opencode/agents/docs-researcher.md +42 -0
  47. package/templates/common/.opencode/agents/explore-manager.md +49 -0
  48. package/templates/common/.opencode/agents/implement-manager.md +56 -0
  49. package/templates/common/.opencode/agents/implementer.md +42 -0
  50. package/templates/common/.opencode/agents/memory-master.md +88 -0
  51. package/templates/common/.opencode/agents/planner.md +38 -0
  52. package/templates/common/.opencode/agents/reflector.md +39 -0
  53. package/templates/common/.opencode/agents/researcher.md +42 -0
  54. package/templates/common/.opencode/agents/review-manager.md +63 -0
  55. package/templates/common/.opencode/agents/reviewer.md +37 -0
  56. package/templates/common/.opencode/agents/task-scribe.md +70 -0
  57. package/templates/common/.opencode/agents/tdd-guide.md +83 -0
  58. package/templates/common/.opencode/agents/test-writer.md +54 -0
  59. package/templates/common/.opencode/agents/verifier.md +37 -0
  60. package/templates/common/.opencode/commands/wf-auto-spark.md +15 -0
  61. package/templates/common/.opencode/commands/wf-auto.md +15 -0
  62. package/templates/common/.opencode/commands/wf-help.md +27 -0
  63. package/templates/common/.opencode/commands/wf-learn.md +15 -0
  64. package/templates/common/.opencode/commands/wf-max.md +15 -0
  65. package/templates/common/.opencode/commands/wf-readme.md +15 -0
  66. package/templates/common/.opencode/commands/wf-remove.md +15 -0
  67. package/templates/common/.opencode/commands/wf-review.md +15 -0
  68. package/templates/common/.opencode/commands/wf-update.md +24 -0
  69. package/templates/common/.opencode/commands/wf.md +15 -0
  70. package/templates/common/.opencode/plugins/harness-wf-status.mjs +135 -0
  71. package/templates/common/AGENTS.md +2 -29
  72. package/templates/common/CLAUDE.md +114 -88
  73. package/templates/common/Harness/ACCEPTANCE_PROTOCOL.md +2 -2
  74. package/templates/common/{MEMORY.md → Harness/MEMORY.md} +17 -4
  75. package/templates/common/Harness/MEMORY_PROTOCOL.md +80 -30
  76. package/templates/common/Harness/PROGRESS.md +17 -17
  77. package/templates/common/Harness/README.md +58 -19
  78. package/templates/common/{SETUP.md → Harness/SETUP.md} +278 -276
  79. package/templates/common/Harness/TASK_ARCHIVE.md +56 -0
  80. package/templates/common/Harness/WF-AUTO-ANGLES.md +170 -0
  81. package/templates/common/Harness/WF-AUTO-SPARK.md +10 -19
  82. package/templates/common/Harness/WF-AUTO.md +93 -167
  83. package/templates/common/Harness/WF-KERNEL.md +189 -0
  84. package/templates/common/Harness/WF-MAX.md +60 -328
  85. package/templates/common/Harness/WF-STATE.md +83 -0
  86. package/templates/common/Harness/WF.md +117 -237
  87. package/templates/common/Harness/agent-workflow.md +2 -2
  88. package/templates/common/Harness/architecture.md +124 -124
  89. package/templates/common/Harness/context-loading.md +111 -111
  90. package/templates/common/Harness/dispatch.md +43 -35
  91. package/templates/common/Harness/extension.md +66 -66
  92. package/templates/common/Harness/lifecycle.md +20 -20
  93. package/templates/common/Harness/research/PRD.md +56 -56
  94. package/templates/common/Harness/research/README.md +169 -169
  95. package/templates/common/Harness/research/research-results.md +66 -66
  96. package/templates/common/Harness/scripts/archive-tasks.mjs +239 -0
  97. package/templates/common/{scripts → Harness/scripts}/scan-clean.mjs +443 -416
  98. package/templates/common/{scripts → Harness/scripts}/validate-harness.mjs +691 -452
  99. package/templates/common/Harness/scripts/wf-auto-update-prompt.mjs +258 -0
  100. package/templates/common/{scripts → Harness/scripts}/wf-remove.mjs +56 -39
  101. package/templates/common/{scripts → Harness/scripts}/wf-update-check.mjs +632 -599
  102. package/templates/common/Harness/subagents.md +215 -214
  103. package/templates/common/Harness/tasks/_template/ARTIFACTS.md +2 -2
  104. package/templates/common/Harness/tasks/_template/NOTES.md +2 -2
  105. package/templates/common/Harness/tasks/_template/PLAN.md +5 -0
  106. package/templates/common/Harness/tasks/_template/STATE.json +23 -0
  107. package/templates/common/README.md +37 -37
  108. package/templates/common/memory/agent-lessons-patterns.md +22 -21
  109. package/templates/common/memory/routes.md +43 -0
  110. package/templates/common/memory/startup-hints.md +32 -0
  111. package/templates/common/memory/tool-usage-reflections.md +22 -21
  112. package/templates/common/memory/user-corrections-preferences.md +23 -21
  113. package/templates/common/opencode.json +19 -0
  114. package/templates/optional/catalog.json +49 -33
  115. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +42 -42
  116. package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +193 -193
  117. package/templates/optional/skills/browser-e2e/.opencode/commands/wf-browser.md +15 -0
  118. package/templates/optional/skills/browser-e2e/Harness/workflows/browser-e2e.md +48 -48
  119. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +40 -40
  120. package/templates/optional/skills/github-pr-review/Harness/workflows/github-pr-review.md +28 -28
  121. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +40 -40
  122. package/templates/optional/skills/python-backend/Harness/workflows/python-backend.md +34 -34
  123. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +43 -43
  124. package/templates/optional/skills/ts-react-frontend/Harness/workflows/ts-react-frontend.md +34 -34
  125. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +40 -40
  126. package/templates/optional/skills/ui-ux-review/Harness/workflows/ui-ux-review.md +26 -26
@@ -0,0 +1,239 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+
5
+ const root = process.cwd();
6
+ const tasksDir = path.join(root, 'Harness', 'tasks');
7
+ const archiveDir = path.join(tasksDir, '_archive');
8
+
9
+ const args = process.argv.slice(2);
10
+ const flags = {
11
+ dryRun: !args.includes('--apply'),
12
+ apply: args.includes('--apply'),
13
+ json: args.includes('--json'),
14
+ keep: parseInt(args.includes('--keep') ? args[args.indexOf('--keep') + 1] : '5', 10),
15
+ task: args.includes('--task') ? args[args.indexOf('--task') + 1] : null,
16
+ };
17
+
18
+ if (args.includes('--help') || args.includes('-h')) {
19
+ console.log(`Usage: node Harness/scripts/archive-tasks.mjs [options]
20
+
21
+ Options:
22
+ --dry-run Show what would be archived without moving files (default)
23
+ --apply Execute the archive moves
24
+ --keep <n> Keep at most <n> non-archived tasks (default: 5)
25
+ --task <id> Archive only the specified task
26
+ --json Output results as JSON
27
+ --help, -h Show this help`);
28
+ process.exit(0);
29
+ }
30
+
31
+ const RESERVED = new Set(['_template', '_archive', 'auto']);
32
+ const NEVER_ARCHIVE_STATUSES = new Set([
33
+ 'active', 'blocked', 'in_progress', 'running', 'pending', 'needs-user-decision',
34
+ ]);
35
+ const SAFE_ARCHIVE_STATUSES = new Set([
36
+ 'complete', 'verified', 'archived', 'abandoned', 'obsolete', 'done', 'closed', 'closeout',
37
+ ]);
38
+
39
+ function readStateJson(taskDir) {
40
+ const statePath = path.join(tasksDir, taskDir, 'STATE.json');
41
+ if (!fs.existsSync(statePath)) return null;
42
+ try {
43
+ return JSON.parse(fs.readFileSync(statePath, 'utf8'));
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+
49
+ function readProgressPhase(taskDir) {
50
+ const progressPath = path.join(tasksDir, taskDir, 'PROGRESS.md');
51
+ if (!fs.existsSync(progressPath)) return null;
52
+ const text = fs.readFileSync(progressPath, 'utf8');
53
+ // Match "- Phase: X", "Phase: X", or "Current: X" (task capsules use all three).
54
+ const match = text.match(/^(?:-\s*)?(?:Phase|Current(?: phase)?):\s*([A-Za-z_-]+)/mi);
55
+ return match ? match[1].trim().toLowerCase() : null;
56
+ }
57
+
58
+ function canArchive(taskDir) {
59
+ if (RESERVED.has(taskDir)) return { ok: false, reason: 'reserved directory' };
60
+ if (taskDir.startsWith('_')) return { ok: false, reason: 'system directory' };
61
+
62
+ const state = readStateJson(taskDir);
63
+ const status = state?.status?.toLowerCase() || '';
64
+ const phase = state?.phase?.toLowerCase() || '';
65
+
66
+ if (NEVER_ARCHIVE_STATUSES.has(status)) {
67
+ return { ok: false, reason: `status "${status}" is never auto-archived` };
68
+ }
69
+ if (NEVER_ARCHIVE_STATUSES.has(phase)) {
70
+ return { ok: false, reason: `phase "${phase}" is never auto-archived` };
71
+ }
72
+
73
+ if (SAFE_ARCHIVE_STATUSES.has(status) || SAFE_ARCHIVE_STATUSES.has(phase)) {
74
+ return { ok: true, reason: `status/phase allows archive` };
75
+ }
76
+
77
+ // Fallback: check PROGRESS.md phase
78
+ const progressPhase = readProgressPhase(taskDir);
79
+ if (progressPhase && SAFE_ARCHIVE_STATUSES.has(progressPhase)) {
80
+ return { ok: true, reason: `PROGRESS.md phase "${progressPhase}" allows archive` };
81
+ }
82
+ if (progressPhase && NEVER_ARCHIVE_STATUSES.has(progressPhase)) {
83
+ return { ok: false, reason: `PROGRESS.md phase "${progressPhase}" is never auto-archived` };
84
+ }
85
+
86
+ return { ok: false, reason: 'status indeterminate — requires manual review' };
87
+ }
88
+
89
+ function scandir(dir) {
90
+ if (!fs.existsSync(dir)) return [];
91
+ return fs.readdirSync(dir, { withFileTypes: true })
92
+ .filter(e => e.isDirectory())
93
+ .map(e => e.name);
94
+ }
95
+
96
+ function safeResolve(...segments) {
97
+ const resolved = path.resolve(root, ...segments);
98
+ const normalized = resolved.replace(/\\/g, '/');
99
+ const tasksPrefix = tasksDir.replace(/\\/g, '/');
100
+ if (!normalized.startsWith(tasksPrefix + '/') && normalized !== tasksPrefix) {
101
+ throw new Error(`Path "${resolved}" is outside Harness/tasks/ — aborting`);
102
+ }
103
+ return resolved;
104
+ }
105
+
106
+ function mkdirIfMissing(dir) {
107
+ if (!fs.existsSync(dir)) {
108
+ if (flags.apply) {
109
+ fs.mkdirSync(dir, { recursive: true });
110
+ }
111
+ return true;
112
+ }
113
+ return false;
114
+ }
115
+
116
+ function resultsToJson(results) {
117
+ return JSON.stringify(results, null, 2);
118
+ }
119
+
120
+ // Main
121
+ const taskDirs = scandir(tasksDir).filter(d => !RESERVED.has(d));
122
+ const candidates = flags.task
123
+ ? taskDirs.filter(d => d === flags.task)
124
+ : taskDirs;
125
+
126
+ if (flags.task && candidates.length === 0) {
127
+ const msg = `Task "${flags.task}" not found in Harness/tasks/`;
128
+ if (flags.json) console.log(resultsToJson({ error: msg }));
129
+ else console.error(msg);
130
+ process.exit(1);
131
+ }
132
+
133
+ const results = [];
134
+ const skipped = [];
135
+
136
+ // Read active task from PROGRESS.md
137
+ const progressPath = path.join(root, 'Harness', 'PROGRESS.md');
138
+ let activeTask = null;
139
+ if (fs.existsSync(progressPath)) {
140
+ const text = fs.readFileSync(progressPath, 'utf8');
141
+ const match = text.match(/## Active Task\s*\n+\s*-\s*(.+)/);
142
+ if (match) activeTask = match[1].trim();
143
+ }
144
+
145
+ const archiveable = [];
146
+ for (const dir of candidates) {
147
+ if (dir === activeTask) {
148
+ skipped.push({ dir, reason: 'active task' });
149
+ continue;
150
+ }
151
+ const result = canArchive(dir);
152
+ if (result.ok) {
153
+ archiveable.push(dir);
154
+ } else {
155
+ skipped.push({ dir, reason: result.reason });
156
+ }
157
+ }
158
+
159
+ // Sort by modified time (oldest first) to archive oldest first
160
+ archiveable.sort((a, b) => {
161
+ const statA = fs.statSync(path.join(tasksDir, a));
162
+ const statB = fs.statSync(path.join(tasksDir, b));
163
+ return statA.mtimeMs - statB.mtimeMs;
164
+ });
165
+
166
+ // Determine how many to archive: keep `flags.keep` non-archived
167
+ const currentNonArchived = taskDirs.length;
168
+ const toArchiveCount = flags.task
169
+ ? archiveable.length
170
+ : Math.max(0, currentNonArchived - flags.keep);
171
+
172
+ const toArchive = archiveable.slice(0, toArchiveCount);
173
+
174
+ for (const dir of toArchive) {
175
+ const stat = fs.statSync(path.join(tasksDir, dir));
176
+ const year = new Date(stat.mtimeMs).getFullYear().toString();
177
+ const src = safeResolve('Harness', 'tasks', dir);
178
+ const destDir = safeResolve('Harness', 'tasks', '_archive', year);
179
+ const dest = path.join(destDir, dir);
180
+
181
+ if (flags.apply) {
182
+ mkdirIfMissing(destDir);
183
+ fs.renameSync(src, dest);
184
+
185
+ // Update STATE.json status to archived
186
+ const statePath = path.join(dest, 'STATE.json');
187
+ if (fs.existsSync(statePath)) {
188
+ try {
189
+ const state = JSON.parse(fs.readFileSync(statePath, 'utf8'));
190
+ state.status = 'archived';
191
+ state.phase = 'archived';
192
+ state.updatedAt = new Date().toISOString();
193
+ fs.writeFileSync(statePath, JSON.stringify(state, null, 2) + '\n');
194
+ } catch {
195
+ // If STATE.json is broken, leave it alone
196
+ }
197
+ }
198
+
199
+ results.push({ dir, year, action: 'archived', status: 'moved' });
200
+ } else {
201
+ results.push({ dir, year, action: 'would-archive', status: 'dry-run' });
202
+ }
203
+ }
204
+
205
+ for (const s of skipped) {
206
+ results.push({ dir: s.dir, year: null, action: 'skipped', status: s.reason });
207
+ }
208
+
209
+ // Update INDEX.md
210
+ const indexPath = path.join(archiveDir, 'INDEX.md');
211
+ const indexEntries = results
212
+ .filter(r => r.action === 'archived')
213
+ .map(r => `| ${r.dir} | ${r.year} | ${new Date().toISOString().split('T')[0]} |`);
214
+
215
+ if (indexEntries.length > 0 && flags.apply) {
216
+ mkdirIfMissing(archiveDir);
217
+ const existingIndex = fs.existsSync(indexPath)
218
+ ? fs.readFileSync(indexPath, 'utf8')
219
+ : '| Task | Year | Archived |\n|------|------|----------|\n';
220
+ const newEntries = indexEntries.join('\n') + '\n';
221
+ fs.writeFileSync(indexPath, existingIndex + newEntries);
222
+ }
223
+
224
+ if (flags.json) {
225
+ console.log(resultsToJson({
226
+ scanned: candidates.length,
227
+ archiveable: archiveable.length,
228
+ toArchive: toArchive.length,
229
+ skipped: skipped.length,
230
+ dryRun: flags.dryRun,
231
+ results,
232
+ }));
233
+ } else {
234
+ if (flags.dryRun) console.log('[DRY RUN] No files moved. Use --apply to execute.');
235
+ console.log(`Scanned: ${candidates.length}, Archiveable: ${archiveable.length}, To archive: ${toArchive.length}, Skipped: ${skipped.length}`);
236
+ for (const r of results) {
237
+ console.log(` ${r.action}: ${r.dir} (${r.status})${r.year ? ' → _archive/' + r.year : ''}`);
238
+ }
239
+ }