@punks/cli 4.0.2 → 4.0.4

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 (164) hide show
  1. package/dist/BASELINE_CHANGELOG.md +29 -0
  2. package/dist/CHANGELOG.md +25 -0
  3. package/dist/baseline/scaffold-baseline/baseline.json +5 -5
  4. package/dist/baseline/scaffold-baseline/data/catalog/lint-assets.json +10 -4
  5. package/dist/baseline/scaffold-baseline/data/catalog/packs.json +0 -1
  6. package/dist/baseline/scaffold-baseline/data/catalog/skills.json +0 -8
  7. package/dist/baseline/scaffold-baseline/data/hooks/format-edited-file.mjs +602 -101
  8. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.d.ts +11 -0
  9. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.mjs +103 -0
  10. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.test.ts +144 -0
  11. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/claude.mjs +1 -0
  12. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/codex.mjs +1 -0
  13. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/cursor.mjs +1 -0
  14. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/opencode.mjs +1 -0
  15. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/contract.ts +24 -33
  16. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/core.mjs +4 -0
  17. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/core.test.ts +61 -0
  18. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/lint-feedback.test.ts +123 -0
  19. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/test-fixtures/claude/actions.json +1 -0
  20. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/test-fixtures/codex/actions.json +2 -1
  21. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/test-fixtures/cursor/projection.json +1 -0
  22. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/test-fixtures/opencode/projection.json +1 -0
  23. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents-validator.test.ts +59 -0
  24. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.d.mts +1 -0
  25. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.mjs +27 -14
  26. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/docs-onboarding/SKILL.md +2 -2
  27. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/SKILL.md +32 -32
  28. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/assets/SPEC-TEMPLATE.md +7 -7
  29. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/references/readiness.md +14 -13
  30. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/references/spec-quality-bar.md +26 -19
  31. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/autoreview/SKILL.md +2 -2
  32. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/autoreview/scripts/autoreview +3 -0
  33. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/brainstorm/SKILL.md +18 -0
  34. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/SKILL.md +2 -1
  35. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/EXAMPLES.md +9 -9
  36. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/REFERENCE.md +43 -55
  37. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/SKILL.md +68 -63
  38. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +26 -29
  39. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/concepts/story-shape.md +5 -5
  40. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +1 -1
  41. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +2 -2
  42. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +1 -1
  43. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +2 -2
  44. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/business-projection.md +19 -24
  45. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/delivery-status.md +17 -13
  46. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/fog-intake.md +45 -48
  47. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/functional-projection.md +16 -21
  48. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/normalization.md +14 -14
  49. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/project-context.md +32 -27
  50. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/providers/github.md +105 -150
  51. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/providers/linear.md +111 -181
  52. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/technical-projection.md +51 -47
  53. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/scripts/validate-task-blocker-graph.mjs +49 -35
  54. package/dist/baseline/scaffold-baseline/skills/agnostic/security/security-best-practices/references/javascript-typescript-vue-web-frontend-security.md +1 -1
  55. package/dist/baseline/scaffold-baseline/skills/frameworks/expo/eas-update-insights/references/update-insights-schema.md +2 -6
  56. package/dist/baseline/scaffold-baseline/skills/frameworks/expo/expo-skill-eval/SKILL.md +6 -7
  57. package/dist/baseline/scaffold-baseline/skills/frameworks/pulumi/pulumi-best-practices/SKILL.md +1 -3
  58. package/dist/baseline/scaffold-baseline/skills/frameworks/pulumi/pulumi-component/SKILL.md +2 -14
  59. package/dist/baseline/scaffold-baseline/skills/frameworks/tanstack-query/tanstack-query/references/best-practices.md +7 -1
  60. package/dist/baseline/scaffold-baseline/skills/frameworks/tanstack-query/tanstack-query/templates/devtools-setup.tsx +4 -0
  61. package/dist/baseline/scaffold-baseline/skills/frameworks/trpc/tanstack-query/references/best-practices.md +7 -1
  62. package/dist/baseline/scaffold-baseline/skills/frameworks/trpc/tanstack-query/templates/devtools-setup.tsx +4 -0
  63. package/dist/baseline/scaffold-baseline/skills/languages/typescript/quality-types/SKILL.md +1 -3
  64. package/dist/baseline/scaffold-baseline/skills/phases/business-finder/SKILL.md +29 -16
  65. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/SKILL.md +1 -1
  66. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +10 -8
  67. package/dist/baseline/scaffold-baseline/skills/phases/design-phase/phases/backlog.md +26 -17
  68. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/AUTHORING-HANDOFF.md +51 -261
  69. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/SKILL.md +22 -25
  70. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/ensure-fog.md +13 -23
  71. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/grilling.md +40 -0
  72. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/handback.md +11 -18
  73. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/prototype.md +13 -21
  74. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/reconcile.md +21 -35
  75. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/research.md +13 -18
  76. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/return-target.md +14 -25
  77. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/router.md +22 -56
  78. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/references/entrypoint-contract.md +25 -26
  79. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/references/root-routing.md +12 -20
  80. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/references/runtime-handoff.md +17 -39
  81. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/references/state-graph.md +27 -49
  82. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/scripts/finder-contract.mjs +40 -359
  83. package/dist/baseline/scaffold-baseline/skills/phases/functional-finder/SKILL.md +29 -62
  84. package/dist/baseline/scaffold-baseline/skills/phases/requirements-phase/SKILL.md +49 -13
  85. package/dist/baseline/scaffold-baseline.json +5 -5
  86. package/dist/baseline/scaffold-baseline.tgz +0 -0
  87. package/dist/data/hooks/format-edited-file.d.mts +21 -0
  88. package/dist/data/hooks/format-edited-file.mjs +588 -98
  89. package/dist/data/scripts/commit-gate-runner.mjs +103 -0
  90. package/dist/data/scripts/harness-projection/adapters/claude.mjs +1 -0
  91. package/dist/data/scripts/harness-projection/adapters/codex.mjs +1 -0
  92. package/dist/data/scripts/harness-projection/adapters/cursor.mjs +1 -0
  93. package/dist/data/scripts/harness-projection/adapters/opencode.mjs +1 -0
  94. package/dist/data/scripts/harness-projection/core.mjs +4 -0
  95. package/dist/data/scripts/harness-projection/test-fixtures/claude/actions.json +1 -0
  96. package/dist/data/scripts/harness-projection/test-fixtures/codex/actions.json +2 -1
  97. package/dist/data/scripts/harness-projection/test-fixtures/cursor/projection.json +1 -0
  98. package/dist/data/scripts/harness-projection/test-fixtures/opencode/projection.json +1 -0
  99. package/dist/data/scripts/sync-subagents.d.mts +1 -0
  100. package/dist/data/scripts/sync-subagents.mjs +30 -13
  101. package/dist/data/shared-agents.md +2 -60
  102. package/dist/index.js +73 -64
  103. package/dist/skills/agnostic/docs/docs-onboarding/SKILL.md +2 -2
  104. package/dist/skills/agnostic/planning/create-spec/SKILL.md +32 -32
  105. package/dist/skills/agnostic/planning/create-spec/assets/SPEC-TEMPLATE.md +7 -7
  106. package/dist/skills/agnostic/planning/create-spec/references/readiness.md +14 -13
  107. package/dist/skills/agnostic/planning/create-spec/references/spec-quality-bar.md +26 -19
  108. package/dist/skills/agnostic/quality/autoreview/SKILL.md +2 -2
  109. package/dist/skills/agnostic/quality/autoreview/scripts/autoreview +3 -0
  110. package/dist/skills/agnostic/requirements/brainstorm/SKILL.md +18 -0
  111. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +2 -1
  112. package/dist/skills/agnostic/requirements/write-backlog/EXAMPLES.md +9 -9
  113. package/dist/skills/agnostic/requirements/write-backlog/REFERENCE.md +43 -55
  114. package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +68 -63
  115. package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +26 -29
  116. package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/story-shape.md +5 -5
  117. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +1 -1
  118. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +2 -2
  119. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +1 -1
  120. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +2 -2
  121. package/dist/skills/agnostic/requirements/write-backlog/references/business-projection.md +19 -24
  122. package/dist/skills/agnostic/requirements/write-backlog/references/delivery-status.md +17 -13
  123. package/dist/skills/agnostic/requirements/write-backlog/references/fog-intake.md +45 -48
  124. package/dist/skills/agnostic/requirements/write-backlog/references/functional-projection.md +16 -21
  125. package/dist/skills/agnostic/requirements/write-backlog/references/normalization.md +14 -14
  126. package/dist/skills/agnostic/requirements/write-backlog/references/project-context.md +32 -27
  127. package/dist/skills/agnostic/requirements/write-backlog/references/providers/github.md +97 -142
  128. package/dist/skills/agnostic/requirements/write-backlog/references/providers/linear.md +106 -176
  129. package/dist/skills/agnostic/requirements/write-backlog/references/technical-projection.md +51 -47
  130. package/dist/skills/agnostic/requirements/write-backlog/scripts/validate-task-blocker-graph.mjs +55 -31
  131. package/dist/skills/phases/business-finder/SKILL.md +29 -16
  132. package/dist/skills/phases/delivery-phase/SKILL.md +1 -1
  133. package/dist/skills/phases/delivery-phase/phases/router.md +10 -8
  134. package/dist/skills/phases/design-phase/phases/backlog.md +26 -17
  135. package/dist/skills/phases/finder-phase/AUTHORING-HANDOFF.md +51 -261
  136. package/dist/skills/phases/finder-phase/SKILL.md +22 -25
  137. package/dist/skills/phases/finder-phase/phases/ensure-fog.md +13 -23
  138. package/dist/skills/phases/finder-phase/phases/grilling.md +40 -0
  139. package/dist/skills/phases/finder-phase/phases/handback.md +11 -18
  140. package/dist/skills/phases/finder-phase/phases/prototype.md +13 -21
  141. package/dist/skills/phases/finder-phase/phases/reconcile.md +21 -35
  142. package/dist/skills/phases/finder-phase/phases/research.md +13 -18
  143. package/dist/skills/phases/finder-phase/phases/return-target.md +14 -25
  144. package/dist/skills/phases/finder-phase/phases/router.md +22 -56
  145. package/dist/skills/phases/finder-phase/references/entrypoint-contract.md +25 -26
  146. package/dist/skills/phases/finder-phase/references/root-routing.md +12 -20
  147. package/dist/skills/phases/finder-phase/references/runtime-handoff.md +17 -39
  148. package/dist/skills/phases/finder-phase/references/state-graph.md +27 -49
  149. package/dist/skills/phases/finder-phase/scripts/finder-contract.mjs +44 -357
  150. package/dist/skills/phases/functional-finder/SKILL.md +29 -62
  151. package/dist/skills/phases/requirements-phase/SKILL.md +49 -13
  152. package/package.json +7 -5
  153. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/adopt-business-path.md +0 -52
  154. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/business-grilling.md +0 -68
  155. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/functional-grilling.md +0 -53
  156. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/technical-grilling.md +0 -67
  157. package/dist/baseline/scaffold-baseline/skills/phases/technical-finder/SKILL.md +0 -74
  158. package/dist/baseline/scaffold-baseline/skills/phases/technical-finder/agents/openai.yaml +0 -2
  159. package/dist/skills/phases/finder-phase/phases/adopt-business-path.md +0 -52
  160. package/dist/skills/phases/finder-phase/phases/business-grilling.md +0 -68
  161. package/dist/skills/phases/finder-phase/phases/functional-grilling.md +0 -53
  162. package/dist/skills/phases/finder-phase/phases/technical-grilling.md +0 -67
  163. package/dist/skills/phases/technical-finder/SKILL.md +0 -74
  164. package/dist/skills/phases/technical-finder/agents/openai.yaml +0 -2
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execFile as execFileCallback } from "node:child_process";
4
+ import { readFile } from "node:fs/promises";
5
+ import process from "node:process";
6
+ import path from "node:path";
7
+ import { promisify } from "node:util";
8
+
9
+ const execFile = promisify(execFileCallback);
10
+
11
+ const run = async (command, cwd, environment) => {
12
+ try {
13
+ const result = await execFile("sh", ["-c", command], {
14
+ cwd,
15
+ env: { ...process.env, ...environment },
16
+ maxBuffer: 10 * 1024 * 1024,
17
+ });
18
+ return { code: 0, stderr: result.stderr, stdout: result.stdout };
19
+ } catch (error) {
20
+ return {
21
+ code: typeof error.code === "number" ? error.code : 1,
22
+ stderr: error.stderr ?? "",
23
+ stdout: error.stdout ?? "",
24
+ };
25
+ }
26
+ };
27
+
28
+ const stagedPaths = async () => {
29
+ const { stdout } = await execFile("git", [
30
+ "diff",
31
+ "--cached",
32
+ "--name-only",
33
+ "--diff-filter=ACMR",
34
+ "-z",
35
+ ]);
36
+ return stdout.split("\0").filter(Boolean);
37
+ };
38
+
39
+ const shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
40
+
41
+ const argument = (name) => {
42
+ const index = process.argv.indexOf(name);
43
+ return index === -1 ? null : (process.argv[index + 1] ?? null);
44
+ };
45
+
46
+ const contractsPath = argument("--contracts");
47
+ if (contractsPath === null) {
48
+ console.error("Commit Gate runner requires --contracts <path>.");
49
+ process.exitCode = 2;
50
+ } else {
51
+ try {
52
+ const contractsContent = await readFile(contractsPath, "utf-8");
53
+ const contracts = JSON.parse(contractsContent);
54
+ const staged = await stagedPaths();
55
+ if (staged.length === 0) {
56
+ process.exit(0);
57
+ }
58
+
59
+ const failuresByContract = await Promise.all(
60
+ contracts.map(async (contract) => {
61
+ const relativePath = contract.path ?? ".";
62
+ const root = path.resolve(contract.root ?? process.cwd(), relativePath);
63
+ const prefix =
64
+ relativePath === "." || relativePath === "" ? "" : `${relativePath.replace(/\/$/u, "")}/`;
65
+ const files = staged
66
+ .filter((file) => prefix === "" || file.startsWith(prefix))
67
+ .map((file) => (prefix === "" ? file : file.slice(prefix.length)));
68
+ if (files.length === 0) {
69
+ return [];
70
+ }
71
+ const fileArguments = files.map(shellQuote).join(" ");
72
+ const commands = [
73
+ ["lint", contract.lint],
74
+ ["formatCheck", contract.formatCheck],
75
+ ];
76
+ const results = await Promise.all(
77
+ commands.map(async ([kind, template]) => {
78
+ const scopedTemplate = template.replace(/(?<prefix>^|\s)\.\s*$/u, "$<prefix>{files}");
79
+ const command = scopedTemplate.includes("{files}")
80
+ ? scopedTemplate.replaceAll("{files}", fileArguments)
81
+ : `${scopedTemplate} -- ${fileArguments}`;
82
+ const result = await run(command, root, {
83
+ HI_STAGED_FILES: files.join("\n"),
84
+ });
85
+ return { ...result, kind, owner: contract.owner ?? root };
86
+ }),
87
+ );
88
+ return results.filter((result) => result.code !== 0);
89
+ }),
90
+ );
91
+ const failures = failuresByContract.flat();
92
+
93
+ for (const failure of failures) {
94
+ process.stderr.write(
95
+ `Commit Gate ${failure.kind} failed for ${failure.owner} (exit ${failure.code}).\n${failure.stdout}${failure.stderr}`,
96
+ );
97
+ }
98
+ process.exitCode = failures.length === 0 ? 0 : 1;
99
+ } catch (error) {
100
+ console.error(error instanceof Error ? error.message : String(error));
101
+ process.exitCode = 1;
102
+ }
103
+ }
@@ -73,6 +73,7 @@ const projectContribution = ({ scopeId, contribution }) => {
73
73
  operation: "merge-json",
74
74
  target: `.claude/settings.json#${configuration.path.join(".")}:${contribution.identity.id}`,
75
75
  file: ".claude/settings.json",
76
+ responseMode: "claude-post-tool-use-context",
76
77
  ...configuration,
77
78
  },
78
79
  ];
@@ -84,6 +84,7 @@ const projectContribution = ({ scopeId, contribution }) => {
84
84
  target: `.codex/config.toml#hook:${contribution.identity.id}`,
85
85
  file: ".codex/config.toml",
86
86
  entries,
87
+ responseMode: "codex-post-tool-use-block",
87
88
  },
88
89
  ];
89
90
  }
@@ -81,6 +81,7 @@ const cursorProject = ({ scopeId, contribution }) => {
81
81
  source: `.agents/hooks/${contributionId}.mjs`,
82
82
  target: `.cursor/hooks/${contributionId}.mjs`,
83
83
  config: { path: ".cursor/hooks.json", ...config },
84
+ responseMode: "cursor-user-message",
84
85
  contributionId,
85
86
  },
86
87
  ];
@@ -61,6 +61,7 @@ const openCodeProject = ({ scopeId, contribution }) => {
61
61
  operation: "mirror",
62
62
  source: `.agents/hooks/${contributionId}.mjs`,
63
63
  target: `.opencode/plugins/${contributionId}.mjs`,
64
+ responseMode: "opencode-structured-log",
64
65
  contributionId,
65
66
  },
66
67
  ];
@@ -124,6 +124,10 @@ export function project({ adapter, contextPlan }) {
124
124
 
125
125
  for (const scope of contextPlan.scopes) {
126
126
  for (const contribution of scope.contributions) {
127
+ if (contribution.kind === "commit-gate") {
128
+ continue;
129
+ }
130
+
127
131
  contributionCount += 1;
128
132
  const capability = capabilities.get(contribution.kind);
129
133
  const trace = traceFor({ adapter, contextPlan, scope, contribution });
@@ -52,6 +52,7 @@
52
52
  "operation": "merge-json",
53
53
  "target": ".claude/settings.json#hooks.PostToolUse:format-edited-file",
54
54
  "file": ".claude/settings.json",
55
+ "responseMode": "claude-post-tool-use-context",
55
56
  "path": ["hooks", "PostToolUse"],
56
57
  "value": {
57
58
  "matcher": "Edit|Write|MultiEdit",
@@ -61,7 +61,8 @@
61
61
  "statusMessage": "Auto-formatting edited files",
62
62
  "timeout": 30
63
63
  }
64
- ]
64
+ ],
65
+ "responseMode": "codex-post-tool-use-block"
65
66
  },
66
67
  {
67
68
  "id": "codex:lifecycle-hook:root:scaffold-update-check:mirror",
@@ -29,6 +29,7 @@
29
29
  "event": "afterFileEdit",
30
30
  "command": "node .cursor/hooks/format-edited-file.mjs cursor"
31
31
  },
32
+ "responseMode": "cursor-user-message",
32
33
  "contributionId": "format-edited-file"
33
34
  },
34
35
  {
@@ -24,6 +24,7 @@
24
24
  "operation": "mirror",
25
25
  "source": ".agents/hooks/format-edited-file.mjs",
26
26
  "target": ".opencode/plugins/format-edited-file.mjs",
27
+ "responseMode": "opencode-structured-log",
27
28
  "contributionId": "format-edited-file"
28
29
  },
29
30
  {
@@ -0,0 +1 @@
1
+ export declare const validateCanonicalContextPlan: (contextPlan: unknown) => string | undefined;
@@ -2878,6 +2878,7 @@ const contributionKinds = new Set([
2878
2878
  "lifecycle-hook",
2879
2879
  "tool-configuration",
2880
2880
  "subagent-template",
2881
+ "commit-gate",
2881
2882
  ]);
2882
2883
 
2883
2884
  const identityIssue = (identity) =>
@@ -2902,19 +2903,23 @@ const compatibilityIssue = (compatibility) =>
2902
2903
  isNonEmptyString(entry.id) &&
2903
2904
  isNonEmptyString(entry.versionRange),
2904
2905
  )
2906
+ ? undefined
2907
+ : "Context contribution compatibility is invalid";
2908
+
2909
+ const commitGateContractIssue = (contract) =>
2910
+ exactKeys(contract, ["lint", "formatCheck"]) &&
2911
+ isNonEmptyString(contract.lint) &&
2912
+ isNonEmptyString(contract.formatCheck)
2905
2913
  ? undefined
2906
- : "Context contribution compatibility is invalid";
2914
+ : "Commit-gate contract must contain non-empty lint and formatCheck strings";
2907
2915
 
2908
2916
  const contributionIssue = (contribution) => {
2917
+ const expectedKeys =
2918
+ contribution?.kind === "commit-gate"
2919
+ ? ["kind", "identity", "provenance", "compatibility", "references", "order", "contract"]
2920
+ : ["kind", "identity", "provenance", "compatibility", "references", "order"];
2909
2921
  if (
2910
- !exactKeys(contribution, [
2911
- "kind",
2912
- "identity",
2913
- "provenance",
2914
- "compatibility",
2915
- "references",
2916
- "order",
2917
- ])
2922
+ !exactKeys(contribution, expectedKeys)
2918
2923
  ) {
2919
2924
  return "Context contribution fields are invalid";
2920
2925
  }
@@ -2925,6 +2930,9 @@ const contributionIssue = (contribution) => {
2925
2930
  identityIssue(contribution.identity) ??
2926
2931
  provenanceIssue(contribution.provenance) ??
2927
2932
  compatibilityIssue(contribution.compatibility) ??
2933
+ (contribution.kind === "commit-gate"
2934
+ ? commitGateContractIssue(contribution.contract)
2935
+ : undefined) ??
2928
2936
  (!Array.isArray(contribution.references) || !contribution.references.every(isNonEmptyString)
2929
2937
  ? "Context contribution references are invalid"
2930
2938
  : undefined) ??
@@ -3002,6 +3010,9 @@ function subagentManifestIssue(contextPlan) {
3002
3010
  const canonicalContextIssue = (contextPlan) =>
3003
3011
  contextPlanIssue(contextPlan) ?? subagentManifestIssue(contextPlan);
3004
3012
 
3013
+ export const validateCanonicalContextPlan = (contextPlan) =>
3014
+ canonicalContextIssue(contextPlan);
3015
+
3005
3016
  const contextPlanVersion = (contextPlan) =>
3006
3017
  isObject(contextPlan) && typeof contextPlan.version === "string"
3007
3018
  ? contextPlan.version
@@ -3109,8 +3120,14 @@ async function main({ publicationLock } = {}) {
3109
3120
  }
3110
3121
  }
3111
3122
 
3112
- try {
3113
- await main();
3114
- } finally {
3115
- await closeMutationWorkers();
3123
+ const entrypointPath =
3124
+ process.argv[1] === undefined ? null : await realpath(process.argv[1]);
3125
+ const modulePath = await realpath(fileURLToPath(import.meta.url));
3126
+
3127
+ if (entrypointPath === modulePath) {
3128
+ try {
3129
+ await main();
3130
+ } finally {
3131
+ await closeMutationWorkers();
3132
+ }
3116
3133
  }
@@ -1,14 +1,8 @@
1
- # AGENTS.md
2
-
3
- Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
4
-
5
- **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
6
-
7
1
  ## Philosophy
8
2
 
9
3
  This codebase will outlive you. Every shortcut becomes someone else's burden. Every hack compounds into technical debt that slows the team down.
10
4
 
11
- You are not writing code, you are shaping the future of the project. The patterns established will be copied, the corners cut will be cut again.
5
+ You are shaping the future of the project. The patterns established will be copied, the corners cut will be cut again.
12
6
 
13
7
  Fight entropy, leave the codebase better than when you found it.
14
8
 
@@ -16,6 +10,7 @@ Fight entropy, leave the codebase better than when you found it.
16
10
 
17
11
  - When generating tokens be extremely concise. Sacrifice grammar for the sake of concision.
18
12
  - Be detailed about concepts, reasoning, assumptions, tradeoffs, and questions; keep wording terse.
13
+ - Stop using jargon and speak coherently. State it more simply and concisely, like one human talking to another.
19
14
 
20
15
  ## 1. Think Before Coding
21
16
 
@@ -58,56 +53,3 @@ When your changes create orphans:
58
53
  - Don't remove pre-existing dead code unless asked.
59
54
 
60
55
  The test: Every changed line should trace directly to the user's request or to necessary entropy-reducing support for that request.
61
-
62
- ## 4. Goal-Driven Execution
63
-
64
- **Define success criteria. Loop until verified.**
65
-
66
- Transform tasks into verifiable goals:
67
-
68
- - "Add validation" -> "Write tests for invalid inputs, then make them pass"
69
- - "Fix the bug" -> "Write a test that reproduces it, then make it pass"
70
- - "Refactor X" -> "Ensure tests pass before and after"
71
-
72
- For multi-step tasks, state a brief plan:
73
-
74
- ```text
75
- 1. [Step] -> verify: [check]
76
- 2. [Step] -> verify: [check]
77
- 3. [Step] -> verify: [check]
78
- ```
79
-
80
- Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
81
-
82
- ## Dependency source inspection
83
-
84
- - Prefer web search and official docs first when inspecting external libraries or packages.
85
- - If web results are unsuccessful, stale, or not detailed enough for implementation, fetch source locally.
86
- - For npm packages, use `opensrc path <package>` to get the absolute path to cached source code, fetching on cache miss.
87
- - For non-npm packages, clone the upstream `owner/repo` git source directly with `opensrc path <owner>/<repo>`.
88
-
89
- ## Subagents
90
-
91
- Subagent-based working is mandatory. Before delegating, verify the active harness global/project settings actually enable subagent execution. Then verify `.agents/subagents/manifest.mjs` exists and the chosen specialist has matching owned paths, guidance files, and skills.
92
-
93
- Use one active execution or implementation subagent at a time by default. Spawn multiple execution or implementation subagents in parallel only when the user explicitly asks for parallelism.
94
-
95
- If a spawn is blocked by a full subagent/thread set, close existing completed or finished subagents, then retry.
96
-
97
- Use readonly subagents for research, auditing, investigating hypotheses, or exploring separate paths. When readonly work can be split across independent questions, paths, or hypotheses, parallel readonly subagents are mandatory.
98
-
99
- If the runtime guard fails, repair setup or report the blocker; do not claim inactive worker coverage and do not silently fall back to main-thread execution.
100
-
101
- ## Notes — Cross-session Memory
102
-
103
- Notebook at `.agents/notes/`. Shared memory across sessions. Never ask permission.
104
-
105
- **On session start:** Read `.agents/notes/index.md` (create if missing).
106
- **Write notes for:**
107
-
108
- - Non-obvious behaviors, gotchas, edge cases
109
- - Hard-won insights that took investigation
110
- - Project conventions and architectural decisions
111
- - Setup and config quirks
112
- **Don't note:** File locations, basic structure, session summaries, trivial facts.
113
- **Guidelines:** Store in `.agents/notes/`, keep `index.md` lean with one line per note, update existing notes before creating new ones, include why not just what, prune aggressively.