sapper-iq 1.0.19 → 1.0.20

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 (2) hide show
  1. package/package.json +1 -1
  2. package/sapper.mjs +23 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapper-iq",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "AI-powered development assistant that executes commands and builds projects",
5
5
  "main": "sapper.mjs",
6
6
  "bin": {
package/sapper.mjs CHANGED
@@ -132,29 +132,37 @@ async function runSapper() {
132
132
  if (messages.length === 0) {
133
133
  messages = [{
134
134
  role: 'system',
135
- content: `You are Sapper, a senior engineer working in: ${process.cwd()}
135
+ content: `You are Sapper, a senior engineer.
136
136
 
137
137
  CRITICAL: You are working in the CURRENT DIRECTORY. Always use relative paths!
138
138
  - Use . or ./ for current directory
139
139
  - NEVER use / (that's the root directory)
140
140
  - Use relative paths like ./file.js or subfolder/file.js
141
141
 
142
- STRATEGY:
143
- 1. When asked to analyze, use [TOOL:LIST].[/TOOL] first (NOTE: dot, not slash!)
144
- 2. Read ONLY 2-3 KEY files in the SAME turn (README, package.json, main entry)
145
- 3. DON'T read ALL files at once - read strategically!
146
- 4. After reading files, PROVIDE ANALYSIS - don't just list more!
147
- 5. Use format: [TOOL:TYPE]path]content[/TOOL]
142
+ STRATEGY FOR FILE READING:
143
+ 1. Start with [TOOL:LIST].[/TOOL] to see what exists
144
+ 2. READ FILES BASED ON TASK:
145
+ - Quick overview: Read 2-3 key files (README, package.json, main entry)
146
+ - Deep analysis: Read ALL relevant files (entire src/ folder, all components)
147
+ - User asks "read all": Read ALL files they mention
148
+ 3. Use format: [TOOL:TYPE]path]content[/TOOL]
149
+ 4. After reading, PROVIDE ANALYSIS - don't just list more!
150
+
151
+ READING GUIDELINES:
152
+ - If user says "analyze src folder" → Read ALL files in src/
153
+ - If user says "read everything" → List directory, then read all files
154
+ - If < 20 files total: Read them all
155
+ - If > 20 files: Ask user which area to focus on
148
156
 
149
157
  TOOL FORMAT (CRITICAL - FOLLOW EXACTLY):
150
158
  ✅ CORRECT: [TOOL:LIST].[/TOOL]
151
159
  ✅ CORRECT: [TOOL:READ]./file.js[/TOOL]
160
+ ✅ CORRECT: [TOOL:LIST]./src[/TOOL] then read all files found
152
161
  ❌ WRONG: [TOOL:LIST].[/] - missing TOOL at end!
153
162
  ❌ WRONG: [TOOL:LIST]/[/TOOL] - wrong directory!
154
163
 
155
164
  WORKFLOW:
156
- 1. LIST directory → 2. READ 2-3 key files → 3. ANALYZE and RESPOND
157
- Don't keep executing tools endlessly - provide insights after reading!`
165
+ 1. LIST directory → 2. READ files (as many as needed) → 3. ANALYZE and RESPOND`
158
166
  }];
159
167
  }
160
168
 
@@ -212,10 +220,9 @@ Don't keep executing tools endlessly - provide insights after reading!`
212
220
  }
213
221
  fs.writeFileSync(CONTEXT_FILE, JSON.stringify(messages));
214
222
 
215
- // Limit tool executions - if too many, warn and exit
216
- if (toolMatches.length > 10) {
217
- console.log(chalk.yellow('\n⚠️ Too many tool calls in one response! AI should analyze, not just read endlessly.'));
218
- active = false;
223
+ // Warn if reading many files at once
224
+ if (toolMatches.length > 30) {
225
+ console.log(chalk.yellow('\n⚠️ Reading 30+ files! This might take time.'));
219
226
  }
220
227
  } else {
221
228
  // No tools found - check if malformed command
@@ -233,6 +240,9 @@ Don't keep executing tools endlessly - provide insights after reading!`
233
240
  }
234
241
  }
235
242
  ask();
243
+ }).catch((error) => {
244
+ console.error(chalk.red('\n❌ Error:'), error.message);
245
+ ask(); // Continue despite error
236
246
  });
237
247
  };
238
248
  ask();