stigmergy 1.0.57

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.
Files changed (94) hide show
  1. package/LICENSE +19 -0
  2. package/README.de.md +301 -0
  3. package/README.en.md +301 -0
  4. package/README.es.md +301 -0
  5. package/README.fr.md +301 -0
  6. package/README.ja.md +301 -0
  7. package/README.ko.md +301 -0
  8. package/README.md +301 -0
  9. package/README.ru.md +301 -0
  10. package/README.zh.md +301 -0
  11. package/package.json +82 -0
  12. package/src/adapters/claude/__init__.py +13 -0
  13. package/src/adapters/claude/claude_skills_integration.py +609 -0
  14. package/src/adapters/claude/hook_adapter.py +663 -0
  15. package/src/adapters/claude/install_claude_integration.py +265 -0
  16. package/src/adapters/claude/skills_hook_adapter.py +841 -0
  17. package/src/adapters/claude/standalone_claude_adapter.py +384 -0
  18. package/src/adapters/cline/__init__.py +20 -0
  19. package/src/adapters/cline/config.py +108 -0
  20. package/src/adapters/cline/install_cline_integration.py +617 -0
  21. package/src/adapters/cline/mcp_server.py +713 -0
  22. package/src/adapters/cline/standalone_cline_adapter.py +459 -0
  23. package/src/adapters/codebuddy/__init__.py +13 -0
  24. package/src/adapters/codebuddy/buddy_adapter.py +1125 -0
  25. package/src/adapters/codebuddy/install_codebuddy_integration.py +279 -0
  26. package/src/adapters/codebuddy/skills_hook_adapter.py +672 -0
  27. package/src/adapters/codebuddy/skills_integration.py +395 -0
  28. package/src/adapters/codebuddy/standalone_codebuddy_adapter.py +403 -0
  29. package/src/adapters/codex/__init__.py +11 -0
  30. package/src/adapters/codex/base.py +46 -0
  31. package/src/adapters/codex/install_codex_integration.py +311 -0
  32. package/src/adapters/codex/mcp_server.py +493 -0
  33. package/src/adapters/codex/natural_language_parser.py +82 -0
  34. package/src/adapters/codex/slash_command_adapter.py +326 -0
  35. package/src/adapters/codex/standalone_codex_adapter.py +362 -0
  36. package/src/adapters/copilot/__init__.py +13 -0
  37. package/src/adapters/copilot/install_copilot_integration.py +564 -0
  38. package/src/adapters/copilot/mcp_adapter.py +772 -0
  39. package/src/adapters/copilot/mcp_server.py +168 -0
  40. package/src/adapters/copilot/standalone_copilot_adapter.py +114 -0
  41. package/src/adapters/gemini/__init__.py +13 -0
  42. package/src/adapters/gemini/extension_adapter.py +690 -0
  43. package/src/adapters/gemini/install_gemini_integration.py +257 -0
  44. package/src/adapters/gemini/standalone_gemini_adapter.py +366 -0
  45. package/src/adapters/iflow/__init__.py +7 -0
  46. package/src/adapters/iflow/hook_adapter.py +1038 -0
  47. package/src/adapters/iflow/hook_installer.py +536 -0
  48. package/src/adapters/iflow/install_iflow_integration.py +271 -0
  49. package/src/adapters/iflow/official_hook_adapter.py +1272 -0
  50. package/src/adapters/iflow/standalone_iflow_adapter.py +48 -0
  51. package/src/adapters/iflow/workflow_adapter.py +793 -0
  52. package/src/adapters/qoder/hook_installer.py +732 -0
  53. package/src/adapters/qoder/install_qoder_integration.py +265 -0
  54. package/src/adapters/qoder/notification_hook_adapter.py +863 -0
  55. package/src/adapters/qoder/standalone_qoder_adapter.py +48 -0
  56. package/src/adapters/qwen/__init__.py +17 -0
  57. package/src/adapters/qwencode/__init__.py +13 -0
  58. package/src/adapters/qwencode/inheritance_adapter.py +818 -0
  59. package/src/adapters/qwencode/install_qwencode_integration.py +276 -0
  60. package/src/adapters/qwencode/standalone_qwencode_adapter.py +399 -0
  61. package/src/atomic_collaboration_handler.py +461 -0
  62. package/src/cli_collaboration_agent.py +697 -0
  63. package/src/collaboration/hooks.py +315 -0
  64. package/src/core/__init__.py +21 -0
  65. package/src/core/ai_environment_scanner.py +331 -0
  66. package/src/core/base_adapter.py +220 -0
  67. package/src/core/cli_hook_integration.py +406 -0
  68. package/src/core/cross_cli_executor.py +713 -0
  69. package/src/core/cross_cli_mapping.py +1163 -0
  70. package/src/core/cross_platform_encoding.py +365 -0
  71. package/src/core/cross_platform_safe_cli.py +894 -0
  72. package/src/core/direct_cli_executor.py +805 -0
  73. package/src/core/direct_cli_hook_system.py +958 -0
  74. package/src/core/enhanced_init_processor.py +427 -0
  75. package/src/core/graceful_cli_executor.py +912 -0
  76. package/src/core/md_enhancer.py +342 -0
  77. package/src/core/md_generator.py +619 -0
  78. package/src/core/models.py +218 -0
  79. package/src/core/parser.py +108 -0
  80. package/src/core/real_cli_hook_system.py +852 -0
  81. package/src/core/real_cross_cli_system.py +925 -0
  82. package/src/core/verified_cross_cli_system.py +961 -0
  83. package/src/deploy.js +737 -0
  84. package/src/enhanced_deploy.js +303 -0
  85. package/src/enhanced_universal_cli_setup.py +930 -0
  86. package/src/kimi_wrapper.py +104 -0
  87. package/src/main.js +1309 -0
  88. package/src/shell_integration.py +398 -0
  89. package/src/simple-main.js +315 -0
  90. package/src/smart_router_creator.py +323 -0
  91. package/src/universal_cli_setup.py +1289 -0
  92. package/src/utils/__init__.py +12 -0
  93. package/src/utils/cli_detector.py +445 -0
  94. package/src/utils/file_utils.py +246 -0
@@ -0,0 +1,303 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Smart CLI Router - Node.js版本部署脚本
5
+ * 支持NPM发布和一键部署所有CLI工具集成
6
+ */
7
+
8
+ import { spawn } from 'child_process';
9
+ import { readFile, writeFile, existsSync } from 'fs/promises';
10
+ import { join, dirname } from 'path';
11
+ import { fileURLToPath } from 'url';
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+
16
+ // CLI工具列表
17
+ const CLI_TOOLS = [
18
+ 'claude',
19
+ 'gemini',
20
+ 'qwencode',
21
+ 'iflow',
22
+ 'qoder',
23
+ 'codebuddy',
24
+ 'copilot',
25
+ 'codex'
26
+ ];
27
+
28
+ // 颜色输出
29
+ const colors = {
30
+ reset: '\x1b[0m',
31
+ red: '\x1b[31m',
32
+ green: '\x1b[32m',
33
+ yellow: '\x1b[33m',
34
+ blue: '\x1b[34m',
35
+ magenta: '\x1b[35m',
36
+ cyan: '\x1b[36m'
37
+ };
38
+
39
+ function colorLog(color, message) {
40
+ console.log(`${colors[color]}${message}${colors.reset}`);
41
+ }
42
+
43
+ // 执行命令
44
+ function executeCommand(command, args, options = {}) {
45
+ return new Promise((resolve, reject) => {
46
+ const child = spawn(command, args, {
47
+ stdio: ['pipe', 'pipe', 'pipe'],
48
+ ...options
49
+ });
50
+
51
+ let stdout = '';
52
+ let stderr = '';
53
+
54
+ child.stdout?.on('data', (data) => {
55
+ stdout += data.toString();
56
+ });
57
+
58
+ child.stderr?.on('data', (data) => {
59
+ stderr += data.toString();
60
+ });
61
+
62
+ child.on('close', (code) => {
63
+ resolve({ code, stdout, stderr });
64
+ });
65
+
66
+ child.on('error', (error) => {
67
+ reject(error);
68
+ });
69
+ });
70
+ }
71
+
72
+ // 检查CLI工具是否可用
73
+ async function checkCLIAvailability(cliName) {
74
+ try {
75
+ const result = await executeCommand(cliName, ['--version']);
76
+ return result.code === 0;
77
+ } catch (error) {
78
+ return false;
79
+ }
80
+ }
81
+
82
+ // 安装单个CLI工具集成
83
+ async function installCLIIntegration(cliName) {
84
+ colorLog('cyan', `\n🔧 安装 ${cliName} CLI 集成...`);
85
+
86
+ const installScript = join(__dirname, 'adapters', cliName, `install_${cliName}_integration.py`);
87
+
88
+ try {
89
+ // 检查安装脚本是否存在
90
+ const stats = await readFile(installScript).catch(() => null);
91
+ if (!stats) {
92
+ colorLog('yellow', `⚠️ ${cliName} 安装脚本不存在,跳过`);
93
+ return { success: false, reason: 'Install script not found' };
94
+ }
95
+
96
+ // 执行安装
97
+ colorLog('blue', `📦 执行 ${cliName} 安装脚本...`);
98
+ const result = await executeCommand('python', [installScript, '--install'], {
99
+ cwd: __dirname
100
+ });
101
+
102
+ if (result.code === 0) {
103
+ colorLog('green', `✅ ${cliName} CLI 集成安装成功`);
104
+ return { success: true };
105
+ } else {
106
+ colorLog('red', `❌ ${cliName} CLI 集成安装失败`);
107
+ if (result.stderr) {
108
+ console.log(result.stderr);
109
+ }
110
+ return { success: false, reason: result.stderr };
111
+ }
112
+
113
+ } catch (error) {
114
+ colorLog('red', `❌ ${cliName} 安装过程出错: ${error.message}`);
115
+ return { success: false, reason: error.message };
116
+ }
117
+ }
118
+
119
+ // 验证CLI集成
120
+ async function verifyCLIIntegration(cliName) {
121
+ colorLog('cyan', `🔍 验证 ${cliName} CLI 集成...`);
122
+
123
+ const installScript = join(__dirname, 'adapters', cliName, `install_${cliName}_integration.py`);
124
+
125
+ try {
126
+ const result = await executeCommand('python', [installScript, '--verify'], {
127
+ cwd: __dirname
128
+ });
129
+
130
+ return result.code === 0;
131
+ } catch (error) {
132
+ return false;
133
+ }
134
+ }
135
+
136
+ // 构建项目
137
+ async function buildProject() {
138
+ colorLog('blue', '\n📦 构建项目...');
139
+
140
+ try {
141
+ const result = await executeCommand('npm', ['run', 'build'], {
142
+ cwd: __dirname
143
+ });
144
+
145
+ if (result.code === 0) {
146
+ colorLog('green', '✅ 项目构建成功');
147
+ return true;
148
+ } else {
149
+ colorLog('red', `❌ 项目构建失败: ${result.stderr}`);
150
+ return false;
151
+ }
152
+ } catch (error) {
153
+ colorLog('red', `❌ 构建过程出错: ${error.message}`);
154
+ return false;
155
+ }
156
+ }
157
+
158
+ // 发布到NPM
159
+ async function publishToNPM() {
160
+ colorLog('blue', '\n🚀 发布到 NPM...');
161
+
162
+ try {
163
+ const result = await executeCommand('npm', ['publish', '--access', 'public'], {
164
+ cwd: __dirname
165
+ });
166
+
167
+ if (result.code === 0) {
168
+ colorLog('green', '✅ NPM 发布成功');
169
+ return true;
170
+ } else {
171
+ colorLog('red', `❌ NPM 发布失败: ${result.stderr}`);
172
+ return false;
173
+ }
174
+ } catch (error) {
175
+ colorLog('red', `❌ 发布过程出错: ${error.message}`);
176
+ return false;
177
+ }
178
+ }
179
+
180
+ // 显示系统状态
181
+ async function showSystemStatus() {
182
+ colorLog('cyan', '\n📊 系统状态:');
183
+
184
+ const results = [];
185
+ for (const cliName of CLI_TOOLS) {
186
+ const isInstalled = await verifyCLIIntegration(cliName);
187
+ const isAvailable = await checkCLIAvailability(cliName);
188
+
189
+ results.push({
190
+ name: cliName,
191
+ installed: isInstalled,
192
+ available: isAvailable
193
+ });
194
+
195
+ const statusIcon = isInstalled ? '✅' : '❌';
196
+ const availableIcon = isAvailable ? '🟢' : '🔴';
197
+ console.log(` ${statusIcon} ${cliName} 集成 | ${availableIcon} CLI可用`);
198
+ }
199
+
200
+ return results;
201
+ }
202
+
203
+ // 主部署函数
204
+ async function deploy(options = {}) {
205
+ const { all = false, build = false, publish = false, status = false } = options;
206
+
207
+ colorLog('magenta', '🚀 Smart CLI Router - Node.js部署');
208
+ colorLog('cyan', '=====================================');
209
+
210
+ try {
211
+ // 显示状态
212
+ if (status || all) {
213
+ await showSystemStatus();
214
+ }
215
+
216
+ // 构建项目
217
+ if (build || all) {
218
+ const buildSuccess = await buildProject();
219
+ if (!buildSuccess && publish) {
220
+ throw new Error('构建失败,无法发布');
221
+ }
222
+ }
223
+
224
+ // 安装所有CLI集成
225
+ if (all) {
226
+ colorLog('cyan', '\n🔧 安装所有CLI工具集成...');
227
+
228
+ let successCount = 0;
229
+ let totalCount = 0;
230
+
231
+ for (const cliName of CLI_TOOLS) {
232
+ totalCount++;
233
+ const result = await installCLIIntegration(cliName);
234
+ if (result.success) {
235
+ successCount++;
236
+ }
237
+ }
238
+
239
+ colorLog('green', `\n✅ 安装完成: ${successCount}/${totalCount} 个CLI工具集成成功`);
240
+ }
241
+
242
+ // 发布到NPM
243
+ if (publish || all) {
244
+ const publishSuccess = await publishToNPM();
245
+ if (publishSuccess) {
246
+ colorLog('green', '\n🎉 Smart CLI Router 部署成功!');
247
+ colorLog('cyan', '\n📦 现在任何人都可以使用:');
248
+ colorLog('yellow', ' npx smart-cli-router init');
249
+ colorLog('yellow', ' npx smart-cli-router status');
250
+ colorLog('yellow', ' npx smart-cli-router deploy --all');
251
+ colorLog('cyan', '\n🎯 真正的跨CLI协作,让每个AI工具都能发挥最大价值!');
252
+ }
253
+ }
254
+
255
+ } catch (error) {
256
+ colorLog('red', `❌ 部署失败: ${error.message}`);
257
+ process.exit(1);
258
+ }
259
+ }
260
+
261
+ // 命令行参数处理
262
+ const args = process.argv.slice(2);
263
+ const options = {};
264
+
265
+ if (args.includes('--all')) {
266
+ options.all = true;
267
+ }
268
+ if (args.includes('--build')) {
269
+ options.build = true;
270
+ }
271
+ if (args.includes('--publish')) {
272
+ options.publish = true;
273
+ }
274
+ if (args.includes('--status')) {
275
+ options.status = true;
276
+ }
277
+
278
+ // 如果没有参数,显示帮助
279
+ if (args.length === 0) {
280
+ colorLog('cyan', 'Smart CLI Router - Node.js部署工具');
281
+ colorLog('yellow', '\n用法:');
282
+ colorLog('white', ' node deploy.js <选项>');
283
+ colorLog('yellow', '\n选项:');
284
+ colorLog('white', ' --status 显示系统状态');
285
+ colorLog('white', ' --build 构建项目');
286
+ colorLog('white', ' --publish 发布到NPM');
287
+ colorLog('white', ' --all 执行完整部署(构建+安装所有CLI+发布)');
288
+ colorLog('yellow', '\n示例:');
289
+ colorLog('white', ' node deploy.js --status # 查看系统状态');
290
+ colorLog('white', ' node deploy.js --build # 仅构建项目');
291
+ colorLog('white', ' node deploy.js --all # 完整部署');
292
+ process.exit(0);
293
+ }
294
+
295
+ // 运行部署
296
+ if (import.meta.url === `file://${process.argv[1]}`) {
297
+ deploy(options).catch(error => {
298
+ colorLog('red', `部署失败: ${error.message}`);
299
+ process.exit(1);
300
+ });
301
+ }
302
+
303
+ export { deploy, showSystemStatus, installCLIIntegration };