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,271 @@
1
+ """
2
+ iFlow CLI Hook集成安装脚本
3
+ 为iFlow CLI安装跨CLI协作感知能力
4
+
5
+ 使用方法:
6
+ python install_iflow_integration.py [--verify|--uninstall]
7
+ """
8
+
9
+ import os
10
+ import sys
11
+ import json
12
+ import shutil
13
+ import argparse
14
+ from pathlib import Path
15
+ from datetime import datetime
16
+
17
+ # 获取当前文件目录
18
+ current_dir = Path(__file__).parent
19
+ project_root = current_dir.parent.parent.parent
20
+
21
+ # iFlow CLI配置路径
22
+ IFLOW_CONFIG_DIR = os.path.expanduser("~/.config/iflow")
23
+ IFLOW_HOOKS_FILE = os.path.join(IFLOW_CONFIG_DIR, "hooks.yml")
24
+
25
+ def create_iflow_config_directory():
26
+ """创建iFlow配置目录"""
27
+ os.makedirs(IFLOW_CONFIG_DIR, exist_ok=True)
28
+ print(f"[OK] 创建iFlow配置目录: {IFLOW_CONFIG_DIR}")
29
+
30
+ def install_iflow_hooks():
31
+ """安装iFlow Hook配置"""
32
+ # 读取现有hooks配置
33
+ existing_hooks = {}
34
+ if os.path.exists(IFLOW_HOOKS_FILE):
35
+ try:
36
+ import yaml
37
+ with open(IFLOW_HOOKS_FILE, 'r', encoding='utf-8') as f:
38
+ existing_hooks = yaml.safe_load(f) or {}
39
+ except Exception as e:
40
+ print(f"⚠️ 读取现有hooks配置失败: {e}")
41
+ existing_hooks = {}
42
+
43
+ # 定义跨CLI协作的Hook配置
44
+ cross_cli_hooks = {
45
+ "cross_cli_hook_adapter": {
46
+ "name": "CrossCLIHookAdapter",
47
+ "module": "src.adapters.iflow.hook_adapter",
48
+ "class": "IFlowHookAdapter",
49
+ "enabled": True,
50
+ "priority": 100,
51
+ "hooks": [
52
+ "on_command_start",
53
+ "on_command_end",
54
+ "on_user_input",
55
+ "on_workflow_stage",
56
+ "on_pipeline_execute",
57
+ "on_output_render",
58
+ "on_error"
59
+ ],
60
+ "config": {
61
+ "cross_cli_enabled": True,
62
+ "supported_clis": ["claude", "gemini", "qwencode", "qoder", "codebuddy", "copilot"],
63
+ "auto_detect": True,
64
+ "timeout": 30,
65
+ "error_handling": "continue",
66
+ "collaboration_mode": "active"
67
+ }
68
+ }
69
+ }
70
+
71
+ # 合并配置(保留现有hooks,添加协作功能)
72
+ merged_hooks = existing_hooks.copy()
73
+ if 'plugins' not in merged_hooks:
74
+ merged_hooks['plugins'] = []
75
+
76
+ # 检查是否已存在跨CLI Hook
77
+ existing_plugin_names = [plugin.get('name') for plugin in merged_hooks.get('plugins', [])]
78
+ cross_cli_hook_exists = any(plugin_name == 'CrossCLIHookAdapter' for plugin_name in existing_plugin_names)
79
+
80
+ if not cross_cli_hook_exists:
81
+ merged_hooks['plugins'].append(cross_cli_hooks['cross_cli_hook_adapter'])
82
+
83
+ # 写入hooks配置文件
84
+ try:
85
+ import yaml
86
+ with open(IFLOW_HOOKS_FILE, 'w', encoding='utf-8') as f:
87
+ yaml.dump(merged_hooks, f, default_flow_style=False, allow_unicode=True)
88
+
89
+ print(f"[OK] iFlow Hook配置已安装: {IFLOW_HOOKS_FILE}")
90
+ print("🔗 已安装的Hook:")
91
+ for plugin in merged_hooks.get('plugins', []):
92
+ if plugin.get('name') == 'CrossCLIHookAdapter':
93
+ print(f" - {plugin['name']}: [OK] 跨CLI协作感知")
94
+ print(f" 支持的CLI: {', '.join(plugin['config'].get('supported_clis', []))}")
95
+
96
+ return True
97
+ except Exception as e:
98
+ print(f"❌ 安装iFlow Hook配置失败: {e}")
99
+ return False
100
+
101
+ def copy_adapter_file():
102
+ """复制适配器文件到iFlow配置目录"""
103
+ try:
104
+ # 创建适配器目录
105
+ adapter_dir = os.path.join(IFLOW_CONFIG_DIR, "adapters")
106
+ os.makedirs(adapter_dir, exist_ok=True)
107
+
108
+ # 复制适配器文件
109
+ adapter_files = [
110
+ "hook_adapter.py",
111
+ "standalone_iflow_adapter.py"
112
+ ]
113
+
114
+ for file_name in adapter_files:
115
+ src_file = current_dir / file_name
116
+ dst_file = os.path.join(adapter_dir, file_name)
117
+
118
+ if src_file.exists():
119
+ shutil.copy2(src_file, dst_file)
120
+ print(f"[OK] 复制适配器文件: {file_name}")
121
+ else:
122
+ print(f"⚠️ 适配器文件不存在: {file_name}")
123
+
124
+ return True
125
+ except Exception as e:
126
+ print(f"❌ 复制适配器文件失败: {e}")
127
+ return False
128
+
129
+ def verify_installation():
130
+ """验证安装是否成功"""
131
+ print("\n🔍 验证iFlow CLI集成安装...")
132
+
133
+ # 检查配置目录
134
+ if not os.path.exists(IFLOW_CONFIG_DIR):
135
+ print(f"❌ 配置目录不存在: {IFLOW_CONFIG_DIR}")
136
+ return False
137
+
138
+ # 检查hooks文件
139
+ if not os.path.exists(IFLOW_HOOKS_FILE):
140
+ print(f"❌ Hooks配置文件不存在: {IFLOW_HOOKS_FILE}")
141
+ return False
142
+
143
+ # 检查适配器目录
144
+ adapter_dir = os.path.join(IFLOW_CONFIG_DIR, "adapters")
145
+ if not os.path.exists(adapter_dir):
146
+ print(f"❌ 适配器目录不存在: {adapter_dir}")
147
+ return False
148
+
149
+ # 读取并验证hooks配置
150
+ try:
151
+ import yaml
152
+ with open(IFLOW_HOOKS_FILE, 'r', encoding='utf-8') as f:
153
+ hooks_config = yaml.safe_load(f) or {}
154
+
155
+ plugins = hooks_config.get('plugins', [])
156
+ cross_cli_plugin = None
157
+
158
+ for plugin in plugins:
159
+ if plugin.get('name') == 'CrossCLIHookAdapter':
160
+ cross_cli_plugin = plugin
161
+ print(f"[OK] 跨CLI协作Hook: 已启用")
162
+ print(f"[OK] 支持的CLI工具: {', '.join(plugin.get('config', {}).get('supported_clis', []))}")
163
+ break
164
+
165
+ if not cross_cli_plugin:
166
+ print("❌ 跨CLI协作Hook: 未找到")
167
+ return False
168
+
169
+ except Exception as e:
170
+ print(f"❌ 读取hooks配置失败: {e}")
171
+ return False
172
+
173
+ def uninstall_iflow_integration():
174
+ """卸载iFlow集成"""
175
+ try:
176
+ # 备份现有配置
177
+ if os.path.exists(IFLOW_HOOKS_FILE):
178
+ backup_file = f"{IFLOW_HOOKS_FILE}.backup_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
179
+ shutil.copy2(IFLOW_HOOKS_FILE, backup_file)
180
+ print(f"📦 已备份现有配置: {backup_file}")
181
+
182
+ # 移除跨CLI Hook
183
+ if os.path.exists(IFLOW_HOOKS_FILE):
184
+ import yaml
185
+ with open(IFLOW_HOOKS_FILE, 'r', encoding='utf-8') as f:
186
+ hooks_config = yaml.safe_load(f) or {}
187
+
188
+ if 'plugins' in hooks_config:
189
+ plugins = hooks_config['plugins']
190
+ # 移除跨CLI Hook
191
+ plugins = [p for p in plugins if p.get('name') != 'CrossCLIHookAdapter']
192
+
193
+ hooks_config['plugins'] = plugins
194
+
195
+ # 写回配置
196
+ with open(IFLOW_HOOKS_FILE, 'w', encoding='utf-8') as f:
197
+ yaml.dump(hooks_config, f, default_flow_style=False, allow_unicode=True)
198
+
199
+ print("[OK] iFlow跨CLI协作集成已卸载")
200
+ return True
201
+ except Exception as e:
202
+ print(f"❌ 卸载失败: {e}")
203
+ return False
204
+
205
+ def main():
206
+ parser = argparse.ArgumentParser(
207
+ description="iFlow CLI跨CLI协作集成安装脚本",
208
+ formatter_class=argparse.RawDescriptionHelpFormatter
209
+ )
210
+
211
+ parser.add_argument(
212
+ "--install",
213
+ action="store_true",
214
+ help="安装iFlow CLI跨CLI协作集成"
215
+ )
216
+
217
+ parser.add_argument(
218
+ "--verify",
219
+ action="store_true",
220
+ help="验证iFlow CLI集成安装"
221
+ )
222
+
223
+ parser.add_argument(
224
+ "--uninstall",
225
+ action="store_true",
226
+ help="卸载iFlow CLI跨CLI协作集成"
227
+ )
228
+
229
+ args = parser.parse_args()
230
+
231
+ print("[INSTALL] iFlow CLI跨CLI协作集成安装器")
232
+ print("=" * 60)
233
+
234
+ if args.uninstall:
235
+ print("[UNINSTALL] 卸载模式...")
236
+ success = uninstall_iflow_integration()
237
+ elif args.verify:
238
+ print("[VERIFY] 验证模式...")
239
+ success = verify_installation()
240
+ elif args.install or len(sys.argv) == 1:
241
+ print("[INSTALL] 安装模式...")
242
+
243
+ # 1. 创建配置目录
244
+ print("Step 1. 创建配置目录...")
245
+ create_iflow_config_directory()
246
+
247
+ # 2. 安装hooks配置
248
+ print("Step 2. 安装hooks配置...")
249
+ hooks_success = install_iflow_hooks()
250
+
251
+ # 3. 复制适配器文件
252
+ print("Step 3. 复制适配器文件...")
253
+ adapter_success = copy_adapter_file()
254
+
255
+ success = hooks_success and adapter_success
256
+
257
+ if success:
258
+ print("\n🎉 iFlow CLI集成安装成功!")
259
+ print("\n[INFO] 安装摘要:")
260
+ print(f" [OK] 配置目录: {IFLOW_CONFIG_DIR}")
261
+ print(f" [OK] Hooks文件: {IFLOW_HOOKS_FILE}")
262
+ print(f" [OK] 适配器目录: {os.path.join(IFLOW_CONFIG_DIR, 'adapters')}")
263
+ print(f" [OK] 跨CLI协作: 已启用")
264
+ print(f" [OK] 支持的CLI: claude, gemini, qwencode, qoder, codebuddy, copilot")
265
+ else:
266
+ print("\n❌ iFlow CLI集成安装失败!")
267
+ else:
268
+ parser.print_help()
269
+
270
+ if __name__ == "__main__":
271
+ main()