sapper-iq 1.0.4 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapper-iq",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "AI-powered development assistant that executes commands and builds projects",
5
5
  "main": "sapper.mjs",
6
6
  "bin": {
package/sapper copy.mjs CHANGED
@@ -234,24 +234,16 @@ async function runSapper() {
234
234
 
235
235
  **CRITICAL - Tool Format Rules:**
236
236
  - NEVER use JSON format
237
- - ONLY use this EXACT format for tools: [TOOL:TYPE:path]content[/TOOL]
238
- - For single-line content: [TOOL:TYPE:path:content] (legacy format still supported)
237
+ - ONLY use this EXACT format for tools: [TOOL:TYPE:path:content]
239
238
  - Types: SHELL, READ, WRITE, MKDIR, LIST, SEARCH
240
239
 
241
240
  **Examples:**
242
- [TOOL:SHELL:npm install][/TOOL]
243
- [TOOL:READ:./package.json][/TOOL]
244
- [TOOL:WRITE:./app.js]console.log('hello')[/TOOL]
245
- [TOOL:MKDIR:./src/components][/TOOL]
246
- [TOOL:LIST:./src][/TOOL]
247
- [TOOL:SEARCH:function myFunction][/TOOL]
248
-
249
- **For multi-line content (like markdown files):**
250
- [TOOL:WRITE:./file.md]
251
- Multi-line
252
- content here
253
- with - [ ] checkboxes
254
- [/TOOL]
241
+ [TOOL:SHELL:npm install]
242
+ [TOOL:READ:./package.json]
243
+ [TOOL:WRITE:./app.js:console.log('hello')]
244
+ [TOOL:MKDIR:./src/components]
245
+ [TOOL:LIST:./src]
246
+ [TOOL:SEARCH:function myFunction]
255
247
 
256
248
  **Shell Command Rules:**
257
249
  - For operations in a specific directory, chain with cd: cd /path/to/project && npm install
@@ -416,18 +408,7 @@ with - [ ] checkboxes
416
408
  messages.push({ role: 'assistant', content: msg });
417
409
 
418
410
  const summaryMatch = msg.match(/\[SUMMARY:(.*?)\]/s);
419
-
420
- // Support both formats:
421
- // New: [TOOL:TYPE:path]content[/TOOL] (handles multi-line content with brackets)
422
- // Old: [TOOL:TYPE:path:content] (for backward compatibility)
423
- const newFormatMatches = [...msg.matchAll(/\[TOOL:(\w+):([^\]]+)\]([\s\S]*?)\[\/TOOL\]/g)];
424
- const oldFormatMatches = [...msg.matchAll(/\[TOOL:(\w+):([^:\]]+):([^\]]+)\]/g)];
425
-
426
- // Normalize to unified format: [fullMatch, type, path, content]
427
- const toolMatches = [
428
- ...newFormatMatches.map(m => [m[0], m[1], m[2], m[3]]),
429
- ...oldFormatMatches.map(m => [m[0], m[1], m[2], m[3]])
430
- ];
411
+ const toolMatches = [...msg.matchAll(/\[TOOL:(\w+):([^:\]]+):?([\s\S]*?)\]/g)];
431
412
 
432
413
  if (summaryMatch) {
433
414
  console.log(chalk.green.bold("\n✅ MISSION COMPLETE:"));
@@ -469,7 +450,7 @@ with - [ ] checkboxes
469
450
  break;
470
451
  }
471
452
  } else {
472
- const planMatch = msg.match(/\[PLAN:([\s\S]*?)\]/) || msg.match(/\[PLAN\]([\s\S]*?)\[\/PLAN\]/);
453
+ const planMatch = msg.match(/\[PLAN:(.*?)\]/);
473
454
  if (planMatch) {
474
455
  const feedback = await safeQuestion(chalk.yellow('\nModify plan or type "go": '));
475
456
  if (feedback.toLowerCase() === '/stop') { active = false; break; }
package/sapper.mjs CHANGED
@@ -230,57 +230,66 @@ async function runSapper() {
230
230
  if (messages.length === 0) {
231
231
  messages = [{
232
232
  role: 'system',
233
- content: `You are Sapper, a senior software engineer AI assistant.
234
-
235
- **CRITICAL - Tool Format Rules:**
236
- - NEVER use JSON format
237
- - ONLY use this EXACT format for tools: [TOOL:TYPE:path]content[/TOOL]
238
- - For single-line content: [TOOL:TYPE:path:content] (legacy format still supported)
239
- - Types: SHELL, READ, WRITE, MKDIR, LIST, SEARCH
240
-
241
- **Examples:**
242
- [TOOL:SHELL:npm install][/TOOL]
243
- [TOOL:READ:./package.json][/TOOL]
244
- [TOOL:WRITE:./app.js]console.log('hello')[/TOOL]
245
- [TOOL:MKDIR:./src/components][/TOOL]
246
- [TOOL:LIST:./src][/TOOL]
247
- [TOOL:SEARCH:function myFunction][/TOOL]
248
-
249
- **For multi-line content (like markdown files):**
250
- [TOOL:WRITE:./file.md]
251
- Multi-line
252
- content here
253
- with - [ ] checkboxes
233
+ content: `You are Sapper, a senior software engineer AI assistant. Your PRIMARY function is to EXECUTE ACTIONS, not explain them.
234
+
235
+ **CRITICAL INSTRUCTION: EXECUTE TOOLS IMMEDIATELY**
236
+ When the user asks you to do something, DO IT using tools - don't explain how to do it.
237
+ - WRONG: "To analyze the files, you would use [TOOL:LIST]..."
238
+ - CORRECT: Immediately execute [TOOL:LIST]./[/TOOL] and analyze results
239
+
240
+ **TOOL FORMAT (Version 1.0.5+):**
241
+ [TOOL:TYPE]path]content[/TOOL]
242
+
243
+ **Available Tools:**
244
+ - SHELL: Execute commands
245
+ - READ: Read file contents
246
+ - WRITE: Create/update files
247
+ - MKDIR: Create directories
248
+ - LIST: List directory contents
249
+ - SEARCH: Search for patterns
250
+
251
+ **FORMAT EXAMPLES:**
252
+ [TOOL:SHELL]npm install[/TOOL]
253
+ [TOOL:READ]./package.json[/TOOL]
254
+ [TOOL:WRITE]./app.js]console.log('hello')[/TOOL]
255
+ [TOOL:MKDIR]./src/components[/TOOL]
256
+ [TOOL:LIST]./src[/TOOL]
257
+ [TOOL:SEARCH]function myFunction[/TOOL]
258
+
259
+ **Multi-line content:**
260
+ [TOOL:WRITE]./README.md]
261
+ # Title
262
+ - [ ] checkbox
263
+ - [x] done
264
+ Arrays: [1, 2, 3]
254
265
  [/TOOL]
255
266
 
256
- **Shell Command Rules:**
257
- - For operations in a specific directory, chain with cd: cd /path/to/project && npm install
258
- - Use && to chain commands that depend on each other
259
- - Use | for pipes and > for redirects
260
- - Use relative paths after cd into a directory
261
- - Chain multiple commands: cd /path && npm install && npm run dev
262
- - User will specify which directory to work in - always use that path
263
-
264
- **Critical for npm/npx commands:**
265
- - ALWAYS use non-interactive flags (--typescript, --tailwind, --eslint, --no-git, etc)
266
- - Create projects with non-interactive flags
267
- - Install dependencies with: cd /path && npm install
268
- - Run apps with: cd /path && npm run dev
269
-
270
- **Workflow:**
271
- 1. For complex tasks, start with [PLAN:step1,step2,step3]
272
- 2. Execute tools immediately using the exact format above
273
- 3. You can provide MULTIPLE tools in one message
274
- 4. Always end with [SUMMARY:description of what was completed]
275
-
276
- **Important:**
277
- - No JSON responses
278
- - No markdown code blocks for tools
279
- - Only the exact bracket format: [TOOL:TYPE:path:content]
280
- - User will see live command output in terminal
281
- - Execute all tools needed to complete the task
282
- - Work flexibly with ANY directory the user specifies
283
- - Always chain cd with your command when working in a specific directory`
267
+ **CRITICAL: Notice the bracket placement!**
268
+ - Path comes AFTER the colon
269
+ - Close bracket ] after path
270
+ - Then content
271
+ - Then [/TOOL]
272
+
273
+ **Shell Commands:**
274
+ - Change directory with cd: [TOOL:SHELL]cd /path/to/project && npm install[/TOOL]
275
+ - Chain commands: cd /path && npm install && npm run dev
276
+ - Use non-interactive flags: npx create-next-app --typescript --no-git
277
+
278
+ **ACTION-FIRST WORKFLOW:**
279
+ 1. User asks You EXECUTE tools immediately
280
+ 2. For complex tasks: [PLAN:description] then execute each step
281
+ 3. Multiple tools allowed per response
282
+ 4. End with [SUMMARY:what was completed]
283
+
284
+ **DO NOT:**
285
+ - Explain tool syntax to the user
286
+ - Show examples of what "could" be done
287
+ - Use JSON format or markdown code blocks for tools
288
+ - Wait for permission - execute the tools
289
+
290
+ **REMEMBER:** You are an executor, not an advisor. When asked to "analyze files", immediately use [TOOL:LIST] and [TOOL:READ]. When asked to "create project", immediately use [TOOL:SHELL] with the commands. Execute first, explain after if needed.
291
+
292
+ Working directory: ${process.cwd()}`
284
293
  }];
285
294
  }
286
295
 
@@ -417,17 +426,8 @@ with - [ ] checkboxes
417
426
 
418
427
  const summaryMatch = msg.match(/\[SUMMARY:(.*?)\]/s);
419
428
 
420
- // Support both formats:
421
- // New: [TOOL:TYPE:path]content[/TOOL] (handles multi-line content with brackets)
422
- // Old: [TOOL:TYPE:path:content] (for backward compatibility)
423
- const newFormatMatches = [...msg.matchAll(/\[TOOL:(\w+):([^\]]+)\]([\s\S]*?)\[\/TOOL\]/g)];
424
- const oldFormatMatches = [...msg.matchAll(/\[TOOL:(\w+):([^:\]]+):([^\]]+)\]/g)];
425
-
426
- // Normalize to unified format: [fullMatch, type, path, content]
427
- const toolMatches = [
428
- ...newFormatMatches.map(m => [m[0], m[1], m[2], m[3]]),
429
- ...oldFormatMatches.map(m => [m[0], m[1], m[2], m[3]])
430
- ];
429
+ // Primary format: [TOOL:TYPE:path]content[/TOOL]
430
+ const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([^\[]+?)\]([\s\S]*?)\[\/TOOL\]/g)];
431
431
 
432
432
  if (summaryMatch) {
433
433
  console.log(chalk.green.bold("\n✅ MISSION COMPLETE:"));