stigmergy 1.2.13 → 1.3.1
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/README.md +39 -3
- package/STIGMERGY.md +3 -0
- package/config/builtin-skills.json +43 -0
- package/config/enhanced-cli-config.json +438 -0
- package/docs/CLI_TOOLS_AGENT_SKILL_ANALYSIS.md +463 -0
- package/docs/DESIGN_CLI_HELP_ANALYZER_REFACTOR.md +726 -0
- package/docs/ENHANCED_CLI_AGENT_SKILL_CONFIG.md +285 -0
- package/docs/IMPLEMENTATION_CHECKLIST_CLI_HELP_ANALYZER_REFACTOR.md +1268 -0
- package/docs/INSTALLER_ARCHITECTURE.md +257 -0
- package/docs/LESSONS_LEARNED.md +252 -0
- package/docs/SPECS_CLI_HELP_ANALYZER_REFACTOR.md +287 -0
- package/docs/SUDO_PROBLEM_AND_SOLUTION.md +529 -0
- package/docs/correct-skillsio-implementation.md +368 -0
- package/docs/development_guidelines.md +276 -0
- package/docs/independent-resume-implementation.md +198 -0
- package/docs/resumesession-final-implementation.md +195 -0
- package/docs/resumesession-usage.md +87 -0
- package/package.json +146 -136
- package/scripts/analyze-router.js +168 -0
- package/scripts/run-comprehensive-tests.js +230 -0
- package/scripts/run-quick-tests.js +90 -0
- package/scripts/test-runner.js +344 -0
- package/skills/resumesession/INDEPENDENT_SKILL.md +403 -0
- package/skills/resumesession/README.md +381 -0
- package/skills/resumesession/SKILL.md +211 -0
- package/skills/resumesession/__init__.py +33 -0
- package/skills/resumesession/implementations/simple-resume.js +13 -0
- package/skills/resumesession/independent-resume.js +750 -0
- package/skills/resumesession/package.json +1 -0
- package/skills/resumesession/skill.json +1 -0
- package/src/adapters/claude/install_claude_integration.js +9 -1
- package/src/adapters/codebuddy/install_codebuddy_integration.js +3 -1
- package/src/adapters/codex/install_codex_integration.js +15 -5
- package/src/adapters/gemini/install_gemini_integration.js +3 -1
- package/src/adapters/qwen/install_qwen_integration.js +3 -1
- package/src/cli/commands/autoinstall.js +65 -0
- package/src/cli/commands/errors.js +190 -0
- package/src/cli/commands/independent-resume.js +395 -0
- package/src/cli/commands/install.js +179 -0
- package/src/cli/commands/permissions.js +108 -0
- package/src/cli/commands/project.js +485 -0
- package/src/cli/commands/scan.js +97 -0
- package/src/cli/commands/simple-resume.js +377 -0
- package/src/cli/commands/skills.js +158 -0
- package/src/cli/commands/status.js +113 -0
- package/src/cli/commands/stigmergy-resume.js +775 -0
- package/src/cli/commands/system.js +301 -0
- package/src/cli/commands/universal-resume.js +394 -0
- package/src/cli/router-beta.js +471 -0
- package/src/cli/utils/environment.js +75 -0
- package/src/cli/utils/formatters.js +47 -0
- package/src/cli/utils/skills_cache.js +92 -0
- package/src/core/cache_cleaner.js +1 -0
- package/src/core/cli_adapters.js +345 -0
- package/src/core/cli_help_analyzer.js +1236 -680
- package/src/core/cli_path_detector.js +702 -709
- package/src/core/cli_tools.js +515 -160
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +18 -0
- package/src/core/coordination/nodejs/HookDeploymentManager.js +242 -412
- package/src/core/coordination/nodejs/HookDeploymentManager.refactored.js +323 -0
- package/src/core/coordination/nodejs/generators/CLIAdapterGenerator.js +363 -0
- package/src/core/coordination/nodejs/generators/ResumeSessionGenerator.js +932 -0
- package/src/core/coordination/nodejs/generators/SkillsIntegrationGenerator.js +1395 -0
- package/src/core/coordination/nodejs/generators/index.js +12 -0
- package/src/core/enhanced_cli_installer.js +1208 -608
- package/src/core/enhanced_cli_parameter_handler.js +402 -0
- package/src/core/execution_mode_detector.js +222 -0
- package/src/core/installer.js +151 -106
- package/src/core/local_skill_scanner.js +732 -0
- package/src/core/multilingual/language-pattern-manager.js +1 -1
- package/src/core/skills/BuiltinSkillsDeployer.js +188 -0
- package/src/core/skills/StigmergySkillManager.js +123 -16
- package/src/core/skills/embedded-openskills/SkillParser.js +7 -3
- package/src/core/smart_router.js +550 -261
- package/src/index.js +10 -4
- package/src/utils.js +66 -7
- package/test/cli-integration.test.js +304 -0
- package/test/direct_smart_router_test.js +88 -0
- package/test/enhanced-cli-agent-skill-test.js +485 -0
- package/test/simple_test.js +82 -0
- package/test/smart_router_test_runner.js +123 -0
- package/test/smart_routing_edge_cases.test.js +284 -0
- package/test/smart_routing_simple_verification.js +139 -0
- package/test/smart_routing_verification.test.js +346 -0
- package/test/specific-cli-agent-skill-analysis.js +385 -0
- package/test/unit/smart_router.test.js +295 -0
- package/test/very_simple_test.js +54 -0
- package/src/cli/router.js +0 -1783
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Tools Adapters
|
|
3
|
+
* Provides tool-specific parameter mapping for interactive and one-time modes
|
|
4
|
+
*
|
|
5
|
+
* Each CLI tool has different parameter conventions:
|
|
6
|
+
* - claude: Uses -p for one-time, default is interactive
|
|
7
|
+
* - qwen: Uses -p for one-time, -i for prompt-interactive
|
|
8
|
+
* - codex: Uses 'exec' subcommand for one-time, default is interactive
|
|
9
|
+
*
|
|
10
|
+
* This adapter normalizes these differences.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* CLI Adapters Configuration
|
|
15
|
+
* Maps each tool's parameters for different execution modes
|
|
16
|
+
*/
|
|
17
|
+
const CLI_ADAPTERS = {
|
|
18
|
+
/**
|
|
19
|
+
* Claude CLI Adapter
|
|
20
|
+
*
|
|
21
|
+
* Documentation:
|
|
22
|
+
* - Default: Interactive mode
|
|
23
|
+
* - -p, --print: Non-interactive (print and exit)
|
|
24
|
+
*
|
|
25
|
+
* Examples:
|
|
26
|
+
* - Interactive: claude "prompt" or just claude
|
|
27
|
+
* - One-time: claude -p "prompt"
|
|
28
|
+
*/
|
|
29
|
+
claude: {
|
|
30
|
+
// Execute prompt and keep CLI running for continuous conversation
|
|
31
|
+
interactive: (prompt) => {
|
|
32
|
+
// Claude defaults to interactive mode
|
|
33
|
+
// If prompt provided, pass it as positional argument
|
|
34
|
+
return prompt ? [prompt] : [];
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
// Execute prompt and exit (return control to caller)
|
|
38
|
+
oneTime: (prompt) => {
|
|
39
|
+
// Use -p flag for non-interactive output
|
|
40
|
+
return ['-p', prompt];
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// Check if tool supports this mode
|
|
44
|
+
supportsInteractive: true,
|
|
45
|
+
supportsOneTime: true,
|
|
46
|
+
defaultMode: 'interactive'
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Gemini CLI Adapter
|
|
51
|
+
*
|
|
52
|
+
* Note: Full behavior to be verified (may vary by version)
|
|
53
|
+
*/
|
|
54
|
+
gemini: {
|
|
55
|
+
interactive: (prompt) => {
|
|
56
|
+
// Assuming similar to claude (to be verified)
|
|
57
|
+
return prompt ? [prompt] : [];
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
oneTime: (prompt) => {
|
|
61
|
+
// Assuming -p for print mode (to be verified)
|
|
62
|
+
return ['-p', prompt];
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
supportsInteractive: true,
|
|
66
|
+
supportsOneTime: true,
|
|
67
|
+
defaultMode: 'interactive',
|
|
68
|
+
verified: false // Needs testing
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Qwen CLI Adapter
|
|
73
|
+
*
|
|
74
|
+
* Documentation:
|
|
75
|
+
* - Default: Interactive CLI
|
|
76
|
+
* - -p, --prompt: One-shot (deprecated)
|
|
77
|
+
* - -i, --prompt-interactive: Execute prompt then stay interactive
|
|
78
|
+
*
|
|
79
|
+
* Examples:
|
|
80
|
+
* - Interactive: qwen -i "prompt" or just qwen
|
|
81
|
+
* - One-time: qwen -p "prompt" (deprecated) or qwen "prompt" (positional, one-shot)
|
|
82
|
+
*/
|
|
83
|
+
qwen: {
|
|
84
|
+
interactive: (prompt) => {
|
|
85
|
+
// Use -i flag for "prompt-interactive" mode
|
|
86
|
+
// This executes the prompt and then keeps the CLI running
|
|
87
|
+
return prompt ? ['-i', prompt] : [];
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
oneTime: (prompt) => {
|
|
91
|
+
// Use -p for one-shot mode (though deprecated, still works)
|
|
92
|
+
// Or could use positional prompt (which defaults to one-shot)
|
|
93
|
+
return ['-p', prompt];
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
supportsInteractive: true,
|
|
97
|
+
supportsOneTime: true,
|
|
98
|
+
defaultMode: 'interactive',
|
|
99
|
+
verified: true
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Codebuddy CLI Adapter
|
|
104
|
+
*
|
|
105
|
+
* Note: Behavior to be verified
|
|
106
|
+
*/
|
|
107
|
+
codebuddy: {
|
|
108
|
+
interactive: (prompt) => {
|
|
109
|
+
return prompt ? [prompt] : [];
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
oneTime: (prompt) => {
|
|
113
|
+
// Assuming -p for print mode (to be verified)
|
|
114
|
+
return ['-p', prompt];
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
supportsInteractive: true,
|
|
118
|
+
supportsOneTime: true,
|
|
119
|
+
defaultMode: 'interactive',
|
|
120
|
+
verified: false
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Codex CLI Adapter
|
|
125
|
+
*
|
|
126
|
+
* Documentation:
|
|
127
|
+
* - Default: Interactive CLI
|
|
128
|
+
* - 'exec' subcommand: Non-interactive execution
|
|
129
|
+
*
|
|
130
|
+
* Examples:
|
|
131
|
+
* - Interactive: codex "prompt" or just codex
|
|
132
|
+
* - One-time: codex exec "prompt"
|
|
133
|
+
*/
|
|
134
|
+
codex: {
|
|
135
|
+
interactive: (prompt) => {
|
|
136
|
+
// Codex defaults to interactive mode
|
|
137
|
+
// If prompt provided, pass it as positional argument
|
|
138
|
+
return prompt ? [prompt] : [];
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
oneTime: (prompt) => {
|
|
142
|
+
// Use 'exec' subcommand for non-interactive execution
|
|
143
|
+
return ['exec', prompt];
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
supportsInteractive: true,
|
|
147
|
+
supportsOneTime: true,
|
|
148
|
+
defaultMode: 'interactive',
|
|
149
|
+
verified: true
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* iFlow CLI Adapter
|
|
154
|
+
*
|
|
155
|
+
* Note: Behavior to be verified
|
|
156
|
+
*/
|
|
157
|
+
iflow: {
|
|
158
|
+
interactive: (prompt) => {
|
|
159
|
+
return prompt ? [prompt] : [];
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
oneTime: (prompt) => {
|
|
163
|
+
return ['-p', prompt];
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
supportsInteractive: true,
|
|
167
|
+
supportsOneTime: true,
|
|
168
|
+
defaultMode: 'interactive',
|
|
169
|
+
verified: false
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* QoderCLI Adapter
|
|
174
|
+
*
|
|
175
|
+
* Note: Behavior to be verified
|
|
176
|
+
*/
|
|
177
|
+
qodercli: {
|
|
178
|
+
interactive: (prompt) => {
|
|
179
|
+
return prompt ? [prompt] : [];
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
oneTime: (prompt) => {
|
|
183
|
+
return ['-p', prompt];
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
supportsInteractive: true,
|
|
187
|
+
supportsOneTime: true,
|
|
188
|
+
defaultMode: 'interactive',
|
|
189
|
+
verified: false
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Copilot CLI Adapter
|
|
194
|
+
*
|
|
195
|
+
* Note: Behavior to be verified
|
|
196
|
+
*/
|
|
197
|
+
copilot: {
|
|
198
|
+
interactive: (prompt) => {
|
|
199
|
+
return prompt ? [prompt] : [];
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
oneTime: (prompt) => {
|
|
203
|
+
return ['-p', prompt];
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
supportsInteractive: true,
|
|
207
|
+
supportsOneTime: true,
|
|
208
|
+
defaultMode: 'interactive',
|
|
209
|
+
verified: false
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Kode CLI Adapter
|
|
214
|
+
*
|
|
215
|
+
* Note: Behavior to be verified
|
|
216
|
+
*/
|
|
217
|
+
kode: {
|
|
218
|
+
interactive: (prompt) => {
|
|
219
|
+
return prompt ? [prompt] : [];
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
oneTime: (prompt) => {
|
|
223
|
+
return ['-p', prompt];
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
supportsInteractive: true,
|
|
227
|
+
supportsOneTime: true,
|
|
228
|
+
defaultMode: 'interactive',
|
|
229
|
+
verified: false
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* CLI Adapter Class
|
|
235
|
+
* Provides methods to get appropriate arguments for each tool and mode
|
|
236
|
+
*/
|
|
237
|
+
class CLIAdapterManager {
|
|
238
|
+
constructor() {
|
|
239
|
+
this.adapters = CLI_ADAPTERS;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Get arguments for a specific tool and execution mode
|
|
244
|
+
* @param {string} toolName - Name of the CLI tool
|
|
245
|
+
* @param {string} mode - 'interactive' or 'one-time'
|
|
246
|
+
* @param {string} prompt - User prompt to pass
|
|
247
|
+
* @returns {Array<string>} Array of arguments to pass to the CLI tool
|
|
248
|
+
*/
|
|
249
|
+
getArguments(toolName, mode, prompt) {
|
|
250
|
+
const adapter = this.adapters[toolName];
|
|
251
|
+
|
|
252
|
+
if (!adapter) {
|
|
253
|
+
throw new Error(`Unknown CLI tool: ${toolName}`);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Normalize mode name: 'one-time' -> 'oneTime', 'interactive' -> 'interactive'
|
|
257
|
+
const normalizedMode = mode === 'one-time' ? 'oneTime' : mode;
|
|
258
|
+
|
|
259
|
+
const modeFunction = adapter[normalizedMode];
|
|
260
|
+
|
|
261
|
+
if (typeof modeFunction !== 'function') {
|
|
262
|
+
throw new Error(`Tool ${toolName} does not support ${mode} mode`);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return modeFunction(prompt);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Check if a tool supports a specific mode
|
|
270
|
+
* @param {string} toolName - Name of the CLI tool
|
|
271
|
+
* @param {string} mode - 'interactive' or 'one-time'
|
|
272
|
+
* @returns {boolean} True if supported
|
|
273
|
+
*/
|
|
274
|
+
supportsMode(toolName, mode) {
|
|
275
|
+
const adapter = this.adapters[toolName];
|
|
276
|
+
return adapter && adapter.supports && adapter.supports.includes(mode);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Get the default mode for a tool
|
|
281
|
+
* @param {string} toolName - Name of the CLI tool
|
|
282
|
+
* @returns {string} 'interactive' or 'one-time'
|
|
283
|
+
*/
|
|
284
|
+
getDefaultMode(toolName) {
|
|
285
|
+
const adapter = this.adapters[toolName];
|
|
286
|
+
return adapter ? adapter.defaultMode : 'one-time';
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Check if tool configuration has been verified
|
|
291
|
+
* @param {string} toolName - Name of the CLI tool
|
|
292
|
+
* @returns {boolean} True if configuration is verified
|
|
293
|
+
*/
|
|
294
|
+
isVerified(toolName) {
|
|
295
|
+
const adapter = this.adapters[toolName];
|
|
296
|
+
return adapter ? adapter.verified === true : false;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Get list of all supported tools
|
|
301
|
+
* @returns {Array<string>} Array of tool names
|
|
302
|
+
*/
|
|
303
|
+
getSupportedTools() {
|
|
304
|
+
return Object.keys(this.adapters);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Get adapter information for a tool
|
|
309
|
+
* @param {string} toolName - Name of the CLI tool
|
|
310
|
+
* @returns {Object} Adapter configuration
|
|
311
|
+
*/
|
|
312
|
+
getAdapterInfo(toolName) {
|
|
313
|
+
return this.adapters[toolName] || null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Print adapter configuration (for debugging)
|
|
318
|
+
* @param {string} toolName - Name of the CLI tool
|
|
319
|
+
* @param {boolean} verbose - Show detailed information
|
|
320
|
+
*/
|
|
321
|
+
printAdapterInfo(toolName, verbose = false) {
|
|
322
|
+
const adapter = this.adapters[toolName];
|
|
323
|
+
|
|
324
|
+
if (!adapter) {
|
|
325
|
+
console.log(`[ADAPTER] No adapter found for: ${toolName}`);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
console.log(`[ADAPTER] ${toolName} Configuration:`);
|
|
330
|
+
console.log(` - Supports Interactive: ${adapter.supportsInteractive ? '✅' : '❌'}`);
|
|
331
|
+
console.log(` - Supports One-Time: ${adapter.supportsOneTime ? '✅' : '❌'}`);
|
|
332
|
+
console.log(` - Default Mode: ${adapter.defaultMode}`);
|
|
333
|
+
console.log(` - Verified: ${adapter.verified ? '✅' : '⚠️ (needs testing)'}`);
|
|
334
|
+
|
|
335
|
+
if (verbose && adapter.supportsInteractive && adapter.supportsOneTime) {
|
|
336
|
+
console.log(` - Interactive Example: ${toolName} ${this.getArguments(toolName, 'interactive', 'your prompt').join(' ')}`);
|
|
337
|
+
console.log(` - One-Time Example: ${toolName} ${this.getArguments(toolName, 'one-time', 'your prompt').join(' ')}`);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
module.exports = {
|
|
343
|
+
CLI_ADAPTERS,
|
|
344
|
+
CLIAdapterManager
|
|
345
|
+
};
|