bugx-cli 0.1.3 → 0.1.5
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/core/README.md +5 -3
- package/core/agent/agent_execution.py +7 -0
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/bugx.md +2 -2
- package/core/bugx_paths.py +10 -2
- package/core/bundled_docs/OVERVIEW.md +311 -0
- package/core/bundled_docs/README.md +10 -0
- package/core/bundled_docs/README_EN.md +278 -0
- package/core/bundled_docs/ai/01_AI_REFERENCE.md +838 -0
- package/core/bundled_docs/ai/02_AI_USAGE.md +161 -0
- package/core/bundled_docs/ai/03_AI_COMMANDS.md +322 -0
- package/core/bundled_docs/guides/01_USER_GUIDE.md +887 -0
- package/core/bundled_docs/guides/02_COMMANDS.md +935 -0
- package/core/bundled_docs/guides/03_TROUBLESHOOTING.md +763 -0
- package/core/bundled_docs/guides/04_CLOUD_AUTH_AND_SYNC_COOKBOOK.md +48 -0
- package/core/bundled_docs/guides/05_HOST_MATRIX_AND_DISPATCH.md +25 -0
- package/core/bundled_docs/guides/06_PROBES_AND_POC_COOKBOOK.md +49 -0
- package/core/bundled_docs/guides/07_LIFECYCLE_AND_RECOVERY_STATES.md +46 -0
- package/core/bundled_docs/guides/08_LESSONS_AND_PRIVACY_BOUNDARY.md +35 -0
- package/core/bundled_docs/hosts/bugx-claude_SKILL.md +326 -0
- package/core/bundled_docs/hosts/bugx-dsh_SKILL.md +229 -0
- package/core/bundled_docs/hosts/bugx-opencode_SKILL.md +129 -0
- package/core/bundled_docs/hosts/bugx-zcode_SKILL.md +459 -0
- package/core/bundled_docs/hosts/bugx_SKILL.md +118 -0
- package/core/bundled_docs/hosts/cline_bugx_SKILL.md +69 -0
- package/core/bundled_docs/hosts/platform_bugx_SKILL.md +50 -0
- package/core/bundled_docs/manifest.json +140 -0
- package/core/bundled_docs/reference/01_ENVIRONMENT_VARIABLES.md +422 -0
- package/core/bundled_docs/reference/04_REPOSITORY_TOPOLOGY.md +180 -0
- package/core/cli-help.txt +7 -3
- package/core/cloud_sync/cloud_client.py +81 -2
- package/core/cloud_sync/endpoint_router.py +22 -9
- package/core/cloud_sync/issue_uploader.py +297 -0
- package/core/cloud_sync/sensitive_filter.py +77 -7
- package/core/contracts/AGENT_GUIDE.md +3 -9
- package/core/contracts/README.md +1 -1
- package/core/contracts/bugx-runtime-contract.md +10 -20
- package/core/contracts/bugx-worker.md +1 -1
- package/core/coverage/coverage_ai_review.py +15 -11
- package/core/coverage/coverage_bootstrap.py +18 -13
- package/core/coverage/coverage_discovery.py +1 -1
- package/core/dev_harness/interaction_preset.py +1 -1
- package/core/engine-integrity.json +283 -159
- package/core/host_acp/README.md +4 -0
- package/core/host_acp/agnescode.py +128 -0
- package/core/host_acp/antigravity.py +153 -0
- package/core/host_runtime/README.md +3 -0
- package/core/host_runtime/adapters.py +5 -1
- package/core/host_runtime/antigravity.py +162 -0
- package/core/host_runtime/host_bootstrap.py +18 -7
- package/core/host_runtime/host_evaluators.py +4 -4
- package/core/host_runtime/host_registry.py +3 -1
- package/core/host_runtime/mcp_process_tracker.py +30 -3
- package/core/host_runtime/mcp_registry_gate.py +34 -11
- package/core/hosts/README.md +4 -0
- package/core/hosts/agnescode.py +415 -0
- package/core/hosts/antigravity.py +115 -0
- package/core/hosts/codex.py +3 -0
- package/core/hosts/dsh.py +42 -23
- package/core/hosts/minimax.py +5 -4
- package/core/hosts/opencode.py +11 -3
- package/core/i18n.py +94 -5
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +2 -2
- package/core/infra/python_runtime.py +4 -1
- package/core/launch_phases/README.md +2 -2
- package/core/launch_phases/finding_confirm_phase.py +1 -1
- package/core/launch_phases/semantic_recon.py +3 -19
- package/core/launch_phases/startup_version_gate.py +2 -2
- package/core/launch_phases/supervisor_bridge.py +2 -0
- package/core/launch_phases/supervisor_degraded.py +7 -5
- package/core/launch_phases/verify_loop.py +3 -19
- package/core/ledger/README.md +1 -1
- package/core/ledger/finding_confirmation.py +1 -1
- package/core/ledger/finding_verification.py +2 -20
- package/core/ledger/fp_ledger.py +3 -19
- package/core/ledger/life_ledger.py +7 -33
- package/core/ledger/schema.py +1 -1
- package/core/locales/en-US.json +3 -3
- package/core/locales/zh-CN.json +3 -3
- package/core/mcp_handlers/supervisor_handlers.py +1 -1
- package/core/mcp_runtime_support/common.py +6 -0
- package/core/mcp_runtime_support/environment.py +88 -24
- package/core/metadata.txt +1 -1
- package/core/planning/README.md +1 -1
- package/core/planning/prompt_harness.py +2 -2
- package/core/planning/target_sandbox_manager.py +2 -0
- package/core/probes/codebase_memory_probe.py +43 -24
- package/core/probes/mobile_probe.py +1 -0
- package/core/probes/probe_registry.py +10 -7
- package/core/probes/sast_probe.py +1 -1
- package/core/probes/sca_scanner.py +1 -1
- package/core/project_profiler/constants.py +1 -1
- package/core/prompts/command_routing_en.md +6 -5
- package/core/prompts/command_routing_zh.md +6 -5
- package/core/repair/rsi_rounds.py +3 -0
- package/core/repair/self_heal.py +160 -6
- package/core/retrieval/README.md +1 -1
- package/core/retrieval/symbol_index.py +227 -52
- package/core/runtime/README.md +1 -1
- package/core/runtime/daemon_runner.py +3 -2
- package/core/runtime/project_init.py +1 -1
- package/core/runtime/scenario_eval.py +5 -1
- package/core/runtime/tool_install_targets.py +12 -2
- package/core/skills/README.md +4 -2
- package/core/skills/bugx_docs_cloud_sync.py +658 -0
- package/core/skills/bugx_docs_mcp_server.py +966 -140
- package/core/skills/bugx_mcp_server.py +9 -0
- package/core/skills/mcp_session_proof.py +3 -31
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/finding_commit.py +3 -24
- package/core/supervisor/task_scheduler.py +5 -2
- package/core/supervisor/worker_execution.py +16 -3
- package/core/supervisor/worker_handoff.py +2 -2
- package/core/webui/docs_session_service.py +40 -2
- package/core/webui/mcp_inspector.py +6 -6
- package/ecosystem/integrations/cline/skills/bugx/SKILL.md +46 -46
- package/ecosystem/integrations/dsh/agents/bugx.md +2 -1
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +5 -5
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +4 -4
- package/ecosystem/integrations/opencode/mcp-lock.json +1 -1
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/pi/skills/bugx/SKILL.md +5 -5
- package/ecosystem/integrations/qoder/CONNECTORS.md +11 -23
- package/ecosystem/integrations/qoder/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +8 -7
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/agents/bugx-worker.md +14 -18
- package/ecosystem/plugins/bugx/agents/bugx.md +45 -49
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +7 -7
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +2 -2
- package/interfaces/cli/bugx_cli/__init__.py +1 -1
- package/interfaces/cli/bugx_cli/cli.py +153 -8
- package/interfaces/cli/bugx_cli/commands/agent.py +376 -69
- package/interfaces/cli/bugx_cli/commands/audit.py +2 -1
- package/interfaces/cli/bugx_cli/commands/cloud.py +42 -1
- package/interfaces/cli/bugx_cli/commands/doctor.py +650 -223
- package/interfaces/cli/bugx_cli/commands/guide.py +143 -0
- package/interfaces/cli/bugx_cli/commands/issue.py +262 -0
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +56 -26
- package/interfaces/cli/bugx_cli/commands/patch.py +5 -1
- package/interfaces/cli/bugx_cli/commands/plugin.py +306 -56
- package/interfaces/cli/bugx_cli/commands/plugin_antigravity.py +350 -0
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +2 -2
- package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +154 -62
- package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +308 -108
- package/interfaces/cli/bugx_cli/commands/system.py +11 -1
- package/interfaces/cli/bugx_cli/common.py +39 -8
- package/interfaces/cli/bugx_cli/host_adapters.py +46 -3
- package/interfaces/cli/bugx_cli/hosts/registry.py +3 -2
- package/interfaces/cli/bugx_cli/hosts/template_engine.py +21 -2
- package/interfaces/cli/bugx_cli/infra/__init__.py +4 -0
- package/interfaces/cli/bugx_cli/infra/ai_advisor.py +14 -12
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +76 -10
- package/interfaces/cli/bugx_cli/infra/host_sync.py +66 -1
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +240 -50
- package/package.json +3 -2
- package/pyproject.toml +22 -2
- package/scripts/sync-version.mjs +1 -1
- package/skills/README.md +1 -2
- package/skills/platform/bugx/SKILL.md +50 -0
- package/skills/platform/bugx-user/SKILL.md +0 -92
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"""Install the native Antigravity plugin for defensive code review."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from core.hosts.antigravity import (
|
|
9
|
+
AGENT, LOGO, MANIFEST, MCP, PLUGIN_DIR, PROJECT_MCP, SKILL, WORKER_AGENT,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from .. import __version__
|
|
13
|
+
from ..common import CliError
|
|
14
|
+
from ..infra.engine_installer import asset_root, global_engine_root
|
|
15
|
+
from ..infra.security import _assert_no_symlink_components
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
_LEGACY_MCP = json.dumps({"mcpServers": {"docs": {
|
|
19
|
+
"command": "bugx", "args": ["mcp", "docs", "serve", "--root", "."],
|
|
20
|
+
}}}, indent=2) + "\n"
|
|
21
|
+
|
|
22
|
+
# Exact payloads emitted by the first Antigravity adapter revision. They are
|
|
23
|
+
# accepted only as an upgrade input; arbitrary edits to a user's plugin still
|
|
24
|
+
# fail closed instead of being silently overwritten.
|
|
25
|
+
_LEGACY_FILES = {
|
|
26
|
+
AGENT: """---
|
|
27
|
+
name: bugx-review
|
|
28
|
+
description: Review source changes and identify defects in an authorized workspace.
|
|
29
|
+
mainAgent: true
|
|
30
|
+
subagent: false
|
|
31
|
+
inheritMcp: false
|
|
32
|
+
inheritCustomizations: false
|
|
33
|
+
commandExecutionPolicy: 'off'
|
|
34
|
+
skills:
|
|
35
|
+
- skills/bugx-review
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
You are BugX Review. Use the BugX Review skill to inspect the requested workspace scope. Use the plugin's documentation search when the repository's documentation is relevant. Report findings with source locations, impact, and concrete remediation.
|
|
39
|
+
""",
|
|
40
|
+
SKILL: """---
|
|
41
|
+
name: bugx-review
|
|
42
|
+
description: Review authorized source changes for correctness, maintainability, and defensive security.
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
Identify the requested files and the expected behavior. Inspect those files and their immediate callers. Report each defect with an exact source location, its impact, and a remediation. Distinguish source evidence from assumptions and state any verification gaps. This is a read-only review.
|
|
46
|
+
""",
|
|
47
|
+
MANIFEST: json.dumps({
|
|
48
|
+
"name": "bugx-review", "version": __version__,
|
|
49
|
+
"description": "BugX defensive code review and local documentation search.",
|
|
50
|
+
}, indent=2) + "\n",
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_LEGACY_AGENT_V2 = """---
|
|
54
|
+
name: bugx-review
|
|
55
|
+
description: Review source changes and identify defects in an authorized workspace.
|
|
56
|
+
mainAgent: true
|
|
57
|
+
subagent: false
|
|
58
|
+
inheritMcp: true
|
|
59
|
+
inheritCustomizations: false
|
|
60
|
+
commandExecutionPolicy: 'off'
|
|
61
|
+
skills:
|
|
62
|
+
- skills/bugx-review
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
You are BugX Review. Before doing work, read `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`.
|
|
66
|
+
Use the inherited workspace-scoped BugX MCP servers. Use `bugx-docs` for project documentation and `bugx-supervisor` for lifecycle, evidence, checkpoints, findings, and final reporting. Never treat model text, a generated prompt, or a local CLI printout as lifecycle evidence. Report findings with source locations, impact, and concrete remediation.
|
|
67
|
+
|
|
68
|
+
`bugx-docs` is project-scoped: every `resolve_library`, `search_docs`, or `fetch_doc` call MUST include `project_id`. Unless the server instructions explicitly advertise another value, use the current workspace directory name (the scope used by `bugx mcp docs serve`) and never omit the field.
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
# Exact payload emitted by the immediately preceding managed revision. It is
|
|
72
|
+
# accepted only for this one-way rename so an existing BugX installation can
|
|
73
|
+
# be upgraded from the lowercase identifier without weakening ownership
|
|
74
|
+
# checks for arbitrary user edits.
|
|
75
|
+
_LEGACY_AGENT_BUGX = """---
|
|
76
|
+
name: bugx
|
|
77
|
+
description: Review source changes and identify defects in an authorized workspace.
|
|
78
|
+
mainAgent: true
|
|
79
|
+
subagent: false
|
|
80
|
+
inheritMcp: true
|
|
81
|
+
inheritCustomizations: false
|
|
82
|
+
commandExecutionPolicy: 'off'
|
|
83
|
+
skills:
|
|
84
|
+
- skills/bugx-review
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
You are BugX Review. Before doing work, read `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`.
|
|
88
|
+
Use the inherited workspace-scoped BugX MCP servers. Use `bugx-docs` for project documentation and `bugx-supervisor` for lifecycle, evidence, checkpoints, findings, and final reporting. Never treat model text, a generated prompt, or a local CLI printout as lifecycle evidence. Report findings with source locations, impact, and concrete remediation.
|
|
89
|
+
|
|
90
|
+
`bugx-docs` is project-scoped: every `resolve_library`, `search_docs`, or `fetch_doc` call MUST include `project_id`. Unless the server instructions explicitly advertise another value, use the current workspace directory name (the scope used by `bugx mcp docs serve`) and never omit the field.
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
_LEGACY_MANIFEST_WITH_LOGO = json.dumps({
|
|
94
|
+
"name": "bugx-review", "version": __version__,
|
|
95
|
+
"logo": LOGO,
|
|
96
|
+
"description": "BugX defensive code review and local documentation search.",
|
|
97
|
+
}, indent=2) + "\n"
|
|
98
|
+
|
|
99
|
+
# The old relative MCP config could start the docs server from the plugin
|
|
100
|
+
# directory, leaving only these BugX-owned SQLite artifacts behind. Keep them
|
|
101
|
+
# readable during upgrade (they are no longer loaded); unknown files remain a
|
|
102
|
+
# hard failure.
|
|
103
|
+
_LEGACY_GENERATED = (
|
|
104
|
+
Path(".bugx/knowledge/docs.sqlite3"),
|
|
105
|
+
Path(".bugx/knowledge/docs.sqlite3-shm"),
|
|
106
|
+
Path(".bugx/knowledge/docs.sqlite3-wal"),
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
_FILES = {
|
|
111
|
+
AGENT: """---
|
|
112
|
+
name: BugX
|
|
113
|
+
description: Review source changes and identify defects in an authorized workspace.
|
|
114
|
+
mainAgent: true
|
|
115
|
+
subagent: false
|
|
116
|
+
inheritMcp: true
|
|
117
|
+
inheritCustomizations: false
|
|
118
|
+
commandExecutionPolicy: 'off'
|
|
119
|
+
skills:
|
|
120
|
+
- skills/bugx-review
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
You are BugX Review. Before doing work, read `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`.
|
|
124
|
+
Use the inherited workspace-scoped BugX MCP servers. Use `bugx-docs` for project documentation and `bugx-supervisor` for lifecycle, evidence, checkpoints, findings, and final reporting. Never treat model text, a generated prompt, or a local CLI printout as lifecycle evidence. Report findings with source locations, impact, and concrete remediation.
|
|
125
|
+
|
|
126
|
+
`bugx-docs` is project-scoped: every `resolve_library`, `search_docs`, or `fetch_doc` call MUST include `project_id`. Unless the server instructions explicitly advertise another value, use the current workspace directory name (the scope used by `bugx mcp docs serve`) and never omit the field.
|
|
127
|
+
""",
|
|
128
|
+
WORKER_AGENT: """---
|
|
129
|
+
name: bugx-worker
|
|
130
|
+
description: Execute one bounded BugX review claim and return evidence to the Supervisor.
|
|
131
|
+
mainAgent: false
|
|
132
|
+
subagent: true
|
|
133
|
+
inheritMcp: true
|
|
134
|
+
inheritCustomizations: false
|
|
135
|
+
commandExecutionPolicy: 'off'
|
|
136
|
+
skills:
|
|
137
|
+
- skills/bugx-review
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
You are the BugX Worker. Read `bugx engine path --name bugx-worker.md` and `bugx engine path --name bugx-runtime-contract.md` first. Work only on the assigned claim, use `bugx-supervisor-worker` for claim, heartbeat, checkpoint, and finding calls, and never invent a checkpoint or finding. Return bounded evidence and a clear terminal status.
|
|
141
|
+
""",
|
|
142
|
+
SKILL: """---
|
|
143
|
+
name: bugx-review
|
|
144
|
+
description: Review authorized source changes for correctness, maintainability, and defensive security.
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
Identify the requested files and the expected behavior. Inspect those files and their immediate callers. Report each defect with an exact source location, its impact, and a remediation. Distinguish source evidence from assumptions and state any verification gaps. This is a read-only review. When using `bugx-docs`, always include the current workspace directory name as the required `project_id` unless the server advertises a different exact scope.
|
|
148
|
+
""",
|
|
149
|
+
# Project-bound MCP is written to ``<root>/.agents/mcp_config.json`` by
|
|
150
|
+
# the generic host writer. The plugin-level file must not start a server
|
|
151
|
+
# against the plugin/app CWD, so it is intentionally an empty container.
|
|
152
|
+
MCP: json.dumps({"mcpServers": {}}, indent=2) + "\n",
|
|
153
|
+
MANIFEST: json.dumps({
|
|
154
|
+
"name": "bugx-review", "displayName": "BugX", "version": __version__, "logo": LOGO,
|
|
155
|
+
"description": "BugX defensive code review and local documentation search.",
|
|
156
|
+
}, indent=2) + "\n",
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _logo_source() -> Path:
|
|
161
|
+
"""Return the packaged official BugX avatar used by the plugin manifest."""
|
|
162
|
+
|
|
163
|
+
candidates = (
|
|
164
|
+
asset_root() / "assets" / "bugx-avatar.svg",
|
|
165
|
+
global_engine_root() / "assets" / "bugx-avatar.svg",
|
|
166
|
+
Path(__file__).resolve().parents[4] / "core" / "assets" / "bugx-avatar.svg",
|
|
167
|
+
)
|
|
168
|
+
for candidate in candidates:
|
|
169
|
+
if not candidate.is_symlink() and candidate.is_file():
|
|
170
|
+
return candidate
|
|
171
|
+
raise CliError("找不到 BugX 官方头像资源 bugx-avatar.svg,拒绝安装 Antigravity 插件。")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _owned_files() -> dict[str, bytes | str]:
|
|
175
|
+
return {**_FILES, LOGO: _logo_source().read_bytes()}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def pre_validate() -> None:
|
|
179
|
+
dest = Path.home() / PLUGIN_DIR
|
|
180
|
+
_assert_no_symlink_components(dest)
|
|
181
|
+
owned = _owned_files()
|
|
182
|
+
paths = {dest / relative for relative in owned}
|
|
183
|
+
paths.update(dest / relative for relative in _LEGACY_GENERATED)
|
|
184
|
+
directories = {dest} | {parent for path in paths for parent in path.parents if dest in parent.parents}
|
|
185
|
+
allowed = paths | directories
|
|
186
|
+
for folder in directories:
|
|
187
|
+
_assert_no_symlink_components(folder)
|
|
188
|
+
if folder.exists() and (
|
|
189
|
+
not folder.is_dir() or any(path not in allowed for path in folder.iterdir())
|
|
190
|
+
):
|
|
191
|
+
raise CliError(f"Antigravity 插件目录含有未识别的内容,拒绝覆盖: {folder}")
|
|
192
|
+
for relative, content in owned.items():
|
|
193
|
+
path = dest / relative
|
|
194
|
+
_assert_no_symlink_components(path)
|
|
195
|
+
if not path.exists():
|
|
196
|
+
continue
|
|
197
|
+
if not path.is_file():
|
|
198
|
+
raise CliError(f"Antigravity 插件路径不是普通文件,拒绝覆盖: {path}")
|
|
199
|
+
current = path.read_bytes()
|
|
200
|
+
expected = content if isinstance(content, bytes) else content.encode("utf-8")
|
|
201
|
+
if current != expected:
|
|
202
|
+
# This is the exact MCP file emitted by the previous BugX build.
|
|
203
|
+
# It is accepted only to be replaced during this upgrade; any
|
|
204
|
+
# other foreign content remains a hard failure.
|
|
205
|
+
if relative == LOGO:
|
|
206
|
+
legacy_contents = ()
|
|
207
|
+
elif relative == MCP:
|
|
208
|
+
legacy_contents = (_LEGACY_MCP,)
|
|
209
|
+
else:
|
|
210
|
+
legacy_contents = tuple(
|
|
211
|
+
value for value in (_LEGACY_FILES.get(relative),
|
|
212
|
+
_LEGACY_AGENT_V2 if relative == AGENT else None,
|
|
213
|
+
_LEGACY_AGENT_BUGX if relative == AGENT else None,
|
|
214
|
+
_LEGACY_MANIFEST_WITH_LOGO if relative == MANIFEST else None)
|
|
215
|
+
if value is not None
|
|
216
|
+
)
|
|
217
|
+
if not any(
|
|
218
|
+
current == (value if isinstance(value, bytes) else value.encode("utf-8"))
|
|
219
|
+
for value in legacy_contents
|
|
220
|
+
):
|
|
221
|
+
raise CliError(f"Antigravity 插件路径含有未识别的内容,拒绝覆盖: {path}")
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def install_review_plugin() -> dict[str, object]:
|
|
225
|
+
from .agent import _atomic_write_global_file_tx
|
|
226
|
+
|
|
227
|
+
pre_validate()
|
|
228
|
+
dest = Path.home() / PLUGIN_DIR
|
|
229
|
+
written = []
|
|
230
|
+
changed_any = False
|
|
231
|
+
for relative, content in _owned_files().items():
|
|
232
|
+
path = dest / relative
|
|
233
|
+
payload = content if isinstance(content, bytes) else content.encode("utf-8")
|
|
234
|
+
created = not path.exists()
|
|
235
|
+
changed = created or path.read_bytes() != payload
|
|
236
|
+
if changed:
|
|
237
|
+
_atomic_write_global_file_tx(path, payload)
|
|
238
|
+
changed_any = True
|
|
239
|
+
written.append({
|
|
240
|
+
"path": str(path),
|
|
241
|
+
"status": "created" if created else "updated" if changed else "unchanged",
|
|
242
|
+
"backup": None, "created": created,
|
|
243
|
+
})
|
|
244
|
+
return {
|
|
245
|
+
"status": "updated" if changed_any else "unchanged",
|
|
246
|
+
"dir": str(dest), "written": written, "backups": [],
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def _validate_workspace_mcp(root: Path) -> tuple[bool, str]:
|
|
251
|
+
target = root.resolve() / PROJECT_MCP
|
|
252
|
+
if target.is_symlink() or not target.is_file():
|
|
253
|
+
return False, f"缺少项目级 Antigravity MCP 配置: {target}"
|
|
254
|
+
try:
|
|
255
|
+
payload = json.loads(target.read_text(encoding="utf-8"))
|
|
256
|
+
except (OSError, UnicodeDecodeError, json.JSONDecodeError) as exc:
|
|
257
|
+
return False, f"项目级 Antigravity MCP 配置无法解析: {target}: {exc}"
|
|
258
|
+
servers = payload.get("mcpServers") if isinstance(payload, dict) else None
|
|
259
|
+
required = {"bugx-supervisor", "bugx-supervisor-worker", "bugx-docs"}
|
|
260
|
+
if not isinstance(servers, dict) or not required.issubset(servers):
|
|
261
|
+
return False, "项目级 Antigravity MCP 缺少 bugx-supervisor / worker / docs 双通道"
|
|
262
|
+
root_resolved = root.resolve()
|
|
263
|
+
root_text = str(root_resolved)
|
|
264
|
+
expected_db = str(root_resolved / ".bugx" / "knowledge" / "docs.sqlite3")
|
|
265
|
+
for name in required:
|
|
266
|
+
entry = servers.get(name)
|
|
267
|
+
command = entry.get("command") if isinstance(entry, dict) else None
|
|
268
|
+
command_name = Path(str(command)).name.casefold() if isinstance(command, str) else ""
|
|
269
|
+
if not isinstance(entry, dict) or entry.get("type") != "stdio":
|
|
270
|
+
return False, f"项目级 Antigravity MCP 条目不是 BugX stdio 配置: {name}"
|
|
271
|
+
args = entry.get("args") if isinstance(entry, dict) else None
|
|
272
|
+
if not isinstance(args, list) or "--root" not in args:
|
|
273
|
+
return False, f"项目级 Antigravity MCP 条目缺少绝对 --root: {name}"
|
|
274
|
+
if command_name in {"python", "python.exe", "python3", "python3.exe", "pypy", "pypy.exe"}:
|
|
275
|
+
expected_script = "bugx_docs_mcp_server.py" if name == "bugx-docs" else "bugx_mcp_server.py"
|
|
276
|
+
if len(args) < 2 or Path(str(args[0])).name.casefold() != expected_script or args[1] != "serve":
|
|
277
|
+
return False, f"项目级 Antigravity Python MCP 条目启动器不受支持: {name}"
|
|
278
|
+
script = Path(str(args[0])).expanduser()
|
|
279
|
+
trusted_scripts = {
|
|
280
|
+
(global_engine_root() / "skills" / expected_script).resolve(),
|
|
281
|
+
(asset_root() / "skills" / expected_script).resolve(),
|
|
282
|
+
}
|
|
283
|
+
try:
|
|
284
|
+
if script.resolve() not in trusted_scripts:
|
|
285
|
+
return False, f"项目级 Antigravity MCP 脚本不属于 BugX 引擎: {name}"
|
|
286
|
+
except OSError:
|
|
287
|
+
return False, f"项目级 Antigravity MCP 脚本路径无效: {name}"
|
|
288
|
+
elif command_name not in {"bugx", "bugx.exe", "bugx.cmd", "bugx.ps1"}:
|
|
289
|
+
return False, f"项目级 Antigravity MCP 条目不是 BugX stdio 配置: {name}"
|
|
290
|
+
try:
|
|
291
|
+
root_arg = str(args[args.index("--root") + 1])
|
|
292
|
+
except (ValueError, IndexError):
|
|
293
|
+
return False, f"项目级 Antigravity MCP 条目 --root 无值: {name}"
|
|
294
|
+
if root_arg != root_text:
|
|
295
|
+
return False, f"项目级 Antigravity MCP 根目录不匹配: {name} -> {root_arg}"
|
|
296
|
+
if name == "bugx-docs":
|
|
297
|
+
if "--db" not in args:
|
|
298
|
+
return False, "项目级 Antigravity bugx-docs 条目缺少 --db"
|
|
299
|
+
try:
|
|
300
|
+
db_arg = str(args[args.index("--db") + 1])
|
|
301
|
+
except (ValueError, IndexError):
|
|
302
|
+
return False, "项目级 Antigravity bugx-docs 条目 --db 无值"
|
|
303
|
+
if db_arg != expected_db:
|
|
304
|
+
return False, f"项目级 Antigravity docs 数据库不匹配: {db_arg}"
|
|
305
|
+
elif name == "bugx-supervisor":
|
|
306
|
+
if "--role" not in args or args[args.index("--role") + 1:args.index("--role") + 2] != ["host"]:
|
|
307
|
+
return False, "项目级 Antigravity supervisor 条目必须使用 --role host"
|
|
308
|
+
elif name == "bugx-supervisor-worker":
|
|
309
|
+
if "--role" not in args or args[args.index("--role") + 1:args.index("--role") + 2] != ["worker"]:
|
|
310
|
+
return False, "项目级 Antigravity worker 条目必须使用 --role worker"
|
|
311
|
+
return True, f"Antigravity 项目级 MCP 已绑定当前工作区: {target}"
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def validate_install(root: Path) -> tuple[bool, str]:
|
|
315
|
+
dest = Path.home() / PLUGIN_DIR
|
|
316
|
+
try:
|
|
317
|
+
pre_validate()
|
|
318
|
+
except (OSError, CliError) as exc:
|
|
319
|
+
return False, str(exc)
|
|
320
|
+
if any(not (dest / relative).is_file() for relative in _owned_files()):
|
|
321
|
+
return False, "BugX Agent 安装不完整,请运行 bugx install --agent antigravity。"
|
|
322
|
+
mcp_ok, mcp_detail = _validate_workspace_mcp(root)
|
|
323
|
+
if not mcp_ok:
|
|
324
|
+
return False, mcp_detail + ";请运行 bugx install --agent antigravity"
|
|
325
|
+
return True, f"Antigravity BugX Agent、Worker、Skill 和项目 MCP 已注册:{dest}"
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def user_agent_surfaces() -> list[dict[str, object]]:
|
|
329
|
+
return [{"path": Path.home() / PLUGIN_DIR, "entries": tuple(_owned_files()), "label": "Google Antigravity"}]
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def self_remove_user_agents(
|
|
333
|
+
backup_root: Path | None, removed: list[str], preserved: list[str],
|
|
334
|
+
) -> None:
|
|
335
|
+
from .lifecycle import _backup_tree_external
|
|
336
|
+
|
|
337
|
+
dest = Path.home() / PLUGIN_DIR
|
|
338
|
+
if not dest.exists() and not dest.is_symlink():
|
|
339
|
+
return
|
|
340
|
+
try:
|
|
341
|
+
pre_validate()
|
|
342
|
+
paths = [dest / relative for relative in reversed(_owned_files()) if (dest / relative).is_file()]
|
|
343
|
+
if backup_root is not None:
|
|
344
|
+
for path in paths:
|
|
345
|
+
_backup_tree_external(path, backup_root / "antigravity-bugx-review" / path.relative_to(dest))
|
|
346
|
+
for path in paths:
|
|
347
|
+
path.unlink()
|
|
348
|
+
removed.append(str(path))
|
|
349
|
+
except (CliError, OSError) as exc:
|
|
350
|
+
preserved.append(f"{dest}(未清理: {exc})")
|
|
@@ -262,7 +262,7 @@ _DEFAULT_CLAUDE_SKILL_CONTENT = """---
|
|
|
262
262
|
name: bugx
|
|
263
263
|
description: BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。
|
|
264
264
|
metadata:
|
|
265
|
-
bugx_version: "0.1.
|
|
265
|
+
bugx_version: "0.1.5"
|
|
266
266
|
---
|
|
267
267
|
<!-- bugx-locale: zh-CN -->
|
|
268
268
|
|
|
@@ -270,7 +270,7 @@ metadata:
|
|
|
270
270
|
|
|
271
271
|
BugX Claude Skill 镜像。执行前用 `bugx engine path --name AGENT_GUIDE.md` 和 `bugx engine path --name bugx.md` 读取全局协议;项目 `.bugx/` 只保存状态与配置。
|
|
272
272
|
|
|
273
|
-
协议镜像版本:0.1.
|
|
273
|
+
协议镜像版本:0.1.5
|
|
274
274
|
|
|
275
275
|
## Claude 原生交互适配(强制)
|
|
276
276
|
|
|
@@ -10,7 +10,17 @@ import shutil
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
|
-
from ..common import
|
|
13
|
+
from ..common import (
|
|
14
|
+
CliError,
|
|
15
|
+
_resolve_locale_name,
|
|
16
|
+
asset_root,
|
|
17
|
+
global_engine_root,
|
|
18
|
+
)
|
|
19
|
+
from ..hosts.template_engine import (
|
|
20
|
+
add_locale_marker,
|
|
21
|
+
get_agent_description,
|
|
22
|
+
get_worker_description,
|
|
23
|
+
)
|
|
14
24
|
|
|
15
25
|
|
|
16
26
|
KIMI_PLUGIN_ICON_URL = "https://bugx.dev/brand-mark.svg"
|
|
@@ -34,18 +44,9 @@ def _kimi_code_home() -> Path:
|
|
|
34
44
|
|
|
35
45
|
def _find_bugx_skill_source(root: Path, source: Path) -> Path | None:
|
|
36
46
|
"""定位可复用的 BugX SKILL.md 源文件。"""
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
source / "ecosystem" / "plugins" / "bugx" / "skills" / "bugx" / "SKILL.md",
|
|
41
|
-
root / "plugins" / "bugx" / "skills" / "bugx" / "SKILL.md",
|
|
42
|
-
root / "ecosystem" / "plugins" / "bugx" / "skills" / "bugx" / "SKILL.md",
|
|
43
|
-
global_engine_root() / "skills" / "bugx" / "SKILL.md",
|
|
44
|
-
)
|
|
45
|
-
for candidate in candidates:
|
|
46
|
-
if not candidate.is_symlink() and candidate.is_file():
|
|
47
|
-
return candidate
|
|
48
|
-
return None
|
|
47
|
+
from ..infra.host_sync import find_bugx_skill_source
|
|
48
|
+
|
|
49
|
+
return find_bugx_skill_source(root, source)
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
def _find_bugx_avatar_source() -> Path | None:
|
|
@@ -62,57 +63,85 @@ def _find_bugx_avatar_source() -> Path | None:
|
|
|
62
63
|
return None
|
|
63
64
|
|
|
64
65
|
|
|
65
|
-
def _build_agent_bugx() -> str:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`bugx
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
This
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
""
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
66
|
+
def _build_agent_bugx(locale: str | None = None) -> str:
|
|
67
|
+
loc = _resolve_locale_name(locale)
|
|
68
|
+
desc = get_agent_description(loc)
|
|
69
|
+
is_zh = loc.startswith("zh")
|
|
70
|
+
body = (
|
|
71
|
+
"# BugX\n\n"
|
|
72
|
+
"这是 BugX 的 Kimi Code 入口。\n\n"
|
|
73
|
+
"先读取全局引擎协议:\n"
|
|
74
|
+
"通过 `bugx engine path --name bugx-runtime-contract.md` 和\n"
|
|
75
|
+
"`bugx engine path --name bugx-quick.md` 读取全局协议,并遵守其中的寿命、Supervisor、\n"
|
|
76
|
+
"证据和报告协议。\n\n"
|
|
77
|
+
"该入口只把任务交给当前 Kimi Code 会话;BugX CLI 只安装资源,不直接执行审计。\n\n"
|
|
78
|
+
"## 交互适配\n"
|
|
79
|
+
"- 使用结构化提示呈现交互决策。\n"
|
|
80
|
+
"- 确保可访问 `bugx-supervisor` 与 `bugx-supervisor-worker` MCP 工具。\n"
|
|
81
|
+
) if is_zh else (
|
|
82
|
+
"# BugX\n\n"
|
|
83
|
+
"This is BugX's Kimi Code entry.\n\n"
|
|
84
|
+
"Read the global engine protocol first:\n"
|
|
85
|
+
"load the global protocol via `bugx engine path --name bugx-runtime-contract.md` and\n"
|
|
86
|
+
"`bugx engine path --name bugx-quick.md`, and follow the lifetime, Supervisor,\n"
|
|
87
|
+
"evidence, and reporting protocols in them.\n\n"
|
|
88
|
+
"This entry only hands the task to the current Kimi Code session; BugX CLI installs\n"
|
|
89
|
+
"resources and does not run audits directly.\n\n"
|
|
90
|
+
"## Interaction Adaptation\n"
|
|
91
|
+
"- Present interaction decisions with structured prompts.\n"
|
|
92
|
+
"- Ensure `bugx-supervisor` and `bugx-supervisor-worker` MCP tools are accessible.\n"
|
|
93
|
+
)
|
|
94
|
+
rendered = (
|
|
95
|
+
"---\n"
|
|
96
|
+
"name: bugx\n"
|
|
97
|
+
f"description: {desc}\n"
|
|
98
|
+
"tools: Bash, Read, Grep, Glob, Edit, Write, AskUserQuestion\n"
|
|
99
|
+
"color: cyan\n"
|
|
100
|
+
"---\n\n"
|
|
101
|
+
+ body
|
|
102
|
+
)
|
|
103
|
+
return add_locale_marker(rendered, loc)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _build_agent_worker(locale: str | None = None) -> str:
|
|
107
|
+
loc = _resolve_locale_name(locale)
|
|
108
|
+
desc = get_worker_description(loc)
|
|
109
|
+
is_zh = loc.startswith("zh")
|
|
110
|
+
body = (
|
|
111
|
+
"# BugX Worker\n\n"
|
|
112
|
+
"这是 BugX Worker 执行子智能体。\n\n"
|
|
113
|
+
"## 执行规则\n"
|
|
114
|
+
"- 遵守任务分配与租约限制。\n"
|
|
115
|
+
"- 向 `bugx-supervisor-worker` 上报心跳与检查点。\n"
|
|
116
|
+
"- 为确认的缺陷提供可独立执行的验证脚本(PoC)。\n"
|
|
117
|
+
) if is_zh else (
|
|
118
|
+
"# BugX Worker\n\n"
|
|
119
|
+
"This is the BugX Worker execution sub-agent.\n\n"
|
|
120
|
+
"## Execution Rules\n"
|
|
121
|
+
"- Obey task assignment and lease constraints.\n"
|
|
122
|
+
"- Report heartbeats and checkpoints to `bugx-supervisor-worker`.\n"
|
|
123
|
+
"- Provide standalone proof-of-concept (PoC) scripts for confirmed defects.\n"
|
|
124
|
+
)
|
|
125
|
+
rendered = (
|
|
126
|
+
"---\n"
|
|
127
|
+
"name: bugx-worker\n"
|
|
128
|
+
f"description: {desc}\n"
|
|
129
|
+
"tools: Bash, Read, Grep, Glob, Edit, Write\n"
|
|
130
|
+
"color: green\n"
|
|
131
|
+
"---\n\n"
|
|
132
|
+
+ body
|
|
133
|
+
)
|
|
134
|
+
return add_locale_marker(rendered, loc)
|
|
108
135
|
|
|
109
136
|
|
|
110
|
-
def _build_desktop_plugin_manifest(version: str = "0.1.3") -> dict[str, Any]:
|
|
137
|
+
def _build_desktop_plugin_manifest(version: str = "0.1.3", locale: str | None = None) -> dict[str, Any]:
|
|
111
138
|
"""生成具备完整桌面端 UI / 徽标与 MCP 通道配置的 kimi.plugin.json。"""
|
|
139
|
+
loc = _resolve_locale_name(locale)
|
|
140
|
+
desc = get_agent_description(loc)
|
|
112
141
|
return {
|
|
113
142
|
"name": "bugx",
|
|
114
143
|
"version": version,
|
|
115
|
-
"description":
|
|
144
|
+
"description": desc,
|
|
116
145
|
"homepage": "https://bugx.dev",
|
|
117
146
|
"author": {
|
|
118
147
|
"name": "BugX",
|
|
@@ -200,7 +229,7 @@ def _ensure_kimi_plugin(
|
|
|
200
229
|
只写入这一套当前契约;若宿主数据根不存在则立即失败,避免安装命令
|
|
201
230
|
返回成功但插件实际没有注册。
|
|
202
231
|
"""
|
|
203
|
-
|
|
232
|
+
loc = _resolve_locale_name(locale)
|
|
204
233
|
kimi_home = _kimi_code_home()
|
|
205
234
|
if not kimi_home.is_dir():
|
|
206
235
|
raise CliError(
|
|
@@ -237,7 +266,7 @@ def _ensure_kimi_plugin(
|
|
|
237
266
|
written: list[dict[str, Any]] = []
|
|
238
267
|
|
|
239
268
|
# 2. 写入 kimi.plugin.json 与 .kimi-plugin/plugin.json
|
|
240
|
-
manifest_obj = _build_desktop_plugin_manifest()
|
|
269
|
+
manifest_obj = _build_desktop_plugin_manifest(locale=loc)
|
|
241
270
|
manifest_bytes = (
|
|
242
271
|
json.dumps(manifest_obj, indent=2, ensure_ascii=False) + "\n"
|
|
243
272
|
).encode("utf-8")
|
|
@@ -275,7 +304,7 @@ def _ensure_kimi_plugin(
|
|
|
275
304
|
agents_dir = dest / "agents"
|
|
276
305
|
agents_dir.mkdir(parents=True, exist_ok=True)
|
|
277
306
|
agent_main = agents_dir / "bugx.md"
|
|
278
|
-
agent_main.write_text(_build_agent_bugx(), encoding="utf-8")
|
|
307
|
+
agent_main.write_text(_build_agent_bugx(locale=loc), encoding="utf-8")
|
|
279
308
|
written.append({
|
|
280
309
|
"path": str(agent_main),
|
|
281
310
|
"status": "created",
|
|
@@ -283,7 +312,7 @@ def _ensure_kimi_plugin(
|
|
|
283
312
|
"created": True,
|
|
284
313
|
})
|
|
285
314
|
agent_worker = agents_dir / "bugx-worker.md"
|
|
286
|
-
agent_worker.write_text(_build_agent_worker(), encoding="utf-8")
|
|
315
|
+
agent_worker.write_text(_build_agent_worker(locale=loc), encoding="utf-8")
|
|
287
316
|
written.append({
|
|
288
317
|
"path": str(agent_worker),
|
|
289
318
|
"status": "created",
|
|
@@ -346,3 +375,66 @@ def _ensure_kimi_plugin(
|
|
|
346
375
|
"written": written,
|
|
347
376
|
"backups": [],
|
|
348
377
|
}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def validate_install(root: Path) -> tuple[bool, str]:
|
|
381
|
+
"""Verify Kimi Code plugin registration, files, and MCP server channels."""
|
|
382
|
+
del root
|
|
383
|
+
try:
|
|
384
|
+
kimi_home = _kimi_code_home()
|
|
385
|
+
except CliError as exc:
|
|
386
|
+
return False, str(exc)
|
|
387
|
+
plugins_root = kimi_home / "plugins"
|
|
388
|
+
installed_file = plugins_root / "installed.json"
|
|
389
|
+
dest = plugins_root / "managed" / "bugx"
|
|
390
|
+
manifest = dest / "kimi.plugin.json"
|
|
391
|
+
dot_manifest = dest / ".kimi-plugin" / "plugin.json"
|
|
392
|
+
agent_main = dest / "agents" / "bugx.md"
|
|
393
|
+
agent_worker = dest / "agents" / "bugx-worker.md"
|
|
394
|
+
skill_file = dest / "skills" / "bugx" / "SKILL.md"
|
|
395
|
+
missing = [
|
|
396
|
+
label for label, path in (
|
|
397
|
+
("installed.json", installed_file),
|
|
398
|
+
("kimi.plugin.json", manifest),
|
|
399
|
+
(".kimi-plugin/plugin.json", dot_manifest),
|
|
400
|
+
("主智能体", agent_main),
|
|
401
|
+
("Worker 智能体", agent_worker),
|
|
402
|
+
("Skill", skill_file),
|
|
403
|
+
)
|
|
404
|
+
if path.is_symlink() or not path.is_file()
|
|
405
|
+
]
|
|
406
|
+
if missing:
|
|
407
|
+
return (
|
|
408
|
+
False,
|
|
409
|
+
f"Kimi Code 插件不完整({dest} 缺少 {'、'.join(missing)});"
|
|
410
|
+
"请运行 `bugx install --agent kimi`",
|
|
411
|
+
)
|
|
412
|
+
try:
|
|
413
|
+
installed_data = json.loads(installed_file.read_text(encoding="utf-8"))
|
|
414
|
+
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
|
|
415
|
+
return False, f"Kimi Code installed.json 无法解析({installed_file}):{exc}"
|
|
416
|
+
plugins_list = installed_data.get("plugins") if isinstance(installed_data, dict) else None
|
|
417
|
+
entry = (
|
|
418
|
+
next((p for p in plugins_list if isinstance(p, dict) and p.get("id") == "bugx"), None)
|
|
419
|
+
if isinstance(plugins_list, list) else None
|
|
420
|
+
)
|
|
421
|
+
if not entry or not entry.get("enabled"):
|
|
422
|
+
return False, f"Kimi Code installed.json 未启用 bugx 插件({installed_file});请运行 `bugx install --agent kimi`"
|
|
423
|
+
try:
|
|
424
|
+
manifest_data = json.loads(manifest.read_text(encoding="utf-8"))
|
|
425
|
+
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
|
|
426
|
+
return False, f"Kimi Code kimi.plugin.json 无法解析({manifest}):{exc}"
|
|
427
|
+
servers = manifest_data.get("mcpServers") if isinstance(manifest_data, dict) else None
|
|
428
|
+
if not isinstance(servers, dict):
|
|
429
|
+
return False, f"Kimi Code kimi.plugin.json 缺少 mcpServers({manifest})"
|
|
430
|
+
missing_channels = [
|
|
431
|
+
ch for ch in ("bugx-supervisor", "bugx-supervisor-worker", "bugx-docs")
|
|
432
|
+
if not isinstance(servers.get(ch), dict)
|
|
433
|
+
]
|
|
434
|
+
if missing_channels:
|
|
435
|
+
return (
|
|
436
|
+
False,
|
|
437
|
+
f"Kimi Code kimi.plugin.json 缺少 {', '.join(missing_channels)}({manifest});"
|
|
438
|
+
"请运行 `bugx install --agent kimi`",
|
|
439
|
+
)
|
|
440
|
+
return True, f"Kimi Code 插件与三通道 MCP 已就绪并启用({dest})"
|