@punks/cli 3.2.1 → 3.3.0

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 (117) hide show
  1. package/AGENTS.md +2 -0
  2. package/dist/BASELINE_CHANGELOG.md +76 -0
  3. package/dist/CHANGELOG.md +46 -1
  4. package/dist/baseline/scaffold-baseline/baseline.json +5 -5
  5. package/dist/baseline/scaffold-baseline/data/catalog/lint-assets.json +4 -1
  6. package/dist/baseline/scaffold-baseline/data/catalog/packs.json +7 -3
  7. package/dist/baseline/scaffold-baseline/data/catalog/skills.json +32 -0
  8. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/post-command-flow.md +25 -17
  9. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/rule-authoring/SKILL.md +18 -0
  10. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/rule-authoring/references/migration.md +10 -0
  11. package/dist/baseline/scaffold-baseline/skills/agnostic/frontend/animate/LICENSE +21 -0
  12. package/dist/baseline/scaffold-baseline/skills/agnostic/frontend/animate/RECIPES.md +333 -0
  13. package/dist/baseline/scaffold-baseline/skills/agnostic/frontend/animate/SKILL.md +203 -0
  14. package/dist/baseline/scaffold-baseline/skills/agnostic/frontend/animate/UPSTREAM.md +9 -0
  15. package/dist/baseline/scaffold-baseline/skills/agnostic/frontend/review-animations/LICENSE +21 -0
  16. package/dist/baseline/scaffold-baseline/skills/agnostic/frontend/review-animations/SKILL.md +112 -0
  17. package/dist/baseline/scaffold-baseline/skills/agnostic/frontend/review-animations/STANDARDS.md +229 -0
  18. package/dist/baseline/scaffold-baseline/skills/agnostic/frontend/review-animations/UPSTREAM.md +9 -0
  19. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/REFERENCE.md +5 -1
  20. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/SKILL.md +9 -7
  21. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/architecture-convergence.md +4 -3
  22. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/planner-task-graph.md +12 -7
  23. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/tdd/SKILL.md +3 -2
  24. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/tdd/high-signal-tests.md +17 -3
  25. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/domain-modeling/{CONTEXT-FORMAT.md → GLOSSARY-FORMAT.md} +9 -9
  26. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/domain-modeling/SKILL.md +12 -12
  27. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/SKILL.md +4 -1
  28. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/references/artifact-output.md +36 -3
  29. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/references/grilling-flow.md +18 -1
  30. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/EXAMPLES.md +1 -1
  31. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/REFERENCE.md +4 -3
  32. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/SKILL.md +2 -2
  33. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +6 -6
  34. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +7 -7
  35. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +12 -12
  36. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +9 -9
  37. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +10 -10
  38. package/dist/baseline/scaffold-baseline/skills/frameworks/expo/animate-expo/LICENSE +21 -0
  39. package/dist/baseline/scaffold-baseline/skills/frameworks/expo/animate-expo/RECIPES.md +435 -0
  40. package/dist/baseline/scaffold-baseline/skills/frameworks/expo/animate-expo/SKILL.md +255 -0
  41. package/dist/baseline/scaffold-baseline/skills/frameworks/expo/animate-expo/UPSTREAM.md +9 -0
  42. package/dist/baseline/scaffold-baseline/skills/misc/wait-what/SKILL.md +1 -1
  43. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/SKILL.md +5 -7
  44. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/review.md +50 -25
  45. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +29 -21
  46. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/phase-handoff.md +28 -10
  47. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/AUTHORING-HANDOFF.md +14 -11
  48. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/prepare-review.md +1 -1
  49. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/retain-report.md +9 -2
  50. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/return-route.md +6 -8
  51. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/run-review.md +8 -5
  52. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/durable-report.md +29 -14
  53. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/state-graph.md +45 -32
  54. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/targets.md +2 -1
  55. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/scripts/review-contract.mjs +86 -12
  56. package/dist/baseline/scaffold-baseline.json +5 -5
  57. package/dist/baseline/scaffold-baseline.tgz +0 -0
  58. package/dist/data/AGENTS.md +2 -0
  59. package/dist/index.js +17 -17
  60. package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +10 -2
  61. package/dist/skills/agnostic/docs/rule-authoring/SKILL.md +18 -0
  62. package/dist/skills/agnostic/docs/rule-authoring/references/migration.md +10 -0
  63. package/dist/skills/agnostic/frontend/animate/LICENSE +21 -0
  64. package/dist/skills/agnostic/frontend/animate/RECIPES.md +324 -0
  65. package/dist/skills/agnostic/frontend/animate/SKILL.md +199 -0
  66. package/dist/skills/agnostic/frontend/animate/UPSTREAM.md +9 -0
  67. package/dist/skills/agnostic/frontend/review-animations/LICENSE +21 -0
  68. package/dist/skills/agnostic/frontend/review-animations/SKILL.md +112 -0
  69. package/dist/skills/agnostic/frontend/review-animations/STANDARDS.md +187 -0
  70. package/dist/skills/agnostic/frontend/review-animations/UPSTREAM.md +9 -0
  71. package/dist/skills/agnostic/planning/create-plan/REFERENCE.md +5 -1
  72. package/dist/skills/agnostic/planning/create-plan/SKILL.md +9 -7
  73. package/dist/skills/agnostic/planning/create-plan/references/architecture-convergence.md +4 -3
  74. package/dist/skills/agnostic/planning/create-plan/references/planner-task-graph.md +12 -7
  75. package/dist/skills/agnostic/quality/tdd/SKILL.md +3 -2
  76. package/dist/skills/agnostic/quality/tdd/high-signal-tests.md +17 -3
  77. package/dist/skills/agnostic/requirements/domain-modeling/{CONTEXT-FORMAT.md → GLOSSARY-FORMAT.md} +9 -9
  78. package/dist/skills/agnostic/requirements/domain-modeling/SKILL.md +12 -12
  79. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +4 -1
  80. package/dist/skills/agnostic/requirements/requirements-grill/references/artifact-output.md +33 -3
  81. package/dist/skills/agnostic/requirements/requirements-grill/references/grilling-flow.md +18 -1
  82. package/dist/skills/agnostic/requirements/write-backlog/EXAMPLES.md +1 -1
  83. package/dist/skills/agnostic/requirements/write-backlog/REFERENCE.md +4 -3
  84. package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +2 -2
  85. package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +6 -6
  86. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +7 -7
  87. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +12 -12
  88. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +9 -9
  89. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +10 -10
  90. package/dist/skills/frameworks/expo/animate-expo/LICENSE +21 -0
  91. package/dist/skills/frameworks/expo/animate-expo/RECIPES.md +385 -0
  92. package/dist/skills/frameworks/expo/animate-expo/SKILL.md +255 -0
  93. package/dist/skills/frameworks/expo/animate-expo/UPSTREAM.md +9 -0
  94. package/dist/skills/misc/wait-what/SKILL.md +1 -1
  95. package/dist/skills/phases/delivery-phase/SKILL.md +5 -7
  96. package/dist/skills/phases/delivery-phase/phases/review.md +50 -25
  97. package/dist/skills/phases/delivery-phase/phases/router.md +27 -19
  98. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +28 -10
  99. package/dist/skills/phases/review-phase/AUTHORING-HANDOFF.md +14 -11
  100. package/dist/skills/phases/review-phase/phases/prepare-review.md +1 -1
  101. package/dist/skills/phases/review-phase/phases/retain-report.md +9 -2
  102. package/dist/skills/phases/review-phase/phases/return-route.md +6 -8
  103. package/dist/skills/phases/review-phase/phases/run-review.md +8 -5
  104. package/dist/skills/phases/review-phase/references/durable-report.md +29 -14
  105. package/dist/skills/phases/review-phase/references/state-graph.md +19 -6
  106. package/dist/skills/phases/review-phase/references/targets.md +2 -1
  107. package/dist/skills/phases/review-phase/scripts/review-contract.mjs +91 -11
  108. package/package.json +4 -23
  109. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/claude.test.ts +0 -130
  110. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/codex.test.ts +0 -135
  111. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/cursor.test.ts +0 -138
  112. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/opencode.test.ts +0 -135
  113. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/contract.test.ts +0 -875
  114. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.lifecycle.test.ts +0 -205
  115. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.native.test.ts +0 -2765
  116. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.test.ts +0 -2108
  117. package/dist/baseline/scaffold-baseline/data/subagents/manifest.test.ts +0 -116
@@ -39,8 +39,15 @@ export const inclusiveScopeHash = (entries) =>
39
39
  export const acceptedBoundsHash = (identity, scopeEntries) =>
40
40
  hashRecord("accepted-bounds", [identity, inclusiveScopeHash(scopeEntries)]);
41
41
 
42
- export const deliveryLineageId = (deliveryGoalIdentity) =>
43
- hashRecord("delivery-lineage", [deliveryGoalIdentity]);
42
+ export const deliveryLineageId = (deliveryGoalIdentity) => {
43
+ if (
44
+ typeof deliveryGoalIdentity !== "string" ||
45
+ deliveryGoalIdentity.length === 0
46
+ ) {
47
+ throw new TypeError("delivery goal identity must be a non-empty string");
48
+ }
49
+ return hashRecord("delivery-lineage", [deliveryGoalIdentity]);
50
+ };
44
51
 
45
52
  export const standaloneLineageId = (locator, boundsHash) =>
46
53
  hashRecord("standalone-lineage", [locator, boundsHash]);
@@ -130,10 +137,23 @@ export const sourceSetHash = (sources) =>
130
137
  .flatMap(({ path, hash }) => [path, hash]),
131
138
  );
132
139
 
133
- export const reviewReportPath = ({ lineageId, reviewedAt, snapshotHash }) => {
134
- if (!/^\d{8}T\d{6}Z$/u.test(reviewedAt)) {
135
- throw new TypeError("reviewedAt must use YYYYMMDDTHHMMSSZ UTC format");
140
+ const assertReviewedAt = (reviewedAt, field) => {
141
+ const match = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/u.exec(
142
+ reviewedAt,
143
+ );
144
+ if (!match) {
145
+ throw new TypeError(`${field} must use YYYYMMDDTHHMMSSZ UTC format`);
146
+ }
147
+ const [, year, month, day, hour, minute, second] = match;
148
+ const iso = `${year}-${month}-${day}T${hour}:${minute}:${second}.000Z`;
149
+ const instant = new Date(iso);
150
+ if (Number.isNaN(instant.valueOf()) || instant.toISOString() !== iso) {
151
+ throw new TypeError(`${field} must name a real UTC instant`);
136
152
  }
153
+ };
154
+
155
+ export const reviewReportPath = ({ lineageId, reviewedAt, snapshotHash }) => {
156
+ assertReviewedAt(reviewedAt, "reviewedAt");
137
157
  return `apps/wiki/content/docs/project/reviews/${reviewScopeSlug(lineageId)}-${reviewedAt}-${snapshot12(snapshotHash)}-review-report.md`;
138
158
  };
139
159
 
@@ -165,6 +185,35 @@ const LENS_KEYS = [
165
185
  "simplify",
166
186
  "spec",
167
187
  ];
188
+ const PROTOTYPE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
189
+ const FINDING_ROUTES = [
190
+ "debugging",
191
+ "implementation",
192
+ "debt_follow_up",
193
+ "docs_ingest",
194
+ ];
195
+
196
+ export const deriveReviewRouting = (findings) => {
197
+ if (
198
+ !Array.isArray(findings) ||
199
+ findings.some(
200
+ (finding) =>
201
+ finding === null ||
202
+ typeof finding !== "object" ||
203
+ !FINDING_ROUTES.includes(finding.return_route),
204
+ )
205
+ ) {
206
+ throw new TypeError("invalid finding return route");
207
+ }
208
+ const routes = new Set(findings.map(({ return_route: route }) => route));
209
+ const primary = FINDING_ROUTES.find((route) => routes.has(route)) ?? "closeout";
210
+ return {
211
+ primary,
212
+ secondary_architecture_follow_up:
213
+ routes.has("debt_follow_up") &&
214
+ (primary === "debugging" || primary === "implementation"),
215
+ };
216
+ };
168
217
 
169
218
  const exactKeys = (value, keys) =>
170
219
  value !== null &&
@@ -182,9 +231,7 @@ const sortedUniqueStrings = (values) =>
182
231
  isDeepStrictEqual(values, sortUtf8(values));
183
232
 
184
233
  const reportDate = (reviewedAt) => {
185
- if (!/^\d{8}T\d{6}Z$/u.test(reviewedAt)) {
186
- throw new TypeError("reviewed_at must use YYYYMMDDTHHMMSSZ");
187
- }
234
+ assertReviewedAt(reviewedAt, "reviewed_at");
188
235
  return `${reviewedAt.slice(0, 4)}-${reviewedAt.slice(4, 6)}-${reviewedAt.slice(6, 8)}`;
189
236
  };
190
237
 
@@ -240,11 +287,14 @@ const parseFrontmatter = (text) => {
240
287
  if (!text.startsWith("---\n")) throw new TypeError("missing frontmatter");
241
288
  const close = text.indexOf("\n---\n", 4);
242
289
  if (close < 0) throw new TypeError("unclosed frontmatter");
243
- const frontmatter = {};
290
+ const frontmatter = Object.create(null);
244
291
  for (const line of text.slice(4, close).split("\n")) {
245
292
  const separator = line.indexOf(": ");
246
293
  if (separator < 1) throw new TypeError("malformed frontmatter line");
247
294
  const key = line.slice(0, separator);
295
+ if (PROTOTYPE_KEYS.has(key)) {
296
+ throw new TypeError("prototype-sensitive frontmatter key");
297
+ }
248
298
  if (Object.hasOwn(frontmatter, key)) throw new TypeError("duplicate frontmatter key");
249
299
  const raw = line.slice(separator + 2);
250
300
  frontmatter[key] = raw === "[]" ? [] : JSON.parse(raw);
@@ -288,6 +338,8 @@ export const normalizeReviewTarget = (mode, evidence) => {
288
338
  !nonemptyString(evidence.actualBaseRef) ||
289
339
  !COMMIT_SHA.test(evidence.fixedPointSha) ||
290
340
  !nonemptyString(evidence.headIdentity) ||
341
+ !Array.isArray(evidence.scopeEntries) ||
342
+ evidence.scopeEntries.length === 0 ||
291
343
  !sortedUniqueStrings(sortUtf8(evidence.scopeEntries)) ||
292
344
  !Buffer.isBuffer(evidence.canonicalPatchBytes)
293
345
  ) {
@@ -304,11 +356,18 @@ export const normalizeReviewTarget = (mode, evidence) => {
304
356
  };
305
357
  }
306
358
  if (mode === "standalone") {
359
+ if (
360
+ !Array.isArray(evidence.scopeEntries) ||
361
+ evidence.scopeEntries.length === 0
362
+ ) {
363
+ throw new TypeError("invalid standalone target evidence");
364
+ }
307
365
  const files = orderedFiles(evidence.files);
308
366
  const identities = files.map(({ identity }) => identity);
309
367
  const scope = sortUtf8(evidence.scopeEntries);
310
368
  if (
311
369
  !nonemptyString(evidence.locator) ||
370
+ identities.length === 0 ||
312
371
  !sortedUniqueStrings(identities) ||
313
372
  !files.every(({ bytes }) => Buffer.isBuffer(bytes)) ||
314
373
  !isDeepStrictEqual(scope, identities)
@@ -330,6 +389,7 @@ export const normalizeReviewTarget = (mode, evidence) => {
330
389
  export const normalizeReviewSources = (sources) => {
331
390
  if (
332
391
  !Array.isArray(sources) ||
392
+ sources.length === 0 ||
333
393
  sources.some(
334
394
  ({ path, bytes }) => !nonemptyString(path) || !Buffer.isBuffer(bytes),
335
395
  ) ||
@@ -422,7 +482,12 @@ const validateTargetSchema = (target, mode, errors) => {
422
482
  errors.push("malformed:normalized_target_schema");
423
483
  return;
424
484
  }
425
- if (!nonemptyString(target.locator) || !sortedUniqueStrings(target.inclusive_scope)) {
485
+ if (
486
+ !nonemptyString(target.locator) ||
487
+ !Array.isArray(target.inclusive_scope) ||
488
+ target.inclusive_scope.length === 0 ||
489
+ !sortedUniqueStrings(target.inclusive_scope)
490
+ ) {
426
491
  errors.push("malformed:normalized_target_common_fields");
427
492
  }
428
493
  if (mode === "delivery") {
@@ -472,6 +537,7 @@ const validateReportSemantics = (report, errors) => {
472
537
  "impact",
473
538
  "evidence",
474
539
  "action",
540
+ "return_route",
475
541
  ];
476
542
  const ids = new Set();
477
543
  const findingLenses = new Set();
@@ -514,6 +580,14 @@ const validateReportSemantics = (report, errors) => {
514
580
  typeof report.routing?.secondary_architecture_follow_up !== "boolean"
515
581
  ) {
516
582
  errors.push("malformed:routing");
583
+ } else {
584
+ try {
585
+ if (!isDeepStrictEqual(report.routing, deriveReviewRouting(report.findings))) {
586
+ errors.push("mismatch:routing");
587
+ }
588
+ } catch {
589
+ errors.push("malformed:finding_return_route");
590
+ }
517
591
  }
518
592
 
519
593
  const validationKeys = [
@@ -708,7 +782,13 @@ const inspectRetainedPass = (candidate, expected) => {
708
782
  ) {
709
783
  errors.push("mismatch:report_sha256");
710
784
  }
711
- if (!candidate.refContainsCommit) errors.push("ref_missing_commit");
785
+ if (
786
+ !Buffer.isBuffer(candidate.resolvedReportBytes) ||
787
+ !candidate.reportBytes.equals(candidate.resolvedReportBytes)
788
+ ) {
789
+ errors.push("mismatch:resolved_report_bytes");
790
+ }
791
+ if (candidate.refContainsCommit !== true) errors.push("ref_missing_commit");
712
792
  if (!COMMIT_SHA.test(candidate.reportCommitSha)) {
713
793
  errors.push("invalid:report_commit_sha");
714
794
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punks/cli",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "description": "Harness Intelligence scaffolding CLI",
5
5
  "homepage": "https://github.com/wearedevpunks/harness-intelligence/tree/main/apps/cli#readme",
6
6
  "bugs": {
@@ -29,38 +29,19 @@
29
29
  "check-types": "\"${HI_TEST_NODE_PATH:-node}\" --input-type=module -e \"await import(new URL('./bin/tsc', import.meta.resolve('@typescript/native/package.json')))\" -- tsc --noEmit",
30
30
  "dev": "bun run ./src/index.ts scaffold",
31
31
  "entrypoints": "bun ./scripts/print-entrypoints.mjs",
32
- "fixtures:check:managed-assets": "vitest run --config vitest.config.ts src/features/context-planning/managed-assets-fixture.native.test.ts",
33
- "fixtures:update:managed-assets": "bun run build && HI_UPDATE_MANAGED_ASSETS_FIXTURE=1 bun run fixtures:check:managed-assets",
34
32
  "local": "bun run build && bun run ./dist/index.js",
35
- "release:attest": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-cli-verification.mjs attest",
36
33
  "release:authority": "cd ../.. && node ./apps/cli/scripts/run-release-authority.mjs",
37
34
  "release:candidate": "cd ../.. && node ./apps/cli/scripts/run-release-candidate.mjs",
38
35
  "release:classify": "cd ../.. && node ./apps/cli/scripts/classify-release-impact.mjs",
39
36
  "release:publish": "node ./scripts/release-dispatcher.mjs",
40
37
  "release:publish:beta": "NPM_TAG=beta node ./scripts/release-dispatcher.mjs",
41
- "release:reconcile": "cd ../.. && node ./apps/cli/scripts/run-release-convergence.mjs",
42
- "release:verify": "HI_CACHE_NAMESPACE=protected node ./scripts/run-cli-verification.mjs release",
38
+ "release:publication": "cd ../.. && node ./apps/cli/scripts/run-release-publication.mjs",
43
39
  "sync:skills": "node ./scripts/sync-skills-repo.mjs",
44
40
  "test": "vitest run --config vitest.config.ts",
45
41
  "test:parallel": "vitest run --config vitest.config.ts --fileParallelism --maxWorkers=2",
46
- "test:repository:capability-files": "cd ../.. && bun ./scripts/behavior-contract/run-test-scope.ts --repository-partition=capability-files",
47
- "test:repository:capability-titles": "cd ../.. && bun ./scripts/behavior-contract/run-test-scope.ts --repository-partition=capability-titles",
48
- "test:repository:fresh": "cd ../.. && bun ./scripts/behavior-contract/run-test-scope.ts --repository-partition=fresh",
49
- "test:repository:portable": "cd ../.. && bun ./scripts/behavior-contract/run-test-scope.ts --repository-partition=portable",
50
- "test:release": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs",
51
- "test:release:complete": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs complete",
52
- "test:release:ordinary:ambient": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs ordinary:ambient",
53
- "test:release:ordinary:ambient:capability": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs ordinary:ambient:capability",
54
- "test:release:ordinary:ambient:fresh": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs ordinary:ambient:fresh",
55
- "test:release:ordinary:deterministic": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs ordinary:deterministic",
56
- "test:release:ordinary:native:capability": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs ordinary:native:capability",
57
- "test:release:ordinary:native:forced": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs ordinary:native:forced",
58
- "test:release:update:0": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs update:0",
59
- "test:release:update:1": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs update:1",
60
- "test:release:update:2": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs update:2",
61
- "test:release:update:uncached": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/run-release-tests.mjs update:uncached",
62
42
  "ui:catalog": "bun ./scripts/run-renderer-catalog.mjs",
63
- "check": "oxlint src scripts && oxfmt --check src scripts package.json tsconfig.json vitest.config.ts && bun run fixtures:check:managed-assets"
43
+ "lint": "oxlint src scripts",
44
+ "check": "bun run lint && oxfmt --check src scripts package.json tsconfig.json vitest.config.ts"
64
45
  },
65
46
  "dependencies": {
66
47
  "react-devtools-core": "^6.1.5"
@@ -1,130 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
-
3
- import { ContextPlan } from "@punks/scaffold/context-plan";
4
- import * as EffectVitest from "@effect/vitest";
5
- import * as Schema from "effect/Schema";
6
-
7
- import { testHarnessProjectionContract } from "../contract";
8
- import type { HarnessProjectionAdapter } from "../contract";
9
- import { project } from "../core.mjs";
10
-
11
- const { describe, expect, it } = EffectVitest;
12
-
13
- const { claudeAdapter } = (await import(new URL("claude.mjs", import.meta.url).href)) as {
14
- readonly claudeAdapter: HarnessProjectionAdapter;
15
- };
16
-
17
- const fixture = <Value>(name: string): Value =>
18
- JSON.parse(
19
- readFileSync(new URL(`../test-fixtures/claude/${name}.json`, import.meta.url), "utf-8"),
20
- ) as Value;
21
-
22
- const contextPlan = Schema.decodeUnknownSync(ContextPlan)(fixture("context-plan"));
23
-
24
- testHarnessProjectionContract({ adapter: claudeAdapter, contextPlan, name: "claude" });
25
-
26
- describe("Claude harness projection adapter", () => {
27
- it("locks the exact five-row capability matrix as a compatibility fixture", () => {
28
- expect(claudeAdapter.matrix).toEqual(fixture("matrix"));
29
- expect(JSON.stringify(claudeAdapter.matrix)).toBe(JSON.stringify(fixture("matrix")));
30
- });
31
-
32
- it("projects compiler-shaped contributions into collision-free native intents", () => {
33
- const result = project({ adapter: claudeAdapter, contextPlan });
34
- const intents = result.actions.map(({ trace: _trace, ...intent }) => intent);
35
- const targets = intents.flatMap((intent) =>
36
- "target" in intent && typeof intent.target === "string" ? [intent.target] : [],
37
- );
38
-
39
- expect(intents).toEqual(fixture("actions"));
40
- expect(JSON.stringify(intents)).toBe(JSON.stringify(fixture("actions")));
41
- expect(new Set(targets).size).toBe(targets.length);
42
- expect(result.actions.map(({ trace }) => [trace.scopeId, trace.contribution.id])).toEqual(
43
- fixture("traces"),
44
- );
45
- });
46
-
47
- it("renders each canonical subagent contribution to its own Claude file", () => {
48
- const templates = project({ adapter: claudeAdapter, contextPlan }).actions.filter(
49
- (action) => action.operation === "render-template",
50
- );
51
-
52
- expect(templates).toMatchObject([
53
- {
54
- filename: "apps-cli.md",
55
- skills: ["effect-authoring", "tdd"],
56
- target: ".claude/agents/apps-cli.md",
57
- templateId: "apps-cli",
58
- },
59
- {
60
- filename: "code-review.md",
61
- skills: ["tdd"],
62
- target: ".claude/agents/code-review.md",
63
- templateId: "code-review",
64
- },
65
- ]);
66
- });
67
-
68
- it("records every real tool contribution as a typed canonical omission", () => {
69
- const { summary } = project({ adapter: claudeAdapter, contextPlan });
70
-
71
- expect(summary).toMatchObject({
72
- _tag: "HarnessProjectionPartial",
73
- omissions: ["agent-browser", "opensrc", "portless", "skills"].map((id) => ({
74
- _tag: "HarnessProjectionOmission",
75
- support: "unsupported",
76
- trace: {
77
- adapter: { id: "claude", version: "1.0.0" },
78
- contribution: { id, version: "2026.07.17" },
79
- matrixVersion: "2026.07.17-v1",
80
- scopeId: "root",
81
- },
82
- warning: {
83
- _tag: "UnsupportedHarnessCapabilityWarning",
84
- family: "tool-configuration",
85
- reason: "Harness tool configuration is not projected into Claude settings",
86
- },
87
- })),
88
- });
89
- });
90
-
91
- it("returns unsupported for unknown lifecycle hook IDs while preserving known hooks", () => {
92
- const capability = claudeAdapter.matrix.capabilities.find(
93
- ({ family }) => family === "lifecycle-hook",
94
- );
95
- const knownHooks = contextPlan.scopes
96
- .flatMap(({ contributions }) => contributions)
97
- .filter(({ kind }) => kind === "lifecycle-hook");
98
- if (capability === undefined) {
99
- throw new Error("Claude lifecycle-hook capability is missing");
100
- }
101
-
102
- expect(knownHooks.map(({ identity }) => identity.id)).toEqual([
103
- "format-edited-file",
104
- "scaffold-update-check",
105
- ]);
106
- for (const contribution of knownHooks) {
107
- expect(claudeAdapter.project({ capability, contribution, scopeId: "root" })).toBeInstanceOf(
108
- Array,
109
- );
110
- }
111
-
112
- expect(
113
- claudeAdapter.project({
114
- capability,
115
- contribution: {
116
- compatibility: [],
117
- identity: { id: "unknown-hook", version: "2026.07.28" },
118
- kind: "lifecycle-hook",
119
- order: 99,
120
- provenance: { revision: "2026.07.28", source: "bundled" },
121
- references: [],
122
- },
123
- scopeId: "root",
124
- }),
125
- ).toEqual({
126
- _tag: "HarnessProjectionUnsupported",
127
- reason: "Claude lifecycle hook unknown-hook has no native projection",
128
- });
129
- });
130
- });
@@ -1,135 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
-
3
- import { ContextPlan } from "@punks/scaffold/context-plan";
4
- import * as EffectVitest from "@effect/vitest";
5
- import * as Schema from "effect/Schema";
6
-
7
- import { testHarnessProjectionContract } from "../contract";
8
- import type { HarnessProjectionAdapter } from "../contract";
9
- import { project } from "../core.mjs";
10
-
11
- const { describe, expect, it } = EffectVitest;
12
-
13
- const { codexAdapter } = (await import(new URL("codex.mjs", import.meta.url).href)) as {
14
- readonly codexAdapter: HarnessProjectionAdapter;
15
- };
16
-
17
- const fixture = <Value>(name: string): Value =>
18
- JSON.parse(
19
- readFileSync(new URL(`../test-fixtures/codex/${name}.json`, import.meta.url), "utf-8"),
20
- ) as Value;
21
-
22
- const contextPlan = Schema.decodeUnknownSync(ContextPlan)(fixture("context-plan"));
23
-
24
- testHarnessProjectionContract({ adapter: codexAdapter, contextPlan, name: "codex" });
25
-
26
- describe("Codex harness projection adapter", () => {
27
- it("locks the exact five-row capability matrix as a compatibility fixture", () => {
28
- expect(codexAdapter.matrix).toEqual(fixture("matrix"));
29
- expect(JSON.stringify(codexAdapter.matrix)).toBe(JSON.stringify(fixture("matrix")));
30
- });
31
-
32
- it("projects compiler-shaped contributions into collision-free native intents", () => {
33
- const result = project({ adapter: codexAdapter, contextPlan });
34
- const intents = result.actions.map(({ trace: _trace, ...intent }) => intent);
35
- const targets = intents.flatMap((intent) =>
36
- "target" in intent && typeof intent.target === "string" ? [intent.target] : [],
37
- );
38
-
39
- expect(intents).toEqual(fixture("actions"));
40
- expect(JSON.stringify(intents)).toBe(JSON.stringify(fixture("actions")));
41
- expect(new Set(targets).size).toBe(targets.length);
42
- expect(result.actions.map(({ trace }) => [trace.scopeId, trace.contribution.id])).toEqual(
43
- fixture("traces"),
44
- );
45
- });
46
-
47
- it("links skills only inside their specific Codex subagent TOML render", () => {
48
- const { actions } = project({ adapter: codexAdapter, contextPlan });
49
- const skillActions = actions.filter((action) => action.operation === "use-native-skill");
50
- const templates = actions.filter((action) => action.operation === "render-template");
51
-
52
- expect(skillActions).toHaveLength(4);
53
- expect(skillActions.every((action) => !("target" in action))).toBe(true);
54
- expect(templates).toMatchObject([
55
- {
56
- filename: "apps-cli.toml",
57
- skills: [
58
- { id: "effect-authoring", path: "../../.agents/skills/effect-authoring" },
59
- { id: "tdd", path: "../../.agents/skills/tdd" },
60
- ],
61
- target: ".codex/agents/apps-cli.toml",
62
- templateId: "apps-cli",
63
- },
64
- {
65
- filename: "code-review.toml",
66
- skills: [{ id: "tdd", path: "../../.agents/skills/tdd" }],
67
- target: ".codex/agents/code-review.toml",
68
- templateId: "code-review",
69
- },
70
- ]);
71
- });
72
-
73
- it("records every real tool contribution as a typed canonical omission", () => {
74
- const { summary } = project({ adapter: codexAdapter, contextPlan });
75
-
76
- expect(summary).toMatchObject({
77
- _tag: "HarnessProjectionPartial",
78
- omissions: ["agent-browser", "opensrc", "portless", "skills"].map((id) => ({
79
- _tag: "HarnessProjectionOmission",
80
- support: "unsupported",
81
- trace: {
82
- adapter: { id: "codex", version: "1.0.0" },
83
- contribution: { id, version: "2026.07.17" },
84
- matrixVersion: "2026.07.17-v1",
85
- scopeId: "root",
86
- },
87
- warning: {
88
- _tag: "UnsupportedHarnessCapabilityWarning",
89
- family: "tool-configuration",
90
- reason: "Harness tool configuration is not projected into Codex config",
91
- },
92
- })),
93
- });
94
- });
95
-
96
- it("returns unsupported for unknown lifecycle hook IDs while preserving known hooks", () => {
97
- const capability = codexAdapter.matrix.capabilities.find(
98
- ({ family }) => family === "lifecycle-hook",
99
- );
100
- const knownHooks = contextPlan.scopes
101
- .flatMap(({ contributions }) => contributions)
102
- .filter(({ kind }) => kind === "lifecycle-hook");
103
- if (capability === undefined) {
104
- throw new Error("Codex lifecycle-hook capability is missing");
105
- }
106
-
107
- expect(knownHooks.map(({ identity }) => identity.id)).toEqual([
108
- "format-edited-file",
109
- "scaffold-update-check",
110
- ]);
111
- for (const contribution of knownHooks) {
112
- expect(codexAdapter.project({ capability, contribution, scopeId: "root" })).toBeInstanceOf(
113
- Array,
114
- );
115
- }
116
-
117
- expect(
118
- codexAdapter.project({
119
- capability,
120
- contribution: {
121
- compatibility: [],
122
- identity: { id: "unknown-hook", version: "2026.07.28" },
123
- kind: "lifecycle-hook",
124
- order: 99,
125
- provenance: { revision: "2026.07.28", source: "bundled" },
126
- references: [],
127
- },
128
- scopeId: "root",
129
- }),
130
- ).toEqual({
131
- _tag: "HarnessProjectionUnsupported",
132
- reason: "Codex lifecycle hook unknown-hook has no native projection",
133
- });
134
- });
135
- });
@@ -1,138 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
-
3
- import * as EffectVitest from "@effect/vitest";
4
- import * as Effect from "effect/Effect";
5
-
6
- import type { CompileContextPlanInput } from "../../../../scaffold/models";
7
- import { compileContextPlan } from "../../../../features/context-planning";
8
- import { testHarnessProjectionContract } from "../contract";
9
- import { project } from "../core.mjs";
10
- import { claudeAdapter } from "./claude.mjs";
11
- import { codexAdapter } from "./codex.mjs";
12
- import { cursorAdapter, cursorCapabilityMatrix } from "./cursor.mjs";
13
- import { openCodeAdapter } from "./opencode.mjs";
14
-
15
- const { describe, expect, it } = EffectVitest;
16
-
17
- const fixture = async <Value>(name: string): Promise<Value> =>
18
- JSON.parse(
19
- await readFile(new URL(`../test-fixtures/cursor/${name}.json`, import.meta.url), "utf-8"),
20
- ) as Value;
21
-
22
- const contextFixture = await fixture<Parameters<typeof project>[0]["contextPlan"]>("context-plan");
23
- const contextPlan = await Effect.runPromise(
24
- compileContextPlan(await fixture<CompileContextPlanInput>("compiler-input")),
25
- );
26
-
27
- testHarnessProjectionContract({ adapter: cursorAdapter, contextPlan, name: "cursor" });
28
-
29
- describe("Cursor harness projection", () => {
30
- it("matches the production compiler's canonical contribution identities", () => {
31
- expect(contextPlan).toStrictEqual(contextFixture);
32
- });
33
-
34
- it("projects the canonical .agents prompt from one production plan across all adapters", () => {
35
- const sharedPromptId = ".agents:shared-agents";
36
- const targets = Object.fromEntries(
37
- [claudeAdapter, codexAdapter, cursorAdapter, openCodeAdapter].map((adapter) => {
38
- const result = project({ adapter, contextPlan });
39
- const action = result.actions.find(({ trace }) => trace.contribution.id === sharedPromptId);
40
-
41
- if (result.summary._tag !== "HarnessProjectionPartial") {
42
- throw new Error(`${adapter.matrix.adapter.id} did not preserve typed omissions`);
43
- }
44
- expect(result.summary.omissions.map(({ trace }) => trace.contribution.id)).toEqual([
45
- ...(adapter.matrix.adapter.id === "opencode" ? ["scaffold-update-check"] : []),
46
- "agent-browser",
47
- "opensrc",
48
- "portless",
49
- "skills",
50
- ]);
51
- expect(action).toMatchObject({
52
- source: ".agents/AGENTS.md",
53
- trace: { contribution: { id: sharedPromptId }, scopeId: ".agents" },
54
- });
55
-
56
- return [adapter.matrix.adapter.id, action?.target];
57
- }),
58
- );
59
-
60
- expect(targets).toStrictEqual({
61
- claude: ".claude/CLAUDE.md",
62
- codex: ".codex/AGENTS.md",
63
- cursor: ".agents/AGENTS.md",
64
- opencode: ".opencode/AGENTS.md",
65
- });
66
- });
67
-
68
- it("publishes the exact versioned five-family capability matrix", async () => {
69
- expect(cursorCapabilityMatrix).toStrictEqual(await fixture("matrix"));
70
- expect(JSON.stringify(cursorCapabilityMatrix)).toBe(JSON.stringify(await fixture("matrix")));
71
- });
72
-
73
- it("projects supported bytes and records narrower support without losing canonical identity", async () => {
74
- const result = project({ adapter: cursorAdapter, contextPlan });
75
- const actions = result.actions.map(({ trace: _trace, ...action }) => action);
76
-
77
- expect(actions).toStrictEqual(await fixture("projection"));
78
- expect(JSON.stringify(actions)).toBe(JSON.stringify(await fixture("projection")));
79
- expect(result.summary._tag).toBe("HarnessProjectionPartial");
80
- expect(
81
- result.actions.every(({ contributionId, trace }) => contributionId === trace.contribution.id),
82
- ).toBe(true);
83
- expect(result.actions).toEqual(
84
- expect.arrayContaining([
85
- expect.objectContaining({
86
- contributionId: "effect-authoring",
87
- operation: "native",
88
- source: ".agents/skills/effect-authoring/SKILL.md",
89
- }),
90
- expect.objectContaining({
91
- contributionId: ".agents:shared-agents",
92
- operation: "native",
93
- source: ".agents/AGENTS.md",
94
- target: ".agents/AGENTS.md",
95
- }),
96
- ]),
97
- );
98
- });
99
-
100
- it("omits an unknown degraded lifecycle hook while preserving known projections", () => {
101
- const unknownHook = {
102
- compatibility: [],
103
- identity: { id: "unknown-hook", version: "2026.07.28" },
104
- kind: "lifecycle-hook" as const,
105
- order: 99,
106
- provenance: { revision: "2026.07.28", source: "bundled" as const },
107
- references: [],
108
- };
109
- const plan = {
110
- ...contextPlan,
111
- scopes: contextPlan.scopes.map((scope) =>
112
- scope.id === "root"
113
- ? { ...scope, contributions: [...scope.contributions, unknownHook] }
114
- : scope,
115
- ),
116
- };
117
-
118
- const result = project({ adapter: cursorAdapter, contextPlan: plan });
119
-
120
- expect(result.actions.map(({ contributionId }) => contributionId)).toEqual(
121
- expect.arrayContaining(["format-edited-file", "scaffold-update-check"]),
122
- );
123
- expect(result.summary._tag).toBe("HarnessProjectionPartial");
124
- if (result.summary._tag === "HarnessProjectionPartial") {
125
- expect(
126
- result.summary.omissions.find(({ trace }) => trace.contribution.id === "unknown-hook"),
127
- ).toMatchObject({
128
- _tag: "HarnessProjectionOmission",
129
- support: "unsupported",
130
- warning: {
131
- _tag: "UnsupportedHarnessCapabilityWarning",
132
- family: "lifecycle-hook",
133
- },
134
- });
135
- }
136
- expect(result.summary).not.toHaveProperty("errors");
137
- });
138
- });