sapper-iq 1.0.4 → 1.0.5

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.5",
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
@@ -234,25 +234,27 @@ 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
+ - ALWAYS use this format: [TOOL:TYPE:path]content[/TOOL]
239
238
  - Types: SHELL, READ, WRITE, MKDIR, LIST, SEARCH
240
239
 
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]
240
+ **Examples for ALL cases (short or long content):**
241
+ [TOOL:SHELL]npm install[/TOOL]
242
+ [TOOL:READ]./package.json[/TOOL]
243
+ [TOOL:WRITE]./app.js]console.log('hello')[/TOOL]
244
+ [TOOL:MKDIR]./src/components[/TOOL]
245
+ [TOOL:LIST]./src[/TOOL]
246
+ [TOOL:SEARCH]function myFunction[/TOOL]
248
247
 
249
- **For multi-line content (like markdown files):**
250
- [TOOL:WRITE:./file.md]
248
+ **For files with brackets, arrays, or multi-line content:**
249
+ [TOOL:WRITE]./file.md]
251
250
  Multi-line
252
251
  content here
253
252
  with - [ ] checkboxes
253
+ and [arrays]
254
254
  [/TOOL]
255
255
 
256
+ **IMPORTANT:** ALWAYS put path after colon, then close bracket, then content, then [/TOOL]
257
+
256
258
  **Shell Command Rules:**
257
259
  - For operations in a specific directory, chain with cd: cd /path/to/project && npm install
258
260
  - Use && to chain commands that depend on each other
@@ -417,17 +419,8 @@ with - [ ] checkboxes
417
419
 
418
420
  const summaryMatch = msg.match(/\[SUMMARY:(.*?)\]/s);
419
421
 
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
- ];
422
+ // Primary format: [TOOL:TYPE:path]content[/TOOL]
423
+ const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([^\[]+?)\]([\s\S]*?)\[\/TOOL\]/g)];
431
424
 
432
425
  if (summaryMatch) {
433
426
  console.log(chalk.green.bold("\n✅ MISSION COMPLETE:"));