@aviaratech/ai-delivery 0.3.38 → 0.3.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -18
- package/dist/agent.d.ts +0 -4
- package/dist/agent.js +1 -8
- package/dist/agent.js.map +2 -2
- package/dist/cli.js +2 -72
- package/dist/cli.js.map +2 -2
- package/dist/cliResult.js +2 -14
- package/dist/cliResult.js.map +2 -2
- package/dist/cliResult.test.js +0 -74
- package/dist/cliResult.test.js.map +2 -2
- package/dist/config/deliveryConfig.d.ts +0 -6
- package/dist/config/deliveryConfig.js +2 -35
- package/dist/config/deliveryConfig.js.map +2 -2
- package/dist/config/deliveryConfig.test.js +1 -25
- package/dist/config/deliveryConfig.test.js.map +2 -2
- package/dist/contributorChecks.test.js +0 -1
- package/dist/contributorChecks.test.js.map +2 -2
- package/dist/delivery/common.d.ts +0 -14
- package/dist/delivery/common.js +1 -44
- package/dist/delivery/common.js.map +2 -2
- package/dist/directoryIndependent.test.js +2 -24
- package/dist/directoryIndependent.test.js.map +2 -2
- package/dist/dispatch.js +0 -46
- package/dist/dispatch.js.map +3 -3
- package/dist/fixtures/inertTarget.js +3 -5
- package/dist/fixtures/inertTarget.js.map +2 -2
- package/dist/fixtures/recordedGitHubFlows.d.ts +0 -72
- package/dist/fixtures/recordedGitHubFlows.js +1 -57
- package/dist/fixtures/recordedGitHubFlows.js.map +2 -2
- package/dist/git.d.ts +0 -6
- package/dist/git.js +0 -15
- package/dist/git.js.map +2 -2
- package/dist/github/client.js +0 -3
- package/dist/github/client.js.map +2 -2
- package/dist/github/commandIdentityPolicy.js +0 -1
- package/dist/github/commandIdentityPolicy.js.map +2 -2
- package/dist/github/issueHistory.d.ts +0 -6
- package/dist/github/issueHistory.js +0 -39
- package/dist/github/issueHistory.js.map +2 -2
- package/dist/github/nativeIssueMetadata.d.ts +0 -10
- package/dist/github/nativeIssueMetadata.js +1 -33
- package/dist/github/nativeIssueMetadata.js.map +3 -3
- package/dist/github/projectDelivery.d.ts +0 -34
- package/dist/github/projectDelivery.js +0 -211
- package/dist/github/projectDelivery.js.map +2 -2
- package/dist/github/repo.d.ts +0 -8
- package/dist/github/repo.js +0 -72
- package/dist/github/repo.js.map +2 -2
- package/dist/issue.js +15 -15
- package/dist/issue.js.map +2 -2
- package/dist/issue63Routes.test.js +1 -72
- package/dist/issue63Routes.test.js.map +2 -2
- package/dist/issueIntake.test.js +12 -0
- package/dist/issueIntake.test.js.map +2 -2
- package/dist/issueJournal.d.ts +0 -9
- package/dist/issueJournal.js +10 -76
- package/dist/issueJournal.js.map +2 -2
- package/dist/issueJournal.test.js +1 -108
- package/dist/issueJournal.test.js.map +2 -2
- package/dist/issueTracking.test.js +0 -48
- package/dist/issueTracking.test.js.map +2 -2
- package/dist/lifecycle.test.js +12 -48
- package/dist/lifecycle.test.js.map +2 -2
- package/dist/logger.d.ts +0 -4
- package/dist/logger.js +0 -31
- package/dist/logger.js.map +2 -2
- package/dist/mcp/tools.d.ts +2 -618
- package/dist/mcp/tools.js +8 -34
- package/dist/mcp/tools.js.map +2 -2
- package/dist/pluginAuthProbe.js +0 -3
- package/dist/pluginAuthProbe.js.map +2 -2
- package/dist/pluginDoctor.test.js +1 -1
- package/dist/pluginDoctor.test.js.map +2 -2
- package/dist/pluginInstaller.js +0 -3
- package/dist/pluginInstaller.js.map +2 -2
- package/dist/pluginInstaller.test.js +3 -19
- package/dist/pluginInstaller.test.js.map +2 -2
- package/dist/pluginPackaging.test.js +1 -118
- package/dist/pluginPackaging.test.js.map +2 -2
- package/dist/pr.d.ts +2 -73
- package/dist/pr.js +27 -220
- package/dist/pr.js.map +3 -3
- package/dist/pr.test.js +11 -304
- package/dist/pr.test.js.map +2 -2
- package/dist/prAssociation.test.js +112 -22
- package/dist/prAssociation.test.js.map +2 -2
- package/dist/prDispatch.test.js +4 -11
- package/dist/prDispatch.test.js.map +2 -2
- package/dist/releaseWorkflow.test.js +0 -1
- package/dist/releaseWorkflow.test.js.map +2 -2
- package/dist/review.d.ts +0 -82
- package/dist/review.js +3 -94
- package/dist/review.js.map +2 -2
- package/dist/review.test.js +2 -4
- package/dist/review.test.js.map +2 -2
- package/dist/services/agentReadinessService.d.ts +0 -1
- package/dist/services/agentReadinessService.js.map +2 -2
- package/dist/stdoutRegression.test.js +3 -22
- package/dist/stdoutRegression.test.js.map +2 -2
- package/dist/targetPolicyDiscovery.test.js +0 -86
- package/dist/targetPolicyDiscovery.test.js.map +2 -2
- package/dist/targetPolicyEntrypoints.test.js +1 -54
- package/dist/targetPolicyEntrypoints.test.js.map +2 -2
- package/dist/targetRepositoryExecution.test.js +1 -49
- package/dist/targetRepositoryExecution.test.js.map +2 -2
- package/dist/terminalMessages.d.ts +0 -10
- package/dist/terminalMessages.js +1 -31
- package/dist/terminalMessages.js.map +2 -2
- package/dist/toolOutput.js +0 -2
- package/dist/toolOutput.js.map +2 -2
- package/dist/toolOutput.test.js +15 -1
- package/dist/toolOutput.test.js.map +2 -2
- package/dist/verification.d.ts +1 -186
- package/dist/verification.js +29 -587
- package/dist/verification.js.map +3 -3
- package/dist/verificationGate.test.js +4 -90
- package/dist/verificationGate.test.js.map +2 -2
- package/dist/version.d.ts +0 -6
- package/dist/version.js +2 -39
- package/dist/version.js.map +2 -2
- package/package.json +1 -1
- package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
- package/plugins/ai-delivery/plugin.json +1 -1
- package/plugins/ai-delivery/runtime/dist/cli.js +123 -167
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/dist/boardReconcile.test.d.ts +0 -1
- package/dist/boardReconcile.test.js +0 -1746
- package/dist/boardReconcile.test.js.map +0 -7
- package/dist/delivery/delivery.test.d.ts +0 -1
- package/dist/delivery/delivery.test.js +0 -560
- package/dist/delivery/delivery.test.js.map +0 -7
- package/dist/delivery/evidence.d.ts +0 -92
- package/dist/delivery/evidence.js +0 -139
- package/dist/delivery/evidence.js.map +0 -7
- package/dist/delivery/legacy.d.ts +0 -8
- package/dist/delivery/legacy.js +0 -65
- package/dist/delivery/legacy.js.map +0 -7
- package/dist/delivery/policy.d.ts +0 -252
- package/dist/delivery/policy.js +0 -221
- package/dist/delivery/policy.js.map +0 -7
- package/dist/delivery/stage.d.ts +0 -179
- package/dist/delivery/stage.js +0 -242
- package/dist/delivery/stage.js.map +0 -7
- package/dist/deliveryBoard.d.ts +0 -74
- package/dist/deliveryBoard.js +0 -644
- package/dist/deliveryBoard.js.map +0 -7
- package/dist/deliveryBoard.test.d.ts +0 -1
- package/dist/deliveryBoard.test.js +0 -649
- package/dist/deliveryBoard.test.js.map +0 -7
- package/dist/deliveryHealth.test.d.ts +0 -1
- package/dist/deliveryHealth.test.js +0 -191
- package/dist/deliveryHealth.test.js.map +0 -7
- package/dist/fixtures/deliveryBoardReplay.d.ts +0 -56
- package/dist/fixtures/deliveryBoardReplay.js +0 -617
- package/dist/fixtures/deliveryBoardReplay.js.map +0 -7
- package/dist/genericCompatibility.test.d.ts +0 -1
- package/dist/genericCompatibility.test.js +0 -66
- package/dist/genericCompatibility.test.js.map +0 -7
- package/dist/services/boardReconcileService.d.ts +0 -1204
- package/dist/services/boardReconcileService.js +0 -1445
- package/dist/services/boardReconcileService.js.map +0 -7
- package/dist/services/deliveryHealthService.d.ts +0 -84
- package/dist/services/deliveryHealthService.js +0 -204
- package/dist/services/deliveryHealthService.js.map +0 -7
- package/dist/services/legacyIssueMigration.d.ts +0 -46
- package/dist/services/legacyIssueMigration.js +0 -299
- package/dist/services/legacyIssueMigration.js.map +0 -7
- package/dist/utils/filesystem.d.ts +0 -1
- package/dist/utils/filesystem.js +0 -5
- package/dist/utils/filesystem.js.map +0 -7
package/dist/issueJournal.d.ts
CHANGED
|
@@ -112,14 +112,5 @@ export declare const JournalInputSchema: z.ZodObject<{
|
|
|
112
112
|
followUps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
113
|
}, z.core.$strict>;
|
|
114
114
|
export declare function renderJournal(raw: JournalInput, marker?: string): string;
|
|
115
|
-
export type JournalAttention = {
|
|
116
|
-
kind: JournalInput['kind'] | null;
|
|
117
|
-
state: 'pending' | 'clear' | 'unknown';
|
|
118
|
-
request: string | null;
|
|
119
|
-
reason: string | null;
|
|
120
|
-
};
|
|
121
|
-
/** Read only unambiguous structure emitted by renderJournal; free text is not a second template. */
|
|
122
|
-
export declare function parseJournalAttention(body: string): JournalAttention;
|
|
123
115
|
export declare function acceptanceCriteria(body: string): string[];
|
|
124
|
-
export declare function issueFollowUps(body: string): string[];
|
|
125
116
|
export {};
|
package/dist/issueJournal.js
CHANGED
|
@@ -60,25 +60,26 @@ function missingJournalFields(input) {
|
|
|
60
60
|
const shape = variant?.shape ?? { ...Common, kind: z.string() };
|
|
61
61
|
return Object.entries(shape).filter(([key, schema]) => !schema.isOptional() && input[key] === void 0).map(([key]) => key);
|
|
62
62
|
}
|
|
63
|
+
const onlyFor = (kind, what = "non-empty text") => `Required ${what} when kind is ${kind}; omit for every other kind.`;
|
|
63
64
|
const JournalInputSchema = z.strictObject({
|
|
64
65
|
...Common,
|
|
65
66
|
kind: z.enum(["start", "progress", "decision", "blocker", "closeout"]).describe(
|
|
66
67
|
"Select a journal kind and provide its required fields: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps."
|
|
67
68
|
),
|
|
68
|
-
outcome: Text.optional(),
|
|
69
|
-
done: z.array(Text).min(1).optional(),
|
|
70
|
-
decisionNeeded: Text.optional(),
|
|
71
|
-
decision: Text.optional().describe("
|
|
72
|
-
rationale: Text.optional().describe("
|
|
73
|
-
blocker: Text.optional(),
|
|
74
|
-
resolution: Text.optional(),
|
|
69
|
+
outcome: Text.optional().describe(onlyFor("start")),
|
|
70
|
+
done: z.array(Text).min(1).optional().describe(onlyFor("progress", "non-empty list")),
|
|
71
|
+
decisionNeeded: Text.optional().describe(onlyFor("progress")),
|
|
72
|
+
decision: Text.optional().describe(onlyFor("decision")),
|
|
73
|
+
rationale: Text.optional().describe(onlyFor("decision")),
|
|
74
|
+
blocker: Text.optional().describe(onlyFor("blocker")),
|
|
75
|
+
resolution: Text.optional().describe(onlyFor("blocker")),
|
|
75
76
|
acceptance: z.array(
|
|
76
77
|
z.strictObject(
|
|
77
78
|
{ criterion: Text, evidence: Evidence },
|
|
78
79
|
{ error: "Invalid acceptance entry. Provide only criterion and evidence." }
|
|
79
80
|
)
|
|
80
|
-
).min(1).optional(),
|
|
81
|
-
followUps: z.array(Text).optional()
|
|
81
|
+
).min(1).optional().describe(onlyFor("closeout", "non-empty list of criterion and evidence")),
|
|
82
|
+
followUps: z.array(Text).optional().describe(onlyFor("closeout", "list, empty when none"))
|
|
82
83
|
}).superRefine((input, ctx) => {
|
|
83
84
|
const parsed = JournalVariants.safeParse(input);
|
|
84
85
|
if (!parsed.success)
|
|
@@ -146,76 +147,11 @@ ${section}`;
|
|
|
146
147
|
|
|
147
148
|
${marker}`;
|
|
148
149
|
}
|
|
149
|
-
function parseJournalAttention(body) {
|
|
150
|
-
const unknown = () => ({
|
|
151
|
-
kind: null,
|
|
152
|
-
state: "unknown",
|
|
153
|
-
request: null,
|
|
154
|
-
reason: "Journal structure is incomplete or ambiguous."
|
|
155
|
-
});
|
|
156
|
-
const preview = /^Status: ([^\r\n]{0,32})\. Next: ([^\r\n]{0,32})\.\n\n(?!\*\*Kind:\*\*)/.exec(body);
|
|
157
|
-
if (preview && preview.slice(1).every((value) => value.length <= 32 && !/[*_~`<>[\]\\]|[^\S ]/u.test(value)))
|
|
158
|
-
body = body.slice(preview[0].length);
|
|
159
|
-
const markers = body.match(/<!--\s*ai-delivery:journal@/gu) ?? [];
|
|
160
|
-
if (markers.length) {
|
|
161
|
-
const suffix = /\n\n<!-- ai-delivery:journal@1:sha256:[a-f0-9]{64} -->$/u.exec(body);
|
|
162
|
-
if (markers.length !== 1 || !suffix) return unknown();
|
|
163
|
-
body = body.slice(0, suffix.index);
|
|
164
|
-
}
|
|
165
|
-
if (/<\/?details>|<\/?summary>/u.test(body)) {
|
|
166
|
-
const opening = "\n\n<details>\n<summary>Additional journal detail</summary>";
|
|
167
|
-
if (body.split("<details>").length !== 2 || body.split("</details>").length !== 2 || body.split("<summary>").length !== 2 || body.split("</summary>").length !== 2 || !body.includes(opening) || !body.endsWith("\n\n</details>"))
|
|
168
|
-
return unknown();
|
|
169
|
-
body = body.replace(opening, "").slice(0, -"\n\n</details>".length);
|
|
170
|
-
}
|
|
171
|
-
const kind = /\*\*Kind:\*\* (start|progress|decision|blocker|closeout)\. \*\*Status:\*\*/u.exec(body)?.[1];
|
|
172
|
-
if (!kind) return unknown();
|
|
173
|
-
const fields = {
|
|
174
|
-
start: ["Outcome"],
|
|
175
|
-
progress: ["Done since last", "Decision needed"],
|
|
176
|
-
decision: ["Decision", "Rationale"],
|
|
177
|
-
blocker: ["Blocker", "Resolution needed"],
|
|
178
|
-
closeout: ["Acceptance evidence", "Follow-ups"]
|
|
179
|
-
};
|
|
180
|
-
const expected = ["Kind", "Status", ...fields[kind], "Key numbers", "Next", "Evidence"];
|
|
181
|
-
const matches = [
|
|
182
|
-
...body.matchAll(
|
|
183
|
-
/\*\*(Kind|Status|Outcome|Done since last|Decision needed|Decision|Rationale|Blocker|Resolution needed|Acceptance evidence|Follow-ups|Key numbers|Next|Evidence):\*\*/gu
|
|
184
|
-
)
|
|
185
|
-
];
|
|
186
|
-
if (matches.length !== expected.length || matches.some((match, i) => match[1] !== expected[i])) return unknown();
|
|
187
|
-
const first = matches[0].index;
|
|
188
|
-
if (!/^[^\r\n]+\n\n$/u.test(body.slice(0, first))) return unknown();
|
|
189
|
-
let request = null;
|
|
190
|
-
for (const [i, match] of matches.entries()) {
|
|
191
|
-
if (i !== 1 && body.slice(match.index - 2, match.index) !== "\n\n") return unknown();
|
|
192
|
-
let fence = null;
|
|
193
|
-
for (const line of body.slice(0, match.index).split("\n")) {
|
|
194
|
-
const edge = /^ {0,3}(`{3,}|~{3,})(.*)$/u.exec(line);
|
|
195
|
-
if (!edge) continue;
|
|
196
|
-
if (fence === null) fence = edge[1];
|
|
197
|
-
else if (edge[1][0] === fence[0] && edge[1].length >= fence.length && !edge[2].trim()) fence = null;
|
|
198
|
-
}
|
|
199
|
-
if (fence !== null) return unknown();
|
|
200
|
-
const end = matches[i + 1]?.index ?? body.length;
|
|
201
|
-
const value = body.slice(match.index + match[0].length, end).trim();
|
|
202
|
-
if (!value) return unknown();
|
|
203
|
-
if (match[1] === "Decision needed") request = value;
|
|
204
|
-
}
|
|
205
|
-
if (kind !== "progress") return { kind, state: "clear", request: null, reason: null };
|
|
206
|
-
if (request === null) return unknown();
|
|
207
|
-
return /^(?:none\.?|n\/a|not needed)$/iu.test(request) ? { kind, state: "clear", request: null, reason: null } : { kind, state: "pending", request, reason: null };
|
|
208
|
-
}
|
|
209
150
|
function acceptanceCriteria(body) {
|
|
210
151
|
return journalSection(body, ["acceptance criteria"]).map(
|
|
211
152
|
(line) => line.trimStart().match(/^[-*+]\s*\[[ xX]\][ \t](.*)$/u)?.[1]?.trim() ?? ""
|
|
212
153
|
).filter(Boolean);
|
|
213
154
|
}
|
|
214
|
-
function issueFollowUps(body) {
|
|
215
|
-
return journalSection(body, ["follow-ups", "follow ups"]).map(
|
|
216
|
-
(line) => line.trimStart().match(/^[-*+]\s*(?:\[[ xX]\][ \t])?(.*)$/u)?.[1]?.trim() ?? ""
|
|
217
|
-
).filter(Boolean);
|
|
218
|
-
}
|
|
219
155
|
function journalSection(body, headings) {
|
|
220
156
|
const heading = (line) => line.match(/^ {0,3}#{1,6}[ \t](.*)$/u)?.[1]?.trim().toLowerCase();
|
|
221
157
|
const lines = body.split(/\r?\n/u);
|
|
@@ -232,9 +168,7 @@ export {
|
|
|
232
168
|
JOURNAL_SCHEMA_METADATA,
|
|
233
169
|
JournalInputSchema,
|
|
234
170
|
acceptanceCriteria,
|
|
235
|
-
issueFollowUps,
|
|
236
171
|
missingJournalFields,
|
|
237
|
-
parseJournalAttention,
|
|
238
172
|
renderJournal
|
|
239
173
|
};
|
|
240
174
|
//# sourceMappingURL=issueJournal.js.map
|
package/dist/issueJournal.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/issueJournal.ts"],
|
|
4
|
-
"sourcesContent": ["import { isIP } from 'node:net';\nimport { z } from 'zod';\n\nconst Text = z.string().trim().min(1).max(10000);\nconst Summary = Text.max(500).refine((value) => !/[\\r\\n]/u.test(value), 'Summary must be one plain-language line.');\nconst Date = z.iso.date();\nconst EvidenceUrl = z.url({ protocol: /^https$/u }).refine((value) => {\n let url: URL;\n try {\n url = new URL(value);\n } catch {\n return false;\n }\n const hostname = url.hostname.replace(/^\\[|\\]$/gu, '').replace(/\\.$/u, '');\n return (\n !url.username &&\n !url.password &&\n isIP(hostname) === 0 &&\n hostname.includes('.') &&\n hostname !== 'localhost' &&\n !hostname.endsWith('.localhost') &&\n !hostname.endsWith('.local')\n );\n}, 'Evidence must be an HTTPS link with a public DNS hostname and no credentials or IP literal.');\nconst Evidence = EvidenceUrl.describe(\n 'HTTPS link with a public DNS hostname, such as a GitHub URL; no IP, localhost or credentials.',\n);\nconst Common = {\n issueNumber: z.number().int().positive(),\n summary: Summary,\n status: Text,\n nextStep: Text,\n nextDate: Date.nullable(),\n keyNumbers: z.array(Text),\n evidence: z.array(Evidence),\n details: Text.optional(),\n lengthCap: z.number().int().min(600).max(10000).optional(),\n};\n\nconst JournalVariants = z.discriminatedUnion('kind', [\n z.strictObject({ ...Common, kind: z.literal('start'), outcome: Text }),\n z.strictObject({\n ...Common,\n kind: z.literal('progress'),\n evidence: z.array(Evidence).min(1),\n done: z.array(Text).min(1),\n decisionNeeded: Text,\n }),\n z.strictObject({ ...Common, kind: z.literal('decision'), decision: Text, rationale: Text }),\n z.strictObject({ ...Common, kind: z.literal('blocker'), blocker: Text, resolution: Text }),\n z.strictObject({\n ...Common,\n kind: z.literal('closeout'),\n acceptance: z.array(z.strictObject({ criterion: Text, evidence: Evidence })).min(1),\n followUps: z.array(Text),\n }),\n]);\nexport type JournalInput = z.infer<typeof JournalVariants>;\n/** Publish the same kind requirements enforced by the canonical variant schemas. */\nexport const JOURNAL_SCHEMA_METADATA = {\n required: [\n ...Object.entries(Common)\n .filter(([, schema]) => !schema.isOptional())\n .map(([key]) => key),\n 'kind',\n ],\n anyOf: JournalVariants.options.map((variant) => ({\n properties: { kind: { const: variant.shape.kind.value } },\n required: Object.entries(variant.shape as Record<string, z.ZodType>)\n .filter(([key, schema]) => !(key in Common) && key !== 'kind' && !schema.isOptional())\n .map(([key]) => key),\n })),\n};\nexport function missingJournalFields(input: Record<string, unknown>): string[] {\n const variant = JournalVariants.options.find((option) => option.shape.kind.value === input.kind);\n const shape = variant?.shape ?? { ...Common, kind: z.string() };\n return Object.entries(shape as Record<string, z.ZodType>)\n .filter(([key, schema]) => !schema.isOptional() && input[key] === undefined)\n .map(([key]) => key);\n}\n\n// MCP requires an object schema; the same variant validator enforces kind-specific fields.\nexport const JournalInputSchema = z\n .strictObject({\n ...Common,\n kind: z\n .enum(['start', 'progress', 'decision', 'blocker', 'closeout'])\n .describe(\n 'Select a journal kind and provide its required fields: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps.',\n ),\n outcome: Text.optional(),\n done: z.array(Text).min(1).optional(),\n decisionNeeded: Text.optional(),\n decision: Text.optional().describe('Required non-empty text when kind is decision; omit for every other kind.'),\n rationale: Text.optional().describe('Required non-empty text when kind is decision; omit for every other kind.'),\n blocker: Text.optional(),\n resolution: Text.optional(),\n acceptance: z\n .array(\n z.strictObject(\n { criterion: Text, evidence: Evidence },\n { error: 'Invalid acceptance entry. Provide only criterion and evidence.' },\n ),\n )\n .min(1)\n .optional(),\n followUps: z.array(Text).optional(),\n })\n .superRefine((input, ctx) => {\n const parsed = JournalVariants.safeParse(input);\n if (!parsed.success)\n for (const issue of parsed.error.issues)\n ctx.addIssue({ code: 'custom', path: issue.path, message: issue.message });\n });\n\nexport function renderJournal(raw: JournalInput, marker?: string): string {\n const input = JournalVariants.parse(raw);\n const plainPreview = (value: string): string => {\n const plain = value\n .replace(/!?\\[([^\\]]+)\\]\\([^)]*\\)/gu, '$1')\n .replace(/^\\s{0,3}(?:#{1,6}\\s+|>\\s?|[-+*]\\s+|\\d+[.)]\\s+)/gmu, '')\n .replace(/[*_~`<>[\\]\\\\]/gu, '')\n .replace(/\\s+/gu, ' ')\n .trim();\n const preview = plain.slice(0, 32);\n const last = preview.charCodeAt(preview.length - 1);\n return last >= 0xd800 && last <= 0xdbff ? preview.slice(0, -1) : preview;\n };\n const field = (label: string, value: string): string =>\n `**${label}:**${/\\n|^(?:[-*+]\\s|\\d+[.)]\\s)/u.test(value) ? '\\n' : ' '}${value}`;\n const list = (values: string[]): string => values.map((value) => '- ' + value.replace(/\\n/gu, '\\n ')).join('\\n');\n const sections = [`**Kind:** ${input.kind}. **Status:** ${input.status}`];\n switch (input.kind) {\n case 'start':\n sections.push(field('Outcome', input.outcome));\n break;\n case 'progress':\n sections.push(`**Done since last:**\\n${list(input.done)}`, field('Decision needed', input.decisionNeeded));\n break;\n case 'decision':\n sections.push(field('Decision', input.decision), field('Rationale', input.rationale));\n break;\n case 'blocker':\n sections.push(field('Blocker', input.blocker), field('Resolution needed', input.resolution));\n break;\n case 'closeout':\n sections.push(\n `**Acceptance evidence:**\\n${input.acceptance.map((item) => `- ${item.criterion} \u2014 ${item.evidence}`).join('\\n')}`,\n `**Follow-ups:** ${input.followUps.length ? input.followUps.join('; ') : 'None.'}`,\n );\n break;\n }\n sections.push(\n `**Key numbers:** ${input.keyNumbers.length ? input.keyNumbers.join('; ') : 'None reported.'}`,\n `**Next:** ${input.nextStep} (${input.nextDate ?? 'date not scheduled'}).`,\n `**Evidence:** ${input.evidence.length ? input.evidence.join(' \u00B7 ') : 'None yet.'}`,\n );\n if (input.details) sections.push(input.details);\n let body = `Status: ${plainPreview(input.status)}. Next: ${plainPreview(input.nextStep)}.\\n\\n${input.summary}`;\n let overflow = '';\n for (const section of sections) {\n if (overflow || body.length + section.length + 2 > (input.lengthCap ?? 1800)) overflow += `\\n\\n${section}`;\n else body += `\\n\\n${section}`;\n }\n if (overflow) body += `\\n\\n<details>\\n<summary>Additional journal detail</summary>${overflow}\\n\\n</details>`;\n return marker === undefined ? body : `${body}\\n\\n${marker}`;\n}\n\nexport type JournalAttention = {\n kind: JournalInput['kind'] | null;\n state: 'pending' | 'clear' | 'unknown';\n request: string | null;\n reason: string | null;\n};\n\n/** Read only unambiguous structure emitted by renderJournal; free text is not a second template. */\nexport function parseJournalAttention(body: string): JournalAttention {\n const unknown = (): JournalAttention => ({\n kind: null,\n state: 'unknown',\n request: null,\n reason: 'Journal structure is incomplete or ambiguous.',\n });\n // Match the same UTF-16 unit bounds used by plainPreview.\n const preview = /^Status: ([^\\r\\n]{0,32})\\. Next: ([^\\r\\n]{0,32})\\.\\n\\n(?!\\*\\*Kind:\\*\\*)/.exec(body);\n if (preview && preview.slice(1).every((value) => value.length <= 32 && !/[*_~`<>[\\]\\\\]|[^\\S ]/u.test(value)))\n body = body.slice(preview[0].length);\n const markers = body.match(/<!--\\s*ai-delivery:journal@/gu) ?? [];\n if (markers.length) {\n const suffix = /\\n\\n<!-- ai-delivery:journal@1:sha256:[a-f0-9]{64} -->$/u.exec(body);\n if (markers.length !== 1 || !suffix) return unknown();\n body = body.slice(0, suffix.index);\n }\n if (/<\\/?details>|<\\/?summary>/u.test(body)) {\n const opening = '\\n\\n<details>\\n<summary>Additional journal detail</summary>';\n if (\n body.split('<details>').length !== 2 ||\n body.split('</details>').length !== 2 ||\n body.split('<summary>').length !== 2 ||\n body.split('</summary>').length !== 2 ||\n !body.includes(opening) ||\n !body.endsWith('\\n\\n</details>')\n )\n return unknown();\n body = body.replace(opening, '').slice(0, -'\\n\\n</details>'.length);\n }\n const kind = /\\*\\*Kind:\\*\\* (start|progress|decision|blocker|closeout)\\. \\*\\*Status:\\*\\*/u.exec(body)?.[1] as\n | JournalInput['kind']\n | undefined;\n if (!kind) return unknown();\n const fields: Record<JournalInput['kind'], string[]> = {\n start: ['Outcome'],\n progress: ['Done since last', 'Decision needed'],\n decision: ['Decision', 'Rationale'],\n blocker: ['Blocker', 'Resolution needed'],\n closeout: ['Acceptance evidence', 'Follow-ups'],\n };\n const expected = ['Kind', 'Status', ...fields[kind], 'Key numbers', 'Next', 'Evidence'];\n const matches = [\n ...body.matchAll(\n /\\*\\*(Kind|Status|Outcome|Done since last|Decision needed|Decision|Rationale|Blocker|Resolution needed|Acceptance evidence|Follow-ups|Key numbers|Next|Evidence):\\*\\*/gu,\n ),\n ];\n if (matches.length !== expected.length || matches.some((match, i) => match[1] !== expected[i])) return unknown();\n const first = matches[0]!.index;\n if (!/^[^\\r\\n]+\\n\\n$/u.test(body.slice(0, first))) return unknown();\n let request: string | null = null;\n for (const [i, match] of matches.entries()) {\n if (i !== 1 && body.slice(match.index - 2, match.index) !== '\\n\\n') return unknown();\n let fence: string | null = null;\n for (const line of body.slice(0, match.index).split('\\n')) {\n const edge = /^ {0,3}(`{3,}|~{3,})(.*)$/u.exec(line);\n if (!edge) continue;\n if (fence === null) fence = edge[1]!;\n else if (edge[1]![0] === fence[0] && edge[1]!.length >= fence.length && !edge[2]!.trim()) fence = null;\n }\n if (fence !== null) return unknown();\n const end = matches[i + 1]?.index ?? body.length;\n const value = body.slice(match.index + match[0].length, end).trim();\n if (!value) return unknown();\n if (match[1] === 'Decision needed') request = value;\n }\n if (kind !== 'progress') return { kind, state: 'clear', request: null, reason: null };\n if (request === null) return unknown();\n return /^(?:none\\.?|n\\/a|not needed)$/iu.test(request)\n ? { kind, state: 'clear', request: null, reason: null }\n : { kind, state: 'pending', request, reason: null };\n}\n\nexport function acceptanceCriteria(body: string): string[] {\n return journalSection(body, ['acceptance criteria'])\n .map(\n (line) =>\n line\n .trimStart()\n .match(/^[-*+]\\s*\\[[ xX]\\][ \\t](.*)$/u)?.[1]\n ?.trim() ?? '',\n )\n .filter(Boolean);\n}\n\nexport function issueFollowUps(body: string): string[] {\n return journalSection(body, ['follow-ups', 'follow ups'])\n .map(\n (line) =>\n line\n .trimStart()\n .match(/^[-*+]\\s*(?:\\[[ xX]\\][ \\t])?(.*)$/u)?.[1]\n ?.trim() ?? '',\n )\n .filter(Boolean);\n}\n\n// Match readiness's ATX heading boundaries without changing its separate contract owner.\nfunction journalSection(body: string, headings: string[]): string[] {\n const heading = (line: string) =>\n line\n .match(/^ {0,3}#{1,6}[ \\t](.*)$/u)?.[1]\n ?.trim()\n .toLowerCase();\n const lines = body.split(/\\r?\\n/u);\n const start = lines.findIndex((line) => headings.includes(heading(line) ?? ''));\n if (start === -1) return [];\n const section: string[] = [];\n for (const line of lines.slice(start + 1)) {\n if (heading(line) !== undefined) break;\n section.push(line);\n }\n return section;\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,SAAS;AAElB,MAAM,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAK;AAC/C,MAAM,UAAU,KAAK,IAAI,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,KAAK,KAAK,GAAG,0CAA0C;AAClH,MAAM,OAAO,EAAE,IAAI,KAAK;AACxB,MAAM,cAAc,EAAE,IAAI,EAAE,UAAU,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU;AACpE,MAAI;AACJ,MAAI;AACF,UAAM,IAAI,IAAI,KAAK;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,QAAM,WAAW,IAAI,SAAS,QAAQ,aAAa,EAAE,EAAE,QAAQ,QAAQ,EAAE;AACzE,SACE,CAAC,IAAI,YACL,CAAC,IAAI,YACL,KAAK,QAAQ,MAAM,KACnB,SAAS,SAAS,GAAG,KACrB,aAAa,eACb,CAAC,SAAS,SAAS,YAAY,KAC/B,CAAC,SAAS,SAAS,QAAQ;AAE/B,GAAG,6FAA6F;AAChG,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EACrC,UAAU;AAAA,IACR,GAAG,OAAO,QAAQ,MAAM,EACrB,OAAO,CAAC,CAAC,EAAE,MAAM,MAAM,CAAC,OAAO,WAAW,CAAC,EAC3C,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG;AAAA,IACrB;AAAA,EACF;AAAA,EACA,OAAO,gBAAgB,QAAQ,IAAI,CAAC,aAAa;AAAA,IAC/C,YAAY,EAAE,MAAM,EAAE,OAAO,QAAQ,MAAM,KAAK,MAAM,EAAE;AAAA,IACxD,UAAU,OAAO,QAAQ,QAAQ,KAAkC,EAChE,OAAO,CAAC,CAAC,KAAK,MAAM,MAAM,EAAE,OAAO,WAAW,QAAQ,UAAU,CAAC,OAAO,WAAW,CAAC,EACpF,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG;AAAA,EACvB,EAAE;AACJ;AACO,SAAS,qBAAqB,OAA0C;AAC7E,QAAM,UAAU,gBAAgB,QAAQ,KAAK,CAAC,WAAW,OAAO,MAAM,KAAK,UAAU,MAAM,IAAI;AAC/F,QAAM,QAAQ,SAAS,SAAS,EAAE,GAAG,QAAQ,MAAM,EAAE,OAAO,EAAE;AAC9D,SAAO,OAAO,QAAQ,KAAkC,EACrD,OAAO,CAAC,CAAC,KAAK,MAAM,MAAM,CAAC,OAAO,WAAW,KAAK,MAAM,GAAG,MAAM,MAAS,EAC1E,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG;AACvB;
|
|
4
|
+
"sourcesContent": ["import { isIP } from 'node:net';\nimport { z } from 'zod';\n\nconst Text = z.string().trim().min(1).max(10000);\nconst Summary = Text.max(500).refine((value) => !/[\\r\\n]/u.test(value), 'Summary must be one plain-language line.');\nconst Date = z.iso.date();\nconst EvidenceUrl = z.url({ protocol: /^https$/u }).refine((value) => {\n let url: URL;\n try {\n url = new URL(value);\n } catch {\n return false;\n }\n const hostname = url.hostname.replace(/^\\[|\\]$/gu, '').replace(/\\.$/u, '');\n return (\n !url.username &&\n !url.password &&\n isIP(hostname) === 0 &&\n hostname.includes('.') &&\n hostname !== 'localhost' &&\n !hostname.endsWith('.localhost') &&\n !hostname.endsWith('.local')\n );\n}, 'Evidence must be an HTTPS link with a public DNS hostname and no credentials or IP literal.');\nconst Evidence = EvidenceUrl.describe(\n 'HTTPS link with a public DNS hostname, such as a GitHub URL; no IP, localhost or credentials.',\n);\nconst Common = {\n issueNumber: z.number().int().positive(),\n summary: Summary,\n status: Text,\n nextStep: Text,\n nextDate: Date.nullable(),\n keyNumbers: z.array(Text),\n evidence: z.array(Evidence),\n details: Text.optional(),\n lengthCap: z.number().int().min(600).max(10000).optional(),\n};\n\nconst JournalVariants = z.discriminatedUnion('kind', [\n z.strictObject({ ...Common, kind: z.literal('start'), outcome: Text }),\n z.strictObject({\n ...Common,\n kind: z.literal('progress'),\n evidence: z.array(Evidence).min(1),\n done: z.array(Text).min(1),\n decisionNeeded: Text,\n }),\n z.strictObject({ ...Common, kind: z.literal('decision'), decision: Text, rationale: Text }),\n z.strictObject({ ...Common, kind: z.literal('blocker'), blocker: Text, resolution: Text }),\n z.strictObject({\n ...Common,\n kind: z.literal('closeout'),\n acceptance: z.array(z.strictObject({ criterion: Text, evidence: Evidence })).min(1),\n followUps: z.array(Text),\n }),\n]);\nexport type JournalInput = z.infer<typeof JournalVariants>;\n/** Publish the same kind requirements enforced by the canonical variant schemas. */\nexport const JOURNAL_SCHEMA_METADATA = {\n required: [\n ...Object.entries(Common)\n .filter(([, schema]) => !schema.isOptional())\n .map(([key]) => key),\n 'kind',\n ],\n anyOf: JournalVariants.options.map((variant) => ({\n properties: { kind: { const: variant.shape.kind.value } },\n required: Object.entries(variant.shape as Record<string, z.ZodType>)\n .filter(([key, schema]) => !(key in Common) && key !== 'kind' && !schema.isOptional())\n .map(([key]) => key),\n })),\n};\nexport function missingJournalFields(input: Record<string, unknown>): string[] {\n const variant = JournalVariants.options.find((option) => option.shape.kind.value === input.kind);\n const shape = variant?.shape ?? { ...Common, kind: z.string() };\n return Object.entries(shape as Record<string, z.ZodType>)\n .filter(([key, schema]) => !schema.isOptional() && input[key] === undefined)\n .map(([key]) => key);\n}\n\nconst onlyFor = (kind: string, what = 'non-empty text') =>\n `Required ${what} when kind is ${kind}; omit for every other kind.`;\n\n// MCP requires an object schema; the same variant validator enforces kind-specific fields.\nexport const JournalInputSchema = z\n .strictObject({\n ...Common,\n kind: z\n .enum(['start', 'progress', 'decision', 'blocker', 'closeout'])\n .describe(\n 'Select a journal kind and provide its required fields: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps.',\n ),\n outcome: Text.optional().describe(onlyFor('start')),\n done: z.array(Text).min(1).optional().describe(onlyFor('progress', 'non-empty list')),\n decisionNeeded: Text.optional().describe(onlyFor('progress')),\n decision: Text.optional().describe(onlyFor('decision')),\n rationale: Text.optional().describe(onlyFor('decision')),\n blocker: Text.optional().describe(onlyFor('blocker')),\n resolution: Text.optional().describe(onlyFor('blocker')),\n acceptance: z\n .array(\n z.strictObject(\n { criterion: Text, evidence: Evidence },\n { error: 'Invalid acceptance entry. Provide only criterion and evidence.' },\n ),\n )\n .min(1)\n .optional()\n .describe(onlyFor('closeout', 'non-empty list of criterion and evidence')),\n followUps: z.array(Text).optional().describe(onlyFor('closeout', 'list, empty when none')),\n })\n .superRefine((input, ctx) => {\n const parsed = JournalVariants.safeParse(input);\n if (!parsed.success)\n for (const issue of parsed.error.issues)\n ctx.addIssue({ code: 'custom', path: issue.path, message: issue.message });\n });\n\nexport function renderJournal(raw: JournalInput, marker?: string): string {\n const input = JournalVariants.parse(raw);\n const plainPreview = (value: string): string => {\n const plain = value\n .replace(/!?\\[([^\\]]+)\\]\\([^)]*\\)/gu, '$1')\n .replace(/^\\s{0,3}(?:#{1,6}\\s+|>\\s?|[-+*]\\s+|\\d+[.)]\\s+)/gmu, '')\n .replace(/[*_~`<>[\\]\\\\]/gu, '')\n .replace(/\\s+/gu, ' ')\n .trim();\n const preview = plain.slice(0, 32);\n const last = preview.charCodeAt(preview.length - 1);\n return last >= 0xd800 && last <= 0xdbff ? preview.slice(0, -1) : preview;\n };\n const field = (label: string, value: string): string =>\n `**${label}:**${/\\n|^(?:[-*+]\\s|\\d+[.)]\\s)/u.test(value) ? '\\n' : ' '}${value}`;\n const list = (values: string[]): string => values.map((value) => '- ' + value.replace(/\\n/gu, '\\n ')).join('\\n');\n const sections = [`**Kind:** ${input.kind}. **Status:** ${input.status}`];\n switch (input.kind) {\n case 'start':\n sections.push(field('Outcome', input.outcome));\n break;\n case 'progress':\n sections.push(`**Done since last:**\\n${list(input.done)}`, field('Decision needed', input.decisionNeeded));\n break;\n case 'decision':\n sections.push(field('Decision', input.decision), field('Rationale', input.rationale));\n break;\n case 'blocker':\n sections.push(field('Blocker', input.blocker), field('Resolution needed', input.resolution));\n break;\n case 'closeout':\n sections.push(\n `**Acceptance evidence:**\\n${input.acceptance.map((item) => `- ${item.criterion} \u2014 ${item.evidence}`).join('\\n')}`,\n `**Follow-ups:** ${input.followUps.length ? input.followUps.join('; ') : 'None.'}`,\n );\n break;\n }\n sections.push(\n `**Key numbers:** ${input.keyNumbers.length ? input.keyNumbers.join('; ') : 'None reported.'}`,\n `**Next:** ${input.nextStep} (${input.nextDate ?? 'date not scheduled'}).`,\n `**Evidence:** ${input.evidence.length ? input.evidence.join(' \u00B7 ') : 'None yet.'}`,\n );\n if (input.details) sections.push(input.details);\n let body = `Status: ${plainPreview(input.status)}. Next: ${plainPreview(input.nextStep)}.\\n\\n${input.summary}`;\n let overflow = '';\n for (const section of sections) {\n if (overflow || body.length + section.length + 2 > (input.lengthCap ?? 1800)) overflow += `\\n\\n${section}`;\n else body += `\\n\\n${section}`;\n }\n if (overflow) body += `\\n\\n<details>\\n<summary>Additional journal detail</summary>${overflow}\\n\\n</details>`;\n return marker === undefined ? body : `${body}\\n\\n${marker}`;\n}\n\nexport function acceptanceCriteria(body: string): string[] {\n return journalSection(body, ['acceptance criteria'])\n .map(\n (line) =>\n line\n .trimStart()\n .match(/^[-*+]\\s*\\[[ xX]\\][ \\t](.*)$/u)?.[1]\n ?.trim() ?? '',\n )\n .filter(Boolean);\n}\n\n// Match readiness's ATX heading boundaries without changing its separate contract owner.\nfunction journalSection(body: string, headings: string[]): string[] {\n const heading = (line: string) =>\n line\n .match(/^ {0,3}#{1,6}[ \\t](.*)$/u)?.[1]\n ?.trim()\n .toLowerCase();\n const lines = body.split(/\\r?\\n/u);\n const start = lines.findIndex((line) => headings.includes(heading(line) ?? ''));\n if (start === -1) return [];\n const section: string[] = [];\n for (const line of lines.slice(start + 1)) {\n if (heading(line) !== undefined) break;\n section.push(line);\n }\n return section;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,SAAS;AAElB,MAAM,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAK;AAC/C,MAAM,UAAU,KAAK,IAAI,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,KAAK,KAAK,GAAG,0CAA0C;AAClH,MAAM,OAAO,EAAE,IAAI,KAAK;AACxB,MAAM,cAAc,EAAE,IAAI,EAAE,UAAU,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU;AACpE,MAAI;AACJ,MAAI;AACF,UAAM,IAAI,IAAI,KAAK;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,QAAM,WAAW,IAAI,SAAS,QAAQ,aAAa,EAAE,EAAE,QAAQ,QAAQ,EAAE;AACzE,SACE,CAAC,IAAI,YACL,CAAC,IAAI,YACL,KAAK,QAAQ,MAAM,KACnB,SAAS,SAAS,GAAG,KACrB,aAAa,eACb,CAAC,SAAS,SAAS,YAAY,KAC/B,CAAC,SAAS,SAAS,QAAQ;AAE/B,GAAG,6FAA6F;AAChG,MAAM,WAAW,YAAY;AAAA,EAC3B;AACF;AACA,MAAM,SAAS;AAAA,EACb,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACvC,SAAS;A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M,QAAQ,CAAC;AAAA;AAAA,EAAQ,MAAM,OAAO;AAC5G,MAAI,WAAW;AACf,aAAW,WAAW,UAAU;AAC9B,QAAI,YAAY,KAAK,SAAS,QAAQ,SAAS,KAAK,MAAM,aAAa,MAAO,aAAY;AAAA;AAAA,EAAO,OAAO;AAAA,QACnG,SAAQ;AAAA;AAAA,EAAO,OAAO;AAAA,EAC7B;AACA,MAAI,SAAU,SAAQ;AAAA;AAAA;AAAA,8CAA8D,QAAQ;AAAA;AAAA;AAC5F,SAAO,WAAW,SAAY,OAAO,GAAG,IAAI;AAAA;AAAA,EAAO,MAAM;AAC3D;AAEO,SAAS,mBAAmB,MAAwB;AACzD,SAAO,eAAe,MAAM,CAAC,qBAAqB,CAAC,EAChD;AAAA,IACC,CAAC,SACC,KACG,UAAU,EACV,MAAM,+BAA+B,IAAI,CAAC,GACzC,KAAK,KAAK;AAAA,EAClB,EACC,OAAO,OAAO;AACnB;AAGA,SAAS,eAAe,MAAc,UAA8B;AAClE,QAAM,UAAU,CAAC,SACf,KACG,MAAM,0BAA0B,IAAI,CAAC,GACpC,KAAK,EACN,YAAY;AACjB,QAAM,QAAQ,KAAK,MAAM,QAAQ;AACjC,QAAM,QAAQ,MAAM,UAAU,CAAC,SAAS,SAAS,SAAS,QAAQ,IAAI,KAAK,EAAE,CAAC;AAC9E,MAAI,UAAU,GAAI,QAAO,CAAC;AAC1B,QAAM,UAAoB,CAAC;AAC3B,aAAW,QAAQ,MAAM,MAAM,QAAQ,CAAC,GAAG;AACzC,QAAI,QAAQ,IAAI,MAAM,OAAW;AACjC,YAAQ,KAAK,IAAI;AAAA,EACnB;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,8 +7,7 @@ import { createAiDeliveryMcpServer } from "./mcp/index.js";
|
|
|
7
7
|
import { inertTarget } from "./fixtures/inertTarget.js";
|
|
8
8
|
import { getAiDeliveryMcpTool } from "./mcp/tools.js";
|
|
9
9
|
import * as issue from "./issue.js";
|
|
10
|
-
import
|
|
11
|
-
import { JournalInputSchema, renderJournal, acceptanceCriteria, issueFollowUps } from "./issueJournal.js";
|
|
10
|
+
import { JournalInputSchema, renderJournal, acceptanceCriteria } from "./issueJournal.js";
|
|
12
11
|
import { executeTool } from "./dispatch.js";
|
|
13
12
|
import * as configuration from "./config/deliveryConfig.js";
|
|
14
13
|
import * as githubClients from "./github/client.js";
|
|
@@ -16,104 +15,6 @@ import { execFileSync } from "node:child_process";
|
|
|
16
15
|
import { mkdtempSync, rmSync } from "node:fs";
|
|
17
16
|
import { tmpdir } from "node:os";
|
|
18
17
|
import { join } from "node:path";
|
|
19
|
-
test("latest rendered progress attention is unambiguous", () => {
|
|
20
|
-
const parse = Reflect.get(journalReaders, "parseJournalAttention");
|
|
21
|
-
assert.equal(typeof parse, "function", "rendered journal attention reader is available");
|
|
22
|
-
const progress = (decisionNeeded, extra = {}) => renderJournal({
|
|
23
|
-
issueNumber: 17,
|
|
24
|
-
kind: "progress",
|
|
25
|
-
summary: "Current work.",
|
|
26
|
-
status: "In Progress",
|
|
27
|
-
done: ["Prepared the design"],
|
|
28
|
-
decisionNeeded,
|
|
29
|
-
nextStep: "Implement",
|
|
30
|
-
nextDate: null,
|
|
31
|
-
keyNumbers: [],
|
|
32
|
-
evidence: ["https://github.com/example/widget/issues/17"],
|
|
33
|
-
...extra
|
|
34
|
-
});
|
|
35
|
-
for (const sentinel of ["None", "None.", "N/A", "Not needed", " nOnE. "])
|
|
36
|
-
assert.equal(parse(progress(sentinel)).state, "clear");
|
|
37
|
-
for (const request of [
|
|
38
|
-
"Approve design",
|
|
39
|
-
"Approve design\nThen select an approach",
|
|
40
|
-
"- Approve design\n- Select approach"
|
|
41
|
-
])
|
|
42
|
-
assert.deepEqual(parse(progress(request)), { kind: "progress", state: "pending", request, reason: null });
|
|
43
|
-
assert.equal(parse(progress("Approve design", { done: ["x".repeat(600)], lengthCap: 600 })).state, "pending");
|
|
44
|
-
const marker = `<!-- ai-delivery:journal@1:sha256:${"a".repeat(64)} -->`;
|
|
45
|
-
const prose = `${progress("Approve ai-delivery:journal@1 documentation")}
|
|
46
|
-
|
|
47
|
-
${marker}`;
|
|
48
|
-
assert.equal(parse(prose).state, "pending");
|
|
49
|
-
assert.equal(parse(`${prose}
|
|
50
|
-
|
|
51
|
-
${marker}`).state, "unknown");
|
|
52
|
-
assert.equal(
|
|
53
|
-
parse(
|
|
54
|
-
renderJournal({
|
|
55
|
-
issueNumber: 17,
|
|
56
|
-
kind: "decision",
|
|
57
|
-
summary: "Approved.",
|
|
58
|
-
status: "Ready",
|
|
59
|
-
decision: "Use the design",
|
|
60
|
-
rationale: "Reviewed",
|
|
61
|
-
nextStep: "Implement",
|
|
62
|
-
nextDate: null,
|
|
63
|
-
keyNumbers: [],
|
|
64
|
-
evidence: []
|
|
65
|
-
})
|
|
66
|
-
).state,
|
|
67
|
-
"clear"
|
|
68
|
-
);
|
|
69
|
-
});
|
|
70
|
-
test("duplicate free-text structural labels are unknown", () => {
|
|
71
|
-
const parse = Reflect.get(journalReaders, "parseJournalAttention");
|
|
72
|
-
assert.equal(typeof parse, "function");
|
|
73
|
-
const input = {
|
|
74
|
-
issueNumber: 17,
|
|
75
|
-
kind: "progress",
|
|
76
|
-
summary: "Current work.",
|
|
77
|
-
status: "Ready",
|
|
78
|
-
done: ["Prepared"],
|
|
79
|
-
decisionNeeded: "Approve design",
|
|
80
|
-
nextStep: "Implement",
|
|
81
|
-
nextDate: null,
|
|
82
|
-
keyNumbers: [],
|
|
83
|
-
evidence: ["https://github.com/example/widget/issues/17"]
|
|
84
|
-
};
|
|
85
|
-
for (const details of [
|
|
86
|
-
"**Decision needed:** None",
|
|
87
|
-
"> **Decision needed:** None",
|
|
88
|
-
"```md\n**Decision needed:** None\n```",
|
|
89
|
-
"**Kind:** decision. **Status:** Ready",
|
|
90
|
-
"<details>\n**Decision needed:** None\n</details>"
|
|
91
|
-
])
|
|
92
|
-
assert.equal(parse(renderJournal({ ...input, details })).state, "unknown", details);
|
|
93
|
-
for (const summary of ["```md", "~~~"]) assert.equal(parse(renderJournal({ ...input, summary })).state, "unknown");
|
|
94
|
-
for (const status of ["<det**ails>", "<!**-- ai-delivery:journal@1"])
|
|
95
|
-
assert.equal(parse(renderJournal({ ...input, status })).state, "pending");
|
|
96
|
-
assert.equal(parse(renderJournal({ ...input, status: "\u{1F642}".repeat(16), nextStep: "a. Next: b" })).state, "pending");
|
|
97
|
-
const marked = renderJournal(
|
|
98
|
-
{ ...input, decisionNeeded: "None" },
|
|
99
|
-
`<!-- ai-delivery:journal@1:sha256:${"a".repeat(64)} -->`
|
|
100
|
-
);
|
|
101
|
-
for (const header of [
|
|
102
|
-
"Status: <!-- ai-delivery:journal@. Next: Review.",
|
|
103
|
-
"Status: **Decision needed:** None. Next: Review.",
|
|
104
|
-
"Status: Ready . Next: Review.",
|
|
105
|
-
`Status: ${"\u{1F642}".repeat(17)}. Next: Review.`
|
|
106
|
-
])
|
|
107
|
-
assert.equal(parse(`${header}${marked.slice(marked.indexOf("\n\n"))}`).state, "unknown");
|
|
108
|
-
const legacy = "Status: Ready. Next: Review.\n\n**Kind:** progress. **Status:** Ready\n\n**Done since last:**\n- Prepared\n\n**Decision needed:** Approve design\n\n**Key numbers:** None reported.\n\n**Next:** Review (date not scheduled).\n\n**Evidence:** https://github.com/example/widget/issues/17";
|
|
109
|
-
assert.equal(parse(legacy).state, "pending");
|
|
110
|
-
for (const body of [
|
|
111
|
-
"> **Kind:** progress. **Status:** Ready\n\n**Decision needed:** Approve",
|
|
112
|
-
"```\n**Kind:** progress. **Status:** Ready\n\n**Decision needed:** Approve\n```",
|
|
113
|
-
"**Kind:** progress. **Status:** Ready\n\n**Decision needed:**"
|
|
114
|
-
])
|
|
115
|
-
assert.equal(parse(body).state, "unknown");
|
|
116
|
-
});
|
|
117
18
|
test("decision journal list fields start below their label and preserve nested structure", () => {
|
|
118
19
|
const result = renderJournal({
|
|
119
20
|
issueNumber: 17,
|
|
@@ -197,12 +98,6 @@ ${summary}
|
|
|
197
98
|
`), true);
|
|
198
99
|
assert.match(body, /<details>/u);
|
|
199
100
|
assert.ok(body.endsWith(marker));
|
|
200
|
-
assert.deepEqual(journalReaders.parseJournalAttention(body), {
|
|
201
|
-
kind: input.kind,
|
|
202
|
-
state: "clear",
|
|
203
|
-
request: null,
|
|
204
|
-
reason: null
|
|
205
|
-
});
|
|
206
101
|
}
|
|
207
102
|
}
|
|
208
103
|
for (const input of [
|
|
@@ -433,7 +328,6 @@ test("length cap keeps the summary visible and moves every excess field into col
|
|
|
433
328
|
test("automatic closeout selects acceptance checkboxes and declared follow-ups without swallowing other sections", () => {
|
|
434
329
|
const body = "## Outcome\nShip.\n\n## Acceptance Criteria\n- [ ] Validation works\n- [x] Recovery works\n\n## Follow-ups\n- Track post-release adoption: https://github.com/example/widget/issues/24\n\n## Non-goals\n- [ ] Not an acceptance criterion";
|
|
435
330
|
assert.deepEqual(acceptanceCriteria(body), ["Validation works", "Recovery works"]);
|
|
436
|
-
assert.deepEqual(issueFollowUps(body), ["Track post-release adoption: https://github.com/example/widget/issues/24"]);
|
|
437
331
|
});
|
|
438
332
|
test("closeout accepts every readiness heading level and stops at the next heading", () => {
|
|
439
333
|
for (let level = 1; level <= 6; level += 1) {
|
|
@@ -450,7 +344,6 @@ ${heading} Follow-ups
|
|
|
450
344
|
# Other section
|
|
451
345
|
- Excluded`;
|
|
452
346
|
assert.deepEqual(acceptanceCriteria(body), ["Compact bullet", "Tabbed bullet", "Checked bullet"]);
|
|
453
|
-
assert.deepEqual(issueFollowUps(body), ["Deferred work"]);
|
|
454
347
|
}
|
|
455
348
|
}
|
|
456
349
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/issueJournal.test.ts"],
|
|
4
|
-
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { z } from 'zod';\nimport { test, vi } from 'vitest';\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';\nimport { createAiDeliveryMcpServer } from './mcp/index.js';\nimport { inertTarget } from './fixtures/inertTarget.js';\n\nimport { getAiDeliveryMcpTool } from './mcp/tools.js';\nimport * as issue from './issue.js';\nimport type { DeliveryContext } from './issue.js';\nimport type { JournalInput } from './issueJournal.js';\nimport * as journalReaders from './issueJournal.js';\nimport { JournalInputSchema, renderJournal, acceptanceCriteria, issueFollowUps } from './issueJournal.js';\nimport { executeTool } from './dispatch.js';\nimport * as configuration from './config/deliveryConfig.js';\nimport * as githubClients from './github/client.js';\nimport { execFileSync } from 'node:child_process';\nimport { mkdtempSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\n\ntest('latest rendered progress attention is unambiguous', () => {\n const parse = Reflect.get(journalReaders, 'parseJournalAttention') as\n | ((body: string) => { state: string; request: string | null })\n | undefined;\n assert.equal(typeof parse, 'function', 'rendered journal attention reader is available');\n const progress = (decisionNeeded: string, extra = {}) =>\n renderJournal({\n issueNumber: 17,\n kind: 'progress',\n summary: 'Current work.',\n status: 'In Progress',\n done: ['Prepared the design'],\n decisionNeeded,\n nextStep: 'Implement',\n nextDate: null,\n keyNumbers: [],\n evidence: ['https://github.com/example/widget/issues/17'],\n ...extra,\n });\n for (const sentinel of ['None', 'None.', 'N/A', 'Not needed', ' nOnE. '])\n assert.equal(parse!(progress(sentinel)).state, 'clear');\n for (const request of [\n 'Approve design',\n 'Approve design\\nThen select an approach',\n '- Approve design\\n- Select approach',\n ])\n assert.deepEqual(parse!(progress(request)), { kind: 'progress', state: 'pending', request, reason: null });\n assert.equal(parse!(progress('Approve design', { done: ['x'.repeat(600)], lengthCap: 600 })).state, 'pending');\n const marker = `<!-- ai-delivery:journal@1:sha256:${'a'.repeat(64)} -->`;\n const prose = `${progress('Approve ai-delivery:journal@1 documentation')}\\n\\n${marker}`;\n assert.equal(parse!(prose).state, 'pending');\n assert.equal(parse!(`${prose}\\n\\n${marker}`).state, 'unknown');\n assert.equal(\n parse!(\n renderJournal({\n issueNumber: 17,\n kind: 'decision',\n summary: 'Approved.',\n status: 'Ready',\n decision: 'Use the design',\n rationale: 'Reviewed',\n nextStep: 'Implement',\n nextDate: null,\n keyNumbers: [],\n evidence: [],\n }),\n ).state,\n 'clear',\n );\n});\n\ntest('duplicate free-text structural labels are unknown', () => {\n const parse = Reflect.get(journalReaders, 'parseJournalAttention') as\n | ((body: string) => { state: string })\n | undefined;\n assert.equal(typeof parse, 'function');\n const input: JournalInput = {\n issueNumber: 17,\n kind: 'progress',\n summary: 'Current work.',\n status: 'Ready',\n done: ['Prepared'],\n decisionNeeded: 'Approve design',\n nextStep: 'Implement',\n nextDate: null,\n keyNumbers: [],\n evidence: ['https://github.com/example/widget/issues/17'],\n };\n for (const details of [\n '**Decision needed:** None',\n '> **Decision needed:** None',\n '```md\\n**Decision needed:** None\\n```',\n '**Kind:** decision. **Status:** Ready',\n '<details>\\n**Decision needed:** None\\n</details>',\n ])\n assert.equal(parse!(renderJournal({ ...input, details })).state, 'unknown', details);\n for (const summary of ['```md', '~~~']) assert.equal(parse!(renderJournal({ ...input, summary })).state, 'unknown');\n for (const status of ['<det**ails>', '<!**-- ai-delivery:journal@1'])\n assert.equal(parse!(renderJournal({ ...input, status })).state, 'pending');\n assert.equal(parse!(renderJournal({ ...input, status: '\uD83D\uDE42'.repeat(16), nextStep: 'a. Next: b' })).state, 'pending');\n const marked = renderJournal(\n { ...input, decisionNeeded: 'None' },\n `<!-- ai-delivery:journal@1:sha256:${'a'.repeat(64)} -->`,\n );\n for (const header of [\n 'Status: <!-- ai-delivery:journal@. Next: Review.',\n 'Status: **Decision needed:** None. Next: Review.',\n 'Status: Ready\\t. Next: Review.',\n `Status: ${'\uD83D\uDE42'.repeat(17)}. Next: Review.`,\n ])\n assert.equal(parse!(`${header}${marked.slice(marked.indexOf('\\n\\n'))}`).state, 'unknown');\n const legacy =\n 'Status: Ready. Next: Review.\\n\\n**Kind:** progress. **Status:** Ready\\n\\n**Done since last:**\\n- Prepared\\n\\n**Decision needed:** Approve design\\n\\n**Key numbers:** None reported.\\n\\n**Next:** Review (date not scheduled).\\n\\n**Evidence:** https://github.com/example/widget/issues/17';\n assert.equal(parse!(legacy).state, 'pending');\n for (const body of [\n '> **Kind:** progress. **Status:** Ready\\n\\n**Decision needed:** Approve',\n '```\\n**Kind:** progress. **Status:** Ready\\n\\n**Decision needed:** Approve\\n```',\n '**Kind:** progress. **Status:** Ready\\n\\n**Decision needed:**',\n ])\n assert.equal(parse!(body).state, 'unknown');\n});\n\ntest('decision journal list fields start below their label and preserve nested structure', () => {\n const result = renderJournal({\n issueNumber: 17,\n kind: 'decision',\n summary: 'A decision was made.',\n status: 'Ready',\n decision: '- First\\n - Nested\\n- Second',\n rationale: 'The existing owner is sufficient.',\n nextStep: 'Run checks',\n nextDate: null,\n keyNumbers: [],\n evidence: [],\n });\n assert.equal(\n result,\n 'Status: Ready. Next: Run checks.\\n\\nA decision was made.\\n\\n**Kind:** decision. **Status:** Ready\\n\\n**Decision:**\\n- First\\n - Nested\\n- Second\\n\\n**Rationale:** The existing owner is sufficient.\\n\\n**Key numbers:** None reported.\\n\\n**Next:** Run checks (date not scheduled).\\n\\n**Evidence:** None yet.',\n );\n});\n\ntest('published comment schema lists required fields for every journal kind', () => {\n const schema = z.toJSONSchema(getAiDeliveryMcpTool('issue_comment')!.inputSchema);\n assert.deepEqual(schema.anyOf, [\n { properties: { kind: { const: 'start' } }, required: ['outcome'] },\n { properties: { kind: { const: 'progress' } }, required: ['done', 'decisionNeeded'] },\n { properties: { kind: { const: 'decision' } }, required: ['decision', 'rationale'] },\n { properties: { kind: { const: 'blocker' } }, required: ['blocker', 'resolution'] },\n { properties: { kind: { const: 'closeout' } }, required: ['acceptance', 'followUps'] },\n ]);\n});\n\ntest('all typed journals validate and lead with plain status and next-step previews', () => {\n const tool = getAiDeliveryMcpTool('issue_comment');\n assert.ok(tool, 'issue_comment must be exposed');\n const common = {\n issueNumber: 17,\n summary: 'Parser work is underway.',\n status: 'In progress',\n nextStep: 'Run checks',\n nextDate: '2026-10-09',\n keyNumbers: ['3 checks'],\n evidence: ['https://github.com/example/widget/pull/23'],\n };\n const valid: JournalInput[] = [\n { ...common, kind: 'start', outcome: 'Deliver a safe parser' },\n { ...common, kind: 'progress', done: ['Added validation'], decisionNeeded: 'None' },\n { ...common, kind: 'decision', decision: 'Use the existing parser', rationale: 'Preserves the contract' },\n { ...common, kind: 'blocker', blocker: 'Review pending', resolution: 'Independent acceptance' },\n {\n ...common,\n kind: 'closeout',\n acceptance: [{ criterion: 'Reject malformed input', evidence: 'https://github.com/example/widget/pull/23' }],\n followUps: [],\n },\n ];\n for (const input of valid) {\n for (const repo of [undefined, 'example/widget']) {\n for (const nextDate of [null, '2026-10-09', '2028-02-29']) {\n const selected = { ...input, nextDate, ...(repo === undefined ? {} : { repo }) };\n const parsed: ReturnType<typeof tool.inputSchema.safeParse> = tool.inputSchema.safeParse(selected);\n assert.equal(parsed.success, true, JSON.stringify(selected));\n if (parsed.success) assert.deepEqual(parsed.data, selected);\n }\n }\n assert.equal(JournalInputSchema.safeParse(input).success, true);\n assert.equal(JournalInputSchema.safeParse({ ...input, repo: 'example/widget' }).success, false);\n for (const summary of [input.summary, 'S'.repeat(500)]) {\n const marker = `<!-- ai-delivery:journal@1:sha256:${'a'.repeat(64)} -->`;\n const body = renderJournal(\n {\n ...input,\n summary,\n status: '**In progress**',\n nextStep: 'Run\\nchecks',\n lengthCap: 600,\n details: 'D'.repeat(900),\n },\n marker,\n );\n assert.equal(body.startsWith(`Status: In progress. Next: Run checks.\\n\\n${summary}\\n\\n`), true);\n assert.match(body, /<details>/u);\n assert.ok(body.endsWith(marker));\n assert.deepEqual(journalReaders.parseJournalAttention(body), {\n kind: input.kind,\n state: 'clear',\n request: null,\n reason: null,\n });\n }\n }\n for (const input of [\n { ...common, kind: 'progress' },\n { ...common, kind: 'start', outcome: '' },\n { ...common, kind: 'closeout', acceptance: [], followUps: [] },\n {\n ...common,\n kind: 'decision',\n decision: 'Use parser',\n rationale: 'Works',\n evidence: ['/Users/operator/checks.log'],\n },\n { ...common, kind: 'start', outcome: 'Deliver', nextDate: 'tomorrow' },\n { ...common, kind: 'start', outcome: 'Deliver', done: ['Wrong variant'] },\n { ...common, kind: 'progress', done: ['Deliver'], decisionNeeded: 'None', rationale: 'Wrong variant' },\n { ...common, kind: 'decision', decision: 'Use parser', rationale: 'Works', blocker: 'Wrong variant' },\n { ...common, kind: 'blocker', blocker: 'Review', resolution: 'Accept', outcome: 'Wrong variant' },\n { ...valid[4], done: ['Wrong variant'] },\n { ...valid[0], unknown: true },\n { ...valid[0], kind: 'unsupported' },\n { ...valid[0], nextDate: '2026-02-30' },\n { ...valid[0], nextDate: 20261009 },\n { ...valid[0], keyNumbers: '3 checks' },\n { ...valid[0], issueNumber: '17' },\n { ...valid[4], acceptance: [{ criterion: 'Deliver', evidence: common.evidence[0], unknown: true }] },\n ])\n for (const repo of [undefined, 'example/widget'])\n assert.equal(tool.inputSchema.safeParse({ ...input, ...(repo === undefined ? {} : { repo }) }).success, false);\n for (const repo of [\n '',\n 'example',\n 'example/widget/extra',\n 'https://github.com/example/widget',\n 'example/\\nwidget',\n 17,\n null,\n [],\n ])\n assert.equal(tool.inputSchema.safeParse({ ...valid[0], repo }).success, false);\n});\n\ntest('journal dispatch refuses invalid fields and repository conflicts before configuration or authentication', async () => {\n const settings = vi.spyOn(configuration, 'loadDeliverySettings').mockImplementation(async () => {\n throw new Error('Configuration must not load for an invalid journal');\n });\n const clients = vi.spyOn(githubClients, 'createDeliveryGitHubClients');\n const valid = {\n repo: 'example/widget',\n issueNumber: 17,\n kind: 'progress',\n summary: 'Parser work is underway.',\n status: 'In progress',\n done: ['Added validation'],\n decisionNeeded: 'None',\n keyNumbers: [],\n evidence: ['https://github.com/example/widget/pull/23'],\n nextStep: 'Run checks',\n nextDate: null,\n };\n try {\n for (const input of [\n { ...valid, kind: 'unsupported' },\n { ...valid, outcome: 'Wrong variant' },\n { ...valid, unknown: true },\n { ...valid, done: [] },\n { ...valid, evidence: [] },\n { ...valid, repo: 'invalid' },\n { ...valid, repo: 17 },\n { ...valid, nextDate: '2026-02-30' },\n ])\n await assert.rejects(executeTool('issue_comment', input, { repoRoot: '/non-git-fixture' }));\n await assert.rejects(\n executeTool('issue_comment', valid, { repoRoot: '/non-git-fixture', repo: 'example/other' }),\n /selectors disagree/u,\n );\n assert.equal(settings.mock.calls.length, 0);\n assert.equal(clients.mock.calls.length, 0, 'no authenticated client or comment writer is reached');\n } finally {\n settings.mockRestore();\n clients.mockRestore();\n }\n});\n\ntest('canonical comment writes read back and recover a lost response without duplicates', async () => {\n const comment = (\n issue as unknown as {\n commentIssue?: (\n context: DeliveryContext,\n input: JournalInput | { issueNumber: number; body: string },\n lifecycleKey?: string,\n ) => Promise<{ commentId: number; url: string; body: string; reused: boolean }>;\n }\n ).commentIssue;\n assert.ok(comment, 'canonical comment writer must exist');\n const agent = await import('./agent.js');\n assert.equal(agent.commentIssue, comment);\n assert.equal(agent.ISSUE_COMMENT_BODY_LIMIT, 65536);\n const root = mkdtempSync(join(tmpdir(), 'ai-delivery-journal-'));\n execFileSync('git', ['init', '-q', '-b', 'main'], { cwd: root });\n const stored: { id: number; body: string; html_url: string; user: { login: string }; issue_url: string }[] = [];\n let loseResponse = true;\n let corruptReadback = false;\n let authorCalls = 0;\n const context = {\n root,\n repo: { owner: 'example', repo: 'widget' },\n clients: {\n role: 'author',\n authenticatedAuthor: async () => {\n authorCalls += 1;\n return { actorLogin: 'operator', credentialIdentity: 'user:1' };\n },\n rest: {\n issues: {\n get: async () => ({ data: { number: 17, state: 'open' } }),\n listComments: async () => ({ data: stored }),\n createComment: async (input: { body: string }) => {\n const id = 91 + stored.length;\n const data = {\n id,\n body: input.body,\n html_url: `https://github.com/example/widget/issues/17#issuecomment-${String(id)}`,\n issue_url: 'https://api.github.com/repos/example/widget/issues/17',\n user: { login: 'operator' },\n };\n stored.push(data);\n if (loseResponse) {\n loseResponse = false;\n throw new Error('response lost');\n }\n return { data };\n },\n getComment: async (input: { comment_id: number }) => ({\n data: {\n ...stored.find((item) => item.id === input.comment_id),\n ...(corruptReadback ? { body: 'changed' } : {}),\n },\n }),\n },\n },\n },\n } as unknown as DeliveryContext;\n const input: JournalInput = {\n issueNumber: 17,\n kind: 'start',\n summary: 'Implementation started.',\n status: 'In progress',\n outcome: 'Deliver validation',\n keyNumbers: [],\n evidence: [],\n nextStep: 'Run checks',\n nextDate: '2026-10-09',\n };\n try {\n await assert.rejects(comment(context, input), /response lost/u);\n const recovered = await comment(context, input);\n assert.equal(recovered.commentId, 91);\n assert.equal(recovered.reused, true);\n assert.equal(stored.length, 1);\n assert.match(recovered.body, /^Status: In progress\\. Next: Run checks\\.\\n\\nImplementation started\\./u);\n corruptReadback = true;\n await assert.rejects(comment(context, input), /readback/u);\n corruptReadback = false;\n\n stored.push({ ...stored[0]!, id: 99, html_url: 'https://github.com/example/widget/issues/17#issuecomment-99' });\n await assert.rejects(comment(context, input), /duplicate authored retry matches/u);\n assert.equal(stored.length, 2, 'ambiguous retries must not write another comment');\n stored.pop();\n\n const rawBody = `\\r\\n <details>\\n<summary>Prior content</summary>\\n<pre>${'\uD83D\uDE42 & prior title/body\\r\\n'.repeat(600)}</pre>\\n</details> \\t\\n`;\n assert.ok(rawBody.length > 10000);\n loseResponse = true;\n await assert.rejects(comment(context, { issueNumber: 17, body: rawBody }), /response lost/u);\n const rawRecovered = await comment(context, { issueNumber: 17, body: rawBody });\n assert.equal(rawRecovered.body, rawBody, 'raw history content must remain exact and unwrapped');\n assert.equal(rawRecovered.commentId, 92);\n assert.equal(rawRecovered.reused, true);\n assert.equal(stored.length, 2);\n assert.equal(stored[1]!.body, rawBody, 'no journal marker or unrequested content is appended');\n\n const maximumBody = '\uD83D\uDE42'.repeat(32768);\n assert.equal(maximumBody.length, 65536);\n assert.equal((await comment(context, { issueNumber: 17, body: maximumBody })).body, maximumBody);\n assert.equal(stored.length, 3);\n const beforeInvalid = authorCalls;\n for (const body of ['', ' \\r\\n\\t ', 'x'.repeat(65537), `${maximumBody}\uD83D\uDE42`])\n await assert.rejects(comment(context, { issueNumber: 17, body }), /comment body/u);\n await assert.rejects(\n comment(context, {\n ...input,\n status: 'x'.repeat(9000),\n outcome: 'x'.repeat(9000),\n nextStep: 'x'.repeat(9000),\n details: 'x'.repeat(9000),\n keyNumbers: Array.from({ length: 4 }, () => 'x'.repeat(9000)),\n }),\n /comment body/u,\n );\n await assert.rejects(\n comment(context, { issueNumber: 17, body: rawBody }, 'start:legacy'),\n /lifecycle journal key/u,\n );\n assert.equal(authorCalls, beforeInvalid, 'unsupported payloads fail before authentication or mutation');\n assert.equal(stored.length, 3);\n corruptReadback = true;\n await assert.rejects(comment(context, { issueNumber: 17, body: rawBody }), /readback/u);\n } finally {\n rmSync(root, { recursive: true, force: true });\n }\n});\n\ntest('length cap keeps the summary visible and moves every excess field into collapsed detail', () => {\n const summary = 'S'.repeat(500);\n const rendered = renderJournal({\n issueNumber: 17,\n kind: 'progress',\n summary,\n status: 'In progress '.repeat(500),\n done: ['A'.repeat(900)],\n decisionNeeded: 'None',\n keyNumbers: ['7 tests'],\n evidence: ['https://github.com/example/widget/pull/23'],\n nextStep: 'Review '.repeat(1000),\n nextDate: '2026-10-09',\n lengthCap: 600,\n });\n const first = rendered.split('\\n')[0]!;\n assert.ok(first.startsWith('Status: In progress'));\n assert.ok(first.length <= 100 && rendered.split('\\n')[2] === summary);\n assert.ok(rendered.indexOf('Next: Review') < rendered.indexOf(summary));\n assert.match(rendered, /<details>/u);\n assert.match(rendered, /A{900}/u);\n assert.match(rendered, /7 tests/u);\n assert.match(rendered, /https:\\/\\/github.com\\/example\\/widget\\/pull\\/23/u);\n});\n\ntest('automatic closeout selects acceptance checkboxes and declared follow-ups without swallowing other sections', () => {\n const body =\n '## Outcome\\nShip.\\n\\n## Acceptance Criteria\\n- [ ] Validation works\\n- [x] Recovery works\\n\\n## Follow-ups\\n- Track post-release adoption: https://github.com/example/widget/issues/24\\n\\n## Non-goals\\n- [ ] Not an acceptance criterion';\n assert.deepEqual(acceptanceCriteria(body), ['Validation works', 'Recovery works']);\n assert.deepEqual(issueFollowUps(body), ['Track post-release adoption: https://github.com/example/widget/issues/24']);\n});\n\ntest('closeout accepts every readiness heading level and stops at the next heading', () => {\n for (let level = 1; level <= 6; level += 1) {\n for (let indent = 0; indent <= 3; indent += 1) {\n const heading = `${' '.repeat(indent)}${'#'.repeat(level)}`;\n const body = `${heading}\\tAcceptance Criteria\\n-[ ] Compact bullet\\n*\\t[X]\\tTabbed bullet\\n+ [x] Checked bullet\\n###### Other section\\n- [ ] Excluded\\n${heading} Follow-ups\\n- [ ] Deferred work\\n# Other section\\n- Excluded`;\n assert.deepEqual(acceptanceCriteria(body), ['Compact bullet', 'Tabbed bullet', 'Checked bullet']);\n assert.deepEqual(issueFollowUps(body), ['Deferred work']);\n }\n }\n});\n\ntest('journal evidence rejects local hosts and IP literals while accepting public DNS names', () => {\n const tool = getAiDeliveryMcpTool('issue_comment')!;\n const input = {\n issueNumber: 17,\n kind: 'start',\n summary: 'Work started.',\n status: 'Started',\n outcome: 'Deliver validation',\n keyNumbers: [],\n nextStep: 'Run checks',\n nextDate: null,\n };\n for (const host of [\n 'localhost',\n 'localhost.',\n 'api.localhost',\n 'runner.local',\n '127.0.0.1',\n '10.1.2.3',\n '172.16.0.1',\n '192.168.1.1',\n '169.254.1.1',\n '[::1]',\n '[fd00::1]',\n '[fe80::1]',\n '8.8.8.8',\n ])\n assert.equal(tool.inputSchema.safeParse({ ...input, evidence: [`https://${host}/evidence`] }).success, false, host);\n for (const host of ['github.com', '10.docs.example.com'])\n assert.equal(tool.inputSchema.safeParse({ ...input, evidence: [`https://${host}/evidence`] }).success, true, host);\n});\n\ntest('registered journal tool returns actionable decision refusals before native writes', async ({ signal }) => {\n const f = inertTarget(signal);\n const server = createAiDeliveryMcpServer({ repoRoot: f.root, signal });\n const client = new Client({ name: 'journal-contract-fixture', version: '1' });\n const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();\n const common = {\n repo: 'example/widget',\n issueNumber: 17,\n summary: 'Parser validation is ready.',\n status: 'In progress',\n nextStep: 'Review the parser',\n nextDate: null,\n keyNumbers: [],\n evidence: ['https://github.com/example/widget/pull/23'],\n };\n const decision = {\n ...common,\n kind: 'decision',\n decision: 'Use the existing parser',\n rationale: 'Preserves compatibility',\n };\n try {\n await server.connect(serverTransport);\n await client.connect(clientTransport);\n // A successful call first proves the synthetic external ports and real dispatch are wired correctly.\n const valid = await client.callTool({ name: 'issue_comment', arguments: decision });\n assert.notEqual(valid.isError, true, JSON.stringify(valid));\n assert.equal(f.comments.length, 1);\n const before = f.calls.length;\n const { rationale: _rationale, ...missingRationale } = decision;\n const refused = await client.callTool({ name: 'issue_comment', arguments: missingRationale });\n assert.equal(refused.isError, true);\n assert.equal(f.comments.length, 1, 'the invalid call makes zero additional native writes');\n assert.equal(f.calls.length, before, 'refusal precedes external authentication and reads');\n const text = JSON.stringify(refused);\n assert.doesNotMatch(text, /-32602|Input validation error/u, 'a normal contract refusal must reach the handler');\n assert.match(text, /rationale/u);\n const missingBoth = await client.callTool({ name: 'issue_comment', arguments: { ...common, kind: 'progress' } });\n assert.equal(missingBoth.isError, true);\n assert.match(JSON.stringify(missingBoth), /Missing required fields: done, decisionNeeded/u);\n const missingCommon = await client.callTool({\n name: 'issue_comment',\n arguments: { repo: 'example/widget', issueNumber: 17, kind: 'decision' },\n });\n assert.equal(missingCommon.isError, true);\n assert.match(\n JSON.stringify(missingCommon),\n /Missing required fields: summary, status, nextStep, nextDate, keyNumbers, evidence, decision, rationale/u,\n );\n assert.doesNotMatch(JSON.stringify(missingCommon), /-32602|Input validation error/u);\n\n const published = (await client.listTools()).tools.find((t) => t.name === 'issue_comment');\n assert.deepEqual(\n published?.inputSchema.anyOf,\n z.toJSONSchema(getAiDeliveryMcpTool('issue_comment')!.inputSchema).anyOf,\n );\n assert.match(text, /[Pp]rovide/u, 'the refusal explains the correction');\n const listed = (await client.listTools()).tools.find((tool) => tool.name === 'issue_comment');\n assert.ok(listed);\n assert.match(listed.description ?? '', /decision: non-empty decision and rationale/u);\n const properties = listed.inputSchema.properties as Record<string, { description?: string }>;\n for (const field of ['decision', 'rationale'])\n assert.match(properties[field]?.description ?? '', /Required non-empty text when kind is decision/u);\n assert.match(properties.kind?.description ?? '', /progress: done, decisionNeeded and non-empty evidence/u);\n assert.equal(listed.inputSchema.additionalProperties, false);\n\n const { decision: _decision, ...missingDecision } = decision;\n for (const invalid of [\n missingDecision,\n { ...missingRationale, decision: 'PRIVATE_INPUT_SENTINEL' },\n { ...decision, rationale: '' },\n { ...decision, rationale: 17 },\n { ...decision, kind: 'PRIVATE_INPUT_SENTINEL' },\n { ...decision, unknown: 'PRIVATE_INPUT_SENTINEL' },\n { ...decision, PRIVATE_INPUT_SENTINEL: 'private value' },\n {\n ...common,\n kind: 'closeout',\n acceptance: [{ criterion: 'Validated', evidence: common.evidence[0], PRIVATE_INPUT_SENTINEL: 'private value' }],\n followUps: [],\n },\n { ...decision, outcome: 'PRIVATE_INPUT_SENTINEL' },\n { ...common, kind: 'start' },\n { ...common, kind: 'progress', done: ['Validated'], decisionNeeded: 'None', evidence: [] },\n { ...common, kind: 'blocker', blocker: 'Review pending' },\n { ...common, kind: 'closeout', acceptance: [], followUps: [] },\n ]) {\n const invalidResult = await client.callTool({ name: 'issue_comment', arguments: invalid });\n assert.equal(invalidResult.isError, true);\n assert.doesNotMatch(JSON.stringify(invalidResult), /PRIVATE_INPUT_SENTINEL/u);\n assert.equal(f.comments.length, 1, 'invalid journals never create a native comment');\n assert.equal(f.calls.length, before, 'invalid journals stop before external ports');\n }\n\n const renderedDecision = f.comments[0]!.body;\n assert.match(\n renderedDecision,\n /^Status: In progress\\. Next: Review the parser\\.\\n\\nParser validation is ready\\.\\n\\n\\*\\*Kind:\\*\\* decision\\. \\*\\*Status:\\*\\* In progress\\n\\n\\*\\*Decision:\\*\\* Use the existing parser\\n\\n\\*\\*Rationale:\\*\\* Preserves compatibility/u,\n );\n assert.match(renderedDecision, /<!-- ai-delivery:journal@1:sha256:[a-f0-9]{64} -->$/u);\n const retry = await client.callTool({ name: 'issue_comment', arguments: { ...decision, verbose: true } });\n assert.notEqual(retry.isError, true);\n const retried = JSON.parse((retry.content as { text: string }[])[0]!.text) as {\n body: string;\n reused: boolean;\n commentId: number;\n url: string;\n };\n assert.equal(retried.reused, true);\n assert.equal(retried.body, renderedDecision);\n assert.equal(retried.commentId, 101);\n assert.equal(retried.url, 'https://github.com/example/widget/issues/17#issuecomment-101');\n assert.equal(f.comments.length, 1);\n for (const [variant, section] of [\n [{ ...common, kind: 'start', outcome: 'Deliver validation' }, '**Outcome:** Deliver validation'],\n [\n { ...common, kind: 'progress', done: ['Validated'], decisionNeeded: 'None' },\n '**Done since last:**\\n- Validated',\n ],\n [\n { ...common, kind: 'blocker', blocker: 'Review pending', resolution: 'Independent acceptance' },\n '**Resolution needed:** Independent acceptance',\n ],\n [\n {\n ...common,\n kind: 'closeout',\n acceptance: [{ criterion: 'Validation works', evidence: common.evidence[0] }],\n followUps: [],\n },\n '**Follow-ups:** None.',\n ],\n ] as const) {\n const accepted = await client.callTool({ name: 'issue_comment', arguments: { ...variant, verbose: true } });\n assert.notEqual(accepted.isError, true, JSON.stringify(accepted));\n const value = JSON.parse((accepted.content as { text: string }[])[0]!.text) as { body: string; reused: boolean };\n assert.equal(value.reused, false);\n assert.ok(value.body.includes(section));\n assert.equal(value.body, f.comments.at(-1)!.body, 'response retains authoritative native readback');\n }\n assert.equal(f.comments.length, 5, 'all five valid journal kinds remain usable');\n } finally {\n await client.close();\n await server.close();\n await f.dispose(undefined);\n }\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,SAAS;AAClB,SAAS,MAAM,UAAU;AACzB,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAClC,SAAS,i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ourcesContent": ["import assert from 'node:assert/strict';\nimport { z } from 'zod';\nimport { test, vi } from 'vitest';\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';\nimport { createAiDeliveryMcpServer } from './mcp/index.js';\nimport { inertTarget } from './fixtures/inertTarget.js';\n\nimport { getAiDeliveryMcpTool } from './mcp/tools.js';\nimport * as issue from './issue.js';\nimport type { DeliveryContext } from './issue.js';\nimport type { JournalInput } from './issueJournal.js';\nimport { JournalInputSchema, renderJournal, acceptanceCriteria } from './issueJournal.js';\nimport { executeTool } from './dispatch.js';\nimport * as configuration from './config/deliveryConfig.js';\nimport * as githubClients from './github/client.js';\nimport { execFileSync } from 'node:child_process';\nimport { mkdtempSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\n\ntest('decision journal list fields start below their label and preserve nested structure', () => {\n const result = renderJournal({\n issueNumber: 17,\n kind: 'decision',\n summary: 'A decision was made.',\n status: 'Ready',\n decision: '- First\\n - Nested\\n- Second',\n rationale: 'The existing owner is sufficient.',\n nextStep: 'Run checks',\n nextDate: null,\n keyNumbers: [],\n evidence: [],\n });\n assert.equal(\n result,\n 'Status: Ready. Next: Run checks.\\n\\nA decision was made.\\n\\n**Kind:** decision. **Status:** Ready\\n\\n**Decision:**\\n- First\\n - Nested\\n- Second\\n\\n**Rationale:** The existing owner is sufficient.\\n\\n**Key numbers:** None reported.\\n\\n**Next:** Run checks (date not scheduled).\\n\\n**Evidence:** None yet.',\n );\n});\n\ntest('published comment schema lists required fields for every journal kind', () => {\n const schema = z.toJSONSchema(getAiDeliveryMcpTool('issue_comment')!.inputSchema);\n assert.deepEqual(schema.anyOf, [\n { properties: { kind: { const: 'start' } }, required: ['outcome'] },\n { properties: { kind: { const: 'progress' } }, required: ['done', 'decisionNeeded'] },\n { properties: { kind: { const: 'decision' } }, required: ['decision', 'rationale'] },\n { properties: { kind: { const: 'blocker' } }, required: ['blocker', 'resolution'] },\n { properties: { kind: { const: 'closeout' } }, required: ['acceptance', 'followUps'] },\n ]);\n});\n\ntest('all typed journals validate and lead with plain status and next-step previews', () => {\n const tool = getAiDeliveryMcpTool('issue_comment');\n assert.ok(tool, 'issue_comment must be exposed');\n const common = {\n issueNumber: 17,\n summary: 'Parser work is underway.',\n status: 'In progress',\n nextStep: 'Run checks',\n nextDate: '2026-10-09',\n keyNumbers: ['3 checks'],\n evidence: ['https://github.com/example/widget/pull/23'],\n };\n const valid: JournalInput[] = [\n { ...common, kind: 'start', outcome: 'Deliver a safe parser' },\n { ...common, kind: 'progress', done: ['Added validation'], decisionNeeded: 'None' },\n { ...common, kind: 'decision', decision: 'Use the existing parser', rationale: 'Preserves the contract' },\n { ...common, kind: 'blocker', blocker: 'Review pending', resolution: 'Independent acceptance' },\n {\n ...common,\n kind: 'closeout',\n acceptance: [{ criterion: 'Reject malformed input', evidence: 'https://github.com/example/widget/pull/23' }],\n followUps: [],\n },\n ];\n for (const input of valid) {\n for (const repo of [undefined, 'example/widget']) {\n for (const nextDate of [null, '2026-10-09', '2028-02-29']) {\n const selected = { ...input, nextDate, ...(repo === undefined ? {} : { repo }) };\n const parsed: ReturnType<typeof tool.inputSchema.safeParse> = tool.inputSchema.safeParse(selected);\n assert.equal(parsed.success, true, JSON.stringify(selected));\n if (parsed.success) assert.deepEqual(parsed.data, selected);\n }\n }\n assert.equal(JournalInputSchema.safeParse(input).success, true);\n assert.equal(JournalInputSchema.safeParse({ ...input, repo: 'example/widget' }).success, false);\n for (const summary of [input.summary, 'S'.repeat(500)]) {\n const marker = `<!-- ai-delivery:journal@1:sha256:${'a'.repeat(64)} -->`;\n const body = renderJournal(\n {\n ...input,\n summary,\n status: '**In progress**',\n nextStep: 'Run\\nchecks',\n lengthCap: 600,\n details: 'D'.repeat(900),\n },\n marker,\n );\n assert.equal(body.startsWith(`Status: In progress. Next: Run checks.\\n\\n${summary}\\n\\n`), true);\n assert.match(body, /<details>/u);\n assert.ok(body.endsWith(marker));\n }\n }\n for (const input of [\n { ...common, kind: 'progress' },\n { ...common, kind: 'start', outcome: '' },\n { ...common, kind: 'closeout', acceptance: [], followUps: [] },\n {\n ...common,\n kind: 'decision',\n decision: 'Use parser',\n rationale: 'Works',\n evidence: ['/Users/operator/checks.log'],\n },\n { ...common, kind: 'start', outcome: 'Deliver', nextDate: 'tomorrow' },\n { ...common, kind: 'start', outcome: 'Deliver', done: ['Wrong variant'] },\n { ...common, kind: 'progress', done: ['Deliver'], decisionNeeded: 'None', rationale: 'Wrong variant' },\n { ...common, kind: 'decision', decision: 'Use parser', rationale: 'Works', blocker: 'Wrong variant' },\n { ...common, kind: 'blocker', blocker: 'Review', resolution: 'Accept', outcome: 'Wrong variant' },\n { ...valid[4], done: ['Wrong variant'] },\n { ...valid[0], unknown: true },\n { ...valid[0], kind: 'unsupported' },\n { ...valid[0], nextDate: '2026-02-30' },\n { ...valid[0], nextDate: 20261009 },\n { ...valid[0], keyNumbers: '3 checks' },\n { ...valid[0], issueNumber: '17' },\n { ...valid[4], acceptance: [{ criterion: 'Deliver', evidence: common.evidence[0], unknown: true }] },\n ])\n for (const repo of [undefined, 'example/widget'])\n assert.equal(tool.inputSchema.safeParse({ ...input, ...(repo === undefined ? {} : { repo }) }).success, false);\n for (const repo of [\n '',\n 'example',\n 'example/widget/extra',\n 'https://github.com/example/widget',\n 'example/\\nwidget',\n 17,\n null,\n [],\n ])\n assert.equal(tool.inputSchema.safeParse({ ...valid[0], repo }).success, false);\n});\n\ntest('journal dispatch refuses invalid fields and repository conflicts before configuration or authentication', async () => {\n const settings = vi.spyOn(configuration, 'loadDeliverySettings').mockImplementation(async () => {\n throw new Error('Configuration must not load for an invalid journal');\n });\n const clients = vi.spyOn(githubClients, 'createDeliveryGitHubClients');\n const valid = {\n repo: 'example/widget',\n issueNumber: 17,\n kind: 'progress',\n summary: 'Parser work is underway.',\n status: 'In progress',\n done: ['Added validation'],\n decisionNeeded: 'None',\n keyNumbers: [],\n evidence: ['https://github.com/example/widget/pull/23'],\n nextStep: 'Run checks',\n nextDate: null,\n };\n try {\n for (const input of [\n { ...valid, kind: 'unsupported' },\n { ...valid, outcome: 'Wrong variant' },\n { ...valid, unknown: true },\n { ...valid, done: [] },\n { ...valid, evidence: [] },\n { ...valid, repo: 'invalid' },\n { ...valid, repo: 17 },\n { ...valid, nextDate: '2026-02-30' },\n ])\n await assert.rejects(executeTool('issue_comment', input, { repoRoot: '/non-git-fixture' }));\n await assert.rejects(\n executeTool('issue_comment', valid, { repoRoot: '/non-git-fixture', repo: 'example/other' }),\n /selectors disagree/u,\n );\n assert.equal(settings.mock.calls.length, 0);\n assert.equal(clients.mock.calls.length, 0, 'no authenticated client or comment writer is reached');\n } finally {\n settings.mockRestore();\n clients.mockRestore();\n }\n});\n\ntest('canonical comment writes read back and recover a lost response without duplicates', async () => {\n const comment = (\n issue as unknown as {\n commentIssue?: (\n context: DeliveryContext,\n input: JournalInput | { issueNumber: number; body: string },\n lifecycleKey?: string,\n ) => Promise<{ commentId: number; url: string; body: string; reused: boolean }>;\n }\n ).commentIssue;\n assert.ok(comment, 'canonical comment writer must exist');\n const agent = await import('./agent.js');\n assert.equal(agent.commentIssue, comment);\n assert.equal(agent.ISSUE_COMMENT_BODY_LIMIT, 65536);\n const root = mkdtempSync(join(tmpdir(), 'ai-delivery-journal-'));\n execFileSync('git', ['init', '-q', '-b', 'main'], { cwd: root });\n const stored: { id: number; body: string; html_url: string; user: { login: string }; issue_url: string }[] = [];\n let loseResponse = true;\n let corruptReadback = false;\n let authorCalls = 0;\n const context = {\n root,\n repo: { owner: 'example', repo: 'widget' },\n clients: {\n role: 'author',\n authenticatedAuthor: async () => {\n authorCalls += 1;\n return { actorLogin: 'operator', credentialIdentity: 'user:1' };\n },\n rest: {\n issues: {\n get: async () => ({ data: { number: 17, state: 'open' } }),\n listComments: async () => ({ data: stored }),\n createComment: async (input: { body: string }) => {\n const id = 91 + stored.length;\n const data = {\n id,\n body: input.body,\n html_url: `https://github.com/example/widget/issues/17#issuecomment-${String(id)}`,\n issue_url: 'https://api.github.com/repos/example/widget/issues/17',\n user: { login: 'operator' },\n };\n stored.push(data);\n if (loseResponse) {\n loseResponse = false;\n throw new Error('response lost');\n }\n return { data };\n },\n getComment: async (input: { comment_id: number }) => ({\n data: {\n ...stored.find((item) => item.id === input.comment_id),\n ...(corruptReadback ? { body: 'changed' } : {}),\n },\n }),\n },\n },\n },\n } as unknown as DeliveryContext;\n const input: JournalInput = {\n issueNumber: 17,\n kind: 'start',\n summary: 'Implementation started.',\n status: 'In progress',\n outcome: 'Deliver validation',\n keyNumbers: [],\n evidence: [],\n nextStep: 'Run checks',\n nextDate: '2026-10-09',\n };\n try {\n await assert.rejects(comment(context, input), /response lost/u);\n const recovered = await comment(context, input);\n assert.equal(recovered.commentId, 91);\n assert.equal(recovered.reused, true);\n assert.equal(stored.length, 1);\n assert.match(recovered.body, /^Status: In progress\\. Next: Run checks\\.\\n\\nImplementation started\\./u);\n corruptReadback = true;\n await assert.rejects(comment(context, input), /readback/u);\n corruptReadback = false;\n\n stored.push({ ...stored[0]!, id: 99, html_url: 'https://github.com/example/widget/issues/17#issuecomment-99' });\n await assert.rejects(comment(context, input), /duplicate authored retry matches/u);\n assert.equal(stored.length, 2, 'ambiguous retries must not write another comment');\n stored.pop();\n\n const rawBody = `\\r\\n <details>\\n<summary>Prior content</summary>\\n<pre>${'\uD83D\uDE42 & prior title/body\\r\\n'.repeat(600)}</pre>\\n</details> \\t\\n`;\n assert.ok(rawBody.length > 10000);\n loseResponse = true;\n await assert.rejects(comment(context, { issueNumber: 17, body: rawBody }), /response lost/u);\n const rawRecovered = await comment(context, { issueNumber: 17, body: rawBody });\n assert.equal(rawRecovered.body, rawBody, 'raw history content must remain exact and unwrapped');\n assert.equal(rawRecovered.commentId, 92);\n assert.equal(rawRecovered.reused, true);\n assert.equal(stored.length, 2);\n assert.equal(stored[1]!.body, rawBody, 'no journal marker or unrequested content is appended');\n\n const maximumBody = '\uD83D\uDE42'.repeat(32768);\n assert.equal(maximumBody.length, 65536);\n assert.equal((await comment(context, { issueNumber: 17, body: maximumBody })).body, maximumBody);\n assert.equal(stored.length, 3);\n const beforeInvalid = authorCalls;\n for (const body of ['', ' \\r\\n\\t ', 'x'.repeat(65537), `${maximumBody}\uD83D\uDE42`])\n await assert.rejects(comment(context, { issueNumber: 17, body }), /comment body/u);\n await assert.rejects(\n comment(context, {\n ...input,\n status: 'x'.repeat(9000),\n outcome: 'x'.repeat(9000),\n nextStep: 'x'.repeat(9000),\n details: 'x'.repeat(9000),\n keyNumbers: Array.from({ length: 4 }, () => 'x'.repeat(9000)),\n }),\n /comment body/u,\n );\n await assert.rejects(\n comment(context, { issueNumber: 17, body: rawBody }, 'start:legacy'),\n /lifecycle journal key/u,\n );\n assert.equal(authorCalls, beforeInvalid, 'unsupported payloads fail before authentication or mutation');\n assert.equal(stored.length, 3);\n corruptReadback = true;\n await assert.rejects(comment(context, { issueNumber: 17, body: rawBody }), /readback/u);\n } finally {\n rmSync(root, { recursive: true, force: true });\n }\n});\n\ntest('length cap keeps the summary visible and moves every excess field into collapsed detail', () => {\n const summary = 'S'.repeat(500);\n const rendered = renderJournal({\n issueNumber: 17,\n kind: 'progress',\n summary,\n status: 'In progress '.repeat(500),\n done: ['A'.repeat(900)],\n decisionNeeded: 'None',\n keyNumbers: ['7 tests'],\n evidence: ['https://github.com/example/widget/pull/23'],\n nextStep: 'Review '.repeat(1000),\n nextDate: '2026-10-09',\n lengthCap: 600,\n });\n const first = rendered.split('\\n')[0]!;\n assert.ok(first.startsWith('Status: In progress'));\n assert.ok(first.length <= 100 && rendered.split('\\n')[2] === summary);\n assert.ok(rendered.indexOf('Next: Review') < rendered.indexOf(summary));\n assert.match(rendered, /<details>/u);\n assert.match(rendered, /A{900}/u);\n assert.match(rendered, /7 tests/u);\n assert.match(rendered, /https:\\/\\/github.com\\/example\\/widget\\/pull\\/23/u);\n});\n\ntest('automatic closeout selects acceptance checkboxes and declared follow-ups without swallowing other sections', () => {\n const body =\n '## Outcome\\nShip.\\n\\n## Acceptance Criteria\\n- [ ] Validation works\\n- [x] Recovery works\\n\\n## Follow-ups\\n- Track post-release adoption: https://github.com/example/widget/issues/24\\n\\n## Non-goals\\n- [ ] Not an acceptance criterion';\n assert.deepEqual(acceptanceCriteria(body), ['Validation works', 'Recovery works']);\n});\n\ntest('closeout accepts every readiness heading level and stops at the next heading', () => {\n for (let level = 1; level <= 6; level += 1) {\n for (let indent = 0; indent <= 3; indent += 1) {\n const heading = `${' '.repeat(indent)}${'#'.repeat(level)}`;\n const body = `${heading}\\tAcceptance Criteria\\n-[ ] Compact bullet\\n*\\t[X]\\tTabbed bullet\\n+ [x] Checked bullet\\n###### Other section\\n- [ ] Excluded\\n${heading} Follow-ups\\n- [ ] Deferred work\\n# Other section\\n- Excluded`;\n assert.deepEqual(acceptanceCriteria(body), ['Compact bullet', 'Tabbed bullet', 'Checked bullet']);\n }\n }\n});\n\ntest('journal evidence rejects local hosts and IP literals while accepting public DNS names', () => {\n const tool = getAiDeliveryMcpTool('issue_comment')!;\n const input = {\n issueNumber: 17,\n kind: 'start',\n summary: 'Work started.',\n status: 'Started',\n outcome: 'Deliver validation',\n keyNumbers: [],\n nextStep: 'Run checks',\n nextDate: null,\n };\n for (const host of [\n 'localhost',\n 'localhost.',\n 'api.localhost',\n 'runner.local',\n '127.0.0.1',\n '10.1.2.3',\n '172.16.0.1',\n '192.168.1.1',\n '169.254.1.1',\n '[::1]',\n '[fd00::1]',\n '[fe80::1]',\n '8.8.8.8',\n ])\n assert.equal(tool.inputSchema.safeParse({ ...input, evidence: [`https://${host}/evidence`] }).success, false, host);\n for (const host of ['github.com', '10.docs.example.com'])\n assert.equal(tool.inputSchema.safeParse({ ...input, evidence: [`https://${host}/evidence`] }).success, true, host);\n});\n\ntest('registered journal tool returns actionable decision refusals before native writes', async ({ signal }) => {\n const f = inertTarget(signal);\n const server = createAiDeliveryMcpServer({ repoRoot: f.root, signal });\n const client = new Client({ name: 'journal-contract-fixture', version: '1' });\n const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();\n const common = {\n repo: 'example/widget',\n issueNumber: 17,\n summary: 'Parser validation is ready.',\n status: 'In progress',\n nextStep: 'Review the parser',\n nextDate: null,\n keyNumbers: [],\n evidence: ['https://github.com/example/widget/pull/23'],\n };\n const decision = {\n ...common,\n kind: 'decision',\n decision: 'Use the existing parser',\n rationale: 'Preserves compatibility',\n };\n try {\n await server.connect(serverTransport);\n await client.connect(clientTransport);\n // A successful call first proves the synthetic external ports and real dispatch are wired correctly.\n const valid = await client.callTool({ name: 'issue_comment', arguments: decision });\n assert.notEqual(valid.isError, true, JSON.stringify(valid));\n assert.equal(f.comments.length, 1);\n const before = f.calls.length;\n const { rationale: _rationale, ...missingRationale } = decision;\n const refused = await client.callTool({ name: 'issue_comment', arguments: missingRationale });\n assert.equal(refused.isError, true);\n assert.equal(f.comments.length, 1, 'the invalid call makes zero additional native writes');\n assert.equal(f.calls.length, before, 'refusal precedes external authentication and reads');\n const text = JSON.stringify(refused);\n assert.doesNotMatch(text, /-32602|Input validation error/u, 'a normal contract refusal must reach the handler');\n assert.match(text, /rationale/u);\n const missingBoth = await client.callTool({ name: 'issue_comment', arguments: { ...common, kind: 'progress' } });\n assert.equal(missingBoth.isError, true);\n assert.match(JSON.stringify(missingBoth), /Missing required fields: done, decisionNeeded/u);\n const missingCommon = await client.callTool({\n name: 'issue_comment',\n arguments: { repo: 'example/widget', issueNumber: 17, kind: 'decision' },\n });\n assert.equal(missingCommon.isError, true);\n assert.match(\n JSON.stringify(missingCommon),\n /Missing required fields: summary, status, nextStep, nextDate, keyNumbers, evidence, decision, rationale/u,\n );\n assert.doesNotMatch(JSON.stringify(missingCommon), /-32602|Input validation error/u);\n\n const published = (await client.listTools()).tools.find((t) => t.name === 'issue_comment');\n assert.deepEqual(\n published?.inputSchema.anyOf,\n z.toJSONSchema(getAiDeliveryMcpTool('issue_comment')!.inputSchema).anyOf,\n );\n assert.match(text, /[Pp]rovide/u, 'the refusal explains the correction');\n const listed = (await client.listTools()).tools.find((tool) => tool.name === 'issue_comment');\n assert.ok(listed);\n assert.match(listed.description ?? '', /decision: non-empty decision and rationale/u);\n const properties = listed.inputSchema.properties as Record<string, { description?: string }>;\n for (const field of ['decision', 'rationale'])\n assert.match(properties[field]?.description ?? '', /Required non-empty text when kind is decision/u);\n assert.match(properties.kind?.description ?? '', /progress: done, decisionNeeded and non-empty evidence/u);\n assert.equal(listed.inputSchema.additionalProperties, false);\n\n const { decision: _decision, ...missingDecision } = decision;\n for (const invalid of [\n missingDecision,\n { ...missingRationale, decision: 'PRIVATE_INPUT_SENTINEL' },\n { ...decision, rationale: '' },\n { ...decision, rationale: 17 },\n { ...decision, kind: 'PRIVATE_INPUT_SENTINEL' },\n { ...decision, unknown: 'PRIVATE_INPUT_SENTINEL' },\n { ...decision, PRIVATE_INPUT_SENTINEL: 'private value' },\n {\n ...common,\n kind: 'closeout',\n acceptance: [{ criterion: 'Validated', evidence: common.evidence[0], PRIVATE_INPUT_SENTINEL: 'private value' }],\n followUps: [],\n },\n { ...decision, outcome: 'PRIVATE_INPUT_SENTINEL' },\n { ...common, kind: 'start' },\n { ...common, kind: 'progress', done: ['Validated'], decisionNeeded: 'None', evidence: [] },\n { ...common, kind: 'blocker', blocker: 'Review pending' },\n { ...common, kind: 'closeout', acceptance: [], followUps: [] },\n ]) {\n const invalidResult = await client.callTool({ name: 'issue_comment', arguments: invalid });\n assert.equal(invalidResult.isError, true);\n assert.doesNotMatch(JSON.stringify(invalidResult), /PRIVATE_INPUT_SENTINEL/u);\n assert.equal(f.comments.length, 1, 'invalid journals never create a native comment');\n assert.equal(f.calls.length, before, 'invalid journals stop before external ports');\n }\n\n const renderedDecision = f.comments[0]!.body;\n assert.match(\n renderedDecision,\n /^Status: In progress\\. Next: Review the parser\\.\\n\\nParser validation is ready\\.\\n\\n\\*\\*Kind:\\*\\* decision\\. \\*\\*Status:\\*\\* In progress\\n\\n\\*\\*Decision:\\*\\* Use the existing parser\\n\\n\\*\\*Rationale:\\*\\* Preserves compatibility/u,\n );\n assert.match(renderedDecision, /<!-- ai-delivery:journal@1:sha256:[a-f0-9]{64} -->$/u);\n const retry = await client.callTool({ name: 'issue_comment', arguments: { ...decision, verbose: true } });\n assert.notEqual(retry.isError, true);\n const retried = JSON.parse((retry.content as { text: string }[])[0]!.text) as {\n body: string;\n reused: boolean;\n commentId: number;\n url: string;\n };\n assert.equal(retried.reused, true);\n assert.equal(retried.body, renderedDecision);\n assert.equal(retried.commentId, 101);\n assert.equal(retried.url, 'https://github.com/example/widget/issues/17#issuecomment-101');\n assert.equal(f.comments.length, 1);\n for (const [variant, section] of [\n [{ ...common, kind: 'start', outcome: 'Deliver validation' }, '**Outcome:** Deliver validation'],\n [\n { ...common, kind: 'progress', done: ['Validated'], decisionNeeded: 'None' },\n '**Done since last:**\\n- Validated',\n ],\n [\n { ...common, kind: 'blocker', blocker: 'Review pending', resolution: 'Independent acceptance' },\n '**Resolution needed:** Independent acceptance',\n ],\n [\n {\n ...common,\n kind: 'closeout',\n acceptance: [{ criterion: 'Validation works', evidence: common.evidence[0] }],\n followUps: [],\n },\n '**Follow-ups:** None.',\n ],\n ] as const) {\n const accepted = await client.callTool({ name: 'issue_comment', arguments: { ...variant, verbose: true } });\n assert.notEqual(accepted.isError, true, JSON.stringify(accepted));\n const value = JSON.parse((accepted.content as { text: string }[])[0]!.text) as { body: string; reused: boolean };\n assert.equal(value.reused, false);\n assert.ok(value.body.includes(section));\n assert.equal(value.body, f.comments.at(-1)!.body, 'response retains authoritative native readback');\n }\n assert.equal(f.comments.length, 5, 'all five valid journal kinds remain usable');\n } finally {\n await client.close();\n await server.close();\n await f.dispose(undefined);\n }\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,SAAS;AAClB,SAAS,MAAM,UAAU;AACzB,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAC1C,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