stigmergy 1.1.0 → 1.1.2

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": "stigmergy",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/cli/router.js CHANGED
@@ -33,6 +33,7 @@ async function main() {
33
33
  // Create instances
34
34
  const memory = new MemoryManager();
35
35
  const installer = new StigmergyInstaller();
36
+ const router = new SmartRouter();
36
37
 
37
38
  // Handle help command early
38
39
  if (
@@ -263,11 +264,40 @@ async function main() {
263
264
  console.log(`[ROUTE] Analyzing prompt: ${prompt}`);
264
265
 
265
266
  // Route to appropriate AI CLI tool
266
- const route = await router.routePrompt(prompt);
267
+ const route = await router.smartRoute(prompt);
267
268
  console.log(`[ROUTE] Selected tool: ${route.tool}`);
268
269
 
269
270
  // Prepare tool arguments
270
- const toolArgs = router.prepareToolArguments(route, prompt);
271
+ let toolArgs = [];
272
+
273
+ try {
274
+ // Get CLI pattern for this tool
275
+ const cliPattern = await router.analyzer.getCLIPattern(route.tool);
276
+
277
+ // Use the unified CLI parameter handler
278
+ const CLIParameterHandler = require('../core/cli_parameter_handler');
279
+ toolArgs = CLIParameterHandler.generateArguments(
280
+ route.tool,
281
+ route.prompt,
282
+ cliPattern,
283
+ );
284
+ } catch (patternError) {
285
+ // Fallback to original logic if pattern analysis fails
286
+ if (route.tool === 'claude') {
287
+ // Claude CLI expects the prompt with -p flag for non-interactive mode
288
+ toolArgs = ['-p', `"${route.prompt}"`];
289
+ } else if (route.tool === 'qodercli' || route.tool === 'iflow') {
290
+ // Qoder CLI and iFlow expect the prompt with -p flag
291
+ toolArgs = ['-p', `"${route.prompt}"`];
292
+ } else if (route.tool === 'codex') {
293
+ // Codex CLI needs 'exec' subcommand for non-interactive mode
294
+ toolArgs = ['exec', '-p', `"${route.prompt}"`];
295
+ } else {
296
+ // For other tools, pass the prompt with -p flag
297
+ toolArgs = ['-p', `"${route.prompt}"`];
298
+ }
299
+ }
300
+
271
301
  const toolPath = route.tool;
272
302
 
273
303
  console.log(`[EXEC] Running: ${toolPath} ${toolArgs.join(' ')}`);
@@ -317,14 +347,9 @@ async function main() {
317
347
  process.exit(1);
318
348
  }
319
349
  } catch (error) {
320
- const cliError = await errorHandler.handleCLIError(
321
- route.tool,
322
- error,
323
- prompt,
324
- );
325
350
  console.log(
326
- `[ERROR] Failed to execute ${route.tool}:`,
327
- cliError.message,
351
+ `[ERROR] Failed to route prompt:`,
352
+ error.message,
328
353
  );
329
354
  process.exit(1);
330
355
  }
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const fs = require('fs/promises');
2
3
  const os = require('os');
3
4
  const { spawnSync } = require('child_process');
4
5
  const SmartRouter = require('./smart_router');