create-harness-vibe-coding 0.8.12 → 0.8.16

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 (115) hide show
  1. package/CHANGELOG.md +165 -0
  2. package/README-CN.md +52 -8
  3. package/README.md +50 -8
  4. package/package.json +3 -1
  5. package/src/generator.js +601 -472
  6. package/src/index.js +12 -4
  7. package/templates/common/.claude/agents/architect-manager.md +1 -0
  8. package/templates/common/.claude/agents/architect.md +2 -1
  9. package/templates/common/.claude/agents/codebase-explorer.md +1 -0
  10. package/templates/common/.claude/agents/context-master.md +2 -1
  11. package/templates/common/.claude/agents/debugger.md +1 -0
  12. package/templates/common/.claude/agents/docs-researcher.md +2 -1
  13. package/templates/common/.claude/agents/explore-manager.md +1 -0
  14. package/templates/common/.claude/agents/implement-manager.md +1 -0
  15. package/templates/common/.claude/agents/implementer.md +1 -0
  16. package/templates/common/.claude/agents/memory-master.md +2 -1
  17. package/templates/common/.claude/agents/planner.md +3 -2
  18. package/templates/common/.claude/agents/reflector.md +1 -0
  19. package/templates/common/.claude/agents/researcher.md +1 -0
  20. package/templates/common/.claude/agents/review-manager.md +1 -0
  21. package/templates/common/.claude/agents/reviewer.md +2 -1
  22. package/templates/common/.claude/agents/task-scribe.md +1 -0
  23. package/templates/common/.claude/agents/tdd-guide.md +5 -4
  24. package/templates/common/.claude/agents/test-writer.md +6 -5
  25. package/templates/common/.claude/agents/verifier.md +1 -0
  26. package/templates/common/.claude/commands/wf-help.md +1 -0
  27. package/templates/common/.claude/commands/wf-update.md +73 -9
  28. package/templates/common/.claude/rules/ecc/common.md +6 -5
  29. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +12 -6
  30. package/templates/common/.claude/skills/tdd/SKILL.md +5 -5
  31. package/templates/common/.claude/skills/wf/SKILL.md +13 -5
  32. package/templates/common/.claude/skills/wf-agents-docs/SKILL.md +119 -0
  33. package/templates/common/.claude/skills/wf-auto/SKILL.md +27 -7
  34. package/templates/common/.claude/skills/wf-auto-spark/SKILL.md +12 -5
  35. package/templates/common/.claude/skills/wf-learn/SKILL.md +6 -0
  36. package/templates/common/.claude/skills/wf-max/SKILL.md +22 -7
  37. package/templates/common/.claude/skills/wf-readme/SKILL.md +8 -2
  38. package/templates/common/.claude/skills/wf-remove/SKILL.md +6 -0
  39. package/templates/common/.claude/skills/wf-review/SKILL.md +10 -3
  40. package/templates/common/.claude/skills/wf-update/SKILL.md +52 -5
  41. package/templates/common/.harness-version +291 -129
  42. package/templates/common/.opencode/agents/architect-manager.md +1 -0
  43. package/templates/common/.opencode/agents/architect.md +2 -1
  44. package/templates/common/.opencode/agents/codebase-explorer.md +1 -0
  45. package/templates/common/.opencode/agents/context-master.md +2 -1
  46. package/templates/common/.opencode/agents/debugger.md +1 -0
  47. package/templates/common/.opencode/agents/docs-researcher.md +2 -1
  48. package/templates/common/.opencode/agents/explore-manager.md +1 -0
  49. package/templates/common/.opencode/agents/implement-manager.md +1 -0
  50. package/templates/common/.opencode/agents/implementer.md +1 -0
  51. package/templates/common/.opencode/agents/memory-master.md +2 -1
  52. package/templates/common/.opencode/agents/planner.md +3 -2
  53. package/templates/common/.opencode/agents/reflector.md +1 -0
  54. package/templates/common/.opencode/agents/researcher.md +1 -0
  55. package/templates/common/.opencode/agents/review-manager.md +1 -0
  56. package/templates/common/.opencode/agents/reviewer.md +2 -1
  57. package/templates/common/.opencode/agents/task-scribe.md +1 -0
  58. package/templates/common/.opencode/agents/tdd-guide.md +5 -4
  59. package/templates/common/.opencode/agents/test-writer.md +6 -5
  60. package/templates/common/.opencode/agents/verifier.md +1 -0
  61. package/templates/common/.opencode/commands/wf-auto-spark.md +3 -2
  62. package/templates/common/.opencode/commands/wf-auto.md +3 -2
  63. package/templates/common/.opencode/commands/wf-help.md +1 -0
  64. package/templates/common/.opencode/commands/wf-learn.md +3 -2
  65. package/templates/common/.opencode/commands/wf-max.md +3 -2
  66. package/templates/common/.opencode/commands/wf-readme.md +3 -2
  67. package/templates/common/.opencode/commands/wf-remove.md +3 -2
  68. package/templates/common/.opencode/commands/wf-review.md +3 -2
  69. package/templates/common/.opencode/commands/wf-update.md +73 -9
  70. package/templates/common/.opencode/commands/wf.md +3 -2
  71. package/templates/common/CLAUDE.md +14 -12
  72. package/templates/common/Harness/MEMORY.md +21 -18
  73. package/templates/common/Harness/README.md +41 -39
  74. package/templates/common/Harness/ownership.manifest.json +815 -0
  75. package/templates/common/Harness/{architecture.md → project/architecture.md} +1 -1
  76. package/templates/common/Harness/research/README.md +3 -3
  77. package/templates/common/Harness/scripts/context-budget.mjs +95 -0
  78. package/templates/common/Harness/scripts/l2-cache-telemetry.mjs +703 -0
  79. package/templates/common/Harness/scripts/scan-clean.mjs +86 -4
  80. package/templates/common/Harness/scripts/validate-harness.mjs +332 -175
  81. package/templates/common/Harness/scripts/wf-remove.mjs +60 -34
  82. package/templates/common/Harness/scripts/wf-update-check.mjs +562 -121
  83. package/templates/common/Harness/settings.json +43 -0
  84. package/templates/common/Harness/{ECC-GUIDE.md → specs/guides/ECC-GUIDE.md} +4 -4
  85. package/templates/common/Harness/{SETUP.md → specs/guides/SETUP.md} +32 -35
  86. package/templates/common/Harness/{extension.md → specs/guides/extension.md} +3 -3
  87. package/templates/common/Harness/{lifecycle.md → specs/guides/lifecycle.md} +2 -2
  88. package/templates/common/Harness/{agent-workflow.md → specs/runtime/agent-workflow.md} +6 -6
  89. package/templates/common/Harness/{context-loading.md → specs/runtime/context-loading.md} +85 -21
  90. package/templates/common/Harness/{dispatch.md → specs/runtime/dispatch.md} +3 -2
  91. package/templates/common/Harness/{subagents.md → specs/runtime/subagents.md} +10 -5
  92. package/templates/common/Harness/{WF-AUTO-SPARK.md → specs/workflows/WF-AUTO-SPARK.md} +2 -2
  93. package/templates/common/Harness/{WF-AUTO.md → specs/workflows/WF-AUTO.md} +6 -1
  94. package/templates/common/Harness/{WF-KERNEL.md → specs/workflows/WF-KERNEL.md} +10 -0
  95. package/templates/common/Harness/{WF-MAX.md → specs/workflows/WF-MAX.md} +10 -5
  96. package/templates/common/Harness/{WF-STATE.md → specs/workflows/WF-STATE.md} +5 -0
  97. package/templates/common/Harness/{WF.md → specs/workflows/WF.md} +12 -1
  98. package/templates/common/README.md +8 -6
  99. package/templates/common/memory/startup-hints.md +19 -17
  100. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +1 -1
  101. package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +7 -0
  102. package/templates/optional/skills/browser-e2e/.opencode/commands/wf-browser.md +3 -2
  103. package/templates/optional/skills/browser-e2e/Harness/workflows/browser-e2e.md +4 -4
  104. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +1 -1
  105. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +1 -1
  106. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +1 -1
  107. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +1 -1
  108. /package/templates/common/Harness/{ACCEPTANCE_PROTOCOL.md → specs/protocols/ACCEPTANCE_PROTOCOL.md} +0 -0
  109. /package/templates/common/Harness/{AGENT_ISOLATION.md → specs/protocols/AGENT_ISOLATION.md} +0 -0
  110. /package/templates/common/Harness/{DEBUG_PROTOCOL.md → specs/protocols/DEBUG_PROTOCOL.md} +0 -0
  111. /package/templates/common/Harness/{HARNESS_BRIDGE.md → specs/protocols/HARNESS_BRIDGE.md} +0 -0
  112. /package/templates/common/Harness/{MEMORY_PROTOCOL.md → specs/protocols/MEMORY_PROTOCOL.md} +0 -0
  113. /package/templates/common/Harness/{TASK_ARCHIVE.md → specs/protocols/TASK_ARCHIVE.md} +0 -0
  114. /package/templates/common/Harness/{TDD-GUIDE.md → specs/protocols/TDD-GUIDE.md} +0 -0
  115. /package/templates/common/Harness/{WF-AUTO-ANGLES.md → specs/workflows/WF-AUTO-ANGLES.md} +0 -0
@@ -19,11 +19,16 @@ import { readFileSync, writeFileSync, existsSync, lstatSync, readdirSync, unlink
19
19
  import { resolve, dirname, sep, join } from 'path';
20
20
  import { fileURLToPath } from 'url';
21
21
  import { createInterface } from 'readline';
22
+ import { gunzipSync } from 'zlib';
22
23
 
23
24
  const __dirname = dirname(fileURLToPath(import.meta.url));
24
25
  const ROOT = process.env.WF_ROOT ? resolve(process.env.WF_ROOT) : resolve(__dirname, '..', '..');
25
26
  const VERSION_FILE = resolve(ROOT, 'Harness', '.harness-version');
27
+ const NPM_PACKAGE = 'create-harness-vibe-coding';
28
+ const NPM_REGISTRY = (process.env.NPM_CONFIG_REGISTRY || 'https://registry.npmjs.org').replace(/\/+$/, '');
29
+ const TEMPLATE_SUBPATH = 'templates/common/';
26
30
  const DEFAULT_SOURCE_BASE = 'https://raw.githubusercontent.com/LiWeny16/create-harness-vibe-coding/main/templates/common/';
31
+ const LEGACY_SOURCE_BASE = 'https://raw.githubusercontent.com/zingspark/create-harness-vibe-coding/main/templates/common/';
27
32
 
28
33
  // ── Classification constants ────────────────────────────────────────
29
34
 
@@ -151,6 +156,83 @@ async function fetchRemote(url, timeoutMs = 30000) {
151
156
  }
152
157
  }
153
158
 
159
+ async function fetchBytes(url, timeoutMs = 30000) {
160
+ const controller = new AbortController();
161
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
162
+ try {
163
+ const res = await fetch(url, { signal: controller.signal, headers: { 'User-Agent': 'harness-scan-clean' } });
164
+ if (!res.ok) throw new Error(`HTTP ${res.status}: ${url}`);
165
+ return Buffer.from(await res.arrayBuffer());
166
+ } finally {
167
+ clearTimeout(timer);
168
+ }
169
+ }
170
+
171
+ function tarString(header, start, length) {
172
+ const slice = header.subarray(start, start + length);
173
+ const zero = slice.indexOf(0);
174
+ return Buffer.from(zero === -1 ? slice : slice.subarray(0, zero)).toString('utf8').trim();
175
+ }
176
+
177
+ function parseTarFiles(buffer) {
178
+ const files = new Map();
179
+ for (let offset = 0; offset + 512 <= buffer.length;) {
180
+ const header = buffer.subarray(offset, offset + 512);
181
+ if (header.every(byte => byte === 0)) break;
182
+
183
+ const name = tarString(header, 0, 100);
184
+ const prefix = tarString(header, 345, 155);
185
+ const size = Number.parseInt(tarString(header, 124, 12) || '0', 8) || 0;
186
+ const type = String.fromCharCode(header[156] || 0);
187
+ const fullName = prefix ? `${prefix}/${name}` : name;
188
+ const dataStart = offset + 512;
189
+
190
+ if ((type === '\0' || type === '0' || type === '') && fullName) {
191
+ files.set(fullName, buffer.subarray(dataStart, dataStart + size));
192
+ }
193
+
194
+ offset = dataStart + Math.ceil(size / 512) * 512;
195
+ }
196
+ return files;
197
+ }
198
+
199
+ async function fetchNpmLatestManifest() {
200
+ const meta = JSON.parse(await fetchRemote(`${NPM_REGISTRY}/${NPM_PACKAGE}/latest`, 15000));
201
+ const tarball = meta?.dist?.tarball;
202
+ if (!tarball) throw new Error(`npm metadata missing dist.tarball for ${NPM_PACKAGE}@latest`);
203
+ const files = parseTarFiles(gunzipSync(await fetchBytes(tarball, 30000)));
204
+ const manifest = files.get(`package/${TEMPLATE_SUBPATH}.harness-version`);
205
+ if (!manifest) throw new Error('npm package missing templates/common/.harness-version');
206
+ return Buffer.from(manifest).toString('utf8');
207
+ }
208
+
209
+ async function fetchRemoteManifest(explicitSource, localVersion = {}) {
210
+ if (explicitSource) return fetchRemote(normalizeSourceBase(explicitSource) + '.harness-version');
211
+ const localSource = typeof localVersion.source === 'string' ? localVersion.source.trim() : '';
212
+ let localSourceError = null;
213
+ if (localSource) {
214
+ try {
215
+ return await fetchRemote(normalizeSourceBase(localSource) + '.harness-version');
216
+ } catch (e) {
217
+ localSourceError = e;
218
+ }
219
+ }
220
+ try {
221
+ return await fetchNpmLatestManifest();
222
+ } catch (npmError) {
223
+ try {
224
+ return await fetchRemote(DEFAULT_SOURCE_BASE + '.harness-version');
225
+ } catch (canonicalError) {
226
+ try {
227
+ return await fetchRemote(LEGACY_SOURCE_BASE + '.harness-version');
228
+ } catch (legacyError) {
229
+ const localSourceMessage = localSourceError ? `local source: ${localSourceError.message}; ` : '';
230
+ throw new Error(`${localSourceMessage}npm latest: ${npmError.message}; canonical GitHub: ${canonicalError.message}; legacy mirror: ${legacyError.message}`);
231
+ }
232
+ }
233
+ }
234
+ }
235
+
154
236
  // ── Orphan detection ─────────────────────────────────────────────────
155
237
 
156
238
  /**
@@ -285,7 +367,7 @@ async function main() {
285
367
  const clean = args.includes('--clean');
286
368
  const yes = args.includes('--yes');
287
369
  const jsonOut = args.includes('--json');
288
- const sourceBase = normalizeSourceBase(readFlagValue(args, '--source-base') || process.env.WF_SOURCE_BASE || DEFAULT_SOURCE_BASE);
370
+ const explicitSource = readFlagValue(args, '--source-base') || process.env.WF_SOURCE_BASE;
289
371
 
290
372
  // 1. Read local state
291
373
  if (!existsSync(VERSION_FILE)) {
@@ -314,7 +396,7 @@ async function main() {
314
396
  // 2. Fetch remote version file
315
397
  let remoteVersion;
316
398
  try {
317
- const raw = await fetchRemote(sourceBase + '.harness-version');
399
+ const raw = await fetchRemoteManifest(explicitSource, localVersion);
318
400
  if (isTemplate(raw)) {
319
401
  if (jsonOut) {
320
402
  console.log(JSON.stringify({ status: 'error', message: 'Remote .harness-version is a template (contains {{placeholders}}). Cannot determine dead files.' }));
@@ -328,9 +410,9 @@ async function main() {
328
410
  remoteVersion = JSON.parse(raw);
329
411
  } catch (e) {
330
412
  if (jsonOut) {
331
- console.log(JSON.stringify({ status: 'error', message: 'Cannot reach GitHub or invalid remote JSON: ' + e.message }));
413
+ console.log(JSON.stringify({ status: 'error', message: 'Cannot reach npm, canonical GitHub, or legacy mirror update sources: ' + e.message }));
332
414
  } else {
333
- console.error('ERROR: Cannot reach GitHub or invalid remote JSON. Offline?');
415
+ console.error('ERROR: Cannot reach npm, canonical GitHub, or legacy mirror update sources. Offline?');
334
416
  console.error(e.message);
335
417
  }
336
418
  process.exit(1);