@aviaratech/ai-delivery 0.3.41 → 0.3.42
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 +7 -1
- package/dist/callerErrors.test.js +11 -1
- package/dist/callerErrors.test.js.map +2 -2
- package/dist/fixtures/readView.d.ts +9 -1
- package/dist/fixtures/readView.js +4 -0
- package/dist/fixtures/readView.js.map +2 -2
- package/dist/issue.d.ts +0 -1
- package/dist/issue.js +42 -11
- package/dist/issue.js.map +2 -2
- package/dist/issueContract.d.ts +2 -0
- package/dist/issueContract.js +11 -9
- package/dist/issueContract.js.map +2 -2
- package/dist/issueInfoReadback.test.js +80 -7
- package/dist/issueInfoReadback.test.js.map +2 -2
- package/dist/issueIntake.test.js +30 -0
- package/dist/issueIntake.test.js.map +2 -2
- package/dist/issueJournal.js +4 -2
- package/dist/issueJournal.js.map +2 -2
- package/dist/issueJournal.test.js +22 -0
- package/dist/issueJournal.test.js.map +2 -2
- package/dist/issueTracking.test.js +4 -1
- package/dist/issueTracking.test.js.map +2 -2
- package/dist/mcp/index.js +3 -3
- package/dist/mcp/index.js.map +2 -2
- package/dist/mcp/tools.d.ts +8 -3
- package/dist/mcp/tools.js +134 -101
- package/dist/mcp/tools.js.map +2 -2
- package/dist/pr.d.ts +2 -0
- package/dist/pr.js +28 -3
- package/dist/pr.js.map +2 -2
- package/dist/pr.test.js +0 -7
- package/dist/pr.test.js.map +2 -2
- package/dist/prAssociation.test.js +82 -9
- package/dist/prAssociation.test.js.map +2 -2
- package/dist/projectNumbers.test.js +1 -1
- package/dist/projectNumbers.test.js.map +1 -1
- package/dist/readView.d.ts +31 -3
- package/dist/readView.js +29 -12
- package/dist/readView.js.map +2 -2
- package/dist/readView.test.js +63 -1
- package/dist/readView.test.js.map +2 -2
- package/dist/targetPolicyEntrypoints.test.js +1 -1
- package/dist/targetPolicyEntrypoints.test.js.map +2 -2
- package/dist/targetPolicyRoutes.test.js +1 -1
- package/dist/targetPolicyRoutes.test.js.map +2 -2
- package/dist/toolOutput.test.js +14 -0
- package/dist/toolOutput.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 +116 -116
- package/plugins/ai-delivery/runtime/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/issueTracking.test.ts"],
|
|
4
|
-
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { execFileSync } from 'node:child_process';\nimport { mkdtempSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { test } from 'vitest';\nimport * as issue from './issue.js';\nimport { getAiDeliveryMcpTool } from './mcp/tools.js';\nimport { syntheticDiscoveryConfig } from './fixtures/discovery.js';\nimport type { DeliveryContext } from './issue.js';\nimport { getNativeBlockerRelationships } from './github/relationships.js';\nimport * as projectDelivery from './github/projectDelivery.js';\nimport { issueProjectItemsResponse } from './fixtures/issueProjectItems.js';\n\nfunction updateFixture() {\n const root = mkdtempSync(join(tmpdir(), 'ai-delivery-history-'));\n execFileSync('git', ['init', '-q', '-b', 'main'], { cwd: root });\n const events: string[] = [];\n const live = {\n number: 17,\n id: 117,\n node_id: 'ISSUE17',\n title: ' Prior <title>\\r\\n',\n body: '\\nprior & body\\t ',\n state: 'open',\n html_url: 'https://github.com/example/widget/issues/17',\n };\n const controls = {\n corruptComment: false,\n failUpdate: false,\n ignoreClosure: false,\n drift: false,\n targetPr: false,\n reason: null as string | null,\n duplicate: null as number | null,\n archived: false,\n archiveAfterUpdate: false,\n projectUnavailableAfterUpdate: false,\n nativeUnavailableAfterUpdate: false,\n foreignAfterUpdate: false,\n wrongNodeAfterUpdate: false,\n driftAfterUpdate: false,\n projectFailure: '' as '' | 'rate-limit' | 'cancel',\n nativeReadsAfterUpdate: 0,\n failChildReadAfterUpdate: false,\n childReadsAfterUpdate: 0,\n };\n const comments: { id: number; body: string; html_url: string; user: { login: string }; issue_url: string }[] = [];\n const updates: Record<string, unknown>[] = [];\n let projectStatus = 'Active';\n const context = {\n root,\n repo: { owner: 'example', repo: 'widget' },\n config: syntheticDiscoveryConfig,\n projectConfiguration: { ...listingFixture().context.projectConfiguration!, writable: true },\n clients: {\n role: 'author',\n authenticatedAuthor: async () => {\n events.push('author');\n return { actorLogin: 'operator', credentialIdentity: 'user:1' };\n },\n rest: {\n issues: {\n listSubIssues: async () => {\n if (updates.length) controls.childReadsAfterUpdate++;\n if (updates.length && controls.failChildReadAfterUpdate) throw new Error('Child progress unavailable');\n return { data: [] };\n },\n get: async (input: { issue_number: number }) => {\n if (updates.length) controls.nativeReadsAfterUpdate++;\n if (updates.length && controls.nativeUnavailableAfterUpdate) throw new Error('Native unavailable');\n return {\n data:\n input.issue_number === 17\n ? {\n ...live,\n ...(updates.length && controls.wrongNodeAfterUpdate ? { node_id: 'FOREIGN_ISSUE' } : {}),\n ...(updates.length && controls.foreignAfterUpdate\n ? { html_url: 'https://github.com/other/widget/issues/17' }\n : {}),\n ...(updates.length && controls.driftAfterUpdate ? { body: 'Concurrent later edit' } : {}),\n }\n : {\n number: input.issue_number,\n id: 118,\n html_url: `https://github.com/example/widget/issues/${String(input.issue_number)}`,\n ...(controls.targetPr ? { pull_request: {} } : {}),\n },\n };\n },\n listComments: async () => ({ data: comments }),\n createComment: async (input: { body: string }) => {\n events.push('comment');\n const id = 91 + comments.length;\n const data = {\n id,\n body: input.body,\n html_url: `https://github.com/example/widget/issues/17#issuecomment-${String(id)}`,\n user: { login: 'operator' },\n issue_url: 'https://api.github.com/repos/example/widget/issues/17',\n };\n comments.push(data);\n return { data };\n },\n getComment: async (input: { comment_id: number }) => {\n events.push('comment-readback');\n if (controls.drift) live.body = 'Concurrent human edit';\n return {\n data: {\n ...comments.find((comment) => comment.id === input.comment_id),\n ...(controls.corruptComment ? { body: 'Wrong body' } : {}),\n },\n };\n },\n update: async (input: Record<string, unknown>) => {\n events.push('update');\n updates.push(input);\n if (controls.failUpdate) throw new Error('Update unavailable');\n if (controls.archiveAfterUpdate) controls.archived = true;\n if (typeof input.title === 'string') live.title = input.title;\n if (typeof input.body === 'string') live.body = input.body;\n if (!controls.ignoreClosure && typeof input.state === 'string') {\n live.state = input.state;\n controls.reason =\n input.state === 'closed'\n ? (typeof input.state_reason === 'string' ? input.state_reason : 'completed').toUpperCase()\n : 'REOPENED';\n if (input.duplicate_issue_id !== undefined) controls.duplicate = 18;\n }\n return { data: { ...live } };\n },\n },\n request: async () => ({ data: [] }),\n },\n graphql: async (query: string, variables: Record<string, unknown>) => {\n if (query.includes('ProjectDelivery') && updates.length && controls.projectFailure) {\n if (controls.projectFailure === 'cancel') throw new DOMException('Cancelled', 'AbortError');\n throw Object.assign(new Error('PRIVATE_RATE_CONTENT'), {\n status: 429,\n response: { headers: { 'retry-after': '60' } },\n });\n }\n if (query.includes('ProjectDelivery') && updates.length && controls.projectUnavailableAfterUpdate)\n throw new Error('PRIVATE_REMOTE_CONTENT');\n if (query.includes('IssueClosureReadback'))\n return {\n repository: {\n issue: {\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n state: live.state.toUpperCase(),\n stateReason: controls.reason,\n duplicateOf:\n controls.duplicate === null\n ? null\n : { number: controls.duplicate, repository: { nameWithOwner: 'example/widget' } },\n },\n },\n };\n if (query.includes('blockedBy(first:'))\n return {\n repository: {\n issue: { parent: null, blockedBy: { nodes: [], pageInfo: { hasNextPage: false, endCursor: null } } },\n },\n };\n if (query.includes('ProjectDeliveryIssueItems'))\n return issueProjectItemsResponse(variables, [\n {\n id: 'ITEM17',\n isArchived: controls.archived,\n content: { id: 'ISSUE17' },\n fieldValueByName: {\n name: projectStatus,\n optionId: projectStatus === 'Active' ? 'ACTIVE' : projectStatus === 'Queued' ? 'TODO' : 'DONE',\n },\n },\n ]);\n if (query.includes('UpdateProjectDeliveryStatus')) {\n events.push('project-update');\n projectStatus =\n variables.optionId === 'DONE' ? 'Shipped' : variables.optionId === 'TODO' ? 'Queued' : 'Active';\n return { updateProjectV2ItemFieldValue: { projectV2Item: { id: 'ITEM17' } } };\n }\n if (query.includes('ProjectDeliveryItemReadback'))\n return {\n node: {\n id: 'ITEM17',\n isArchived: false,\n project: { id: 'PROJECT', number: 1 },\n content: { id: 'ISSUE17' },\n fieldValueByName: {\n name: projectStatus,\n optionId: projectStatus === 'Active' ? 'ACTIVE' : projectStatus === 'Queued' ? 'TODO' : 'DONE',\n },\n },\n };\n throw new Error(`Unexpected update fixture query: ${query}`);\n },\n },\n } as unknown as DeliveryContext;\n return {\n context,\n live,\n controls,\n comments,\n events,\n updates,\n cleanup: () => rmSync(root, { recursive: true, force: true }),\n };\n}\n\ntest('history preserves exact prior content before a rewrite and retries a failed mutation once', async () => {\n const fixture = updateFixture();\n try {\n const oldTitle = fixture.live.title;\n const oldBody = fixture.live.body;\n fixture.controls.failUpdate = true;\n const input = { issueNumber: 17, title: 'New title', body: 'New body', draft: true, preserveHistory: true };\n await assert.rejects(issue.updateIssue(fixture.context, input), /Update unavailable/u);\n assert.equal(fixture.comments.length, 1);\n assert.equal(fixture.comments[0]!.body, issue.renderIssueHistory(oldTitle, oldBody));\n assert.ok(fixture.events.indexOf('comment-readback') < fixture.events.indexOf('update'));\n fixture.controls.failUpdate = false;\n const result = await issue.updateIssue(fixture.context, input);\n assert.equal(result.title, 'New title');\n assert.equal(result.conversion?.priorBody, oldBody);\n assert.ok(oldBody.split('\\n').every((line) => result.conversion?.diff.includes('-' + line)));\n assert.match(result.body, /ai-delivery:issue@1/u);\n assert.equal(fixture.comments.length, 1);\n assert.equal((result as unknown as { historyComment: { reused: boolean } }).historyComment.reused, true);\n await issue.updateIssue(fixture.context, input);\n assert.equal(fixture.comments.length, 1, 'a no-op rewrite adds no history');\n } finally {\n fixture.cleanup();\n }\n});\n\ntest.each([{ state: 'closed' as const }, { state: 'open' as const }, { title: 'Retitled archived issue safely' }])(\n 'archived native update preserves the item and returns its identity: %j',\n async (patch) => {\n const f = updateFixture();\n try {\n f.controls.archived = true;\n if (patch.state === 'open') f.live.state = 'closed';\n const result = await issue.updateIssue(f.context, { issueNumber: 17, ...patch });\n assert.equal(f.live.state, patch.state ?? 'open');\n if (patch.title) assert.equal(f.live.title, patch.title);\n assert.equal(f.controls.archived, true);\n assert.equal(f.events.includes('project-update'), false);\n assert.ok(result.warnings.some((w) => w.code === 'project.archived' && w.message.includes('ITEM17')));\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('initially archived issue update refuses before history, closure or native writes', async () => {\n const f = updateFixture();\n try {\n f.controls.archived = true;\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n /archived/u,\n );\n assert.deepEqual(f.updates, []);\n assert.deepEqual(f.comments, []);\n assert.equal(f.events.includes('project-update'), false);\n assert.equal(f.live.state, 'open');\n } finally {\n f.cleanup();\n }\n});\n\ntest.each(['archive', 'unavailable'] as const)(\n 'post-commit %s reports confirmed native content and closure separately from pending Project work',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = failure === 'archive';\n f.controls.projectUnavailableAfterUpdate = failure === 'unavailable';\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n (error: unknown) => {\n const result = (\n error as {\n result: {\n status: string;\n native: {\n status: string;\n repository: string;\n readback: issue.IssueInfo;\n closure: issue.IssueClosureReadback;\n historyComment: issue.IssueCommentReadback;\n };\n project: { status: string; desiredStatus: string };\n recovery: { tool: string };\n };\n }\n ).result;\n assert.equal(result.status, 'update-incomplete');\n assert.equal(result.native.status, 'confirmed');\n assert.equal(result.native.repository, 'example/widget');\n assert.equal(result.native.readback.state, 'closed');\n assert.match(result.native.readback.body, /Replacement/u);\n assert.equal(result.native.closure.closeReason, 'not_planned');\n assert.equal(result.native.historyComment.commentId, 91);\n assert.equal(result.project.status, failure === 'archive' ? 'pending' : 'unknown');\n assert.equal(result.project.desiredStatus, 'Done');\n assert.equal(result.recovery.tool, 'issue_batch_update');\n assert.equal(JSON.stringify(result).includes('PRIVATE_'), false);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n assert.equal(f.comments.length, 2);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('native fallback confirms committed closure without requiring child progress', async () => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = true;\n f.controls.failChildReadAfterUpdate = true;\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n (error: unknown) => {\n const result = issue.getIncompleteIssueUpdate(error);\n assert.equal(result?.native.status, 'confirmed');\n assert.equal(result?.native.readback?.state, 'closed');\n assert.match(result?.native.readback?.body ?? '', /Replacement/u);\n assert.equal(result?.native.closure?.closeReason, 'not_planned');\n assert.equal(result?.native.readback?.childProgress, undefined);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n assert.equal(f.controls.childReadsAfterUpdate, 1);\n } finally {\n f.cleanup();\n }\n});\n\ntest.each(['unavailable', 'foreign', 'drift', 'node'] as const)(\n 'post-commit native %s evidence remains unknown',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = true;\n f.controls.nativeUnavailableAfterUpdate = failure === 'unavailable';\n f.controls.foreignAfterUpdate = failure === 'foreign';\n f.controls.wrongNodeAfterUpdate = failure === 'node';\n f.controls.driftAfterUpdate = failure === 'drift';\n await assert.rejects(\n issue.updateIssue(f.context, { issueNumber: 17, body: 'Replacement', draft: true }),\n (error: unknown) => {\n const result = (error as { result: { native: { status: string; readback: unknown } } }).result;\n assert.equal(result.native.status, 'unknown');\n assert.equal(result.native.readback, null);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest.each(['rate-limit', 'cancel'] as const)(\n 'post-commit %s defers native readback without another request',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.projectFailure = failure;\n await assert.rejects(\n issue.updateIssue(f.context, { issueNumber: 17, body: 'Replacement', draft: true }),\n (error: unknown) => {\n const partial = issue.getIncompleteIssueUpdate(error);\n assert.equal(partial?.native.status, 'unknown');\n assert.equal(partial?.native.readback, null);\n if (failure === 'rate-limit') assert.equal(partial?.rateLimit?.retryAfterSeconds, 60);\n assert.equal(JSON.stringify(partial).includes('PRIVATE_'), false);\n return true;\n },\n );\n assert.equal(f.controls.nativeReadsAfterUpdate, 1);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('history overflow, invalid metadata, failed comment readback and concurrent edits prevent rewrites', async () => {\n for (const failure of ['overflow', 'labels', 'readback', 'drift'] as const) {\n const fixture = updateFixture();\n try {\n if (failure === 'overflow') fixture.live.body = '&'.repeat(14000);\n if (failure === 'readback') fixture.controls.corruptComment = true;\n if (failure === 'drift') fixture.controls.drift = true;\n const oldBody = fixture.live.body;\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n ...(failure === 'labels' ? { labels: ['invalid'] } : {}),\n }),\n );\n assert.equal(fixture.updates.length, 0, failure);\n if (failure !== 'drift') assert.equal(fixture.live.body, oldBody);\n if (failure === 'overflow' || failure === 'labels') assert.equal(fixture.comments.length, 0);\n if (failure === 'overflow') assert.ok(!fixture.events.includes('author'));\n } finally {\n fixture.cleanup();\n }\n }\n});\n\ntest('reasoned closure records supersession and verifies native reason and duplicate identity', async () => {\n for (const closeReason of ['completed', 'not_planned', 'duplicate'] as const) {\n const fixture = updateFixture();\n try {\n const input = { issueNumber: 17, state: 'closed' as const, draft: true, closeReason, supersededBy: 18 };\n const result = await issue.updateIssue(fixture.context, input);\n const closure = (\n result as unknown as {\n closure: issue.IssueClosureReadback & { supersededBy: number; comment: issue.IssueCommentReadback };\n }\n ).closure;\n assert.equal(result.state, 'closed');\n assert.equal(closure.closeReason, closeReason);\n assert.equal(closure.supersededBy, 18);\n assert.match(closure.comment.body, /example\\/widget#18/u);\n assert.equal(fixture.updates[0]!.state_reason, closeReason);\n if (closeReason === 'duplicate') {\n assert.equal(fixture.updates[0]!.duplicate_issue_id, 118);\n assert.deepEqual(closure.duplicateOf, { number: 18, repository: 'example/widget' });\n }\n await issue.updateIssue(fixture.context, input);\n assert.equal(fixture.comments.length, 2, 'closure retries reuse authoritative comments');\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n ...input,\n closeReason: closeReason === 'completed' ? 'not_planned' : 'completed',\n }),\n /already closed/u,\n );\n } finally {\n fixture.cleanup();\n }\n }\n});\n\ntest('invalid superseding issues and contradictory native closure fail closed', async () => {\n for (const failure of ['self', 'pull-request', 'reason', 'duplicate'] as const) {\n const fixture = updateFixture();\n try {\n fixture.controls.targetPr = failure === 'pull-request';\n fixture.controls.ignoreClosure = failure === 'reason';\n if (failure === 'duplicate') {\n fixture.live.state = 'closed';\n fixture.controls.reason = 'DUPLICATE';\n fixture.controls.duplicate = 19;\n }\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n issueNumber: 17,\n state: 'closed',\n draft: true,\n closeReason: failure === 'duplicate' ? 'duplicate' : 'completed',\n supersededBy: failure === 'self' ? 17 : 18,\n }),\n );\n if (failure !== 'reason') {\n assert.equal(fixture.updates.length, 0);\n assert.equal(fixture.comments.length, 0);\n }\n } finally {\n fixture.cleanup();\n }\n }\n});\n\nconst listIssues = (\n issue as unknown as {\n listIssues: (context: DeliveryContext, input: unknown) => Promise<{ issues: unknown[]; nextPage: number | null }>;\n }\n).listIssues;\n\nfunction listingFixture(\n options: {\n foreign?: boolean;\n incomplete?: boolean;\n invalidField?: boolean;\n foreignParent?: boolean;\n missingOption?: boolean;\n dualBlockers?: boolean;\n missingMulti?: boolean;\n } = {},\n) {\n const requests: Record<string, unknown>[] = [];\n const context = {\n root: '/synthetic',\n repo: { owner: 'example', repo: 'widget' },\n config: syntheticDiscoveryConfig,\n projectConfiguration: {\n projectId: 'PROJECT',\n projectNumber: 1,\n title: 'Delivery',\n writable: false,\n pointsFieldId: 'POINTS',\n priorityFieldId: 'PRIORITY',\n statusFieldId: 'STATUS',\n statusOptionIds: { Todo: 'TODO', 'In Progress': 'ACTIVE', Blocked: 'BLOCKED', Done: 'DONE' },\n settings: {\n number: 1,\n title: 'Delivery',\n statusField: 'Flow',\n statuses: { Todo: 'Queued', 'In Progress': 'Active', Blocked: 'Waiting', Done: 'Shipped' },\n },\n },\n clients: {\n rest: {\n issues: {\n listForRepo: async (params: Record<string, unknown>) => {\n requests.push(params);\n return {\n data: [\n {\n number: 17,\n node_id: 'ISSUE17',\n title: 'Repair widget',\n state: 'open',\n labels: [{ name: 'area:widget' }],\n type: { name: 'Task' },\n html_url: options.foreign\n ? 'https://github.com/elsewhere/widget/issues/17'\n : 'https://github.com/example/widget/issues/17',\n updated_at: '2026-10-07T00:00:00Z',\n },\n { number: 18, pull_request: {} },\n ],\n };\n },\n },\n search: {\n issuesAndPullRequests: async (params: Record<string, unknown>) => {\n requests.push(params);\n return { data: { total_count: 0, incomplete_results: options.incomplete ?? false, items: [] } };\n },\n },\n request: async (route: string, params: Record<string, unknown>) => {\n requests.push({ route, ...params });\n if (route.includes('/orgs/'))\n return {\n data: [\n { id: 101, name: 'Estimate', data_type: 'single_select' },\n { id: 102, name: 'Urgency', data_type: 'single_select' },\n { id: 103, name: 'Start date', data_type: 'date' },\n ...(options.missingMulti ? [{ id: 104, name: 'Tags', data_type: 'multi_select' }] : []),\n ],\n };\n return {\n data: [\n {\n issue_field_id: 101,\n issue_field_name: options.invalidField ? 'Foreign estimate' : 'Estimate',\n data_type: 'single_select',\n value: 44,\n ...(options.missingOption ? {} : { single_select_option: { id: 44, name: '4' } }),\n },\n { issue_field_id: 103, issue_field_name: 'Start date', data_type: 'date', value: '2026-10-07' },\n ...(options.missingMulti\n ? [{ issue_field_id: 104, issue_field_name: 'Tags', data_type: 'multi_select', value: 'one' }]\n : []),\n ],\n };\n },\n },\n graphql: async (query: string, variables?: Record<string, unknown>) => {\n if (query.includes('blockedBy(first:'))\n return {\n repository: {\n issue: {\n parent: {\n id: 'PARENT9',\n number: 9,\n repository: { nameWithOwner: options.foreignParent ? 'example/other' : 'example/widget' },\n },\n blockedBy: {\n nodes: [\n {\n id: 'BLOCKER8',\n number: 8,\n title: 'Prerequisite',\n state: 'CLOSED',\n repository: { nameWithOwner: 'example/widget' },\n },\n ...(options.dualBlockers\n ? [\n {\n id: 'FOREIGN8',\n number: 8,\n title: 'Other prerequisite',\n state: 'OPEN',\n repository: { nameWithOwner: 'example/other' },\n },\n ]\n : []),\n ],\n pageInfo: { hasNextPage: false, endCursor: null },\n },\n },\n },\n };\n if (query.includes('ProjectDeliveryIssueItems'))\n return issueProjectItemsResponse(variables, [\n {\n id: 'ITEM17',\n isArchived: false,\n content: { id: 'ISSUE17' },\n fieldValueByName: { name: 'Active', optionId: 'ACTIVE' },\n },\n ]);\n throw new Error('Unexpected query');\n },\n },\n } as unknown as DeliveryContext;\n return { context, requests };\n}\n\ntest('typed listing filters stay repository-bound and expose named fields without identifiers', async () => {\n const tool = getAiDeliveryMcpTool('issue_list');\n assert.ok(tool, 'issue_list is registered');\n const input = tool.inputSchema.parse({\n state: 'open',\n labels: ['area:widget'],\n parentIssueNumber: 9,\n issueType: 'Task',\n projectStatus: 'In Progress',\n updatedSince: '2026-10-01T00:00:00Z',\n perPage: 2,\n });\n const { context, requests } = listingFixture();\n const result = await listIssues(context, input);\n assert.equal(result.nextPage, 2);\n assert.deepEqual(result.issues, [\n {\n number: 17,\n title: 'Repair widget',\n state: 'open',\n labels: ['area:widget'],\n issueType: 'Task',\n parentIssueNumber: 9,\n parent: { repository: 'example/widget', number: 9 },\n blockers: [{ repository: 'example/widget', number: 8, title: 'Prerequisite', state: 'CLOSED' }],\n projectStatus: 'In Progress',\n fields: { Estimate: '4', Urgency: null, 'Start date': '2026-10-07' },\n url: 'https://github.com/example/widget/issues/17',\n updatedAt: '2026-10-07T00:00:00Z',\n },\n ]);\n assert.equal(requests[0]?.owner, 'example');\n assert.equal(requests[0]?.since, '2026-10-01T00:00:00Z');\n assert.equal(JSON.stringify(result).includes('BLOCKER8'), false);\n});\n\ntest('search quotes user text so it cannot change the selected repository', async () => {\n const tool = getAiDeliveryMcpTool('issue_search');\n assert.ok(tool, 'issue_search is registered');\n const input = tool.inputSchema.parse({ query: 'repo:elsewhere/project', page: 2, perPage: 10 });\n const { context, requests } = listingFixture();\n const result = await listIssues(context, input);\n assert.equal(result.nextPage, null);\n assert.equal(requests[0]?.q, 'repo:example/widget is:issue \"repo:elsewhere/project\"');\n});\n\ntest('update accepts history and reasoned closure while rejecting incoherent requests', () => {\n const tool = getAiDeliveryMcpTool('issue_update');\n assert.ok(tool);\n assert.equal(tool.inputSchema.safeParse({ issueNumber: 17, body: 'new body', preserveHistory: true }).success, true);\n assert.equal(\n tool.inputSchema.safeParse({ issueNumber: 17, state: 'closed', closeReason: 'duplicate', supersededBy: 9 }).success,\n true,\n );\n assert.throws(\n () => tool.inputSchema.safeParse({ issueNumber: 17, state: 'open', closeReason: 'completed' }),\n /\"code\":\"closure.state\"/u,\n );\n});\n\ntest('local filters retain pagination when the current GitHub page has no matching issue', async () => {\n const { context } = listingFixture();\n const result = await listIssues(context, { parentIssueNumber: null, perPage: 2 });\n assert.deepEqual(result.issues, []);\n assert.equal(result.nextPage, 2);\n});\n\ntest('foreign issue identity and mismatched organization fields fail rather than returning false readback', async () => {\n await assert.rejects(listIssues(listingFixture({ foreign: true }).context, {}), /foreign repository/u);\n await assert.rejects(listIssues(listingFixture({ invalidField: true }).context, {}), /conflicts with its catalog/u);\n});\n\ntest('search refuses incomplete upstream results and invalid literal text', async () => {\n await assert.rejects(\n listIssues(listingFixture({ incomplete: true }).context, { query: 'widget' }),\n /incomplete results/u,\n );\n await assert.rejects(listIssues(listingFixture().context, { query: '\" repo:elsewhere/widget' }), /literal text/u);\n assert.equal(getAiDeliveryMcpTool('issue_list')?.inputSchema.safeParse({ perPage: 101 }).success, false);\n});\n\ntest('a foreign parent with the same issue number cannot satisfy a local parent filter', async () => {\n const { context } = listingFixture({ foreignParent: true });\n assert.deepEqual((await listIssues(context, { parentIssueNumber: 9 })).issues, []);\n});\n\ntest('label filters preserve GitHub case-insensitive label identity', async () => {\n const { context } = listingFixture();\n assert.equal((await listIssues(context, { labels: ['AREA:Widget'] })).issues.length, 1);\n});\n\ntest('a set select field without its named option fails rather than reporting unset', async () => {\n await assert.rejects(listIssues(listingFixture({ missingOption: true }).context, {}), /option/u);\n});\n\ntest('same-number blockers in different repositories retain both qualified identities', async () => {\n const { context } = listingFixture({ dualBlockers: true });\n const result = await issue.listIssues(context, {});\n assert.deepEqual(result.issues[0]?.blockers, [\n { repository: 'example/widget', number: 8, title: 'Prerequisite', state: 'CLOSED' },\n { repository: 'example/other', number: 8, title: 'Other prerequisite', state: 'OPEN' },\n ]);\n});\n\ntest('a set multi-select field without named options cannot be reported unset', async () => {\n await assert.rejects(listIssues(listingFixture({ missingMulti: true }).context, {}), /option/u);\n});\n\ntest('history rendering preserves whitespace and escapes content that could end the collapsed section', () => {\n const render = (issue as unknown as { renderIssueHistory: (title: string, body: string) => string })\n .renderIssueHistory;\n assert.equal(typeof render, 'function');\n const body = ' old body\\n</pre></details><script>x</script> & text ';\n const result = render('Old <title> & name', body);\n assert.equal(\n result,\n '<details>\\n<summary>Previous issue title and body</summary>\\n\\nTitle:\\n<pre>Old <title> & name</pre>\\n\\nBody:\\n<pre> old body\\n</pre></details><script>x</script> & text </pre>\\n\\n</details>',\n );\n});\n\ntest('closure evidence reads native reason and preserves qualified duplicate identity', async () => {\n const { context } = listingFixture();\n context.clients.graphql = (async () => ({\n repository: {\n issue: {\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n state: 'CLOSED',\n stateReason: 'DUPLICATE',\n duplicateOf: { number: 9, repository: { nameWithOwner: 'example/other' } },\n },\n },\n })) as unknown as typeof context.clients.graphql;\n const read = (\n issue as unknown as { readIssueClosure: (context: DeliveryContext, issueNumber: number) => Promise<unknown> }\n ).readIssueClosure;\n assert.equal(typeof read, 'function');\n assert.deepEqual(await read(context, 17), {\n state: 'closed',\n closeReason: 'duplicate',\n duplicateOf: { number: 9, repository: 'example/other' },\n });\n});\n\ntest('native field catalog and values both paginate through the last named field', async () => {\n const { context } = listingFixture();\n const requests: { route: string; page: unknown }[] = [];\n context.clients.rest.request = (async (route: string, params: Record<string, unknown>) => {\n requests.push({ route, page: params.page });\n const catalog = route.includes('/orgs/');\n if (params.page === 2)\n return {\n data: catalog\n ? [{ id: 201, name: 'Late date', data_type: 'date' }]\n : [{ issue_field_id: 201, issue_field_name: 'Late date', data_type: 'date', value: '2026-10-09' }],\n };\n return {\n data: catalog\n ? [\n { id: 101, name: 'Estimate', data_type: 'single_select' },\n { id: 102, name: 'Urgency', data_type: 'single_select' },\n ...Array.from({ length: 98 }, (_, index) => ({\n id: index + 103,\n name: `Custom ${String(index)}`,\n data_type: 'text',\n })),\n ]\n : [\n {\n issue_field_id: 101,\n issue_field_name: 'Estimate',\n data_type: 'single_select',\n value: 44,\n single_select_option: { name: '4' },\n },\n { issue_field_id: 102, issue_field_name: 'Urgency', data_type: 'single_select', value: null },\n ...Array.from({ length: 98 }, (_, index) => ({\n issue_field_id: index + 103,\n issue_field_name: `Custom ${String(index)}`,\n data_type: 'text',\n value: 'retained',\n })),\n ],\n };\n }) as unknown as typeof context.clients.rest.request;\n const result = await issue.listIssues(context, {});\n assert.equal(result.issues[0]?.fields['Late date'], '2026-10-09');\n assert.equal(result.issues[0]?.fields.Urgency, null);\n assert.deepEqual(\n requests.map((request) => request.page),\n [1, 2, 1, 2],\n );\n});\n\ntest('native field pagination fails closed on a repeated nonadvancing page', async () => {\n const { context } = listingFixture();\n context.clients.rest.request = (async () => ({\n data: Array.from({ length: 100 }, (_, index) => ({\n id: index + 1,\n name: `Field ${String(index)}`,\n data_type: 'text',\n })),\n })) as unknown as typeof context.clients.rest.request;\n await assert.rejects(issue.listIssues(context, {}), /repeated a pagination page/u);\n});\n\ntest.each([\n ['catalog', 'list'],\n ['values', 'list'],\n ['catalog', 'ready'],\n ['values', 'ready'],\n ['catalog', 'capacity'],\n ['values', 'capacity'],\n] as const)('reconciliation bounds native %s through %s reads', async (collection, entry) => {\n const { context } = listingFixture();\n Object.assign(context, { readPageLimit: 20 });\n if (entry === 'ready')\n context.clients.rest.issues.listSubIssues = (async (input: Record<string, unknown>) => {\n assert.equal(input.owner, 'example');\n assert.equal(input.repo, 'widget');\n assert.equal(input.issue_number, 17);\n return { data: [] };\n }) as unknown as typeof context.clients.rest.issues.listSubIssues;\n context.clients.rest.issues.get = (async () => ({\n data: {\n number: 17,\n node_id: 'ISSUE17',\n state: 'open',\n body: '',\n title: 'Repair widget',\n html_url: 'https://github.com/example/widget/issues/17',\n },\n })) as typeof context.clients.rest.issues.get;\n if (entry === 'capacity')\n context.config = {\n ...context.config,\n wipLimits: [{ repository: 'example/widget', name: 'Native', match: { field: 'Estimate', value: '4' }, limit: 2 }],\n };\n const originalGraphql = context.clients.graphql;\n context.clients.graphql = (async (query: string, variables?: Record<string, unknown>) => {\n const response = await originalGraphql(query, variables);\n if (!query.includes('blockedBy(first:')) return response;\n const parsed = response as { repository: { issue: Record<string, unknown> } };\n Object.assign(parsed.repository.issue, {\n id: 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n });\n return parsed;\n }) as unknown as typeof context.clients.graphql;\n const original = context.clients.rest.request;\n let requests = 0;\n context.clients.rest.request = (async (route: string, params: { page: number }) => {\n if (route.includes('/orgs/') !== (collection === 'catalog')) return original(route);\n requests++;\n return {\n data:\n params.page > 20\n ? []\n : Array.from({ length: 100 }, (_, index) => {\n const id = 1000 + params.page * 100 + index;\n return collection === 'catalog'\n ? { id, name: `Extra ${String(id)}`, data_type: 'text' }\n : { issue_field_id: id, issue_field_name: `Extra ${String(id)}`, data_type: 'text', value: 'value' };\n }),\n };\n }) as typeof context.clients.rest.request;\n const operation =\n entry === 'list'\n ? issue.listIssues(context, {})\n : entry === 'ready'\n ? issue.readyCheck(context, 17)\n : issue.assertIssueStartCapacity(context, 17);\n await assert.rejects(operation, (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n assert.equal(Reflect.get(error, 'pagesRequested'), 20);\n return true;\n });\n assert.equal(requests, 20);\n});\n\ntest('reconciliation bounds blocker pages and binds their source issue', async () => {\n const { context } = listingFixture();\n let requests = 0;\n context.clients.graphql = (async () => {\n requests++;\n return {\n repository: {\n issue: {\n id: 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n parent: null,\n blockedBy: { nodes: [], pageInfo: { hasNextPage: requests < 21, endCursor: `page-${String(requests)}` } },\n },\n },\n };\n }) as unknown as typeof context.clients.graphql;\n const input = { graphql: context.clients.graphql, repo: context.repo, issueNumber: 17, maxPages: 20 };\n await assert.rejects(getNativeBlockerRelationships(input), (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n assert.equal(Reflect.get(error, 'pagesRequested'), 20);\n return true;\n });\n assert.equal(requests, 20);\n});\n\ntest('reconciliation WIP guards bound their label catalog', async () => {\n const { context } = listingFixture();\n Object.assign(context, { readPageLimit: 20 });\n context.config = {\n ...context.config,\n wipLimits: [{ repository: 'example/widget', name: 'Urgent', match: { label: 'urgent' }, limit: 2 }],\n };\n let requests = 0;\n context.clients.rest.issues.listLabelsForRepo = (async () => {\n requests++;\n return {\n data:\n requests > 20\n ? []\n : Array.from({ length: 100 }, (_, index) => ({\n name: index === 0 && requests === 1 ? 'urgent' : `label-${String(requests)}-${String(index)}`,\n })),\n };\n }) as typeof context.clients.rest.issues.listLabelsForRepo;\n await assert.rejects(issue.assertIssueStartCapacity(context, 17), (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n return true;\n });\n assert.equal(requests, 20);\n});\n\nfunction membershipFixture() {\n const configuration = { ...listingFixture().context.projectConfiguration!, writable: true };\n const events: string[] = [];\n const controls = { corrupt: '', archived: false, duplicate: false, unreadable: false };\n let member = false;\n let status: 'In Progress' | null = null;\n const item = (readback = false) => ({\n id: readback && controls.corrupt === 'item' ? 'WRONG' : 'ITEM17',\n isArchived: controls.archived,\n project: { id: readback && controls.corrupt === 'project' ? 'WRONG' : 'PROJECT', number: 1 },\n content: controls.unreadable\n ? null\n : {\n __typename: 'Issue',\n id: readback && controls.corrupt === 'issue' ? 'WRONG' : 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n },\n fieldValueByName:\n status === null ? null : { name: 'Active', optionId: controls.corrupt === 'option' ? 'WRONG' : 'ACTIVE' },\n });\n const graphql = (async (query: string, variables?: Record<string, unknown>) => {\n if (query.includes('mutation AddProjectDeliveryItem')) {\n events.push('add');\n member = true;\n return { addProjectV2ItemById: { item: { id: 'ITEM17' } } };\n }\n if (query.includes('mutation UpdateProjectDeliveryStatus')) {\n events.push('status');\n status = 'In Progress';\n return { updateProjectV2ItemFieldValue: { projectV2Item: { id: 'ITEM17' } } };\n }\n if (query.includes('query ProjectDeliveryItemReadback')) {\n events.push('readback');\n return { node: item(true) };\n }\n const items = member ? (controls.duplicate ? [item(), { ...item(), id: 'SECOND' }] : [item()]) : [];\n if (query.includes('query ProjectDeliveryIssueItems')) return issueProjectItemsResponse(variables, items);\n if (query.includes('query ProjectDeliveryItems'))\n return {\n organization: {\n projectV2: { id: 'PROJECT', number: 1, items: { nodes: items, pageInfo: { hasNextPage: false } } },\n },\n };\n throw new Error('Unexpected membership fixture query.');\n }) as unknown as DeliveryContext['clients']['graphql'];\n return {\n input: { graphql, configuration, org: 'example', issueNodeId: 'ISSUE17' },\n events,\n controls,\n setMember: () => {\n member = true;\n },\n };\n}\n\ntest('membership-only add verifies the exact unarchived item and reuse writes nothing', async () => {\n const f = membershipFixture();\n const ensure = Reflect.get(projectDelivery, 'ensureIssueProjectMembership') as\n | ((input: typeof f.input & { beforeAdd?: () => Promise<void> }) => Promise<{ itemId: string; archived: false }>)\n | undefined;\n assert.equal(typeof ensure, 'function');\n const result = await ensure!({\n ...f.input,\n beforeAdd: async () => {\n f.events.push('before-add');\n },\n });\n assert.deepEqual(result, { itemId: 'ITEM17', archived: false });\n assert.deepEqual(f.events, ['before-add', 'add', 'readback']);\n f.events.length = 0;\n await ensure!(f.input);\n assert.deepEqual(f.events, ['readback']);\n});\n\ntest.each(['project', 'issue', 'item', 'archive', 'duplicate', 'unreadable'] as const)(\n 'membership refuses %s evidence without a repair write',\n async (failure) => {\n const f = membershipFixture();\n f.setMember();\n if (failure === 'archive') f.controls.archived = true;\n else if (failure === 'duplicate') f.controls.duplicate = true;\n else if (failure === 'unreadable') f.controls.unreadable = true;\n else f.controls.corrupt = failure;\n const ensure = Reflect.get(projectDelivery, 'ensureIssueProjectMembership') as\n | ((input: typeof f.input) => Promise<unknown>)\n | undefined;\n assert.equal(typeof ensure, 'function');\n await assert.rejects(ensure!(f.input));\n assert.deepEqual(\n f.events.filter((e) => e === 'add' || e === 'status'),\n [],\n );\n },\n);\n\nconst projectRow = {\n id: 'ITEM17',\n isArchived: false,\n project: { id: 'PROJECT', number: 1 },\n content: { id: 'ISSUE17' },\n fieldValueByName: { name: 'Active', optionId: 'ACTIVE' },\n};\n\nfunction readStatus(nodes: unknown[], overrides: { nodeId?: string; hasNextPage?: boolean } = {}) {\n const { input } = membershipFixture();\n const graphql = (async () => ({\n node: {\n id: overrides.nodeId ?? 'ISSUE17',\n projectItems: { nodes, pageInfo: { hasNextPage: overrides.hasNextPage ?? false } },\n },\n })) as unknown as typeof input.graphql;\n return projectDelivery.getIssueProjectStatus({ ...input, graphql });\n}\n\ntest('issue Project Status is the exact configured item and never a guess (#180)', async () => {\n assert.deepEqual(await readStatus([projectRow]), { itemId: 'ITEM17', status: 'In Progress' });\n assert.equal(await readStatus([]), null);\n assert.equal(await readStatus([{ ...projectRow, isArchived: true }]), null);\n assert.equal(await readStatus([{ ...projectRow, project: { id: 'OTHER', number: 9 } }]), null);\n});\n\ntest.each([\n ['a different issue node', () => readStatus([projectRow], { nodeId: 'ISSUE99' }), /different issue/u],\n ['more than 50 Projects', () => readStatus([projectRow], { hasNextPage: true }), /more than 50 Projects/u],\n ['an unreadable item in the configured Project', () => readStatus([{ ...projectRow, content: null }]), /unreadable/u],\n [\n 'a duplicate item in the configured Project',\n () => readStatus([projectRow, { ...projectRow, id: 'SECOND' }]),\n /duplicate/u,\n ],\n])('issue Project lookup refuses %s', async (_name, read, message) => {\n await assert.rejects(read(), message);\n});\n\ntest('guards run immediately before both Project mutation boundaries', async () => {\n const f = membershipFixture();\n const input = {\n ...f.input,\n status: 'In Progress' as const,\n beforeAdd: async () => {\n f.events.push('before-add');\n },\n beforeAdvance: async () => {\n f.events.push('before-advance');\n },\n };\n await projectDelivery.syncIssueProjectStatus(input);\n assert.deepEqual(\n f.events.filter((e) => e !== 'readback'),\n ['before-add', 'add', 'before-advance', 'status'],\n );\n const refused = membershipFixture();\n const fail = {\n ...refused.input,\n status: 'In Progress' as const,\n beforeAdd: async () => {\n throw new Error('native drift');\n },\n };\n await assert.rejects(projectDelivery.syncIssueProjectStatus(fail), /native drift/u);\n assert.deepEqual(refused.events, []);\n});\n\ntest.each(['project', 'option'] as const)(\n 'Project %s readback failure preserves an attempted write without retry',\n async (failure) => {\n const f = membershipFixture();\n f.controls.corrupt = failure;\n if (failure === 'project') {\n await assert.rejects(projectDelivery.ensureIssueProjectMembership(f.input), /exact issue item/u);\n assert.deepEqual(f.events, ['add', 'readback']);\n } else {\n f.setMember();\n await assert.rejects(\n projectDelivery.syncIssueProjectStatus({ ...f.input, status: 'In Progress' }),\n /unsupported Project Status/u,\n );\n assert.deepEqual(f.events, ['status', 'readback']);\n }\n },\n);\n\ntest('search applies the same case-insensitive label filter to authoritative result rows', async () => {\n const { context } = listingFixture();\n context.clients.rest.search.issuesAndPullRequests = (async () => ({\n data: {\n total_count: 1,\n incomplete_results: false,\n items: [\n {\n number: 17,\n node_id: 'ISSUE17',\n title: 'Repair widget',\n state: 'open',\n labels: [{ name: 'area:widget' }],\n type: { name: 'Task' },\n html_url: 'https://github.com/example/widget/issues/17',\n updated_at: '2026-10-07T00:00:00Z',\n },\n ],\n },\n })) as unknown as typeof context.clients.rest.search.issuesAndPullRequests;\n const result = await issue.listIssues(context, { query: 'widget', labels: ['AREA:Widget'] });\n assert.equal(result.issues.length, 1);\n assert.equal(result.nextPage, null);\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,aAAa,cAAc;AACpC,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,gCAAgC;AAEzC,SAAS,qCAAqC;AAC9C,YAAY,qBAAqB;AACjC,SAAS,iCAAiC;AAE1C,SAAS,gBAAgB;AACvB,QAAM,OAAO,YAAY,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAC/D,eAAa,OAAO,CAAC,QAAQ,MAAM,MAAM,MAAM,GAAG,EAAE,KAAK,KAAK,CAAC;AAC/D,QAAM,SAAmB,CAAC;AAC1B,QAAM,OAAO;AAAA,IACX,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AACA,QAAM,WAAW;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,oBAAoB;AAAA,IACpB,+BAA+B;AAAA,IAC/B,8BAA8B;AAAA,IAC9B,oBAAoB;AAAA,IACpB,sBAAs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AQ,CAAC,aAAa,EAAE,CAAC;AAC3F,SAAO,MAAM,OAAO,OAAO,QAAQ,CAAC;AACpC,SAAO,MAAM,OAAO,UAAU,IAAI;AACpC,CAAC;",
|
|
4
|
+
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { execFileSync } from 'node:child_process';\nimport { mkdtempSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { test } from 'vitest';\nimport * as issue from './issue.js';\nimport { getAiDeliveryMcpTool } from './mcp/tools.js';\nimport { syntheticDiscoveryConfig } from './fixtures/discovery.js';\nimport type { DeliveryContext } from './issue.js';\nimport { getNativeBlockerRelationships } from './github/relationships.js';\nimport * as projectDelivery from './github/projectDelivery.js';\nimport { issueProjectItemsResponse } from './fixtures/issueProjectItems.js';\n\nfunction updateFixture() {\n const root = mkdtempSync(join(tmpdir(), 'ai-delivery-history-'));\n execFileSync('git', ['init', '-q', '-b', 'main'], { cwd: root });\n const events: string[] = [];\n const live = {\n number: 17,\n id: 117,\n node_id: 'ISSUE17',\n title: ' Prior <title>\\r\\n',\n body: '\\nprior & body\\t ',\n state: 'open',\n html_url: 'https://github.com/example/widget/issues/17',\n };\n const controls = {\n corruptComment: false,\n failUpdate: false,\n ignoreClosure: false,\n drift: false,\n targetPr: false,\n reason: null as string | null,\n duplicate: null as number | null,\n archived: false,\n archiveAfterUpdate: false,\n projectUnavailableAfterUpdate: false,\n nativeUnavailableAfterUpdate: false,\n foreignAfterUpdate: false,\n wrongNodeAfterUpdate: false,\n driftAfterUpdate: false,\n projectFailure: '' as '' | 'rate-limit' | 'cancel',\n nativeReadsAfterUpdate: 0,\n failChildReadAfterUpdate: false,\n childReadsAfterUpdate: 0,\n };\n const comments: { id: number; body: string; html_url: string; user: { login: string }; issue_url: string }[] = [];\n const updates: Record<string, unknown>[] = [];\n let projectStatus = 'Active';\n const context = {\n root,\n repo: { owner: 'example', repo: 'widget' },\n config: syntheticDiscoveryConfig,\n projectConfiguration: { ...listingFixture().context.projectConfiguration!, writable: true },\n clients: {\n role: 'author',\n authenticatedAuthor: async () => {\n events.push('author');\n return { actorLogin: 'operator', credentialIdentity: 'user:1' };\n },\n rest: {\n issues: {\n listSubIssues: async () => {\n if (updates.length) controls.childReadsAfterUpdate++;\n if (updates.length && controls.failChildReadAfterUpdate) throw new Error('Child progress unavailable');\n return { data: [] };\n },\n get: async (input: { issue_number: number }) => {\n if (updates.length) controls.nativeReadsAfterUpdate++;\n if (updates.length && controls.nativeUnavailableAfterUpdate) throw new Error('Native unavailable');\n return {\n data:\n input.issue_number === 17\n ? {\n ...live,\n ...(updates.length && controls.wrongNodeAfterUpdate ? { node_id: 'FOREIGN_ISSUE' } : {}),\n ...(updates.length && controls.foreignAfterUpdate\n ? { html_url: 'https://github.com/other/widget/issues/17' }\n : {}),\n ...(updates.length && controls.driftAfterUpdate ? { body: 'Concurrent later edit' } : {}),\n }\n : {\n number: input.issue_number,\n id: 118,\n html_url: `https://github.com/example/widget/issues/${String(input.issue_number)}`,\n ...(controls.targetPr ? { pull_request: {} } : {}),\n },\n };\n },\n listComments: async () => ({ data: comments }),\n createComment: async (input: { body: string }) => {\n events.push('comment');\n const id = 91 + comments.length;\n const data = {\n id,\n body: input.body,\n html_url: `https://github.com/example/widget/issues/17#issuecomment-${String(id)}`,\n user: { login: 'operator' },\n issue_url: 'https://api.github.com/repos/example/widget/issues/17',\n };\n comments.push(data);\n return { data };\n },\n getComment: async (input: { comment_id: number }) => {\n events.push('comment-readback');\n if (controls.drift) live.body = 'Concurrent human edit';\n return {\n data: {\n ...comments.find((comment) => comment.id === input.comment_id),\n ...(controls.corruptComment ? { body: 'Wrong body' } : {}),\n },\n };\n },\n update: async (input: Record<string, unknown>) => {\n events.push('update');\n updates.push(input);\n if (controls.failUpdate) throw new Error('Update unavailable');\n if (controls.archiveAfterUpdate) controls.archived = true;\n if (typeof input.title === 'string') live.title = input.title;\n if (typeof input.body === 'string') live.body = input.body;\n if (!controls.ignoreClosure && typeof input.state === 'string') {\n live.state = input.state;\n controls.reason =\n input.state === 'closed'\n ? (typeof input.state_reason === 'string' ? input.state_reason : 'completed').toUpperCase()\n : 'REOPENED';\n if (input.duplicate_issue_id !== undefined) controls.duplicate = 18;\n }\n return { data: { ...live } };\n },\n },\n request: async () => ({ data: [] }),\n },\n graphql: async (query: string, variables: Record<string, unknown>) => {\n if (query.includes('ProjectDelivery') && updates.length && controls.projectFailure) {\n if (controls.projectFailure === 'cancel') throw new DOMException('Cancelled', 'AbortError');\n throw Object.assign(new Error('PRIVATE_RATE_CONTENT'), {\n status: 429,\n response: { headers: { 'retry-after': '60' } },\n });\n }\n if (query.includes('ProjectDelivery') && updates.length && controls.projectUnavailableAfterUpdate)\n throw new Error('PRIVATE_REMOTE_CONTENT');\n if (query.includes('IssueClosureReadback'))\n return {\n repository: {\n issue: {\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n state: live.state.toUpperCase(),\n stateReason: controls.reason,\n duplicateOf:\n controls.duplicate === null\n ? null\n : { number: controls.duplicate, repository: { nameWithOwner: 'example/widget' } },\n },\n },\n };\n if (query.includes('blockedBy(first:'))\n return {\n repository: {\n issue: { parent: null, blockedBy: { nodes: [], pageInfo: { hasNextPage: false, endCursor: null } } },\n },\n };\n if (query.includes('ProjectDeliveryIssueItems'))\n return issueProjectItemsResponse(variables, [\n {\n id: 'ITEM17',\n isArchived: controls.archived,\n content: { id: 'ISSUE17' },\n fieldValueByName: {\n name: projectStatus,\n optionId: projectStatus === 'Active' ? 'ACTIVE' : projectStatus === 'Queued' ? 'TODO' : 'DONE',\n },\n },\n ]);\n if (query.includes('UpdateProjectDeliveryStatus')) {\n events.push('project-update');\n projectStatus =\n variables.optionId === 'DONE' ? 'Shipped' : variables.optionId === 'TODO' ? 'Queued' : 'Active';\n return { updateProjectV2ItemFieldValue: { projectV2Item: { id: 'ITEM17' } } };\n }\n if (query.includes('ProjectDeliveryItemReadback'))\n return {\n node: {\n id: 'ITEM17',\n isArchived: false,\n project: { id: 'PROJECT', number: 1 },\n content: { id: 'ISSUE17' },\n fieldValueByName: {\n name: projectStatus,\n optionId: projectStatus === 'Active' ? 'ACTIVE' : projectStatus === 'Queued' ? 'TODO' : 'DONE',\n },\n },\n };\n throw new Error(`Unexpected update fixture query: ${query}`);\n },\n },\n } as unknown as DeliveryContext;\n return {\n context,\n live,\n controls,\n comments,\n events,\n updates,\n cleanup: () => rmSync(root, { recursive: true, force: true }),\n };\n}\n\ntest('history preserves exact prior content before a rewrite and retries a failed mutation once', async () => {\n const fixture = updateFixture();\n try {\n const oldTitle = fixture.live.title;\n const oldBody = fixture.live.body;\n fixture.controls.failUpdate = true;\n const input = { issueNumber: 17, title: 'New title', body: 'New body', draft: true, preserveHistory: true };\n await assert.rejects(issue.updateIssue(fixture.context, input), /Update unavailable/u);\n assert.equal(fixture.comments.length, 1);\n assert.equal(fixture.comments[0]!.body, issue.renderIssueHistory(oldTitle, oldBody));\n assert.ok(fixture.events.indexOf('comment-readback') < fixture.events.indexOf('update'));\n fixture.controls.failUpdate = false;\n const result = await issue.updateIssue(fixture.context, input);\n assert.equal(result.title, 'New title');\n assert.equal(result.conversion?.priorBody, oldBody);\n assert.ok(oldBody.split('\\n').every((line) => result.conversion?.diff.includes('-' + line)));\n assert.match(result.body, /ai-delivery:issue@1/u);\n assert.equal(fixture.comments.length, 1);\n assert.equal((result as unknown as { historyComment: { reused: boolean } }).historyComment.reused, true);\n // The body replaces the converted legacy text; once that text has history, repeating the update is a no-op.\n await issue.updateIssue(fixture.context, input);\n await issue.updateIssue(fixture.context, input);\n const afterReplace = fixture.comments.length;\n await issue.updateIssue(fixture.context, input);\n assert.equal(fixture.comments.length, afterReplace, 'a no-op rewrite adds no history');\n } finally {\n fixture.cleanup();\n }\n});\n\ntest.each([{ state: 'closed' as const }, { state: 'open' as const }, { title: 'Retitled archived issue safely' }])(\n 'archived native update preserves the item and returns its identity: %j',\n async (patch) => {\n const f = updateFixture();\n try {\n f.controls.archived = true;\n if (patch.state === 'open') f.live.state = 'closed';\n const result = await issue.updateIssue(f.context, { issueNumber: 17, ...patch });\n assert.equal(f.live.state, patch.state ?? 'open');\n if (patch.title) assert.equal(f.live.title, patch.title);\n assert.equal(f.controls.archived, true);\n assert.equal(f.events.includes('project-update'), false);\n assert.ok(result.warnings.some((w) => w.code === 'project.archived' && w.message.includes('ITEM17')));\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('initially archived issue update refuses before history, closure or native writes', async () => {\n const f = updateFixture();\n try {\n f.controls.archived = true;\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n /archived/u,\n );\n assert.deepEqual(f.updates, []);\n assert.deepEqual(f.comments, []);\n assert.equal(f.events.includes('project-update'), false);\n assert.equal(f.live.state, 'open');\n } finally {\n f.cleanup();\n }\n});\n\ntest.each(['archive', 'unavailable'] as const)(\n 'post-commit %s reports confirmed native content and closure separately from pending Project work',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = failure === 'archive';\n f.controls.projectUnavailableAfterUpdate = failure === 'unavailable';\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n (error: unknown) => {\n const result = (\n error as {\n result: {\n status: string;\n native: {\n status: string;\n repository: string;\n readback: issue.IssueInfo;\n closure: issue.IssueClosureReadback;\n historyComment: issue.IssueCommentReadback;\n };\n project: { status: string; desiredStatus: string };\n recovery: { tool: string };\n };\n }\n ).result;\n assert.equal(result.status, 'update-incomplete');\n assert.equal(result.native.status, 'confirmed');\n assert.equal(result.native.repository, 'example/widget');\n assert.equal(result.native.readback.state, 'closed');\n assert.match(result.native.readback.body, /Replacement/u);\n assert.equal(result.native.closure.closeReason, 'not_planned');\n assert.equal(result.native.historyComment.commentId, 91);\n assert.equal(result.project.status, failure === 'archive' ? 'pending' : 'unknown');\n assert.equal(result.project.desiredStatus, 'Done');\n assert.equal(result.recovery.tool, 'issue_batch_update');\n assert.equal(JSON.stringify(result).includes('PRIVATE_'), false);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n assert.equal(f.comments.length, 2);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('native fallback confirms committed closure without requiring child progress', async () => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = true;\n f.controls.failChildReadAfterUpdate = true;\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n (error: unknown) => {\n const result = issue.getIncompleteIssueUpdate(error);\n assert.equal(result?.native.status, 'confirmed');\n assert.equal(result?.native.readback?.state, 'closed');\n assert.match(result?.native.readback?.body ?? '', /Replacement/u);\n assert.equal(result?.native.closure?.closeReason, 'not_planned');\n assert.equal(result?.native.readback?.childProgress, undefined);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n assert.equal(f.controls.childReadsAfterUpdate, 1);\n } finally {\n f.cleanup();\n }\n});\n\ntest.each(['unavailable', 'foreign', 'drift', 'node'] as const)(\n 'post-commit native %s evidence remains unknown',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = true;\n f.controls.nativeUnavailableAfterUpdate = failure === 'unavailable';\n f.controls.foreignAfterUpdate = failure === 'foreign';\n f.controls.wrongNodeAfterUpdate = failure === 'node';\n f.controls.driftAfterUpdate = failure === 'drift';\n await assert.rejects(\n issue.updateIssue(f.context, { issueNumber: 17, body: 'Replacement', draft: true }),\n (error: unknown) => {\n const result = (error as { result: { native: { status: string; readback: unknown } } }).result;\n assert.equal(result.native.status, 'unknown');\n assert.equal(result.native.readback, null);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest.each(['rate-limit', 'cancel'] as const)(\n 'post-commit %s defers native readback without another request',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.projectFailure = failure;\n await assert.rejects(\n issue.updateIssue(f.context, { issueNumber: 17, body: 'Replacement', draft: true }),\n (error: unknown) => {\n const partial = issue.getIncompleteIssueUpdate(error);\n assert.equal(partial?.native.status, 'unknown');\n assert.equal(partial?.native.readback, null);\n if (failure === 'rate-limit') assert.equal(partial?.rateLimit?.retryAfterSeconds, 60);\n assert.equal(JSON.stringify(partial).includes('PRIVATE_'), false);\n return true;\n },\n );\n assert.equal(f.controls.nativeReadsAfterUpdate, 1);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('history overflow, invalid metadata, failed comment readback and concurrent edits prevent rewrites', async () => {\n for (const failure of ['overflow', 'labels', 'readback', 'drift'] as const) {\n const fixture = updateFixture();\n try {\n if (failure === 'overflow') fixture.live.body = '&'.repeat(14000);\n if (failure === 'readback') fixture.controls.corruptComment = true;\n if (failure === 'drift') fixture.controls.drift = true;\n const oldBody = fixture.live.body;\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n ...(failure === 'labels' ? { labels: ['invalid'] } : {}),\n }),\n );\n assert.equal(fixture.updates.length, 0, failure);\n if (failure !== 'drift') assert.equal(fixture.live.body, oldBody);\n if (failure === 'overflow' || failure === 'labels') assert.equal(fixture.comments.length, 0);\n if (failure === 'overflow') assert.ok(!fixture.events.includes('author'));\n } finally {\n fixture.cleanup();\n }\n }\n});\n\ntest('reasoned closure records supersession and verifies native reason and duplicate identity', async () => {\n for (const closeReason of ['completed', 'not_planned', 'duplicate'] as const) {\n const fixture = updateFixture();\n try {\n const input = { issueNumber: 17, state: 'closed' as const, draft: true, closeReason, supersededBy: 18 };\n const result = await issue.updateIssue(fixture.context, input);\n const closure = (\n result as unknown as {\n closure: issue.IssueClosureReadback & { supersededBy: number; comment: issue.IssueCommentReadback };\n }\n ).closure;\n assert.equal(result.state, 'closed');\n assert.equal(closure.closeReason, closeReason);\n assert.equal(closure.supersededBy, 18);\n assert.match(closure.comment.body, /example\\/widget#18/u);\n assert.equal(fixture.updates[0]!.state_reason, closeReason);\n if (closeReason === 'duplicate') {\n assert.equal(fixture.updates[0]!.duplicate_issue_id, 118);\n assert.deepEqual(closure.duplicateOf, { number: 18, repository: 'example/widget' });\n }\n await issue.updateIssue(fixture.context, input);\n assert.equal(fixture.comments.length, 2, 'closure retries reuse authoritative comments');\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n ...input,\n closeReason: closeReason === 'completed' ? 'not_planned' : 'completed',\n }),\n /already closed/u,\n );\n } finally {\n fixture.cleanup();\n }\n }\n});\n\ntest('invalid superseding issues and contradictory native closure fail closed', async () => {\n for (const failure of ['self', 'pull-request', 'reason', 'duplicate'] as const) {\n const fixture = updateFixture();\n try {\n fixture.controls.targetPr = failure === 'pull-request';\n fixture.controls.ignoreClosure = failure === 'reason';\n if (failure === 'duplicate') {\n fixture.live.state = 'closed';\n fixture.controls.reason = 'DUPLICATE';\n fixture.controls.duplicate = 19;\n }\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n issueNumber: 17,\n state: 'closed',\n draft: true,\n closeReason: failure === 'duplicate' ? 'duplicate' : 'completed',\n supersededBy: failure === 'self' ? 17 : 18,\n }),\n );\n if (failure !== 'reason') {\n assert.equal(fixture.updates.length, 0);\n assert.equal(fixture.comments.length, 0);\n }\n } finally {\n fixture.cleanup();\n }\n }\n});\n\nconst listIssues = (\n issue as unknown as {\n listIssues: (context: DeliveryContext, input: unknown) => Promise<{ issues: unknown[]; nextPage: number | null }>;\n }\n).listIssues;\n\nfunction listingFixture(\n options: {\n foreign?: boolean;\n incomplete?: boolean;\n invalidField?: boolean;\n foreignParent?: boolean;\n missingOption?: boolean;\n dualBlockers?: boolean;\n missingMulti?: boolean;\n } = {},\n) {\n const requests: Record<string, unknown>[] = [];\n const context = {\n root: '/synthetic',\n repo: { owner: 'example', repo: 'widget' },\n config: syntheticDiscoveryConfig,\n projectConfiguration: {\n projectId: 'PROJECT',\n projectNumber: 1,\n title: 'Delivery',\n writable: false,\n pointsFieldId: 'POINTS',\n priorityFieldId: 'PRIORITY',\n statusFieldId: 'STATUS',\n statusOptionIds: { Todo: 'TODO', 'In Progress': 'ACTIVE', Blocked: 'BLOCKED', Done: 'DONE' },\n settings: {\n number: 1,\n title: 'Delivery',\n statusField: 'Flow',\n statuses: { Todo: 'Queued', 'In Progress': 'Active', Blocked: 'Waiting', Done: 'Shipped' },\n },\n },\n clients: {\n rest: {\n issues: {\n listForRepo: async (params: Record<string, unknown>) => {\n requests.push(params);\n return {\n data: [\n {\n number: 17,\n node_id: 'ISSUE17',\n title: 'Repair widget',\n state: 'open',\n labels: [{ name: 'area:widget' }],\n type: { name: 'Task' },\n html_url: options.foreign\n ? 'https://github.com/elsewhere/widget/issues/17'\n : 'https://github.com/example/widget/issues/17',\n updated_at: '2026-10-07T00:00:00Z',\n },\n { number: 18, pull_request: {} },\n ],\n };\n },\n },\n search: {\n issuesAndPullRequests: async (params: Record<string, unknown>) => {\n requests.push(params);\n return { data: { total_count: 0, incomplete_results: options.incomplete ?? false, items: [] } };\n },\n },\n request: async (route: string, params: Record<string, unknown>) => {\n requests.push({ route, ...params });\n if (route.includes('/orgs/'))\n return {\n data: [\n { id: 101, name: 'Estimate', data_type: 'single_select' },\n { id: 102, name: 'Urgency', data_type: 'single_select' },\n { id: 103, name: 'Start date', data_type: 'date' },\n ...(options.missingMulti ? [{ id: 104, name: 'Tags', data_type: 'multi_select' }] : []),\n ],\n };\n return {\n data: [\n {\n issue_field_id: 101,\n issue_field_name: options.invalidField ? 'Foreign estimate' : 'Estimate',\n data_type: 'single_select',\n value: 44,\n ...(options.missingOption ? {} : { single_select_option: { id: 44, name: '4' } }),\n },\n { issue_field_id: 103, issue_field_name: 'Start date', data_type: 'date', value: '2026-10-07' },\n ...(options.missingMulti\n ? [{ issue_field_id: 104, issue_field_name: 'Tags', data_type: 'multi_select', value: 'one' }]\n : []),\n ],\n };\n },\n },\n graphql: async (query: string, variables?: Record<string, unknown>) => {\n if (query.includes('blockedBy(first:'))\n return {\n repository: {\n issue: {\n parent: {\n id: 'PARENT9',\n number: 9,\n repository: { nameWithOwner: options.foreignParent ? 'example/other' : 'example/widget' },\n },\n blockedBy: {\n nodes: [\n {\n id: 'BLOCKER8',\n number: 8,\n title: 'Prerequisite',\n state: 'CLOSED',\n repository: { nameWithOwner: 'example/widget' },\n },\n ...(options.dualBlockers\n ? [\n {\n id: 'FOREIGN8',\n number: 8,\n title: 'Other prerequisite',\n state: 'OPEN',\n repository: { nameWithOwner: 'example/other' },\n },\n ]\n : []),\n ],\n pageInfo: { hasNextPage: false, endCursor: null },\n },\n },\n },\n };\n if (query.includes('ProjectDeliveryIssueItems'))\n return issueProjectItemsResponse(variables, [\n {\n id: 'ITEM17',\n isArchived: false,\n content: { id: 'ISSUE17' },\n fieldValueByName: { name: 'Active', optionId: 'ACTIVE' },\n },\n ]);\n throw new Error('Unexpected query');\n },\n },\n } as unknown as DeliveryContext;\n return { context, requests };\n}\n\ntest('typed listing filters stay repository-bound and expose named fields without identifiers', async () => {\n const tool = getAiDeliveryMcpTool('issue_list');\n assert.ok(tool, 'issue_list is registered');\n const input = tool.inputSchema.parse({\n state: 'open',\n labels: ['area:widget'],\n parentIssueNumber: 9,\n issueType: 'Task',\n projectStatus: 'In Progress',\n updatedSince: '2026-10-01T00:00:00Z',\n perPage: 2,\n });\n const { context, requests } = listingFixture();\n const result = await listIssues(context, input);\n assert.equal(result.nextPage, 2);\n assert.deepEqual(result.issues, [\n {\n number: 17,\n title: 'Repair widget',\n state: 'open',\n labels: ['area:widget'],\n issueType: 'Task',\n parentIssueNumber: 9,\n parent: { repository: 'example/widget', number: 9 },\n blockers: [{ repository: 'example/widget', number: 8, title: 'Prerequisite', state: 'CLOSED' }],\n projectStatus: 'In Progress',\n fields: { Estimate: '4', Urgency: null, 'Start date': '2026-10-07' },\n url: 'https://github.com/example/widget/issues/17',\n updatedAt: '2026-10-07T00:00:00Z',\n },\n ]);\n assert.equal(requests[0]?.owner, 'example');\n assert.equal(requests[0]?.since, '2026-10-01T00:00:00Z');\n assert.equal(JSON.stringify(result).includes('BLOCKER8'), false);\n});\n\ntest('search quotes user text so it cannot change the selected repository', async () => {\n const tool = getAiDeliveryMcpTool('issue_search');\n assert.ok(tool, 'issue_search is registered');\n const input = tool.inputSchema.parse({ query: 'repo:elsewhere/project', page: 2, perPage: 10 });\n const { context, requests } = listingFixture();\n const result = await listIssues(context, input);\n assert.equal(result.nextPage, null);\n assert.equal(requests[0]?.q, 'repo:example/widget is:issue \"repo:elsewhere/project\"');\n});\n\ntest('update accepts history and reasoned closure while rejecting incoherent requests', () => {\n const tool = getAiDeliveryMcpTool('issue_update');\n assert.ok(tool);\n assert.equal(tool.inputSchema.safeParse({ issueNumber: 17, body: 'new body', preserveHistory: true }).success, true);\n assert.equal(\n tool.inputSchema.safeParse({ issueNumber: 17, state: 'closed', closeReason: 'duplicate', supersededBy: 9 }).success,\n true,\n );\n assert.throws(\n () => tool.inputSchema.safeParse({ issueNumber: 17, state: 'open', closeReason: 'completed' }),\n /\"code\":\"closure.state\"/u,\n );\n});\n\ntest('local filters retain pagination when the current GitHub page has no matching issue', async () => {\n const { context } = listingFixture();\n const result = await listIssues(context, { parentIssueNumber: null, perPage: 2 });\n assert.deepEqual(result.issues, []);\n assert.equal(result.nextPage, 2);\n});\n\ntest('foreign issue identity and mismatched organization fields fail rather than returning false readback', async () => {\n await assert.rejects(listIssues(listingFixture({ foreign: true }).context, {}), /foreign repository/u);\n await assert.rejects(listIssues(listingFixture({ invalidField: true }).context, {}), /conflicts with its catalog/u);\n});\n\ntest('search refuses incomplete upstream results and invalid literal text', async () => {\n await assert.rejects(\n listIssues(listingFixture({ incomplete: true }).context, { query: 'widget' }),\n /incomplete results/u,\n );\n await assert.rejects(listIssues(listingFixture().context, { query: '\" repo:elsewhere/widget' }), /literal text/u);\n assert.equal(getAiDeliveryMcpTool('issue_list')?.inputSchema.safeParse({ perPage: 101 }).success, false);\n});\n\ntest('a foreign parent with the same issue number cannot satisfy a local parent filter', async () => {\n const { context } = listingFixture({ foreignParent: true });\n assert.deepEqual((await listIssues(context, { parentIssueNumber: 9 })).issues, []);\n});\n\ntest('label filters preserve GitHub case-insensitive label identity', async () => {\n const { context } = listingFixture();\n assert.equal((await listIssues(context, { labels: ['AREA:Widget'] })).issues.length, 1);\n});\n\ntest('a set select field without its named option fails rather than reporting unset', async () => {\n await assert.rejects(listIssues(listingFixture({ missingOption: true }).context, {}), /option/u);\n});\n\ntest('same-number blockers in different repositories retain both qualified identities', async () => {\n const { context } = listingFixture({ dualBlockers: true });\n const result = await issue.listIssues(context, {});\n assert.deepEqual(result.issues[0]?.blockers, [\n { repository: 'example/widget', number: 8, title: 'Prerequisite', state: 'CLOSED' },\n { repository: 'example/other', number: 8, title: 'Other prerequisite', state: 'OPEN' },\n ]);\n});\n\ntest('a set multi-select field without named options cannot be reported unset', async () => {\n await assert.rejects(listIssues(listingFixture({ missingMulti: true }).context, {}), /option/u);\n});\n\ntest('history rendering preserves whitespace and escapes content that could end the collapsed section', () => {\n const render = (issue as unknown as { renderIssueHistory: (title: string, body: string) => string })\n .renderIssueHistory;\n assert.equal(typeof render, 'function');\n const body = ' old body\\n</pre></details><script>x</script> & text ';\n const result = render('Old <title> & name', body);\n assert.equal(\n result,\n '<details>\\n<summary>Previous issue title and body</summary>\\n\\nTitle:\\n<pre>Old <title> & name</pre>\\n\\nBody:\\n<pre> old body\\n</pre></details><script>x</script> & text </pre>\\n\\n</details>',\n );\n});\n\ntest('closure evidence reads native reason and preserves qualified duplicate identity', async () => {\n const { context } = listingFixture();\n context.clients.graphql = (async () => ({\n repository: {\n issue: {\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n state: 'CLOSED',\n stateReason: 'DUPLICATE',\n duplicateOf: { number: 9, repository: { nameWithOwner: 'example/other' } },\n },\n },\n })) as unknown as typeof context.clients.graphql;\n const read = (\n issue as unknown as { readIssueClosure: (context: DeliveryContext, issueNumber: number) => Promise<unknown> }\n ).readIssueClosure;\n assert.equal(typeof read, 'function');\n assert.deepEqual(await read(context, 17), {\n state: 'closed',\n closeReason: 'duplicate',\n duplicateOf: { number: 9, repository: 'example/other' },\n });\n});\n\ntest('native field catalog and values both paginate through the last named field', async () => {\n const { context } = listingFixture();\n const requests: { route: string; page: unknown }[] = [];\n context.clients.rest.request = (async (route: string, params: Record<string, unknown>) => {\n requests.push({ route, page: params.page });\n const catalog = route.includes('/orgs/');\n if (params.page === 2)\n return {\n data: catalog\n ? [{ id: 201, name: 'Late date', data_type: 'date' }]\n : [{ issue_field_id: 201, issue_field_name: 'Late date', data_type: 'date', value: '2026-10-09' }],\n };\n return {\n data: catalog\n ? [\n { id: 101, name: 'Estimate', data_type: 'single_select' },\n { id: 102, name: 'Urgency', data_type: 'single_select' },\n ...Array.from({ length: 98 }, (_, index) => ({\n id: index + 103,\n name: `Custom ${String(index)}`,\n data_type: 'text',\n })),\n ]\n : [\n {\n issue_field_id: 101,\n issue_field_name: 'Estimate',\n data_type: 'single_select',\n value: 44,\n single_select_option: { name: '4' },\n },\n { issue_field_id: 102, issue_field_name: 'Urgency', data_type: 'single_select', value: null },\n ...Array.from({ length: 98 }, (_, index) => ({\n issue_field_id: index + 103,\n issue_field_name: `Custom ${String(index)}`,\n data_type: 'text',\n value: 'retained',\n })),\n ],\n };\n }) as unknown as typeof context.clients.rest.request;\n const result = await issue.listIssues(context, {});\n assert.equal(result.issues[0]?.fields['Late date'], '2026-10-09');\n assert.equal(result.issues[0]?.fields.Urgency, null);\n assert.deepEqual(\n requests.map((request) => request.page),\n [1, 2, 1, 2],\n );\n});\n\ntest('native field pagination fails closed on a repeated nonadvancing page', async () => {\n const { context } = listingFixture();\n context.clients.rest.request = (async () => ({\n data: Array.from({ length: 100 }, (_, index) => ({\n id: index + 1,\n name: `Field ${String(index)}`,\n data_type: 'text',\n })),\n })) as unknown as typeof context.clients.rest.request;\n await assert.rejects(issue.listIssues(context, {}), /repeated a pagination page/u);\n});\n\ntest.each([\n ['catalog', 'list'],\n ['values', 'list'],\n ['catalog', 'ready'],\n ['values', 'ready'],\n ['catalog', 'capacity'],\n ['values', 'capacity'],\n] as const)('reconciliation bounds native %s through %s reads', async (collection, entry) => {\n const { context } = listingFixture();\n Object.assign(context, { readPageLimit: 20 });\n if (entry === 'ready')\n context.clients.rest.issues.listSubIssues = (async (input: Record<string, unknown>) => {\n assert.equal(input.owner, 'example');\n assert.equal(input.repo, 'widget');\n assert.equal(input.issue_number, 17);\n return { data: [] };\n }) as unknown as typeof context.clients.rest.issues.listSubIssues;\n context.clients.rest.issues.get = (async () => ({\n data: {\n number: 17,\n node_id: 'ISSUE17',\n state: 'open',\n body: '',\n title: 'Repair widget',\n html_url: 'https://github.com/example/widget/issues/17',\n },\n })) as typeof context.clients.rest.issues.get;\n if (entry === 'capacity')\n context.config = {\n ...context.config,\n wipLimits: [{ repository: 'example/widget', name: 'Native', match: { field: 'Estimate', value: '4' }, limit: 2 }],\n };\n const originalGraphql = context.clients.graphql;\n context.clients.graphql = (async (query: string, variables?: Record<string, unknown>) => {\n const response = await originalGraphql(query, variables);\n if (!query.includes('blockedBy(first:')) return response;\n const parsed = response as { repository: { issue: Record<string, unknown> } };\n Object.assign(parsed.repository.issue, {\n id: 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n });\n return parsed;\n }) as unknown as typeof context.clients.graphql;\n const original = context.clients.rest.request;\n let requests = 0;\n context.clients.rest.request = (async (route: string, params: { page: number }) => {\n if (route.includes('/orgs/') !== (collection === 'catalog')) return original(route);\n requests++;\n return {\n data:\n params.page > 20\n ? []\n : Array.from({ length: 100 }, (_, index) => {\n const id = 1000 + params.page * 100 + index;\n return collection === 'catalog'\n ? { id, name: `Extra ${String(id)}`, data_type: 'text' }\n : { issue_field_id: id, issue_field_name: `Extra ${String(id)}`, data_type: 'text', value: 'value' };\n }),\n };\n }) as typeof context.clients.rest.request;\n const operation =\n entry === 'list'\n ? issue.listIssues(context, {})\n : entry === 'ready'\n ? issue.readyCheck(context, 17)\n : issue.assertIssueStartCapacity(context, 17);\n await assert.rejects(operation, (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n assert.equal(Reflect.get(error, 'pagesRequested'), 20);\n return true;\n });\n assert.equal(requests, 20);\n});\n\ntest('reconciliation bounds blocker pages and binds their source issue', async () => {\n const { context } = listingFixture();\n let requests = 0;\n context.clients.graphql = (async () => {\n requests++;\n return {\n repository: {\n issue: {\n id: 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n parent: null,\n blockedBy: { nodes: [], pageInfo: { hasNextPage: requests < 21, endCursor: `page-${String(requests)}` } },\n },\n },\n };\n }) as unknown as typeof context.clients.graphql;\n const input = { graphql: context.clients.graphql, repo: context.repo, issueNumber: 17, maxPages: 20 };\n await assert.rejects(getNativeBlockerRelationships(input), (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n assert.equal(Reflect.get(error, 'pagesRequested'), 20);\n return true;\n });\n assert.equal(requests, 20);\n});\n\ntest('reconciliation WIP guards bound their label catalog', async () => {\n const { context } = listingFixture();\n Object.assign(context, { readPageLimit: 20 });\n context.config = {\n ...context.config,\n wipLimits: [{ repository: 'example/widget', name: 'Urgent', match: { label: 'urgent' }, limit: 2 }],\n };\n let requests = 0;\n context.clients.rest.issues.listLabelsForRepo = (async () => {\n requests++;\n return {\n data:\n requests > 20\n ? []\n : Array.from({ length: 100 }, (_, index) => ({\n name: index === 0 && requests === 1 ? 'urgent' : `label-${String(requests)}-${String(index)}`,\n })),\n };\n }) as typeof context.clients.rest.issues.listLabelsForRepo;\n await assert.rejects(issue.assertIssueStartCapacity(context, 17), (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n return true;\n });\n assert.equal(requests, 20);\n});\n\nfunction membershipFixture() {\n const configuration = { ...listingFixture().context.projectConfiguration!, writable: true };\n const events: string[] = [];\n const controls = { corrupt: '', archived: false, duplicate: false, unreadable: false };\n let member = false;\n let status: 'In Progress' | null = null;\n const item = (readback = false) => ({\n id: readback && controls.corrupt === 'item' ? 'WRONG' : 'ITEM17',\n isArchived: controls.archived,\n project: { id: readback && controls.corrupt === 'project' ? 'WRONG' : 'PROJECT', number: 1 },\n content: controls.unreadable\n ? null\n : {\n __typename: 'Issue',\n id: readback && controls.corrupt === 'issue' ? 'WRONG' : 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n },\n fieldValueByName:\n status === null ? null : { name: 'Active', optionId: controls.corrupt === 'option' ? 'WRONG' : 'ACTIVE' },\n });\n const graphql = (async (query: string, variables?: Record<string, unknown>) => {\n if (query.includes('mutation AddProjectDeliveryItem')) {\n events.push('add');\n member = true;\n return { addProjectV2ItemById: { item: { id: 'ITEM17' } } };\n }\n if (query.includes('mutation UpdateProjectDeliveryStatus')) {\n events.push('status');\n status = 'In Progress';\n return { updateProjectV2ItemFieldValue: { projectV2Item: { id: 'ITEM17' } } };\n }\n if (query.includes('query ProjectDeliveryItemReadback')) {\n events.push('readback');\n return { node: item(true) };\n }\n const items = member ? (controls.duplicate ? [item(), { ...item(), id: 'SECOND' }] : [item()]) : [];\n if (query.includes('query ProjectDeliveryIssueItems')) return issueProjectItemsResponse(variables, items);\n if (query.includes('query ProjectDeliveryItems'))\n return {\n organization: {\n projectV2: { id: 'PROJECT', number: 1, items: { nodes: items, pageInfo: { hasNextPage: false } } },\n },\n };\n throw new Error('Unexpected membership fixture query.');\n }) as unknown as DeliveryContext['clients']['graphql'];\n return {\n input: { graphql, configuration, org: 'example', issueNodeId: 'ISSUE17' },\n events,\n controls,\n setMember: () => {\n member = true;\n },\n };\n}\n\ntest('membership-only add verifies the exact unarchived item and reuse writes nothing', async () => {\n const f = membershipFixture();\n const ensure = Reflect.get(projectDelivery, 'ensureIssueProjectMembership') as\n | ((input: typeof f.input & { beforeAdd?: () => Promise<void> }) => Promise<{ itemId: string; archived: false }>)\n | undefined;\n assert.equal(typeof ensure, 'function');\n const result = await ensure!({\n ...f.input,\n beforeAdd: async () => {\n f.events.push('before-add');\n },\n });\n assert.deepEqual(result, { itemId: 'ITEM17', archived: false });\n assert.deepEqual(f.events, ['before-add', 'add', 'readback']);\n f.events.length = 0;\n await ensure!(f.input);\n assert.deepEqual(f.events, ['readback']);\n});\n\ntest.each(['project', 'issue', 'item', 'archive', 'duplicate', 'unreadable'] as const)(\n 'membership refuses %s evidence without a repair write',\n async (failure) => {\n const f = membershipFixture();\n f.setMember();\n if (failure === 'archive') f.controls.archived = true;\n else if (failure === 'duplicate') f.controls.duplicate = true;\n else if (failure === 'unreadable') f.controls.unreadable = true;\n else f.controls.corrupt = failure;\n const ensure = Reflect.get(projectDelivery, 'ensureIssueProjectMembership') as\n | ((input: typeof f.input) => Promise<unknown>)\n | undefined;\n assert.equal(typeof ensure, 'function');\n await assert.rejects(ensure!(f.input));\n assert.deepEqual(\n f.events.filter((e) => e === 'add' || e === 'status'),\n [],\n );\n },\n);\n\nconst projectRow = {\n id: 'ITEM17',\n isArchived: false,\n project: { id: 'PROJECT', number: 1 },\n content: { id: 'ISSUE17' },\n fieldValueByName: { name: 'Active', optionId: 'ACTIVE' },\n};\n\nfunction readStatus(nodes: unknown[], overrides: { nodeId?: string; hasNextPage?: boolean } = {}) {\n const { input } = membershipFixture();\n const graphql = (async () => ({\n node: {\n id: overrides.nodeId ?? 'ISSUE17',\n projectItems: { nodes, pageInfo: { hasNextPage: overrides.hasNextPage ?? false } },\n },\n })) as unknown as typeof input.graphql;\n return projectDelivery.getIssueProjectStatus({ ...input, graphql });\n}\n\ntest('issue Project Status is the exact configured item and never a guess (#180)', async () => {\n assert.deepEqual(await readStatus([projectRow]), { itemId: 'ITEM17', status: 'In Progress' });\n assert.equal(await readStatus([]), null);\n assert.equal(await readStatus([{ ...projectRow, isArchived: true }]), null);\n assert.equal(await readStatus([{ ...projectRow, project: { id: 'OTHER', number: 9 } }]), null);\n});\n\ntest.each([\n ['a different issue node', () => readStatus([projectRow], { nodeId: 'ISSUE99' }), /different issue/u],\n ['more than 50 Projects', () => readStatus([projectRow], { hasNextPage: true }), /more than 50 Projects/u],\n ['an unreadable item in the configured Project', () => readStatus([{ ...projectRow, content: null }]), /unreadable/u],\n [\n 'a duplicate item in the configured Project',\n () => readStatus([projectRow, { ...projectRow, id: 'SECOND' }]),\n /duplicate/u,\n ],\n])('issue Project lookup refuses %s', async (_name, read, message) => {\n await assert.rejects(read(), message);\n});\n\ntest('guards run immediately before both Project mutation boundaries', async () => {\n const f = membershipFixture();\n const input = {\n ...f.input,\n status: 'In Progress' as const,\n beforeAdd: async () => {\n f.events.push('before-add');\n },\n beforeAdvance: async () => {\n f.events.push('before-advance');\n },\n };\n await projectDelivery.syncIssueProjectStatus(input);\n assert.deepEqual(\n f.events.filter((e) => e !== 'readback'),\n ['before-add', 'add', 'before-advance', 'status'],\n );\n const refused = membershipFixture();\n const fail = {\n ...refused.input,\n status: 'In Progress' as const,\n beforeAdd: async () => {\n throw new Error('native drift');\n },\n };\n await assert.rejects(projectDelivery.syncIssueProjectStatus(fail), /native drift/u);\n assert.deepEqual(refused.events, []);\n});\n\ntest.each(['project', 'option'] as const)(\n 'Project %s readback failure preserves an attempted write without retry',\n async (failure) => {\n const f = membershipFixture();\n f.controls.corrupt = failure;\n if (failure === 'project') {\n await assert.rejects(projectDelivery.ensureIssueProjectMembership(f.input), /exact issue item/u);\n assert.deepEqual(f.events, ['add', 'readback']);\n } else {\n f.setMember();\n await assert.rejects(\n projectDelivery.syncIssueProjectStatus({ ...f.input, status: 'In Progress' }),\n /unsupported Project Status/u,\n );\n assert.deepEqual(f.events, ['status', 'readback']);\n }\n },\n);\n\ntest('search applies the same case-insensitive label filter to authoritative result rows', async () => {\n const { context } = listingFixture();\n context.clients.rest.search.issuesAndPullRequests = (async () => ({\n data: {\n total_count: 1,\n incomplete_results: false,\n items: [\n {\n number: 17,\n node_id: 'ISSUE17',\n title: 'Repair widget',\n state: 'open',\n labels: [{ name: 'area:widget' }],\n type: { name: 'Task' },\n html_url: 'https://github.com/example/widget/issues/17',\n updated_at: '2026-10-07T00:00:00Z',\n },\n ],\n },\n })) as unknown as typeof context.clients.rest.search.issuesAndPullRequests;\n const result = await issue.listIssues(context, { query: 'widget', labels: ['AREA:Widget'] });\n assert.equal(result.issues.length, 1);\n assert.equal(result.nextPage, null);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,aAAa,cAAc;AACpC,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,gCAAgC;AAEzC,SAAS,qCAAqC;AAC9C,YAAY,qBAAqB;AACjC,SAAS,iCAAiC;AAE1C,SAAS,gBAAgB;AACvB,QAAM,OAAO,YAAY,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAC/D,eAAa,OAAO,CAAC,QAAQ,MAAM,MAAM,MAAM,GAAG,EAAE,KAAK,KAAK,CAAC;AAC/D,QAAM,SAAmB,CAAC;AAC1B,QAAM,OAAO;AAAA,IACX,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AACA,QAAM,WAAW;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,oBAAoB;AAAA,IACpB,+BAA+B;AAAA,IAC/B,8BAA8B;AAAA,IAC9B,oBAAoB;AAAA,IACpB,sBAAsB;AAAA,IACtB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,IACxB,0BAA0B;AAAA,I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W,SAAS,EAAE,OAAO,UAAU,QAAQ,CAAC,aAAa,EAAE,CAAC;AAC3F,SAAO,MAAM,OAAO,OAAO,QAAQ,CAAC;AACpC,SAAO,MAAM,OAAO,UAAU,IAAI;AACpC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/mcp/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { z } from "zod";
|
|
|
4
4
|
import { executeTool } from "../dispatch.js";
|
|
5
5
|
import { setLogsSuppressed } from "../logger.js";
|
|
6
6
|
import { PACKAGE_VERSION } from "../version.js";
|
|
7
|
+
import { acceptedKeysError } from "../issueContract.js";
|
|
7
8
|
import { JOURNAL_SCHEMA_METADATA, missingJournalFields } from "../issueJournal.js";
|
|
8
9
|
import { getIncompleteIssueUpdate } from "../issue.js";
|
|
9
10
|
import { projectToolOutput } from "../toolOutput.js";
|
|
@@ -21,12 +22,11 @@ function createAiDeliveryMcpServer(context, activeCalls) {
|
|
|
21
22
|
tool.name,
|
|
22
23
|
{
|
|
23
24
|
description: tool.description,
|
|
25
|
+
...tool.readOnly ? { annotations: { readOnlyHint: true } } : {},
|
|
24
26
|
// The SDK must leave journal kind refinements to the handler so missing
|
|
25
27
|
// conditional fields receive a safe, actionable contract refusal. Unknown
|
|
26
28
|
// property names stay private through a schema-local error message.
|
|
27
|
-
inputSchema: tool.name === "issue_comment" ? z.strictObject(tool.inputSchema.shape, {
|
|
28
|
-
error: "Invalid journal object. Provide only the advertised fields."
|
|
29
|
-
}).partial().meta(JOURNAL_SCHEMA_METADATA) : tool.inputSchema
|
|
29
|
+
inputSchema: tool.name === "issue_comment" ? z.strictObject(tool.inputSchema.shape, { error: acceptedKeysError }).partial().meta(JOURNAL_SCHEMA_METADATA) : tool.inputSchema
|
|
30
30
|
},
|
|
31
31
|
async (args, extra) => {
|
|
32
32
|
const parsed = tool.inputSchema.safeParse(args);
|
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 { JOURNAL_SCHEMA_METADATA, missingJournalFields } 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 {
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAElB,SAAS,mBAA0C;AACnD,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB,4BAA4B;AAC9D,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,
|
|
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 { JOURNAL_SCHEMA_METADATA, missingJournalFields } 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 missing = tool.name === 'issue_comment' ? missingJournalFields(args) : [];\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.` : tool.name === 'issue_comment' ? ` ${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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QAAQ,WAAW,WAAW;AACpC,YAAM,OAAO,MAAM;AACnB,cAAQ,KAAK,CAAC;AAAA,IAChB,GAAG;AACH,WAAO;AAAA,EACT;AACA,UAAQ,KAAK,UAAU,MAAM;AAC3B,SAAK,MAAM;AAAA,EACb,CAAC;AACD,UAAQ,KAAK,WAAW,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
|
@@ -179,6 +179,7 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
179
179
|
}, z.core.$strict>;
|
|
180
180
|
}, {
|
|
181
181
|
readonly name: 'issue_list';
|
|
182
|
+
readonly readOnly: true;
|
|
182
183
|
readonly commandName: 'list';
|
|
183
184
|
readonly description: 'List repository issues with native filters, named organization fields and pagination';
|
|
184
185
|
readonly inputSchema: z.ZodObject<{
|
|
@@ -205,6 +206,7 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
205
206
|
}, z.core.$strict>;
|
|
206
207
|
}, {
|
|
207
208
|
readonly name: 'issue_search';
|
|
209
|
+
readonly readOnly: true;
|
|
208
210
|
readonly commandName: 'search';
|
|
209
211
|
readonly description: 'Search literal issue text in the selected repository with native filters and pagination';
|
|
210
212
|
readonly inputSchema: z.ZodObject<{
|
|
@@ -389,8 +391,9 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
389
391
|
}, z.core.$strict>;
|
|
390
392
|
}, {
|
|
391
393
|
readonly name: 'issue_info';
|
|
394
|
+
readonly readOnly: true;
|
|
392
395
|
readonly commandName: 'info';
|
|
393
|
-
readonly description: 'Read live GitHub issue metadata, relationships, Project status, linked PRs (state, checks, reviews) and the latest journal in one call. Child counts by default; verbose adds the body, 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.';
|
|
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.';
|
|
394
397
|
readonly inputSchema: z.ZodObject<{
|
|
395
398
|
issueNumber: z.ZodNumber;
|
|
396
399
|
repo: z.ZodOptional<z.ZodString>;
|
|
@@ -398,6 +401,7 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
398
401
|
}, z.core.$strict>;
|
|
399
402
|
}, {
|
|
400
403
|
readonly name: 'issue_ready_check';
|
|
404
|
+
readonly readOnly: true;
|
|
401
405
|
readonly commandName: 'ready:check';
|
|
402
406
|
readonly description: 'Evaluate deterministic readiness from live native issue state';
|
|
403
407
|
readonly inputSchema: z.ZodObject<{
|
|
@@ -408,7 +412,7 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
408
412
|
}, {
|
|
409
413
|
readonly name: 'issue_pr_create';
|
|
410
414
|
readonly commandName: 'pr:create';
|
|
411
|
-
readonly description: 'Create or reuse a PR from any directory using repo, issueNumber and a pushed head. By default it closes the issue and restores a missing closing link on reuse. nonClosing opens a draft that references the issue and leaves it open. expectedHeadSha refuses a different pushed head.';
|
|
415
|
+
readonly description: 'Create or reuse a PR from any directory using repo, issueNumber and a pushed head. By default it closes the issue and restores a missing closing link on reuse. On an existing closing PR, a new title or body edits it and draft: false marks it ready. nonClosing opens a draft that references the issue and leaves it open. expectedHeadSha refuses a different pushed head.';
|
|
412
416
|
readonly inputSchema: z.ZodObject<{
|
|
413
417
|
repo: z.ZodOptional<z.ZodString>;
|
|
414
418
|
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -426,8 +430,9 @@ export declare const AI_DELIVERY_MCP_TOOLS: readonly [{
|
|
|
426
430
|
}, z.core.$strict>;
|
|
427
431
|
}, {
|
|
428
432
|
readonly name: 'issue_pr_info';
|
|
433
|
+
readonly readOnly: true;
|
|
429
434
|
readonly commandName: 'pr:info';
|
|
430
|
-
readonly description: "Inspect a PR by number or its GitHub-linked issue branch: state, merge state, checks, reviews and each linked issue's state, Project status and latest journal, in one call";
|
|
435
|
+
readonly description: "Inspect a PR by number or its GitHub-linked issue branch: state, merge state, merge commit, checks, reviews and each linked issue's state, Project status and latest journal, in one call";
|
|
431
436
|
readonly inputSchema: z.ZodObject<{
|
|
432
437
|
repo: z.ZodOptional<z.ZodString>;
|
|
433
438
|
verbose: z.ZodOptional<z.ZodBoolean>;
|