create-harness-vibe-coding 0.8.8 → 0.8.10
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-CN.md +8 -2
- package/README.md +22 -3
- package/docs/images/harness-icon.png +0 -0
- package/package.json +3 -1
- package/src/generator.js +36 -0
- package/src/index.js +72 -4
- package/templates/common/.claude/agents/architect.md +31 -31
- package/templates/common/.claude/agents/codebase-explorer.md +45 -0
- package/templates/common/.claude/agents/docs-researcher.md +41 -41
- package/templates/common/.claude/agents/memory-master.md +26 -8
- package/templates/common/.claude/agents/reviewer.md +34 -34
- package/templates/common/.claude/agents/task-scribe.md +70 -0
- package/templates/common/.claude/commands/wf-help.md +9 -5
- package/templates/common/.claude/commands/wf-update.md +24 -0
- package/templates/common/.claude/rules/ecc/common.md +15 -2
- package/templates/common/.claude/settings.json +13 -0
- package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +10 -6
- package/templates/common/.claude/skills/wf/SKILL.md +15 -8
- package/templates/common/.claude/skills/wf-auto/SKILL.md +3 -2
- package/templates/common/.claude/skills/wf-learn/SKILL.md +9 -2
- package/templates/common/.claude/skills/wf-max/SKILL.md +26 -8
- package/templates/common/.claude/skills/wf-review/SKILL.md +63 -12
- package/templates/common/.claude/skills/wf-update/SKILL.md +15 -2
- package/templates/common/.codex/hooks.json +17 -0
- package/templates/common/.harness-version +93 -48
- package/templates/common/.opencode/agents/architect.md +24 -24
- package/templates/common/.opencode/agents/codebase-explorer.md +45 -0
- package/templates/common/.opencode/agents/docs-researcher.md +34 -34
- package/templates/common/.opencode/agents/memory-master.md +26 -8
- package/templates/common/.opencode/agents/reviewer.md +27 -27
- package/templates/common/.opencode/agents/task-scribe.md +70 -0
- package/templates/common/.opencode/commands/wf-auto-spark.md +15 -0
- package/templates/common/.opencode/commands/wf-auto.md +15 -0
- package/templates/common/.opencode/commands/wf-help.md +9 -5
- package/templates/common/.opencode/commands/wf-learn.md +15 -0
- package/templates/common/.opencode/commands/wf-max.md +15 -0
- package/templates/common/.opencode/commands/wf-readme.md +15 -0
- package/templates/common/.opencode/commands/wf-remove.md +15 -0
- package/templates/common/.opencode/commands/wf-review.md +15 -0
- package/templates/common/.opencode/commands/wf-update.md +24 -0
- package/templates/common/.opencode/commands/wf.md +15 -0
- package/templates/common/.opencode/plugins/harness-wf-status.mjs +126 -0
- package/templates/common/AGENTS.md +2 -29
- package/templates/common/CLAUDE.md +35 -6
- package/templates/common/Harness/ACCEPTANCE_PROTOCOL.md +2 -2
- package/templates/common/{MEMORY.md → Harness/MEMORY.md} +17 -4
- package/templates/common/Harness/MEMORY_PROTOCOL.md +80 -30
- package/templates/common/Harness/README.md +53 -25
- package/templates/common/{SETUP.md → Harness/SETUP.md} +278 -276
- package/templates/common/Harness/TASK_ARCHIVE.md +56 -0
- package/templates/common/Harness/WF-AUTO-ANGLES.md +1 -1
- package/templates/common/Harness/WF-AUTO-SPARK.md +5 -14
- package/templates/common/Harness/WF-AUTO.md +22 -84
- package/templates/common/Harness/WF-KERNEL.md +189 -0
- package/templates/common/Harness/WF-MAX.md +60 -328
- package/templates/common/Harness/WF-STATE.md +83 -0
- package/templates/common/Harness/WF.md +117 -237
- package/templates/common/Harness/agent-workflow.md +2 -2
- package/templates/common/Harness/context-loading.md +3 -3
- package/templates/common/Harness/dispatch.md +43 -35
- package/templates/common/Harness/scripts/archive-tasks.mjs +239 -0
- package/templates/common/{scripts → Harness/scripts}/scan-clean.mjs +29 -1
- package/templates/common/{scripts → Harness/scripts}/validate-harness.mjs +921 -699
- package/templates/common/Harness/scripts/wf-auto-update-prompt.mjs +258 -0
- package/templates/common/{scripts → Harness/scripts}/wf-remove.mjs +1 -0
- package/templates/common/{scripts → Harness/scripts}/wf-update-check.mjs +163 -52
- package/templates/common/Harness/subagents.md +36 -28
- package/templates/common/Harness/tasks/_template/PLAN.md +5 -0
- package/templates/common/Harness/tasks/_template/STATE.json +23 -0
- package/templates/common/README.md +2 -2
- package/templates/common/memory/agent-lessons-patterns.md +9 -8
- package/templates/common/memory/routes.md +43 -0
- package/templates/common/memory/startup-hints.md +32 -0
- package/templates/common/memory/tool-usage-reflections.md +9 -8
- package/templates/common/memory/user-corrections-preferences.md +11 -9
- package/templates/optional/catalog.json +8 -0
- package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +42 -42
- package/templates/optional/skills/browser-e2e/.opencode/commands/wf-browser.md +15 -0
- package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +40 -40
- package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +40 -40
- package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +43 -43
- package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +40 -40
|
@@ -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
|
+
}
|
|
@@ -54,10 +54,18 @@ const FRAMEWORK_DIRS = [
|
|
|
54
54
|
'Harness/workflows',
|
|
55
55
|
];
|
|
56
56
|
|
|
57
|
+
/** Framework-managed dirs also tracked via checksums — files here are NOT orphans. */
|
|
58
|
+
const MANAGED_SUBDIRS = new Set([
|
|
59
|
+
'.opencode/agents',
|
|
60
|
+
'.opencode/commands',
|
|
61
|
+
'.opencode/plugins',
|
|
62
|
+
]);
|
|
63
|
+
|
|
57
64
|
// ── Helpers ──────────────────────────────────────────────────────────
|
|
58
65
|
|
|
59
66
|
/** Reject paths that escape ROOT (traversal, absolute, .., etc.). */
|
|
60
67
|
function safePath(file) {
|
|
68
|
+
if (/^[A-Za-z]:/.test(file)) return null;
|
|
61
69
|
let normalized = file.replace(/\\/g, '/').replace(/^\/+/, '');
|
|
62
70
|
if (/\/\//.test(normalized)) return null;
|
|
63
71
|
if (normalized.split('/').some(p => p === '..')) return null;
|
|
@@ -109,7 +117,17 @@ function optionalSkillFromSource(source) {
|
|
|
109
117
|
|
|
110
118
|
function isInstalledOptionalFile(file, localVersion) {
|
|
111
119
|
const skillId = optionalSkillFromSource(localVersion?.sources?.[file]);
|
|
112
|
-
|
|
120
|
+
if (skillId && selectedOptionIds(localVersion).has(skillId)) return true;
|
|
121
|
+
// Also check if the file is in the optional file patterns (not tracked in common checksums)
|
|
122
|
+
// e.g. .opencode/commands/wf-browser.md from browser-e2e
|
|
123
|
+
const canonical = canonicalPath(file);
|
|
124
|
+
if (/^\.opencode\/commands\/wf-browser\.md$/.test(canonical)) {
|
|
125
|
+
return selectedOptionIds(localVersion).has('browser-e2e');
|
|
126
|
+
}
|
|
127
|
+
if (/^\.claude\/skills\/wf-browser\//.test(canonical)) {
|
|
128
|
+
return selectedOptionIds(localVersion).has('browser-e2e');
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
113
131
|
}
|
|
114
132
|
|
|
115
133
|
/** Detect template placeholders in remote content. */
|
|
@@ -178,6 +196,16 @@ function findOrphanFiles(localChecksums, remoteChecksums) {
|
|
|
178
196
|
}
|
|
179
197
|
}
|
|
180
198
|
|
|
199
|
+
// Check MANAGED_SUBDIRS for orphans too (directories tracked via checksums, not in FRAMEWORK_DIRS)
|
|
200
|
+
for (const dir of MANAGED_SUBDIRS) {
|
|
201
|
+
const diskFiles = listFilesRecursive(dir);
|
|
202
|
+
for (const file of diskFiles) {
|
|
203
|
+
if (allTracked.has(file)) continue;
|
|
204
|
+
if (isPreserved(file)) continue;
|
|
205
|
+
orphans.push({ file, reason: 'untracked in managed subdirectory' });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
181
209
|
return orphans;
|
|
182
210
|
}
|
|
183
211
|
|