@maxanatsko/llm-cli-bridge 3.1.0

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 (131) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +203 -0
  3. package/dist/backends/codex.d.ts +37 -0
  4. package/dist/backends/codex.d.ts.map +1 -0
  5. package/dist/backends/codex.js +438 -0
  6. package/dist/backends/codex.js.map +1 -0
  7. package/dist/backends/gemini.d.ts +17 -0
  8. package/dist/backends/gemini.d.ts.map +1 -0
  9. package/dist/backends/gemini.js +174 -0
  10. package/dist/backends/gemini.js.map +1 -0
  11. package/dist/backends/index.d.ts +8 -0
  12. package/dist/backends/index.d.ts.map +1 -0
  13. package/dist/backends/index.js +9 -0
  14. package/dist/backends/index.js.map +1 -0
  15. package/dist/backends/registry.d.ts +33 -0
  16. package/dist/backends/registry.d.ts.map +1 -0
  17. package/dist/backends/registry.js +80 -0
  18. package/dist/backends/registry.js.map +1 -0
  19. package/dist/backends/types.d.ts +61 -0
  20. package/dist/backends/types.d.ts.map +1 -0
  21. package/dist/backends/types.js +5 -0
  22. package/dist/backends/types.js.map +1 -0
  23. package/dist/constants.d.ts +223 -0
  24. package/dist/constants.d.ts.map +1 -0
  25. package/dist/constants.js +228 -0
  26. package/dist/constants.js.map +1 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +192 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/tools/ask.tool.d.ts +4 -0
  32. package/dist/tools/ask.tool.d.ts.map +1 -0
  33. package/dist/tools/ask.tool.js +113 -0
  34. package/dist/tools/ask.tool.js.map +1 -0
  35. package/dist/tools/brainstorm.tool.d.ts +3 -0
  36. package/dist/tools/brainstorm.tool.d.ts.map +1 -0
  37. package/dist/tools/brainstorm.tool.js +250 -0
  38. package/dist/tools/brainstorm.tool.js.map +1 -0
  39. package/dist/tools/index.d.ts +5 -0
  40. package/dist/tools/index.d.ts.map +1 -0
  41. package/dist/tools/index.js +13 -0
  42. package/dist/tools/index.js.map +1 -0
  43. package/dist/tools/registry.d.ts +42 -0
  44. package/dist/tools/registry.d.ts.map +1 -0
  45. package/dist/tools/registry.js +85 -0
  46. package/dist/tools/registry.js.map +1 -0
  47. package/dist/tools/review-code.tool.d.ts +3 -0
  48. package/dist/tools/review-code.tool.d.ts.map +1 -0
  49. package/dist/tools/review-code.tool.js +279 -0
  50. package/dist/tools/review-code.tool.js.map +1 -0
  51. package/dist/tools/test-tool.example.d.ts +13 -0
  52. package/dist/tools/test-tool.example.d.ts.map +1 -0
  53. package/dist/tools/test-tool.example.js +32 -0
  54. package/dist/tools/test-tool.example.js.map +1 -0
  55. package/dist/tools/timeout-test.tool.d.ts +3 -0
  56. package/dist/tools/timeout-test.tool.d.ts.map +1 -0
  57. package/dist/tools/timeout-test.tool.js +38 -0
  58. package/dist/tools/timeout-test.tool.js.map +1 -0
  59. package/dist/utils/askSessionManager.d.ts +59 -0
  60. package/dist/utils/askSessionManager.d.ts.map +1 -0
  61. package/dist/utils/askSessionManager.js +123 -0
  62. package/dist/utils/askSessionManager.js.map +1 -0
  63. package/dist/utils/brainstormSessionManager.d.ts +67 -0
  64. package/dist/utils/brainstormSessionManager.d.ts.map +1 -0
  65. package/dist/utils/brainstormSessionManager.js +174 -0
  66. package/dist/utils/brainstormSessionManager.js.map +1 -0
  67. package/dist/utils/changeModeInstructions.d.ts +17 -0
  68. package/dist/utils/changeModeInstructions.d.ts.map +1 -0
  69. package/dist/utils/changeModeInstructions.js +100 -0
  70. package/dist/utils/changeModeInstructions.js.map +1 -0
  71. package/dist/utils/changeModeParser.d.ts +15 -0
  72. package/dist/utils/changeModeParser.d.ts.map +1 -0
  73. package/dist/utils/changeModeParser.js +81 -0
  74. package/dist/utils/changeModeParser.js.map +1 -0
  75. package/dist/utils/changeModeTranslator.d.ts +4 -0
  76. package/dist/utils/changeModeTranslator.d.ts.map +1 -0
  77. package/dist/utils/changeModeTranslator.js +42 -0
  78. package/dist/utils/changeModeTranslator.js.map +1 -0
  79. package/dist/utils/commandExecutor.d.ts +2 -0
  80. package/dist/utils/commandExecutor.d.ts.map +1 -0
  81. package/dist/utils/commandExecutor.js +76 -0
  82. package/dist/utils/commandExecutor.js.map +1 -0
  83. package/dist/utils/envAllowlist.d.ts +17 -0
  84. package/dist/utils/envAllowlist.d.ts.map +1 -0
  85. package/dist/utils/envAllowlist.js +54 -0
  86. package/dist/utils/envAllowlist.js.map +1 -0
  87. package/dist/utils/geminiExecutor.d.ts +3 -0
  88. package/dist/utils/geminiExecutor.d.ts.map +1 -0
  89. package/dist/utils/geminiExecutor.js +94 -0
  90. package/dist/utils/geminiExecutor.js.map +1 -0
  91. package/dist/utils/gitStateDetector.d.ts +32 -0
  92. package/dist/utils/gitStateDetector.d.ts.map +1 -0
  93. package/dist/utils/gitStateDetector.js +68 -0
  94. package/dist/utils/gitStateDetector.js.map +1 -0
  95. package/dist/utils/logger.d.ts +13 -0
  96. package/dist/utils/logger.d.ts.map +1 -0
  97. package/dist/utils/logger.js +42 -0
  98. package/dist/utils/logger.js.map +1 -0
  99. package/dist/utils/reviewFormatter.d.ts +35 -0
  100. package/dist/utils/reviewFormatter.d.ts.map +1 -0
  101. package/dist/utils/reviewFormatter.js +201 -0
  102. package/dist/utils/reviewFormatter.js.map +1 -0
  103. package/dist/utils/reviewPromptBuilder.d.ts +43 -0
  104. package/dist/utils/reviewPromptBuilder.d.ts.map +1 -0
  105. package/dist/utils/reviewPromptBuilder.js +170 -0
  106. package/dist/utils/reviewPromptBuilder.js.map +1 -0
  107. package/dist/utils/reviewResponseParser.d.ts +20 -0
  108. package/dist/utils/reviewResponseParser.d.ts.map +1 -0
  109. package/dist/utils/reviewResponseParser.js +149 -0
  110. package/dist/utils/reviewResponseParser.js.map +1 -0
  111. package/dist/utils/reviewSessionCache.d.ts +81 -0
  112. package/dist/utils/reviewSessionCache.d.ts.map +1 -0
  113. package/dist/utils/reviewSessionCache.js +220 -0
  114. package/dist/utils/reviewSessionCache.js.map +1 -0
  115. package/dist/utils/reviewSessionManager.d.ts +52 -0
  116. package/dist/utils/reviewSessionManager.d.ts.map +1 -0
  117. package/dist/utils/reviewSessionManager.js +65 -0
  118. package/dist/utils/reviewSessionManager.js.map +1 -0
  119. package/dist/utils/sessionManager.d.ts +95 -0
  120. package/dist/utils/sessionManager.d.ts.map +1 -0
  121. package/dist/utils/sessionManager.js +382 -0
  122. package/dist/utils/sessionManager.js.map +1 -0
  123. package/dist/utils/sessionSchemas.d.ts +140 -0
  124. package/dist/utils/sessionSchemas.d.ts.map +1 -0
  125. package/dist/utils/sessionSchemas.js +2 -0
  126. package/dist/utils/sessionSchemas.js.map +1 -0
  127. package/dist/utils/timeoutManager.d.ts +2 -0
  128. package/dist/utils/timeoutManager.d.ts.map +1 -0
  129. package/dist/utils/timeoutManager.js +2 -0
  130. package/dist/utils/timeoutManager.js.map +1 -0
  131. package/package.json +72 -0
@@ -0,0 +1,250 @@
1
+ import { z } from 'zod';
2
+ import { Logger } from '../utils/logger.js';
3
+ import { getBackend } from '../backends/index.js';
4
+ import { brainstormSessionManager } from '../utils/brainstormSessionManager.js';
5
+ function buildBrainstormPrompt(config) {
6
+ const { prompt, methodology, domain, constraints, existingContext, ideaCount, includeAnalysis } = config;
7
+ // Select methodology framework
8
+ let frameworkInstructions = getMethodologyInstructions(methodology, domain);
9
+ let enhancedPrompt = `# BRAINSTORMING SESSION
10
+
11
+ ## Core Challenge
12
+ ${prompt}
13
+
14
+ ## Methodology Framework
15
+ ${frameworkInstructions}
16
+
17
+ ## Context Engineering
18
+ *Use the following context to inform your reasoning:*
19
+ ${domain ? `**Domain Focus:** ${domain} - Apply domain-specific knowledge, terminology, and best practices.` : ''}
20
+ ${constraints ? `**Constraints & Boundaries:** ${constraints}` : ''}
21
+ ${existingContext ? `**Background Context:** ${existingContext}` : ''}
22
+
23
+ ## Output Requirements
24
+ - Generate ${ideaCount} distinct, creative ideas
25
+ - Each idea should be unique and non-obvious
26
+ - Focus on actionable, implementable concepts
27
+ - Use clear, descriptive naming
28
+ - Provide brief explanations for each idea
29
+
30
+ ${includeAnalysis ? `
31
+ ## Analysis Framework
32
+ For each idea, provide:
33
+ - **Feasibility:** Implementation difficulty (1-5 scale)
34
+ - **Impact:** Potential value/benefit (1-5 scale)
35
+ - **Innovation:** Uniqueness/creativity (1-5 scale)
36
+ - **Quick Assessment:** One-sentence evaluation
37
+ ` : ''}
38
+
39
+ ## Format
40
+ Present ideas in a structured format:
41
+
42
+ ### Idea [N]: [Creative Name]
43
+ **Description:** [2-3 sentence explanation]
44
+ ${includeAnalysis ? '**Feasibility:** [1-5] | **Impact:** [1-5] | **Innovation:** [1-5]\n**Assessment:** [Brief evaluation]' : ''}
45
+
46
+ ---
47
+
48
+ **Before finalizing, review the list: remove near-duplicates and ensure each idea satisfies the constraints.**
49
+
50
+ Begin brainstorming session:`;
51
+ return enhancedPrompt;
52
+ }
53
+ /**
54
+ * Returns methodology-specific instructions for structured brainstorming
55
+ */
56
+ function getMethodologyInstructions(methodology, domain) {
57
+ const methodologies = {
58
+ 'divergent': `**Divergent Thinking Approach:**
59
+ - Generate maximum quantity of ideas without self-censoring
60
+ - Build on wild or seemingly impractical ideas
61
+ - Combine unrelated concepts for unexpected solutions
62
+ - Use "Yes, and..." thinking to expand each concept
63
+ - Postpone evaluation until all ideas are generated`,
64
+ 'convergent': `**Convergent Thinking Approach:**
65
+ - Focus on refining and improving existing concepts
66
+ - Synthesize related ideas into stronger solutions
67
+ - Apply critical evaluation criteria
68
+ - Prioritize based on feasibility and impact
69
+ - Develop implementation pathways for top ideas`,
70
+ 'scamper': `**SCAMPER Creative Triggers:**
71
+ - **Substitute:** What can be substituted or replaced?
72
+ - **Combine:** What can be combined or merged?
73
+ - **Adapt:** What can be adapted from other domains?
74
+ - **Modify:** What can be magnified, minimized, or altered?
75
+ - **Put to other use:** How else can this be used?
76
+ - **Eliminate:** What can be removed or simplified?
77
+ - **Reverse:** What can be rearranged or reversed?`,
78
+ 'design-thinking': `**Human-Centered Design Thinking:**
79
+ - **Empathize:** Consider user needs, pain points, and contexts
80
+ - **Define:** Frame problems from user perspective
81
+ - **Ideate:** Generate user-focused solutions
82
+ - **Consider Journey:** Think through complete user experience
83
+ - **Prototype Mindset:** Focus on testable, iterative concepts`,
84
+ 'lateral': `**Lateral Thinking Approach:**
85
+ - Make unexpected connections between unrelated fields
86
+ - Challenge fundamental assumptions
87
+ - Use random word association to trigger new directions
88
+ - Apply metaphors and analogies from other domains
89
+ - Reverse conventional thinking patterns`,
90
+ 'auto': `**AI-Optimized Approach:**
91
+ ${domain ? `Given the ${domain} domain, I'll apply the most effective combination of:` : 'I\'ll intelligently combine multiple methodologies:'}
92
+ - Divergent exploration with domain-specific knowledge
93
+ - SCAMPER triggers and lateral thinking
94
+ - Human-centered perspective for practical value`
95
+ };
96
+ return methodologies[methodology] || methodologies['auto'];
97
+ }
98
+ const brainstormArgsSchema = z.object({
99
+ prompt: z.string().min(1).describe("Primary brainstorming challenge or question to explore"),
100
+ backend: z.enum(['gemini', 'codex']).optional().describe("AI backend to use: 'gemini' (default) or 'codex'. Gemini offers 1M+ token context, Codex integrates with OpenAI models."),
101
+ session: z.string().optional().describe("Session ID for tracking ideas across rounds (e.g., 'feature-ideas'). Enables iterative brainstorming with context."),
102
+ model: z.string().optional().describe("Model override. Gemini: 'gemini-3.1-pro' (default), 'gemini-3-flash', 'gemini-2.5-pro', 'gemini-2.5-flash'. Codex: 'gpt-5.4' (default), 'gpt-5.4-mini', 'gpt-5.3-codex', 'gpt-5.2-codex', 'gpt-5.2'"),
103
+ methodology: z.enum(['divergent', 'convergent', 'scamper', 'design-thinking', 'lateral', 'auto']).default('auto').describe("Brainstorming framework: 'divergent' (generate many ideas), 'convergent' (refine existing), 'scamper' (systematic triggers), 'design-thinking' (human-centered), 'lateral' (unexpected connections), 'auto' (AI selects best)"),
104
+ domain: z.string().optional().describe("Domain context for specialized brainstorming (e.g., 'software', 'business', 'creative', 'research', 'product', 'marketing')"),
105
+ constraints: z.string().optional().describe("Known limitations, requirements, or boundaries (budget, time, technical, legal, etc.)"),
106
+ existingContext: z.string().optional().describe("Background information, previous attempts, or current state to build upon"),
107
+ ideaCount: z.number().int().positive().default(12).describe("Target number of ideas to generate (default: 10-15)"),
108
+ includeAnalysis: z.boolean().default(true).describe("Include feasibility, impact, and implementation analysis for generated ideas"),
109
+ includeHistory: z.boolean().default(true).describe("Include previously generated ideas in context (only applies when session is provided). Default: true"),
110
+ reasoningEffort: z.enum(['low', 'medium', 'high', 'xhigh']).optional().describe("Reasoning effort level (Codex only): 'low', 'medium' (default), 'high', 'xhigh'. Use 'high'/'xhigh' for complex tasks."),
111
+ allowedTools: z.array(z.string()).optional().describe("Tools that AI can auto-approve without confirmation (e.g., ['run_shell_command']). Use sparingly for security."),
112
+ cwd: z.string().optional().describe("Working directory for CLI execution. Use this to match your IDE workspace directory if you get 'Directory mismatch' errors."),
113
+ });
114
+ export const brainstormTool = {
115
+ name: "brainstorm",
116
+ description: "Generate novel ideas with dynamic context gathering. --> Creative frameworks (SCAMPER, Design Thinking, etc.), domain context integration, idea clustering, feasibility analysis, and iterative refinement.",
117
+ zodSchema: brainstormArgsSchema,
118
+ annotations: {
119
+ readOnlyHint: false, // Can modify state via sessions
120
+ destructiveHint: false, // Doesn't delete data
121
+ idempotentHint: false, // Same input yields different AI responses
122
+ openWorldHint: true, // Interacts with external AI APIs
123
+ },
124
+ prompt: {
125
+ description: "Generate structured brainstorming prompt with methodology-driven ideation, domain context integration, and analytical evaluation framework",
126
+ },
127
+ category: 'ai',
128
+ execute: async (args, onProgress) => {
129
+ const { prompt, backend: backendChoice, session, model, methodology = 'auto', domain, constraints, existingContext, ideaCount = 12, includeAnalysis = true, includeHistory = true, reasoningEffort, allowedTools, cwd } = args;
130
+ if (!prompt?.trim()) {
131
+ throw new Error("You must provide a valid brainstorming challenge or question to explore");
132
+ }
133
+ // Session handling
134
+ let sessionData = null;
135
+ let contextualizedExistingContext = existingContext;
136
+ if (session) {
137
+ try {
138
+ sessionData = await brainstormSessionManager.getOrCreate(session, prompt.trim(), methodology, domain, constraints);
139
+ // Build context from previous rounds
140
+ if (includeHistory && sessionData.rounds.length > 0) {
141
+ const previousIdeas = brainstormSessionManager.buildIdeasContext(sessionData, true);
142
+ contextualizedExistingContext = existingContext
143
+ ? `${existingContext}\n\n${previousIdeas}`
144
+ : previousIdeas;
145
+ }
146
+ onProgress?.(`🧠 Session '${session}' (Round ${sessionData.rounds.length + 1})`);
147
+ }
148
+ catch (error) {
149
+ onProgress?.(`⚠️ Session loading failed: ${error instanceof Error ? error.message : String(error)}`);
150
+ Logger.error(`Failed to load session '${session}': ${error}`);
151
+ // Continue without session
152
+ }
153
+ }
154
+ let enhancedPrompt = buildBrainstormPrompt({
155
+ prompt: prompt.trim(),
156
+ methodology: methodology,
157
+ domain: domain,
158
+ constraints: constraints,
159
+ existingContext: contextualizedExistingContext,
160
+ ideaCount: ideaCount,
161
+ includeAnalysis: includeAnalysis
162
+ });
163
+ Logger.debug(`Brainstorm: Using methodology '${methodology}' for domain '${domain || 'general'}'`);
164
+ // Get the appropriate backend (defaults to session's last backend, then Gemini)
165
+ const backendType = backendChoice || sessionData?.lastBackend || 'gemini';
166
+ const backend = await getBackend(backendType);
167
+ // Report progress to user
168
+ onProgress?.(`🤖 Using ${backend.name} backend...`);
169
+ onProgress?.(`Generating ${ideaCount} ideas via ${methodology} methodology...`);
170
+ // Execute via the selected backend
171
+ // Pass existing codexThreadId for native session resume when using Codex
172
+ const result = await backend.execute(enhancedPrompt, {
173
+ provider: backendType,
174
+ model: model,
175
+ sandbox: false,
176
+ changeMode: false,
177
+ allowedTools: allowedTools,
178
+ cwd: cwd,
179
+ codexThreadId: sessionData?.codexThreadId, // For Codex native session resume
180
+ reasoningEffort: reasoningEffort,
181
+ }, onProgress);
182
+ // Save to session if provided
183
+ if (session && sessionData) {
184
+ try {
185
+ // Parse ideas from response (simple extraction)
186
+ const ideas = parseIdeasFromResponse(result.response);
187
+ brainstormSessionManager.addRound(sessionData, prompt, result.response, ideas, backendType, result.codexThreadId // Store Codex thread ID for native session resume
188
+ );
189
+ await brainstormSessionManager.save(sessionData);
190
+ onProgress?.(`💾 Saved to session '${session}' (${sessionData.totalIdeas} total ideas, ${sessionData.activeIdeas} active)`);
191
+ if (result.codexThreadId && result.codexThreadId.length > 0) {
192
+ const threadPreview = result.codexThreadId.slice(0, 8);
193
+ onProgress?.(`🔗 Codex thread: ${threadPreview}...`);
194
+ }
195
+ }
196
+ catch (error) {
197
+ onProgress?.(`⚠️ Session save failed: ${error instanceof Error ? error.message : String(error)}`);
198
+ Logger.error(`Failed to save session '${session}': ${error}`);
199
+ // Continue - result is still valid even if session save failed
200
+ }
201
+ }
202
+ // Use backend-aware response prefix
203
+ const backendName = backend.name.charAt(0).toUpperCase() + backend.name.slice(1);
204
+ return `${backendName} response:\n${result.response}`;
205
+ }
206
+ };
207
+ /**
208
+ * Escapes special regex characters in a string to prevent ReDoS attacks
209
+ */
210
+ function escapeRegex(str) {
211
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
212
+ }
213
+ /**
214
+ * Safely parses an integer score, returning undefined for invalid values
215
+ */
216
+ function parseScore(matchResult) {
217
+ if (!matchResult)
218
+ return undefined;
219
+ const parsed = parseInt(matchResult[1], 10);
220
+ return !isNaN(parsed) && parsed >= 1 && parsed <= 10 ? parsed : undefined;
221
+ }
222
+ /**
223
+ * Parses ideas from brainstorm response
224
+ * Extracts idea names, descriptions, and scores
225
+ */
226
+ function parseIdeasFromResponse(response) {
227
+ const ideas = [];
228
+ // Pattern: ### Idea [N]: [Name]
229
+ const ideaPattern = /###\s+Idea\s+\d+:\s*(.+?)\n\*\*Description:\*\*\s*(.+?)(?=\n###|\n\*\*Feasibility|\n---|$)/gis;
230
+ let match;
231
+ while ((match = ideaPattern.exec(response)) !== null) {
232
+ const name = match[1].trim();
233
+ const description = match[2].trim();
234
+ // Escape regex metacharacters to prevent ReDoS attacks
235
+ const escapedName = escapeRegex(name);
236
+ // Try to extract scores with escaped name
237
+ const feasibilityMatch = response.match(new RegExp(`${escapedName}[\\s\\S]{0,300}\\*\\*Feasibility:\\*\\*\\s*(\\d+)`, 'i'));
238
+ const impactMatch = response.match(new RegExp(`${escapedName}[\\s\\S]{0,300}\\*\\*Impact:\\*\\*\\s*(\\d+)`, 'i'));
239
+ const innovationMatch = response.match(new RegExp(`${escapedName}[\\s\\S]{0,300}\\*\\*Innovation:\\*\\*\\s*(\\d+)`, 'i'));
240
+ ideas.push({
241
+ name,
242
+ description,
243
+ feasibility: parseScore(feasibilityMatch),
244
+ impact: parseScore(impactMatch),
245
+ innovation: parseScore(innovationMatch)
246
+ });
247
+ }
248
+ return ideas;
249
+ }
250
+ //# sourceMappingURL=brainstorm.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brainstorm.tool.js","sourceRoot":"","sources":["../../src/tools/brainstorm.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAe,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,SAAS,qBAAqB,CAAC,MAQ9B;IACC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAEzG,+BAA+B;IAC/B,IAAI,qBAAqB,GAAG,0BAA0B,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE5E,IAAI,cAAc,GAAG;;;EAGrB,MAAM;;;EAGN,qBAAqB;;;;EAIrB,MAAM,CAAC,CAAC,CAAC,qBAAqB,MAAM,sEAAsE,CAAC,CAAC,CAAC,EAAE;EAC/G,WAAW,CAAC,CAAC,CAAC,iCAA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CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAEpC,uDAAuD;QACvD,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAEtC,0CAA0C;QAC1C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CACrC,IAAI,MAAM,CAAC,GAAG,WAAW,mDAAmD,EAAE,GAAG,CAAC,CACnF,CAAC;QACF,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAChC,IAAI,MAAM,CAAC,GAAG,WAAW,8CAA8C,EAAE,GAAG,CAAC,CAC9E,CAAC;QACF,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CACpC,IAAI,MAAM,CAAC,GAAG,WAAW,kDAAkD,EAAE,GAAG,CAAC,CAClF,CAAC;QAEF,KAAK,CAAC,IAAI,CAAC;YACT,IAAI;YACJ,WAAW;YACX,WAAW,EAAE,UAAU,CAAC,gBAAgB,CAAC;YACzC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC;YAC/B,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './registry.js';
2
+ export { askTool } from './ask.tool.js';
3
+ export { brainstormTool } from './brainstorm.tool.js';
4
+ export { reviewCodeTool } from './review-code.tool.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,13 @@
1
+ // Tool Registry Index - Registers all tools
2
+ import { toolRegistry } from './registry.js';
3
+ import { askTool } from './ask.tool.js';
4
+ import { brainstormTool } from './brainstorm.tool.js';
5
+ import { reviewCodeTool } from './review-code.tool.js';
6
+ // Register tools
7
+ toolRegistry.push(askTool, brainstormTool, reviewCodeTool);
8
+ export * from './registry.js';
9
+ // Re-export tools for direct access
10
+ export { askTool } from './ask.tool.js';
11
+ export { brainstormTool } from './brainstorm.tool.js';
12
+ export { reviewCodeTool } from './review-code.tool.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,iBAAiB;AACjB,YAAY,CAAC,IAAI,CACf,OAAO,EACP,cAAc,EACd,cAAc,CACf,CAAC;AAEF,cAAc,eAAe,CAAC;AAE9B,oCAAoC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { Tool, Prompt } from "@modelcontextprotocol/sdk/types.js";
2
+ import { ToolArguments } from "../constants.js";
3
+ import { ZodTypeAny } from "zod";
4
+ /**
5
+ * MCP Tool Annotations
6
+ * @see https://spec.modelcontextprotocol.io/specification/server/tools/#annotations
7
+ */
8
+ export interface ToolAnnotations {
9
+ /** If true, the tool does not modify any external state */
10
+ readOnlyHint?: boolean;
11
+ /** If true, the tool may perform destructive updates (e.g., deleting data) */
12
+ destructiveHint?: boolean;
13
+ /** If true, calling the tool with the same inputs may yield different results */
14
+ idempotentHint?: boolean;
15
+ /** If true, the tool interacts with external entities (APIs, internet, etc.) */
16
+ openWorldHint?: boolean;
17
+ }
18
+ export interface UnifiedTool {
19
+ name: string;
20
+ description: string;
21
+ zodSchema: ZodTypeAny;
22
+ outputSchema?: ZodTypeAny;
23
+ /** MCP tool annotations for client behavior hints */
24
+ annotations?: ToolAnnotations;
25
+ prompt?: {
26
+ description: string;
27
+ arguments?: Array<{
28
+ name: string;
29
+ description: string;
30
+ required: boolean;
31
+ }>;
32
+ };
33
+ execute: (args: ToolArguments, onProgress?: (newOutput: string) => void) => Promise<string>;
34
+ category?: 'simple' | 'ai' | 'utility';
35
+ }
36
+ export declare const toolRegistry: UnifiedTool[];
37
+ export declare function toolExists(toolName: string): boolean;
38
+ export declare function getToolDefinitions(): Tool[];
39
+ export declare function getPromptDefinitions(): Prompt[];
40
+ export declare function executeTool(toolName: string, args: ToolArguments, onProgress?: (newOutput: string) => void): Promise<string>;
41
+ export declare function getPromptMessage(toolName: string, args: Record<string, any>): string;
42
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAY,MAAM,KAAK,CAAC;AAG3C;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iFAAiF;IACjF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gFAAgF;IAChF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,UAAU,CAAC;IACtB,YAAY,CAAC,EAAE,UAAU,CAAC;IAE1B,qDAAqD;IACrD,WAAW,CAAC,EAAE,eAAe,CAAC;IAE9B,MAAM,CAAC,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,KAAK,CAAC;YAChB,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,EAAE,MAAM,CAAC;YACpB,QAAQ,EAAE,OAAO,CAAC;SACnB,CAAC,CAAC;KACJ,CAAC;IAEF,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;CACxC;AAED,eAAO,MAAM,YAAY,EAAE,WAAW,EAAO,CAAC;AAC9C,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AACD,wBAAgB,kBAAkB,IAAI,IAAI,EAAE,CAuB3C;AAcD,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAQ/C;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlI;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAsBpF"}
@@ -0,0 +1,85 @@
1
+ import { ZodError } from "zod";
2
+ import { zodToJsonSchema } from "zod-to-json-schema";
3
+ export const toolRegistry = [];
4
+ export function toolExists(toolName) {
5
+ return toolRegistry.some(t => t.name === toolName);
6
+ }
7
+ export function getToolDefinitions() {
8
+ return toolRegistry.map(tool => {
9
+ const raw = zodToJsonSchema(tool.zodSchema, tool.name);
10
+ const def = raw.definitions?.[tool.name] ?? raw;
11
+ const inputSchema = {
12
+ type: "object",
13
+ properties: def.properties || {},
14
+ required: def.required || [],
15
+ };
16
+ const result = {
17
+ name: tool.name,
18
+ description: tool.description,
19
+ inputSchema,
20
+ };
21
+ // Include annotations if defined (MCP spec compliance)
22
+ if (tool.annotations) {
23
+ result.annotations = tool.annotations;
24
+ }
25
+ return result;
26
+ });
27
+ }
28
+ function extractPromptArguments(zodSchema) {
29
+ const jsonSchema = zodToJsonSchema(zodSchema);
30
+ const properties = jsonSchema.properties || {};
31
+ const required = jsonSchema.required || [];
32
+ return Object.entries(properties).map(([name, prop]) => ({
33
+ name,
34
+ description: prop.description || `${name} parameter`,
35
+ required: required.includes(name)
36
+ }));
37
+ }
38
+ export function getPromptDefinitions() {
39
+ return toolRegistry
40
+ .filter(tool => tool.prompt)
41
+ .map(tool => ({
42
+ name: tool.name,
43
+ description: tool.prompt.description,
44
+ arguments: tool.prompt.arguments || extractPromptArguments(tool.zodSchema),
45
+ }));
46
+ }
47
+ export async function executeTool(toolName, args, onProgress) {
48
+ const tool = toolRegistry.find(t => t.name === toolName);
49
+ if (!tool) {
50
+ throw new Error(`Unknown tool: ${toolName}`);
51
+ }
52
+ try {
53
+ const validatedArgs = tool.zodSchema.parse(args);
54
+ return tool.execute(validatedArgs, onProgress);
55
+ }
56
+ catch (error) {
57
+ if (error instanceof ZodError) {
58
+ const issues = error.issues.map(issue => `${issue.path.join('.')}: ${issue.message}`).join(', ');
59
+ throw new Error(`Invalid arguments for ${toolName}: ${issues}`);
60
+ }
61
+ throw error;
62
+ }
63
+ }
64
+ export function getPromptMessage(toolName, args) {
65
+ const tool = toolRegistry.find(t => t.name === toolName);
66
+ if (!tool?.prompt) {
67
+ throw new Error(`No prompt defined for tool: ${toolName}`);
68
+ }
69
+ const paramStrings = [];
70
+ if (args.prompt) {
71
+ paramStrings.push(args.prompt);
72
+ }
73
+ Object.entries(args).forEach(([key, value]) => {
74
+ if (key !== 'prompt' && value !== undefined && value !== null && value !== false) {
75
+ if (typeof value === 'boolean' && value) {
76
+ paramStrings.push(`[${key}]`);
77
+ }
78
+ else if (typeof value !== 'boolean') {
79
+ paramStrings.push(`(${key}: ${value})`);
80
+ }
81
+ }
82
+ });
83
+ return `Use the ${toolName} tool${paramStrings.length > 0 ? ': ' + paramStrings.join(' ') : ''}`;
84
+ }
85
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAuCrD,MAAM,CAAC,MAAM,YAAY,GAAkB,EAAE,CAAC;AAC9C,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AACrD,CAAC;AACD,MAAM,UAAU,kBAAkB;IAChC,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC7B,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAQ,CAAC;QAC9D,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;QAChD,MAAM,WAAW,GAAwB;YACvC,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE;YAChC,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;SAC7B,CAAC;QAEF,MAAM,MAAM,GAAS;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW;SACZ,CAAC;Q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GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC5C,IAAI,GAAG,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;YACjF,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC;gBACxC,YAAY,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;YAChC,CAAC;iBAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtC,YAAY,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,KAAK,GAAG,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,QAAQ,QAAQ,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACnG,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { UnifiedTool } from './registry.js';
2
+ export declare const reviewCodeTool: UnifiedTool;
3
+ //# sourceMappingURL=review-code.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-code.tool.d.ts","sourceRoot":"","sources":["../../src/tools/review-code.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAkG5C,eAAO,MAAM,cAAc,EAAE,WAgN5B,CAAC"}