gentle-pi 2.1.2 → 2.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 (228) hide show
  1. package/README.md +108 -79
  2. package/assets/agents/gentle-ai-worker.md +7 -3
  3. package/assets/agents/jd-fix-agent.md +1 -1
  4. package/assets/agents/jd-judge-a.md +3 -1
  5. package/assets/agents/jd-judge-b.md +3 -1
  6. package/assets/agents/review-readability.md +4 -3
  7. package/assets/agents/review-reliability.md +4 -3
  8. package/assets/agents/review-resilience.md +4 -3
  9. package/assets/agents/review-risk.md +4 -3
  10. package/assets/agents/sdd-apply.md +11 -4
  11. package/assets/agents/sdd-archive.md +6 -1
  12. package/assets/agents/sdd-design.md +6 -1
  13. package/assets/agents/sdd-explore.md +6 -2
  14. package/assets/agents/sdd-init.md +10 -2
  15. package/assets/agents/sdd-onboard.md +6 -1
  16. package/assets/agents/sdd-proposal.md +8 -1
  17. package/assets/agents/sdd-research.md +54 -0
  18. package/assets/agents/sdd-spec.md +6 -1
  19. package/assets/agents/sdd-status.md +10 -5
  20. package/assets/agents/sdd-sync.md +6 -1
  21. package/assets/agents/sdd-tasks.md +8 -4
  22. package/assets/agents/sdd-verify.md +27 -2
  23. package/assets/chains/4r-review.chain.md +2 -0
  24. package/assets/chains/sdd-full.chain.md +2 -2
  25. package/assets/chains/sdd-plan.chain.md +1 -1
  26. package/assets/chains/sdd-verify.chain.md +2 -2
  27. package/assets/orchestrator-delegation.md +145 -160
  28. package/assets/orchestrator-memory.md +2 -0
  29. package/assets/orchestrator.md +25 -48
  30. package/assets/sdd-orchestrator-workflow.md +163 -25
  31. package/assets/support/sdd-status-contract.md +24 -6
  32. package/contracts/review-integration/v1/fixtures/consent.fixture.json +3 -3
  33. package/contracts/review-integration/v1/fixtures/start-v2.fixture.json +19 -28
  34. package/contracts/review-integration/v1/fixtures/start.fixture.json +1 -10
  35. package/contracts/review-integration/v1/fixtures/status-v2.fixture.json +12 -21
  36. package/contracts/review-integration/v1/schemas/correction-plan-request.schema.json +49 -0
  37. package/contracts/review-integration/v1/schemas/operation.schema.json +76 -0
  38. package/contracts/review-integration/v1/schemas/repair.schema.json +39 -0
  39. package/contracts/review-integration/v1/schemas/status-v2.schema.json +4 -2
  40. package/contracts/review-integration/v1/schemas/status.schema.json +4 -2
  41. package/contracts/review-integration/v1/schemas/transition-execution.schema.json +42 -0
  42. package/contracts/review-integration/v2/fixtures/consent.fixture.json +1 -1
  43. package/contracts/review-integration/v2/fixtures/start.fixture.json +1 -10
  44. package/contracts/review-integration/v2/fixtures/status.fixture.json +1 -10
  45. package/contracts/review-integration/v2/schemas/failure.schema.json +5 -1
  46. package/contracts/review-integration/v2/schemas/last-event-closure.schema.json +66 -0
  47. package/contracts/review-integration/v2/schemas/opencode-provider-role.schema.json +14 -0
  48. package/contracts/review-integration/v2/schemas/operation.schema.json +6 -1
  49. package/contracts/review-integration/v2/schemas/repair.schema.json +4 -2
  50. package/contracts/review-integration/v2/schemas/start.schema.json +5 -2
  51. package/contracts/review-integration/v2/schemas/status.schema.json +4 -2
  52. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +30 -0
  53. package/contracts/review-provider-contract-mirror/v1.1.0/bundle/README.md +12 -0
  54. package/contracts/review-provider-contract-mirror/v1.1.0/bundle/manifest.json +65 -0
  55. package/contracts/review-provider-contract-mirror/v1.1.0/bundle/schemas/lens.schema.json +16 -0
  56. package/contracts/review-provider-contract-mirror/v1.1.0/bundle/schemas/refuter.schema.json +1 -0
  57. package/contracts/review-provider-contract-mirror/v1.1.0/bundle/schemas/targeted-validator.schema.json +1 -0
  58. package/contracts/review-provider-contract-mirror/v1.1.0/bundle/vectors/lens.json +1 -0
  59. package/contracts/review-provider-contract-mirror/v1.1.0/bundle/vectors/refuter.json +1 -0
  60. package/contracts/review-provider-contract-mirror/v1.1.0/bundle/vectors/targeted-validator.json +1 -0
  61. package/contracts/review-provider-contract-mirror/v1.1.0/generated/provider-capabilities.baseline.json +15 -0
  62. package/contracts/review-provider-contract-mirror/v1.1.0/generated/provider-roles.baseline.json +42 -0
  63. package/docs/native-authority-architecture.md +14 -16
  64. package/docs/review-integration.md +27 -353
  65. package/extensions/ask-user-choice.ts +151 -0
  66. package/extensions/gentle-ai.ts +2710 -3211
  67. package/extensions/quiet-tools.ts +515 -32
  68. package/extensions/sdd-init.ts +21 -12
  69. package/extensions/skill-registry.ts +10 -2
  70. package/extensions/startup-banner.ts +10 -4
  71. package/lib/gentle-ai-binary.ts +173 -2
  72. package/lib/gentle-ai-renderer.ts +70 -0
  73. package/lib/model-routing-authority.ts +133 -0
  74. package/lib/native-review-cli.ts +676 -781
  75. package/lib/opaque-pi-reviewer-adapter.ts +284 -0
  76. package/lib/provider-contract-bundle.ts +704 -0
  77. package/lib/review-candidate-view.ts +836 -118
  78. package/lib/review-compact-contract.ts +59 -248
  79. package/lib/review-host-relay.ts +578 -0
  80. package/lib/review-integration-v2.ts +1254 -221
  81. package/lib/review-last-event-controller.ts +35 -0
  82. package/lib/review-relay-contract.ts +16 -0
  83. package/lib/sdd-preflight.ts +230 -67
  84. package/lib/sdd-status.ts +66 -111
  85. package/lib/terminal-theme.ts +1 -1
  86. package/package.json +83 -79
  87. package/runtime/gentle-ai-binary.mjs +174 -3
  88. package/runtime/native-review-cli.mjs +610 -715
  89. package/runtime/review-integration-v2.mjs +1223 -190
  90. package/runtime/review-relay-contract.mjs +17 -0
  91. package/scripts/{build-git-commit-transaction-runner.mjs → build-runtime-modules.mjs} +5 -5
  92. package/scripts/check-provider-contract.mjs +138 -0
  93. package/scripts/gentle-ai-installer.mjs +85 -22
  94. package/scripts/maintainer/provider-relay-matrix.mjs +403 -0
  95. package/scripts/mirror-provider-contract.mjs +143 -0
  96. package/scripts/test-packed-runner.mjs +20 -9
  97. package/scripts/verify-package-files.mjs +119 -43
  98. package/skills/_shared/review-ledger-contract.md +11 -19
  99. package/skills/chained-pr/SKILL.md +3 -0
  100. package/skills/cognitive-doc-design/SKILL.md +1 -1
  101. package/skills/comment-writer/SKILL.md +1 -1
  102. package/skills/gentle-ai/SKILL.md +7 -74
  103. package/skills/issue-creation/SKILL.md +94 -168
  104. package/skills/judgment-day/SKILL.md +9 -5
  105. package/skills/judgment-day/references/prompts-and-formats.md +2 -0
  106. package/skills/rdd-defect-workflow/SKILL.md +54 -0
  107. package/skills/release/SKILL.md +3 -3
  108. package/skills/skill-registry/SKILL.md +1 -1
  109. package/skills/work-unit-commits/SKILL.md +3 -1
  110. package/tests/artifact-language.test.ts +24 -11
  111. package/tests/ask-user-choice.test.ts +264 -0
  112. package/tests/background-subagents.test.ts +771 -0
  113. package/tests/codegraph-tools.test.ts +3 -3
  114. package/tests/crosslane/cross-lane.mjs +16 -0
  115. package/tests/delegated-key-learnings-contract.test.ts +240 -0
  116. package/tests/devbinary/native-review-parity.devtest.ts +167 -250
  117. package/tests/devbinary/pi-host-relay.devtest.ts +867 -0
  118. package/tests/fixtures/devbinary/capabilities-v2.1.derived.json +331 -0
  119. package/tests/fixtures/devbinary/capabilities-v2.2.captured.json +340 -0
  120. package/tests/fixtures/devbinary/consent-v3.captured.json +37 -0
  121. package/tests/fixtures/devbinary/failure-v2-capture-evidence.captured.json +16 -0
  122. package/tests/fixtures/devbinary/last-event-capture-correction-plan.captured.json +10 -0
  123. package/tests/fixtures/devbinary/last-event-capture-refuter-approved.captured.json +20 -0
  124. package/tests/fixtures/devbinary/last-event-capture-refuter-correction-required.captured.json +26 -0
  125. package/tests/fixtures/devbinary/last-event-capture-result-approved.captured.json +8 -0
  126. package/tests/fixtures/devbinary/last-event-capture-result-correction-required.captured.json +26 -0
  127. package/tests/fixtures/devbinary/last-event-capture-validation-approved.captured.json +8 -0
  128. package/tests/fixtures/devbinary/last-event-closure.provenance.md +13 -0
  129. package/tests/fixtures/devbinary/result-artifact-v2-path.captured.json +12 -0
  130. package/tests/fixtures/devbinary/result-artifact-v2.captured.json +12 -0
  131. package/tests/fixtures/devbinary/review-acknowledged-v1.captured.json +9 -0
  132. package/tests/fixtures/devbinary/review-acknowledged.provenance.md +31 -0
  133. package/tests/fixtures/devbinary/start-v3-consent-declined.captured.json +19 -0
  134. package/tests/fixtures/devbinary/start-v3-consent-granted.captured.json +109 -0
  135. package/tests/fixtures/devbinary/start-v3-zero-lens-closed.captured.json +21 -0
  136. package/tests/fixtures/devbinary/status-v5-capture-result-submission.captured.json +184 -0
  137. package/tests/fixtures/devbinary/status-v5-repository-context.captured.json +138 -0
  138. package/tests/fixtures/devbinary/status-v5.captured.json +88 -0
  139. package/tests/fixtures/native-review-cli/v2.5.0-rc.1/PROVENANCE.txt +15 -0
  140. package/tests/fixtures/provider-contract-bundle/v1.1.0/README.md +12 -0
  141. package/tests/fixtures/provider-contract-bundle/v1.1.0/manifest.json +65 -0
  142. package/tests/fixtures/provider-contract-bundle/v1.1.0/schemas/lens.schema.json +16 -0
  143. package/tests/fixtures/provider-contract-bundle/v1.1.0/schemas/refuter.schema.json +1 -0
  144. package/tests/fixtures/provider-contract-bundle/v1.1.0/schemas/targeted-validator.schema.json +1 -0
  145. package/tests/fixtures/provider-contract-bundle/v1.1.0/vectors/lens.json +1 -0
  146. package/tests/fixtures/provider-contract-bundle/v1.1.0/vectors/refuter.json +1 -0
  147. package/tests/fixtures/provider-contract-bundle/v1.1.0/vectors/targeted-validator.json +1 -0
  148. package/tests/gentle-ai-binary.test.ts +83 -13
  149. package/tests/gentle-ai-dev-binary-surfacing.test.ts +195 -0
  150. package/tests/gentle-ai-dev-binary.test.ts +159 -0
  151. package/tests/gentle-ai-installer.test.ts +138 -48
  152. package/tests/gentle-ai.test.ts +820 -131
  153. package/tests/gentle-theme.test.ts +133 -0
  154. package/tests/maintainer/provider-relay.maintest.ts +601 -0
  155. package/tests/model-routing-authority.test.ts +257 -0
  156. package/tests/native-review-capability-contract.test.ts +75 -2
  157. package/tests/native-review-cli.test.ts +588 -908
  158. package/tests/native-review-consent.test.ts +283 -38
  159. package/tests/native-review-parity-runtime.test.ts +108 -350
  160. package/tests/native-review-parity.test.ts +684 -732
  161. package/tests/native-sdd-attempt-authority.test.ts +235 -0
  162. package/tests/opaque-pi-reviewer-adapter.test.ts +266 -0
  163. package/tests/orchestrator-budget.test.ts +158 -89
  164. package/tests/orchestrator-rdd-ownership.test.ts +103 -0
  165. package/tests/package-manifest.test.ts +128 -100
  166. package/tests/provider-contract-bundle.test.ts +385 -0
  167. package/tests/provider-contract-mirror.test.ts +206 -0
  168. package/tests/provider-defect-handoff.test.ts +252 -0
  169. package/tests/quiet-tool-rendering.test.ts +1055 -28
  170. package/tests/review-actor-tool-deny.test.ts +12 -13
  171. package/tests/review-authority-recovery-docs.test.ts +1 -2
  172. package/tests/review-candidate-view.test.ts +898 -12
  173. package/tests/review-compact-contract.test.ts +29 -122
  174. package/tests/review-controller-lock-status.test.ts +2 -2
  175. package/tests/review-controller-native-recovery.test.ts +366 -857
  176. package/tests/review-controller-native-routing.test.ts +1253 -4199
  177. package/tests/review-controller-retired-ops.test.ts +1 -1
  178. package/tests/review-controller-workspace-root.test.ts +236 -70
  179. package/tests/review-controller.test.ts +26 -816
  180. package/tests/review-corrected-finalize-binding.test.ts +134 -0
  181. package/tests/review-dispatch-hydration-gap.test.ts +145 -0
  182. package/tests/review-gate.test.ts +0 -45
  183. package/tests/review-host-relay-restart-parity.test.ts +360 -0
  184. package/tests/review-host-relay-routing.test.ts +352 -0
  185. package/tests/review-host-relay.test.ts +754 -0
  186. package/tests/review-integration-v2-forward.test.ts +654 -0
  187. package/tests/review-integration-v2.test.ts +317 -129
  188. package/tests/review-last-event-closure.test.ts +408 -0
  189. package/tests/review-ledger-contract.test.ts +106 -60
  190. package/tests/review-recovered-lineage-routing.test.ts +199 -0
  191. package/tests/review-relay-transport-agent.test.ts +322 -0
  192. package/tests/review-snapshot.test.ts +3 -2
  193. package/tests/runtime-harness.mjs +573 -180
  194. package/tests/sdd-agent-tools.test.ts +53 -32
  195. package/tests/sdd-preflight.test.ts +81 -15
  196. package/tests/sdd-status.test.ts +109 -110
  197. package/tests/skill-collision-prefixes.test.ts +6 -8
  198. package/tests/skill-registry.test.ts +50 -1
  199. package/tests/verify-package-files.test.ts +62 -0
  200. package/tests/writer-edit-surface-scope.test.ts +230 -0
  201. package/themes/Gentleman-Cute.json +94 -0
  202. package/themes/Gentleman-Sexy.json +92 -0
  203. package/assets/agents/review-refuter.md +0 -40
  204. package/assets/agents/review-validator.md +0 -23
  205. package/lib/git-commit-transaction.ts +0 -801
  206. package/lib/native-review-remediation.ts +0 -49
  207. package/lib/review-compact.ts +0 -947
  208. package/lib/review-refuter-adapter.ts +0 -129
  209. package/lib/review-runtime-contract.ts +0 -68
  210. package/prompts/gcl.md +0 -54
  211. package/prompts/gis.md +0 -25
  212. package/prompts/gpr.md +0 -41
  213. package/prompts/gwr.md +0 -31
  214. package/runtime/git-commit-transaction.mjs +0 -802
  215. package/scripts/run-git-commit-transaction.mjs +0 -35
  216. package/tests/fixtures/native-review-cli/v2.1.2/bind-sdd.json +0 -25
  217. package/tests/fixtures/native-review-cli/v2.1.2/finalize.json +0 -8
  218. package/tests/fixtures/native-review-cli/v2.1.2/sdd-status-engram.json +0 -139
  219. package/tests/fixtures/native-review-cli/v2.1.2/sdd-status.json +0 -200
  220. package/tests/fixtures/native-review-cli/v2.1.2/start.json +0 -12
  221. package/tests/fixtures/native-review-cli/v2.1.2/validate-allow.json +0 -24
  222. package/tests/fixtures/native-review-cli/v2.1.2/validate-deny-empty-context.json +0 -20
  223. package/tests/fixtures/native-review-cli/v2.1.2/validate-deny.json +0 -28
  224. package/tests/fixtures/native-review-cli/v2.1.3/sdd-status-engram.json +0 -139
  225. package/tests/fixtures/native-review-cli/v2.1.3/sdd-status.json +0 -200
  226. package/tests/git-commit-transaction.test.ts +0 -302
  227. package/tests/review-compact.test.ts +0 -243
  228. package/tests/review-refuter-adapter.test.ts +0 -89
@@ -1,129 +0,0 @@
1
- import {
2
- COMPACT_FINDING_OUTCOME,
3
- type CompactRefuterRequest,
4
- type CompactRefuterResult,
5
- } from "./review-compact.ts";
6
-
7
- const REFUTER_BATCH_SCHEMA = "gentle-ai.refuter-result-batch/v1";
8
- const DIGEST = /^[0-9a-f]{64}$/;
9
-
10
- export const REFUTER_BATCH_STATUS = {
11
- NORMALIZED: "normalized",
12
- INVALID: "invalid",
13
- } as const;
14
-
15
- export interface RefuterBatchRow {
16
- finding_id: string;
17
- outcome: CompactRefuterResult["outcome"];
18
- proof_refs: string[];
19
- }
20
-
21
- export interface RefuterBatch {
22
- schema: typeof REFUTER_BATCH_SCHEMA;
23
- request_hash: string;
24
- results: RefuterBatchRow[];
25
- }
26
-
27
- export interface NativeRefuterDocument {
28
- results: RefuterBatchRow[];
29
- }
30
-
31
- interface NormalizedRefuterBatch {
32
- status: typeof REFUTER_BATCH_STATUS.NORMALIZED;
33
- refuter_request_hash: string;
34
- refuter_results: CompactRefuterResult[];
35
- }
36
-
37
- interface InvalidRefuterBatch {
38
- status: typeof REFUTER_BATCH_STATUS.INVALID;
39
- reason_code: string;
40
- }
41
-
42
- export type RefuterBatchNormalization = NormalizedRefuterBatch | InvalidRefuterBatch;
43
-
44
- function invalid(reason_code: string): InvalidRefuterBatch {
45
- return { status: REFUTER_BATCH_STATUS.INVALID, reason_code };
46
- }
47
-
48
- function record(value: unknown): Record<string, unknown> | undefined {
49
- if (typeof value !== "object" || value === null || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype) return undefined;
50
- return value as Record<string, unknown>;
51
- }
52
-
53
- function exact(object: Record<string, unknown>, keys: readonly string[]): boolean {
54
- return Object.keys(object).length === keys.length && keys.every((key) => key in object);
55
- }
56
-
57
- function parseBatch(value: unknown): RefuterBatch | InvalidRefuterBatch {
58
- let raw = value;
59
- if (typeof raw === "string") {
60
- if (raw.length === 0 || raw.trim() !== raw) return invalid("refuter-batch-prose");
61
- try {
62
- raw = JSON.parse(raw) as unknown;
63
- } catch {
64
- return invalid("refuter-batch-json");
65
- }
66
- }
67
- const batch = record(raw);
68
- if (!batch || !exact(batch, ["schema", "request_hash", "results"])) return invalid("refuter-batch-shape");
69
- if (batch.schema !== REFUTER_BATCH_SCHEMA || typeof batch.request_hash !== "string" || !DIGEST.test(batch.request_hash) || !Array.isArray(batch.results)) {
70
- return invalid("refuter-batch-shape");
71
- }
72
- const results: RefuterBatchRow[] = [];
73
- for (const result of batch.results) {
74
- const row = record(result);
75
- if (!row || !exact(row, ["finding_id", "outcome", "proof_refs"])) return invalid("refuter-row-shape");
76
- if (
77
- typeof row.finding_id !== "string" || row.finding_id.length === 0 || row.finding_id.trim() !== row.finding_id ||
78
- (row.outcome !== COMPACT_FINDING_OUTCOME.REFUTED && row.outcome !== COMPACT_FINDING_OUTCOME.CORROBORATED && row.outcome !== COMPACT_FINDING_OUTCOME.INCONCLUSIVE) ||
79
- !Array.isArray(row.proof_refs) ||
80
- row.proof_refs.length === 0 ||
81
- row.proof_refs.some((proof) => typeof proof !== "string" || proof.length === 0 || proof.trim() !== proof)
82
- ) return invalid("refuter-row-value");
83
- results.push({ finding_id: row.finding_id, outcome: row.outcome, proof_refs: [...row.proof_refs] });
84
- }
85
- return { schema: REFUTER_BATCH_SCHEMA, request_hash: batch.request_hash, results };
86
- }
87
-
88
- export function parseRefuterBatch(value: unknown): RefuterBatch {
89
- const batch = parseBatch(value);
90
- if ("status" in batch) throw new TypeError(batch.reason_code);
91
- return batch;
92
- }
93
-
94
- export function toNativeRefuterDocument(batch: RefuterBatch): NativeRefuterDocument {
95
- return { results: batch.results.map((row) => ({ ...row, proof_refs: [...row.proof_refs] })) };
96
- }
97
-
98
- export function normalizeRefuterBatch(
99
- request: CompactRefuterRequest,
100
- value: unknown,
101
- ): RefuterBatchNormalization {
102
- const batch = parseBatch(value);
103
- if ("status" in batch) return batch;
104
- if (batch.request_hash !== request.request_hash) return invalid("refuter-request-hash");
105
- const frozen = new Map(request.findings.map((finding) => [finding.id, finding]));
106
- const rows = new Map<string, RefuterBatchRow>();
107
- for (const row of batch.results) {
108
- const finding = frozen.get(row.finding_id);
109
- if (!finding) return invalid("refuter-finding-id");
110
- if (rows.has(row.finding_id)) return invalid("refuter-duplicate-id");
111
- if (row.proof_refs.length === 0 || new Set(row.proof_refs).size !== row.proof_refs.length) return invalid("refuter-proof-refs");
112
- rows.set(row.finding_id, row);
113
- }
114
- if (rows.size !== request.findings.length) return invalid("refuter-missing-id");
115
- const refuter_results = request.findings.map((finding) => {
116
- const row = rows.get(finding.id);
117
- if (!row) throw new Error("Complete refuter batch lost a frozen finding");
118
- return {
119
- finding_id: row.finding_id,
120
- outcome: row.outcome,
121
- proof_refs: [...row.proof_refs].toSorted(),
122
- };
123
- });
124
- return {
125
- status: REFUTER_BATCH_STATUS.NORMALIZED,
126
- refuter_request_hash: request.request_hash,
127
- refuter_results,
128
- };
129
- }
@@ -1,68 +0,0 @@
1
- import { domainHashV1 } from "./review-canonical.ts";
2
-
3
- export const REVIEW_RUNTIME_INCOMPATIBLE = "REVIEW_RUNTIME_INCOMPATIBLE";
4
-
5
- export interface LoadedReviewRuntimeIdentityV1 {
6
- schema: "gentle-ai.review-runtime/v1";
7
- compact_contract: "gentle-ai.review-compact/v2";
8
- operation_contract: string;
9
- state_schema: "gentle-ai.review-state/v2";
10
- record_schema: "gentle-ai.review-state-record/v2";
11
- receipt_schema: "gentle-ai.review-receipt-body/v2";
12
- canonicalization: "gentle-ai.canonical-json/v1";
13
- identity_hash: string;
14
- }
15
-
16
- function identityBody(): Omit<LoadedReviewRuntimeIdentityV1, "identity_hash"> {
17
- return {
18
- schema: "gentle-ai.review-runtime/v1",
19
- compact_contract: "gentle-ai.review-compact/v2",
20
- operation_contract: "gentle-ai.review-operation/v1",
21
- state_schema: "gentle-ai.review-state/v2",
22
- record_schema: "gentle-ai.review-state-record/v2",
23
- receipt_schema: "gentle-ai.review-receipt-body/v2",
24
- canonicalization: "gentle-ai.canonical-json/v1",
25
- };
26
- }
27
-
28
- function createIdentity(): LoadedReviewRuntimeIdentityV1 {
29
- const body = identityBody();
30
- return { ...body, identity_hash: domainHashV1("review-runtime-contract", body) };
31
- }
32
-
33
- let testIdentity: LoadedReviewRuntimeIdentityV1 | undefined;
34
-
35
- export function loadedReviewRuntimeIdentity(): LoadedReviewRuntimeIdentityV1 {
36
- return testIdentity ?? createIdentity();
37
- }
38
-
39
- function identityHash(identity: Omit<LoadedReviewRuntimeIdentityV1, "identity_hash">): string {
40
- return domainHashV1("review-runtime-contract", identity);
41
- }
42
-
43
- export function assertReviewRuntimeIdentity(identity: LoadedReviewRuntimeIdentityV1): void {
44
- if (!hasValidIdentityHash(identity)) throw new Error(REVIEW_RUNTIME_INCOMPATIBLE);
45
- }
46
-
47
- function hasValidIdentityHash(identity: LoadedReviewRuntimeIdentityV1): boolean {
48
- return identity.identity_hash === identityHash({
49
- schema: identity.schema,
50
- compact_contract: identity.compact_contract,
51
- operation_contract: identity.operation_contract,
52
- state_schema: identity.state_schema,
53
- record_schema: identity.record_schema,
54
- receipt_schema: identity.receipt_schema,
55
- canonicalization: identity.canonicalization,
56
- });
57
- }
58
-
59
- export function assertLoadedReviewRuntimeIdentity(expected: LoadedReviewRuntimeIdentityV1): void {
60
- const actual = loadedReviewRuntimeIdentity();
61
- assertReviewRuntimeIdentity(actual);
62
- assertReviewRuntimeIdentity(expected);
63
- if (actual.identity_hash !== expected.identity_hash) throw new Error(REVIEW_RUNTIME_INCOMPATIBLE);
64
- }
65
-
66
- export function setLoadedReviewRuntimeIdentityForTesting(identity: LoadedReviewRuntimeIdentityV1 | undefined): void {
67
- testIdentity = identity;
68
- }
package/prompts/gcl.md DELETED
@@ -1,54 +0,0 @@
1
- ---
2
- description: Audit changelog entries before release
3
- ---
4
- Audit changelog entries for all commits since the last release.
5
-
6
- ## Process
7
-
8
- 1. **Find the last release tag:**
9
- ```bash
10
- git tag --sort=-version:refname | head -1
11
- ```
12
-
13
- 2. **List all commits since that tag:**
14
- ```bash
15
- git log <tag>..HEAD --oneline
16
- ```
17
-
18
- 3. **Read each package's [Unreleased] section:**
19
- - packages/ai/CHANGELOG.md
20
- - packages/tui/CHANGELOG.md
21
- - packages/coding-agent/CHANGELOG.md
22
-
23
- 4. **For each commit, check:**
24
- - Skip: changelog updates, doc-only changes, release housekeeping
25
- - Skip: changes to generated model catalogs (for example `packages/ai/src/models.generated.ts`) unless accompanied by an intentional product-facing change in non-generated source/docs.
26
- - Determine which package(s) the commit affects (use `git show <hash> --stat`)
27
- - Verify a changelog entry exists in the affected package(s)
28
- - For external contributions (PRs), verify format: `Description ([#N](url) by [@user](url))`
29
-
30
- 5. **Cross-package duplication rule:**
31
- Changes in `ai`, `agent` or `tui` that affect end users should be duplicated to `coding-agent` changelog, since coding-agent is the user-facing package that depends on them.
32
-
33
- 6. **Add New Features section after changelog fixes:**
34
- - Insert a `### New Features` section at the start of `## [Unreleased]` in `packages/coding-agent/CHANGELOG.md`.
35
- - Propose the top new features to the user for confirmation before writing them.
36
- - Link to relevant docs and sections whenever possible.
37
-
38
- 7. **Report:**
39
- - List commits with missing entries
40
- - List entries that need cross-package duplication
41
- - Add any missing entries directly
42
-
43
- ## Changelog Format Reference
44
-
45
- Sections (in order):
46
- - `### Breaking Changes` - API changes requiring migration
47
- - `### Added` - New features
48
- - `### Changed` - Changes to existing functionality
49
- - `### Fixed` - Bug fixes
50
- - `### Removed` - Removed features
51
-
52
- Attribution:
53
- - Internal: `Fixed foo ([#123](https://github.com/earendil-works/pi-mono/issues/123))`
54
- - External: `Added bar ([#456](https://github.com/earendil-works/pi-mono/pull/456) by [@user](https://github.com/user))`
package/prompts/gis.md DELETED
@@ -1,25 +0,0 @@
1
- ---
2
- description: Analyze GitHub issues (bugs or feature requests)
3
- argument-hint: "<issue>"
4
- ---
5
- Analyze GitHub issue(s): $ARGUMENTS
6
-
7
- For each issue:
8
-
9
- 1. Add the `inprogress` label to the issue via GitHub CLI before analysis starts. If adding the label fails, report that explicitly and continue.
10
- 2. Read the issue in full, including all comments and linked issues/PRs.
11
- 3. Do not trust analysis written in the issue. Independently verify behavior and derive your own analysis from the code and execution path.
12
-
13
- 4. **For bugs**:
14
- - Ignore any root cause analysis in the issue (likely wrong)
15
- - Read all related code files in full (no truncation)
16
- - Trace the code path and identify the actual root cause
17
- - Propose a fix
18
-
19
- 5. **For feature requests**:
20
- - Do not trust implementation proposals in the issue without verification
21
- - Read all related code files in full (no truncation)
22
- - Propose the most concise implementation approach
23
- - List affected files and changes needed
24
-
25
- Do NOT implement unless explicitly asked. Analyze and propose only.
package/prompts/gpr.md DELETED
@@ -1,41 +0,0 @@
1
- ---
2
- description: Review PRs from URLs with structured issue and code analysis
3
- argument-hint: "<PR-URL>"
4
- ---
5
- You are given one or more GitHub PR URLs: $@
6
-
7
- For each PR URL, do the following in order:
8
- 1. Add the `inprogress` label to the PR via GitHub CLI before analysis starts. If adding the label fails, report that explicitly and continue.
9
- 2. Read the PR page in full. Include description, all comments, all commits, and all changed files.
10
- 3. Identify any linked issues referenced in the PR body, comments, commit messages, or cross links. Read each issue in full, including all comments.
11
- 4. Analyze the PR diff. Read all relevant code files in full with no truncation from the current main branch and compare against the diff. Do not fetch PR file blobs unless a file is missing on main or the diff context is insufficient. Include related code paths that are not in the diff but are required to validate behavior.
12
- 5. Check for a changelog entry in the relevant `packages/*/CHANGELOG.md` files. Report whether an entry exists. If missing, state that a changelog entry is required before merge and that you will add it if the user decides to merge. Follow the changelog format rules in AGENTS.md. Verify:
13
- - Entry uses correct section (`### Breaking Changes`, `### Added`, `### Fixed`, etc.)
14
- - External contributions include PR link and author: `Fixed foo ([#123](https://github.com/earendil-works/pi-mono/pull/123) by [@user](https://github.com/user))`
15
- - Breaking changes are in `### Breaking Changes`, not just `### Fixed`
16
- 6. Check if packages/coding-agent/README.md, packages/coding-agent/docs/*.md, packages/coding-agent/examples/**/*.md require modification. This is usually the case when existing features have been changed, or new features have been added.
17
- 7. Provide a structured review with these sections:
18
- - Good: solid choices or improvements
19
- - Bad: concrete issues, regressions, missing tests, or risks
20
- - Ugly: subtle or high impact problems
21
- 8. Add Questions or Assumptions if anything is unclear.
22
- 9. Add Change summary and Tests.
23
-
24
- Output format per PR:
25
- PR: <url>
26
- Changelog:
27
- - ...
28
- Good:
29
- - ...
30
- Bad:
31
- - ...
32
- Ugly:
33
- - ...
34
- Questions or Assumptions:
35
- - ...
36
- Change summary:
37
- - ...
38
- Tests:
39
- - ...
40
-
41
- If no issues are found, say so under Bad and Ugly.
package/prompts/gwr.md DELETED
@@ -1,31 +0,0 @@
1
- ---
2
- description: Finish the current task end-to-end with changelog, commit, and push
3
- argument-hint: "[instructions]"
4
- ---
5
- Wrap it.
6
-
7
- Additional instructions: $ARGUMENTS
8
-
9
- Determine context from the conversation history first.
10
-
11
- Rules for context detection:
12
- - If the conversation already mentions a GitHub issue or PR, use that existing context.
13
- - If the work came from `/is` or `/pr`, assume the issue or PR context is already known from the conversation and from the analysis work already done.
14
- - If there is no GitHub issue or PR in the conversation history, treat this as non-GitHub work.
15
-
16
- Unless I explicitly override something in this request, do the following in order:
17
-
18
- 1. Add or update the relevant package changelog entry under `## [Unreleased]` using the repo changelog rules.
19
- 2. If this task is tied to a GitHub issue or PR and a final issue or PR comment has not already been posted in this session, draft it in my tone, preview it, and post exactly one final comment.
20
- 3. Commit only files you changed in this session.
21
- 4. If this task is tied to exactly one GitHub issue, include `closes #<issue>` in the commit message. If it is tied to multiple issues, stop and ask which one to use. If it is not tied to any issue, do not include `closes #` or `fixes #` in the commit message.
22
- 5. Check the current git branch. If it is not `main`, stop and ask what to do. Do not push from another branch unless I explicitly say so.
23
- 6. Push the current branch.
24
-
25
- Constraints:
26
- - Never stage unrelated files.
27
- - Never use `git add .` or `git add -A`.
28
- - Run required checks before committing if code changed.
29
- - Do not open a PR unless I explicitly ask.
30
- - If this is not GitHub issue or PR work, do not post a GitHub comment.
31
- - If a final issue or PR comment was already posted in this session, do not post another one unless I explicitly ask.