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
|
@@ -11,6 +11,7 @@ import subprocess
|
|
|
11
11
|
import sys
|
|
12
12
|
import tempfile
|
|
13
13
|
import time
|
|
14
|
+
from collections.abc import Callable
|
|
14
15
|
from pathlib import Path
|
|
15
16
|
from typing import Any
|
|
16
17
|
|
|
@@ -18,6 +19,7 @@ from .. import __version__
|
|
|
18
19
|
from ..common import *
|
|
19
20
|
from ..host_adapters import HOST_ADAPTERS
|
|
20
21
|
from ..hosts.registry import (
|
|
22
|
+
QODER_PROJECT_MCP_PATHS,
|
|
21
23
|
engine_host_label,
|
|
22
24
|
engine_host_mcp_config_paths,
|
|
23
25
|
engine_host_mcp_write,
|
|
@@ -717,8 +719,81 @@ def _host_global_mcp_target(host_name: str, root: Path) -> Path | None:
|
|
|
717
719
|
return paths[0] if paths else None
|
|
718
720
|
|
|
719
721
|
|
|
722
|
+
def _resolve_docs_remote_url(explicit: str | None = None) -> str:
|
|
723
|
+
"""解析并校验 bugx-docs remote HTTP MCP 端点 URL。"""
|
|
724
|
+
import re as _re
|
|
725
|
+
from ..common import __version__
|
|
726
|
+
|
|
727
|
+
try:
|
|
728
|
+
from core.cloud_sync.endpoint_router import load_cloud_config, validate_base_url
|
|
729
|
+
except Exception as exc: # noqa: BLE001
|
|
730
|
+
raise CliError(f"无法加载云端路由校验器以配置远程 bugx-docs:{exc}") from exc
|
|
731
|
+
|
|
732
|
+
ver_match = _re.match(r"([0-9]+\.[0-9]+\.[0-9]+)", str(__version__))
|
|
733
|
+
contract_ver = ver_match.group(1) if ver_match else str(__version__)
|
|
734
|
+
raw = str(explicit or "").strip()
|
|
735
|
+
if raw:
|
|
736
|
+
base_part, _, query = raw.partition("?")
|
|
737
|
+
try:
|
|
738
|
+
normalized = validate_base_url(base_part)
|
|
739
|
+
except ValueError as exc:
|
|
740
|
+
raise CliError(f"非法 --docs-remote-url: {exc}") from exc
|
|
741
|
+
if "/api/v1/mcp/docs" not in normalized:
|
|
742
|
+
normalized = f"{normalized}/api/v1/mcp/docs"
|
|
743
|
+
return f"{normalized}?{query}" if query else f"{normalized}?contract_version={contract_ver}"
|
|
744
|
+
|
|
745
|
+
cfg = load_cloud_config()
|
|
746
|
+
base = str(cfg.get("base_url") or "https://bugx.dev").strip()
|
|
747
|
+
try:
|
|
748
|
+
normalized_base = validate_base_url(base)
|
|
749
|
+
except ValueError as exc:
|
|
750
|
+
raise CliError(f"云端 base_url 无法用于远程 bugx-docs: {exc}") from exc
|
|
751
|
+
return f"{normalized_base}/api/v1/mcp/docs?contract_version={contract_ver}"
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
def _probe_docs_remote_connectivity(url: str, timeout: float = 1.0) -> bool:
|
|
755
|
+
"""快速探测远程文档服务连通性(1s 有界超时)。"""
|
|
756
|
+
import urllib.error
|
|
757
|
+
import urllib.request
|
|
758
|
+
try:
|
|
759
|
+
req = urllib.request.Request(url, headers={"User-Agent": "bugx-install-probe"}, method="HEAD")
|
|
760
|
+
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
|
761
|
+
return resp.status < 500
|
|
762
|
+
except urllib.error.HTTPError as exc:
|
|
763
|
+
return exc.code < 500
|
|
764
|
+
except (urllib.error.URLError, TimeoutError, OSError):
|
|
765
|
+
return False
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
def resolve_effective_docs_transport(
|
|
769
|
+
docs_transport: str | None,
|
|
770
|
+
docs_remote_url: str | None = None,
|
|
771
|
+
) -> str:
|
|
772
|
+
"""确定当前环境应采用的 bugx-docs 传输模式(远程优先,无法联网时自动降级本地)。"""
|
|
773
|
+
if docs_transport in {"stdio", "remote"}:
|
|
774
|
+
return docs_transport
|
|
775
|
+
try:
|
|
776
|
+
from core.skills.bugx_docs_cloud_sync import docs_offline_disabled
|
|
777
|
+
if docs_offline_disabled():
|
|
778
|
+
return "stdio"
|
|
779
|
+
except Exception:
|
|
780
|
+
pass
|
|
781
|
+
|
|
782
|
+
try:
|
|
783
|
+
target_url = _resolve_docs_remote_url(docs_remote_url)
|
|
784
|
+
if _probe_docs_remote_connectivity(target_url, timeout=1.0):
|
|
785
|
+
return "remote"
|
|
786
|
+
except Exception:
|
|
787
|
+
pass
|
|
788
|
+
return "stdio"
|
|
789
|
+
|
|
790
|
+
|
|
720
791
|
def _host_supervisor_server_definitions(
|
|
721
|
-
*,
|
|
792
|
+
*,
|
|
793
|
+
shape: str,
|
|
794
|
+
optional_names: set[str] | None = None,
|
|
795
|
+
docs_transport: str | None = None,
|
|
796
|
+
docs_remote_url: str | None = None,
|
|
722
797
|
) -> dict[str, dict[str, object]]:
|
|
723
798
|
"""构建 Cline / Claude Code / ZCode / Qoder / Trea / FunIDE 的最小 BugX MCP 注册。
|
|
724
799
|
|
|
@@ -736,6 +811,7 @@ def _host_supervisor_server_definitions(
|
|
|
736
811
|
if shape not in _mcp_shape_names():
|
|
737
812
|
raise CliError(_i18n_exc("plugin.unknown_mcp_shape", f"未知宿主 MCP 配置形态: {shape}", shape=shape))
|
|
738
813
|
entry_extra = _host_mcp_entry_extra(shape)
|
|
814
|
+
effective_transport = resolve_effective_docs_transport(docs_transport, docs_remote_url)
|
|
739
815
|
result: dict[str, dict[str, object]] = {}
|
|
740
816
|
for name in HOST_SUPERVISOR_MCP:
|
|
741
817
|
role = HOST_SUPERVISOR_MCP_ROLES[name]
|
|
@@ -750,16 +826,24 @@ def _host_supervisor_server_definitions(
|
|
|
750
826
|
if entry_extra:
|
|
751
827
|
entry.update(copy.deepcopy(entry_extra))
|
|
752
828
|
result[name] = entry
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
"
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
829
|
+
if effective_transport == "remote":
|
|
830
|
+
resolved_url = _resolve_docs_remote_url(docs_remote_url)
|
|
831
|
+
docs_entry = (
|
|
832
|
+
{"url": resolved_url}
|
|
833
|
+
if shape == "codex"
|
|
834
|
+
else {"type": "http", "url": resolved_url}
|
|
835
|
+
)
|
|
836
|
+
else:
|
|
837
|
+
docs_entry = {
|
|
838
|
+
"type": "stdio",
|
|
839
|
+
"command": "bugx",
|
|
840
|
+
"args": [
|
|
841
|
+
"mcp", "docs", "serve", "--root", ".",
|
|
842
|
+
"--db", ".bugx/knowledge/docs.sqlite3",
|
|
843
|
+
],
|
|
844
|
+
}
|
|
845
|
+
if entry_extra:
|
|
846
|
+
docs_entry.update(copy.deepcopy(entry_extra))
|
|
763
847
|
result["bugx-docs"] = docs_entry
|
|
764
848
|
for name in sorted(optional_names or set()):
|
|
765
849
|
if name not in {"playwright", "postmcp"}:
|
|
@@ -797,9 +881,29 @@ def _host_mcp_command_tokens(entry: object) -> list[str] | None:
|
|
|
797
881
|
|
|
798
882
|
|
|
799
883
|
_PYTHON_MODULE_LAUNCHER_PREFIX = ["-m", "bugx_cli.cli"]
|
|
884
|
+
_SAFE_PYTHON_MODULE_LAUNCHER_PREFIX = ["-P", *_PYTHON_MODULE_LAUNCHER_PREFIX]
|
|
885
|
+
_QODER_NPM_ENV_KEYS = ("BUGX_CLI_SOURCE", "BUGX_ASSET_ROOT", "PYTHONPATH")
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
def _qoder_windows_mcp_launcher() -> tuple[str, dict[str, str]]:
|
|
889
|
+
"""Keep Qoder's Windows stdio launch independent of PATH and npm shims."""
|
|
890
|
+
python = Path(sys.executable)
|
|
891
|
+
if not python.is_absolute() or python.suffix.casefold() != ".exe" or not python.is_file():
|
|
892
|
+
raise CliError(f"Qoder MCP 需要可直接启动的 Windows Python 解释器: {python}")
|
|
893
|
+
if os.environ.get("BUGX_CLI_SOURCE") != "npm":
|
|
894
|
+
return str(python), {}
|
|
895
|
+
# npm adds its Python module and engine paths to the installer's environment.
|
|
896
|
+
# Qoder runs in a different process and does not inherit either of them.
|
|
897
|
+
return str(python), {
|
|
898
|
+
"BUGX_CLI_SOURCE": "npm",
|
|
899
|
+
"BUGX_ASSET_ROOT": str(asset_root()),
|
|
900
|
+
"PYTHONPATH": str(Path(__file__).resolve().parents[2]),
|
|
901
|
+
}
|
|
800
902
|
|
|
801
903
|
|
|
802
|
-
def _absolute_bugx_launcher(
|
|
904
|
+
def _absolute_bugx_launcher(
|
|
905
|
+
*, direct_engine: bool = False, script_name: str = "bugx_mcp_server.py",
|
|
906
|
+
) -> tuple[str, list[str]]:
|
|
803
907
|
"""解析 bugx 启动入口,返回 ``(command, 前缀参数)``。
|
|
804
908
|
|
|
805
909
|
候选按可信度排序,**绝不落盘伪造路径**(旧实现无条件取 ``sys.argv[0]``,
|
|
@@ -811,6 +915,21 @@ def _absolute_bugx_launcher() -> tuple[str, list[str]]:
|
|
|
811
915
|
4. 兜底:``<当前解释器> -m bugx_cli.cli`` —— 绝对、可执行、不伪造路径。
|
|
812
916
|
"""
|
|
813
917
|
|
|
918
|
+
if direct_engine:
|
|
919
|
+
# Antigravity ACP has a short MCP pre-load window. Starting the full
|
|
920
|
+
# CLI first adds several seconds on Windows, while the engine script
|
|
921
|
+
# is self-bootstrapping and reaches the same ``serve`` implementation
|
|
922
|
+
# directly. Keep the interpreter and script absolute because the ACP
|
|
923
|
+
# process is not guaranteed to inherit the user's PATH or cwd.
|
|
924
|
+
engine_roots = (global_engine_root(), asset_root())
|
|
925
|
+
for engine_root in engine_roots:
|
|
926
|
+
script = engine_root / "skills" / script_name
|
|
927
|
+
if script.is_file():
|
|
928
|
+
return str(Path(sys.executable).resolve()), [str(script.resolve())]
|
|
929
|
+
raise CliError(
|
|
930
|
+
f"全局 BugX 引擎缺少 skills/{script_name},无法为 Antigravity ACP 写入快速 MCP 启动器"
|
|
931
|
+
)
|
|
932
|
+
|
|
814
933
|
override = shutil.which("bugx")
|
|
815
934
|
if override:
|
|
816
935
|
return str(Path(override).resolve()), []
|
|
@@ -840,10 +959,23 @@ def _absolutize_server_definitions(
|
|
|
840
959
|
spawn——常驻 Hub Daemon 的 cwd 不是工作区,``--root .`` 会解析到宿主 cwd
|
|
841
960
|
而不是本项目,因此必须写绝对项目根。
|
|
842
961
|
"""
|
|
843
|
-
command, prefix = _absolute_bugx_launcher()
|
|
844
962
|
root_str = str(root)
|
|
845
963
|
for entry in desired.values():
|
|
964
|
+
direct_engine = entry.pop("_bugx_direct_engine_script", False) is True
|
|
846
965
|
args = entry.get("args")
|
|
966
|
+
script_name = "bugx_mcp_server.py"
|
|
967
|
+
if direct_engine and isinstance(args, list):
|
|
968
|
+
if args[:2] == ["mcp", "docs"]:
|
|
969
|
+
script_name = "bugx_docs_mcp_server.py"
|
|
970
|
+
args = args[2:]
|
|
971
|
+
elif args[:1] == ["mcp"]:
|
|
972
|
+
args = args[1:]
|
|
973
|
+
else:
|
|
974
|
+
raise CliError("Antigravity 直通 MCP 条目缺少受支持的 `mcp` 子命令")
|
|
975
|
+
entry["args"] = args
|
|
976
|
+
command, prefix = _absolute_bugx_launcher(
|
|
977
|
+
direct_engine=direct_engine, script_name=script_name,
|
|
978
|
+
)
|
|
847
979
|
if entry.get("command") == "bugx":
|
|
848
980
|
entry["command"] = command
|
|
849
981
|
if prefix and isinstance(args, list):
|
|
@@ -860,7 +992,7 @@ def _absolutize_server_definitions(
|
|
|
860
992
|
return desired
|
|
861
993
|
|
|
862
994
|
|
|
863
|
-
def _mcp_entry_has_relative_paths(entry: object) -> bool:
|
|
995
|
+
def _mcp_entry_has_relative_paths(entry: object, *, include_db: bool = True) -> bool:
|
|
864
996
|
"""宿主 MCP 条目 argv 是否仍携带相对 ``--root`` / ``--db`` 路径 token。
|
|
865
997
|
|
|
866
998
|
``mcp_write.requires_absolutize=True`` 宿主的**声明性过期**判据:这类宿主的
|
|
@@ -882,7 +1014,7 @@ def _mcp_entry_has_relative_paths(entry: object) -> bool:
|
|
|
882
1014
|
continue
|
|
883
1015
|
if token == "--root" and not Path(value).is_absolute():
|
|
884
1016
|
return True
|
|
885
|
-
if token == "--db" and value.startswith(".bugx/"):
|
|
1017
|
+
if include_db and token == "--db" and value.startswith(".bugx/"):
|
|
886
1018
|
return True
|
|
887
1019
|
return False
|
|
888
1020
|
|
|
@@ -938,8 +1070,8 @@ def _same_mcp_arg(got: object, want: object, root: Path | None = None) -> bool:
|
|
|
938
1070
|
|
|
939
1071
|
def _launcher_kind(command: str) -> str:
|
|
940
1072
|
"""启动器类别:``bugx``(原生启动器)/ ``python``(解释器)/ ``other:<name>``。"""
|
|
941
|
-
name = Path(command).name
|
|
942
|
-
if name in {"bugx", "bugx.js"}:
|
|
1073
|
+
name = os.path.normcase(Path(command).name)
|
|
1074
|
+
if name in {"bugx", "bugx.exe", "bugx.js"}:
|
|
943
1075
|
return "bugx"
|
|
944
1076
|
if name.startswith("python") or name.startswith("pypy"):
|
|
945
1077
|
return "python"
|
|
@@ -955,18 +1087,17 @@ def _launchers_equivalent(got_cmd: str, got_args: list, want_cmd: str, want_args
|
|
|
955
1087
|
return got_cmd == want_cmd
|
|
956
1088
|
if {got_kind, want_kind} != {"bugx", "python"}:
|
|
957
1089
|
return False
|
|
958
|
-
|
|
959
|
-
if got_kind == "python" and list(got_args[: len(prefix)]) != prefix:
|
|
1090
|
+
if got_kind == "python" and _strip_launcher_prefix(got_args) == list(got_args):
|
|
960
1091
|
return False
|
|
961
|
-
if want_kind == "python" and
|
|
1092
|
+
if want_kind == "python" and _strip_launcher_prefix(want_args) == list(want_args):
|
|
962
1093
|
return False
|
|
963
1094
|
return True
|
|
964
1095
|
|
|
965
1096
|
|
|
966
1097
|
def _strip_launcher_prefix(args: list) -> list:
|
|
967
|
-
prefix
|
|
968
|
-
|
|
969
|
-
|
|
1098
|
+
for prefix in (_SAFE_PYTHON_MODULE_LAUNCHER_PREFIX, _PYTHON_MODULE_LAUNCHER_PREFIX):
|
|
1099
|
+
if list(args[: len(prefix)]) == prefix:
|
|
1100
|
+
return list(args[len(prefix):])
|
|
970
1101
|
return list(args)
|
|
971
1102
|
|
|
972
1103
|
|
|
@@ -1174,7 +1305,7 @@ def _expand_pinned_expected(expected: list[str], root: Path | None) -> list[str]
|
|
|
1174
1305
|
|
|
1175
1306
|
|
|
1176
1307
|
def _mcp_tokens_match(
|
|
1177
|
-
actual: list[str], expected: list[str], root: Path | None = None,
|
|
1308
|
+
actual: list[str] | None, expected: list[str], root: Path | None = None,
|
|
1178
1309
|
) -> bool:
|
|
1179
1310
|
"""比较宿主 MCP 条目 tokens 与 pinned 模板,按**语义**而非字面。
|
|
1180
1311
|
|
|
@@ -1186,7 +1317,7 @@ def _mcp_tokens_match(
|
|
|
1186
1317
|
``_tokens_equivalent``(启动器类别 + 逐参路径等价)。角色/子命令/顺序仍严格
|
|
1187
1318
|
相等,所以「指向别的项目」「角色写错」「db 写错」依旧判过期。
|
|
1188
1319
|
"""
|
|
1189
|
-
return _tokens_equivalent(actual, _expand_pinned_expected(expected, root), root)
|
|
1320
|
+
return bool(actual) and _tokens_equivalent(actual, _expand_pinned_expected(expected, root), root)
|
|
1190
1321
|
|
|
1191
1322
|
|
|
1192
1323
|
def _host_mcp_entry_is_current(
|
|
@@ -1197,6 +1328,12 @@ def _host_mcp_entry_is_current(
|
|
|
1197
1328
|
return False
|
|
1198
1329
|
if entry.get("disabled") is True or entry.get("enabled") is False:
|
|
1199
1330
|
return False
|
|
1331
|
+
if name == "bugx-docs" and isinstance(entry.get("url"), str) and entry["url"].strip():
|
|
1332
|
+
try:
|
|
1333
|
+
from core.host_runtime.mcp_process_tracker import probe_remote_docs_mcp
|
|
1334
|
+
return bool(probe_remote_docs_mcp({"bugx-docs": entry}).get("healthy"))
|
|
1335
|
+
except Exception:
|
|
1336
|
+
return False
|
|
1200
1337
|
expected = OPENCODE_PINNED_MCP_COMMANDS.get(name)
|
|
1201
1338
|
if not expected:
|
|
1202
1339
|
return False
|
|
@@ -1204,6 +1341,31 @@ def _host_mcp_entry_is_current(
|
|
|
1204
1341
|
return _mcp_tokens_match(actual, expected, root)
|
|
1205
1342
|
|
|
1206
1343
|
|
|
1344
|
+
def _qoder_mcp_entry_is_current(name: str, entry: object, root: Path | None) -> bool:
|
|
1345
|
+
"""Check project binding and the Windows launcher used by Qoder Desktop."""
|
|
1346
|
+
# The Docs server resolves a relative database path under its explicit root.
|
|
1347
|
+
if not (
|
|
1348
|
+
isinstance(entry, dict)
|
|
1349
|
+
and not _mcp_entry_has_relative_paths(entry, include_db=False)
|
|
1350
|
+
and _host_mcp_entry_is_current(name, entry, root)
|
|
1351
|
+
):
|
|
1352
|
+
return False
|
|
1353
|
+
if os.name != "nt":
|
|
1354
|
+
return True
|
|
1355
|
+
command, environment = _qoder_windows_mcp_launcher()
|
|
1356
|
+
args = entry.get("args")
|
|
1357
|
+
current_env = entry.get("env", {})
|
|
1358
|
+
return (
|
|
1359
|
+
isinstance(entry.get("command"), str)
|
|
1360
|
+
and os.path.normcase(entry["command"]) == os.path.normcase(command)
|
|
1361
|
+
and isinstance(args, list)
|
|
1362
|
+
and args[:len(_SAFE_PYTHON_MODULE_LAUNCHER_PREFIX)] == _SAFE_PYTHON_MODULE_LAUNCHER_PREFIX
|
|
1363
|
+
and isinstance(current_env, dict)
|
|
1364
|
+
and all(current_env.get(key) == value for key, value in environment.items())
|
|
1365
|
+
and (bool(environment) or current_env.get("BUGX_CLI_SOURCE") != "npm")
|
|
1366
|
+
)
|
|
1367
|
+
|
|
1368
|
+
|
|
1207
1369
|
def _load_json_object(path: Path, label: str) -> dict[str, object]:
|
|
1208
1370
|
if path.is_symlink():
|
|
1209
1371
|
raise CliError(_i18n_exc("plugin.mcp_symlink_config_refused", f"拒绝写入符号链接 {label} 配置: {path}", label=label, path=path))
|
|
@@ -1221,7 +1383,12 @@ def _load_json_object(path: Path, label: str) -> dict[str, object]:
|
|
|
1221
1383
|
|
|
1222
1384
|
|
|
1223
1385
|
def write_host_mcp_config(
|
|
1224
|
-
root: Path,
|
|
1386
|
+
root: Path,
|
|
1387
|
+
host_name: str,
|
|
1388
|
+
*,
|
|
1389
|
+
optional_names: set[str] | None = None,
|
|
1390
|
+
docs_transport: str | None = None,
|
|
1391
|
+
docs_remote_url: str | None = None,
|
|
1225
1392
|
) -> tuple[str, Path, Path | None, bool]:
|
|
1226
1393
|
"""Idempotently register both BugX MCP channels in a host-native file.
|
|
1227
1394
|
|
|
@@ -1293,7 +1460,10 @@ def write_host_mcp_config(
|
|
|
1293
1460
|
# 产出死配置(Codex 从不加载 ``.codex/config.json``),因此直接委托插件,
|
|
1294
1461
|
# 不再复制一份宿主实现。
|
|
1295
1462
|
desired = _host_supervisor_server_definitions(
|
|
1296
|
-
shape=str(host_name).strip().casefold(),
|
|
1463
|
+
shape=str(host_name).strip().casefold(),
|
|
1464
|
+
optional_names=optional_names,
|
|
1465
|
+
docs_transport=docs_transport,
|
|
1466
|
+
docs_remote_url=docs_remote_url,
|
|
1297
1467
|
)
|
|
1298
1468
|
result = migrated.bootstrap(root, desired)
|
|
1299
1469
|
relpath = migrated.project_relpath or ""
|
|
@@ -1319,10 +1489,19 @@ def write_host_mcp_config(
|
|
|
1319
1489
|
target = root / migrated.project_relpath
|
|
1320
1490
|
payload = _load_json_object(target, engine_host_label(host_name))
|
|
1321
1491
|
servers_key = migrated.container_key
|
|
1322
|
-
|
|
1492
|
+
container = payload
|
|
1493
|
+
keys = servers_key.split(".")
|
|
1494
|
+
for k in keys[:-1]:
|
|
1495
|
+
child = container.get(k)
|
|
1496
|
+
if not isinstance(child, dict):
|
|
1497
|
+
child = {}
|
|
1498
|
+
container[k] = child
|
|
1499
|
+
container = child
|
|
1500
|
+
leaf_key = keys[-1]
|
|
1501
|
+
servers = container.get(leaf_key)
|
|
1323
1502
|
if servers is None:
|
|
1324
1503
|
servers = {}
|
|
1325
|
-
|
|
1504
|
+
container[leaf_key] = servers
|
|
1326
1505
|
if not isinstance(servers, dict):
|
|
1327
1506
|
raise CliError(
|
|
1328
1507
|
_i18n_exc(
|
|
@@ -1333,7 +1512,10 @@ def write_host_mcp_config(
|
|
|
1333
1512
|
)
|
|
1334
1513
|
)
|
|
1335
1514
|
desired = _host_supervisor_server_definitions(
|
|
1336
|
-
shape=str(host_name).strip().casefold(),
|
|
1515
|
+
shape=str(host_name).strip().casefold(),
|
|
1516
|
+
optional_names=optional_names,
|
|
1517
|
+
docs_transport=docs_transport,
|
|
1518
|
+
docs_remote_url=docs_remote_url,
|
|
1337
1519
|
)
|
|
1338
1520
|
if migrated.requires_absolutize:
|
|
1339
1521
|
# 宿主声明 ``requires_absolutize=True`` 时按契约落盘**绝对**根(D3
|
|
@@ -1352,7 +1534,12 @@ def write_host_mcp_config(
|
|
|
1352
1534
|
payload[servers_key] = servers
|
|
1353
1535
|
if not isinstance(servers, dict):
|
|
1354
1536
|
raise CliError(_i18n_exc("plugin.funide_servers_not_object", f"FunIDE 配置 {servers_key} 不是对象,拒绝写入: {target}", servers_key=servers_key, target=target))
|
|
1355
|
-
desired = _host_supervisor_server_definitions(
|
|
1537
|
+
desired = _host_supervisor_server_definitions(
|
|
1538
|
+
shape="funide",
|
|
1539
|
+
optional_names=optional_names,
|
|
1540
|
+
docs_transport=docs_transport,
|
|
1541
|
+
docs_remote_url=docs_remote_url,
|
|
1542
|
+
)
|
|
1356
1543
|
elif host_name in {"chatgpt", "workbuddy", "codebuddy"}:
|
|
1357
1544
|
# pi / dsh 已迁移为插件:分别走上方通用 JSON 骨架分支(requires_absolutize
|
|
1358
1545
|
# 声明绝对化)与全局分支(project_relpath=None),这里的遗留路径已不可达。
|
|
@@ -1369,18 +1556,32 @@ def write_host_mcp_config(
|
|
|
1369
1556
|
desired = _host_supervisor_server_definitions(
|
|
1370
1557
|
shape="workbuddy" if host_name == "codebuddy" else host_name,
|
|
1371
1558
|
optional_names=optional_names,
|
|
1559
|
+
docs_transport=docs_transport,
|
|
1560
|
+
docs_remote_url=docs_remote_url,
|
|
1372
1561
|
)
|
|
1373
1562
|
elif host_name == "qoder":
|
|
1374
|
-
target = root /
|
|
1563
|
+
target = root / QODER_PROJECT_MCP_PATHS[0]
|
|
1375
1564
|
payload = _load_json_object(target, "Qoder")
|
|
1376
1565
|
servers_key = "mcpServers"
|
|
1377
1566
|
servers = payload.get(servers_key)
|
|
1378
|
-
if
|
|
1567
|
+
if servers_key not in payload:
|
|
1379
1568
|
servers = {}
|
|
1380
1569
|
payload[servers_key] = servers
|
|
1381
1570
|
if not isinstance(servers, dict):
|
|
1382
1571
|
raise CliError(_i18n_exc("plugin.qoder_servers_not_object", f"Qoder 配置 {servers_key} 不是对象,拒绝写入: {target}", servers_key=servers_key, target=target))
|
|
1383
1572
|
desired = _host_supervisor_server_definitions(shape="qoder", optional_names=optional_names)
|
|
1573
|
+
windows_launcher = _qoder_windows_mcp_launcher() if os.name == "nt" else None
|
|
1574
|
+
# Qoder Desktop can spawn stdio from its application directory.
|
|
1575
|
+
for entry in desired.values():
|
|
1576
|
+
args = entry.get("args")
|
|
1577
|
+
if isinstance(args, list):
|
|
1578
|
+
entry["args"] = _expand_pinned_expected(args, root)
|
|
1579
|
+
if windows_launcher is not None:
|
|
1580
|
+
command, environment = windows_launcher
|
|
1581
|
+
entry["command"] = command
|
|
1582
|
+
entry["args"] = [*_SAFE_PYTHON_MODULE_LAUNCHER_PREFIX, *entry["args"]]
|
|
1583
|
+
if environment:
|
|
1584
|
+
entry["env"] = environment
|
|
1384
1585
|
elif host_name == "trea":
|
|
1385
1586
|
# DOC-169:补全 Trea 的项目级 MCP 写入(flat 形态,与 qoder 同构)。
|
|
1386
1587
|
target = root / ".trea" / "mcp.json"
|
|
@@ -1406,6 +1607,9 @@ def write_host_mcp_config(
|
|
|
1406
1607
|
# 全局作用域宿主按「与本次绝对化期望逐字段相等」判定时效,不能用相对 token。
|
|
1407
1608
|
def _entry_is_current(name: str, current: object) -> bool:
|
|
1408
1609
|
return _absolute_entry_is_current(name, current, desired)
|
|
1610
|
+
elif host_name == "qoder":
|
|
1611
|
+
def _entry_is_current(name: str, current: object) -> bool:
|
|
1612
|
+
return _qoder_mcp_entry_is_current(name, current, root)
|
|
1409
1613
|
else:
|
|
1410
1614
|
_absolutize_facet = engine_host_mcp_write(host_name)
|
|
1411
1615
|
if _absolutize_facet is not None and _absolutize_facet.requires_absolutize:
|
|
@@ -1415,13 +1619,24 @@ def write_host_mcp_config(
|
|
|
1415
1619
|
# 同根重跑逐字段相等 ⇒ unchanged(幂等,不依赖 CLI 进程 cwd)。
|
|
1416
1620
|
if _mcp_entry_has_relative_paths(current):
|
|
1417
1621
|
return False
|
|
1622
|
+
# 直通引擎脚本等宿主专属启动器也属于声明性契约的一部分;
|
|
1623
|
+
# 不能只拿通用 pinned ``bugx mcp`` 模板比较,否则旧启动器会
|
|
1624
|
+
# 被误判为 current,导致 ACP 冷启动超时的修复永远不落盘。
|
|
1625
|
+
return _absolute_entry_is_current(name, current, desired)
|
|
1626
|
+
elif target == root / QODER_PROJECT_MCP_PATHS[0]:
|
|
1627
|
+
# Other hosts sharing the root manifest can reuse Qoder's absolute binding.
|
|
1628
|
+
def _entry_is_current(name: str, current: object) -> bool:
|
|
1418
1629
|
return _host_mcp_entry_is_current(name, current, root)
|
|
1419
1630
|
else:
|
|
1420
1631
|
_entry_is_current = _host_mcp_entry_is_current
|
|
1421
1632
|
optional_managed = {"playwright", "postmcp"}
|
|
1422
1633
|
for name in optional_managed - set(optional_names or set()):
|
|
1423
1634
|
current = servers.get(name)
|
|
1424
|
-
|
|
1635
|
+
is_managed = (
|
|
1636
|
+
_host_mcp_entry_is_current(name, current, root)
|
|
1637
|
+
if host_name == "qoder" else _entry_is_current(name, current)
|
|
1638
|
+
)
|
|
1639
|
+
if is_managed:
|
|
1425
1640
|
servers.pop(name, None)
|
|
1426
1641
|
changed = True
|
|
1427
1642
|
for name, expected in desired.items():
|
|
@@ -1430,9 +1645,37 @@ def write_host_mcp_config(
|
|
|
1430
1645
|
servers[name] = copy.deepcopy(expected)
|
|
1431
1646
|
changed = True
|
|
1432
1647
|
continue
|
|
1433
|
-
|
|
1648
|
+
drop_cwd = host_name == "qoder" and name in HOST_ALL_MCP and "cwd" in current
|
|
1649
|
+
entry_is_current = _entry_is_current(name, current)
|
|
1650
|
+
if name == "bugx-docs" and entry_is_current:
|
|
1651
|
+
effective_transport = resolve_effective_docs_transport(docs_transport, docs_remote_url)
|
|
1652
|
+
if effective_transport == "remote" and current.get("url") != expected.get("url"):
|
|
1653
|
+
entry_is_current = False
|
|
1654
|
+
elif effective_transport == "stdio" and isinstance(current.get("url"), str):
|
|
1655
|
+
entry_is_current = False
|
|
1656
|
+
if drop_cwd or not entry_is_current:
|
|
1434
1657
|
merged = copy.deepcopy(current)
|
|
1435
|
-
|
|
1658
|
+
if not entry_is_current:
|
|
1659
|
+
merged.update(copy.deepcopy(expected))
|
|
1660
|
+
if host_name == "qoder" and os.name == "nt":
|
|
1661
|
+
old_env = current.get("env")
|
|
1662
|
+
if isinstance(old_env, dict):
|
|
1663
|
+
environment = dict(old_env)
|
|
1664
|
+
if environment.get("BUGX_CLI_SOURCE") == "npm":
|
|
1665
|
+
for key in _QODER_NPM_ENV_KEYS:
|
|
1666
|
+
environment.pop(key, None)
|
|
1667
|
+
environment.update(expected.get("env", {}))
|
|
1668
|
+
merged["env"] = environment
|
|
1669
|
+
elif "env" not in expected:
|
|
1670
|
+
merged.pop("env", None)
|
|
1671
|
+
if name == "bugx-docs":
|
|
1672
|
+
if "url" in expected:
|
|
1673
|
+
merged.pop("command", None)
|
|
1674
|
+
merged.pop("args", None)
|
|
1675
|
+
elif "command" in expected:
|
|
1676
|
+
merged.pop("url", None)
|
|
1677
|
+
if drop_cwd:
|
|
1678
|
+
merged.pop("cwd")
|
|
1436
1679
|
servers[name] = merged
|
|
1437
1680
|
changed = True
|
|
1438
1681
|
upgraded = True
|
|
@@ -1501,20 +1744,30 @@ def _read_host_json_servers(path: Path, shape: str) -> dict[str, object]:
|
|
|
1501
1744
|
def _validate_host_supervisor_mcp(
|
|
1502
1745
|
candidates: tuple[tuple[Path, str], ...],
|
|
1503
1746
|
root: Path | None = None,
|
|
1747
|
+
*,
|
|
1748
|
+
merge_servers: bool = False,
|
|
1749
|
+
entry_is_current: Callable[[str, object, Path | None], bool] = _host_mcp_entry_is_current,
|
|
1504
1750
|
) -> tuple[bool, str]:
|
|
1505
|
-
"""Require current, enabled
|
|
1751
|
+
"""Require current, enabled BugX entries in the host's effective config.
|
|
1506
1752
|
|
|
1507
1753
|
``root`` 用于判定用户级绝对 ``--root`` 是否指向**本项目**(语义等价比对),
|
|
1508
1754
|
缺省时只接受 pinned 相对形式。
|
|
1509
1755
|
"""
|
|
1756
|
+
configs = [
|
|
1757
|
+
(str(path), servers)
|
|
1758
|
+
for path, shape in candidates
|
|
1759
|
+
if (servers := _read_host_json_servers(path, shape))
|
|
1760
|
+
]
|
|
1761
|
+
if merge_servers and configs:
|
|
1762
|
+
# Candidates are in load order. A higher-priority definition replaces
|
|
1763
|
+
# the whole server entry, including an explicitly disabled entry.
|
|
1764
|
+
merged = {name: entry for _, servers in configs for name, entry in servers.items()}
|
|
1765
|
+
configs = [(" + ".join(path for path, _ in configs), merged)]
|
|
1510
1766
|
partial: list[str] = []
|
|
1511
|
-
for path,
|
|
1512
|
-
servers = _read_host_json_servers(path, shape)
|
|
1513
|
-
if not servers:
|
|
1514
|
-
continue
|
|
1767
|
+
for path, servers in configs:
|
|
1515
1768
|
missing_or_stale = [
|
|
1516
1769
|
name for name in HOST_ALL_MCP
|
|
1517
|
-
if not
|
|
1770
|
+
if not entry_is_current(name, servers.get(name), root)
|
|
1518
1771
|
]
|
|
1519
1772
|
if not missing_or_stale:
|
|
1520
1773
|
return True, _i18n_prompt("plugin.mcp_registered", f"已在 {path} 注册并启用 bugx-supervisor host/worker 双通道与 docs 服务", path=path)
|
|
@@ -2100,7 +2353,7 @@ def _host_project_mcp_config_target(root: Path, host_name: str) -> tuple[Path, s
|
|
|
2100
2353
|
}
|
|
2101
2354
|
return root / rel_map[host_name], "mcpServers"
|
|
2102
2355
|
if host_name == "qoder":
|
|
2103
|
-
return root /
|
|
2356
|
+
return root / QODER_PROJECT_MCP_PATHS[0], "mcpServers"
|
|
2104
2357
|
if host_name == "trea":
|
|
2105
2358
|
return root / ".trea" / "mcp.json", "mcpServers"
|
|
2106
2359
|
if host_name == "opencode":
|
|
@@ -2156,7 +2409,14 @@ def _remove_host_mcp_entry(
|
|
|
2156
2409
|
preserved.extend(str(item) for item in (outcome.get("preserved") or ()))
|
|
2157
2410
|
return
|
|
2158
2411
|
|
|
2159
|
-
def _is_bugx_mcp_entry(name: str, entry: object) -> bool:
|
|
2412
|
+
def _is_bugx_mcp_entry(name: str, entry: object, *, shared: bool) -> bool:
|
|
2413
|
+
if shared:
|
|
2414
|
+
return name in HOST_ALL_MCP or (
|
|
2415
|
+
name in {"playwright", "postmcp"}
|
|
2416
|
+
and _mcp_tokens_match(
|
|
2417
|
+
_host_mcp_command_tokens(entry), OPENCODE_PINNED_MCP_COMMANDS[name], root,
|
|
2418
|
+
)
|
|
2419
|
+
)
|
|
2160
2420
|
if name in HOST_ALL_MCP or "bugx" in name.lower():
|
|
2161
2421
|
return True
|
|
2162
2422
|
tokens = _host_mcp_command_tokens(entry)
|
|
@@ -2203,7 +2463,8 @@ def _remove_host_mcp_entry(
|
|
|
2203
2463
|
if not isinstance(servers, dict):
|
|
2204
2464
|
continue
|
|
2205
2465
|
|
|
2206
|
-
|
|
2466
|
+
shared = path == root / QODER_PROJECT_MCP_PATHS[0]
|
|
2467
|
+
bugx_keys = [k for k, v in servers.items() if _is_bugx_mcp_entry(k, v, shared=shared)]
|
|
2207
2468
|
if not bugx_keys:
|
|
2208
2469
|
continue
|
|
2209
2470
|
|
|
@@ -2257,17 +2518,6 @@ def _remove_claude_mcp_entry(
|
|
|
2257
2518
|
)
|
|
2258
2519
|
|
|
2259
2520
|
|
|
2260
|
-
def _remove_qoder_mcp_entry(
|
|
2261
|
-
root: Path, removed: list[str], preserved: list[str], *, backup_host: str = "qoder",
|
|
2262
|
-
backup_dir: Path | None = None,
|
|
2263
|
-
) -> None:
|
|
2264
|
-
"""Remove BugX supervisor MCP channels from .qoder/mcp.json on qoder uninstall."""
|
|
2265
|
-
_remove_host_mcp_entry(
|
|
2266
|
-
root, "qoder", removed, preserved,
|
|
2267
|
-
backup_host=backup_host, backup_dir=backup_dir,
|
|
2268
|
-
)
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
2521
|
def _remove_dsh_project_files(
|
|
2272
2522
|
root: Path, removed: list[str], preserved: list[str],
|
|
2273
2523
|
records: list[object] | None = None, *, backup_host: str = "dsh",
|