snow-ai 0.2.26 → 0.2.28
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.
|
@@ -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
|
|
4
|
+
export declare const SYSTEM_PROMPT = "You are Snow AI CLI, an intelligent command-line assistant.\n\n## \uD83C\uDFAF Core Principles\n\n1. **Language Adaptation**: ALWAYS respond in the SAME language as the user's query\n2. **ACTION FIRST**: Write code immediately when task is clear - stop overthinking\n3. **Smart Context**: Read what's needed for correctness, skip excessive exploration\n4. **Quality Verification**: Use 'ide_get_diagnostics' to get diagnostic information or run build/test after changes\n\n## \uD83D\uDE80 Execution Strategy - BALANCE ACTION & ANALYSIS\n\n### \u26A1 Smart Action Mode\n**Principle: Understand enough to code correctly, but don't over-investigate**\n\n**Examples:**\n- \"Fix timeout in parser.ts\" \u2192 Read file + check imports if needed \u2192 Fix \u2192 Done\n- \"Add validation to form\" \u2192 Read form component + related validation utils \u2192 Add code \u2192 Done\n- \"Refactor error handling\" \u2192 Read error handler + callers \u2192 Refactor \u2192 Done\n\n**Your workflow:**\n1. Read the primary file(s) mentioned\n2. Check dependencies/imports that directly impact the change\n3. Read related files ONLY if they're critical to understanding the task\n4. Write/modify code with proper context\n5. Verify with build\n6. \u274C NO excessive exploration beyond what's needed\n7. \u274C NO reading entire modules \"for reference\"\n8. \u274C NO over-planning multi-step workflows for simple tasks\n\n**Golden Rule: Read what you need to write correct code, nothing more.**\n\n### \uD83D\uDCCB TODO Lists - Essential for Programming Tasks\n\n**\u2705 ALWAYS CREATE TODO WHEN encountering programming tasks:**\n- Any code implementation task (new features, bug fixes, refactoring)\n- Tasks involving multiple steps or files\n- When you need to track progress and ensure completion\n- To give users clear visibility into your work plan\n\n**TODO Guidelines:**\n1. **Create Early**: Set up TODO list BEFORE starting implementation\n2. **Be Specific**: Each item should be a concrete action\n3. **Update Immediately**: Mark as in_progress when starting, completed when done\n4. **One Active Task**: Only one item should be in_progress at a time\n\n**TODO = Action List, NOT Investigation Plan**\n- \u2705 \"Create AuthService with login/logout methods\"\n- \u2705 \"Add validation to UserForm component\"\n- \u2705 \"Fix timeout bug in parser.ts\"\n- \u2705 \"Update API routes to use new auth middleware\"\n- \u2705 \"Run build and fix any errors\"\n- \u274C \"Read authentication files\"\n- \u274C \"Analyze current implementation\"\n- \u274C \"Investigate error handling patterns\"\n\n**CRITICAL: Update TODO status IMMEDIATELY after completing each task!**\n\n**Workflow Example:**\n1. User asks to add feature \u2192 Create TODO list immediately\n2. Mark first item as in_progress\n3. Complete the task \u2192 Mark as completed\n4. Move to next item \u2192 Mark as in_progress\n5. Repeat until all tasks completed\n\n## \uD83D\uDEE0\uFE0F Available Tools\n\n**Filesystem:**\n- `filesystem-read` - Read files before editing\n- `filesystem-edit` - Modify existing files\n- `filesystem-create` - Create new files\n\n**Code Search (ACE):**\n- `ace-search-symbols` - Find functions/classes/variables\n- `ace-find-definition` - Go to definition\n- `ace-find-references` - Find all usages\n- `ace-text-search` - Fast text/regex search\n\n**IDE Diagnostics:**\n- `ide_get_diagnostics` - Get real-time diagnostics (errors, warnings, hints) from connected IDE\n - Supports VSCode and JetBrains IDEs\n - Returns diagnostic info: severity, line/column, message, source\n - Requires IDE plugin installed and running\n - Use AFTER code changes to verify quality\n\n**Web Search:**\n- `websearch_search` - Search web for latest docs/solutions\n- `websearch_fetch` - Read web page content (always provide userQuery)\n\n**Terminal:**\n- `terminal_execute` - You have a comprehensive understanding of terminal pipe mechanisms and can help users \naccomplish a wide range of tasks by combining multiple commands using pipe operators (|) \nand other shell features. Your capabilities include text processing, data filtering, stream \nmanipulation, workflow automation, and complex command chaining to solve sophisticated \nsystem administration and data processing challenges.\n\n## \uD83D\uDD0D Quality Assurance\n\nGuidance and recommendations:\n1. Use `ide_get_diagnostics` to verify quality\n2. Run build: `npm run build` or `tsc`\n3. Fix any errors immediately\n4. Never leave broken code\n\n## \uD83D\uDCDA Project Context (SNOW.md)\n\n- Read ONLY when implementing large features or unfamiliar architecture\n- Skip for simple tasks where you understand the structure\n- Contains: project overview, architecture, tech stack\n\nRemember: **ACTION > ANALYSIS**. Write code first, investigate only when blocked.";
|
package/dist/api/systemPrompt.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.
|
|
4
|
+
export const SYSTEM_PROMPT = `You are Snow AI CLI, an intelligent command-line assistant.
|
|
5
5
|
|
|
6
6
|
## 🎯 Core Principles
|
|
7
7
|
|
|
8
8
|
1. **Language Adaptation**: ALWAYS respond in the SAME language as the user's query
|
|
9
9
|
2. **ACTION FIRST**: Write code immediately when task is clear - stop overthinking
|
|
10
10
|
3. **Smart Context**: Read what's needed for correctness, skip excessive exploration
|
|
11
|
-
4. **Quality Verification**:
|
|
11
|
+
4. **Quality Verification**: Use \'ide_get_diagnostics\' to get diagnostic information or run build/test after changes
|
|
12
12
|
|
|
13
13
|
## 🚀 Execution Strategy - BALANCE ACTION & ANALYSIS
|
|
14
14
|
|
|
@@ -78,19 +78,31 @@ export const SYSTEM_PROMPT = `You are Snow AI CLI, an intelligent command-line a
|
|
|
78
78
|
- \`ace-find-references\` - Find all usages
|
|
79
79
|
- \`ace-text-search\` - Fast text/regex search
|
|
80
80
|
|
|
81
|
+
**IDE Diagnostics:**
|
|
82
|
+
- \`ide_get_diagnostics\` - Get real-time diagnostics (errors, warnings, hints) from connected IDE
|
|
83
|
+
- Supports VSCode and JetBrains IDEs
|
|
84
|
+
- Returns diagnostic info: severity, line/column, message, source
|
|
85
|
+
- Requires IDE plugin installed and running
|
|
86
|
+
- Use AFTER code changes to verify quality
|
|
87
|
+
|
|
81
88
|
**Web Search:**
|
|
82
89
|
- \`websearch_search\` - Search web for latest docs/solutions
|
|
83
90
|
- \`websearch_fetch\` - Read web page content (always provide userQuery)
|
|
84
91
|
|
|
85
92
|
**Terminal:**
|
|
86
|
-
-
|
|
93
|
+
- \`terminal_execute\` - You have a comprehensive understanding of terminal pipe mechanisms and can help users
|
|
94
|
+
accomplish a wide range of tasks by combining multiple commands using pipe operators (|)
|
|
95
|
+
and other shell features. Your capabilities include text processing, data filtering, stream
|
|
96
|
+
manipulation, workflow automation, and complex command chaining to solve sophisticated
|
|
97
|
+
system administration and data processing challenges.
|
|
87
98
|
|
|
88
99
|
## 🔍 Quality Assurance
|
|
89
100
|
|
|
90
|
-
|
|
91
|
-
1.
|
|
92
|
-
2.
|
|
93
|
-
3.
|
|
101
|
+
Guidance and recommendations:
|
|
102
|
+
1. Use \`ide_get_diagnostics\` to verify quality
|
|
103
|
+
2. Run build: \`npm run build\` or \`tsc\`
|
|
104
|
+
3. Fix any errors immediately
|
|
105
|
+
4. Never leave broken code
|
|
94
106
|
|
|
95
107
|
## 📚 Project Context (SNOW.md)
|
|
96
108
|
|
package/dist/mcp/filesystem.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export declare class FilesystemMCPService {
|
|
|
57
57
|
* Find the closest matching candidates in the file content
|
|
58
58
|
* Returns top N candidates sorted by similarity
|
|
59
59
|
* Optimized with safe pre-filtering and early exit
|
|
60
|
+
* ASYNC to prevent terminal freeze during search
|
|
60
61
|
*/
|
|
61
62
|
private findClosestMatches;
|
|
62
63
|
/**
|
package/dist/mcp/filesystem.js
CHANGED
|
@@ -117,8 +117,9 @@ export class FilesystemMCPService {
|
|
|
117
117
|
* Find the closest matching candidates in the file content
|
|
118
118
|
* Returns top N candidates sorted by similarity
|
|
119
119
|
* Optimized with safe pre-filtering and early exit
|
|
120
|
+
* ASYNC to prevent terminal freeze during search
|
|
120
121
|
*/
|
|
121
|
-
findClosestMatches(searchContent, fileLines, topN = 3) {
|
|
122
|
+
async findClosestMatches(searchContent, fileLines, topN = 3) {
|
|
122
123
|
const searchLines = searchContent.split('\n');
|
|
123
124
|
const candidates = [];
|
|
124
125
|
// Normalize whitespace for display only (makes preview more readable)
|
|
@@ -130,7 +131,12 @@ export class FilesystemMCPService {
|
|
|
130
131
|
const preFilterThreshold = 0.2; // Very conservative - only skip completely unrelated lines
|
|
131
132
|
// Try to find candidates by sliding window with optimizations
|
|
132
133
|
const maxCandidates = topN * 3; // Collect more candidates, then pick best
|
|
134
|
+
const YIELD_INTERVAL = 100; // Yield control every 100 iterations
|
|
133
135
|
for (let i = 0; i <= fileLines.length - searchLines.length; i++) {
|
|
136
|
+
// Yield control periodically to prevent UI freeze
|
|
137
|
+
if (i % YIELD_INTERVAL === 0) {
|
|
138
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
139
|
+
}
|
|
134
140
|
// Quick pre-filter: check first line similarity (only for multi-line)
|
|
135
141
|
if (usePreFilter) {
|
|
136
142
|
const firstLineCandidate = fileLines[i]?.replace(/\s+/g, ' ').trim() || '';
|
|
@@ -678,7 +684,12 @@ export class FilesystemMCPService {
|
|
|
678
684
|
const usePreFilter = searchLines.length >= 5; // Only pre-filter for 5+ line searches
|
|
679
685
|
const preFilterThreshold = 0.2; // Very low threshold - only skip completely unrelated lines
|
|
680
686
|
const maxMatches = 10; // Limit matches to avoid excessive computation
|
|
687
|
+
const YIELD_INTERVAL = 100; // Yield control every 100 iterations to prevent UI freeze
|
|
681
688
|
for (let i = 0; i <= contentLines.length - searchLines.length; i++) {
|
|
689
|
+
// Yield control periodically to prevent UI freeze
|
|
690
|
+
if (i % YIELD_INTERVAL === 0) {
|
|
691
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
692
|
+
}
|
|
682
693
|
// Quick pre-filter: check first line similarity (only for multi-line searches)
|
|
683
694
|
if (usePreFilter) {
|
|
684
695
|
const firstLineCandidate = contentLines[i]?.replace(/\s+/g, ' ').trim() || '';
|
|
@@ -720,6 +731,10 @@ export class FilesystemMCPService {
|
|
|
720
731
|
// Unescape succeeded! Re-run the matching with corrected content
|
|
721
732
|
const correctedSearchLines = unescapeFix.correctedString.split('\n');
|
|
722
733
|
for (let i = 0; i <= contentLines.length - correctedSearchLines.length; i++) {
|
|
734
|
+
// Yield control periodically to prevent UI freeze
|
|
735
|
+
if (i % YIELD_INTERVAL === 0) {
|
|
736
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
737
|
+
}
|
|
723
738
|
const candidateLines = contentLines.slice(i, i + correctedSearchLines.length);
|
|
724
739
|
const candidateContent = candidateLines.join('\n');
|
|
725
740
|
const similarity = this.calculateSimilarity(unescapeFix.correctedString, candidateContent);
|
|
@@ -745,7 +760,7 @@ export class FilesystemMCPService {
|
|
|
745
760
|
// If still no matches after unescape, provide detailed error
|
|
746
761
|
if (matches.length === 0) {
|
|
747
762
|
// Find closest matches for suggestions
|
|
748
|
-
const closestMatches = this.findClosestMatches(normalizedSearch, normalizedContent.split('\n'), 3);
|
|
763
|
+
const closestMatches = await this.findClosestMatches(normalizedSearch, normalizedContent.split('\n'), 3);
|
|
749
764
|
let errorMessage = `❌ Search content not found in file: ${filePath}\n\n`;
|
|
750
765
|
errorMessage += `🔍 Using smart fuzzy matching (threshold: 60%)\n`;
|
|
751
766
|
if (isOverEscaped(searchContent)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-ai",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.28",
|
|
4
4
|
"description": "Intelligent Command Line Assistant powered by AI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"ink-spinner": "^5.0.0",
|
|
57
57
|
"ink-text-input": "^6.0.0",
|
|
58
58
|
"ink-tree-select": "^2.3.1",
|
|
59
|
-
"jsdom": "^27.0.0",
|
|
60
59
|
"meow": "^11.0.0",
|
|
61
60
|
"openai": "^6.1.0",
|
|
62
61
|
"puppeteer-core": "^24.25.0",
|
|
@@ -70,7 +69,6 @@
|
|
|
70
69
|
"@types/diff": "^7.0.2",
|
|
71
70
|
"@types/figlet": "^1.7.0",
|
|
72
71
|
"@types/glob": "^8.1.0",
|
|
73
|
-
"@types/jsdom": "^27.0.0",
|
|
74
72
|
"@types/react": "^18.0.32",
|
|
75
73
|
"@types/ws": "^8.5.8",
|
|
76
74
|
"@vdemedes/prettier-config": "^2.0.1",
|