create-harness-vibe-coding 0.8.16 → 0.8.18
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/CHANGELOG.md +18 -0
- package/README-CN.md +100 -127
- package/README.md +63 -42
- package/package.json +1 -1
- package/src/generator.js +628 -121
- package/src/index.js +174 -43
- package/src/prompts.js +18 -0
- package/templates/common/.claude/commands/wf-auto-spark.md +16 -0
- package/templates/common/.claude/commands/wf-auto.md +16 -0
- package/templates/{optional/skills/browser-e2e/.opencode → common/.claude}/commands/wf-browser.md +1 -1
- package/templates/common/.claude/commands/wf-command-create.md +58 -0
- package/templates/common/.claude/commands/wf-help.md +13 -6
- package/templates/common/.claude/commands/wf-learn.md +16 -0
- package/templates/common/.claude/commands/wf-max.md +20 -0
- package/templates/common/.claude/commands/wf-readme.md +16 -0
- package/templates/common/.claude/commands/wf-remove.md +16 -0
- package/templates/common/.claude/commands/wf-review.md +16 -0
- package/templates/common/.claude/commands/wf-task-archive.md +26 -0
- package/templates/common/.claude/commands/wf-task-list.md +24 -0
- package/templates/common/.claude/commands/wf-task-record.md +24 -0
- package/templates/common/.claude/commands/wf.md +16 -0
- package/templates/common/.claude/rules/ecc/common.md +1 -1
- package/templates/common/.claude/skills/wf-agents-docs/SKILL.md +15 -30
- package/templates/common/.claude/skills/wf-browser/SKILL.md +176 -0
- package/templates/common/.claude/skills/wf-command-create/SKILL.md +37 -0
- package/templates/common/.claude/skills/wf-help/SKILL.md +30 -0
- package/templates/common/.claude/skills/wf-max/SKILL.md +22 -8
- package/templates/common/.claude/skills/wf-review/SKILL.md +29 -2
- package/templates/common/.claude/skills/wf-task-archive/SKILL.md +28 -0
- package/templates/common/.claude/skills/wf-task-list/SKILL.md +28 -0
- package/templates/common/.claude/skills/wf-task-record/SKILL.md +28 -0
- package/templates/common/.codex/config.toml +3 -5
- package/templates/common/.harness-version +108 -41
- package/templates/common/.opencode/agents/architect-manager.md +7 -1
- package/templates/common/.opencode/agents/explore-manager.md +10 -1
- package/templates/common/.opencode/agents/implement-manager.md +5 -3
- package/templates/common/.opencode/agents/review-manager.md +5 -2
- package/templates/common/.opencode/commands/wf-browser.md +16 -0
- package/templates/common/.opencode/commands/wf-command-create.md +61 -0
- package/templates/common/.opencode/commands/wf-help.md +13 -6
- package/templates/common/.opencode/commands/wf-max.md +12 -7
- package/templates/common/.opencode/commands/wf-task-archive.md +29 -0
- package/templates/common/.opencode/commands/wf-task-list.md +27 -0
- package/templates/common/.opencode/commands/wf-task-record.md +27 -0
- package/templates/common/CLAUDE.md +9 -7
- package/templates/common/Harness/MEMORY.md +12 -3
- package/templates/common/Harness/README.md +23 -41
- package/templates/common/Harness/ownership.manifest.json +162 -14
- package/templates/common/Harness/scripts/archive-tasks.mjs +12 -220
- package/templates/common/Harness/scripts/scan-clean.mjs +3 -9
- package/templates/common/Harness/scripts/task-state.mjs +1279 -0
- package/templates/common/Harness/scripts/validate-harness.mjs +635 -65
- package/templates/common/Harness/scripts/wf-remove.mjs +37 -5
- package/templates/common/Harness/scripts/wf-update-check.mjs +3 -0
- package/templates/common/Harness/specs/guides/SETUP.md +10 -2
- package/templates/common/Harness/specs/protocols/MEMORY_PROTOCOL.md +15 -0
- package/templates/common/Harness/specs/protocols/TASK_ARCHIVE.md +49 -23
- package/templates/common/Harness/specs/runtime/command-surface.json +215 -0
- package/templates/common/Harness/specs/runtime/dispatch.md +2 -2
- package/templates/common/Harness/specs/runtime/subagents.md +15 -5
- package/templates/common/Harness/specs/workflows/WF-AUTO.md +6 -6
- package/templates/common/Harness/specs/workflows/WF-KERNEL.md +1 -1
- package/templates/common/Harness/specs/workflows/WF-MAX.md +35 -2
- package/templates/common/Harness/specs/workflows/WF-STATE.md +155 -36
- package/templates/common/Harness/tasks/_template/STATE.json +6 -0
- package/templates/common/opencode.json +1 -0
- package/templates/optional/catalog.json +2 -9
- package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +0 -42
- package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +0 -201
- package/templates/optional/skills/browser-e2e/Harness/workflows/browser-e2e.md +0 -119
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
const taskState = path.join(__dirname, 'task-state.mjs');
|
|
9
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
10
|
|
|
18
11
|
if (args.includes('--help') || args.includes('-h')) {
|
|
19
12
|
console.log(`Usage: node Harness/scripts/archive-tasks.mjs [options]
|
|
20
13
|
|
|
14
|
+
Compatibility entry for: node Harness/scripts/task-state.mjs archive [options]
|
|
15
|
+
|
|
21
16
|
Options:
|
|
22
17
|
--dry-run Show what would be archived without moving files (default)
|
|
23
|
-
--apply Execute
|
|
18
|
+
--apply Execute archive moves
|
|
24
19
|
--keep <n> Keep at most <n> non-archived tasks (default: 5)
|
|
25
20
|
--task <id> Archive only the specified task
|
|
26
21
|
--json Output results as JSON
|
|
@@ -28,212 +23,9 @@ Options:
|
|
|
28
23
|
process.exit(0);
|
|
29
24
|
}
|
|
30
25
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
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;
|
|
26
|
+
const result = spawnSync(process.execPath, [taskState, 'archive', ...args], {
|
|
27
|
+
cwd: process.cwd(),
|
|
28
|
+
stdio: 'inherit',
|
|
164
29
|
});
|
|
165
30
|
|
|
166
|
-
|
|
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
|
-
}
|
|
31
|
+
process.exit(result.status ?? 1);
|
|
@@ -120,18 +120,12 @@ function optionalSkillFromSource(source) {
|
|
|
120
120
|
return match ? match[1] : null;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
const RETIRED_OPTION_IDS = new Set(['browser-e2e']);
|
|
124
|
+
|
|
123
125
|
function isInstalledOptionalFile(file, localVersion) {
|
|
124
126
|
const skillId = optionalSkillFromSource(localVersion?.sources?.[file]);
|
|
127
|
+
if (skillId && RETIRED_OPTION_IDS.has(skillId)) return false;
|
|
125
128
|
if (skillId && selectedOptionIds(localVersion).has(skillId)) return true;
|
|
126
|
-
// Also check if the file is in the optional file patterns (not tracked in common checksums)
|
|
127
|
-
// e.g. .opencode/commands/wf-browser.md from browser-e2e
|
|
128
|
-
const canonical = canonicalPath(file);
|
|
129
|
-
if (/^\.opencode\/commands\/wf-browser\.md$/.test(canonical)) {
|
|
130
|
-
return selectedOptionIds(localVersion).has('browser-e2e');
|
|
131
|
-
}
|
|
132
|
-
if (/^\.claude\/skills\/wf-browser\//.test(canonical)) {
|
|
133
|
-
return selectedOptionIds(localVersion).has('browser-e2e');
|
|
134
|
-
}
|
|
135
129
|
return false;
|
|
136
130
|
}
|
|
137
131
|
|