stigmergy 1.1.4 → 1.1.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/STIGMERGY.md
CHANGED
|
@@ -4,30 +4,50 @@ This project is configured for Stigmergy-based multi-AI CLI collaboration.
|
|
|
4
4
|
|
|
5
5
|
## Available AI CLI Tools
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Cross-CLI communication is enabled between all supported AI tools:
|
|
8
|
+
- Claude (Anthropic)
|
|
9
|
+
- Qwen (Alibaba)
|
|
10
|
+
- Gemini (Google)
|
|
11
|
+
- iFlow (Intelligent Workflow)
|
|
12
|
+
- Qoder CLI
|
|
13
|
+
- CodeBuddy
|
|
14
|
+
- GitHub Copilot
|
|
15
|
+
- OpenAI Codex
|
|
16
|
+
|
|
17
|
+
## Cross-CLI Collaboration
|
|
18
|
+
|
|
19
|
+
Instead of using a central command, cross-CLI communication happens directly between tools through hooks:
|
|
20
|
+
|
|
21
|
+
### How It Works
|
|
22
|
+
1. Each CLI tool has hooks deployed by Stigmergy
|
|
23
|
+
2. When one tool detects a request to use another tool, it triggers cross-CLI communication
|
|
24
|
+
3. The target tool executes the requested task and returns results
|
|
25
|
+
|
|
26
|
+
### Usage Pattern
|
|
27
|
+
From any supported CLI tool, use natural language patterns:
|
|
12
28
|
```bash
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
stigmergy call gemini "generate docs for this file"
|
|
18
|
-
|
|
19
|
-
# Use Qwen for translation
|
|
20
|
-
stigmergy call qwen "translate to English"
|
|
29
|
+
# Natural language patterns recognized by hooks
|
|
30
|
+
"use qwen to translate this code to Python"
|
|
31
|
+
"ask claude to review this algorithm"
|
|
32
|
+
"call gemini to explain this concept"
|
|
21
33
|
```
|
|
22
34
|
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
# Initialize with Claude as primary AI
|
|
26
|
-
stigmergy init --primary claude
|
|
35
|
+
## Project Memory and Documentation
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
This project automatically generates documentation for each CLI tool:
|
|
38
|
+
- claude.md
|
|
39
|
+
- qwen.md
|
|
40
|
+
- gemini.md
|
|
41
|
+
- iflow.md
|
|
42
|
+
- qodercli.md
|
|
43
|
+
- codebuddy.md
|
|
44
|
+
- copilot.md
|
|
45
|
+
- codex.md
|
|
46
|
+
|
|
47
|
+
Each documentation file contains:
|
|
48
|
+
- Tool configuration information
|
|
49
|
+
- Usage patterns
|
|
50
|
+
- Cross-CLI communication instructions
|
|
31
51
|
|
|
32
52
|
## Configuration
|
|
33
53
|
|
|
@@ -36,7 +56,7 @@ Global configuration: `~/.stigmergy/config.json`
|
|
|
36
56
|
## Getting Started
|
|
37
57
|
|
|
38
58
|
1. Run `stigmergy status` to verify setup
|
|
39
|
-
2.
|
|
40
|
-
3.
|
|
59
|
+
2. Check individual CLI documentation files for specific usage instructions
|
|
60
|
+
3. Use natural language requests within any CLI tool to trigger cross-CLI communication
|
|
41
61
|
|
|
42
|
-
For more information: https://github.com/ptreezh/stigmergy-CLI-Multi-Agents
|
|
62
|
+
For more information: https://github.com/ptreezh/stigmergy-CLI-Multi-Agents
|
package/package.json
CHANGED
package/src/cli/router.js
CHANGED
|
@@ -60,7 +60,7 @@ async function main() {
|
|
|
60
60
|
console.log(
|
|
61
61
|
' init Initialize Stigmergy configuration (alias for setup)',
|
|
62
62
|
);
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
console.log(' fibonacci <n> Calculate the nth Fibonacci number');
|
|
65
65
|
console.log(' fibonacci seq <n> Generate the first n Fibonacci numbers');
|
|
66
66
|
console.log(' errors Display error report and statistics');
|
|
@@ -71,7 +71,7 @@ async function main() {
|
|
|
71
71
|
' 2. stigmergy install # Auto-scan & install CLI tools',
|
|
72
72
|
);
|
|
73
73
|
console.log(' 3. stigmergy setup # Deploy hooks & config');
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
console.log('');
|
|
76
76
|
console.log(
|
|
77
77
|
'For more information, visit: https://github.com/ptreezh/stigmergy-CLI-Multi-Agents',
|
|
@@ -281,118 +281,7 @@ async function main() {
|
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
|
|
285
|
-
if (args.length < 2) {
|
|
286
|
-
console.log('[ERROR] Please provide a prompt');
|
|
287
|
-
console.log('Usage: stigmergy call "<your prompt>"');
|
|
288
|
-
process.exit(1);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Extract prompt from quotes or join remaining args
|
|
292
|
-
let prompt = '';
|
|
293
|
-
if (args[1].startsWith('"') && args[args.length - 1].endsWith('"')) {
|
|
294
|
-
// Quoted prompt
|
|
295
|
-
prompt = args.slice(1).join(' ').slice(1, -1);
|
|
296
|
-
} else {
|
|
297
|
-
// Unquoted prompt
|
|
298
|
-
prompt = args.slice(1).join(' ');
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
try {
|
|
302
|
-
console.log(`[ROUTE] Analyzing prompt: ${prompt}`);
|
|
303
|
-
|
|
304
|
-
// Route to appropriate AI CLI tool
|
|
305
|
-
const route = await router.smartRoute(prompt);
|
|
306
|
-
console.log(`[ROUTE] Selected tool: ${route.tool}`);
|
|
307
|
-
|
|
308
|
-
// Prepare tool arguments
|
|
309
|
-
let toolArgs = [];
|
|
310
|
-
|
|
311
|
-
try {
|
|
312
|
-
// Get CLI pattern for this tool
|
|
313
|
-
const cliPattern = await router.analyzer.getCLIPattern(route.tool);
|
|
314
|
-
|
|
315
|
-
// Use the unified CLI parameter handler
|
|
316
|
-
const CLIParameterHandler = require('../core/cli_parameter_handler');
|
|
317
|
-
toolArgs = CLIParameterHandler.generateArguments(
|
|
318
|
-
route.tool,
|
|
319
|
-
route.prompt,
|
|
320
|
-
cliPattern,
|
|
321
|
-
);
|
|
322
|
-
} catch (patternError) {
|
|
323
|
-
// Fallback to original logic if pattern analysis fails
|
|
324
|
-
if (route.tool === 'claude') {
|
|
325
|
-
// Claude CLI expects the prompt with -p flag for non-interactive mode
|
|
326
|
-
toolArgs = ['-p', `"${route.prompt}"`];
|
|
327
|
-
} else if (route.tool === 'qodercli' || route.tool === 'iflow') {
|
|
328
|
-
// Qoder CLI and iFlow expect the prompt with -p flag
|
|
329
|
-
toolArgs = ['-p', `"${route.prompt}"`];
|
|
330
|
-
} else if (route.tool === 'codex') {
|
|
331
|
-
// Codex CLI needs 'exec' subcommand for non-interactive mode
|
|
332
|
-
toolArgs = ['exec', '-p', `"${route.prompt}"`];
|
|
333
|
-
} else {
|
|
334
|
-
// For other tools, pass the prompt with -p flag
|
|
335
|
-
toolArgs = ['-p', `"${route.prompt}"`];
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
const toolPath = route.tool;
|
|
340
|
-
|
|
341
|
-
console.log(`[EXEC] Running: ${toolPath} ${toolArgs.join(' ')}`);
|
|
342
|
-
|
|
343
|
-
// Execute the AI CLI tool
|
|
344
|
-
const startTime = Date.now();
|
|
345
|
-
try {
|
|
346
|
-
const result = await executeCommand(toolPath, toolArgs);
|
|
347
|
-
|
|
348
|
-
if (result.success) {
|
|
349
|
-
console.log('[RESULT] Success!');
|
|
350
|
-
console.log(result.output);
|
|
351
|
-
|
|
352
|
-
// Save to memory
|
|
353
|
-
await memory.addInteraction(route.tool, prompt, result.output);
|
|
354
|
-
|
|
355
|
-
// Exit with the same code as the executed command
|
|
356
|
-
process.exit(result.code || 0);
|
|
357
|
-
}
|
|
358
|
-
} catch (executionError) {
|
|
359
|
-
const cliError = await errorHandler.handleCLIError(
|
|
360
|
-
route.tool,
|
|
361
|
-
executionError.error || executionError,
|
|
362
|
-
toolArgs.join(' '),
|
|
363
|
-
);
|
|
364
|
-
|
|
365
|
-
// Provide clear ANSI English error message
|
|
366
|
-
console.log('==================================================');
|
|
367
|
-
console.log('ERROR: Failed to execute AI CLI tool');
|
|
368
|
-
console.log('==================================================');
|
|
369
|
-
console.log(`Tool: ${route.tool}`);
|
|
370
|
-
console.log(`Error: ${cliError.message}`);
|
|
371
|
-
if (executionError.stderr) {
|
|
372
|
-
console.log(`Stderr: ${executionError.stderr}`);
|
|
373
|
-
}
|
|
374
|
-
console.log('');
|
|
375
|
-
console.log('Possible solutions:');
|
|
376
|
-
console.log('1. Check if the AI CLI tool is properly installed');
|
|
377
|
-
console.log('2. Verify the tool is in your system PATH');
|
|
378
|
-
console.log('3. Try reinstalling the tool with: stigmergy install');
|
|
379
|
-
console.log('4. Run stigmergy status to check tool availability');
|
|
380
|
-
console.log('');
|
|
381
|
-
console.log('For manual execution, you can run:');
|
|
382
|
-
console.log(`${toolPath} ${toolArgs.join(' ')}`);
|
|
383
|
-
console.log('==================================================');
|
|
384
|
-
|
|
385
|
-
process.exit(1);
|
|
386
|
-
}
|
|
387
|
-
} catch (error) {
|
|
388
|
-
console.log(
|
|
389
|
-
`[ERROR] Failed to route prompt:`,
|
|
390
|
-
error.message,
|
|
391
|
-
);
|
|
392
|
-
process.exit(1);
|
|
393
|
-
}
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
284
|
+
|
|
396
285
|
|
|
397
286
|
case 'auto-install':
|
|
398
287
|
// Auto-install mode for npm postinstall - NON-INTERACTIVE
|
|
@@ -14,16 +14,9 @@ class CLCommunication {
|
|
|
14
14
|
async executeTask(sourceCLI, targetCLI, task, context) {
|
|
15
15
|
console.log(`[CL_COMMUNICATION] Executing task from ${sourceCLI} to ${targetCLI}: ${task}`);
|
|
16
16
|
|
|
17
|
-
const targetAdapter = this.getAdapter(targetCLI);
|
|
18
|
-
if (!targetAdapter) {
|
|
19
|
-
throw new Error(`Adapter for ${targetCLI} not found`);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// For Node.js implementation, we simulate cross-CLI communication
|
|
23
|
-
// In a real implementation, this would interface with actual CLI tools
|
|
24
17
|
try {
|
|
25
|
-
//
|
|
26
|
-
const result = await this.
|
|
18
|
+
// Execute the target CLI with the task
|
|
19
|
+
const result = await this.executeCLICommand(targetCLI, task);
|
|
27
20
|
return result;
|
|
28
21
|
} catch (error) {
|
|
29
22
|
console.error(`[CL_COMMUNICATION] Failed to execute task for ${targetCLI}:`, error);
|
|
@@ -31,26 +24,98 @@ class CLCommunication {
|
|
|
31
24
|
}
|
|
32
25
|
}
|
|
33
26
|
|
|
27
|
+
async executeCLICommand(cliName, task) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
// Prepare arguments based on the CLI type for non-interactive execution
|
|
30
|
+
const args = this.prepareCLIArguments(cliName, task);
|
|
31
|
+
|
|
32
|
+
// Spawn the CLI command
|
|
33
|
+
const child = spawn(cliName, args, {
|
|
34
|
+
encoding: 'utf8',
|
|
35
|
+
timeout: this.executionTimeout,
|
|
36
|
+
shell: true
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
let stdout = '';
|
|
40
|
+
let stderr = '';
|
|
41
|
+
|
|
42
|
+
child.stdout.on('data', (data) => {
|
|
43
|
+
stdout += data.toString();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
child.stderr.on('data', (data) => {
|
|
47
|
+
stderr += data.toString();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
child.on('close', (code) => {
|
|
51
|
+
if (code === 0) {
|
|
52
|
+
resolve({
|
|
53
|
+
success: true,
|
|
54
|
+
output: stdout.trim(),
|
|
55
|
+
code: code
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
reject({
|
|
59
|
+
success: false,
|
|
60
|
+
error: stderr.trim() || stdout.trim() || `Process exited with code ${code}`,
|
|
61
|
+
code: code
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
child.on('error', (error) => {
|
|
67
|
+
reject({
|
|
68
|
+
success: false,
|
|
69
|
+
error: `Failed to spawn process: ${error.message}`,
|
|
70
|
+
code: null
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
child.on('timeout', () => {
|
|
75
|
+
child.kill();
|
|
76
|
+
reject({
|
|
77
|
+
success: false,
|
|
78
|
+
error: `Command timed out after ${this.executionTimeout}ms`,
|
|
79
|
+
code: null
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
prepareCLIArguments(cliName, task) {
|
|
86
|
+
// Prepare arguments based on the CLI type for non-interactive execution
|
|
87
|
+
const cliTypes = {
|
|
88
|
+
// CLIs that support -p flag for prompt
|
|
89
|
+
'claude': ['-p', task],
|
|
90
|
+
'qwen': ['-p', task],
|
|
91
|
+
'gemini': ['-p', task],
|
|
92
|
+
'iflow': ['-p', task],
|
|
93
|
+
// CLIs that support direct prompt as argument
|
|
94
|
+
'qodercli': [task],
|
|
95
|
+
'codebuddy': [task],
|
|
96
|
+
'copilot': [task],
|
|
97
|
+
'codex': [task]
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const args = cliTypes[cliName];
|
|
101
|
+
return args || ['-p', task]; // Default to -p flag if not specified
|
|
102
|
+
}
|
|
103
|
+
|
|
34
104
|
getAdapter(cliName) {
|
|
35
|
-
//
|
|
36
|
-
// For now, we return a mock adapter
|
|
105
|
+
// Return a real adapter that can execute CLI commands
|
|
37
106
|
return {
|
|
38
107
|
name: cliName,
|
|
39
108
|
executeTask: async (task, context) => {
|
|
40
|
-
|
|
109
|
+
try {
|
|
110
|
+
const result = await this.executeCLICommand(cliName, task);
|
|
111
|
+
return result.output;
|
|
112
|
+
} catch (error) {
|
|
113
|
+
return `[${cliName.toUpperCase()} ERROR] ${error.error || error.message}`;
|
|
114
|
+
}
|
|
41
115
|
}
|
|
42
116
|
};
|
|
43
117
|
}
|
|
44
118
|
|
|
45
|
-
async simulateCLIExecution(cliName, task, context) {
|
|
46
|
-
// Simulate CLI execution with a promise that resolves after a short delay
|
|
47
|
-
return new Promise((resolve, reject) => {
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
resolve(`[${cliName.toUpperCase()} NODE.JS EXECUTION] Completed task: ${task}`);
|
|
50
|
-
}, Math.random() * 1000); // Random delay between 0-1000ms
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
119
|
generateTaskId() {
|
|
55
120
|
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
56
121
|
}
|
|
@@ -122,20 +122,31 @@ class ${this.capitalize(cliName)}NodeJsHook {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
detectCrossCLIRequest(prompt) {
|
|
125
|
-
//
|
|
125
|
+
// Enhanced pattern matching for cross-CLI requests
|
|
126
126
|
const patterns = [
|
|
127
|
-
/(?:use|call|ask)
|
|
128
|
-
/(?:use|call|ask)
|
|
127
|
+
/(?:use|call|ask)\\\\s+(\\\\w+)\\\\s+(?:to|for)\\\\s+(.+)$/i,
|
|
128
|
+
/(?:please\\\\s+)?(?:use|call|ask)\\\\s+(\\\\w+)\\\\s+(.+)$/i,
|
|
129
|
+
/(\\\\w+)[,\\\\s]+(?:please\\\\s+)?(?:help\\\\s+me\\\\s+)?(.+)$/i
|
|
129
130
|
];
|
|
130
131
|
|
|
131
132
|
for (const pattern of patterns) {
|
|
132
133
|
const match = prompt.match(pattern);
|
|
133
|
-
if (match) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
if (match && match.length >= 3) {
|
|
135
|
+
const targetCLI = match[1].toLowerCase();
|
|
136
|
+
const task = match[2];
|
|
137
|
+
|
|
138
|
+
// Validate that the target CLI is supported
|
|
139
|
+
const supportedCLIs = [
|
|
140
|
+
'claude', 'gemini', 'qwen', 'iflow', 'qodercli', 'codebuddy', 'codex', 'copilot'
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
if (supportedCLIs.includes(targetCLI)) {
|
|
144
|
+
return {
|
|
145
|
+
targetCLI: targetCLI,
|
|
146
|
+
task: task,
|
|
147
|
+
source: this.cliName
|
|
148
|
+
};
|
|
149
|
+
}
|
|
139
150
|
}
|
|
140
151
|
}
|
|
141
152
|
|
|
@@ -145,14 +156,46 @@ class ${this.capitalize(cliName)}NodeJsHook {
|
|
|
145
156
|
async handleCrossCLIRequest(request, context) {
|
|
146
157
|
this.log('INFO', \`Cross-CLI request detected: \${JSON.stringify(request)}\`);
|
|
147
158
|
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
159
|
+
// Validate the request
|
|
160
|
+
if (!request.targetCLI || !request.task) {
|
|
161
|
+
this.log('ERROR', 'Invalid cross-CLI request: missing targetCLI or task');
|
|
162
|
+
return \`[CROSS-CLI] Invalid request: missing targetCLI or task\`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Check if the target CLI is the same as the source
|
|
166
|
+
if (request.targetCLI === this.cliName) {
|
|
167
|
+
this.log('WARN', 'Cross-CLI request to self ignored');
|
|
168
|
+
return \`[CROSS-CLI] Cannot call self (\${request.targetCLI})\`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Communicate with the coordination layer to execute the cross-CLI call
|
|
172
|
+
try {
|
|
173
|
+
// Dynamically load the CLCommunication module
|
|
174
|
+
const modulePath = path.join(__dirname, '..', '..', '..', '..', 'src', 'core', 'coordination', 'nodejs', 'CLCommunication');
|
|
175
|
+
const CLCommunication = require(modulePath);
|
|
176
|
+
const communicator = new CLCommunication();
|
|
177
|
+
|
|
178
|
+
const result = await communicator.executeTask(
|
|
179
|
+
request.source,
|
|
180
|
+
request.targetCLI,
|
|
181
|
+
request.task,
|
|
182
|
+
context
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
if (result.success) {
|
|
186
|
+
return \`[CROSS-CLI] Response from \${request.targetCLI}: \${result.output}\`;
|
|
187
|
+
} else {
|
|
188
|
+
return \`[CROSS-CLI] Error from \${request.targetCLI}: \${result.error}\`;
|
|
189
|
+
}
|
|
190
|
+
} catch (error) {
|
|
191
|
+
this.log('ERROR', \`Failed to handle cross-CLI request: \${error.message}\`);
|
|
192
|
+
return \`[CROSS-CLI] Failed to execute \${request.targetCLI}: \${error.message}\`;
|
|
193
|
+
}
|
|
151
194
|
}
|
|
152
195
|
|
|
153
196
|
log(level, message) {
|
|
154
197
|
const timestamp = new Date().toISOString();
|
|
155
|
-
const logEntry = \`[\${timestamp}] [\${level}] [\${this.cliName.toUpperCase()}] \${message}
|
|
198
|
+
const logEntry = \`[\${timestamp}] [\${level}] [\${this.cliName.toUpperCase()}] \${message}\\\\n\`;
|
|
156
199
|
|
|
157
200
|
try {
|
|
158
201
|
fs.appendFileSync(this.logFile, logEntry);
|
package/src/core/installer.js
CHANGED
|
@@ -189,13 +189,20 @@ class StigmergyInstaller {
|
|
|
189
189
|
console.log('\n[DEPLOY] Deploying project documentation...');
|
|
190
190
|
|
|
191
191
|
try {
|
|
192
|
-
// Create standard project documentation files
|
|
193
|
-
const
|
|
192
|
+
// Create standard project documentation files for each CLI
|
|
193
|
+
const cliDocs = {
|
|
194
|
+
'claude.md': this.generateCLIDocumentation('claude'),
|
|
195
|
+
'gemini.md': this.generateCLIDocumentation('gemini'),
|
|
196
|
+
'qwen.md': this.generateCLIDocumentation('qwen'),
|
|
197
|
+
'iflow.md': this.generateCLIDocumentation('iflow'),
|
|
198
|
+
'qodercli.md': this.generateCLIDocumentation('qodercli'),
|
|
199
|
+
'codebuddy.md': this.generateCLIDocumentation('codebuddy'),
|
|
200
|
+
'copilot.md': this.generateCLIDocumentation('copilot'),
|
|
201
|
+
'codex.md': this.generateCLIDocumentation('codex'),
|
|
194
202
|
'STIGMERGY.md': this.generateProjectMemoryTemplate(),
|
|
195
|
-
'README.md': this.generateProjectReadme(),
|
|
196
203
|
};
|
|
197
204
|
|
|
198
|
-
for (const [filename, content] of Object.entries(
|
|
205
|
+
for (const [filename, content] of Object.entries(cliDocs)) {
|
|
199
206
|
const filepath = path.join(process.cwd(), filename);
|
|
200
207
|
if (!(await this.fileExists(filepath))) {
|
|
201
208
|
await fs.writeFile(filepath, content);
|
|
@@ -211,26 +218,45 @@ class StigmergyInstaller {
|
|
|
211
218
|
}
|
|
212
219
|
}
|
|
213
220
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
221
|
+
generateCLIDocumentation(cliName) {
|
|
222
|
+
const cliInfo = this.router.tools[cliName] || { name: cliName };
|
|
223
|
+
return `# ${cliInfo.name} CLI Documentation
|
|
224
|
+
|
|
225
|
+
## Overview
|
|
226
|
+
This document contains configuration and usage information for the ${cliInfo.name} CLI tool within the Stigmergy system.
|
|
227
|
+
|
|
228
|
+
## Basic Information
|
|
229
|
+
- **CLI Name**: ${cliName}
|
|
230
|
+
- **Tool Name**: ${cliInfo.name}
|
|
231
|
+
- **Installation Command**: \`${cliInfo.install || 'Not configured'}\`
|
|
232
|
+
- **Version Check**: \`${cliInfo.version || cliName + ' --version'}\`
|
|
233
|
+
|
|
234
|
+
## Usage Patterns
|
|
235
|
+
The ${cliInfo.name} CLI can be invoked in several ways:
|
|
236
|
+
1. Direct execution: \`${cliName} [arguments]\`
|
|
237
|
+
2. Through Stigmergy coordination layer
|
|
238
|
+
3. Cross-CLI calls from other tools
|
|
239
|
+
|
|
240
|
+
## Cross-CLI Communication
|
|
241
|
+
To call ${cliInfo.name} from another CLI tool:
|
|
242
|
+
\`\`\`bash
|
|
243
|
+
# From any other supported CLI
|
|
244
|
+
use ${cliName} to [task description]
|
|
245
|
+
# or
|
|
246
|
+
call ${cliName} [task description]
|
|
247
|
+
# or
|
|
248
|
+
ask ${cliName} [task description]
|
|
249
|
+
\`\`\`
|
|
250
|
+
|
|
251
|
+
## Configuration
|
|
252
|
+
This tool integrates with Stigmergy through hooks deployed to:
|
|
253
|
+
\`${cliInfo.hooksDir || 'Not configured'}\`
|
|
254
|
+
|
|
255
|
+
## Last Updated
|
|
256
|
+
${new Date().toISOString()}
|
|
230
257
|
|
|
231
258
|
---
|
|
232
259
|
*This file is automatically managed by Stigmergy CLI*
|
|
233
|
-
*Last updated: ${new Date().toISOString()}*
|
|
234
260
|
`;
|
|
235
261
|
}
|
|
236
262
|
|
|
@@ -359,17 +385,87 @@ See [STIGMERGY.md](STIGMERGY.md) for interaction history and collaboration recor
|
|
|
359
385
|
console.log('='.repeat(60));
|
|
360
386
|
console.log('');
|
|
361
387
|
console.log('Next steps:');
|
|
362
|
-
console.log(' ✅
|
|
363
|
-
console.log(' ✅ Or use `stigmergy --help` for more commands');
|
|
364
|
-
console.log('');
|
|
365
|
-
console.log('Example usage:');
|
|
366
|
-
console.log(' stigmergy call "Create a React component for a todo list"');
|
|
367
|
-
console.log(' stigmergy call "Refactor this Python code for better performance"');
|
|
368
|
-
console.log(' stigmergy call "Explain how this JavaScript function works"');
|
|
388
|
+
console.log(' ✅ Use `stigmergy --help` for available commands');
|
|
369
389
|
console.log('');
|
|
370
390
|
console.log('Happy coding with Stigmergy! 🚀');
|
|
371
391
|
console.log('');
|
|
372
392
|
}
|
|
393
|
+
|
|
394
|
+
generateProjectMemoryTemplate() {
|
|
395
|
+
return `# Stigmergy Project Memory
|
|
396
|
+
|
|
397
|
+
## Project Information
|
|
398
|
+
- **Project Name**: ${path.basename(process.cwd())}
|
|
399
|
+
- **Created**: ${new Date().toISOString()}
|
|
400
|
+
- **Stigmergy Version**: 1.0.94
|
|
401
|
+
|
|
402
|
+
## Usage Instructions
|
|
403
|
+
This file automatically tracks all interactions with AI CLI tools through the Stigmergy system.
|
|
404
|
+
|
|
405
|
+
## Recent Interactions
|
|
406
|
+
No interactions recorded yet.
|
|
407
|
+
|
|
408
|
+
## Collaboration History
|
|
409
|
+
No collaboration history yet.
|
|
410
|
+
|
|
411
|
+
## Available CLI Tools
|
|
412
|
+
See individual documentation files:
|
|
413
|
+
- claude.md
|
|
414
|
+
- gemini.md
|
|
415
|
+
- qwen.md
|
|
416
|
+
- iflow.md
|
|
417
|
+
- qodercli.md
|
|
418
|
+
- codebuddy.md
|
|
419
|
+
- copilot.md
|
|
420
|
+
- codex.md
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
*This file is automatically managed by Stigmergy CLI*
|
|
424
|
+
*Last updated: ${new Date().toISOString()}*
|
|
425
|
+
`;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
generateCLIDocumentation(cliName) {
|
|
429
|
+
const cliInfo = this.router.tools[cliName] || { name: cliName };
|
|
430
|
+
return `# ${cliInfo.name} CLI Documentation
|
|
431
|
+
|
|
432
|
+
## Overview
|
|
433
|
+
This document contains configuration and usage information for the ${cliInfo.name} CLI tool within the Stigmergy system.
|
|
434
|
+
|
|
435
|
+
## Basic Information
|
|
436
|
+
- **CLI Name**: ${cliName}
|
|
437
|
+
- **Tool Name**: ${cliInfo.name}
|
|
438
|
+
- **Installation Command**: \`${cliInfo.install || 'Not configured'}\`
|
|
439
|
+
- **Version Check**: \`${cliInfo.version || cliName + ' --version'}\`
|
|
440
|
+
|
|
441
|
+
## Usage Patterns
|
|
442
|
+
The ${cliInfo.name} CLI can be invoked in several ways:
|
|
443
|
+
1. Direct execution: \`${cliName} [arguments]\`
|
|
444
|
+
2. Through Stigmergy coordination layer
|
|
445
|
+
3. Cross-CLI calls from other tools
|
|
446
|
+
|
|
447
|
+
## Cross-CLI Communication
|
|
448
|
+
To call ${cliInfo.name} from another CLI tool:
|
|
449
|
+
\`\`\`bash
|
|
450
|
+
# From any other supported CLI
|
|
451
|
+
use ${cliName} to [task description]
|
|
452
|
+
# or
|
|
453
|
+
call ${cliName} [task description]
|
|
454
|
+
# or
|
|
455
|
+
ask ${cliName} [task description]
|
|
456
|
+
\`\`\`
|
|
457
|
+
|
|
458
|
+
## Configuration
|
|
459
|
+
This tool integrates with Stigmergy through hooks deployed to:
|
|
460
|
+
\`${cliInfo.hooksDir || 'Not configured'}\`
|
|
461
|
+
|
|
462
|
+
## Last Updated
|
|
463
|
+
${new Date().toISOString()}
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
*This file is automatically managed by Stigmergy CLI*
|
|
467
|
+
`;
|
|
468
|
+
}
|
|
373
469
|
}
|
|
374
470
|
|
|
375
471
|
module.exports = StigmergyInstaller;
|