@neurynae/toolcairn-mcp 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/chunk-B74KV6FC.js +59 -0
  2. package/dist/chunk-B74KV6FC.js.map +1 -0
  3. package/dist/dist-2HK3ZGXE.js +5989 -0
  4. package/dist/dist-2HK3ZGXE.js.map +1 -0
  5. package/dist/index.js +2069 -35
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/dist/index.d.ts +0 -2
  9. package/dist/index.d.ts.map +0 -1
  10. package/dist/middleware/event-logger.d.ts +0 -19
  11. package/dist/middleware/event-logger.d.ts.map +0 -1
  12. package/dist/middleware/event-logger.js +0 -138
  13. package/dist/middleware/event-logger.js.map +0 -1
  14. package/dist/schemas.d.ts +0 -2
  15. package/dist/schemas.d.ts.map +0 -1
  16. package/dist/schemas.js +0 -3
  17. package/dist/schemas.js.map +0 -1
  18. package/dist/server.d.ts +0 -3
  19. package/dist/server.d.ts.map +0 -1
  20. package/dist/server.js +0 -116
  21. package/dist/server.js.map +0 -1
  22. package/dist/server.prod.d.ts +0 -14
  23. package/dist/server.prod.d.ts.map +0 -1
  24. package/dist/server.prod.js +0 -127
  25. package/dist/server.prod.js.map +0 -1
  26. package/dist/templates/agent-instructions.d.ts +0 -22
  27. package/dist/templates/agent-instructions.d.ts.map +0 -1
  28. package/dist/templates/agent-instructions.js +0 -155
  29. package/dist/templates/agent-instructions.js.map +0 -1
  30. package/dist/tools/check-compatibility.d.ts +0 -100
  31. package/dist/tools/check-compatibility.d.ts.map +0 -1
  32. package/dist/tools/check-compatibility.js +0 -103
  33. package/dist/tools/check-compatibility.js.map +0 -1
  34. package/dist/tools/check-issue.d.ts +0 -126
  35. package/dist/tools/check-issue.d.ts.map +0 -1
  36. package/dist/tools/check-issue.js +0 -248
  37. package/dist/tools/check-issue.js.map +0 -1
  38. package/dist/tools/classify-prompt.d.ts +0 -101
  39. package/dist/tools/classify-prompt.d.ts.map +0 -1
  40. package/dist/tools/classify-prompt.js +0 -64
  41. package/dist/tools/classify-prompt.js.map +0 -1
  42. package/dist/tools/compare-tools.d.ts +0 -102
  43. package/dist/tools/compare-tools.d.ts.map +0 -1
  44. package/dist/tools/compare-tools.js +0 -178
  45. package/dist/tools/compare-tools.js.map +0 -1
  46. package/dist/tools/format-results.d.ts +0 -44
  47. package/dist/tools/format-results.d.ts.map +0 -1
  48. package/dist/tools/format-results.js +0 -114
  49. package/dist/tools/format-results.js.map +0 -1
  50. package/dist/tools/generate-tracker.d.ts +0 -7
  51. package/dist/tools/generate-tracker.d.ts.map +0 -1
  52. package/dist/tools/generate-tracker.js +0 -408
  53. package/dist/tools/generate-tracker.js.map +0 -1
  54. package/dist/tools/get-stack.d.ts +0 -105
  55. package/dist/tools/get-stack.d.ts.map +0 -1
  56. package/dist/tools/get-stack.js +0 -156
  57. package/dist/tools/get-stack.js.map +0 -1
  58. package/dist/tools/init-project-config.d.ts +0 -107
  59. package/dist/tools/init-project-config.d.ts.map +0 -1
  60. package/dist/tools/init-project-config.js +0 -52
  61. package/dist/tools/init-project-config.js.map +0 -1
  62. package/dist/tools/read-project-config.d.ts +0 -99
  63. package/dist/tools/read-project-config.d.ts.map +0 -1
  64. package/dist/tools/read-project-config.js +0 -78
  65. package/dist/tools/read-project-config.js.map +0 -1
  66. package/dist/tools/refine-requirement.d.ts +0 -105
  67. package/dist/tools/refine-requirement.d.ts.map +0 -1
  68. package/dist/tools/refine-requirement.js +0 -77
  69. package/dist/tools/refine-requirement.js.map +0 -1
  70. package/dist/tools/report-outcome.d.ts +0 -104
  71. package/dist/tools/report-outcome.d.ts.map +0 -1
  72. package/dist/tools/report-outcome.js +0 -108
  73. package/dist/tools/report-outcome.js.map +0 -1
  74. package/dist/tools/search-tools-respond.d.ts +0 -103
  75. package/dist/tools/search-tools-respond.d.ts.map +0 -1
  76. package/dist/tools/search-tools-respond.js +0 -91
  77. package/dist/tools/search-tools-respond.js.map +0 -1
  78. package/dist/tools/search-tools.d.ts +0 -104
  79. package/dist/tools/search-tools.d.ts.map +0 -1
  80. package/dist/tools/search-tools.js +0 -77
  81. package/dist/tools/search-tools.js.map +0 -1
  82. package/dist/tools/suggest-graph-update.d.ts +0 -117
  83. package/dist/tools/suggest-graph-update.d.ts.map +0 -1
  84. package/dist/tools/suggest-graph-update.js +0 -177
  85. package/dist/tools/suggest-graph-update.js.map +0 -1
  86. package/dist/tools/toolpilot-init.d.ts +0 -103
  87. package/dist/tools/toolpilot-init.d.ts.map +0 -1
  88. package/dist/tools/toolpilot-init.js +0 -117
  89. package/dist/tools/toolpilot-init.js.map +0 -1
  90. package/dist/tools/update-project-config.d.ts +0 -104
  91. package/dist/tools/update-project-config.d.ts.map +0 -1
  92. package/dist/tools/update-project-config.js +0 -117
  93. package/dist/tools/update-project-config.js.map +0 -1
  94. package/dist/tools/verify-suggestion.d.ts +0 -113
  95. package/dist/tools/verify-suggestion.d.ts.map +0 -1
  96. package/dist/tools/verify-suggestion.js +0 -223
  97. package/dist/tools/verify-suggestion.js.map +0 -1
  98. package/dist/transport.d.ts +0 -5
  99. package/dist/transport.d.ts.map +0 -1
  100. package/dist/transport.js +0 -13
  101. package/dist/transport.js.map +0 -1
  102. package/dist/utils.d.ts +0 -4
  103. package/dist/utils.d.ts.map +0 -1
  104. package/dist/utils.js +0 -12
  105. package/dist/utils.js.map +0 -1
@@ -1,103 +0,0 @@
1
- import { MemgraphToolRepository } from '@toolpilot/graph';
2
- import pino from 'pino';
3
- import { errResult, okResult } from '../utils.js';
4
- const logger = pino({ name: '@toolpilot/mcp-server:check-compatibility' });
5
- const repo = new MemgraphToolRepository();
6
- const COMPATIBLE_TYPES = new Set(['COMPATIBLE_WITH', 'INTEGRATES_WITH', 'POPULAR_WITH']);
7
- const CONFLICT_TYPES = new Set(['CONFLICTS_WITH', 'BREAKS_FROM']);
8
- const REQUIRES_TYPES = new Set(['REQUIRES']);
9
- export async function handleCheckCompatibility(args) {
10
- try {
11
- logger.info({ tool_a: args.tool_a, tool_b: args.tool_b }, 'check_compatibility called');
12
- // Verify both tools exist
13
- const [existsA, existsB] = await Promise.all([
14
- repo.toolExists(args.tool_a),
15
- repo.toolExists(args.tool_b),
16
- ]);
17
- if (!existsA.ok || !existsA.data) {
18
- return errResult('tool_not_found', `Tool "${args.tool_a}" not found in the ToolPilot index`);
19
- }
20
- if (!existsB.ok || !existsB.data) {
21
- return errResult('tool_not_found', `Tool "${args.tool_b}" not found in the ToolPilot index`);
22
- }
23
- // Check direct edges between the two tools
24
- const edgesResult = await repo.getDirectEdges(args.tool_a, args.tool_b);
25
- if (!edgesResult.ok) {
26
- return errResult('graph_error', edgesResult.error.message);
27
- }
28
- const edges = edgesResult.data;
29
- let status = 'unknown';
30
- let confidence = 0.5;
31
- const signals = [];
32
- if (edges.length > 0) {
33
- // Direct edges — high confidence
34
- confidence = Math.max(...edges.map((e) => e.confidence));
35
- if (edges.some((e) => CONFLICT_TYPES.has(e.edgeType))) {
36
- status = 'conflicts';
37
- signals.push(`Direct ${edges.find((e) => CONFLICT_TYPES.has(e.edgeType))?.edgeType} edge found`);
38
- }
39
- else if (edges.some((e) => COMPATIBLE_TYPES.has(e.edgeType))) {
40
- status = 'compatible';
41
- signals.push(`Direct ${edges.find((e) => COMPATIBLE_TYPES.has(e.edgeType))?.edgeType} edge found`);
42
- }
43
- else if (edges.some((e) => REQUIRES_TYPES.has(e.edgeType))) {
44
- status = 'requires';
45
- signals.push('Direct REQUIRES relationship found');
46
- }
47
- }
48
- else {
49
- // No direct edges — check 2-hop paths via shared neighbors
50
- const [neighborsA, neighborsB] = await Promise.all([
51
- repo.getRelated(args.tool_a, 10),
52
- repo.getRelated(args.tool_b, 10),
53
- ]);
54
- if (neighborsA.ok && neighborsB.ok) {
55
- const namesA = new Set(neighborsA.data.map((t) => t.name));
56
- const namesB = new Set(neighborsB.data.map((t) => t.name));
57
- const sharedNeighbors = [...namesA].filter((n) => namesB.has(n));
58
- if (sharedNeighbors.length >= 3) {
59
- status = 'compatible';
60
- confidence = 0.6;
61
- signals.push(`${sharedNeighbors.length} shared graph neighbors suggest these tools are used together`);
62
- }
63
- else if (sharedNeighbors.length > 0) {
64
- status = 'unknown';
65
- confidence = 0.4;
66
- signals.push(`${sharedNeighbors.length} shared neighbors found — insufficient for strong inference`);
67
- }
68
- else {
69
- signals.push('No direct edges or shared neighbors — these tools may operate in different domains');
70
- }
71
- }
72
- }
73
- const recommendation = status === 'compatible'
74
- ? `${args.tool_a} and ${args.tool_b} can be used together.`
75
- : status === 'conflicts'
76
- ? `${args.tool_a} and ${args.tool_b} have known conflicts. Avoid using them in the same project.`
77
- : status === 'requires'
78
- ? 'One of these tools requires the other. Check the direction of the REQUIRES edge.'
79
- : 'No direct compatibility data. These tools may work together but it has not been verified.';
80
- return okResult({
81
- tool_a: args.tool_a,
82
- tool_b: args.tool_b,
83
- status,
84
- confidence: Math.round(confidence * 100) / 100,
85
- direct_edges: edges.map((e) => ({
86
- type: e.edgeType,
87
- direction: e.direction,
88
- confidence: Math.round(e.confidence * 100) / 100,
89
- effective_weight: Math.round(e.effective_weight * 100) / 100,
90
- })),
91
- signals,
92
- recommendation,
93
- suggest_graph_update: status === 'unknown'
94
- ? `If you discover compatibility data, call suggest_graph_update with suggestion_type: "new_edge" to contribute it back.`
95
- : null,
96
- });
97
- }
98
- catch (e) {
99
- logger.error({ err: e }, 'check_compatibility failed');
100
- return errResult('compatibility_error', e instanceof Error ? e.message : String(e));
101
- }
102
- }
103
- //# sourceMappingURL=check-compatibility.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-compatibility.js","sourceRoot":"","sources":["../../src/tools/check-compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,M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d,oBAAoB,EAClB,MAAM,KAAK,SAAS;gBAClB,CAAC,CAAC,uHAAuH;gBACzH,CAAC,CAAC,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,4BAA4B,CAAC,CAAC;QACvD,OAAO,SAAS,CAAC,qBAAqB,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;AACH,CAAC"}
@@ -1,126 +0,0 @@
1
- /**
2
- * check_issue — Checks GitHub directly for known issues matching an error.
3
- *
4
- * IMPORTANT: This is a last-resort tool. The agent should:
5
- * 1. Try to fix the error itself (2 retries)
6
- * 2. Consult the tool's documentation (2 more retries)
7
- * 3. ONLY THEN call check_issue (pass retry_count≥4, docs_consulted=true)
8
- *
9
- * This prevents spamming the GitHub API for errors that are config issues,
10
- * environment problems, or things the docs would explain.
11
- *
12
- * Flow:
13
- * 1. Gate: enforce retry + docs requirements
14
- * 2. Look up tool's github_url in Memgraph
15
- * 3. Search GitHub Issues API directly (no local DB — live data)
16
- * 4. Also search for PRs that may fix the issue
17
- * 5. Return one of four statuses:
18
- * - not_found: no matching issue on GitHub → agent handles it
19
- * - fix_in_progress: open issue + open PR exists → track PR
20
- * - known_issue_no_fix: open issue, no PR → gist + ask user intent
21
- * - fixed_in_version: closed issue → which version fixed it
22
- * 6. In real-issue cases (3/4): add 👍 reaction to the issue via GitHub API
23
- */
24
- export declare function handleCheckIssue(args: {
25
- tool_name: string;
26
- issue_title: string;
27
- retry_count?: number;
28
- docs_consulted?: boolean;
29
- issue_url?: string;
30
- }): Promise<{
31
- [x: string]: unknown;
32
- content: ({
33
- type: "text";
34
- text: string;
35
- annotations?: {
36
- audience?: ("user" | "assistant")[] | undefined;
37
- priority?: number | undefined;
38
- lastModified?: string | undefined;
39
- } | undefined;
40
- _meta?: {
41
- [x: string]: unknown;
42
- } | undefined;
43
- } | {
44
- type: "image";
45
- data: string;
46
- mimeType: string;
47
- annotations?: {
48
- audience?: ("user" | "assistant")[] | undefined;
49
- priority?: number | undefined;
50
- lastModified?: string | undefined;
51
- } | undefined;
52
- _meta?: {
53
- [x: string]: unknown;
54
- } | undefined;
55
- } | {
56
- type: "audio";
57
- data: string;
58
- mimeType: string;
59
- annotations?: {
60
- audience?: ("user" | "assistant")[] | undefined;
61
- priority?: number | undefined;
62
- lastModified?: string | undefined;
63
- } | undefined;
64
- _meta?: {
65
- [x: string]: unknown;
66
- } | undefined;
67
- } | {
68
- uri: string;
69
- name: string;
70
- type: "resource_link";
71
- description?: string | undefined;
72
- mimeType?: string | undefined;
73
- annotations?: {
74
- audience?: ("user" | "assistant")[] | undefined;
75
- priority?: number | undefined;
76
- lastModified?: string | undefined;
77
- } | undefined;
78
- _meta?: {
79
- [x: string]: unknown;
80
- } | undefined;
81
- icons?: {
82
- src: string;
83
- mimeType?: string | undefined;
84
- sizes?: string[] | undefined;
85
- theme?: "light" | "dark" | undefined;
86
- }[] | undefined;
87
- title?: string | undefined;
88
- } | {
89
- type: "resource";
90
- resource: {
91
- uri: string;
92
- text: string;
93
- mimeType?: string | undefined;
94
- _meta?: {
95
- [x: string]: unknown;
96
- } | undefined;
97
- } | {
98
- uri: string;
99
- blob: string;
100
- mimeType?: string | undefined;
101
- _meta?: {
102
- [x: string]: unknown;
103
- } | undefined;
104
- };
105
- annotations?: {
106
- audience?: ("user" | "assistant")[] | undefined;
107
- priority?: number | undefined;
108
- lastModified?: string | undefined;
109
- } | undefined;
110
- _meta?: {
111
- [x: string]: unknown;
112
- } | undefined;
113
- })[];
114
- _meta?: {
115
- [x: string]: unknown;
116
- progressToken?: string | number | undefined;
117
- "io.modelcontextprotocol/related-task"?: {
118
- taskId: string;
119
- } | undefined;
120
- } | undefined;
121
- structuredContent?: {
122
- [x: string]: unknown;
123
- } | undefined;
124
- isError?: boolean | undefined;
125
- }>;
126
- //# sourceMappingURL=check-issue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-issue.d.ts","sourceRoot":"","sources":["../../src/tools/check-issue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA8GH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+KA"}
@@ -1,248 +0,0 @@
1
- /**
2
- * check_issue — Checks GitHub directly for known issues matching an error.
3
- *
4
- * IMPORTANT: This is a last-resort tool. The agent should:
5
- * 1. Try to fix the error itself (2 retries)
6
- * 2. Consult the tool's documentation (2 more retries)
7
- * 3. ONLY THEN call check_issue (pass retry_count≥4, docs_consulted=true)
8
- *
9
- * This prevents spamming the GitHub API for errors that are config issues,
10
- * environment problems, or things the docs would explain.
11
- *
12
- * Flow:
13
- * 1. Gate: enforce retry + docs requirements
14
- * 2. Look up tool's github_url in Memgraph
15
- * 3. Search GitHub Issues API directly (no local DB — live data)
16
- * 4. Also search for PRs that may fix the issue
17
- * 5. Return one of four statuses:
18
- * - not_found: no matching issue on GitHub → agent handles it
19
- * - fix_in_progress: open issue + open PR exists → track PR
20
- * - known_issue_no_fix: open issue, no PR → gist + ask user intent
21
- * - fixed_in_version: closed issue → which version fixed it
22
- * 6. In real-issue cases (3/4): add 👍 reaction to the issue via GitHub API
23
- */
24
- import { config } from '@toolpilot/config';
25
- import { MemgraphToolRepository } from '@toolpilot/graph';
26
- import pino from 'pino';
27
- import { errResult, okResult } from '../utils.js';
28
- const logger = pino({ name: '@toolpilot/mcp-server:check-issue' });
29
- const repo = new MemgraphToolRepository();
30
- const DOCS_RETRY_THRESHOLD = 4; // total retries before check_issue is appropriate
31
- function githubHeaders() {
32
- const headers = {
33
- Accept: 'application/vnd.github+json',
34
- 'X-GitHub-Api-Version': '2022-11-28',
35
- };
36
- if (config.GITHUB_TOKEN) {
37
- headers.Authorization = `Bearer ${config.GITHUB_TOKEN}`;
38
- }
39
- return headers;
40
- }
41
- async function searchGitHubIssues(owner, repoName, query, type) {
42
- const q = encodeURIComponent(`${query} repo:${owner}/${repoName} type:${type}`);
43
- const url = `https://api.github.com/search/issues?q=${q}&sort=relevance&per_page=5`;
44
- const res = await fetch(url, { headers: githubHeaders() });
45
- if (!res.ok) {
46
- if (res.status === 422 || res.status === 403)
47
- return []; // rate limit or bad query
48
- throw new Error(`GitHub Search API error: ${res.status}`);
49
- }
50
- const data = (await res.json());
51
- return data.items ?? [];
52
- }
53
- async function addReaction(owner, repoName, issueNumber) {
54
- if (!config.GITHUB_TOKEN)
55
- return false; // reactions require auth
56
- try {
57
- const res = await fetch(`https://api.github.com/repos/${owner}/${repoName}/issues/${issueNumber}/reactions`, {
58
- method: 'POST',
59
- headers: { ...githubHeaders(), 'Content-Type': 'application/json' },
60
- body: JSON.stringify({ content: '+1' }),
61
- });
62
- return res.ok || res.status === 200;
63
- }
64
- catch {
65
- return false;
66
- }
67
- }
68
- /**
69
- * Extract a concise gist from an issue (title + key labels + first 500 chars of body).
70
- */
71
- function buildIssueGist(issue) {
72
- const labels = issue.labels.map((l) => l.name).join(', ');
73
- const bodySnippet = (issue.body ?? '').slice(0, 500).replace(/\r?\n/g, ' ');
74
- return [
75
- `Title: ${issue.title}`,
76
- labels ? `Labels: ${labels}` : null,
77
- bodySnippet
78
- ? `Description: ${bodySnippet}${issue.body && issue.body.length > 500 ? '...' : ''}`
79
- : null,
80
- `State: ${issue.state}`,
81
- `Comments: ${issue.comments}`,
82
- ]
83
- .filter(Boolean)
84
- .join('\n');
85
- }
86
- /**
87
- * Parse owner/repo from a GitHub URL.
88
- */
89
- function parseGitHubRepo(githubUrl) {
90
- const match = githubUrl.match(/github\.com\/([^/]+)\/([^/]+)/i);
91
- if (!match)
92
- return null;
93
- return { owner: match[1], repo: (match[2] ?? '').replace(/\.git$/, '') };
94
- }
95
- // ─── Handler ──────────────────────────────────────────────────────────────────
96
- export async function handleCheckIssue(args) {
97
- try {
98
- const retryCount = args.retry_count ?? 0;
99
- const docsConsulted = args.docs_consulted ?? false;
100
- logger.info({ tool_name: args.tool_name, issue_title: args.issue_title, retryCount, docsConsulted }, 'check_issue called');
101
- // ── Gate: enforce "docs first, then issues" protocol ─────────────────────
102
- if (retryCount < DOCS_RETRY_THRESHOLD || !docsConsulted) {
103
- const nextStep = !docsConsulted
104
- ? "Consult the documentation link in the tool's prompt_hint before calling check_issue. Read the changelog and README carefully — most errors are config or version issues."
105
- : `Retry at least ${DOCS_RETRY_THRESHOLD} times total before checking GitHub issues. You have tried ${retryCount} time(s).`;
106
- return okResult({
107
- status: 'too_early',
108
- message: 'check_issue is a last resort. Exhaust documentation and retries first.',
109
- retry_count: retryCount,
110
- docs_consulted: docsConsulted,
111
- next_step: nextStep,
112
- agent_instructions: [
113
- '1. Try to fix the error yourself (up to 2 retries).',
114
- "2. Read the tool's documentation — use the docs_url/readme_url from search_tools results.",
115
- '3. Apply documentation guidance and retry (up to 2 more retries).',
116
- '4. Only call check_issue after 4+ total retries AND docs_consulted=true.',
117
- ].join(' '),
118
- });
119
- }
120
- // ── Look up tool in Memgraph to get github_url ────────────────────────────
121
- const toolResult = await repo.findByName(args.tool_name);
122
- if (!toolResult.ok) {
123
- return errResult('db_error', toolResult.error.message);
124
- }
125
- if (!toolResult.data) {
126
- return errResult('tool_not_found', `Tool '${args.tool_name}' is not in the ToolPilot index. Try search_tools to find the correct tool name.`);
127
- }
128
- const tool = toolResult.data;
129
- const parsed = parseGitHubRepo(tool.github_url);
130
- if (!parsed) {
131
- return errResult('parse_error', `Cannot parse GitHub repo from: ${tool.github_url}`);
132
- }
133
- const { owner, repo: repoName } = parsed;
134
- // ── Search GitHub Issues + PRs directly ──────────────────────────────────
135
- logger.info({ owner, repo: repoName, query: args.issue_title }, 'Searching GitHub issues');
136
- const [issues, prs] = await Promise.all([
137
- searchGitHubIssues(owner, repoName, args.issue_title, 'issue'),
138
- searchGitHubIssues(owner, repoName, args.issue_title, 'pr'),
139
- ]);
140
- // ── CASE 1: Nothing found ─────────────────────────────────────────────────
141
- if (issues.length === 0 && prs.length === 0) {
142
- return okResult({
143
- status: 'not_found',
144
- tool: args.tool_name,
145
- message: `No matching issue found on GitHub for '${args.tool_name}'. The problem may be specific to your environment or configuration.`,
146
- github_issues_url: `${tool.github_url}/issues`,
147
- agent_instructions: [
148
- 'No known GitHub issue matches this error.',
149
- 'Investigate: (1) environment/config differences, (2) version mismatch, (3) incorrect usage pattern.',
150
- 'Re-read the documentation section relevant to this error.',
151
- 'Consider searching GitHub manually with different keywords.',
152
- ].join(' '),
153
- });
154
- }
155
- // Find the most relevant open issue
156
- const openIssues = issues.filter((i) => i.state === 'open');
157
- const closedIssues = issues.filter((i) => i.state === 'closed');
158
- const topIssue = openIssues[0] ?? closedIssues[0];
159
- // Find related open PRs (not merged yet)
160
- const openPrs = prs.filter((pr) => pr.state === 'open');
161
- const mergedPrs = prs.filter((pr) => pr.pull_request?.merged_at != null);
162
- const topPr = openPrs[0] ?? mergedPrs[0];
163
- // ── CASE 4: Fixed in a closed issue + merged PR ───────────────────────────
164
- if (!topIssue || topIssue.state === 'closed') {
165
- const fixInfo = mergedPrs[0]
166
- ? `PR #${mergedPrs[0].number} was merged: ${mergedPrs[0].html_url}`
167
- : `Issue was closed: ${topIssue?.html_url ?? `${tool.github_url}/issues`}`;
168
- return okResult({
169
- status: 'fixed_in_version',
170
- tool: args.tool_name,
171
- issue: topIssue
172
- ? {
173
- number: topIssue.number,
174
- title: topIssue.title,
175
- github_url: topIssue.html_url,
176
- closed_at: topIssue.closed_at,
177
- }
178
- : null,
179
- fix_info: fixInfo,
180
- message: `This issue appears to have been fixed. ${fixInfo}`,
181
- agent_instructions: 'Update the tool to the latest version to get this fix. Check the PR/release notes for the specific version.',
182
- });
183
- }
184
- // ── Add 👍 reaction to the issue (signal that others have hit this too) ───
185
- const reactionAdded = await addReaction(owner, repoName, topIssue.number);
186
- logger.info({ issue: topIssue.number, reactionAdded }, 'Attempted to add 👍 reaction to issue');
187
- // ── CASE 2: Open issue + open PR exists ───────────────────────────────────
188
- if (topPr && topPr.state === 'open') {
189
- return okResult({
190
- status: 'fix_in_progress',
191
- tool: args.tool_name,
192
- issue: {
193
- number: topIssue.number,
194
- title: topIssue.title,
195
- github_url: topIssue.html_url,
196
- gist: buildIssueGist(topIssue),
197
- },
198
- pr: {
199
- number: topPr.number,
200
- title: topPr.title,
201
- github_url: topPr.html_url,
202
- state: 'open',
203
- },
204
- reaction_added: reactionAdded,
205
- message: `Known issue — a fix is in progress (PR #${topPr.number}). Your 👍 reaction was ${reactionAdded ? 'added' : 'not added (no GitHub token)'} to signal impact.`,
206
- agent_instructions: 'A fix is in progress. Consider: (1) checking if a pre-release/nightly build has the fix, (2) applying a temporary workaround, (3) tracking the PR for a stable release.',
207
- });
208
- }
209
- // ── CASE 3: Open issue, no PR ─────────────────────────────────────────────
210
- return okResult({
211
- status: 'known_issue_no_fix',
212
- tool: args.tool_name,
213
- issue: {
214
- number: topIssue.number,
215
- title: topIssue.title,
216
- github_url: topIssue.html_url,
217
- state: topIssue.state,
218
- comments: topIssue.comments,
219
- created_at: topIssue.created_at,
220
- gist: buildIssueGist(topIssue),
221
- },
222
- reaction_added: reactionAdded,
223
- other_matching_issues: openIssues.slice(1, 3).map((i) => ({
224
- number: i.number,
225
- title: i.title,
226
- github_url: i.html_url,
227
- })),
228
- message: `Known open issue (#${topIssue.number}): "${topIssue.title}". Your 👍 reaction was ${reactionAdded ? 'added' : 'not added'} to signal impact.`,
229
- user_action_required: {
230
- question: 'What would you like to do? Options: (a) Create a new issue report if your case has additional detail, (b) Handle it later, (c) Ignore.',
231
- if_create_issue: "Ask the agent to generate an issue template — you can copy and paste it to GitHub manually. The agent will follow the repo's issue template format.",
232
- github_new_issue_url: `${tool.github_url}/issues/new`,
233
- },
234
- agent_instructions: [
235
- `Issue #${topIssue.number} is open with no fix yet.`,
236
- 'Ask the user whether they want to: (a) create a new issue, (b) handle it later, (c) ignore.',
237
- "If user wants to create an issue: generate a detailed issue template using the repo's issue format, present it for the user to copy-paste manually.",
238
- 'Do NOT auto-submit any GitHub issue — always require explicit user action.',
239
- 'In the meantime, explore workarounds: different config, version pinning, or alternative approaches.',
240
- ].join(' '),
241
- });
242
- }
243
- catch (e) {
244
- logger.error({ err: e, tool_name: args.tool_name }, 'check_issue failed');
245
- return errResult('internal_error', e instanceof Error ? e.message : String(e));
246
- }
247
- }
248
- //# sourceMappingURL=check-issue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-issue.js","sourceRoot":"","sources":["../../src/tools/check-issue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,mCAAmC,EAAE,CAAC,CAAC;AACnE,MAAM,IAAI,GAAG,IAAI,sBAAsB,EAAE,CAAC;AAE1C,MAAM,oBAAoB,GAAG,CAAC,CAAC,CAAC,kDAAkD;AAwBlF,SAAS,aAAa;IACpB,MAAM,OAAO,GAA2B;QACtC,MAAM,EAAE,6BAA6B;QACrC,sBAAsB,EAAE,YAAY;KACrC,CAAC;IACF,IAAI,MAAM,CAAC,YAAY,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SACZ,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,oBAAoB,CAAC,CAAC;QAC1E,OAAO,SAAS,CAAC,gBAAgB,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;AACH,CAAC"}
@@ -1,101 +0,0 @@
1
- export type PromptClassification = 'tool_discovery' | 'stack_building' | 'tool_configuration' | 'tool_comparison' | 'debugging' | 'general_coding';
2
- export declare function handleClassifyPrompt(args: {
3
- prompt: string;
4
- project_tools?: string[];
5
- }): Promise<{
6
- [x: string]: unknown;
7
- content: ({
8
- type: "text";
9
- text: string;
10
- annotations?: {
11
- audience?: ("user" | "assistant")[] | undefined;
12
- priority?: number | undefined;
13
- lastModified?: string | undefined;
14
- } | undefined;
15
- _meta?: {
16
- [x: string]: unknown;
17
- } | undefined;
18
- } | {
19
- type: "image";
20
- data: string;
21
- mimeType: string;
22
- annotations?: {
23
- audience?: ("user" | "assistant")[] | undefined;
24
- priority?: number | undefined;
25
- lastModified?: string | undefined;
26
- } | undefined;
27
- _meta?: {
28
- [x: string]: unknown;
29
- } | undefined;
30
- } | {
31
- type: "audio";
32
- data: string;
33
- mimeType: string;
34
- annotations?: {
35
- audience?: ("user" | "assistant")[] | undefined;
36
- priority?: number | undefined;
37
- lastModified?: string | undefined;
38
- } | undefined;
39
- _meta?: {
40
- [x: string]: unknown;
41
- } | undefined;
42
- } | {
43
- uri: string;
44
- name: string;
45
- type: "resource_link";
46
- description?: string | undefined;
47
- mimeType?: string | undefined;
48
- annotations?: {
49
- audience?: ("user" | "assistant")[] | undefined;
50
- priority?: number | undefined;
51
- lastModified?: string | undefined;
52
- } | undefined;
53
- _meta?: {
54
- [x: string]: unknown;
55
- } | undefined;
56
- icons?: {
57
- src: string;
58
- mimeType?: string | undefined;
59
- sizes?: string[] | undefined;
60
- theme?: "light" | "dark" | undefined;
61
- }[] | undefined;
62
- title?: string | undefined;
63
- } | {
64
- type: "resource";
65
- resource: {
66
- uri: string;
67
- text: string;
68
- mimeType?: string | undefined;
69
- _meta?: {
70
- [x: string]: unknown;
71
- } | undefined;
72
- } | {
73
- uri: string;
74
- blob: string;
75
- mimeType?: string | undefined;
76
- _meta?: {
77
- [x: string]: unknown;
78
- } | undefined;
79
- };
80
- annotations?: {
81
- audience?: ("user" | "assistant")[] | undefined;
82
- priority?: number | undefined;
83
- lastModified?: string | undefined;
84
- } | undefined;
85
- _meta?: {
86
- [x: string]: unknown;
87
- } | undefined;
88
- })[];
89
- _meta?: {
90
- [x: string]: unknown;
91
- progressToken?: string | number | undefined;
92
- "io.modelcontextprotocol/related-task"?: {
93
- taskId: string;
94
- } | undefined;
95
- } | undefined;
96
- structuredContent?: {
97
- [x: string]: unknown;
98
- } | undefined;
99
- isError?: boolean | undefined;
100
- }>;
101
- //# sourceMappingURL=classify-prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classify-prompt.d.ts","sourceRoot":"","sources":["../../src/tools/classify-prompt.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,gBAAgB,GAChB,oBAAoB,GACpB,iBAAiB,GACjB,WAAW,GACX,gBAAgB,CAAC;AASrB,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DA"}