@aviaratech/ai-delivery 0.3.35 → 0.3.37
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/CONTRIBUTING.md +12 -206
- package/README.md +56 -554
- package/dist/agent.d.ts +1 -3
- package/dist/agent.js +74 -16
- package/dist/agent.js.map +7 -1
- package/dist/agentReadiness.test.js +73 -67
- package/dist/agentReadiness.test.js.map +7 -1
- package/dist/boardReconcile.test.js +1651 -1590
- package/dist/boardReconcile.test.js.map +7 -1
- package/dist/build.test.js +130 -0
- package/dist/build.test.js.map +7 -0
- package/dist/callerErrors.test.js +91 -0
- package/dist/callerErrors.test.js.map +7 -0
- package/dist/cli.js +389 -517
- package/dist/cli.js.map +7 -1
- package/dist/cliResult.d.ts +2 -2
- package/dist/cliResult.js +42 -45
- package/dist/cliResult.js.map +7 -1
- package/dist/cliResult.test.js +424 -369
- package/dist/cliResult.test.js.map +7 -1
- package/dist/config/deliveryConfig.d.ts +288 -14
- package/dist/config/deliveryConfig.js +472 -390
- package/dist/config/deliveryConfig.js.map +7 -1
- package/dist/config/deliveryConfig.test.js +773 -649
- package/dist/config/deliveryConfig.test.js.map +7 -1
- package/dist/contributorChecks.test.js +1694 -916
- package/dist/contributorChecks.test.js.map +7 -1
- package/dist/currentConsumer.test.js +819 -737
- package/dist/currentConsumer.test.js.map +7 -1
- package/dist/currentTrackingScenario.test.js +499 -479
- package/dist/currentTrackingScenario.test.js.map +7 -1
- package/dist/delivery/common.js +160 -172
- package/dist/delivery/common.js.map +7 -1
- package/dist/delivery/delivery.test.js +509 -431
- package/dist/delivery/delivery.test.js.map +7 -1
- package/dist/delivery/evidence.d.ts +2 -2
- package/dist/delivery/evidence.js +133 -120
- package/dist/delivery/evidence.js.map +7 -1
- package/dist/delivery/index.js +7 -2
- package/dist/delivery/index.js.map +7 -1
- package/dist/delivery/legacy.js +65 -5
- package/dist/delivery/legacy.js.map +7 -1
- package/dist/delivery/policy.d.ts +10 -10
- package/dist/delivery/policy.js +211 -238
- package/dist/delivery/policy.js.map +7 -1
- package/dist/delivery/stage.d.ts +18 -18
- package/dist/delivery/stage.js +220 -235
- package/dist/delivery/stage.js.map +7 -1
- package/dist/deliveryBoard.d.ts +74 -0
- package/dist/deliveryBoard.js +644 -0
- package/dist/deliveryBoard.js.map +7 -0
- package/dist/deliveryBoard.test.js +649 -0
- package/dist/deliveryBoard.test.js.map +7 -0
- package/dist/deliveryHealth.test.js +179 -155
- package/dist/deliveryHealth.test.js.map +7 -1
- package/dist/dependencyCompatibility.test.js +154 -140
- package/dist/dependencyCompatibility.test.js.map +7 -1
- package/dist/directoryIndependent.test.js +417 -383
- package/dist/directoryIndependent.test.js.map +7 -1
- package/dist/dispatch.d.ts +16 -11
- package/dist/dispatch.js +316 -354
- package/dist/dispatch.js.map +7 -1
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +103 -96
- package/dist/errors.js.map +7 -1
- package/dist/fixtures/deliveryBoardReplay.d.ts +56 -0
- package/dist/fixtures/deliveryBoardReplay.js +617 -0
- package/dist/fixtures/deliveryBoardReplay.js.map +7 -0
- package/dist/fixtures/discovery.d.ts +63 -23
- package/dist/fixtures/discovery.js +96 -90
- package/dist/fixtures/discovery.js.map +7 -1
- package/dist/fixtures/inertEntrypointChild.js +57 -56
- package/dist/fixtures/inertEntrypointChild.js.map +7 -1
- package/dist/fixtures/inertEntrypoints.d.ts +1 -1
- package/dist/fixtures/inertEntrypoints.js +321 -276
- package/dist/fixtures/inertEntrypoints.js.map +7 -1
- package/dist/fixtures/inertTarget.d.ts +78 -7
- package/dist/fixtures/inertTarget.js +769 -691
- package/dist/fixtures/inertTarget.js.map +7 -1
- package/dist/fixtures/issue63.d.ts +4 -3
- package/dist/fixtures/issue63.js +260 -274
- package/dist/fixtures/issue63.js.map +7 -1
- package/dist/fixtures/issueProjectItems.d.ts +20 -0
- package/dist/fixtures/issueProjectItems.js +15 -0
- package/dist/fixtures/issueProjectItems.js.map +7 -0
- package/dist/fixtures/readView.d.ts +120 -0
- package/dist/fixtures/readView.js +172 -0
- package/dist/fixtures/readView.js.map +7 -0
- package/dist/fixtures/recordedGitHubFlows.d.ts +120 -0
- package/dist/fixtures/recordedGitHubFlows.js +109 -0
- package/dist/fixtures/recordedGitHubFlows.js.map +7 -0
- package/dist/genericCompatibility.test.js +64 -55
- package/dist/genericCompatibility.test.js.map +7 -1
- package/dist/git.d.ts +0 -3
- package/dist/git.js +59 -76
- package/dist/git.js.map +7 -1
- package/dist/gitProcess.d.ts +1 -1
- package/dist/gitProcess.js +58 -53
- package/dist/gitProcess.js.map +7 -1
- package/dist/github/client.d.ts +2 -2
- package/dist/github/client.js +484 -379
- package/dist/github/client.js.map +7 -1
- package/dist/github/commandIdentityPolicy.js +42 -52
- package/dist/github/commandIdentityPolicy.js.map +7 -1
- package/dist/github/discovery.d.ts +1 -0
- package/dist/github/discovery.js +197 -215
- package/dist/github/discovery.js.map +7 -1
- package/dist/github/discovery.test.js +223 -177
- package/dist/github/discovery.test.js.map +7 -1
- package/dist/github/issueHistory.d.ts +2 -2
- package/dist/github/issueHistory.js +117 -125
- package/dist/github/issueHistory.js.map +7 -1
- package/dist/github/machineAuth.d.ts +1 -1
- package/dist/github/machineAuth.js +126 -117
- package/dist/github/machineAuth.js.map +7 -1
- package/dist/github/machineAuth.test.js +755 -639
- package/dist/github/machineAuth.test.js.map +7 -1
- package/dist/github/nativeIssueMetadata.js +286 -273
- package/dist/github/nativeIssueMetadata.js.map +7 -1
- package/dist/github/projectDelivery.d.ts +18 -2
- package/dist/github/projectDelivery.js +615 -557
- package/dist/github/projectDelivery.js.map +7 -1
- package/dist/github/relationships.js +433 -389
- package/dist/github/relationships.js.map +7 -1
- package/dist/github/repo.d.ts +1 -0
- package/dist/github/repo.js +123 -96
- package/dist/github/repo.js.map +7 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +7 -1
- package/dist/issue.d.ts +40 -9
- package/dist/issue.js +2102 -1742
- package/dist/issue.js.map +7 -1
- package/dist/issue63History.test.js +40 -42
- package/dist/issue63History.test.js.map +7 -1
- package/dist/issue63Routes.test.js +154 -143
- package/dist/issue63Routes.test.js.map +7 -1
- package/dist/issueBatchUpdate.test.js +989 -885
- package/dist/issueBatchUpdate.test.js.map +7 -1
- package/dist/issueBlockerGuard.test.js +262 -226
- package/dist/issueBlockerGuard.test.js.map +7 -1
- package/dist/issueContract.d.ts +23 -4
- package/dist/issueContract.js +416 -395
- package/dist/issueContract.js.map +7 -1
- package/dist/issueContract.test.d.ts +4 -3
- package/dist/issueContract.test.js +358 -321
- package/dist/issueContract.test.js.map +7 -1
- package/dist/issueDates.test.js +235 -233
- package/dist/issueDates.test.js.map +7 -1
- package/dist/issueInfoReadback.test.js +304 -190
- package/dist/issueInfoReadback.test.js.map +7 -1
- package/dist/issueIntake.test.js +1938 -1732
- package/dist/issueIntake.test.js.map +7 -1
- package/dist/issueJournal.d.ts +40 -19
- package/dist/issueJournal.js +229 -138
- package/dist/issueJournal.js.map +7 -1
- package/dist/issueJournal.test.js +605 -422
- package/dist/issueJournal.test.js.map +7 -1
- package/dist/issueRollup.test.d.ts +1 -0
- package/dist/issueRollup.test.js +476 -0
- package/dist/issueRollup.test.js.map +7 -0
- package/dist/issueTracking.test.js +1059 -989
- package/dist/issueTracking.test.js.map +7 -1
- package/dist/issueWriteRecovery.test.d.ts +1 -0
- package/dist/issueWriteRecovery.test.js +260 -0
- package/dist/issueWriteRecovery.test.js.map +7 -0
- package/dist/lifecycle.test.js +112 -441
- package/dist/lifecycle.test.js.map +7 -1
- package/dist/logger.js +80 -74
- package/dist/logger.js.map +7 -1
- package/dist/mcp/index.js +116 -94
- package/dist/mcp/index.js.map +7 -1
- package/dist/mcp/tools.d.ts +252 -310
- package/dist/mcp/tools.js +235 -342
- package/dist/mcp/tools.js.map +7 -1
- package/dist/pluginAuthProbe.js +63 -52
- package/dist/pluginAuthProbe.js.map +7 -1
- package/dist/pluginAuthProbe.test.js +85 -62
- package/dist/pluginAuthProbe.test.js.map +7 -1
- package/dist/pluginCredentials.test.js +282 -259
- package/dist/pluginCredentials.test.js.map +7 -1
- package/dist/pluginDoctor.test.js +653 -588
- package/dist/pluginDoctor.test.js.map +7 -1
- package/dist/pluginInstaller.d.ts +7 -5
- package/dist/pluginInstaller.js +1173 -1229
- package/dist/pluginInstaller.js.map +7 -1
- package/dist/pluginInstaller.test.js +1842 -1423
- package/dist/pluginInstaller.test.js.map +7 -1
- package/dist/pluginPackaging.test.js +417 -413
- package/dist/pluginPackaging.test.js.map +7 -1
- package/dist/pr.d.ts +114 -131
- package/dist/pr.js +1314 -1327
- package/dist/pr.js.map +7 -1
- package/dist/pr.test.js +967 -653
- package/dist/pr.test.js.map +7 -1
- package/dist/prAssociation.test.js +2419 -1788
- package/dist/prAssociation.test.js.map +7 -1
- package/dist/prDispatch.test.js +123 -89
- package/dist/prDispatch.test.js.map +7 -1
- package/dist/readView.d.ts +184 -0
- package/dist/readView.js +218 -0
- package/dist/readView.js.map +7 -0
- package/dist/readView.test.d.ts +1 -0
- package/dist/readView.test.js +146 -0
- package/dist/readView.test.js.map +7 -0
- package/dist/releaseReconciliation.test.js +267 -288
- package/dist/releaseReconciliation.test.js.map +7 -1
- package/dist/releaseWorkflow.test.js +2493 -422
- package/dist/releaseWorkflow.test.js.map +7 -1
- package/dist/review.d.ts +738 -2
- package/dist/review.js +601 -348
- package/dist/review.js.map +7 -1
- package/dist/review.test.js +1218 -812
- package/dist/review.test.js.map +7 -1
- package/dist/reviewSubmit.test.d.ts +1 -0
- package/dist/reviewSubmit.test.js +747 -0
- package/dist/reviewSubmit.test.js.map +7 -0
- package/dist/services/agentReadinessService.js +42 -37
- package/dist/services/agentReadinessService.js.map +7 -1
- package/dist/services/blockerGuardService.js +188 -188
- package/dist/services/blockerGuardService.js.map +7 -1
- package/dist/services/boardReconcileService.d.ts +125 -125
- package/dist/services/boardReconcileService.js +1295 -1421
- package/dist/services/boardReconcileService.js.map +7 -1
- package/dist/services/deliveryHealthService.js +197 -199
- package/dist/services/deliveryHealthService.js.map +7 -1
- package/dist/services/legacyIssueMigration.js +263 -277
- package/dist/services/legacyIssueMigration.js.map +7 -1
- package/dist/stagedChecks.test.js +396 -194
- package/dist/stagedChecks.test.js.map +7 -1
- package/dist/start.test.js +99 -95
- package/dist/start.test.js.map +7 -1
- package/dist/stdoutRegression.test.js +321 -358
- package/dist/stdoutRegression.test.js.map +7 -1
- package/dist/targetPolicyDiscovery.test.js +141 -143
- package/dist/targetPolicyDiscovery.test.js.map +7 -1
- package/dist/targetPolicyEntrypoints.test.js +308 -269
- package/dist/targetPolicyEntrypoints.test.js.map +7 -1
- package/dist/targetPolicyLocal.test.js +580 -1051
- package/dist/targetPolicyLocal.test.js.map +7 -1
- package/dist/targetPolicyRoutes.test.js +274 -281
- package/dist/targetPolicyRoutes.test.js.map +7 -1
- package/dist/targetRepositoryExecution.test.d.ts +1 -0
- package/dist/targetRepositoryExecution.test.js +451 -0
- package/dist/targetRepositoryExecution.test.js.map +7 -0
- package/dist/terminalMessages.js +41 -35
- package/dist/terminalMessages.js.map +7 -1
- package/dist/toolOutput.d.ts +2 -0
- package/dist/toolOutput.js +36 -0
- package/dist/toolOutput.js.map +7 -0
- package/dist/toolOutput.test.d.ts +1 -0
- package/dist/toolOutput.test.js +240 -0
- package/dist/toolOutput.test.js.map +7 -0
- package/dist/utils/atomicJson.d.ts +0 -2
- package/dist/utils/atomicJson.js +81 -77
- package/dist/utils/atomicJson.js.map +7 -1
- package/dist/utils/filesystem.d.ts +0 -8
- package/dist/utils/filesystem.js +5 -19
- package/dist/utils/filesystem.js.map +7 -1
- package/dist/utils/lockfile.js +68 -71
- package/dist/utils/lockfile.js.map +7 -1
- package/dist/verification.d.ts +1 -54
- package/dist/verification.js +976 -1941
- package/dist/verification.js.map +7 -1
- package/dist/verificationGate.test.js +127 -117
- package/dist/verificationGate.test.js.map +7 -1
- package/dist/version.js +45 -24
- package/dist/version.js.map +7 -1
- package/package.json +9 -8
- package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
- package/plugins/ai-delivery/README.md +47 -156
- package/plugins/ai-delivery/plugin.json +1 -1
- package/plugins/ai-delivery/runtime/dist/THIRD-PARTY-NOTICES.md +238 -44
- package/plugins/ai-delivery/runtime/dist/cli.js +351 -115
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/plugins/ai-delivery/skills/intake-create/SKILL.md +14 -78
- package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +35 -36
- package/plugins/ai-delivery/skills/worktree-lifecycle/SKILL.md +14 -15
- package/dist/investigationCompletion.test.js +0 -728
- package/dist/investigationCompletion.test.js.map +0 -1
- package/dist/services/deliveryAdmission.d.ts +0 -49
- package/dist/services/deliveryAdmission.js +0 -165
- package/dist/services/deliveryAdmission.js.map +0 -1
- package/dist/services/worktreeRegistry.d.ts +0 -434
- package/dist/services/worktreeRegistry.js +0 -1248
- package/dist/services/worktreeRegistry.js.map +0 -1
- package/dist/setup.d.ts +0 -60
- package/dist/setup.js +0 -585
- package/dist/setup.js.map +0 -1
- package/dist/setup.test.js +0 -3329
- package/dist/setup.test.js.map +0 -1
- package/dist/worktree.d.ts +0 -28
- package/dist/worktree.js +0 -188
- package/dist/worktree.js.map +0 -1
- package/dist/worktreeTransition.d.ts +0 -211
- package/dist/worktreeTransition.js +0 -1037
- package/dist/worktreeTransition.js.map +0 -1
- package/dist/worktreeTransition.test.js +0 -1191
- package/dist/worktreeTransition.test.js.map +0 -1
- /package/dist/{investigationCompletion.test.d.ts → build.test.d.ts} +0 -0
- /package/dist/{setup.test.d.ts → callerErrors.test.d.ts} +0 -0
- /package/dist/{worktreeTransition.test.d.ts → deliveryBoard.test.d.ts} +0 -0
|
@@ -1,341 +1,378 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import { test } from
|
|
3
|
-
import { z } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[3500, false],
|
|
29
|
-
[4000, false],
|
|
30
|
-
[4001, true],
|
|
31
|
-
[4500, true],
|
|
32
|
-
]) {
|
|
33
|
-
const issue = validIssue();
|
|
34
|
-
issue.problem = '';
|
|
35
|
-
const prefix = () => renderIssueBody(issue).split('<!-- ai-delivery:issue-data@1 ')[0];
|
|
36
|
-
issue.problem = '<'.repeat(length - prefix().length);
|
|
37
|
-
assert.equal(prefix().length, length);
|
|
38
|
-
assert.equal(issueWarnings(issue).some((item) => item.code === 'body.length'), warning, String(length));
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "vitest";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import {
|
|
5
|
+
DraftIssue,
|
|
6
|
+
ReadyIssue,
|
|
7
|
+
IssueFields,
|
|
8
|
+
IssueWriteSchema,
|
|
9
|
+
ISSUE_JSON_SCHEMAS,
|
|
10
|
+
ISSUE_BODY_MARKER,
|
|
11
|
+
requireIssue,
|
|
12
|
+
renderIssueBody,
|
|
13
|
+
parseIssueBody,
|
|
14
|
+
validateIssue,
|
|
15
|
+
issueWarnings
|
|
16
|
+
} from "./issueContract.js";
|
|
17
|
+
import { AI_DELIVERY_MCP_TOOLS } from "./mcp/index.js";
|
|
18
|
+
const validIssue = () => IssueFields.parse({
|
|
19
|
+
title: "Reject invalid widget identifiers before persistence",
|
|
20
|
+
issueType: "Feature",
|
|
21
|
+
points: 2,
|
|
22
|
+
problem: "Malformed identifiers currently reach persistence.",
|
|
23
|
+
outcome: "Widget writes reject malformed identifiers before persistence.",
|
|
24
|
+
acceptanceCriteria: [
|
|
25
|
+
{
|
|
26
|
+
behavior: "An invalid widget identifier returns an error without a persistence call.",
|
|
27
|
+
verifiedBy: "A mocked persistence regression asserts the error and zero calls."
|
|
39
28
|
}
|
|
29
|
+
],
|
|
30
|
+
outOfScope: ["Changing the storage engine."],
|
|
31
|
+
openQuestions: [],
|
|
32
|
+
context: {
|
|
33
|
+
components: ["widget intake"],
|
|
34
|
+
files: ["src/widget.ts"],
|
|
35
|
+
evidence: ["A portable synthetic identifier fixture."]
|
|
36
|
+
}
|
|
40
37
|
});
|
|
41
|
-
test(
|
|
38
|
+
test("readable body length excludes embedded issue data and warns strictly above 4000", () => {
|
|
39
|
+
for (const [length, warning] of [
|
|
40
|
+
[3500, false],
|
|
41
|
+
[4e3, false],
|
|
42
|
+
[4001, true],
|
|
43
|
+
[4500, true]
|
|
44
|
+
]) {
|
|
42
45
|
const issue = validIssue();
|
|
43
|
-
issue.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
issue.problem = "";
|
|
47
|
+
const prefix = () => renderIssueBody(issue).split("<!-- ai-delivery:issue-data@1 ")[0];
|
|
48
|
+
issue.problem = "<".repeat(length - prefix().length);
|
|
49
|
+
assert.equal(prefix().length, length);
|
|
50
|
+
assert.equal(
|
|
51
|
+
issueWarnings(issue).some((item) => item.code === "body.length"),
|
|
52
|
+
warning,
|
|
53
|
+
String(length)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
52
56
|
});
|
|
53
|
-
test(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
assert.deepEqual(z.toJSONSchema(create.inputSchema).properties?.[name], shape?.[name]);
|
|
68
|
-
assert.deepEqual(z.toJSONSchema(update.inputSchema).properties?.[name], shape?.[name]);
|
|
69
|
-
}
|
|
70
|
-
assert.deepEqual(update.inputSchema.parse({ issueNumber: 17 }), { issueNumber: 17 });
|
|
71
|
-
assert.ok('issueContract' in create);
|
|
72
|
-
assert.deepEqual(create.issueContract, ISSUE_JSON_SCHEMAS, 'portable output is reachable through the existing packaged MCP export');
|
|
57
|
+
test("multiline criteria keep nested bullets and verification attached to their own checkbox", () => {
|
|
58
|
+
const issue = validIssue();
|
|
59
|
+
issue.acceptanceCriteria = [
|
|
60
|
+
{
|
|
61
|
+
behavior: "Reject malformed input:\n- Empty input\n - Whitespace only\n- Invalid shape",
|
|
62
|
+
verifiedBy: "Regression cases:\n- Empty and malformed"
|
|
63
|
+
},
|
|
64
|
+
{ behavior: "A valid input is stored once.", verifiedBy: "One observed write." }
|
|
65
|
+
];
|
|
66
|
+
const actual = renderIssueBody(issue).split("## Acceptance criteria\n\n")[1].split("\n\n## Out of scope")[0];
|
|
67
|
+
assert.equal(
|
|
68
|
+
actual,
|
|
69
|
+
"- [ ] Reject malformed input:\n - Empty input\n - Whitespace only\n - Invalid shape\n\n Verified by: Regression cases:\n - Empty and malformed\n- [ ] A valid input is stored once.\n Verified by: One observed write."
|
|
70
|
+
);
|
|
73
71
|
});
|
|
74
|
-
test(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
assert.
|
|
72
|
+
test("MCP create/update fields derive from the canonical schema and patch omissions retain no defaults", () => {
|
|
73
|
+
const create = AI_DELIVERY_MCP_TOOLS.find((t) => t.name === "issue_create");
|
|
74
|
+
const update = AI_DELIVERY_MCP_TOOLS.find((t) => t.name === "issue_update");
|
|
75
|
+
const shape = z.toJSONSchema(IssueWriteSchema).properties;
|
|
76
|
+
for (const name of [
|
|
77
|
+
"acceptanceCriteria",
|
|
78
|
+
"context",
|
|
79
|
+
"outOfScope",
|
|
80
|
+
"openQuestions",
|
|
81
|
+
"problem",
|
|
82
|
+
"outcome",
|
|
83
|
+
"bug",
|
|
84
|
+
"draft"
|
|
85
|
+
]) {
|
|
86
|
+
assert.deepEqual(z.toJSONSchema(create.inputSchema).properties?.[name], shape?.[name]);
|
|
87
|
+
assert.deepEqual(z.toJSONSchema(update.inputSchema).properties?.[name], shape?.[name]);
|
|
88
|
+
}
|
|
89
|
+
assert.deepEqual(update.inputSchema.parse({ issueNumber: 17 }), { issueNumber: 17 });
|
|
90
|
+
assert.ok("issueContract" in create);
|
|
91
|
+
assert.deepEqual(
|
|
92
|
+
create.issueContract,
|
|
93
|
+
ISSUE_JSON_SCHEMAS,
|
|
94
|
+
"portable output is reachable through the existing packaged MCP export"
|
|
95
|
+
);
|
|
89
96
|
});
|
|
90
|
-
test(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
'The request is done.',
|
|
105
|
-
'The interface is user friendly.',
|
|
106
|
-
]) {
|
|
107
|
-
const issue = validIssue();
|
|
108
|
-
issue.acceptanceCriteria[0].behavior = behavior;
|
|
109
|
-
assert.ok(validateIssue(issue).failures.some((f) => f.code === 'acceptance-criteria.vague'), behavior);
|
|
97
|
+
test("portable JSON Schema snapshot carries Ready bounds and distinguishes incomplete drafts", () => {
|
|
98
|
+
const ready = ISSUE_JSON_SCHEMAS.ready;
|
|
99
|
+
assert.deepEqual(
|
|
100
|
+
{
|
|
101
|
+
draft: ready.properties?.draft,
|
|
102
|
+
points: ready.properties?.points,
|
|
103
|
+
title: ready.properties?.title,
|
|
104
|
+
openQuestions: ready.properties?.openQuestions
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
draft: { type: "boolean", const: false, default: false },
|
|
108
|
+
points: { type: "integer", minimum: 1, maximum: 8 },
|
|
109
|
+
title: { type: "string", minLength: 10, maxLength: 80 },
|
|
110
|
+
openQuestions: { default: [], type: "array", items: { type: "string" }, maxItems: 0 }
|
|
110
111
|
}
|
|
112
|
+
);
|
|
113
|
+
assert.deepEqual(ready.anyOf, [
|
|
114
|
+
{ properties: { epic: { const: true } }, required: ["epic"] },
|
|
115
|
+
{ required: ["points"] }
|
|
116
|
+
]);
|
|
117
|
+
assert.ok(!ISSUE_JSON_SCHEMAS.draft.required?.includes("points"));
|
|
111
118
|
});
|
|
112
|
-
test(
|
|
119
|
+
test("concrete domain wording remains Ready while generic completion claims fail", () => {
|
|
120
|
+
for (const behavior of [
|
|
121
|
+
"The independently reviewed head SHA is sent as the merge guard.",
|
|
122
|
+
"A failed request leaves the Project Done column unchanged.",
|
|
123
|
+
"A verified token grants access only to its repository.",
|
|
124
|
+
"The adapter works with a missing local checkout and returns the selected repository."
|
|
125
|
+
]) {
|
|
113
126
|
const issue = validIssue();
|
|
114
|
-
issue.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
issue.acceptanceCriteria[0].behavior = behavior;
|
|
128
|
+
assert.deepEqual(validateIssue(issue).failures, [], behavior);
|
|
129
|
+
}
|
|
130
|
+
for (const behavior of [
|
|
131
|
+
"The widget works correctly.",
|
|
132
|
+
"The change is reviewed.",
|
|
133
|
+
"The request is done.",
|
|
134
|
+
"The interface is user friendly."
|
|
135
|
+
]) {
|
|
136
|
+
const issue = validIssue();
|
|
137
|
+
issue.acceptanceCriteria[0].behavior = behavior;
|
|
138
|
+
assert.ok(
|
|
139
|
+
validateIssue(issue).failures.some((f) => f.code === "acceptance-criteria.vague"),
|
|
140
|
+
behavior
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
test("canonical bodies round trip every typed field, multiline markup and comment delimiters", () => {
|
|
145
|
+
const issue = validIssue();
|
|
146
|
+
issue.context.evidence.push("Observed <!-- text -->\n## nested heading\n`code`");
|
|
147
|
+
const body = renderIssueBody(issue);
|
|
148
|
+
assert.ok(body.startsWith(ISSUE_BODY_MARKER + "\n\n## Status\n\nReady"));
|
|
149
|
+
assert.deepEqual(parseIssueBody(body, { title: issue.title }).issue, issue);
|
|
150
|
+
assert.equal(parseIssueBody(body, { title: issue.title }).legacy, false);
|
|
151
|
+
assert.throws(
|
|
152
|
+
() => parseIssueBody(body.replace("## Status\n\nReady", "## Status\n\nDraft"), { title: issue.title }),
|
|
153
|
+
/body.canonical/u
|
|
154
|
+
);
|
|
155
|
+
assert.throws(() => parseIssueBody(body, { title: "Different native title" }), /body.canonical/u);
|
|
121
156
|
});
|
|
122
|
-
test(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const ready = requireIssue(parsed.issue);
|
|
131
|
-
assert.deepEqual(parseIssueBody(renderIssueBody(ready), { title: ready.title }).issue, ready);
|
|
157
|
+
test("lenient legacy conversion retains all bytes, portable verification and marker descriptions", () => {
|
|
158
|
+
const body = "## Problem\nA literal " + ISSUE_BODY_MARKER + " is documentation.\n## Outcome\nReject malformed identifiers.\n## Acceptance Criteria\n- [ ] Invalid identifiers return an error before persistence.\n## Verification\nRun the synthetic identifier tests.\n## Out of scope\n- Storage engine changes.\n## Scope\nsrc/missing-in-this-checkout.ts\nUnclassified historical text.\n";
|
|
159
|
+
const parsed = parseIssueBody(body, { title: validIssue().title, points: 2, issueType: "Feature" });
|
|
160
|
+
assert.equal(parsed.legacy, true);
|
|
161
|
+
assert.equal(parsed.issue.legacyBody, body);
|
|
162
|
+
assert.equal(parsed.issue.acceptanceCriteria[0]?.verifiedBy, "Run the synthetic identifier tests.");
|
|
163
|
+
const ready = requireIssue(parsed.issue);
|
|
164
|
+
assert.deepEqual(parseIssueBody(renderIssueBody(ready), { title: ready.title }).issue, ready);
|
|
132
165
|
});
|
|
133
|
-
test(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
166
|
+
test("legacy conversion never fabricates missing verification or bug evidence", () => {
|
|
167
|
+
const body = "## Problem\nA failure.\n## Outcome\nReject invalid widgets.\n## Acceptance Criteria\n- [ ] Invalid widgets are rejected before persistence.\n## Out of scope\n- Storage changes.\n";
|
|
168
|
+
const parsed = parseIssueBody(body, { title: validIssue().title, points: 2, issueType: "Bug" });
|
|
169
|
+
const codes = validateIssue(parsed.issue).failures.map((f) => f.code);
|
|
170
|
+
assert.ok(codes.includes("acceptance-criteria.fields"));
|
|
171
|
+
assert.ok(codes.includes("bug.steps"));
|
|
172
|
+
assert.ok(codes.includes("bug.environment"));
|
|
140
173
|
});
|
|
141
174
|
const blockingCases = [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
175
|
+
[
|
|
176
|
+
"Points13",
|
|
177
|
+
(i) => {
|
|
178
|
+
i.points = 13;
|
|
179
|
+
},
|
|
180
|
+
"points"
|
|
181
|
+
],
|
|
182
|
+
[
|
|
183
|
+
"Points0",
|
|
184
|
+
(i) => {
|
|
185
|
+
i.points = 0;
|
|
186
|
+
},
|
|
187
|
+
"points"
|
|
188
|
+
],
|
|
189
|
+
[
|
|
190
|
+
"Points9",
|
|
191
|
+
(i) => {
|
|
192
|
+
i.points = 9;
|
|
193
|
+
},
|
|
194
|
+
"points"
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"missing behavior",
|
|
198
|
+
(i) => {
|
|
199
|
+
i.acceptanceCriteria[0].behavior = "";
|
|
200
|
+
},
|
|
201
|
+
"acceptance-criteria.fields"
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"missing verifiedBy",
|
|
205
|
+
(i) => {
|
|
206
|
+
i.acceptanceCriteria[0].verifiedBy = "";
|
|
207
|
+
},
|
|
208
|
+
"acceptance-criteria.fields"
|
|
209
|
+
],
|
|
210
|
+
[
|
|
211
|
+
"vague AC",
|
|
212
|
+
(i) => {
|
|
213
|
+
i.acceptanceCriteria[0].behavior = "The widget works correctly.";
|
|
214
|
+
},
|
|
215
|
+
"acceptance-criteria.vague"
|
|
216
|
+
],
|
|
217
|
+
[
|
|
218
|
+
"no non-goal",
|
|
219
|
+
(i) => {
|
|
220
|
+
i.outOfScope = [];
|
|
221
|
+
},
|
|
222
|
+
"out-of-scope"
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
"open question",
|
|
226
|
+
(i) => {
|
|
227
|
+
i.openQuestions = ["Choose the persistence behavior."];
|
|
228
|
+
},
|
|
229
|
+
"open-questions"
|
|
230
|
+
],
|
|
231
|
+
[
|
|
232
|
+
"vague title",
|
|
233
|
+
(i) => {
|
|
234
|
+
i.title = "Fix things";
|
|
235
|
+
},
|
|
236
|
+
"title.specific"
|
|
237
|
+
],
|
|
238
|
+
[
|
|
239
|
+
"long title",
|
|
240
|
+
(i) => {
|
|
241
|
+
i.title = "x".repeat(81);
|
|
242
|
+
},
|
|
243
|
+
"title.length"
|
|
244
|
+
],
|
|
245
|
+
[
|
|
246
|
+
"type prefix",
|
|
247
|
+
(i) => {
|
|
248
|
+
i.title = "Bug: Reject invalid widget identifiers";
|
|
249
|
+
},
|
|
250
|
+
"title.prefix"
|
|
251
|
+
],
|
|
252
|
+
[
|
|
253
|
+
"bug fields",
|
|
254
|
+
(i) => {
|
|
255
|
+
i.issueType = "Bug";
|
|
256
|
+
},
|
|
257
|
+
"bug"
|
|
258
|
+
],
|
|
259
|
+
[
|
|
260
|
+
"secret",
|
|
261
|
+
(i) => {
|
|
262
|
+
i.problem = "A fixture contains " + ["gh", "p_"].join("") + "A".repeat(24);
|
|
263
|
+
},
|
|
264
|
+
"secrets"
|
|
265
|
+
]
|
|
233
266
|
];
|
|
234
267
|
for (const [name, mutate, code] of blockingCases)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
268
|
+
test("Ready blocks " + name + " with a field and actionable fix hint", () => {
|
|
269
|
+
const issue = validIssue();
|
|
270
|
+
mutate(issue);
|
|
271
|
+
const failures = validateIssue(issue).failures;
|
|
272
|
+
assert.ok(
|
|
273
|
+
failures.some((f) => f.code === code),
|
|
274
|
+
JSON.stringify(failures)
|
|
275
|
+
);
|
|
276
|
+
assert.ok(failures.every((f) => f.field.length > 0 && f.fixHint.length > 10));
|
|
277
|
+
});
|
|
278
|
+
for (const field of ["steps", "expected", "actual", "reproducibility", "environment"])
|
|
279
|
+
test("Bug requires " + field, () => {
|
|
280
|
+
const issue = validIssue();
|
|
281
|
+
issue.issueType = "Bug";
|
|
282
|
+
issue.bug = {
|
|
283
|
+
steps: ["Submit an invalid identifier."],
|
|
284
|
+
expected: "No write.",
|
|
285
|
+
actual: "A write occurs.",
|
|
286
|
+
reproducibility: "Every invalid input.",
|
|
287
|
+
environment: "Synthetic server, Node24."
|
|
288
|
+
};
|
|
289
|
+
if (field === "steps") issue.bug.steps = [];
|
|
290
|
+
else issue.bug[field] = "";
|
|
291
|
+
assert.ok(validateIssue(issue).failures.some((f) => f.code === "bug." + field));
|
|
292
|
+
});
|
|
293
|
+
test("Ready is the default; explicit drafts park incomplete requirements without permitting secrets", () => {
|
|
294
|
+
assert.equal(requireIssue(validIssue()).draft, false);
|
|
295
|
+
assert.equal(ReadyIssue.safeParse({ title: "Investigate invalid widget identifiers", draft: true }).success, false);
|
|
296
|
+
const draft = requireIssue({ title: "Investigate invalid widget identifiers", draft: true });
|
|
297
|
+
assert.equal(draft.draft, true);
|
|
298
|
+
assert.match(renderIssueBody(draft), /Draft — parked/u);
|
|
299
|
+
assert.equal(DraftIssue.safeParse({ ...draft, problem: "password=" + "X".repeat(16) }).success, false);
|
|
266
300
|
});
|
|
267
|
-
test(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
301
|
+
test("independent Ready failures remain actionable together when native Points are missing", () => {
|
|
302
|
+
const failures = validateIssue({
|
|
303
|
+
title: "Investigate malformed widget identifiers",
|
|
304
|
+
issueType: "Bug",
|
|
305
|
+
problem: "A malformed identifier reaches storage.",
|
|
306
|
+
outcome: "Reject malformed identifiers.",
|
|
307
|
+
acceptanceCriteria: [],
|
|
308
|
+
outOfScope: [],
|
|
309
|
+
openQuestions: ["Choose the return shape."]
|
|
310
|
+
}).failures;
|
|
311
|
+
for (const code of ["points", "bug", "acceptance-criteria", "out-of-scope", "open-questions"])
|
|
312
|
+
assert.ok(failures.some((f) => f.code === code));
|
|
313
|
+
assert.equal(new Set(failures.map((f) => f.code + ":" + f.field)).size, failures.length);
|
|
280
314
|
});
|
|
281
315
|
const warningCases = [
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
316
|
+
[
|
|
317
|
+
"many criteria",
|
|
318
|
+
(i) => {
|
|
319
|
+
i.acceptanceCriteria = Array.from({ length: 8 }, () => ({ ...i.acceptanceCriteria[0] }));
|
|
320
|
+
},
|
|
321
|
+
"many-criteria"
|
|
322
|
+
],
|
|
323
|
+
[
|
|
324
|
+
"no edge case",
|
|
325
|
+
(i) => {
|
|
326
|
+
i.acceptanceCriteria[0].behavior = "A valid identifier produces exactly one persisted widget.";
|
|
327
|
+
},
|
|
328
|
+
"edge-case"
|
|
329
|
+
],
|
|
330
|
+
[
|
|
331
|
+
"Bug without regression",
|
|
332
|
+
(i) => {
|
|
333
|
+
i.issueType = "Bug";
|
|
334
|
+
i.bug = {
|
|
335
|
+
steps: ["Submit an invalid identifier."],
|
|
336
|
+
expected: "No write.",
|
|
337
|
+
actual: "A write occurs.",
|
|
338
|
+
reproducibility: "Every input.",
|
|
339
|
+
environment: "Synthetic server."
|
|
340
|
+
};
|
|
341
|
+
i.acceptanceCriteria[0].verifiedBy = "A mock asserts zero persistence calls.";
|
|
342
|
+
},
|
|
343
|
+
"bug.regression"
|
|
344
|
+
],
|
|
345
|
+
[
|
|
346
|
+
"no context",
|
|
347
|
+
(i) => {
|
|
348
|
+
i.context = { files: [], components: [], evidence: [] };
|
|
349
|
+
},
|
|
350
|
+
"context"
|
|
351
|
+
],
|
|
352
|
+
[
|
|
353
|
+
"only local evidence",
|
|
354
|
+
(i) => {
|
|
355
|
+
i.context.evidence = ["/synthetic/machine/proof.txt"];
|
|
356
|
+
i.acceptanceCriteria[0].verifiedBy = "/synthetic/machine/test.ts";
|
|
357
|
+
},
|
|
358
|
+
"local-evidence"
|
|
359
|
+
],
|
|
360
|
+
[
|
|
361
|
+
"long body",
|
|
362
|
+
(i) => {
|
|
363
|
+
i.context.evidence.push("A".repeat(4500));
|
|
364
|
+
},
|
|
365
|
+
"body.length"
|
|
366
|
+
]
|
|
333
367
|
];
|
|
334
368
|
for (const [name, mutate, code] of warningCases)
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
369
|
+
test("Warning does not block " + name, () => {
|
|
370
|
+
const issue = validIssue();
|
|
371
|
+
mutate(issue);
|
|
372
|
+
assert.equal(validateIssue(issue).failures.length, 0);
|
|
373
|
+
assert.ok(issueWarnings(issue).some((w) => w.code === code));
|
|
374
|
+
});
|
|
375
|
+
export {
|
|
376
|
+
validIssue
|
|
377
|
+
};
|
|
378
|
+
//# sourceMappingURL=issueContract.test.js.map
|