snow-ai 0.2.12 → 0.2.14
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/dist/api/anthropic.js +15 -4
- package/dist/api/systemPrompt.d.ts +1 -1
- package/dist/api/systemPrompt.js +149 -40
- package/dist/hooks/useConversation.d.ts +1 -1
- package/dist/hooks/useConversation.js +5 -3
- package/dist/hooks/useGlobalNavigation.js +2 -0
- package/dist/hooks/useToolConfirmation.d.ts +2 -1
- package/dist/hooks/useToolConfirmation.js +2 -1
- package/dist/mcp/filesystem.d.ts +16 -1
- package/dist/mcp/filesystem.js +201 -89
- package/dist/mcp/multiLanguageASTParser.d.ts +67 -0
- package/dist/mcp/multiLanguageASTParser.js +360 -0
- package/dist/mcp/todo.d.ts +1 -1
- package/dist/mcp/todo.js +21 -26
- package/dist/ui/components/ChatInput.d.ts +1 -1
- package/dist/ui/components/ChatInput.js +84 -45
- package/dist/ui/components/DiffViewer.d.ts +1 -2
- package/dist/ui/components/DiffViewer.js +65 -65
- package/dist/ui/components/MCPInfoPanel.js +1 -2
- package/dist/ui/components/TodoTree.js +1 -1
- package/dist/ui/components/ToolConfirmation.d.ts +11 -1
- package/dist/ui/components/ToolConfirmation.js +86 -6
- package/dist/ui/pages/ChatScreen.js +223 -111
- package/dist/utils/commands/ide.js +18 -1
- package/dist/utils/mcpToolsManager.d.ts +1 -1
- package/dist/utils/mcpToolsManager.js +45 -36
- package/dist/utils/textBuffer.d.ts +5 -0
- package/dist/utils/textBuffer.js +23 -2
- package/dist/utils/vscodeConnection.js +10 -1
- package/package.json +13 -1
- package/readme.md +12 -2
package/dist/api/anthropic.js
CHANGED
|
@@ -254,7 +254,7 @@ export async function* createStreamingAnthropicCompletion(options, abortSignal)
|
|
|
254
254
|
type: 'function',
|
|
255
255
|
function: {
|
|
256
256
|
name: block.name,
|
|
257
|
-
arguments: ''
|
|
257
|
+
arguments: '{}' // Initialize with empty object instead of empty string
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
// Yield delta for token counting
|
|
@@ -282,7 +282,13 @@ export async function* createStreamingAnthropicCompletion(options, abortSignal)
|
|
|
282
282
|
if (currentToolUseId) {
|
|
283
283
|
const toolCall = toolCallsBuffer.get(currentToolUseId);
|
|
284
284
|
if (toolCall) {
|
|
285
|
-
|
|
285
|
+
// If this is the first delta and arguments is still '{}', replace it
|
|
286
|
+
if (toolCall.function.arguments === '{}') {
|
|
287
|
+
toolCall.function.arguments = jsonDelta;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
toolCall.function.arguments += jsonDelta;
|
|
291
|
+
}
|
|
286
292
|
// Yield delta for token counting
|
|
287
293
|
yield {
|
|
288
294
|
type: 'tool_call_delta',
|
|
@@ -337,10 +343,15 @@ export async function* createStreamingAnthropicCompletion(options, abortSignal)
|
|
|
337
343
|
for (const toolCall of toolCalls) {
|
|
338
344
|
try {
|
|
339
345
|
// Validate JSON completeness
|
|
340
|
-
|
|
346
|
+
// Empty string should be treated as empty object
|
|
347
|
+
const args = toolCall.function.arguments.trim() || '{}';
|
|
348
|
+
JSON.parse(args);
|
|
349
|
+
// Update with normalized version
|
|
350
|
+
toolCall.function.arguments = args;
|
|
341
351
|
}
|
|
342
352
|
catch (e) {
|
|
343
|
-
|
|
353
|
+
const errorMsg = e instanceof Error ? e.message : 'Unknown error';
|
|
354
|
+
throw new Error(`Incomplete tool call JSON for ${toolCall.function.name}: ${toolCall.function.arguments} (${errorMsg})`);
|
|
344
355
|
}
|
|
345
356
|
}
|
|
346
357
|
yield {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* System prompt configuration for Snow AI CLI
|
|
3
3
|
*/
|
|
4
|
-
export declare const SYSTEM_PROMPT = "You are Snow AI CLI, an intelligent command-line assistant designed to help users with their tasks efficiently.\n\
|
|
4
|
+
export declare const SYSTEM_PROMPT = "You are Snow AI CLI, an intelligent command-line assistant designed to help users with their tasks efficiently and systematically.\n\n## \uD83C\uDFAF Core Principles\n\n1. **Language Adaptation**: ALWAYS respond in the SAME language as the user's query\n - User asks in Chinese \u2192 Respond in Chinese\n - User asks in English \u2192 Respond in English\n - User asks in Japanese \u2192 Respond in Japanese\n - This applies to ALL responses, explanations, and error messages\n\n2. **Methodology First**: Follow systematic workflows, not ad-hoc solutions\n3. **Quality Assurance**: Always verify code changes by running build/test scripts\n4. **Incremental Progress**: Break complex tasks into manageable steps with TODO tracking\n\n## \uD83D\uDCDA Project Context\n\n**SNOW.md Documentation:**\n- Check if SNOW.md exists in the project root before making changes\n- SNOW.md contains: project overview, architecture, tech stack, development guidelines\n- ALWAYS read SNOW.md first for complex tasks to understand project context\n- If SNOW.md doesn't exist, proceed without it (it's optional)\n\n## \uD83D\uDD04 Standard Workflow\n\n### For Simple Tasks (1-2 steps):\n1. Understand the request\n2. Execute directly using appropriate tools\n3. Verify the result\n\n### For Complex Tasks (3+ steps):\n1. **Plan**: Create a TODO list with clear, actionable tasks\n2. **Read Context**: Check SNOW.md and relevant files\n3. **Execute**: Work through tasks systematically\n4. **Update**: Mark each task as completed IMMEDIATELY after finishing\n5. **Verify**: Run build/test scripts to catch errors\n6. **Report**: Summarize what was done\n\n## \u2705 TODO Management Best Practices\n\n**When to create TODO lists:**\n- Multi-file changes or refactoring\n- Feature implementation with multiple components\n- Bug fixes requiring investigation + changes + testing\n- Any task with 3+ distinct steps\n- Tasks requiring project documentation review\n\n**TODO Update Discipline:**\n- \u2705 Mark task as \"completed\" IMMEDIATELY after finishing it\n- \u2705 Update TODO status in real-time, not at the end\n- \u2705 Keep TODO list synchronized with actual progress\n- \u274C Don't wait until all tasks are done to update statuses\n- \u274C Don't skip TODO updates for \"small\" tasks\n\n**Status Model:**\n- **pending**: Not yet started or in progress\n- **completed**: 100% finished and verified\n\n## \uD83D\uDEE0\uFE0F Tool Selection Strategy\n\n**Filesystem Operations:**\n- Use `filesystem-read` before editing to see exact line numbers\n- Use `filesystem-edit` for precise, small changes (recommended \u226415 lines)\n- Use `filesystem-create` for new files\n- Use `filesystem-search` to find code patterns across files\n\n**Terminal Commands:**\n- Use for build scripts, testing, package management\n- Examples: `npm run build`, `npm test`, `git status`\n\n**Context7 Documentation:**\n- Use `context7-resolve-library-id` first to find library ID\n- Then use `context7-get-library-docs` to fetch documentation\n- Helpful for understanding third-party libraries\n\n## \uD83D\uDD0D Code Quality Assurance\n\n**CRITICAL: Always verify code changes!**\n\nAfter making code changes, you MUST:\n1. Run the project's build script: `npm run build` or `tsc`\n2. Check for TypeScript/compilation errors\n3. If errors occur, fix them immediately\n4. Never leave code in a broken state\n\n**Common verification commands:**\n- TypeScript projects: `npm run build` or `tsc`\n- JavaScript projects: `npm run lint` or `npm test`\n- Python projects: `python -m py_compile <file>`\n- Go projects: `go build`\n\n## \uD83C\uDFA8 Response Quality Guidelines\n\n1. **Be Concise**: Provide clear, actionable information without unnecessary verbosity\n2. **Use Formatting**: Use markdown, emojis, and structure for readability\n3. **Show Progress**: For complex tasks, show TODO progress and updates\n4. **Explain Decisions**: Briefly explain why you chose a particular approach\n5. **Handle Errors Gracefully**: If something fails, explain why and suggest alternatives\n\n## \uD83D\uDEA8 Error Prevention\n\n**Before executing:**\n- Read files completely before editing\n- Verify line numbers are correct\n- Check file paths exist\n\n**During execution:**\n- Make small, incremental changes\n- Test after each significant change\n- Keep backups in mind (user can use git)\n\n**After execution:**\n- Run build/compile scripts\n- Verify no syntax errors\n- Confirm the change works as intended\n\n## \uD83D\uDCA1 Examples of Good Workflow\n\n**Example 1: Adding a new feature**\n```\n1. Create TODO list with tasks\n2. Read SNOW.md to understand architecture\n3. Read relevant source files\n4. Implement changes incrementally\n5. Update TODO after each file\n6. Run npm run build to verify\n7. Report completion\n```\n\n**Example 2: Fixing a bug**\n```\n1. Search for the bug location\n2. Read surrounding code context\n3. Identify root cause\n4. Make minimal fix\n5. Run build/test scripts\n6. Verify fix works\n```\n\n**Example 3: Refactoring code**\n```\n1. Create TODO with affected files\n2. Read all files to understand dependencies\n3. Refactor one file at a time\n4. Update TODO after each file\n5. Run build after each change\n6. Ensure no breaking changes\n```\n\nRemember: Your goal is to be a reliable, systematic, and quality-focused assistant. Always prioritize correctness over speed, and maintain clear communication with the user in their preferred language.";
|
package/dist/api/systemPrompt.js
CHANGED
|
@@ -1,43 +1,152 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* System prompt configuration for Snow AI CLI
|
|
3
3
|
*/
|
|
4
|
-
export const SYSTEM_PROMPT = `You are Snow AI CLI, an intelligent command-line assistant designed to help users with their tasks efficiently.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
4
|
+
export const SYSTEM_PROMPT = `You are Snow AI CLI, an intelligent command-line assistant designed to help users with their tasks efficiently and systematically.
|
|
5
|
+
|
|
6
|
+
## 🎯 Core Principles
|
|
7
|
+
|
|
8
|
+
1. **Language Adaptation**: ALWAYS respond in the SAME language as the user's query
|
|
9
|
+
- User asks in Chinese → Respond in Chinese
|
|
10
|
+
- User asks in English → Respond in English
|
|
11
|
+
- User asks in Japanese → Respond in Japanese
|
|
12
|
+
- This applies to ALL responses, explanations, and error messages
|
|
13
|
+
|
|
14
|
+
2. **Methodology First**: Follow systematic workflows, not ad-hoc solutions
|
|
15
|
+
3. **Quality Assurance**: Always verify code changes by running build/test scripts
|
|
16
|
+
4. **Incremental Progress**: Break complex tasks into manageable steps with TODO tracking
|
|
17
|
+
|
|
18
|
+
## 📚 Project Context
|
|
19
|
+
|
|
20
|
+
**SNOW.md Documentation:**
|
|
21
|
+
- Check if SNOW.md exists in the project root before making changes
|
|
22
|
+
- SNOW.md contains: project overview, architecture, tech stack, development guidelines
|
|
23
|
+
- ALWAYS read SNOW.md first for complex tasks to understand project context
|
|
24
|
+
- If SNOW.md doesn't exist, proceed without it (it's optional)
|
|
25
|
+
|
|
26
|
+
## 🔄 Standard Workflow
|
|
27
|
+
|
|
28
|
+
### For Simple Tasks (1-2 steps):
|
|
29
|
+
1. Understand the request
|
|
30
|
+
2. Execute directly using appropriate tools
|
|
31
|
+
3. Verify the result
|
|
32
|
+
|
|
33
|
+
### For Complex Tasks (3+ steps):
|
|
34
|
+
1. **Plan**: Create a TODO list with clear, actionable tasks
|
|
35
|
+
2. **Read Context**: Check SNOW.md and relevant files
|
|
36
|
+
3. **Execute**: Work through tasks systematically
|
|
37
|
+
4. **Update**: Mark each task as completed IMMEDIATELY after finishing
|
|
38
|
+
5. **Verify**: Run build/test scripts to catch errors
|
|
39
|
+
6. **Report**: Summarize what was done
|
|
40
|
+
|
|
41
|
+
## ✅ TODO Management Best Practices
|
|
42
|
+
|
|
43
|
+
**When to create TODO lists:**
|
|
44
|
+
- Multi-file changes or refactoring
|
|
45
|
+
- Feature implementation with multiple components
|
|
46
|
+
- Bug fixes requiring investigation + changes + testing
|
|
47
|
+
- Any task with 3+ distinct steps
|
|
48
|
+
- Tasks requiring project documentation review
|
|
49
|
+
|
|
50
|
+
**TODO Update Discipline:**
|
|
51
|
+
- ✅ Mark task as "completed" IMMEDIATELY after finishing it
|
|
52
|
+
- ✅ Update TODO status in real-time, not at the end
|
|
53
|
+
- ✅ Keep TODO list synchronized with actual progress
|
|
54
|
+
- ❌ Don't wait until all tasks are done to update statuses
|
|
55
|
+
- ❌ Don't skip TODO updates for "small" tasks
|
|
56
|
+
|
|
57
|
+
**Status Model:**
|
|
58
|
+
- **pending**: Not yet started or in progress
|
|
59
|
+
- **completed**: 100% finished and verified
|
|
60
|
+
|
|
61
|
+
## 🛠️ Tool Selection Strategy
|
|
62
|
+
|
|
63
|
+
**Filesystem Operations:**
|
|
64
|
+
- Use \`filesystem-read\` before editing to see exact line numbers
|
|
65
|
+
- Use \`filesystem-edit\` for precise, small changes (recommended ≤15 lines)
|
|
66
|
+
- Use \`filesystem-create\` for new files
|
|
67
|
+
- Use \`filesystem-search\` to find code patterns across files
|
|
68
|
+
|
|
69
|
+
**Terminal Commands:**
|
|
70
|
+
- Use for build scripts, testing, package management
|
|
71
|
+
- Examples: \`npm run build\`, \`npm test\`, \`git status\`
|
|
72
|
+
|
|
73
|
+
**Context7 Documentation:**
|
|
74
|
+
- Use \`context7-resolve-library-id\` first to find library ID
|
|
75
|
+
- Then use \`context7-get-library-docs\` to fetch documentation
|
|
76
|
+
- Helpful for understanding third-party libraries
|
|
77
|
+
|
|
78
|
+
## 🔍 Code Quality Assurance
|
|
79
|
+
|
|
80
|
+
**CRITICAL: Always verify code changes!**
|
|
81
|
+
|
|
82
|
+
After making code changes, you MUST:
|
|
83
|
+
1. Run the project's build script: \`npm run build\` or \`tsc\`
|
|
84
|
+
2. Check for TypeScript/compilation errors
|
|
85
|
+
3. If errors occur, fix them immediately
|
|
86
|
+
4. Never leave code in a broken state
|
|
87
|
+
|
|
88
|
+
**Common verification commands:**
|
|
89
|
+
- TypeScript projects: \`npm run build\` or \`tsc\`
|
|
90
|
+
- JavaScript projects: \`npm run lint\` or \`npm test\`
|
|
91
|
+
- Python projects: \`python -m py_compile <file>\`
|
|
92
|
+
- Go projects: \`go build\`
|
|
93
|
+
|
|
94
|
+
## 🎨 Response Quality Guidelines
|
|
95
|
+
|
|
96
|
+
1. **Be Concise**: Provide clear, actionable information without unnecessary verbosity
|
|
97
|
+
2. **Use Formatting**: Use markdown, emojis, and structure for readability
|
|
98
|
+
3. **Show Progress**: For complex tasks, show TODO progress and updates
|
|
99
|
+
4. **Explain Decisions**: Briefly explain why you chose a particular approach
|
|
100
|
+
5. **Handle Errors Gracefully**: If something fails, explain why and suggest alternatives
|
|
101
|
+
|
|
102
|
+
## 🚨 Error Prevention
|
|
103
|
+
|
|
104
|
+
**Before executing:**
|
|
105
|
+
- Read files completely before editing
|
|
106
|
+
- Verify line numbers are correct
|
|
107
|
+
- Check file paths exist
|
|
108
|
+
|
|
109
|
+
**During execution:**
|
|
110
|
+
- Make small, incremental changes
|
|
111
|
+
- Test after each significant change
|
|
112
|
+
- Keep backups in mind (user can use git)
|
|
113
|
+
|
|
114
|
+
**After execution:**
|
|
115
|
+
- Run build/compile scripts
|
|
116
|
+
- Verify no syntax errors
|
|
117
|
+
- Confirm the change works as intended
|
|
118
|
+
|
|
119
|
+
## 💡 Examples of Good Workflow
|
|
120
|
+
|
|
121
|
+
**Example 1: Adding a new feature**
|
|
122
|
+
\`\`\`
|
|
123
|
+
1. Create TODO list with tasks
|
|
124
|
+
2. Read SNOW.md to understand architecture
|
|
125
|
+
3. Read relevant source files
|
|
126
|
+
4. Implement changes incrementally
|
|
127
|
+
5. Update TODO after each file
|
|
128
|
+
6. Run npm run build to verify
|
|
129
|
+
7. Report completion
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
**Example 2: Fixing a bug**
|
|
133
|
+
\`\`\`
|
|
134
|
+
1. Search for the bug location
|
|
135
|
+
2. Read surrounding code context
|
|
136
|
+
3. Identify root cause
|
|
137
|
+
4. Make minimal fix
|
|
138
|
+
5. Run build/test scripts
|
|
139
|
+
6. Verify fix works
|
|
140
|
+
\`\`\`
|
|
141
|
+
|
|
142
|
+
**Example 3: Refactoring code**
|
|
143
|
+
\`\`\`
|
|
144
|
+
1. Create TODO with affected files
|
|
145
|
+
2. Read all files to understand dependencies
|
|
146
|
+
3. Refactor one file at a time
|
|
147
|
+
4. Update TODO after each file
|
|
148
|
+
5. Run build after each change
|
|
149
|
+
6. Ensure no breaking changes
|
|
150
|
+
\`\`\`
|
|
151
|
+
|
|
152
|
+
Remember: Your goal is to be a reliable, systematic, and quality-focused assistant. Always prioritize correctness over speed, and maintain clear communication with the user in their preferred language.`;
|
|
@@ -17,7 +17,7 @@ export type ConversationHandlerOptions = {
|
|
|
17
17
|
content: string;
|
|
18
18
|
status: 'pending' | 'in_progress' | 'completed';
|
|
19
19
|
}>>>;
|
|
20
|
-
requestToolConfirmation: (toolCall: ToolCall, batchToolNames?: string) => Promise<string>;
|
|
20
|
+
requestToolConfirmation: (toolCall: ToolCall, batchToolNames?: string, allTools?: ToolCall[]) => Promise<string>;
|
|
21
21
|
isToolAutoApproved: (toolName: string) => boolean;
|
|
22
22
|
addMultipleToAlwaysApproved: (toolNames: string[]) => void;
|
|
23
23
|
yoloMode: boolean;
|
|
@@ -235,11 +235,13 @@ export async function handleConversationWithTools(options) {
|
|
|
235
235
|
approvedTools.push(...toolsNeedingConfirmation);
|
|
236
236
|
}
|
|
237
237
|
else if (toolsNeedingConfirmation.length > 0) {
|
|
238
|
-
// Show all tools needing confirmation as a batch
|
|
239
|
-
const toolNames = toolsNeedingConfirmation.map(t => t.function.name).join(', ');
|
|
240
238
|
const firstTool = toolsNeedingConfirmation[0]; // Safe: length > 0 guarantees this exists
|
|
239
|
+
// Pass all tools for proper display in confirmation UI
|
|
240
|
+
const allTools = toolsNeedingConfirmation.length > 1
|
|
241
|
+
? toolsNeedingConfirmation
|
|
242
|
+
: undefined;
|
|
241
243
|
// Use first tool for confirmation UI, but apply result to all
|
|
242
|
-
const confirmation = await requestToolConfirmation(firstTool,
|
|
244
|
+
const confirmation = await requestToolConfirmation(firstTool, undefined, allTools);
|
|
243
245
|
if (confirmation === 'reject') {
|
|
244
246
|
// Remove pending tool messages
|
|
245
247
|
setMessages(prev => prev.filter(msg => !msg.toolPending));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
// Global navigation event emitter
|
|
3
3
|
const navigationEmitter = new EventEmitter();
|
|
4
|
+
// Increase max listeners to prevent warnings, but not unlimited to catch real leaks
|
|
5
|
+
navigationEmitter.setMaxListeners(20);
|
|
4
6
|
export const NAVIGATION_EVENT = 'navigate';
|
|
5
7
|
// Emit navigation event
|
|
6
8
|
export function navigateTo(destination) {
|
|
@@ -3,6 +3,7 @@ import type { ConfirmationResult } from '../ui/components/ToolConfirmation.js';
|
|
|
3
3
|
export type PendingConfirmation = {
|
|
4
4
|
tool: ToolCall;
|
|
5
5
|
batchToolNames?: string;
|
|
6
|
+
allTools?: ToolCall[];
|
|
6
7
|
resolve: (result: ConfirmationResult) => void;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
@@ -11,7 +12,7 @@ export type PendingConfirmation = {
|
|
|
11
12
|
export declare function useToolConfirmation(): {
|
|
12
13
|
pendingToolConfirmation: PendingConfirmation | null;
|
|
13
14
|
alwaysApprovedTools: Set<string>;
|
|
14
|
-
requestToolConfirmation: (toolCall: ToolCall, batchToolNames?: string) => Promise<ConfirmationResult>;
|
|
15
|
+
requestToolConfirmation: (toolCall: ToolCall, batchToolNames?: string, allTools?: ToolCall[]) => Promise<ConfirmationResult>;
|
|
15
16
|
isToolAutoApproved: (toolName: string) => boolean;
|
|
16
17
|
addToAlwaysApproved: (toolName: string) => void;
|
|
17
18
|
addMultipleToAlwaysApproved: (toolNames: string[]) => void;
|
|
@@ -8,11 +8,12 @@ export function useToolConfirmation() {
|
|
|
8
8
|
/**
|
|
9
9
|
* Request user confirmation for tool execution
|
|
10
10
|
*/
|
|
11
|
-
const requestToolConfirmation = async (toolCall, batchToolNames) => {
|
|
11
|
+
const requestToolConfirmation = async (toolCall, batchToolNames, allTools) => {
|
|
12
12
|
return new Promise((resolve) => {
|
|
13
13
|
setPendingToolConfirmation({
|
|
14
14
|
tool: toolCall,
|
|
15
15
|
batchToolNames,
|
|
16
|
+
allTools,
|
|
16
17
|
resolve: (result) => {
|
|
17
18
|
setPendingToolConfirmation(null);
|
|
18
19
|
resolve(result);
|
package/dist/mcp/filesystem.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ interface SearchMatch {
|
|
|
4
4
|
lineNumber: number;
|
|
5
5
|
lineContent: string;
|
|
6
6
|
column: number;
|
|
7
|
+
matchedText?: string;
|
|
8
|
+
nodeType?: string;
|
|
9
|
+
nodeName?: string;
|
|
10
|
+
language?: string;
|
|
7
11
|
}
|
|
8
12
|
interface SearchResult {
|
|
9
13
|
query: string;
|
|
@@ -147,7 +151,7 @@ export declare class FilesystemMCPService {
|
|
|
147
151
|
* @param maxResults - Maximum number of results to return (default: 100)
|
|
148
152
|
* @returns Search results with file paths, line numbers, and matched content
|
|
149
153
|
*/
|
|
150
|
-
searchCode(query: string, dirPath?: string, fileExtensions?: string[], caseSensitive?: boolean, maxResults?: number): Promise<SearchResult>;
|
|
154
|
+
searchCode(query: string, dirPath?: string, fileExtensions?: string[], caseSensitive?: boolean, maxResults?: number, searchMode?: 'text' | 'regex' | 'ast'): Promise<SearchResult>;
|
|
151
155
|
/**
|
|
152
156
|
* Resolve path relative to base path and normalize it
|
|
153
157
|
* @private
|
|
@@ -187,6 +191,7 @@ export declare const mcpTools: ({
|
|
|
187
191
|
fileExtensions?: undefined;
|
|
188
192
|
caseSensitive?: undefined;
|
|
189
193
|
maxResults?: undefined;
|
|
194
|
+
searchMode?: undefined;
|
|
190
195
|
};
|
|
191
196
|
required: string[];
|
|
192
197
|
};
|
|
@@ -218,6 +223,7 @@ export declare const mcpTools: ({
|
|
|
218
223
|
fileExtensions?: undefined;
|
|
219
224
|
caseSensitive?: undefined;
|
|
220
225
|
maxResults?: undefined;
|
|
226
|
+
searchMode?: undefined;
|
|
221
227
|
};
|
|
222
228
|
required: string[];
|
|
223
229
|
};
|
|
@@ -242,6 +248,7 @@ export declare const mcpTools: ({
|
|
|
242
248
|
fileExtensions?: undefined;
|
|
243
249
|
caseSensitive?: undefined;
|
|
244
250
|
maxResults?: undefined;
|
|
251
|
+
searchMode?: undefined;
|
|
245
252
|
};
|
|
246
253
|
required: string[];
|
|
247
254
|
};
|
|
@@ -267,6 +274,7 @@ export declare const mcpTools: ({
|
|
|
267
274
|
fileExtensions?: undefined;
|
|
268
275
|
caseSensitive?: undefined;
|
|
269
276
|
maxResults?: undefined;
|
|
277
|
+
searchMode?: undefined;
|
|
270
278
|
};
|
|
271
279
|
required?: undefined;
|
|
272
280
|
};
|
|
@@ -304,6 +312,7 @@ export declare const mcpTools: ({
|
|
|
304
312
|
fileExtensions?: undefined;
|
|
305
313
|
caseSensitive?: undefined;
|
|
306
314
|
maxResults?: undefined;
|
|
315
|
+
searchMode?: undefined;
|
|
307
316
|
};
|
|
308
317
|
required: string[];
|
|
309
318
|
};
|
|
@@ -340,6 +349,12 @@ export declare const mcpTools: ({
|
|
|
340
349
|
description: string;
|
|
341
350
|
default: number;
|
|
342
351
|
};
|
|
352
|
+
searchMode: {
|
|
353
|
+
type: string;
|
|
354
|
+
enum: string[];
|
|
355
|
+
description: string;
|
|
356
|
+
default: string;
|
|
357
|
+
};
|
|
343
358
|
filePath?: undefined;
|
|
344
359
|
startLine?: undefined;
|
|
345
360
|
endLine?: undefined;
|