sapper-iq 1.0.11 → 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 +50 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapper-iq",
3
- "version": "1.0.11",
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
@@ -87,11 +87,31 @@ const tools = {
87
87
  }
88
88
  };
89
89
 
90
+ async function checkForUpdates() {
91
+ try {
92
+ const response = await fetch('https://registry.npmjs.org/sapper-iq/latest');
93
+ const data = await response.json();
94
+ const latestVersion = data.version;
95
+
96
+ if (latestVersion && latestVersion !== CURRENT_VERSION) {
97
+ console.log(chalk.yellow('šŸ”„ UPDATE AVAILABLE!'));
98
+ console.log(chalk.gray(` Current: v${CURRENT_VERSION}`));
99
+ console.log(chalk.green(` Latest: v${latestVersion}`));
100
+ console.log(chalk.cyan(' Run: npm update -g sapper-iq\n'));
101
+ }
102
+ } catch (error) {
103
+ // Silently fail if update check fails
104
+ }
105
+ }
106
+
90
107
  async function runSapper() {
91
108
  console.clear();
92
109
  console.log(chalk.cyan.bold(` SAPPER v${CURRENT_VERSION} | Autonomous "OpenCode" Mode`));
93
110
  console.log(chalk.gray(`šŸ“ Working Directory: ${process.cwd()}\n`));
94
111
 
112
+ // Check for updates
113
+ await checkForUpdates();
114
+
95
115
  let messages = [];
96
116
  if (fs.existsSync(CONTEXT_FILE)) {
97
117
  const resume = await safeQuestion(chalk.green('Resume previous session? (y/n): '));
@@ -115,14 +135,20 @@ CRITICAL: You are working in the CURRENT DIRECTORY. Always use relative paths!
115
135
 
116
136
  STRATEGY:
117
137
  1. When asked to analyze, use [TOOL:LIST].[/TOOL] first (NOTE: dot, not slash!)
118
- 2. Immediately [TOOL:READ] key files from current directory in the SAME turn
119
- 3. Use format: [TOOL:TYPE]path]content[/TOOL]
120
- 4. DO NOT ask permission - just execute tools immediately
121
-
122
- EXAMPLES:
123
- āœ… CORRECT: [TOOL:LIST].[/TOOL] - lists current directory
124
- āœ… CORRECT: [TOOL:READ]./package.json[/TOOL] - reads from current dir
125
- āŒ 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!`
126
152
  }];
127
153
  }
128
154
 
@@ -165,8 +191,23 @@ EXAMPLES:
165
191
  messages.push({ role: 'user', content: `RESULT (${path}): ${result}` });
166
192
  }
167
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
+ }
168
200
  } else {
169
- 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
+ }
170
211
  }
171
212
  }
172
213
  ask();