stigmergy 1.0.82 → 1.0.85
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/docs/NATIVE_INTEGRATION_GUIDE.md +1191 -0
- package/docs/PROJECT_CONSTITUTION.md +434 -0
- package/docs/PROJECT_REQUIREMENTS.md +329 -0
- package/docs/PROJECT_STRUCTURE.md +304 -0
- package/docs/PROJECT_STRUCTURE_CURRENT.md +81 -0
- package/docs/UNIFIED_TECHNICAL_ARCHITECTURE.md +967 -0
- package/examples/cline_usage_examples.md +365 -0
- package/package.json +4 -2
- package/src/main_english.js +80 -50
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# Cline CLI Usage Examples
|
|
2
|
+
|
|
3
|
+
This document provides comprehensive usage examples for the Cline CLI integration with the Stigmergy system.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start Examples
|
|
6
|
+
|
|
7
|
+
### 1. Basic Task Execution
|
|
8
|
+
```bash
|
|
9
|
+
# Simple task execution
|
|
10
|
+
cline task "Analyze the project structure and identify main components"
|
|
11
|
+
|
|
12
|
+
# Task with specific context
|
|
13
|
+
cline task "Review the authentication module for security issues" --context "Django web application"
|
|
14
|
+
|
|
15
|
+
# Multi-step task
|
|
16
|
+
cline task "First run the tests, then build the project, and finally deploy to staging"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 2. MCP Tool Usage
|
|
20
|
+
```bash
|
|
21
|
+
# List available MCP tools
|
|
22
|
+
cline mcp list-tools
|
|
23
|
+
|
|
24
|
+
# Search for Python files
|
|
25
|
+
cline mcp call-tool search_files --args '{"pattern": "*.py", "directory": "src"}'
|
|
26
|
+
|
|
27
|
+
# Read a specific file
|
|
28
|
+
cline mcp call-tool read_project_file --args '{"path": "README.md", "max_lines": 50}'
|
|
29
|
+
|
|
30
|
+
# Get project structure
|
|
31
|
+
cline mcp call-tool get_project_structure --args '{"max_depth": 3}'
|
|
32
|
+
|
|
33
|
+
# Analyze codebase dependencies
|
|
34
|
+
cline mcp call-tool analyze_codebase --args '{"analysis_type": "dependencies"}'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 3. Cross-CLI Collaboration
|
|
38
|
+
```bash
|
|
39
|
+
# From Claude CLI
|
|
40
|
+
claude "请用cline帮我执行构建任务"
|
|
41
|
+
claude "use cline to run the test suite"
|
|
42
|
+
|
|
43
|
+
# From Gemini CLI
|
|
44
|
+
gemini "调用cline来管理这个工作流"
|
|
45
|
+
gemini "call cline to orchestrate the deployment process"
|
|
46
|
+
|
|
47
|
+
# From other CLI tools
|
|
48
|
+
codebuddy "让cline帮我创建一个新的工具"
|
|
49
|
+
codebuddy "ask cline to create a custom tool for code analysis"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 📋 Advanced Workflow Examples
|
|
53
|
+
|
|
54
|
+
### Example 1: Code Review Workflow
|
|
55
|
+
```bash
|
|
56
|
+
# Step 1: Use Claude for initial code review
|
|
57
|
+
claude "Review the authentication module for security vulnerabilities"
|
|
58
|
+
|
|
59
|
+
# Step 2: Use Cline to execute security tests
|
|
60
|
+
cline task "Run security tests on the authentication module"
|
|
61
|
+
|
|
62
|
+
# Step 3: Use Cline to generate security report
|
|
63
|
+
cline mcp call-tool analyze_codebase --args '{"analysis_type": "security"}'
|
|
64
|
+
|
|
65
|
+
# Step 4: Use Gemini to translate findings
|
|
66
|
+
gemini "Translate this security report to Chinese for the team"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Example 2: Multi-Language Development
|
|
70
|
+
```bash
|
|
71
|
+
# Step 1: Use QwenCode for Chinese code generation
|
|
72
|
+
qwencode "生成用户管理模块的Python代码"
|
|
73
|
+
|
|
74
|
+
# Step 2: Use Cline to organize the generated code
|
|
75
|
+
cline task "Organize the generated user management code into proper structure"
|
|
76
|
+
|
|
77
|
+
# Step 3: Use Cline to create tests
|
|
78
|
+
cline task "Create comprehensive unit tests for the user management module"
|
|
79
|
+
|
|
80
|
+
# Step 4: Use Claude for code review
|
|
81
|
+
claude "Review the user management module for best practices"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Example 3: Documentation Generation
|
|
85
|
+
```bash
|
|
86
|
+
# Step 1: Use Cline to analyze project structure
|
|
87
|
+
cline mcp call-tool get_project_structure --args '{"max_depth": 4}'
|
|
88
|
+
|
|
89
|
+
# Step 2: Use Cline to read key files
|
|
90
|
+
cline mcp call-tool read_project_file --args '{"path": "src/main.py"}'
|
|
91
|
+
|
|
92
|
+
# Step 3: Use Claude to generate documentation
|
|
93
|
+
claude "Generate comprehensive documentation for this project based on the structure"
|
|
94
|
+
|
|
95
|
+
# Step 4: Use Gemini to translate documentation
|
|
96
|
+
gemini "Translate the project documentation to multiple languages"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Example 4: Testing and Quality Assurance
|
|
100
|
+
```bash
|
|
101
|
+
# Step 1: Use Cline to search for test files
|
|
102
|
+
cline mcp call-tool search_files --args '{"pattern": "*test*.py"}'
|
|
103
|
+
|
|
104
|
+
# Step 2: Use Cline to analyze test coverage
|
|
105
|
+
cline task "Analyze test coverage and identify gaps"
|
|
106
|
+
|
|
107
|
+
# Step 3: Use Cline to run tests with coverage
|
|
108
|
+
cline task "Run all tests with coverage reporting"
|
|
109
|
+
|
|
110
|
+
# Step 4: Use CodeBuddy for learning recommendations
|
|
111
|
+
codebuddy "Based on the test results, what should I learn about testing best practices?"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 🔧 Custom MCP Tool Creation
|
|
115
|
+
|
|
116
|
+
### Example 1: Create a TODO Analyzer
|
|
117
|
+
```bash
|
|
118
|
+
# Create a tool that analyzes TODO comments in code
|
|
119
|
+
cline mcp create-tool --name "todo_analyzer" \
|
|
120
|
+
--description "Analyze code for TODO comments and generate reports" \
|
|
121
|
+
--function-code '
|
|
122
|
+
def analyze_todos(file_path):
|
|
123
|
+
"""Analyze Python file for TODO comments"""
|
|
124
|
+
todos = []
|
|
125
|
+
with open(file_path, "r", encoding="utf-8") as f:
|
|
126
|
+
for line_num, line in enumerate(f, 1):
|
|
127
|
+
if "TODO" in line.upper() or "FIXME" in line.upper():
|
|
128
|
+
todos.append({
|
|
129
|
+
"line": line_num,
|
|
130
|
+
"content": line.strip(),
|
|
131
|
+
"type": "TODO" if "TODO" in line.upper() else "FIXME"
|
|
132
|
+
})
|
|
133
|
+
return {"file": file_path, "todos": todos, "count": len(todos)}
|
|
134
|
+
'
|
|
135
|
+
|
|
136
|
+
# Use the custom tool
|
|
137
|
+
cline mcp call-tool todo_analyzer --args '{"file_path": "src/main.py"}'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Example 2: Create a Dependency Analyzer
|
|
141
|
+
```bash
|
|
142
|
+
# Create a tool that analyzes project dependencies
|
|
143
|
+
cline mcp create-tool --name "dependency_analyzer" \
|
|
144
|
+
--description "Analyze project dependencies and suggest updates" \
|
|
145
|
+
--function-code '
|
|
146
|
+
def analyze_dependencies(project_path):
|
|
147
|
+
"""Analyze project dependencies"""
|
|
148
|
+
import json
|
|
149
|
+
from pathlib import Path
|
|
150
|
+
|
|
151
|
+
results = {}
|
|
152
|
+
|
|
153
|
+
# Check package.json
|
|
154
|
+
package_json = Path(project_path) / "package.json"
|
|
155
|
+
if package_json.exists():
|
|
156
|
+
with open(package_json) as f:
|
|
157
|
+
data = json.load(f)
|
|
158
|
+
results["npm"] = {
|
|
159
|
+
"dependencies": list(data.get("dependencies", {}).keys()),
|
|
160
|
+
"devDependencies": list(data.get("devDependencies", {}).keys())
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
# Check requirements.txt
|
|
164
|
+
requirements = Path(project_path) / "requirements.txt"
|
|
165
|
+
if requirements.exists():
|
|
166
|
+
with open(requirements) as f:
|
|
167
|
+
results["python"] = [line.strip() for line in f if line.strip() and not line.startswith("#")]
|
|
168
|
+
|
|
169
|
+
return results
|
|
170
|
+
'
|
|
171
|
+
|
|
172
|
+
# Use the custom tool
|
|
173
|
+
cline mcp call-tool dependency_analyzer --args '{"project_path": "."}'
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 🌐 Web Integration Examples
|
|
177
|
+
|
|
178
|
+
### Example 1: Browser Automation
|
|
179
|
+
```bash
|
|
180
|
+
# Use Cline for browser automation
|
|
181
|
+
cline task "Open the application in browser and test the login functionality"
|
|
182
|
+
|
|
183
|
+
# Take screenshots for documentation
|
|
184
|
+
cline task "Take screenshots of all main pages for documentation"
|
|
185
|
+
|
|
186
|
+
# Test responsive design
|
|
187
|
+
cline task "Test the application on different screen sizes and devices"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Example 2: API Testing
|
|
191
|
+
```bash
|
|
192
|
+
# Test API endpoints
|
|
193
|
+
cline task "Test all API endpoints and verify responses"
|
|
194
|
+
|
|
195
|
+
# Generate API documentation
|
|
196
|
+
cline task "Generate comprehensive API documentation from the code"
|
|
197
|
+
|
|
198
|
+
# Create API client examples
|
|
199
|
+
cline task "Create example API client code in multiple languages"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## 📊 Data Analysis Examples
|
|
203
|
+
|
|
204
|
+
### Example 1: Code Quality Analysis
|
|
205
|
+
```bash
|
|
206
|
+
# Analyze code complexity
|
|
207
|
+
cline mcp call-tool analyze_codebase --args '{"analysis_type": "complexity"}'
|
|
208
|
+
|
|
209
|
+
# Find code patterns
|
|
210
|
+
cline mcp call-tool analyze_codebase --args '{"analysis_type": "patterns"}'
|
|
211
|
+
|
|
212
|
+
# Analyze dependencies
|
|
213
|
+
cline mcp call-tool analyze_codebase --args '{"analysis_type": "dependencies"}'
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Example 2: Performance Analysis
|
|
217
|
+
```bash
|
|
218
|
+
# Analyze project structure
|
|
219
|
+
cline mcp call-tool get_project_structure --args '{"max_depth": 5}'
|
|
220
|
+
|
|
221
|
+
# Find large files
|
|
222
|
+
cline mcp call-tool search_files --args '{"pattern": "*.py"}' | python -c "
|
|
223
|
+
import json, sys
|
|
224
|
+
data = json.load(sys.stdin)
|
|
225
|
+
large_files = [f for f in data['files'] if f.endswith('.py')]
|
|
226
|
+
print(f'Found {len(large_files)} Python files')
|
|
227
|
+
"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## 🤖 Automation Examples
|
|
231
|
+
|
|
232
|
+
### Example 1: Automated Code Review
|
|
233
|
+
```bash
|
|
234
|
+
#!/bin/bash
|
|
235
|
+
# Automated code review script
|
|
236
|
+
|
|
237
|
+
echo "🚀 Starting automated code review..."
|
|
238
|
+
|
|
239
|
+
# Step 1: Get changed files
|
|
240
|
+
CHANGED_FILES=$(git diff --name-only HEAD~1)
|
|
241
|
+
|
|
242
|
+
# Step 2: Analyze each changed file
|
|
243
|
+
for file in $CHANGED_FILES; do
|
|
244
|
+
if [[ $file == *.py ]]; then
|
|
245
|
+
echo "Analyzing $file..."
|
|
246
|
+
cline mcp call-tool read_project_file --args "{\"path\": \"$file\", \"max_lines\": 100}"
|
|
247
|
+
claude "Review this Python file for code quality and best practices"
|
|
248
|
+
fi
|
|
249
|
+
done
|
|
250
|
+
|
|
251
|
+
# Step 3: Generate summary report
|
|
252
|
+
cline task "Generate a comprehensive code review report based on the analysis"
|
|
253
|
+
|
|
254
|
+
echo "✅ Automated code review completed!"
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Example 2: Continuous Integration
|
|
258
|
+
```bash
|
|
259
|
+
#!/bin/bash
|
|
260
|
+
# CI/CD integration script
|
|
261
|
+
|
|
262
|
+
echo "🔧 Starting CI/CD pipeline..."
|
|
263
|
+
|
|
264
|
+
# Step 1: Run tests with Cline
|
|
265
|
+
cline task "Run all unit tests and generate coverage report"
|
|
266
|
+
|
|
267
|
+
# Step 2: Security analysis
|
|
268
|
+
cline mcp call-tool analyze_codebase --args '{"analysis_type": "security"}'
|
|
269
|
+
|
|
270
|
+
# Step 3: Performance analysis
|
|
271
|
+
cline task "Run performance benchmarks and compare with previous results"
|
|
272
|
+
|
|
273
|
+
# Step 4: Documentation generation
|
|
274
|
+
claude "Generate updated documentation based on the latest code changes"
|
|
275
|
+
|
|
276
|
+
# Step 5: Deployment preparation
|
|
277
|
+
cline task "Prepare deployment packages and verify deployment scripts"
|
|
278
|
+
|
|
279
|
+
echo "✅ CI/CD pipeline completed!"
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## 🎯 Best Practices
|
|
283
|
+
|
|
284
|
+
### 1. Task Design
|
|
285
|
+
- **Be Specific**: Provide clear, detailed task descriptions
|
|
286
|
+
- **Break Down Complex Tasks**: Divide large tasks into smaller steps
|
|
287
|
+
- **Include Context**: Provide relevant background information
|
|
288
|
+
- **Set Expectations**: Specify desired output format and scope
|
|
289
|
+
|
|
290
|
+
### 2. MCP Tool Usage
|
|
291
|
+
- **Leverage Existing Tools**: Use built-in tools before creating custom ones
|
|
292
|
+
- **Provide Clear Parameters**: Use well-structured JSON for tool arguments
|
|
293
|
+
- **Handle Errors Gracefully**: Implement proper error handling in workflows
|
|
294
|
+
- **Document Custom Tools**: Add comprehensive descriptions for custom tools
|
|
295
|
+
|
|
296
|
+
### 3. Cross-CLI Collaboration
|
|
297
|
+
- **Choose Appropriate Tools**: Select the right CLI for each specific task
|
|
298
|
+
- **Maintain Context**: Preserve context across CLI boundaries
|
|
299
|
+
- **Monitor Performance**: Track execution times and success rates
|
|
300
|
+
- **Implement Fallbacks**: Have backup strategies for failed operations
|
|
301
|
+
|
|
302
|
+
### 4. Security Considerations
|
|
303
|
+
- **Validate Inputs**: Sanitize user inputs before processing
|
|
304
|
+
- **Limit Permissions**: Use minimal required permissions for operations
|
|
305
|
+
- **Audit Actions**: Log all cross-CLI operations for security review
|
|
306
|
+
- **Secure Credentials**: Store API keys and sensitive data securely
|
|
307
|
+
|
|
308
|
+
## 🚨 Common Issues and Solutions
|
|
309
|
+
|
|
310
|
+
### Issue 1: MCP Server Not Responding
|
|
311
|
+
```bash
|
|
312
|
+
# Solution: Check server status and restart
|
|
313
|
+
cline mcp status
|
|
314
|
+
cline mcp restart
|
|
315
|
+
|
|
316
|
+
# Check logs
|
|
317
|
+
tail -f ~/.config/cline/mcp_server.log
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Issue 2: Tool Execution Fails
|
|
321
|
+
```bash
|
|
322
|
+
# Solution: Verify tool parameters
|
|
323
|
+
cline mcp call-tool search_files --args '{"pattern": "*.py"}' --validate
|
|
324
|
+
|
|
325
|
+
# Check tool documentation
|
|
326
|
+
cline mcp describe-tool search_files
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Issue 3: Cross-CLI Communication Issues
|
|
330
|
+
```bash
|
|
331
|
+
# Solution: Check collaboration logs
|
|
332
|
+
cat ~/.stigmergy_cli_hooks/hook_events.json
|
|
333
|
+
|
|
334
|
+
# Verify CLI availability
|
|
335
|
+
python -c "from src.core.cross_cli_executor import CrossCLIExecutor; print(CrossCLIExecutor().check_cli_availability('cline'))"
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Issue 4: Performance Problems
|
|
339
|
+
```bash
|
|
340
|
+
# Solution: Monitor execution times
|
|
341
|
+
cline task "Analyze performance" --profile
|
|
342
|
+
|
|
343
|
+
# Check resource usage
|
|
344
|
+
cline mcp call-tool analyze_codebase --args '{"analysis_type": "performance"}'
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## 📚 Additional Resources
|
|
348
|
+
|
|
349
|
+
### Documentation
|
|
350
|
+
- [Cline CLI Official Docs](https://docs.cline.bot/)
|
|
351
|
+
- [MCP Protocol Specification](https://modelcontextprotocol.io/)
|
|
352
|
+
- [Stigmergy System Guide](../README.md)
|
|
353
|
+
|
|
354
|
+
### Community
|
|
355
|
+
- [GitHub Issues](https://github.com/ptreezh/stigmergy-CLI-Multi-Agents/issues)
|
|
356
|
+
- [Community Discussions](https://github.com/ptreezh/stigmergy-CLI-Multi-Agents/discussions)
|
|
357
|
+
|
|
358
|
+
### Development
|
|
359
|
+
- [Source Code](../src/adapters/cline/)
|
|
360
|
+
- [Test Suite](../test_cline_integration.py)
|
|
361
|
+
- [Configuration](../src/adapters/cline/config.py)
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
*These examples demonstrate the full potential of Cline CLI integration with the Stigmergy system. Experiment with different combinations to find the workflows that work best for your development process.*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stigmergy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.85",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System",
|
|
6
6
|
"main": "src/main_english.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dev": "node --watch src/index.js",
|
|
23
23
|
"lint": "eslint src/",
|
|
24
24
|
"format": "prettier --write src/",
|
|
25
|
-
"postinstall": "node src/main_english.js
|
|
25
|
+
"postinstall": "node src/main_english.js setup"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"ai",
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
"bin/**/*.cmd",
|
|
47
47
|
"test/**/*.js",
|
|
48
48
|
"scripts/**/*.js",
|
|
49
|
+
"examples/**/*",
|
|
50
|
+
"docs/**/*",
|
|
49
51
|
"package.json",
|
|
50
52
|
"README.md",
|
|
51
53
|
"LICENSE",
|
package/src/main_english.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System
|
|
5
5
|
* International Version - Pure English & ANSI Only
|
|
6
|
-
* Version: 1.0.
|
|
6
|
+
* Version: 1.0.85
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const { spawn, spawnSync } = require('child_process');
|
|
@@ -410,7 +410,7 @@ class StigmergyInstaller {
|
|
|
410
410
|
return { available, missing };
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
async showInstallOptions(missing) {
|
|
413
|
+
async showInstallOptions(missing, isNonInteractive = false) {
|
|
414
414
|
if (Object.keys(missing).length === 0) {
|
|
415
415
|
console.log('[INFO] All AI CLI tools are already installed!');
|
|
416
416
|
return [];
|
|
@@ -428,6 +428,12 @@ class StigmergyInstaller {
|
|
|
428
428
|
index++;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
if (isNonInteractive) {
|
|
432
|
+
console.log('\n[INFO] Non-interactive mode detected. Skipping automatic installation.');
|
|
433
|
+
console.log('[INFO] To install these tools manually, run: stigmergy install');
|
|
434
|
+
return [];
|
|
435
|
+
}
|
|
436
|
+
|
|
431
437
|
console.log('\n[OPTIONS] Installation Options:');
|
|
432
438
|
console.log('- Enter numbers separated by spaces (e.g: 1 3 5)');
|
|
433
439
|
console.log('- Enter "all" to install all missing tools');
|
|
@@ -436,6 +442,58 @@ class StigmergyInstaller {
|
|
|
436
442
|
return options;
|
|
437
443
|
}
|
|
438
444
|
|
|
445
|
+
async getUserSelection(options, missing) {
|
|
446
|
+
if (options.length === 0) {
|
|
447
|
+
return [];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
try {
|
|
451
|
+
const inquirer = require('inquirer');
|
|
452
|
+
|
|
453
|
+
const choices = options.map(opt => ({
|
|
454
|
+
name: `${opt.toolInfo.name} - ${opt.toolInfo.install}`,
|
|
455
|
+
value: opt.toolName
|
|
456
|
+
}));
|
|
457
|
+
|
|
458
|
+
choices.push(new inquirer.Separator(' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='),
|
|
459
|
+
{ name: 'All missing tools', value: 'all' },
|
|
460
|
+
{ name: 'Skip installation', value: 'skip' });
|
|
461
|
+
|
|
462
|
+
const answers = await inquirer.prompt([
|
|
463
|
+
{
|
|
464
|
+
type: 'checkbox',
|
|
465
|
+
name: 'selectedTools',
|
|
466
|
+
message: 'Select tools to install (Space to select, Enter to confirm):',
|
|
467
|
+
choices: choices,
|
|
468
|
+
validate: function (answer) {
|
|
469
|
+
if (answer.length < 1) {
|
|
470
|
+
return 'You must choose at least one option.';
|
|
471
|
+
}
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
]);
|
|
476
|
+
|
|
477
|
+
if (answers.selectedTools.includes('skip')) {
|
|
478
|
+
console.log('[INFO] Skipping CLI tool installation');
|
|
479
|
+
return [];
|
|
480
|
+
} else {
|
|
481
|
+
let toolsToInstall;
|
|
482
|
+
if (answers.selectedTools.includes('all')) {
|
|
483
|
+
toolsToInstall = options;
|
|
484
|
+
} else {
|
|
485
|
+
toolsToInstall = options.filter(opt => answers.selectedTools.includes(opt.toolName));
|
|
486
|
+
}
|
|
487
|
+
return toolsToInstall;
|
|
488
|
+
}
|
|
489
|
+
} catch (error) {
|
|
490
|
+
console.log('[ERROR] Interactive selection failed:', error.message);
|
|
491
|
+
console.log('[INFO] Skipping CLI tool installation due to input error');
|
|
492
|
+
console.log('[INFO] To install tools manually, run: stigmergy install');
|
|
493
|
+
return [];
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
439
497
|
async installTools(selectedTools, missing) {
|
|
440
498
|
if (!selectedTools || selectedTools.length === 0) {
|
|
441
499
|
console.log('[INFO] Skipping CLI tool installation');
|
|
@@ -452,8 +510,9 @@ class StigmergyInstaller {
|
|
|
452
510
|
const installCmd = toolInfo.install.split(' ');
|
|
453
511
|
const result = spawnSync(installCmd[0], installCmd.slice(1), {
|
|
454
512
|
encoding: 'utf8',
|
|
455
|
-
timeout:
|
|
456
|
-
stdio: 'inherit'
|
|
513
|
+
timeout: 300000, // Increased to 5 minutes for CLI tools that download binaries
|
|
514
|
+
stdio: 'inherit',
|
|
515
|
+
env: process.env
|
|
457
516
|
});
|
|
458
517
|
|
|
459
518
|
if (result.status === 0) {
|
|
@@ -504,7 +563,7 @@ class StigmergyInstaller {
|
|
|
504
563
|
|
|
505
564
|
const configFile = path.join(this.configDir, 'config.json');
|
|
506
565
|
const config = {
|
|
507
|
-
version: '1.0.
|
|
566
|
+
version: '1.0.85',
|
|
508
567
|
initialized: true,
|
|
509
568
|
createdAt: new Date().toISOString(),
|
|
510
569
|
lastUpdated: new Date().toISOString(),
|
|
@@ -558,7 +617,7 @@ async function main() {
|
|
|
558
617
|
|
|
559
618
|
if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
|
|
560
619
|
console.log('Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System');
|
|
561
|
-
console.log('Version: 1.0.
|
|
620
|
+
console.log('Version: 1.0.85');
|
|
562
621
|
console.log('');
|
|
563
622
|
console.log('[SYSTEM] Automated Installation and Deployment System');
|
|
564
623
|
console.log('');
|
|
@@ -589,7 +648,7 @@ async function main() {
|
|
|
589
648
|
switch (command) {
|
|
590
649
|
case 'version':
|
|
591
650
|
case '--version':
|
|
592
|
-
console.log('Stigmergy CLI v1.0.
|
|
651
|
+
console.log('Stigmergy CLI v1.0.85');
|
|
593
652
|
break;
|
|
594
653
|
|
|
595
654
|
case 'status':
|
|
@@ -608,45 +667,10 @@ async function main() {
|
|
|
608
667
|
const options = await installer.showInstallOptions(missingTools);
|
|
609
668
|
|
|
610
669
|
if (options.length > 0) {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
name: `${opt.toolInfo.name} - ${opt.toolInfo.install}`,
|
|
616
|
-
value: opt.toolName
|
|
617
|
-
}));
|
|
618
|
-
|
|
619
|
-
choices.push(new inquirer.Separator(' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='),
|
|
620
|
-
{ name: 'All missing tools', value: 'all' },
|
|
621
|
-
{ name: 'Skip installation', value: 'skip' });
|
|
622
|
-
|
|
623
|
-
const answers = await inquirer.prompt([
|
|
624
|
-
{
|
|
625
|
-
type: 'checkbox',
|
|
626
|
-
name: 'selectedTools',
|
|
627
|
-
message: 'Select tools to install (Space to select, Enter to confirm):',
|
|
628
|
-
choices: choices,
|
|
629
|
-
validate: function (answer) {
|
|
630
|
-
if (answer.length < 1) {
|
|
631
|
-
return 'You must choose at least one option.';
|
|
632
|
-
}
|
|
633
|
-
return true;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
]);
|
|
637
|
-
|
|
638
|
-
if (answers.selectedTools.includes('skip')) {
|
|
639
|
-
console.log('[INFO] Skipping CLI tool installation');
|
|
640
|
-
} else {
|
|
641
|
-
let toolsToInstall;
|
|
642
|
-
if (answers.selectedTools.includes('all')) {
|
|
643
|
-
toolsToInstall = options;
|
|
644
|
-
} else {
|
|
645
|
-
toolsToInstall = options.filter(opt => answers.selectedTools.includes(opt.toolName));
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
console.log('\n[INFO] Installing selected tools...');
|
|
649
|
-
await installer.installTools(toolsToInstall, missingTools);
|
|
670
|
+
const selectedTools = await installer.getUserSelection(options, missingTools);
|
|
671
|
+
if (selectedTools.length > 0) {
|
|
672
|
+
console.log('\n[INFO] Installing selected tools (this may take several minutes for tools that download binaries)...');
|
|
673
|
+
await installer.installTools(selectedTools, missingTools);
|
|
650
674
|
}
|
|
651
675
|
} else {
|
|
652
676
|
console.log('\n[INFO] All required tools are already installed!');
|
|
@@ -665,8 +689,13 @@ async function main() {
|
|
|
665
689
|
const setupOptions = await installer.showInstallOptions(setupMissing);
|
|
666
690
|
|
|
667
691
|
if (setupOptions.length > 0) {
|
|
668
|
-
|
|
669
|
-
|
|
692
|
+
const selectedTools = await installer.getUserSelection(setupOptions, setupMissing);
|
|
693
|
+
if (selectedTools.length > 0) {
|
|
694
|
+
console.log('\n[INFO] Installing selected tools (this may take several minutes for tools that download binaries)...');
|
|
695
|
+
await installer.installTools(selectedTools, setupMissing);
|
|
696
|
+
}
|
|
697
|
+
} else {
|
|
698
|
+
console.log('\n[INFO] All required tools are already installed!');
|
|
670
699
|
}
|
|
671
700
|
|
|
672
701
|
await installer.deployHooks(setupAvailable);
|
|
@@ -689,7 +718,7 @@ async function main() {
|
|
|
689
718
|
break;
|
|
690
719
|
|
|
691
720
|
case 'auto-install':
|
|
692
|
-
// Auto-install mode for npm postinstall
|
|
721
|
+
// Auto-install mode for npm postinstall - NON-INTERACTIVE
|
|
693
722
|
console.log('[AUTO-INSTALL] Stigmergy CLI automated setup');
|
|
694
723
|
console.log('='.repeat(60));
|
|
695
724
|
|
|
@@ -712,7 +741,8 @@ async function main() {
|
|
|
712
741
|
|
|
713
742
|
// Show final message to guide users
|
|
714
743
|
console.log('\n[SUCCESS] Stigmergy CLI installed successfully!');
|
|
715
|
-
console.log('[USAGE] Run "stigmergy
|
|
744
|
+
console.log('[USAGE] Run "stigmergy setup" to complete full configuration and install missing AI CLI tools.');
|
|
745
|
+
console.log('[USAGE] Run "stigmergy install" to install only missing AI CLI tools.');
|
|
716
746
|
console.log('[USAGE] Run "stigmergy --help" to see all available commands.');
|
|
717
747
|
break;
|
|
718
748
|
|