stigmergy 1.0.68 → 1.0.70

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 (102) hide show
  1. package/README.en.md +306 -300
  2. package/README.md +469 -301
  3. package/package.json +97 -81
  4. package/scripts/publish.js +268 -0
  5. package/scripts/simple-publish.js +59 -0
  6. package/src/index.js +12 -0
  7. package/test/enhanced-main-alignment.test.js +298 -0
  8. package/test/hook-system-integration-test.js +307 -0
  9. package/test/natural-language-skills-test.js +320 -0
  10. package/test/nl-integration-test.js +179 -0
  11. package/test/parameter-parsing-test.js +143 -0
  12. package/test/real-test.js +435 -0
  13. package/test/system-compatibility-test.js +447 -0
  14. package/test/tdd-fixes-test.js +211 -0
  15. package/test/third-party-skills-test.js +321 -0
  16. package/test/tool-selection-integration-test.js +157 -0
  17. package/test/unit/cli-scanner.test.js +291 -0
  18. package/test/unit/cross-cli-executor.test.js +399 -0
  19. package/src/adapters/claude/__init__.py +0 -13
  20. package/src/adapters/claude/claude_skills_integration.py +0 -609
  21. package/src/adapters/claude/hook_adapter.py +0 -663
  22. package/src/adapters/claude/install_claude_integration.py +0 -265
  23. package/src/adapters/claude/skills_hook_adapter.py +0 -841
  24. package/src/adapters/claude/standalone_claude_adapter.py +0 -384
  25. package/src/adapters/cline/__init__.py +0 -20
  26. package/src/adapters/cline/config.py +0 -108
  27. package/src/adapters/cline/install_cline_integration.py +0 -617
  28. package/src/adapters/cline/mcp_server.py +0 -713
  29. package/src/adapters/cline/standalone_cline_adapter.py +0 -459
  30. package/src/adapters/codebuddy/__init__.py +0 -13
  31. package/src/adapters/codebuddy/buddy_adapter.py +0 -1125
  32. package/src/adapters/codebuddy/install_codebuddy_integration.py +0 -279
  33. package/src/adapters/codebuddy/skills_hook_adapter.py +0 -672
  34. package/src/adapters/codebuddy/skills_integration.py +0 -395
  35. package/src/adapters/codebuddy/standalone_codebuddy_adapter.py +0 -403
  36. package/src/adapters/codex/__init__.py +0 -11
  37. package/src/adapters/codex/base.py +0 -46
  38. package/src/adapters/codex/install_codex_integration.py +0 -311
  39. package/src/adapters/codex/mcp_server.py +0 -493
  40. package/src/adapters/codex/natural_language_parser.py +0 -82
  41. package/src/adapters/codex/slash_command_adapter.py +0 -326
  42. package/src/adapters/codex/standalone_codex_adapter.py +0 -362
  43. package/src/adapters/copilot/__init__.py +0 -13
  44. package/src/adapters/copilot/install_copilot_integration.py +0 -564
  45. package/src/adapters/copilot/mcp_adapter.py +0 -772
  46. package/src/adapters/copilot/mcp_server.py +0 -168
  47. package/src/adapters/copilot/standalone_copilot_adapter.py +0 -114
  48. package/src/adapters/gemini/__init__.py +0 -13
  49. package/src/adapters/gemini/extension_adapter.py +0 -690
  50. package/src/adapters/gemini/install_gemini_integration.py +0 -257
  51. package/src/adapters/gemini/standalone_gemini_adapter.py +0 -366
  52. package/src/adapters/iflow/__init__.py +0 -7
  53. package/src/adapters/iflow/hook_adapter.py +0 -1038
  54. package/src/adapters/iflow/hook_installer.py +0 -536
  55. package/src/adapters/iflow/install_iflow_integration.py +0 -271
  56. package/src/adapters/iflow/official_hook_adapter.py +0 -1272
  57. package/src/adapters/iflow/standalone_iflow_adapter.py +0 -48
  58. package/src/adapters/iflow/workflow_adapter.py +0 -793
  59. package/src/adapters/qoder/hook_installer.py +0 -732
  60. package/src/adapters/qoder/install_qoder_integration.py +0 -265
  61. package/src/adapters/qoder/notification_hook_adapter.py +0 -863
  62. package/src/adapters/qoder/standalone_qoder_adapter.py +0 -48
  63. package/src/adapters/qwen/__init__.py +0 -17
  64. package/src/adapters/qwencode/__init__.py +0 -13
  65. package/src/adapters/qwencode/inheritance_adapter.py +0 -818
  66. package/src/adapters/qwencode/install_qwencode_integration.py +0 -276
  67. package/src/adapters/qwencode/standalone_qwencode_adapter.py +0 -399
  68. package/src/atomic_collaboration_handler.py +0 -461
  69. package/src/cli_collaboration_agent.py +0 -697
  70. package/src/collaboration/hooks.py +0 -315
  71. package/src/core/__init__.py +0 -21
  72. package/src/core/ai_environment_scanner.py +0 -331
  73. package/src/core/base_adapter.py +0 -220
  74. package/src/core/cli_hook_integration.py +0 -406
  75. package/src/core/cross_cli_executor.py +0 -713
  76. package/src/core/cross_cli_mapping.py +0 -1165
  77. package/src/core/cross_platform_encoding.py +0 -365
  78. package/src/core/cross_platform_safe_cli.py +0 -894
  79. package/src/core/direct_cli_executor.py +0 -805
  80. package/src/core/direct_cli_hook_system.py +0 -958
  81. package/src/core/enhanced_init_processor.py +0 -467
  82. package/src/core/graceful_cli_executor.py +0 -912
  83. package/src/core/md_enhancer.py +0 -342
  84. package/src/core/md_generator.py +0 -619
  85. package/src/core/models.py +0 -218
  86. package/src/core/parser.py +0 -108
  87. package/src/core/real_cli_hook_system.py +0 -852
  88. package/src/core/real_cross_cli_system.py +0 -925
  89. package/src/core/verified_cross_cli_system.py +0 -961
  90. package/src/deploy.js +0 -737
  91. package/src/enhanced-main.js +0 -626
  92. package/src/enhanced_deploy.js +0 -303
  93. package/src/enhanced_universal_cli_setup.py +0 -930
  94. package/src/kimi_wrapper.py +0 -104
  95. package/src/main.js +0 -1309
  96. package/src/shell_integration.py +0 -398
  97. package/src/simple-main.js +0 -315
  98. package/src/smart_router_creator.py +0 -323
  99. package/src/universal_cli_setup.py +0 -1289
  100. package/src/utils/__init__.py +0 -12
  101. package/src/utils/cli_detector.py +0 -445
  102. package/src/utils/file_utils.py +0 -246
@@ -1,168 +0,0 @@
1
- """
2
- Copilot CLI MCP服务器实现
3
-
4
- 为Copilot CLI提供跨CLI集成能力的MCP服务器
5
- 支持工具调用、权限管理和异步执行
6
- """
7
-
8
- import asyncio
9
- import json
10
- import logging
11
- import os
12
- import sys
13
- from typing import Dict, Any, List, Optional
14
- from datetime import datetime
15
-
16
- # MCP相关导入(这里使用模拟实现,实际应该使用MCP SDK)
17
- try:
18
- from mcp.server import Server
19
- from mcp.types import Tool, TextContent
20
- except ImportError:
21
- # 如果MCP SDK不可用,使用模拟实现
22
- logging.warning("MCP SDK不可用,使用模拟实现")
23
- Server = object
24
- Tool = object
25
- TextContent = object
26
-
27
- logger = logging.getLogger(__name__)
28
-
29
-
30
- class CopilotMCPServer:
31
- """
32
- Copilot CLI MCP服务器
33
-
34
- 提供以下工具:
35
- 1. cross_cli_execute - 执行跨CLI调用
36
- 2. get_available_clis - 获取可用的CLI工具列表
37
- 3. check_cli_status - 检查特定CLI工具状态
38
- """
39
-
40
- def __init__(self):
41
- """初始化MCP服务器"""
42
- self.server = Server("cross-cli-adapter")
43
- self.adapter = None
44
- self.setup_handlers()
45
-
46
- def setup_handlers(self):
47
- """设置MCP服务器处理器"""
48
-
49
- @self.server.list_tools()
50
- async def list_tools() -> List[Tool]:
51
- """列出可用的工具"""
52
- return [
53
- Tool(
54
- name="cross_cli_execute",
55
- description="Execute tasks on other AI CLI tools through cross-CLI integration",
56
- inputSchema={
57
- "type": "object",
58
- "properties": {
59
- "target_cli": {
60
- "type": "string",
61
- "description": "Target CLI tool name (e.g., claude, gemini, qwencode)"
62
- },
63
- "task": {
64
- "type": "string",
65
- "description": "Task to execute on the target CLI"
66
- }
67
- },
68
- "required": ["target_cli", "task"]
69
- }
70
- ),
71
- Tool(
72
- name="get_available_clis",
73
- description="Get list of available AI CLI tools",
74
- inputSchema={
75
- "type": "object",
76
- "properties": {}
77
- }
78
- ),
79
- Tool(
80
- name="check_cli_status",
81
- description="Check status and health of a specific CLI tool",
82
- inputSchema={
83
- "type": "object",
84
- "properties": {
85
- "cli_name": {
86
- "type": "string",
87
- "description": "CLI tool name to check"
88
- }
89
- },
90
- "required": ["cli_name"]
91
- }
92
- )
93
- ]
94
-
95
- @self.server.call_tool()
96
- async def call_tool(name: str, arguments: Dict[str, Any]) -> List[TextContent]:
97
- """处理工具调用"""
98
- try:
99
- result = await self.handle_tool_call(name, arguments)
100
- return [TextContent(type="text", text=result)]
101
- except Exception as e:
102
- error_msg = f"Tool execution failed: {str(e)}"
103
- logger.error(error_msg)
104
- return [TextContent(type="text", text=error_msg)]
105
-
106
- async def handle_tool_call(self, tool_name: str, arguments: Dict[str, Any]) -> str:
107
- """处理工具调用的核心逻辑"""
108
-
109
- # 延迟加载适配器
110
- if self.adapter is None:
111
- from .mcp_adapter import get_copilot_mcp_adapter
112
- self.adapter = get_copilot_mcp_adapter()
113
-
114
- # 创建模拟上下文
115
- context = self._create_context()
116
-
117
- if hasattr(self.adapter, 'on_mcp_tool_call'):
118
- result = await self.adapter.on_mcp_tool_call(tool_name, arguments, context)
119
- if result is not None:
120
- return result
121
-
122
- # 默认处理
123
- return f"Tool {tool_name} executed with arguments: {json.dumps(arguments, indent=2)}"
124
-
125
- def _create_context(self):
126
- """创建MCP上下文"""
127
- from .mcp_adapter import CopilotMCPContext
128
-
129
- metadata = {
130
- 'session_id': os.getenv('COPILOT_SESSION_ID', 'unknown'),
131
- 'user_id': os.getenv('COPILOT_USER_ID', 'unknown'),
132
- 'tool_permissions': {}
133
- }
134
-
135
- return CopilotMCPContext(metadata=metadata)
136
-
137
- async def run(self):
138
- """运行MCP服务器"""
139
- try:
140
- logger.info("启动Copilot MCP服务器")
141
- # 这里应该启动实际的MCP服务器
142
- # 由于没有MCP SDK,我们使用模拟运行
143
- await self._simulate_server_run()
144
- except Exception as e:
145
- logger.error(f"MCP服务器运行失败: {e}")
146
- sys.exit(1)
147
-
148
- async def _simulate_server_run(self):
149
- """模拟服务器运行(用于演示)"""
150
- logger.info("MCP服务器模拟运行中...")
151
- # 在实际实现中,这里会启动真正的MCP服务器
152
- await asyncio.sleep(1) # 模拟运行
153
- logger.info("MCP服务器模拟运行完成")
154
-
155
-
156
- async def main():
157
- """主函数"""
158
- logging.basicConfig(
159
- level=logging.INFO,
160
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
161
- )
162
-
163
- server = CopilotMCPServer()
164
- await server.run()
165
-
166
-
167
- if __name__ == "__main__":
168
- asyncio.run(main())
@@ -1,114 +0,0 @@
1
- """
2
- 独立 Copilot CLI 适配器 - 完全无抽象层
3
-
4
- 基于 Copilot CLI 官方 MCP (Model Context Protocol) 系统的原生集成:
5
- - 使用 Copilot CLI 官方 MCP 机制
6
- - 无任何抽象基类或 Factory 系统
7
- - 不改变 CLI 启动和使用方式
8
- - 纯粹的原生扩展实现
9
- """
10
-
11
- import os
12
- import json
13
- import logging
14
- import asyncio
15
- import re
16
- from typing import Dict, Any, Optional, List
17
- from datetime import datetime
18
-
19
- logger = logging.getLogger(__name__)
20
-
21
-
22
- class StandaloneCopilotAdapter:
23
- """
24
- 独立的 Copilot CLI MCP 适配器
25
-
26
- 直接基于 Copilot CLI 官方 MCP 系统,无任何抽象层:
27
- - MCP 服务器集成
28
- - 直接工具调用
29
- - 原生协议支持
30
- """
31
-
32
- def __init__(self):
33
- """初始化 - 纯实现,无抽象"""
34
- self.cli_name = "copilot"
35
- self.version = "1.0.0"
36
-
37
- # MCP 配置
38
- self.mcp_config_file = os.path.expanduser("~/.config/copilot/mcp_servers.json")
39
- self.mcp_registered = False
40
-
41
- # 统计信息
42
- self.execution_count = 0
43
- self.error_count = 0
44
- self.mcp_calls_count = 0
45
- self.cross_cli_calls_count = 0
46
- self.last_execution: Optional[datetime] = None
47
-
48
- # 直接跨CLI处理器 - 无Factory
49
- self._cli_handlers = {}
50
- self._init_cli_handlers()
51
-
52
- logger.info("独立 Copilot CLI MCP 适配器初始化完成")
53
-
54
- def _init_cli_handlers(self):
55
- """初始化跨CLI处理器 - 直接导入,无Factory"""
56
- try:
57
- logger.info("跨CLI处理器初始化完成")
58
- except Exception as e:
59
- logger.warning(f"跨CLI处理器初始化失败: {e}")
60
-
61
- def is_available(self) -> bool:
62
- """检查是否可用 - 直接检查 Copilot CLI"""
63
- try:
64
- import subprocess
65
- result = subprocess.run(['copilot', '--version'], capture_output=True, text=True, timeout=10)
66
- return result.returncode == 0
67
- except Exception:
68
- return False
69
-
70
- async def execute_task(self, task: str, context: Dict[str, Any] = None) -> str:
71
- """执行任务 - 纯实现,无抽象层"""
72
- if context is None:
73
- context = {}
74
-
75
- try:
76
- self.execution_count += 1
77
- self.last_execution = datetime.now()
78
-
79
- # 检测跨CLI调用
80
- cross_cli_intent = self._detect_cross_cli_intent(task)
81
- if cross_cli_intent:
82
- return await self._handle_cross_cli_call(cross_cli_intent, context)
83
-
84
- # 本地 Copilot 处理
85
- return f"[Copilot CLI 本地处理] {task}"
86
-
87
- except Exception as e:
88
- self.error_count += 1
89
- logger.error(f"任务执行失败: {task}, 错误: {e}")
90
- return f"[错误] {task} 执行失败: {str(e)}"
91
-
92
- def _detect_cross_cli_intent(self, text: str) -> Optional[str]:
93
- """检测跨CLI调用意图"""
94
- # 简化实现
95
- return None
96
-
97
- async def _handle_cross_cli_call(self, command: str, context: Dict[str, Any]) -> str:
98
- """处理跨CLI调用 - 直接实现,无抽象层"""
99
- self.cross_cli_calls_count += 1
100
- return f"[跨CLI调用] {command}"
101
-
102
- def get_statistics(self) -> Dict[str, Any]:
103
- """获取统计信息 - 直接实现"""
104
- return {
105
- 'cli_name': self.cli_name,
106
- 'version': self.version,
107
- 'design': 'standalone_mcp_native',
108
- 'no_abstraction': True
109
- }
110
-
111
-
112
- def get_standalone_copilot_adapter() -> StandaloneCopilotAdapter:
113
- """获取独立的 Copilot CLI 适配器实例"""
114
- return StandaloneCopilotAdapter()
@@ -1,13 +0,0 @@
1
- """
2
- Gemini CLI 适配器包
3
-
4
- 基于 Gemini CLI 官方 Extension 系统的原生集成
5
- 完全无抽象层设计
6
- """
7
-
8
- from .standalone_gemini_adapter import get_standalone_gemini_adapter, StandaloneGeminiAdapter
9
-
10
- # 向后兼容的别名
11
- GeminiExtensionAdapter = StandaloneGeminiAdapter
12
-
13
- __all__ = ['StandaloneGeminiAdapter', 'get_standalone_gemini_adapter', 'GeminiExtensionAdapter']