snow-ai 0.2.7 → 0.2.9
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/mcp/filesystem.d.ts +3 -3
- package/dist/mcp/filesystem.js +18 -19
- package/package.json +1 -1
- package/readme.md +54 -1
package/dist/mcp/filesystem.d.ts
CHANGED
|
@@ -76,8 +76,8 @@ export declare class FilesystemMCPService {
|
|
|
76
76
|
}>;
|
|
77
77
|
/**
|
|
78
78
|
* Edit a file by replacing lines within a specified range
|
|
79
|
-
*
|
|
80
|
-
* For larger changes, make multiple
|
|
79
|
+
* BEST PRACTICE: Keep edits small and focused (≤15 lines recommended) for better accuracy.
|
|
80
|
+
* For larger changes, make multiple parallel edits to non-overlapping sections instead of one large edit.
|
|
81
81
|
*
|
|
82
82
|
* @param filePath - Path to the file to edit
|
|
83
83
|
* @param startLine - Starting line number (1-indexed, inclusive) - get from filesystem_read output
|
|
@@ -85,7 +85,7 @@ export declare class FilesystemMCPService {
|
|
|
85
85
|
* @param newContent - New content to replace the specified lines (WITHOUT line numbers)
|
|
86
86
|
* @param contextLines - Number of context lines to return before and after the edit (default: 8)
|
|
87
87
|
* @returns Object containing success message, precise before/after comparison, and diagnostics
|
|
88
|
-
* @throws Error if file editing fails
|
|
88
|
+
* @throws Error if file editing fails
|
|
89
89
|
*/
|
|
90
90
|
editFile(filePath: string, startLine: number, endLine: number, newContent: string, contextLines?: number): Promise<{
|
|
91
91
|
message: string;
|
package/dist/mcp/filesystem.js
CHANGED
|
@@ -206,8 +206,8 @@ export class FilesystemMCPService {
|
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* Edit a file by replacing lines within a specified range
|
|
209
|
-
*
|
|
210
|
-
* For larger changes, make multiple
|
|
209
|
+
* BEST PRACTICE: Keep edits small and focused (≤15 lines recommended) for better accuracy.
|
|
210
|
+
* For larger changes, make multiple parallel edits to non-overlapping sections instead of one large edit.
|
|
211
211
|
*
|
|
212
212
|
* @param filePath - Path to the file to edit
|
|
213
213
|
* @param startLine - Starting line number (1-indexed, inclusive) - get from filesystem_read output
|
|
@@ -215,7 +215,7 @@ export class FilesystemMCPService {
|
|
|
215
215
|
* @param newContent - New content to replace the specified lines (WITHOUT line numbers)
|
|
216
216
|
* @param contextLines - Number of context lines to return before and after the edit (default: 8)
|
|
217
217
|
* @returns Object containing success message, precise before/after comparison, and diagnostics
|
|
218
|
-
* @throws Error if file editing fails
|
|
218
|
+
* @throws Error if file editing fails
|
|
219
219
|
*/
|
|
220
220
|
async editFile(filePath, startLine, endLine, newContent, contextLines = 8) {
|
|
221
221
|
try {
|
|
@@ -240,18 +240,7 @@ export class FilesystemMCPService {
|
|
|
240
240
|
}
|
|
241
241
|
// Adjust endLine if it exceeds file length
|
|
242
242
|
const adjustedEndLine = Math.min(endLine, totalLines);
|
|
243
|
-
// ENFORCE SMALL EDITS: Limit to max 15 lines per edit for precision
|
|
244
243
|
const linesToModify = adjustedEndLine - startLine + 1;
|
|
245
|
-
const MAX_LINES_PER_EDIT = 15;
|
|
246
|
-
if (linesToModify > MAX_LINES_PER_EDIT) {
|
|
247
|
-
throw new Error(`❌ Edit range too large (${linesToModify} lines). Maximum allowed: ${MAX_LINES_PER_EDIT} lines.\n\n` +
|
|
248
|
-
`💡 Best Practice: Make SMALL, PRECISE edits instead of large changes.\n` +
|
|
249
|
-
` - Break your changes into multiple sequential edits\n` +
|
|
250
|
-
` - Each edit should modify at most ${MAX_LINES_PER_EDIT} lines\n` +
|
|
251
|
-
` - This ensures accuracy and prevents syntax errors\n\n` +
|
|
252
|
-
`Current request: lines ${startLine}-${adjustedEndLine} (${linesToModify} lines)\n` +
|
|
253
|
-
`Suggested approach: Split into ${Math.ceil(linesToModify / MAX_LINES_PER_EDIT)} smaller edits`);
|
|
254
|
-
}
|
|
255
244
|
// Backup file before editing
|
|
256
245
|
await incrementalSnapshotManager.backupFile(fullPath);
|
|
257
246
|
// Extract the lines that will be replaced (for comparison)
|
|
@@ -317,8 +306,18 @@ export class FilesystemMCPService {
|
|
|
317
306
|
const errorCount = diagnostics.filter(d => d.severity === 'error').length;
|
|
318
307
|
const warningCount = diagnostics.filter(d => d.severity === 'warning').length;
|
|
319
308
|
if (errorCount > 0 || warningCount > 0) {
|
|
320
|
-
result.message += `\n\n⚠️ Diagnostics detected: ${errorCount} error(s), ${warningCount} warning(s)
|
|
321
|
-
|
|
309
|
+
result.message += `\n\n⚠️ Diagnostics detected: ${errorCount} error(s), ${warningCount} warning(s)`;
|
|
310
|
+
// Format diagnostics for better readability
|
|
311
|
+
const formattedDiagnostics = diagnostics
|
|
312
|
+
.filter(d => d.severity === 'error' || d.severity === 'warning')
|
|
313
|
+
.map(d => {
|
|
314
|
+
const icon = d.severity === 'error' ? '❌' : '⚠️';
|
|
315
|
+
const location = `${filePath}:${d.line}:${d.character}`;
|
|
316
|
+
return ` ${icon} [${d.source || 'unknown'}] ${location}\n ${d.message}`;
|
|
317
|
+
})
|
|
318
|
+
.join('\n\n');
|
|
319
|
+
result.message += `\n\n📋 Diagnostic Details:\n${formattedDiagnostics}`;
|
|
320
|
+
result.message += `\n\n ⚡ TIP: Review the errors above and make another small edit to fix them`;
|
|
322
321
|
}
|
|
323
322
|
}
|
|
324
323
|
return result;
|
|
@@ -441,7 +440,7 @@ export const filesystemService = new FilesystemMCPService();
|
|
|
441
440
|
export const mcpTools = [
|
|
442
441
|
{
|
|
443
442
|
name: 'filesystem_read',
|
|
444
|
-
description: 'Read the content of a file within specified line range. The returned content includes line numbers (format: "lineNum→content") for precise editing. You MUST specify startLine and endLine. To read the entire file, use startLine=1 and a large endLine value (e.g.,
|
|
443
|
+
description: 'Read the content of a file within specified line range. The returned content includes line numbers (format: "lineNum→content") for precise editing. You MUST specify startLine and endLine. To read the entire file, use startLine=1 and a large endLine value (e.g., 500). IMPORTANT: When you need to edit a file, you MUST read it first to see the exact line numbers and current content. NOTE: If the path points to a directory, this tool will automatically list its contents instead of throwing an error.',
|
|
445
444
|
inputSchema: {
|
|
446
445
|
type: 'object',
|
|
447
446
|
properties: {
|
|
@@ -514,7 +513,7 @@ export const mcpTools = [
|
|
|
514
513
|
},
|
|
515
514
|
{
|
|
516
515
|
name: 'filesystem_edit',
|
|
517
|
-
description: '🎯 PREFERRED tool for precise file editing. **
|
|
516
|
+
description: '🎯 PREFERRED tool for precise file editing. **BEST PRACTICES**: (1) Use SMALL, INCREMENTAL edits (recommended ≤15 lines per edit) instead of large changes - this is SAFER and MORE ACCURATE, preventing syntax errors and bracket mismatches. (2) For large changes, make MULTIPLE PARALLEL edits to different sections of the file instead of one large edit. (3) Must use exact line numbers from filesystem_read output. **WORKFLOW**: (1) Read target section with filesystem_read to get exact line numbers, (2) Edit small sections, (3) Verify with diagnostics, (4) If editing multiple sections, you can make parallel edits to non-overlapping line ranges. Returns precise before/after comparison with line numbers and VS Code diagnostics.',
|
|
518
517
|
inputSchema: {
|
|
519
518
|
type: 'object',
|
|
520
519
|
properties: {
|
|
@@ -528,7 +527,7 @@ export const mcpTools = [
|
|
|
528
527
|
},
|
|
529
528
|
endLine: {
|
|
530
529
|
type: 'number',
|
|
531
|
-
description: '⚠️ CRITICAL: Ending line number (1-indexed, inclusive). MUST match exact line number from filesystem_read output.
|
|
530
|
+
description: '⚠️ CRITICAL: Ending line number (1-indexed, inclusive). MUST match exact line number from filesystem_read output. 💡 TIP: Keep edits small (≤15 lines recommended) for better accuracy.'
|
|
532
531
|
},
|
|
533
532
|
newContent: {
|
|
534
533
|
type: 'string',
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -6,4 +6,57 @@
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
$ npm install --global snow-ai
|
|
9
|
-
```
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Start
|
|
12
|
+
```bash
|
|
13
|
+
$ snow
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Update
|
|
17
|
+
```bash
|
|
18
|
+
$ snow --update
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Config example `./User/.snow/config.json`
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"openai": {
|
|
25
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
26
|
+
"apiKey": "your-api-key",
|
|
27
|
+
"requestMethod": "responses",
|
|
28
|
+
"advancedModel": "gpt-5-codex",
|
|
29
|
+
"basicModel": "gpt-5-codex",
|
|
30
|
+
"maxContextTokens": 200000,
|
|
31
|
+
"compactModel": {
|
|
32
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
33
|
+
"apiKey": "your-api-key",
|
|
34
|
+
"modelName": "gpt-4.1-mini"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Uninstall
|
|
41
|
+
```bash
|
|
42
|
+
$ npm uninstall --global snow-ai
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Install VSCode Extension
|
|
46
|
+
|
|
47
|
+
* download [VSIX/snow-cli-0.2.5.vsix](https://github.com/MayDay-wpf/snow-cli/blob/main/VSIX/snow-cli-0.2.5.vsix)
|
|
48
|
+
|
|
49
|
+
* open VSCode, click `Extensions` -> `Install from VSIX...` -> select `snow-cli-0.2.5.vsix`
|
|
50
|
+
|
|
51
|
+
## Live View
|
|
52
|
+
* **Welcome & Settings**
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
* **Agent**
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
* **Commands**
|
|
61
|
+
|
|
62
|
+

|