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,311 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Codex CLI Slash Command集成安装脚本
|
|
3
|
+
为Codex CLI安装跨CLI协作感知能力
|
|
4
|
+
|
|
5
|
+
使用方法:
|
|
6
|
+
python install_codex_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
|
+
# Codex CLI配置路径
|
|
22
|
+
CODEX_CONFIG_DIR = os.path.expanduser("~/.config/codex")
|
|
23
|
+
CODEX_SLASH_COMMANDS_FILE = os.path.join(CODEX_CONFIG_DIR, "slash_commands.json")
|
|
24
|
+
|
|
25
|
+
def create_codex_config_directory():
|
|
26
|
+
"""创建Codex配置目录"""
|
|
27
|
+
os.makedirs(CODEX_CONFIG_DIR, exist_ok=True)
|
|
28
|
+
print(f"[OK] 创建Codex配置目录: {CODEX_CONFIG_DIR}")
|
|
29
|
+
|
|
30
|
+
def install_codex_slash_commands():
|
|
31
|
+
"""安装Codex Slash Command配置"""
|
|
32
|
+
# 读取现有slash_commands配置
|
|
33
|
+
existing_config = {}
|
|
34
|
+
if os.path.exists(CODEX_SLASH_COMMANDS_FILE):
|
|
35
|
+
try:
|
|
36
|
+
with open(CODEX_SLASH_COMMANDS_FILE, 'r', encoding='utf-8') as f:
|
|
37
|
+
existing_config = json.load(f)
|
|
38
|
+
except Exception as e:
|
|
39
|
+
print(f"⚠️ 读取现有slash_commands配置失败: {e}")
|
|
40
|
+
existing_config = {}
|
|
41
|
+
|
|
42
|
+
# 定义跨CLI协作的Slash Command配置
|
|
43
|
+
cross_cli_slash_commands = {
|
|
44
|
+
"init": {
|
|
45
|
+
"command": "init",
|
|
46
|
+
"description": "初始化跨CLI协作项目",
|
|
47
|
+
"module": "src.core.enhanced_init_processor",
|
|
48
|
+
"enabled": True,
|
|
49
|
+
"cross_cli_enabled": True,
|
|
50
|
+
"supported_clis": ["claude", "gemini", "qwencode", "iflow", "qoder", "codebuddy", "copilot"]
|
|
51
|
+
},
|
|
52
|
+
"scan": {
|
|
53
|
+
"command": "scan",
|
|
54
|
+
"description": "扫描AI环境中的CLI工具",
|
|
55
|
+
"module": "src.core.ai_environment_scanner",
|
|
56
|
+
"enabled": True,
|
|
57
|
+
"cross_cli_enabled": True,
|
|
58
|
+
"supported_clis": ["claude", "gemini", "qwencode", "iflow", "qoder", "codebuddy", "copilot"]
|
|
59
|
+
},
|
|
60
|
+
"status": {
|
|
61
|
+
"command": "status",
|
|
62
|
+
"description": "查看所有CLI工具的状态",
|
|
63
|
+
"module": "src.core.cli_hook_integration",
|
|
64
|
+
"enabled": True,
|
|
65
|
+
"cross_cli_enabled": True,
|
|
66
|
+
"supported_clis": ["claude", "gemini", "qwencode", "iflow", "qoder", "codebuddy", "copilot"]
|
|
67
|
+
},
|
|
68
|
+
"deploy": {
|
|
69
|
+
"command": "deploy",
|
|
70
|
+
"description": "部署所有CLI工具的协作插件",
|
|
71
|
+
"module": "src.core.cli_hook_integration",
|
|
72
|
+
"enabled": True,
|
|
73
|
+
"cross_cli_enabled": True,
|
|
74
|
+
"supported_clis": ["claude", "gemini", "qwencode", "iflow", "qoder", "codebuddy", "copilot"]
|
|
75
|
+
},
|
|
76
|
+
"call": {
|
|
77
|
+
"command": "call",
|
|
78
|
+
"description": "调用其他CLI工具执行任务",
|
|
79
|
+
"module": "src.core.cli_hook_integration",
|
|
80
|
+
"enabled": True,
|
|
81
|
+
"cross_cli_enabled": True,
|
|
82
|
+
"supported_clis": ["claude", "gemini", "qwencode", "iflow", "qoder", "codebuddy", "copilot"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# 合并配置(保留现有slash_commands,添加协作功能)
|
|
87
|
+
merged_config = existing_config.copy()
|
|
88
|
+
if 'slash_commands' not in merged_config:
|
|
89
|
+
merged_config['slash_commands'] = {}
|
|
90
|
+
|
|
91
|
+
# 检查是否已存在跨CLI协作命令
|
|
92
|
+
existing_command_names = [cmd.get('command') for cmd in merged_config.get('slash_commands', {}).values()]
|
|
93
|
+
cross_cli_commands = ["init", "scan", "status", "deploy", "call"]
|
|
94
|
+
|
|
95
|
+
# 添加跨CLI协作Slash Commands(如果不存在)
|
|
96
|
+
for cmd_name, cmd_config in cross_cli_slash_commands.items():
|
|
97
|
+
if cmd_name not in existing_command_names:
|
|
98
|
+
merged_config['slash_commands'][cmd_name] = cmd_config
|
|
99
|
+
|
|
100
|
+
# 写入配置文件
|
|
101
|
+
try:
|
|
102
|
+
with open(CODEX_SLASH_COMMANDS_FILE, 'w', encoding='utf-8') as f:
|
|
103
|
+
json.dump(merged_config, f, indent=2, ensure_ascii=False)
|
|
104
|
+
|
|
105
|
+
print(f"[OK] Codex配置已安装: {CODEX_SLASH_COMMANDS_FILE}")
|
|
106
|
+
print("🔗 已安装的跨CLI协作命令:")
|
|
107
|
+
for cmd_name in cross_cli_commands:
|
|
108
|
+
cmd_config = merged_config['slash_commands'].get(cmd_name, {})
|
|
109
|
+
status = "[OK]" if cmd_config.get('enabled') else "❌"
|
|
110
|
+
print(f" - /{cmd_name}: {status} - {cmd_config.get('description')}")
|
|
111
|
+
|
|
112
|
+
return True
|
|
113
|
+
except Exception as e:
|
|
114
|
+
print(f"❌ 安装Codex配置失败: {e}")
|
|
115
|
+
return False
|
|
116
|
+
|
|
117
|
+
def copy_adapter_file():
|
|
118
|
+
"""复制适配器文件到Codex配置目录"""
|
|
119
|
+
try:
|
|
120
|
+
# 创建适配器目录
|
|
121
|
+
adapter_dir = CODEX_CONFIG_DIR
|
|
122
|
+
os.makedirs(adapter_dir, exist_ok=True)
|
|
123
|
+
|
|
124
|
+
# 复制适配器文件
|
|
125
|
+
adapter_files = [
|
|
126
|
+
"mcp_server.py",
|
|
127
|
+
"standalone_codex_adapter.py"
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
for file_name in adapter_files:
|
|
131
|
+
src_file = current_dir / file_name
|
|
132
|
+
dst_file = os.path.join(adapter_dir, file_name)
|
|
133
|
+
|
|
134
|
+
if src_file.exists():
|
|
135
|
+
shutil.copy2(src_file, dst_file)
|
|
136
|
+
print(f"[OK] 复制适配器文件: {file_name}")
|
|
137
|
+
else:
|
|
138
|
+
print(f"⚠️ 适配器文件不存在: {file_name}")
|
|
139
|
+
|
|
140
|
+
return True
|
|
141
|
+
except Exception as e:
|
|
142
|
+
print(f"❌ 复制适配器文件失败: {e}")
|
|
143
|
+
return False
|
|
144
|
+
|
|
145
|
+
def verify_installation():
|
|
146
|
+
"""验证安装是否成功"""
|
|
147
|
+
print("\n🔍 验证Codex CLI集成安装...")
|
|
148
|
+
|
|
149
|
+
# 检查配置文件
|
|
150
|
+
if not os.path.exists(CODEX_SLASH_COMMANDS_FILE):
|
|
151
|
+
print(f"❌ 配置文件不存在: {CODEX_SLASH_COMMANDS_FILE}")
|
|
152
|
+
return False
|
|
153
|
+
|
|
154
|
+
try:
|
|
155
|
+
with open(CODEX_SLASH_COMMANDS_FILE, 'r', encoding='utf-8') as f:
|
|
156
|
+
config = json.load(f)
|
|
157
|
+
|
|
158
|
+
slash_commands = config.get('slash_commands', {})
|
|
159
|
+
cross_cli_commands = ["init", "scan", "status", "deploy", "call"]
|
|
160
|
+
|
|
161
|
+
# 验证跨CLI协作命令
|
|
162
|
+
all_commands_found = True
|
|
163
|
+
for cmd_name in cross_cli_commands:
|
|
164
|
+
cmd_config = slash_commands.get(cmd_name, {})
|
|
165
|
+
if not cmd_config:
|
|
166
|
+
all_commands_found = False
|
|
167
|
+
break
|
|
168
|
+
if not cmd_config.get('cross_cli_enabled'):
|
|
169
|
+
all_commands_found = False
|
|
170
|
+
break
|
|
171
|
+
|
|
172
|
+
if all_commands_found:
|
|
173
|
+
print("[OK] 跨CLI协作Slash Commands已安装")
|
|
174
|
+
for cmd_name in cross_cli_commands:
|
|
175
|
+
cmd_config = slash_commands.get(cmd_name, {})
|
|
176
|
+
status = "[OK]" if cmd_config.get('enabled') else "❌"
|
|
177
|
+
print(f" - /{cmd_name}: {status} - {cmd_config.get('description')}")
|
|
178
|
+
else:
|
|
179
|
+
print("❌ 跨CLI协作Slash Commands未完全安装")
|
|
180
|
+
return False
|
|
181
|
+
|
|
182
|
+
# 检查适配器文件
|
|
183
|
+
required_files = ["mcp_server.py"]
|
|
184
|
+
missing_files = []
|
|
185
|
+
|
|
186
|
+
for file_name in required_files:
|
|
187
|
+
file_path = os.path.join(CODEX_CONFIG_DIR, file_name)
|
|
188
|
+
if not os.path.exists(file_path):
|
|
189
|
+
missing_files.append(file_name)
|
|
190
|
+
|
|
191
|
+
if missing_files:
|
|
192
|
+
print(f"❌ 缺失适配器文件: {missing_files}")
|
|
193
|
+
return False
|
|
194
|
+
else:
|
|
195
|
+
print("[OK] 适配器文件已复制")
|
|
196
|
+
|
|
197
|
+
return True
|
|
198
|
+
except Exception as e:
|
|
199
|
+
print(f"❌ 验证失败: {e}")
|
|
200
|
+
return False
|
|
201
|
+
|
|
202
|
+
def uninstall_codex_integration():
|
|
203
|
+
"""卸载Codex集成"""
|
|
204
|
+
try:
|
|
205
|
+
# 备份现有配置
|
|
206
|
+
if os.path.exists(CODEX_SLASH_COMMANDS_FILE):
|
|
207
|
+
backup_file = f"{CODEX_SLASH_COMMANDS_FILE}.backup_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
|
|
208
|
+
shutil.copy2(CODEX_SLASH_COMMANDS_FILE, backup_file)
|
|
209
|
+
print(f"📦 已备份现有配置: {backup_file}")
|
|
210
|
+
|
|
211
|
+
# 移除跨CLI协作Slash Commands
|
|
212
|
+
config_updated = False
|
|
213
|
+
if os.path.exists(CODEX_SLASH_COMMANDS_FILE):
|
|
214
|
+
with open(CODEX_SLASH_COMMANDS_FILE, 'r+', encoding='utf-8') as f:
|
|
215
|
+
config = json.load(f)
|
|
216
|
+
slash_commands = config.get('slash_commands', {})
|
|
217
|
+
|
|
218
|
+
# 禁用跨CLI协作命令
|
|
219
|
+
for cmd_name in ["init", "scan", "status", "deploy", "call"]:
|
|
220
|
+
if cmd_name in slash_commands:
|
|
221
|
+
slash_commands[cmd_name]['cross_cli_enabled'] = False
|
|
222
|
+
|
|
223
|
+
f.seek(0)
|
|
224
|
+
f.truncate()
|
|
225
|
+
json.dump({
|
|
226
|
+
'slash_commands': slash_commands,
|
|
227
|
+
'version': config.get('version', '1.0.0')
|
|
228
|
+
}, f, indent=2, ensure_ascii=False)
|
|
229
|
+
config_updated = True
|
|
230
|
+
|
|
231
|
+
print(f"🗑️ Codex跨CLI协作集成已卸载")
|
|
232
|
+
return True
|
|
233
|
+
except Exception as e:
|
|
234
|
+
print(f"❌ 卸载失败: {e}")
|
|
235
|
+
return False
|
|
236
|
+
|
|
237
|
+
def main():
|
|
238
|
+
parser = argparse.ArgumentParser(
|
|
239
|
+
description="Codex CLI跨CLI协作集成安装脚本",
|
|
240
|
+
formatter_class=argparse.RawDescriptionHelpFormatter
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
parser.add_argument(
|
|
244
|
+
"--install",
|
|
245
|
+
action="store_true",
|
|
246
|
+
help="安装Codex CLI跨CLI协作集成"
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
parser.add_argument(
|
|
250
|
+
"--verify",
|
|
251
|
+
action="store_true",
|
|
252
|
+
help="验证Codex CLI集成安装"
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
parser.add_argument(
|
|
256
|
+
"--uninstall",
|
|
257
|
+
action="store_true",
|
|
258
|
+
help="卸载Codex CLI跨CLI协作集成"
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
args = parser.parse_args()
|
|
262
|
+
|
|
263
|
+
print("[INSTALL] Codex CLI跨CLI协作集成安装器")
|
|
264
|
+
print("=" * 50)
|
|
265
|
+
|
|
266
|
+
if args.uninstall:
|
|
267
|
+
print("🗑️ 卸载模式...")
|
|
268
|
+
success = uninstall_codex_integration()
|
|
269
|
+
elif args.verify:
|
|
270
|
+
print("🔍 验证模式...")
|
|
271
|
+
success = verify_installation()
|
|
272
|
+
elif args.install or len(sys.argv) == 1:
|
|
273
|
+
print("📦 安装模式...")
|
|
274
|
+
|
|
275
|
+
# 1. 创建配置目录
|
|
276
|
+
print("1️⃣ 创建配置目录...")
|
|
277
|
+
create_codex_config_directory()
|
|
278
|
+
|
|
279
|
+
# 2. 安装Slash Commands配置
|
|
280
|
+
print("2️⃣ 安装Slash Commands配置...")
|
|
281
|
+
config_success = install_codex_slash_commands()
|
|
282
|
+
|
|
283
|
+
# 3. 复制适配器文件
|
|
284
|
+
print("3️⃣ 复制适配器文件...")
|
|
285
|
+
adapter_success = copy_adapter_file()
|
|
286
|
+
|
|
287
|
+
# 4. 验证安装
|
|
288
|
+
print("4️⃣ 验证安装...")
|
|
289
|
+
verify_success = verify_installation()
|
|
290
|
+
|
|
291
|
+
success = config_success and adapter_success and verify_success
|
|
292
|
+
|
|
293
|
+
if success:
|
|
294
|
+
print("\n🎉 Codex CLI跨CLI协作集成安装成功!")
|
|
295
|
+
print("\n[INFO] 安装摘要:")
|
|
296
|
+
print(f" [OK] 配置目录: {CODEX_CONFIG_DIR}")
|
|
297
|
+
print(f" [OK] 配置文件: {CODEX_SLASH_COMMANDS_FILE}")
|
|
298
|
+
print(f" [OK] 适配器目录: {CODEX_CONFIG_DIR}")
|
|
299
|
+
print(f" [OK] 跨CLI协作Slash Commands: 已启用")
|
|
300
|
+
|
|
301
|
+
print("\n[INSTALL] 下一步:")
|
|
302
|
+
print(" 1. 安装其他CLI工具的集成")
|
|
303
|
+
print(" 2. 使用 ai-cli-router deploy --all")
|
|
304
|
+
print(" 3. 使用 ai-cli-router init 初始化项目")
|
|
305
|
+
else:
|
|
306
|
+
print("\n❌ Codex CLI跨CLI协作集成安装失败")
|
|
307
|
+
else:
|
|
308
|
+
parser.print_help()
|
|
309
|
+
|
|
310
|
+
if __name__ == "__main__":
|
|
311
|
+
main()
|