@aviaratech/ai-delivery 0.3.42 → 0.3.44
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 +2 -2
- package/dist/agentReadiness.test.js +27 -0
- package/dist/agentReadiness.test.js.map +2 -2
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +2 -2
- package/dist/contributorChecks.test.js +4 -1
- package/dist/contributorChecks.test.js.map +2 -2
- package/dist/currentConsumer.test.js +3 -2
- package/dist/currentConsumer.test.js.map +2 -2
- package/dist/currentTrackingScenario.test.js +3 -2
- package/dist/currentTrackingScenario.test.js.map +2 -2
- package/dist/directoryIndependent.test.js +22 -3
- package/dist/directoryIndependent.test.js.map +3 -3
- package/dist/dispatch.js.map +2 -2
- package/dist/fixtures/builderReady.d.ts +84 -0
- package/dist/fixtures/builderReady.js +58 -0
- package/dist/fixtures/builderReady.js.map +7 -0
- package/dist/fixtures/inertTarget.d.ts +82 -0
- package/dist/fixtures/inertTarget.js +25 -15
- package/dist/fixtures/inertTarget.js.map +2 -2
- package/dist/fixtures/issue63.d.ts +99 -0
- package/dist/fixtures/issue63.js +21 -2
- package/dist/fixtures/issue63.js.map +2 -2
- package/dist/issue.d.ts +23 -2
- package/dist/issue.js +154 -28
- package/dist/issue.js.map +2 -2
- package/dist/issue63Routes.test.js +3 -3
- package/dist/issue63Routes.test.js.map +2 -2
- package/dist/issueBlockerGuard.test.js +16 -5
- package/dist/issueBlockerGuard.test.js.map +2 -2
- package/dist/issueContract.d.ts +247 -2
- package/dist/issueContract.js +188 -24
- package/dist/issueContract.js.map +2 -2
- package/dist/issueContract.test.d.ts +21 -0
- package/dist/issueContract.test.js +276 -17
- package/dist/issueContract.test.js.map +2 -2
- package/dist/issueDates.test.js +5 -6
- package/dist/issueDates.test.js.map +2 -2
- package/dist/issueInfoReadback.test.js +64 -0
- package/dist/issueInfoReadback.test.js.map +2 -2
- package/dist/issueIntake.test.js +190 -35
- package/dist/issueIntake.test.js.map +2 -2
- package/dist/issueJournal.d.ts +13 -9
- package/dist/issueJournal.js +14 -10
- package/dist/issueJournal.js.map +2 -2
- package/dist/issueJournal.test.js +11 -8
- package/dist/issueJournal.test.js.map +2 -2
- package/dist/issueTracking.test.js +135 -2
- package/dist/issueTracking.test.js.map +3 -3
- package/dist/issueWriteRecovery.test.js +12 -12
- package/dist/issueWriteRecovery.test.js.map +2 -2
- package/dist/mcp/index.js +10 -3
- package/dist/mcp/index.js.map +2 -2
- package/dist/mcp/tools.d.ts +186 -27
- package/dist/mcp/tools.js +25 -7
- package/dist/mcp/tools.js.map +2 -2
- package/dist/pluginPackaging.test.js +6 -3
- package/dist/pluginPackaging.test.js.map +2 -2
- package/dist/readView.d.ts +3 -0
- package/dist/readView.js +1 -1
- package/dist/readView.js.map +2 -2
- package/dist/releaseReconciliation.test.js +20 -6
- package/dist/releaseReconciliation.test.js.map +2 -2
- package/dist/releaseWorkflow.test.js +2 -2
- package/dist/releaseWorkflow.test.js.map +2 -2
- package/dist/review.d.ts +8 -0
- package/dist/review.js +30 -2
- package/dist/review.js.map +2 -2
- package/dist/review.test.js +64 -1
- package/dist/review.test.js.map +2 -2
- package/dist/services/agentReadinessService.d.ts +2 -1
- package/dist/services/agentReadinessService.js +6 -0
- package/dist/services/agentReadinessService.js.map +2 -2
- package/dist/stdoutRegression.test.js +27 -15
- package/dist/stdoutRegression.test.js.map +2 -2
- package/dist/targetRepositoryExecution.test.js +11 -3
- package/dist/targetRepositoryExecution.test.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 +156 -124
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/plugins/ai-delivery/skills/intake-create/SKILL.md +1 -11
- package/plugins/ai-delivery/skills/ticket-design/SKILL.md +30 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/issueWriteRecovery.test.ts"],
|
|
4
|
-
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { test } from 'vitest';\nimport { createIssue, CreatedTrackingIssueError, canonicalIssueBody } from './issue.js';\nimport { issue63Fixture } from './fixtures/issue63.js';\nimport { parseIssueBody, validateIssue } from './issueContract.js';\nimport { inertTarget, fixtureFields } from './fixtures/inertTarget.js';\n\nfunction fixture() {\n const f = issue63Fixture();\n let parent: number | null = null;\n let parentCleared = false;\n const nativeValues = new Map<number, Record<string, string>>();\n const rest = f.context.clients.rest;\n const originalRequest = rest.request.bind(rest);\n const originalGraphql = f.context.clients.graphql;\n const recovery = { member: false, failProject: false, lostCreateResponse: false };\n rest.paginate = (async () => (parent === 19 ? [f.rows.get(20)!] : [])) as unknown as typeof rest.paginate;\n rest.issues.addSubIssue = (async () => {\n f.writes.push('parent');\n parent = 19;\n return { data: {} };\n }) as unknown as typeof rest.issues.addSubIssue;\n rest.request = (async (\n route: string,\n args: { issue_number?: number; issue_field_values?: { field_id: number; value: string }[] },\n ) => {\n if (route.includes('/orgs/')) {\n const result = await originalRequest(route, args);\n return { data: [...(result.data as unknown[]), { id: 103, name: 'Start date', data_type: 'date' }] };\n }\n if (args.issue_number === 20) {\n const values = nativeValues.get(20)!;\n if (route.startsWith('POST')) {\n f.writes.push('metadata');\n for (const field of args.issue_field_values ?? []) values[String(field.field_id)] = field.value;\n }\n return {\n data: Object.entries(values).map(([id, value]) => ({\n issue_field_id: Number(id),\n issue_field_name: id === '101' ? 'Estimate' : id === '102' ? 'Urgency' : 'Start date',\n data_type: id === '103' ? 'date' : 'single_select',\n value,\n })),\n };\n }\n if (route.startsWith('DELETE')) {\n parentCleared = true;\n return { data: [] };\n }\n if (parentCleared && args.issue_number === 19) return { data: [] };\n return originalRequest(route, args);\n }) as typeof rest.request;\n f.context.clients.graphql = (async (query: string, variables: Record<string, unknown>) => {\n if (query.includes('AddProjectDeliveryItem')) {\n recovery.member = true;\n f.writes.push('membership');\n return { addProjectV2ItemById: { item: { id: 'ITEM20' } } };\n }\n if (query.includes('UpdateProjectDeliveryStatus') && recovery.failProject)\n throw new Error('Synthetic Project write failure');\n const result = (await originalGraphql(query, variables)) as {\n repository: { issue: { parent: unknown; blockedBy: { nodes: { number: number; state: string }[] } } };\n node: { projectItems: { nodes: { id: string }[] } };\n };\n if (query.includes('ProjectDeliveryIssueItems') && !recovery.member)\n result.node.projectItems.nodes = result.node.projectItems.nodes.filter((row) => row.id !== 'ITEM20');\n if (query.includes('blockedBy(first:'))\n for (const blocker of result.repository.issue.blockedBy.nodes)\n blocker.state = f.rows.get(blocker.number)!.state.toUpperCase();\n if (query.includes('blockedBy(first:') && variables.number === 20 && parent !== null)\n result.repository.issue.parent = {\n id: 'ISSUE19',\n number: parent,\n repository: { nameWithOwner: 'example/widget' },\n };\n return result;\n }) as typeof originalGraphql;\n const originalCreate = rest.issues.create.bind(rest.issues);\n rest.issues.create = (async (input: Parameters<typeof originalCreate>[0]) => {\n const result = await originalCreate(input);\n Object.assign(f.rows.get(result.data.number)!, { user: { login: 'operator' } });\n nativeValues.set(result.data.number, {});\n if (recovery.lostCreateResponse) throw new Error('Synthetic lost creation response');\n return result;\n }) as typeof rest.issues.create;\n return { ...f, recovery, nativeValues, parent: () => parent };\n}\n\nconst intent = { opId: 'synthetic-187', parentIssueNumber: 19, blockedBy: [18] };\n\ntest('create establishes Project status before parent and blockers and reuses completed opId', async () => {\n const f = fixture();\n const input = { ...f.ready, ...intent };\n const result = await createIssue(f.context, input);\n assert.equal(result.created.number, 20);\n assert.equal(f.parent(), 19);\n assert.deepEqual([...f.edges.get(20)!], [18]);\n assert.ok(f.writes.indexOf('membership') < f.writes.indexOf('status'));\n assert.ok(f.writes.indexOf('status') < f.writes.indexOf('parent'));\n const writes = [...f.writes];\n await createIssue(f.context, input);\n assert.equal(f.writes.filter((x) => x === 'create').length, 1);\n assert.deepEqual(f.writes, writes, 'a completed retry must not repeat native writes');\n});\n\ntest('same opId completes a failed dependency step once and identifies remaining work', async () => {\n const f = fixture();\n f.controls.failAdd = true;\n const input = { ...f.ready, ...intent };\n await assert.rejects(createIssue(f.context, input), (error) => {\n assert.ok(error instanceof CreatedTrackingIssueError);\n assert.equal(error.created.number, 20);\n assert.match(error.message, /blockers/u);\n assert.match(error.message, /opId/u);\n return true;\n });\n f.controls.failAdd = false;\n await createIssue(f.context, input);\n assert.equal(f.writes.filter((x) => x === 'create').length, 1);\n assert.equal(f.writes.filter((x) => x === 'parent').length, 1);\n assert.equal(f.writes.filter((x) => x === 'add').length, 1);\n});\n\ntest('opId refuses changed intent, duplicate markers and foreign authors without writes', async () => {\n for (const mode of ['intent', 'duplicate', 'author'] as const) {\n const f = fixture();\n const input = { ...f.ready, ...intent };\n await createIssue(f.context, input);\n if (mode === 'duplicate') f.rows.set(21, { ...f.rows.get(20)!, number: 21 });\n if (mode === 'author') Object.assign(f.rows.get(20)!, { user: { login: 'someone-else' } });\n const writes = [...f.writes];\n await assert.rejects(\n createIssue(f.context, { ...input, ...(mode === 'intent' ? { priority: 'High' } : {}) }),\n /conflict|author/iu,\n );\n assert.deepEqual(f.writes, writes);\n }\n});\n\ntest('epic true is an unsized Ready contract and survives canonical roundtrip', () => {\n const f = fixture();\n const { points: _points, ...ready } = f.ready;\n const result = validateIssue({ ...ready, issueType: 'Feature', epic: true }, true);\n assert.equal(result.failures.length, 0, JSON.stringify(result.failures));\n assert.ok(result.issue);\n // Canonical body generation must not force an epic to become a parked draft.\n const input = { ...ready, issueType: 'Feature', epic: true as const };\n const body = canonicalIssueBody(input);\n assert.match(body, /## Status\\n\\nReady/u);\n assert.doesNotMatch(body, /Draft \u2014 parked/u);\n assert.equal(Reflect.get(parseIssueBody(body, { title: ready.title }).issue, 'epic'), true);\n assert.equal(\n validateIssue(ready, true).failures.some((x) => x.code === 'points'),\n true,\n );\n});\n\ntest.each(['project', 'acknowledgement'] as const)(\n 'same opId resumes after %s failure without another issue',\n async (stage) => {\n const f = fixture();\n const input = { ...f.ready, ...intent };\n f.recovery.failProject = stage === 'project';\n f.recovery.lostCreateResponse = stage === 'acknowledgement';\n await assert.rejects(\n createIssue(f.context, input),\n stage === 'project' ? /Failed step: project/u : /lost creation response/u,\n );\n f.recovery.failProject = false;\n f.recovery.lostCreateResponse = false;\n await createIssue(f.context, input);\n assert.equal(f.writes.filter((x) => x === 'create').length, 1);\n assert.equal(f.writes.filter((x) => x === 'membership').length, 1);\n assert.equal(f.parent(), 19);\n assert.deepEqual([...f.edges.get(20)!], [18]);\n },\n);\n\ntest.each(['completed', 'partial'] as const)(\n 'create retry preserves independently changed native values after %s operation',\n async (stage) => {\n for (const [field, value] of [\n ['101', '4'],\n ['102', 'Low'],\n ['103', '2026-02-02'],\n ] as const) {\n const f = fixture();\n const input = { ...f.ready, ...intent, priority: 'High', startDate: '2026-01-01' };\n f.controls.failAdd = stage === 'partial';\n if (stage === 'partial') await assert.rejects(createIssue(f.context, input));\n else await createIssue(f.context, input);\n f.controls.failAdd = false;\n f.nativeValues.get(20)![field] = value;\n const writes = [...f.writes];\n await assert.rejects(createIssue(f.context, input), /conflict/iu);\n assert.equal(f.nativeValues.get(20)![field], value);\n assert.deepEqual(f.writes, writes);\n }\n },\n);\n\ntest('partial create reports only the requested remaining operations', async () => {\n const f = fixture();\n f.recovery.failProject = true;\n await assert.rejects(createIssue(f.context, { ...f.ready, opId: 'synthetic-simple' }), (error) => {\n assert.ok(error instanceof CreatedTrackingIssueError);\n assert.deepEqual(error.remainingSteps, ['project', 'readback']);\n return true;\n });\n});\n\ntest('same opId preserves independently added closed blocker relationships', async () => {\n const f = fixture();\n const input = { ...f.ready, ...intent };\n await createIssue(f.context, input);\n f.rows.get(19)!.state = 'closed';\n f.edges.get(20)!.add(19);\n const writes = [...f.writes];\n await assert.rejects(createIssue(f.context, input), /conflict/iu);\n assert.deepEqual([...f.edges.get(20)!], [18, 19]);\n assert.deepEqual(f.writes, writes);\n});\n\nfor (const mode of ['partial', 'epic'] as const) {\n test(`MCP ${mode} create retains retry identity across compact and verbose output`, async ({ signal }) => {\n const f = inertTarget(signal);\n const originalGet = f.rest.issues.get;\n f.rest.issues.get = async (input) => ({\n data: { ...(await originalGet(input)).data, user: { login: 'operator' } },\n });\n const originalList = f.rest.issues.listForRepo;\n f.rest.issues.listForRepo = async (input) => ({\n data: (await originalList(input)).data.map((row) => ({ ...row, user: { login: 'operator' } })),\n });\n const originalRequest = f.rest.request;\n let fail = mode === 'partial';\n f.rest.request = async (route, args) => {\n const result = await originalRequest(route, args);\n if (fail && route.startsWith('POST') && route.includes('/issue-field-values')) {\n fail = false;\n throw new Error('Synthetic metadata acknowledgement lost');\n }\n return result;\n };\n const { points: _points, ...unsized } = fixtureFields;\n const input = { ...(mode === 'epic' ? { ...unsized, epic: true } : fixtureFields), opId: `synthetic-mcp-${mode}` };\n const connection = await f.connect();\n try {\n if (mode === 'partial') {\n const partial = await connection.call('issue_create', input);\n assert.equal(partial.response.isError, true);\n assert.match(partial.text, /Issue #17.*Failed step: metadata.*same opId/u);\n }\n const compact = await connection.call('issue_create', input);\n assert.notEqual(compact.response.isError, true, compact.text);\n assert.deepEqual(compact.value?.created, {\n number: 17,\n title: fixtureFields.title,\n url: 'https://github.com/example/widget/issues/17',\n });\n assert.equal(Object.hasOwn(compact.value!, 'body'), false);\n assert.ok(Array.isArray(compact.value?.warnings));\n const verbose = await connection.call('issue_create', { ...input, verbose: true });\n assert.notEqual(verbose.response.isError, true, verbose.text);\n assert.match(String(verbose.value?.body), /State:\\*\\* Ready/u);\n if (mode === 'epic')\n assert.equal(parseIssueBody(String(verbose.value?.body), { title: fixtureFields.title }).issue.epic, true);\n assert.equal(f.calls.filter((call) => call.name === 'issues.create').length, 1);\n assert.equal(\n f.calls.filter((call) => call.name.startsWith('POST') && call.name.includes('/issue-field-values')).length,\n mode === 'partial' ? 1 : 0,\n );\n } finally {\n await f.dispose(connection);\n }\n });\n}\n\n// Nov 1 2026 (#277): aviaratech/ai has about 3,900 issues and PRs, so the retry search never reached a short page.\ntest('MCP create with a fresh opId on a busy repository creates, and a same-opId retry reuses it', async ({\n signal,\n}) => {\n const f = inertTarget(signal);\n const originalList = f.rest.issues.listForRepo;\n const filler = (page: number, size: number) =>\n Array.from({ length: size }, (_, index) => ({\n number: 1000 + page * 100 + index,\n title: 'Unrelated work',\n body: 'No create marker.',\n state: 'open',\n user: { login: 'operator' },\n ...(index % 2 === 0 ? { pull_request: {} } : {}),\n }));\n f.rest.issues.listForRepo = async (input) => {\n const page = input.page ?? 1;\n const head = page === 1 ? (await originalList(input)).data.filter((row) => row.number === 17) : [];\n return {\n data: [...head.map((row) => ({ ...row, user: { login: 'operator' } })), ...filler(page, 100 - head.length)],\n } as Awaited<ReturnType<typeof originalList>>;\n };\n const originalGet = f.rest.issues.get;\n f.rest.issues.get = async (input) => ({ data: { ...(await originalGet(input)).data, user: { login: 'operator' } } });\n const input = { ...fixtureFields, opId: 'synthetic-busy-repo' };\n const connection = await f.connect();\n try {\n const first = await connection.call('issue_create', input);\n assert.notEqual(first.response.isError, true, first.text);\n assert.equal(first.value?.created && (first.value.created as { number: number }).number, 17);\n const retry = await connection.call('issue_create', input);\n assert.notEqual(retry.response.isError, true, retry.text);\n assert.equal(f.calls.filter((call) => call.name === 'issues.create').length, 1);\n } finally {\n await f.dispose(connection);\n }\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,YAAY;AACrB,SAAS,aAAa,2BAA2B,0BAA0B;AAC3E,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,qBAAqB;AAC9C,SAAS,aAAa,
|
|
4
|
+
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { test } from 'vitest';\nimport { createIssue, CreatedTrackingIssueError, canonicalIssueBody } from './issue.js';\nimport { issue63Fixture } from './fixtures/issue63.js';\nimport { parseIssueBody, validateIssue } from './issueContract.js';\nimport { inertTarget, fixtureFields, createFields } from './fixtures/inertTarget.js';\n\nfunction fixture() {\n const f = issue63Fixture();\n let parent: number | null = null;\n let parentCleared = false;\n const nativeValues = new Map<number, Record<string, string>>();\n const rest = f.context.clients.rest;\n const originalRequest = rest.request.bind(rest);\n const originalGraphql = f.context.clients.graphql;\n const recovery = { member: false, failProject: false, lostCreateResponse: false };\n rest.paginate = (async () => (parent === 19 ? [f.rows.get(20)!] : [])) as unknown as typeof rest.paginate;\n rest.issues.addSubIssue = (async () => {\n f.writes.push('parent');\n parent = 19;\n return { data: {} };\n }) as unknown as typeof rest.issues.addSubIssue;\n rest.request = (async (\n route: string,\n args: { issue_number?: number; issue_field_values?: { field_id: number; value: string }[] },\n ) => {\n if (route.includes('/orgs/')) {\n const result = await originalRequest(route, args);\n return { data: [...(result.data as unknown[]), { id: 103, name: 'Start date', data_type: 'date' }] };\n }\n if (args.issue_number === 20) {\n const values = nativeValues.get(20)!;\n if (route.startsWith('POST')) {\n f.writes.push('metadata');\n for (const field of args.issue_field_values ?? []) values[String(field.field_id)] = field.value;\n }\n return {\n data: Object.entries(values).map(([id, value]) => ({\n issue_field_id: Number(id),\n issue_field_name: id === '101' ? 'Estimate' : id === '102' ? 'Urgency' : 'Start date',\n data_type: id === '103' ? 'date' : 'single_select',\n value,\n })),\n };\n }\n if (route.startsWith('DELETE')) {\n parentCleared = true;\n return { data: [] };\n }\n if (parentCleared && args.issue_number === 19) return { data: [] };\n return originalRequest(route, args);\n }) as typeof rest.request;\n f.context.clients.graphql = (async (query: string, variables: Record<string, unknown>) => {\n if (query.includes('AddProjectDeliveryItem')) {\n recovery.member = true;\n f.writes.push('membership');\n return { addProjectV2ItemById: { item: { id: 'ITEM20' } } };\n }\n if (query.includes('UpdateProjectDeliveryStatus') && recovery.failProject)\n throw new Error('Synthetic Project write failure');\n const result = (await originalGraphql(query, variables)) as {\n repository: { issue: { parent: unknown; blockedBy: { nodes: { number: number; state: string }[] } } };\n node: { projectItems: { nodes: { id: string }[] } };\n };\n if (query.includes('ProjectDeliveryIssueItems') && !recovery.member)\n result.node.projectItems.nodes = result.node.projectItems.nodes.filter((row) => row.id !== 'ITEM20');\n if (query.includes('blockedBy(first:'))\n for (const blocker of result.repository.issue.blockedBy.nodes)\n blocker.state = f.rows.get(blocker.number)!.state.toUpperCase();\n if (query.includes('blockedBy(first:') && variables.number === 20 && parent !== null)\n result.repository.issue.parent = {\n id: 'ISSUE19',\n number: parent,\n repository: { nameWithOwner: 'example/widget' },\n };\n return result;\n }) as typeof originalGraphql;\n const originalCreate = rest.issues.create.bind(rest.issues);\n rest.issues.create = (async (input: Parameters<typeof originalCreate>[0]) => {\n const result = await originalCreate(input);\n Object.assign(f.rows.get(result.data.number)!, { user: { login: 'operator' } });\n nativeValues.set(result.data.number, {});\n if (recovery.lostCreateResponse) throw new Error('Synthetic lost creation response');\n return result;\n }) as typeof rest.issues.create;\n return { ...f, recovery, nativeValues, parent: () => parent };\n}\n\nconst intent = { opId: 'synthetic-187', parentIssueNumber: 19, blockedBy: [18] };\n\ntest('create establishes Project status before parent and blockers and reuses completed opId', async () => {\n const f = fixture();\n const input = { ...f.createInput, ...intent };\n const result = await createIssue(f.context, input);\n assert.equal(result.created.number, 20);\n assert.equal(f.parent(), 19);\n assert.deepEqual([...f.edges.get(20)!], [18]);\n assert.ok(f.writes.indexOf('membership') < f.writes.indexOf('status'));\n assert.ok(f.writes.indexOf('status') < f.writes.indexOf('parent'));\n const writes = [...f.writes];\n await createIssue(f.context, input);\n assert.equal(f.writes.filter((x) => x === 'create').length, 1);\n assert.deepEqual(f.writes, writes, 'a completed retry must not repeat native writes');\n});\n\ntest('same opId completes a failed dependency step once and identifies remaining work', async () => {\n const f = fixture();\n f.controls.failAdd = true;\n const input = { ...f.createInput, ...intent };\n await assert.rejects(createIssue(f.context, input), (error) => {\n assert.ok(error instanceof CreatedTrackingIssueError);\n assert.equal(error.created.number, 20);\n assert.match(error.message, /blockers/u);\n assert.match(error.message, /opId/u);\n return true;\n });\n f.controls.failAdd = false;\n await createIssue(f.context, input);\n assert.equal(f.writes.filter((x) => x === 'create').length, 1);\n assert.equal(f.writes.filter((x) => x === 'parent').length, 1);\n assert.equal(f.writes.filter((x) => x === 'add').length, 1);\n});\n\ntest('opId refuses changed intent, duplicate markers and foreign authors without writes', async () => {\n for (const mode of ['intent', 'duplicate', 'author'] as const) {\n const f = fixture();\n const input = { ...f.createInput, ...intent };\n await createIssue(f.context, input);\n if (mode === 'duplicate') f.rows.set(21, { ...f.rows.get(20)!, number: 21 });\n if (mode === 'author') Object.assign(f.rows.get(20)!, { user: { login: 'someone-else' } });\n const writes = [...f.writes];\n await assert.rejects(\n createIssue(f.context, { ...input, ...(mode === 'intent' ? { priority: 'Low' } : {}) }),\n /conflict|author/iu,\n );\n assert.deepEqual(f.writes, writes);\n }\n});\n\ntest('epic true is an unsized Ready contract and survives canonical roundtrip', () => {\n const f = fixture();\n const { points: _points, ...ready } = f.ready;\n const result = validateIssue({ ...ready, issueType: 'Feature', epic: true }, true);\n assert.equal(result.failures.length, 0, JSON.stringify(result.failures));\n assert.ok(result.issue);\n // Canonical body generation must not force an epic to become a parked draft.\n const input = { ...ready, issueType: 'Feature', epic: true as const };\n const body = canonicalIssueBody(input);\n assert.match(body, /## Status\\n\\nReady/u);\n assert.doesNotMatch(body, /Draft \u2014 parked/u);\n assert.equal(Reflect.get(parseIssueBody(body, { title: ready.title }).issue, 'epic'), true);\n assert.equal(\n validateIssue(ready, true).failures.some((x) => x.code === 'points'),\n true,\n );\n});\n\ntest.each(['project', 'acknowledgement'] as const)(\n 'same opId resumes after %s failure without another issue',\n async (stage) => {\n const f = fixture();\n const input = { ...f.createInput, ...intent };\n f.recovery.failProject = stage === 'project';\n f.recovery.lostCreateResponse = stage === 'acknowledgement';\n await assert.rejects(\n createIssue(f.context, input),\n stage === 'project' ? /Failed step: project/u : /lost creation response/u,\n );\n f.recovery.failProject = false;\n f.recovery.lostCreateResponse = false;\n await createIssue(f.context, input);\n assert.equal(f.writes.filter((x) => x === 'create').length, 1);\n assert.equal(f.writes.filter((x) => x === 'membership').length, 1);\n assert.equal(f.parent(), 19);\n assert.deepEqual([...f.edges.get(20)!], [18]);\n },\n);\n\ntest.each(['completed', 'partial'] as const)(\n 'create retry preserves independently changed native values after %s operation',\n async (stage) => {\n for (const [field, value] of [\n ['101', '4'],\n ['102', 'Low'],\n ['103', '2026-02-02'],\n ] as const) {\n const f = fixture();\n const input = { ...f.createInput, ...intent, priority: 'High', startDate: '2026-01-01' };\n f.controls.failAdd = stage === 'partial';\n if (stage === 'partial') await assert.rejects(createIssue(f.context, input));\n else await createIssue(f.context, input);\n f.controls.failAdd = false;\n f.nativeValues.get(20)![field] = value;\n const writes = [...f.writes];\n await assert.rejects(createIssue(f.context, input), /conflict/iu);\n assert.equal(f.nativeValues.get(20)![field], value);\n assert.deepEqual(f.writes, writes);\n }\n },\n);\n\ntest('partial create reports only the requested remaining operations', async () => {\n const f = fixture();\n f.recovery.failProject = true;\n await assert.rejects(createIssue(f.context, { ...f.createInput, opId: 'synthetic-simple' }), (error) => {\n assert.ok(error instanceof CreatedTrackingIssueError);\n assert.deepEqual(error.remainingSteps, ['project', 'readback']);\n return true;\n });\n});\n\ntest('same opId preserves independently added closed blocker relationships', async () => {\n const f = fixture();\n const input = { ...f.createInput, ...intent };\n await createIssue(f.context, input);\n f.rows.get(19)!.state = 'closed';\n f.edges.get(20)!.add(19);\n const writes = [...f.writes];\n await assert.rejects(createIssue(f.context, input), /conflict/iu);\n assert.deepEqual([...f.edges.get(20)!], [18, 19]);\n assert.deepEqual(f.writes, writes);\n});\n\nfor (const mode of ['partial', 'epic'] as const) {\n test(`MCP ${mode} create retains retry identity across compact and verbose output`, async ({ signal }) => {\n const f = inertTarget(signal);\n const originalGet = f.rest.issues.get;\n f.rest.issues.get = async (input) => ({\n data: { ...(await originalGet(input)).data, user: { login: 'operator' } },\n });\n const originalList = f.rest.issues.listForRepo;\n f.rest.issues.listForRepo = async (input) => ({\n data: (await originalList(input)).data.map((row) => ({ ...row, user: { login: 'operator' } })),\n });\n const originalRequest = f.rest.request;\n let fail = mode === 'partial';\n f.rest.request = async (route, args) => {\n const result = await originalRequest(route, args);\n if (fail && route.startsWith('POST') && route.includes('/issue-field-values')) {\n fail = false;\n throw new Error('Synthetic metadata acknowledgement lost');\n }\n return result;\n };\n const { points: _points, priority: _priority, ...unsized } = createFields;\n const input = { ...(mode === 'epic' ? { ...unsized, epic: true } : createFields), opId: `synthetic-mcp-${mode}` };\n const connection = await f.connect();\n try {\n if (mode === 'partial') {\n const partial = await connection.call('issue_create', input);\n assert.equal(partial.response.isError, true);\n assert.match(partial.text, /Issue #17.*Failed step: metadata.*same opId/u);\n }\n const compact = await connection.call('issue_create', input);\n assert.notEqual(compact.response.isError, true, compact.text);\n assert.deepEqual(compact.value?.created, {\n number: 17,\n title: fixtureFields.title,\n url: 'https://github.com/example/widget/issues/17',\n });\n assert.equal(Object.hasOwn(compact.value!, 'body'), false);\n assert.ok(Array.isArray(compact.value?.warnings));\n const verbose = await connection.call('issue_create', { ...input, verbose: true });\n assert.notEqual(verbose.response.isError, true, verbose.text);\n assert.match(String(verbose.value?.body), /State:\\*\\* Ready/u);\n if (mode === 'epic')\n assert.equal(parseIssueBody(String(verbose.value?.body), { title: fixtureFields.title }).issue.epic, true);\n assert.equal(f.calls.filter((call) => call.name === 'issues.create').length, 1);\n assert.equal(\n f.calls.filter((call) => call.name.startsWith('POST') && call.name.includes('/issue-field-values')).length,\n mode === 'partial' ? 1 : 0,\n );\n } finally {\n await f.dispose(connection);\n }\n });\n}\n\n// Nov 1 2026 (#277): aviaratech/ai has about 3,900 issues and PRs, so the retry search never reached a short page.\ntest('MCP create with a fresh opId on a busy repository creates, and a same-opId retry reuses it', async ({\n signal,\n}) => {\n const f = inertTarget(signal);\n const originalList = f.rest.issues.listForRepo;\n const filler = (page: number, size: number) =>\n Array.from({ length: size }, (_, index) => ({\n number: 1000 + page * 100 + index,\n title: 'Unrelated work',\n body: 'No create marker.',\n state: 'open',\n user: { login: 'operator' },\n ...(index % 2 === 0 ? { pull_request: {} } : {}),\n }));\n f.rest.issues.listForRepo = async (input) => {\n const page = input.page ?? 1;\n const head = page === 1 ? (await originalList(input)).data.filter((row) => row.number === 17) : [];\n return {\n data: [...head.map((row) => ({ ...row, user: { login: 'operator' } })), ...filler(page, 100 - head.length)],\n } as Awaited<ReturnType<typeof originalList>>;\n };\n const originalGet = f.rest.issues.get;\n f.rest.issues.get = async (input) => ({ data: { ...(await originalGet(input)).data, user: { login: 'operator' } } });\n const input = { ...createFields, opId: 'synthetic-busy-repo' };\n const connection = await f.connect();\n try {\n const first = await connection.call('issue_create', input);\n assert.notEqual(first.response.isError, true, first.text);\n assert.equal(first.value?.created && (first.value.created as { number: number }).number, 17);\n const retry = await connection.call('issue_create', input);\n assert.notEqual(retry.response.isError, true, retry.text);\n assert.equal(f.calls.filter((call) => call.name === 'issues.create').length, 1);\n } finally {\n await f.dispose(connection);\n }\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,YAAY;AACrB,SAAS,aAAa,2BAA2B,0BAA0B;AAC3E,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,qBAAqB;AAC9C,SAAS,aAAa,eAAe,oBAAoB;AAEzD,SAAS,UAAU;AACjB,QAAM,IAAI,eAAe;AACzB,MAAI,SAAwB;AAC5B,MAAI,gBAAgB;AACpB,QAAM,eAAe,oBAAI,IAAoC;AAC7D,QAAM,OAAO,EAAE,QAAQ,QAAQ;AAC/B,QAAM,kBAAkB,KAAK,QAAQ,KAAK,IAAI;AAC9C,QAAM,kBAAkB,EAAE,QAAQ,QAAQ;AAC1C,QAAM,WAAW,EAAE,QAAQ,OAAO,aAAa,OAAO,oBAAoB,MAAM;AAChF,OAAK,YAAY,YAAa,WAAW,KAAK,CAAC,EAAE,KAAK,IAAI,EAAE,CAAE,IAAI,CAAC;AACnE,OAAK,OAAO,eAAe,YAAY;AACrC,MAAE,OAAO,KAAK,QAAQ;AACtB,aAAS;AACT,WAAO,EAAE,MAAM,CAAC,EAAE;A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
6
6
|
"names": ["input"]
|
|
7
7
|
}
|
package/dist/mcp/index.js
CHANGED
|
@@ -5,7 +5,12 @@ import { executeTool } from "../dispatch.js";
|
|
|
5
5
|
import { setLogsSuppressed } from "../logger.js";
|
|
6
6
|
import { PACKAGE_VERSION } from "../version.js";
|
|
7
7
|
import { acceptedKeysError } from "../issueContract.js";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
JOURNAL_SCHEMA_METADATA,
|
|
10
|
+
NEXT_DATE_REFUSAL,
|
|
11
|
+
PLAIN_COMMENT_REFUSAL,
|
|
12
|
+
missingJournalFields
|
|
13
|
+
} from "../issueJournal.js";
|
|
9
14
|
import { getIncompleteIssueUpdate } from "../issue.js";
|
|
10
15
|
import { projectToolOutput } from "../toolOutput.js";
|
|
11
16
|
import { AI_DELIVERY_MCP_TOOLS } from "./tools.js";
|
|
@@ -31,12 +36,14 @@ function createAiDeliveryMcpServer(context, activeCalls) {
|
|
|
31
36
|
async (args, extra) => {
|
|
32
37
|
const parsed = tool.inputSchema.safeParse(args);
|
|
33
38
|
if (!parsed.success) {
|
|
34
|
-
const
|
|
39
|
+
const journal = tool.name === "issue_comment";
|
|
40
|
+
const missing = journal && args.body === void 0 ? missingJournalFields(args) : [];
|
|
41
|
+
const stated = journal ? parsed.error.issues.map((issue) => issue.message).filter((m) => [NEXT_DATE_REFUSAL, PLAIN_COMMENT_REFUSAL].includes(m)) : [];
|
|
35
42
|
return {
|
|
36
43
|
content: [
|
|
37
44
|
{
|
|
38
45
|
type: "text",
|
|
39
|
-
text: `Invalid arguments for ${tool.name}.${missing.length ? ` Missing required fields: ${missing.join(", ")}. Provide every missing field.` :
|
|
46
|
+
text: `Invalid arguments for ${tool.name}.${missing.length ? ` Missing required fields: ${missing.join(", ")}. Provide every missing field.` : stated.length ? ` ${stated.join(" ")}` : journal ? ` ${tool.description}` : ""}`
|
|
40
47
|
}
|
|
41
48
|
],
|
|
42
49
|
isError: true
|
package/dist/mcp/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mcp/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\n\nimport { executeTool, type ExecutionContext } from '../dispatch.js';\nimport { setLogsSuppressed } from '../logger.js';\nimport { PACKAGE_VERSION } from '../version.js';\nimport { acceptedKeysError } from '../issueContract.js';\nimport {
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAElB,SAAS,mBAA0C;AACnD,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,
|
|
4
|
+
"sourcesContent": ["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\n\nimport { executeTool, type ExecutionContext } from '../dispatch.js';\nimport { setLogsSuppressed } from '../logger.js';\nimport { PACKAGE_VERSION } from '../version.js';\nimport { acceptedKeysError } from '../issueContract.js';\nimport {\n JOURNAL_SCHEMA_METADATA,\n NEXT_DATE_REFUSAL,\n PLAIN_COMMENT_REFUSAL,\n missingJournalFields,\n} from '../issueJournal.js';\nimport { getIncompleteIssueUpdate } from '../issue.js';\nimport { projectToolOutput } from '../toolOutput.js';\nimport { AI_DELIVERY_MCP_TOOLS, type AiDeliveryMcpToolName } from './tools.js';\n\nexport { AI_DELIVERY_MCP_CONTRACT_VERSION, AI_DELIVERY_MCP_TOOLS } from './tools.js';\n\nconst SERVER_INSTRUCTIONS =\n 'Use issue_info with an explicit repo; follow repository policy for checks and authorization, and respect requested providers and read-only intent.';\n\nexport function createAiDeliveryMcpServer(context: ExecutionContext, activeCalls?: Set<Promise<unknown>>): McpServer {\n const server = new McpServer(\n { name: 'ai-delivery', version: PACKAGE_VERSION },\n { instructions: SERVER_INSTRUCTIONS },\n );\n const tools: readonly {\n name: string;\n description: string;\n inputSchema: z.ZodObject<z.ZodRawShape>;\n readOnly?: true;\n }[] = AI_DELIVERY_MCP_TOOLS;\n for (const tool of tools) {\n server.registerTool(\n tool.name,\n {\n description: tool.description,\n ...(tool.readOnly ? { annotations: { readOnlyHint: true } } : {}),\n // The SDK must leave journal kind refinements to the handler so missing\n // conditional fields receive a safe, actionable contract refusal. Unknown\n // property names stay private through a schema-local error message.\n inputSchema:\n tool.name === 'issue_comment'\n ? z\n .strictObject(tool.inputSchema.shape, { error: acceptedKeysError })\n .partial()\n .meta(JOURNAL_SCHEMA_METADATA)\n : tool.inputSchema,\n },\n async (args, extra) => {\n const parsed = tool.inputSchema.safeParse(args);\n if (!parsed.success) {\n const journal = tool.name === 'issue_comment';\n const missing = journal && args.body === undefined ? missingJournalFields(args) : [];\n // A missing-field list comes first; these refusals already say what to send, so they replace the generic text.\n const stated = journal\n ? parsed.error.issues\n .map((issue) => issue.message)\n .filter((m) => [NEXT_DATE_REFUSAL, PLAIN_COMMENT_REFUSAL].includes(m))\n : [];\n return {\n content: [\n {\n type: 'text' as const,\n text: `Invalid arguments for ${tool.name}.${missing.length ? ` Missing required fields: ${missing.join(', ')}. Provide every missing field.` : stated.length ? ` ${stated.join(' ')}` : journal ? ` ${tool.description}` : ''}`,\n },\n ],\n isError: true,\n };\n }\n try {\n const signal = context.signal === undefined ? extra.signal : AbortSignal.any([context.signal, extra.signal]);\n const { verbose, ...input } = parsed.data;\n const pending = executeTool(tool.name as AiDeliveryMcpToolName, input, {\n ...context,\n signal,\n ...(verbose === true ? { verbose } : {}),\n });\n activeCalls?.add(pending);\n let value: unknown;\n try {\n value = await pending;\n } finally {\n activeCalls?.delete(pending);\n }\n return {\n content: [\n { type: 'text' as const, text: JSON.stringify(projectToolOutput(tool.name, value, verbose === true)) },\n ],\n };\n } catch (error) {\n const incomplete = getIncompleteIssueUpdate(error);\n if (incomplete !== undefined)\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(\n projectToolOutput(tool.name, incomplete, 'verbose' in args && args.verbose === true),\n ),\n },\n ],\n isError: true,\n };\n const message = error instanceof Error ? error.message : String(error);\n return { content: [{ type: 'text' as const, text: message }], isError: true };\n }\n },\n );\n }\n return server;\n}\n\nexport async function serveAiDeliveryMcp(context: ExecutionContext): Promise<void> {\n setLogsSuppressed(true);\n const shutdown = new AbortController();\n const activeCalls = new Set<Promise<unknown>>();\n const server = createAiDeliveryMcpServer({ ...context, signal: shutdown.signal }, activeCalls);\n let closing: Promise<void> | undefined;\n const close = (): Promise<void> => {\n closing ??= (async () => {\n shutdown.abort();\n await Promise.allSettled(activeCalls);\n await server.close();\n process.exit(0);\n })();\n return closing;\n };\n process.once('SIGINT', () => {\n void close();\n });\n process.once('SIGTERM', () => {\n void close();\n });\n await server.connect(new StdioServerTransport());\n process.stderr.write('ai-delivery MCP server started\\n');\n await new Promise<void>(() => {});\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAElB,SAAS,mBAA0C;AACnD,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAClC,SAAS,6BAAyD;AAElE,SAAS,kCAAkC,yBAAAA,8BAA6B;AAExE,MAAM,sBACJ;AAEK,SAAS,0BAA0B,SAA2B,aAAgD;AACnH,QAAM,SAAS,IAAI;AAAA,IACjB,EAAE,MAAM,eAAe,SAAS,gBAAgB;AAAA,IAChD,EAAE,cAAc,oBAAoB;AAAA,EACtC;AACA,QAAM,QAKA;AACN,aAAW,QAAQ,OAAO;AACxB,WAAO;AAAA,MACL,KAAK;AAAA,MACL;AAAA,QACE,aAAa,KAAK;A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MAAM;AAC5B,SAAK,MAAM;AAAA,EACb,CAAC;AACD,QAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;AAC/C,UAAQ,OAAO,MAAM,kCAAkC;AACvD,QAAM,IAAI,QAAc,MAAM;AAAA,EAAC,CAAC;AAClC;",
|
|
6
6
|
"names": ["AI_DELIVERY_MCP_TOOLS"]
|
|
7
7
|
}
|
package/dist/mcp/tools.d.ts
CHANGED
|
@@ -3,43 +3,44 @@ export declare const AI_DELIVERY_MCP_CONTRACT_VERSION: 'ai-delivery.mcp@2';
|
|
|
3
3
|
export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
4
4
|
readonly name: 'issue_comment';
|
|
5
5
|
readonly commandName: 'comment';
|
|
6
|
-
readonly description: 'Post a typed issue journal with authoritative comment readback. Provide the fields required by kind: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: non-empty decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps. Omit fields belonging to other kinds.';
|
|
6
|
+
readonly description: 'Post a plain comment with body alone, or a typed issue journal with kind and its fields, with authoritative comment readback. Provide the fields required by kind: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: non-empty decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps. Omit fields belonging to other kinds.';
|
|
7
7
|
readonly inputSchema: z.ZodObject<{
|
|
8
|
-
issueNumber: z.ZodNumber
|
|
9
|
-
summary: z.ZodString
|
|
10
|
-
status: z.ZodString
|
|
11
|
-
nextStep: z.ZodString
|
|
12
|
-
nextDate: z.
|
|
13
|
-
keyNumbers: z.ZodArray<z.ZodString
|
|
14
|
-
evidence: z.ZodArray<z.ZodURL
|
|
15
|
-
details: z.ZodOptional<z.ZodString
|
|
16
|
-
lengthCap: z.ZodOptional<z.ZodNumber
|
|
17
|
-
kind: z.ZodEnum<{
|
|
8
|
+
issueNumber: z.ZodNonOptional<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
10
|
+
status: z.ZodOptional<z.ZodString>;
|
|
11
|
+
nextStep: z.ZodOptional<z.ZodString>;
|
|
12
|
+
nextDate: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodNull, z.ZodPipe<z.ZodLiteral<"null">, z.ZodTransform<null, "null">>]>>;
|
|
13
|
+
keyNumbers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
+
evidence: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
15
|
+
details: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
16
|
+
lengthCap: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
17
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
18
18
|
blocker: "blocker";
|
|
19
19
|
closeout: "closeout";
|
|
20
20
|
decision: "decision";
|
|
21
21
|
progress: "progress";
|
|
22
22
|
start: "start";
|
|
23
|
-
}
|
|
24
|
-
outcome: z.ZodOptional<z.ZodString
|
|
25
|
-
done: z.ZodOptional<z.ZodArray<z.ZodString
|
|
26
|
-
decisionNeeded: z.ZodOptional<z.ZodString
|
|
27
|
-
decision: z.ZodOptional<z.ZodString
|
|
28
|
-
rationale: z.ZodOptional<z.ZodString
|
|
29
|
-
blocker: z.ZodOptional<z.ZodString
|
|
30
|
-
resolution: z.ZodOptional<z.ZodString
|
|
31
|
-
acceptance: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
23
|
+
}>>;
|
|
24
|
+
outcome: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
25
|
+
done: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
26
|
+
decisionNeeded: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
27
|
+
decision: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
28
|
+
rationale: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
29
|
+
blocker: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
30
|
+
resolution: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
31
|
+
acceptance: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
32
32
|
criterion: z.ZodString;
|
|
33
33
|
evidence: z.ZodURL;
|
|
34
|
-
}, z.core.$strict
|
|
35
|
-
followUps: z.ZodOptional<z.ZodArray<z.ZodString
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
}, z.core.$strict>>>>;
|
|
35
|
+
followUps: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
36
|
+
body: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
37
|
+
repo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
38
|
+
verbose: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
38
39
|
}, z.core.$strict>;
|
|
39
40
|
}, {
|
|
40
41
|
readonly name: 'issue_create';
|
|
41
42
|
readonly commandName: 'create';
|
|
42
|
-
readonly description: 'Create a native GitHub tracking issue with configured metadata and relationships';
|
|
43
|
+
readonly description: 'Create a native GitHub tracking issue with configured metadata and relationships. A non-draft issue needs issueType, and a non-epic also needs priority.';
|
|
43
44
|
readonly issueContract: {
|
|
44
45
|
version: "ai-delivery.issue@1";
|
|
45
46
|
draft: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
@@ -52,6 +53,11 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
52
53
|
acceptanceCriteria: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
53
54
|
behavior: z.ZodString;
|
|
54
55
|
verifiedBy: z.ZodString;
|
|
56
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
input: z.ZodString;
|
|
58
|
+
expected: z.ZodString;
|
|
59
|
+
failure: z.ZodOptional<z.ZodLiteral<true>>;
|
|
60
|
+
}, z.core.$strict>>>;
|
|
55
61
|
}, z.core.$strict>>>;
|
|
56
62
|
outOfScope: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
57
63
|
openQuestions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -72,6 +78,31 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
72
78
|
until: z.ZodOptional<z.ZodISODate>;
|
|
73
79
|
trigger: z.ZodOptional<z.ZodString>;
|
|
74
80
|
}, z.core.$strict>>;
|
|
81
|
+
builder: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
82
|
+
tier: z.ZodLiteral<"standard">;
|
|
83
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
+
tier: z.ZodLiteral<"frontier">;
|
|
85
|
+
reason: z.ZodEnum<{
|
|
86
|
+
"concurrency-recovery": "concurrency-recovery";
|
|
87
|
+
"risk-semantics": "risk-semantics";
|
|
88
|
+
"state-machine": "state-machine";
|
|
89
|
+
"unprovable-refactor": "unprovable-refactor";
|
|
90
|
+
}>;
|
|
91
|
+
}, z.core.$strict>], "tier">>;
|
|
92
|
+
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
93
|
+
priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
94
|
+
decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
95
|
+
surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
96
|
+
path: z.ZodString;
|
|
97
|
+
change: z.ZodEnum<{
|
|
98
|
+
add: "add";
|
|
99
|
+
delete: "delete";
|
|
100
|
+
edit: "edit";
|
|
101
|
+
}>;
|
|
102
|
+
signatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
}, z.core.$strict>>>;
|
|
104
|
+
fences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
|
+
proof: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
75
106
|
legacyBody: z.ZodOptional<z.ZodString>;
|
|
76
107
|
retainLegacyBody: z.ZodOptional<z.ZodBoolean>;
|
|
77
108
|
}, z.core.$strict>>;
|
|
@@ -94,6 +125,31 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
94
125
|
until: z.ZodOptional<z.ZodISODate>;
|
|
95
126
|
trigger: z.ZodOptional<z.ZodString>;
|
|
96
127
|
}, z.core.$strict>>;
|
|
128
|
+
builder: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
129
|
+
tier: z.ZodLiteral<"standard">;
|
|
130
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
131
|
+
tier: z.ZodLiteral<"frontier">;
|
|
132
|
+
reason: z.ZodEnum<{
|
|
133
|
+
"concurrency-recovery": "concurrency-recovery";
|
|
134
|
+
"risk-semantics": "risk-semantics";
|
|
135
|
+
"state-machine": "state-machine";
|
|
136
|
+
"unprovable-refactor": "unprovable-refactor";
|
|
137
|
+
}>;
|
|
138
|
+
}, z.core.$strict>], "tier">>;
|
|
139
|
+
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
140
|
+
priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
|
+
decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
142
|
+
surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
143
|
+
path: z.ZodString;
|
|
144
|
+
change: z.ZodEnum<{
|
|
145
|
+
add: "add";
|
|
146
|
+
delete: "delete";
|
|
147
|
+
edit: "edit";
|
|
148
|
+
}>;
|
|
149
|
+
signatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
150
|
+
}, z.core.$strict>>>;
|
|
151
|
+
fences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
152
|
+
proof: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
97
153
|
legacyBody: z.ZodOptional<z.ZodString>;
|
|
98
154
|
retainLegacyBody: z.ZodOptional<z.ZodBoolean>;
|
|
99
155
|
title: z.ZodString;
|
|
@@ -103,6 +159,11 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
103
159
|
acceptanceCriteria: z.ZodArray<z.ZodObject<{
|
|
104
160
|
behavior: z.ZodString;
|
|
105
161
|
verifiedBy: z.ZodString;
|
|
162
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
163
|
+
input: z.ZodString;
|
|
164
|
+
expected: z.ZodString;
|
|
165
|
+
failure: z.ZodOptional<z.ZodLiteral<true>>;
|
|
166
|
+
}, z.core.$strict>>>;
|
|
106
167
|
}, z.core.$strict>>;
|
|
107
168
|
outOfScope: z.ZodArray<z.ZodString>;
|
|
108
169
|
openQuestions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -120,6 +181,11 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
120
181
|
acceptanceCriteria: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
121
182
|
behavior: z.ZodString;
|
|
122
183
|
verifiedBy: z.ZodString;
|
|
184
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
185
|
+
input: z.ZodString;
|
|
186
|
+
expected: z.ZodString;
|
|
187
|
+
failure: z.ZodOptional<z.ZodLiteral<true>>;
|
|
188
|
+
}, z.core.$strict>>>;
|
|
123
189
|
}, z.core.$strict>>>;
|
|
124
190
|
outOfScope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
125
191
|
openQuestions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -135,6 +201,31 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
135
201
|
reproducibility: z.ZodString;
|
|
136
202
|
environment: z.ZodString;
|
|
137
203
|
}, z.core.$strict>>;
|
|
204
|
+
builder: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
205
|
+
tier: z.ZodLiteral<"standard">;
|
|
206
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
207
|
+
tier: z.ZodLiteral<"frontier">;
|
|
208
|
+
reason: z.ZodEnum<{
|
|
209
|
+
"concurrency-recovery": "concurrency-recovery";
|
|
210
|
+
"risk-semantics": "risk-semantics";
|
|
211
|
+
"state-machine": "state-machine";
|
|
212
|
+
"unprovable-refactor": "unprovable-refactor";
|
|
213
|
+
}>;
|
|
214
|
+
}, z.core.$strict>], "tier">>;
|
|
215
|
+
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
|
+
priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
217
|
+
decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
218
|
+
surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
219
|
+
path: z.ZodString;
|
|
220
|
+
change: z.ZodEnum<{
|
|
221
|
+
add: "add";
|
|
222
|
+
delete: "delete";
|
|
223
|
+
edit: "edit";
|
|
224
|
+
}>;
|
|
225
|
+
signatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
226
|
+
}, z.core.$strict>>>;
|
|
227
|
+
fences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
228
|
+
proof: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
138
229
|
draft: z.ZodOptional<z.ZodBoolean>;
|
|
139
230
|
retainLegacyBody: z.ZodOptional<z.ZodBoolean>;
|
|
140
231
|
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -156,7 +247,7 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
156
247
|
}, {
|
|
157
248
|
readonly name: 'issue_start';
|
|
158
249
|
readonly commandName: 'start';
|
|
159
|
-
readonly description: 'Start a linked issue. Prefer issueNumber of an open issue that already meets the ready contract: title, Points and, for Bug issues, the bug fields (see issue_create). A new issue from title or request cannot carry bug fields.';
|
|
250
|
+
readonly description: 'Start a linked issue. Prefer issueNumber of an open issue that already meets the ready contract: title, Issue Type, Priority (not for epics), Points and, for Bug issues, the bug fields (see issue_create). A new issue from title or request cannot carry bug fields.';
|
|
160
251
|
readonly inputSchema: z.ZodObject<{
|
|
161
252
|
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
162
253
|
blockedBy: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
@@ -251,6 +342,11 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
251
342
|
acceptanceCriteria: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
252
343
|
behavior: z.ZodString;
|
|
253
344
|
verifiedBy: z.ZodString;
|
|
345
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
346
|
+
input: z.ZodString;
|
|
347
|
+
expected: z.ZodString;
|
|
348
|
+
failure: z.ZodOptional<z.ZodLiteral<true>>;
|
|
349
|
+
}, z.core.$strict>>>;
|
|
254
350
|
}, z.core.$strict>>>;
|
|
255
351
|
outOfScope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
256
352
|
openQuestions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -266,6 +362,31 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
266
362
|
reproducibility: z.ZodString;
|
|
267
363
|
environment: z.ZodString;
|
|
268
364
|
}, z.core.$strict>>;
|
|
365
|
+
builder: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
366
|
+
tier: z.ZodLiteral<"standard">;
|
|
367
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
368
|
+
tier: z.ZodLiteral<"frontier">;
|
|
369
|
+
reason: z.ZodEnum<{
|
|
370
|
+
"concurrency-recovery": "concurrency-recovery";
|
|
371
|
+
"risk-semantics": "risk-semantics";
|
|
372
|
+
"state-machine": "state-machine";
|
|
373
|
+
"unprovable-refactor": "unprovable-refactor";
|
|
374
|
+
}>;
|
|
375
|
+
}, z.core.$strict>], "tier">>;
|
|
376
|
+
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
377
|
+
priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
378
|
+
decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
379
|
+
surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
380
|
+
path: z.ZodString;
|
|
381
|
+
change: z.ZodEnum<{
|
|
382
|
+
add: "add";
|
|
383
|
+
delete: "delete";
|
|
384
|
+
edit: "edit";
|
|
385
|
+
}>;
|
|
386
|
+
signatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
387
|
+
}, z.core.$strict>>>;
|
|
388
|
+
fences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
389
|
+
proof: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
269
390
|
draft: z.ZodOptional<z.ZodBoolean>;
|
|
270
391
|
retainLegacyBody: z.ZodOptional<z.ZodBoolean>;
|
|
271
392
|
status: z.ZodOptional<z.ZodObject<{
|
|
@@ -305,6 +426,10 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
305
426
|
duplicate: "duplicate";
|
|
306
427
|
not_planned: "not_planned";
|
|
307
428
|
}>>;
|
|
429
|
+
closeout: z.ZodOptional<z.ZodObject<{
|
|
430
|
+
verdict: z.ZodString;
|
|
431
|
+
result: z.ZodString;
|
|
432
|
+
}, z.core.$strict>>;
|
|
308
433
|
supersededBy: z.ZodOptional<z.ZodNumber>;
|
|
309
434
|
title: z.ZodOptional<z.ZodString>;
|
|
310
435
|
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -330,6 +455,11 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
330
455
|
acceptanceCriteria: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
331
456
|
behavior: z.ZodString;
|
|
332
457
|
verifiedBy: z.ZodString;
|
|
458
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
459
|
+
input: z.ZodString;
|
|
460
|
+
expected: z.ZodString;
|
|
461
|
+
failure: z.ZodOptional<z.ZodLiteral<true>>;
|
|
462
|
+
}, z.core.$strict>>>;
|
|
333
463
|
}, z.core.$strict>>>;
|
|
334
464
|
outOfScope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
335
465
|
openQuestions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -345,6 +475,31 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
345
475
|
reproducibility: z.ZodString;
|
|
346
476
|
environment: z.ZodString;
|
|
347
477
|
}, z.core.$strict>>;
|
|
478
|
+
builder: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
479
|
+
tier: z.ZodLiteral<"standard">;
|
|
480
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
481
|
+
tier: z.ZodLiteral<"frontier">;
|
|
482
|
+
reason: z.ZodEnum<{
|
|
483
|
+
"concurrency-recovery": "concurrency-recovery";
|
|
484
|
+
"risk-semantics": "risk-semantics";
|
|
485
|
+
"state-machine": "state-machine";
|
|
486
|
+
"unprovable-refactor": "unprovable-refactor";
|
|
487
|
+
}>;
|
|
488
|
+
}, z.core.$strict>], "tier">>;
|
|
489
|
+
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
490
|
+
priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
491
|
+
decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
492
|
+
surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
493
|
+
path: z.ZodString;
|
|
494
|
+
change: z.ZodEnum<{
|
|
495
|
+
add: "add";
|
|
496
|
+
delete: "delete";
|
|
497
|
+
edit: "edit";
|
|
498
|
+
}>;
|
|
499
|
+
signatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
500
|
+
}, z.core.$strict>>>;
|
|
501
|
+
fences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
502
|
+
proof: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
348
503
|
draft: z.ZodOptional<z.ZodBoolean>;
|
|
349
504
|
retainLegacyBody: z.ZodOptional<z.ZodBoolean>;
|
|
350
505
|
status: z.ZodOptional<z.ZodObject<{
|
|
@@ -384,6 +539,10 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
384
539
|
duplicate: "duplicate";
|
|
385
540
|
not_planned: "not_planned";
|
|
386
541
|
}>>;
|
|
542
|
+
closeout: z.ZodOptional<z.ZodObject<{
|
|
543
|
+
verdict: z.ZodString;
|
|
544
|
+
result: z.ZodString;
|
|
545
|
+
}, z.core.$strict>>;
|
|
387
546
|
supersededBy: z.ZodOptional<z.ZodNumber>;
|
|
388
547
|
title: z.ZodOptional<z.ZodString>;
|
|
389
548
|
}, z.core.$strict>>;
|
|
@@ -393,7 +552,7 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
393
552
|
readonly name: 'issue_info';
|
|
394
553
|
readonly readOnly: true;
|
|
395
554
|
readonly commandName: 'info';
|
|
396
|
-
readonly description: 'Read live GitHub issue metadata, relationships, Project status, linked PRs (state, merge commit, checks, reviews) and the latest journal in one call. Child counts by default; verbose adds the body, every journal in full, routing and full child progress. Pass the requested owner/name as repo; an explicit repo works outside Git without a checkout. This read does not start or update the issue.';
|
|
555
|
+
readonly description: 'Read live GitHub issue metadata, relationships, Project status, linked PRs (state, merge commit, checks, reviews), artifacts and the latest journal in one call. Child counts by default; verbose adds the body, every journal in full, routing and full child progress. Pass the requested owner/name as repo; an explicit repo works outside Git without a checkout. This read does not start or update the issue.';
|
|
397
556
|
readonly inputSchema: z.ZodObject<{
|
|
398
557
|
issueNumber: z.ZodNumber;
|
|
399
558
|
repo: z.ZodOptional<z.ZodString>;
|
package/dist/mcp/tools.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { NativeIssueDateFields } from "../github/nativeIssueMetadata.js";
|
|
3
3
|
import { ProjectTradeFields } from "../github/projectNumbers.js";
|
|
4
4
|
import { OverrideReason } from "../services/blockerGuardService.js";
|
|
5
|
-
import { JournalInputSchema, JOURNAL_SCHEMA_METADATA } from "../issueJournal.js";
|
|
5
|
+
import { JournalInputSchema, JOURNAL_SCHEMA_METADATA, PLAIN_COMMENT_REFUSAL } from "../issueJournal.js";
|
|
6
6
|
import {
|
|
7
7
|
IssueFields,
|
|
8
8
|
IssueWriteFields,
|
|
@@ -44,6 +44,10 @@ const IssueUpdateInput = issueInputSchema(
|
|
|
44
44
|
state: z.enum(["open", "closed"]).optional(),
|
|
45
45
|
preserveHistory: z.boolean().optional(),
|
|
46
46
|
closeReason: z.enum(["completed", "not_planned", "duplicate"]).optional(),
|
|
47
|
+
closeout: z.strictObject({
|
|
48
|
+
verdict: z.string().min(1).max(600).describe("The study verdict, 1\u20133 lines."),
|
|
49
|
+
result: z.string().min(1).max(4e3).describe("The READOUT's Result section, verbatim.")
|
|
50
|
+
}).optional().describe('Required to close a study (title starts with "Study") as completed; needs a READOUT artifact.'),
|
|
47
51
|
supersededBy: Positive.optional(),
|
|
48
52
|
title: IssueWriteFields.title
|
|
49
53
|
},
|
|
@@ -51,7 +55,7 @@ const IssueUpdateInput = issueInputSchema(
|
|
|
51
55
|
).superRefine((input, ctx) => {
|
|
52
56
|
if (input.defer !== void 0 && input.undefer !== void 0)
|
|
53
57
|
ctx.addIssue({ code: "custom", message: "Choose defer or undefer, never both.", path: ["defer"] });
|
|
54
|
-
if ((input.closeReason !== void 0 || input.supersededBy !== void 0) && input.state !== "closed")
|
|
58
|
+
if ((input.closeReason !== void 0 || input.closeout !== void 0 || input.supersededBy !== void 0) && input.state !== "closed")
|
|
55
59
|
ctx.addIssue({
|
|
56
60
|
code: "custom",
|
|
57
61
|
path: ["state"],
|
|
@@ -106,8 +110,22 @@ const AI_DELIVERY_MCP_TOOLS = [
|
|
|
106
110
|
{
|
|
107
111
|
name: "issue_comment",
|
|
108
112
|
commandName: "comment",
|
|
109
|
-
description: "Post a typed issue journal with authoritative comment readback. Provide the fields required by kind: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: non-empty decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps. Omit fields belonging to other kinds.",
|
|
110
|
-
inputSchema: z.strictObject(
|
|
113
|
+
description: "Post a plain comment with body alone, or a typed issue journal with kind and its fields, with authoritative comment readback. Provide the fields required by kind: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: non-empty decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps. Omit fields belonging to other kinds.",
|
|
114
|
+
inputSchema: z.strictObject(
|
|
115
|
+
{
|
|
116
|
+
...JournalInputSchema.shape,
|
|
117
|
+
body: z.string().optional().describe("A plain comment posted exactly as written; send it without any journal field."),
|
|
118
|
+
repo: Repo,
|
|
119
|
+
verbose: Verbose
|
|
120
|
+
},
|
|
121
|
+
{ error: acceptedKeysError }
|
|
122
|
+
).partial().required({ issueNumber: true }).superRefine(({ repo: _repo, verbose: _verbose, body, ...journal }, ctx) => {
|
|
123
|
+
if (body !== void 0) {
|
|
124
|
+
const { issueNumber: _issueNumber, ...keys } = journal;
|
|
125
|
+
if (Object.values(keys).some((value) => value !== void 0))
|
|
126
|
+
ctx.addIssue({ code: "custom", message: PLAIN_COMMENT_REFUSAL });
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
111
129
|
const parsed = JournalInputSchema.safeParse(journal);
|
|
112
130
|
if (!parsed.success)
|
|
113
131
|
for (const issue of parsed.error.issues)
|
|
@@ -117,7 +135,7 @@ const AI_DELIVERY_MCP_TOOLS = [
|
|
|
117
135
|
{
|
|
118
136
|
name: "issue_create",
|
|
119
137
|
commandName: "create",
|
|
120
|
-
description: "Create a native GitHub tracking issue with configured metadata and relationships",
|
|
138
|
+
description: "Create a native GitHub tracking issue with configured metadata and relationships. A non-draft issue needs issueType, and a non-epic also needs priority.",
|
|
121
139
|
issueContract: ISSUE_JSON_SCHEMAS,
|
|
122
140
|
inputSchema: issueInputSchema(
|
|
123
141
|
z.strictObject(
|
|
@@ -138,7 +156,7 @@ const AI_DELIVERY_MCP_TOOLS = [
|
|
|
138
156
|
{
|
|
139
157
|
name: "issue_start",
|
|
140
158
|
commandName: "start",
|
|
141
|
-
description: "Start a linked issue. Prefer issueNumber of an open issue that already meets the ready contract: title, Points and, for Bug issues, the bug fields (see issue_create). A new issue from title or request cannot carry bug fields.",
|
|
159
|
+
description: "Start a linked issue. Prefer issueNumber of an open issue that already meets the ready contract: title, Issue Type, Priority (not for epics), Points and, for Bug issues, the bug fields (see issue_create). A new issue from title or request cannot carry bug fields.",
|
|
142
160
|
inputSchema: NormalStart
|
|
143
161
|
},
|
|
144
162
|
{
|
|
@@ -181,7 +199,7 @@ const AI_DELIVERY_MCP_TOOLS = [
|
|
|
181
199
|
name: "issue_info",
|
|
182
200
|
readOnly: true,
|
|
183
201
|
commandName: "info",
|
|
184
|
-
description: "Read live GitHub issue metadata, relationships, Project status, linked PRs (state, merge commit, checks, reviews) and the latest journal in one call. Child counts by default; verbose adds the body, every journal in full, routing and full child progress. Pass the requested owner/name as repo; an explicit repo works outside Git without a checkout. This read does not start or update the issue.",
|
|
202
|
+
description: "Read live GitHub issue metadata, relationships, Project status, linked PRs (state, merge commit, checks, reviews), artifacts and the latest journal in one call. Child counts by default; verbose adds the body, every journal in full, routing and full child progress. Pass the requested owner/name as repo; an explicit repo works outside Git without a checkout. This read does not start or update the issue.",
|
|
185
203
|
inputSchema: z.strictObject({ issueNumber: Positive, repo: Repo, verbose: Verbose }, { error: acceptedKeysError })
|
|
186
204
|
},
|
|
187
205
|
{
|