sapper-iq 1.0.12 → 1.0.13

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 +30 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapper-iq",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
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
@@ -135,14 +135,20 @@ CRITICAL: You are working in the CURRENT DIRECTORY. Always use relative paths!
135
135
 
136
136
  STRATEGY:
137
137
  1. When asked to analyze, use [TOOL:LIST].[/TOOL] first (NOTE: dot, not slash!)
138
- 2. Immediately [TOOL:READ] key files from current directory in the SAME turn
139
- 3. Use format: [TOOL:TYPE]path]content[/TOOL]
140
- 4. DO NOT ask permission - just execute tools immediately
141
-
142
- EXAMPLES:
143
- CORRECT: [TOOL:LIST].[/TOOL] - lists current directory
144
- ✅ CORRECT: [TOOL:READ]./package.json[/TOOL] - reads from current dir
145
- WRONG: [TOOL:LIST]/[/TOOL] - lists root, not current directory!`
138
+ 2. Read ONLY 2-3 KEY files in the SAME turn (README, package.json, main entry)
139
+ 3. DON'T read ALL files at once - read strategically!
140
+ 4. After reading files, PROVIDE ANALYSIS - don't just list more!
141
+ 5. Use format: [TOOL:TYPE]path]content[/TOOL]
142
+
143
+ TOOL FORMAT (CRITICAL - FOLLOW EXACTLY):
144
+ ✅ CORRECT: [TOOL:LIST].[/TOOL]
145
+ CORRECT: [TOOL:READ]./file.js[/TOOL]
146
+ ❌ WRONG: [TOOL:LIST].[/] - missing TOOL at end!
147
+ ❌ WRONG: [TOOL:LIST]/[/TOOL] - wrong directory!
148
+
149
+ WORKFLOW:
150
+ 1. LIST directory → 2. READ 2-3 key files → 3. ANALYZE and RESPOND
151
+ Don't keep executing tools endlessly - provide insights after reading!`
146
152
  }];
147
153
  }
148
154
 
@@ -185,8 +191,23 @@ EXAMPLES:
185
191
  messages.push({ role: 'user', content: `RESULT (${path}): ${result}` });
186
192
  }
187
193
  fs.writeFileSync(CONTEXT_FILE, JSON.stringify(messages));
194
+
195
+ // Limit tool executions - if too many, warn and exit
196
+ if (toolMatches.length > 10) {
197
+ console.log(chalk.yellow('\n⚠️ Too many tool calls in one response! AI should analyze, not just read endlessly.'));
198
+ active = false;
199
+ }
188
200
  } else {
189
- active = false;
201
+ // No tools found - check if malformed command
202
+ if (msg.includes('[TOOL:') && msg.includes('[/]')) {
203
+ console.log(chalk.red('\n❌ Malformed tool command detected! Expected format: [TOOL:TYPE]path[/TOOL]'));
204
+ messages.push({
205
+ role: 'user',
206
+ content: 'ERROR: Your tool command is malformed. Use [TOOL:TYPE]path]content[/TOOL] or [TOOL:TYPE]path[/TOOL]'
207
+ });
208
+ } else {
209
+ active = false;
210
+ }
190
211
  }
191
212
  }
192
213
  ask();