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.
- package/LICENSE +19 -0
- package/README.de.md +301 -0
- package/README.en.md +301 -0
- package/README.es.md +301 -0
- package/README.fr.md +301 -0
- package/README.ja.md +301 -0
- package/README.ko.md +301 -0
- package/README.md +301 -0
- package/README.ru.md +301 -0
- package/README.zh.md +301 -0
- package/package.json +82 -0
- package/src/adapters/claude/__init__.py +13 -0
- package/src/adapters/claude/claude_skills_integration.py +609 -0
- package/src/adapters/claude/hook_adapter.py +663 -0
- package/src/adapters/claude/install_claude_integration.py +265 -0
- package/src/adapters/claude/skills_hook_adapter.py +841 -0
- package/src/adapters/claude/standalone_claude_adapter.py +384 -0
- package/src/adapters/cline/__init__.py +20 -0
- package/src/adapters/cline/config.py +108 -0
- package/src/adapters/cline/install_cline_integration.py +617 -0
- package/src/adapters/cline/mcp_server.py +713 -0
- package/src/adapters/cline/standalone_cline_adapter.py +459 -0
- package/src/adapters/codebuddy/__init__.py +13 -0
- package/src/adapters/codebuddy/buddy_adapter.py +1125 -0
- package/src/adapters/codebuddy/install_codebuddy_integration.py +279 -0
- package/src/adapters/codebuddy/skills_hook_adapter.py +672 -0
- package/src/adapters/codebuddy/skills_integration.py +395 -0
- package/src/adapters/codebuddy/standalone_codebuddy_adapter.py +403 -0
- package/src/adapters/codex/__init__.py +11 -0
- package/src/adapters/codex/base.py +46 -0
- package/src/adapters/codex/install_codex_integration.py +311 -0
- package/src/adapters/codex/mcp_server.py +493 -0
- package/src/adapters/codex/natural_language_parser.py +82 -0
- package/src/adapters/codex/slash_command_adapter.py +326 -0
- package/src/adapters/codex/standalone_codex_adapter.py +362 -0
- package/src/adapters/copilot/__init__.py +13 -0
- package/src/adapters/copilot/install_copilot_integration.py +564 -0
- package/src/adapters/copilot/mcp_adapter.py +772 -0
- package/src/adapters/copilot/mcp_server.py +168 -0
- package/src/adapters/copilot/standalone_copilot_adapter.py +114 -0
- package/src/adapters/gemini/__init__.py +13 -0
- package/src/adapters/gemini/extension_adapter.py +690 -0
- package/src/adapters/gemini/install_gemini_integration.py +257 -0
- package/src/adapters/gemini/standalone_gemini_adapter.py +366 -0
- package/src/adapters/iflow/__init__.py +7 -0
- package/src/adapters/iflow/hook_adapter.py +1038 -0
- package/src/adapters/iflow/hook_installer.py +536 -0
- package/src/adapters/iflow/install_iflow_integration.py +271 -0
- package/src/adapters/iflow/official_hook_adapter.py +1272 -0
- package/src/adapters/iflow/standalone_iflow_adapter.py +48 -0
- package/src/adapters/iflow/workflow_adapter.py +793 -0
- package/src/adapters/qoder/hook_installer.py +732 -0
- package/src/adapters/qoder/install_qoder_integration.py +265 -0
- package/src/adapters/qoder/notification_hook_adapter.py +863 -0
- package/src/adapters/qoder/standalone_qoder_adapter.py +48 -0
- package/src/adapters/qwen/__init__.py +17 -0
- package/src/adapters/qwencode/__init__.py +13 -0
- package/src/adapters/qwencode/inheritance_adapter.py +818 -0
- package/src/adapters/qwencode/install_qwencode_integration.py +276 -0
- package/src/adapters/qwencode/standalone_qwencode_adapter.py +399 -0
- package/src/atomic_collaboration_handler.py +461 -0
- package/src/cli_collaboration_agent.py +697 -0
- package/src/collaboration/hooks.py +315 -0
- package/src/core/__init__.py +21 -0
- package/src/core/ai_environment_scanner.py +331 -0
- package/src/core/base_adapter.py +220 -0
- package/src/core/cli_hook_integration.py +406 -0
- package/src/core/cross_cli_executor.py +713 -0
- package/src/core/cross_cli_mapping.py +1163 -0
- package/src/core/cross_platform_encoding.py +365 -0
- package/src/core/cross_platform_safe_cli.py +894 -0
- package/src/core/direct_cli_executor.py +805 -0
- package/src/core/direct_cli_hook_system.py +958 -0
- package/src/core/enhanced_init_processor.py +427 -0
- package/src/core/graceful_cli_executor.py +912 -0
- package/src/core/md_enhancer.py +342 -0
- package/src/core/md_generator.py +619 -0
- package/src/core/models.py +218 -0
- package/src/core/parser.py +108 -0
- package/src/core/real_cli_hook_system.py +852 -0
- package/src/core/real_cross_cli_system.py +925 -0
- package/src/core/verified_cross_cli_system.py +961 -0
- package/src/deploy.js +737 -0
- package/src/enhanced_deploy.js +303 -0
- package/src/enhanced_universal_cli_setup.py +930 -0
- package/src/kimi_wrapper.py +104 -0
- package/src/main.js +1309 -0
- package/src/shell_integration.py +398 -0
- package/src/simple-main.js +315 -0
- package/src/smart_router_creator.py +323 -0
- package/src/universal_cli_setup.py +1289 -0
- package/src/utils/__init__.py +12 -0
- package/src/utils/cli_detector.py +445 -0
- package/src/utils/file_utils.py +246 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Qoder CLI Notification Hook集成安装脚本
|
|
3
|
+
为Qoder CLI安装跨CLI协作感知能力
|
|
4
|
+
|
|
5
|
+
使用方法:
|
|
6
|
+
python install_qoder_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
|
+
# Qoder CLI配置路径
|
|
22
|
+
QODER_CONFIG_FILE = os.path.expanduser("~/.qoder/config.json")
|
|
23
|
+
|
|
24
|
+
def install_qoder_hooks():
|
|
25
|
+
"""安装Qoder Notification Hook配置"""
|
|
26
|
+
# 读取现有config配置
|
|
27
|
+
existing_config = {}
|
|
28
|
+
if os.path.exists(QODER_CONFIG_FILE):
|
|
29
|
+
try:
|
|
30
|
+
with open(QODER_CONFIG_FILE, 'r', encoding='utf-8') as f:
|
|
31
|
+
existing_config = json.load(f)
|
|
32
|
+
except Exception as e:
|
|
33
|
+
print(f"⚠️ 读取现有config配置失败: {e}")
|
|
34
|
+
existing_config = {}
|
|
35
|
+
|
|
36
|
+
# 定义跨CLI协作的Hook配置
|
|
37
|
+
cross_cli_hooks = {
|
|
38
|
+
"cross_cli_notification_hook": {
|
|
39
|
+
"name": "CrossCLINotificationHook",
|
|
40
|
+
"module": "src.adapters.qoder.notification_hook_adapter",
|
|
41
|
+
"class": "QoderNotificationHookAdapter",
|
|
42
|
+
"enabled": True,
|
|
43
|
+
"priority": 100,
|
|
44
|
+
"triggers": [
|
|
45
|
+
"on_command_execution",
|
|
46
|
+
"on_tool_detected",
|
|
47
|
+
"on_collaboration_request"
|
|
48
|
+
],
|
|
49
|
+
"config": {
|
|
50
|
+
"cross_cli_enabled": True,
|
|
51
|
+
"supported_clis": ["claude", "gemini", "qwencode", "iflow", "codebuddy", "copilot"],
|
|
52
|
+
"auto_detect": True,
|
|
53
|
+
"timeout": 30,
|
|
54
|
+
"notification_channel": "file_system",
|
|
55
|
+
"error_handling": "continue"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# 合并配置(保留现有hooks,添加协作功能)
|
|
61
|
+
merged_config = existing_config.copy()
|
|
62
|
+
if 'hooks' not in merged_config:
|
|
63
|
+
merged_config['hooks'] = []
|
|
64
|
+
|
|
65
|
+
# 检查是否已存在跨CLI通知Hook
|
|
66
|
+
existing_hook_names = [hook.get('name') for hook in merged_config.get('hooks', [])]
|
|
67
|
+
cross_cli_hook_name = "CrossCLINotificationHook"
|
|
68
|
+
|
|
69
|
+
if cross_cli_hook_name not in existing_hook_names:
|
|
70
|
+
merged_config['hooks'].append(cross_cli_hooks['cross_cli_notification_hook'])
|
|
71
|
+
|
|
72
|
+
# 写入配置文件
|
|
73
|
+
try:
|
|
74
|
+
with open(QODER_CONFIG_FILE, 'w', encoding='utf-8') as f:
|
|
75
|
+
json.dump(merged_config, f, indent=2, ensure_ascii=False)
|
|
76
|
+
|
|
77
|
+
print(f"[OK] Qoder配置已安装: {QODER_CONFIG_FILE}")
|
|
78
|
+
print("🔗 已安装的Hook:")
|
|
79
|
+
for hook_name in [hook.get('name') for hook in merged_config.get('hooks', [])]:
|
|
80
|
+
if hook.get('enabled', False):
|
|
81
|
+
status = "❌"
|
|
82
|
+
else:
|
|
83
|
+
status = "[OK]"
|
|
84
|
+
print(f" - {hook_name}: {status}")
|
|
85
|
+
|
|
86
|
+
return True
|
|
87
|
+
except Exception as e:
|
|
88
|
+
print(f"❌ 安装Qoder配置失败: {e}")
|
|
89
|
+
return False
|
|
90
|
+
|
|
91
|
+
def copy_adapter_file():
|
|
92
|
+
"""复制适配器文件到Qoder配置目录"""
|
|
93
|
+
try:
|
|
94
|
+
# 创建适配器目录
|
|
95
|
+
adapter_dir = os.path.dirname(QODER_CONFIG_FILE)
|
|
96
|
+
os.makedirs(adapter_dir, exist_ok=True)
|
|
97
|
+
|
|
98
|
+
# 复制适配器文件
|
|
99
|
+
adapter_files = [
|
|
100
|
+
"notification_hook_adapter.py",
|
|
101
|
+
"standalone_qoder_adapter.py"
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
for file_name in adapter_files:
|
|
105
|
+
src_file = current_dir / file_name
|
|
106
|
+
dst_file = os.path.join(adapter_dir, file_name)
|
|
107
|
+
|
|
108
|
+
if src_file.exists():
|
|
109
|
+
shutil.copy2(src_file, dst_file)
|
|
110
|
+
print(f"[OK] 复制适配器文件: {file_name}")
|
|
111
|
+
else:
|
|
112
|
+
print(f"⚠️ 适配器文件不存在: {file_name}")
|
|
113
|
+
|
|
114
|
+
return True
|
|
115
|
+
except Exception as e:
|
|
116
|
+
print(f"❌ 复制适配器文件失败: {e}")
|
|
117
|
+
return False
|
|
118
|
+
|
|
119
|
+
def verify_installation():
|
|
120
|
+
"""验证安装是否成功"""
|
|
121
|
+
print("\n🔍 验证Qoder CLI集成安装...")
|
|
122
|
+
|
|
123
|
+
# 检查配置文件
|
|
124
|
+
if not os.path.exists(QODER_CONFIG_FILE):
|
|
125
|
+
print(f"❌ 配置文件不存在: {QODER_CONFIG_FILE}")
|
|
126
|
+
return False
|
|
127
|
+
|
|
128
|
+
try:
|
|
129
|
+
with open(QODER_CONFIG_FILE, 'r', encoding='utf-8') as f:
|
|
130
|
+
config = json.load(f)
|
|
131
|
+
|
|
132
|
+
hooks = config.get('hooks', [])
|
|
133
|
+
cross_cli_hook = None
|
|
134
|
+
for hook in hooks:
|
|
135
|
+
if hook.get('name') == 'CrossCLINotificationHook':
|
|
136
|
+
cross_cli_hook = hook
|
|
137
|
+
break
|
|
138
|
+
|
|
139
|
+
if cross_cli_hook:
|
|
140
|
+
print("[OK] 跨CLI协作Hook已安装")
|
|
141
|
+
print(f" - Hook名称: {cross_cli_hook.get('name')}")
|
|
142
|
+
print(f" - 启用状态: {'[OK]' if cross_cli_hook.get('enabled') else '❌'}")
|
|
143
|
+
print(f" - 支持的CLI工具: {cross_cli_hook.get('config', {}).get('supported_clis', [])}")
|
|
144
|
+
print(f" - 自动检测: {'[OK]' if cross_cli_hook.get('config', {}).get('auto_detect') else '❌'}")
|
|
145
|
+
else:
|
|
146
|
+
print("❌ 跨CLI协作Hook未找到")
|
|
147
|
+
return False
|
|
148
|
+
|
|
149
|
+
# 检查适配器文件
|
|
150
|
+
adapter_dir = os.path.dirname(QODER_CONFIG_FILE)
|
|
151
|
+
required_files = ["notification_hook_adapter.py"]
|
|
152
|
+
missing_files = []
|
|
153
|
+
|
|
154
|
+
for file_name in required_files:
|
|
155
|
+
file_path = os.path.join(adapter_dir, file_name)
|
|
156
|
+
if not os.path.exists(file_path):
|
|
157
|
+
missing_files.append(file_name)
|
|
158
|
+
|
|
159
|
+
if missing_files:
|
|
160
|
+
print(f"❌ 缺失适配器文件: {missing_files}")
|
|
161
|
+
return False
|
|
162
|
+
else:
|
|
163
|
+
print("[OK] 适配器文件已复制")
|
|
164
|
+
|
|
165
|
+
return True
|
|
166
|
+
except Exception as e:
|
|
167
|
+
print(f"❌ 验证失败: {e}")
|
|
168
|
+
return False
|
|
169
|
+
|
|
170
|
+
def uninstall_qoder_integration():
|
|
171
|
+
"""卸载Qoder集成"""
|
|
172
|
+
try:
|
|
173
|
+
# 备份现有配置
|
|
174
|
+
if os.path.exists(QODER_CONFIG_FILE):
|
|
175
|
+
backup_file = f"{QODER_CONFIG_FILE}.backup_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
|
|
176
|
+
shutil.copy2(QODER_CONFIG_FILE, backup_file)
|
|
177
|
+
print(f"📦 已备份现有配置: {backup_file}")
|
|
178
|
+
|
|
179
|
+
# 移除跨CLI协作Hook
|
|
180
|
+
config_updated = False
|
|
181
|
+
if os.path.exists(QODER_CONFIG_FILE):
|
|
182
|
+
with open(QODER_CONFIG_FILE, 'r+', encoding='utf-8') as f:
|
|
183
|
+
config = json.load(f)
|
|
184
|
+
hooks = config.get('hooks', [])
|
|
185
|
+
|
|
186
|
+
# 移除跨CLI协作Hook
|
|
187
|
+
hooks = [hook for hook in hooks if hook.get('name') != 'CrossCLINotificationHook']
|
|
188
|
+
|
|
189
|
+
config['hooks'] = hooks
|
|
190
|
+
|
|
191
|
+
f.seek(0)
|
|
192
|
+
f.truncate()
|
|
193
|
+
json.dump(config, f, indent=2, ensure_ascii=False)
|
|
194
|
+
config_updated = True
|
|
195
|
+
|
|
196
|
+
print(f"🗑️ Qoder跨CLI协作集成已卸载")
|
|
197
|
+
return True
|
|
198
|
+
except Exception as e:
|
|
199
|
+
print(f"❌ 卸载失败: {e}")
|
|
200
|
+
return False
|
|
201
|
+
|
|
202
|
+
def main():
|
|
203
|
+
parser = argparse.ArgumentParser(
|
|
204
|
+
description="Qoder CLI跨CLI协作集成安装脚本",
|
|
205
|
+
formatter_class=argparse.RawDescriptionHelpFormatter
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
parser.add_argument(
|
|
209
|
+
"--install",
|
|
210
|
+
action="store_true",
|
|
211
|
+
help="安装Qoder CLI跨CLI协作集成"
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
parser.add_argument(
|
|
215
|
+
"--verify",
|
|
216
|
+
action="store_true",
|
|
217
|
+
help="验证Qoder CLI集成安装"
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
parser.add_argument(
|
|
221
|
+
"--uninstall",
|
|
222
|
+
action="store_true",
|
|
223
|
+
help="卸载Qoder CLI跨CLI协作集成"
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
args = parser.parse_args()
|
|
227
|
+
|
|
228
|
+
print("[CONFIG] Qoder CLI跨CLI协作集成安装器")
|
|
229
|
+
print("=" * 50)
|
|
230
|
+
|
|
231
|
+
if args.uninstall:
|
|
232
|
+
print("[UNINSTALL] 卸载模式...")
|
|
233
|
+
success = uninstall_qoder_integration()
|
|
234
|
+
elif args.verify:
|
|
235
|
+
print("🔍 验证模式...")
|
|
236
|
+
success = verify_installation()
|
|
237
|
+
elif args.install or len(sys.argv) == 1:
|
|
238
|
+
print("📦 安装模式...")
|
|
239
|
+
|
|
240
|
+
# 1. 安装配置
|
|
241
|
+
config_success = install_qoder_hooks()
|
|
242
|
+
|
|
243
|
+
# 2. 复制适配器文件
|
|
244
|
+
adapter_success = copy_adapter_file()
|
|
245
|
+
|
|
246
|
+
success = config_success and adapter_success
|
|
247
|
+
|
|
248
|
+
if success:
|
|
249
|
+
print("\n🎉 Qoder CLI跨CLI协作集成安装成功!")
|
|
250
|
+
print("\n[INFO] 安装摘要:")
|
|
251
|
+
print(f" [OK] 配置文件: {QODER_CONFIG_FILE}")
|
|
252
|
+
print(f" [OK] 适配器目录: {os.path.dirname(QODER_CONFIG_FILE)}")
|
|
253
|
+
print(f" [OK] 跨CLI协作Hook: 已启用")
|
|
254
|
+
|
|
255
|
+
print("\n[INSTALL] 下一步:")
|
|
256
|
+
print(" 1. 运行其他CLI工具的安装脚本")
|
|
257
|
+
print(" 2. 使用 ai-cli-router deploy --all 安装所有工具")
|
|
258
|
+
print(" 3. 使用 ai-cli-router init 初始化项目")
|
|
259
|
+
else:
|
|
260
|
+
print("\n❌ Qoder CLI跨CLI协作集成安装失败")
|
|
261
|
+
else:
|
|
262
|
+
parser.print_help()
|
|
263
|
+
|
|
264
|
+
if __name__ == "__main__":
|
|
265
|
+
main()
|