bugx-cli 0.1.2 → 0.1.3
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/README.md +26 -29
- package/core/agent/agent_orchestrator.py +3 -0
- package/core/agent/agent_workspace.py +14 -2
- package/core/assets/twitter_promo_art.jpg +0 -0
- package/core/assets/twitter_promo_card.svg +166 -0
- package/core/assets/twitter_promo_clean.jpg +0 -0
- package/core/assets/twitter_terminal_real.png +0 -0
- package/core/bugx.md +2 -2
- package/core/bugx_paths.py +2 -2
- package/core/cli-help.txt +1 -1
- package/core/contracts/bugx-opencode.md +1 -1
- package/core/contracts/bugx-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/engine-integrity.json +82 -42
- package/core/host_acp/kimi.py +175 -0
- package/core/host_acp/minimax.py +28 -0
- package/core/host_runtime/host_registry.py +23 -3
- package/core/hosts/dsh.py +1 -1
- package/core/hosts/kimi.py +293 -0
- package/core/hosts/minimax.py +248 -0
- package/core/hosts/zcode.py +5 -0
- package/core/infra/build_info.py +30 -5
- package/core/launch_phases/startup_version_gate.py +2 -2
- package/core/launch_phases/supervisor_bridge.py +14 -23
- package/core/metadata.txt +2 -2
- package/core/runtime/scenario_eval.py +1 -1
- package/core/runtime/setup_ui_env.py +4 -7
- package/core/supervisor/cli.py +2 -2
- package/core/webui/mcp_inspector.py +6 -0
- package/core/webui/static/index.html +51 -3
- package/core/webui/static/manifest.webmanifest +1 -1
- package/core/webui/static/project-settings.js +18 -3
- package/core/webui/static/robots.txt +36 -0
- package/core/webui/static/sitemap.xml +15 -0
- package/docs/07_distribution/01_README_NPM.md +26 -29
- package/ecosystem/integrations/cline/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/agents/bugx.md +1 -1
- package/ecosystem/integrations/dsh/dsh-patch.yml +2 -2
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +1 -1
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/pi/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/qoder/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/marketplace.json +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +4 -4
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/agents/bugx-worker.md +1 -1
- package/ecosystem/plugins/bugx/agents/bugx.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +3 -3
- package/ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +1 -1
- package/interfaces/bin/bugx.js +2 -0
- package/interfaces/cli/bugx_cli/__init__.py +2 -2
- package/interfaces/cli/bugx_cli/cli.py +15 -0
- package/interfaces/cli/bugx_cli/commands/agent.py +192 -67
- package/interfaces/cli/bugx_cli/commands/doctor.py +18 -0
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +54 -47
- package/interfaces/cli/bugx_cli/commands/plugin.py +6 -6
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +27 -13
- package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +348 -0
- package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +322 -0
- package/interfaces/cli/bugx_cli/commands/plugin_qoder.py +3 -4
- package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +4 -5
- package/interfaces/cli/bugx_cli/commands/system.py +64 -4
- package/interfaces/cli/bugx_cli/common.py +96 -7
- package/interfaces/cli/bugx_cli/host_adapters.py +150 -4
- package/interfaces/cli/bugx_cli/hosts/registry.py +4 -2
- package/interfaces/cli/bugx_cli/hosts/template_engine.py +10 -9
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +4 -4
- package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +2 -2
- package/package.json +37 -13
- package/pyproject.toml +36 -12
- package/scripts/sync-version.mjs +1 -1
- package/skills/README.md +25 -0
- package/skills/platform/bugx-user/SKILL.md +92 -0
|
@@ -12,6 +12,7 @@ from ..common import (
|
|
|
12
12
|
_backup_host_resource,
|
|
13
13
|
_i18n_exc,
|
|
14
14
|
_i18n_prompt,
|
|
15
|
+
_remove_tree_force,
|
|
15
16
|
_resolve_locale_name,
|
|
16
17
|
)
|
|
17
18
|
from ..host_adapters import (
|
|
@@ -104,13 +105,11 @@ def _qoder_user_agent_content_worker(*, locale: str | None = None) -> str:
|
|
|
104
105
|
|
|
105
106
|
def _clean_legacy_qoder_plugin_and_skills() -> None:
|
|
106
107
|
"""清理历史遗留的 Qoder 散装技能目录与插件注册(Option A 收敛保障)。"""
|
|
107
|
-
import shutil
|
|
108
|
-
|
|
109
108
|
# 1. 清理 ~/.qoder/skills/bugx
|
|
110
109
|
try:
|
|
111
110
|
user_skill = _qoder_user_skills_dir() / "bugx"
|
|
112
111
|
if user_skill.is_dir() and not user_skill.is_symlink():
|
|
113
|
-
|
|
112
|
+
_remove_tree_force(user_skill)
|
|
114
113
|
except OSError:
|
|
115
114
|
pass
|
|
116
115
|
|
|
@@ -118,7 +117,7 @@ def _clean_legacy_qoder_plugin_and_skills() -> None:
|
|
|
118
117
|
try:
|
|
119
118
|
cache_parent = _qoder_user_plugins_dir() / "cache" / "bugx-agent"
|
|
120
119
|
if cache_parent.is_dir() and not cache_parent.is_symlink():
|
|
121
|
-
|
|
120
|
+
_remove_tree_force(cache_parent)
|
|
122
121
|
except OSError:
|
|
123
122
|
pass
|
|
124
123
|
|
|
@@ -54,7 +54,7 @@ def _zcode_plugin_manifest(version: str = __version__) -> dict[str, object]:
|
|
|
54
54
|
return {
|
|
55
55
|
"name": CHATGPT_PLUGIN_NAME,
|
|
56
56
|
"version": version,
|
|
57
|
-
"description": "Autonomous code review and
|
|
57
|
+
"description": "Autonomous code review and testing agent. Catches hidden deep bugs for developers, automates black-box, functional, and performance testing for QA, and ensures rock-solid software delivery.",
|
|
58
58
|
"homepage": "https://bugx.dev",
|
|
59
59
|
"author": {
|
|
60
60
|
"name": "BugX",
|
|
@@ -130,10 +130,9 @@ def _zcode_storage_dir_override() -> Path:
|
|
|
130
130
|
raw = storage.get("dir") if isinstance(storage, dict) else None
|
|
131
131
|
if isinstance(raw, str) and raw.strip():
|
|
132
132
|
raw = raw.strip()
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return Path(raw)
|
|
133
|
+
expanded = Path(raw).expanduser()
|
|
134
|
+
if expanded.is_absolute():
|
|
135
|
+
return expanded
|
|
137
136
|
return home / ".zcode"
|
|
138
137
|
|
|
139
138
|
|
|
@@ -8,6 +8,7 @@ import hashlib
|
|
|
8
8
|
import importlib.metadata
|
|
9
9
|
import io
|
|
10
10
|
import json
|
|
11
|
+
import math
|
|
11
12
|
import os
|
|
12
13
|
import re
|
|
13
14
|
import shutil
|
|
@@ -49,6 +50,9 @@ _STABLE_AGENT_FILES_HOST = "files.pythonhosted.org"
|
|
|
49
50
|
_MAX_PYPI_METADATA_BYTES = 4 * 1024 * 1024
|
|
50
51
|
_MAX_PYPI_WHEEL_BYTES = 128 * 1024 * 1024
|
|
51
52
|
|
|
53
|
+
DEFAULT_PROBE_TIMEOUT_SECONDS = 120.0
|
|
54
|
+
MAX_PROBE_TIMEOUT_SECONDS = 1800.0
|
|
55
|
+
|
|
52
56
|
|
|
53
57
|
def completion_tree(parser: argparse.ArgumentParser) -> dict[str, tuple[str, ...]]:
|
|
54
58
|
"""Derive nested commands, enum selectors and options from the CLI parser."""
|
|
@@ -2364,18 +2368,74 @@ def command_engine(args: argparse.Namespace) -> int:
|
|
|
2364
2368
|
)
|
|
2365
2369
|
|
|
2366
2370
|
|
|
2371
|
+
def _parse_probe_timeout(raw: object) -> float:
|
|
2372
|
+
"""Parse the bounded outer watchdog used by ``bugx probe``."""
|
|
2373
|
+
try:
|
|
2374
|
+
value = float(raw)
|
|
2375
|
+
except (TypeError, ValueError) as exc:
|
|
2376
|
+
raise argparse.ArgumentTypeError("--timeout-seconds 必须是数字") from exc
|
|
2377
|
+
if not math.isfinite(value) or value <= 0 or value > MAX_PROBE_TIMEOUT_SECONDS:
|
|
2378
|
+
raise argparse.ArgumentTypeError(
|
|
2379
|
+
f"--timeout-seconds 必须在 0 和 {MAX_PROBE_TIMEOUT_SECONDS:g} 秒之间"
|
|
2380
|
+
)
|
|
2381
|
+
return value
|
|
2382
|
+
|
|
2383
|
+
|
|
2384
|
+
def _extract_probe_timeout(
|
|
2385
|
+
args: argparse.Namespace, actual_extra: list[str],
|
|
2386
|
+
) -> tuple[list[str], float]:
|
|
2387
|
+
"""Extract the outer timeout without forwarding it to the probe script.
|
|
2388
|
+
|
|
2389
|
+
``probe_args`` uses ``argparse.REMAINDER``, so users may put the option
|
|
2390
|
+
after the probe kind as well as before it. Keeping the extraction here
|
|
2391
|
+
makes both forms equivalent and prevents ``ui_audit.py`` from seeing a
|
|
2392
|
+
BugX wrapper option it does not own.
|
|
2393
|
+
"""
|
|
2394
|
+
configured = getattr(args, "timeout_seconds", None)
|
|
2395
|
+
forwarded: list[str] = []
|
|
2396
|
+
forwarded_timeout: float | None = None
|
|
2397
|
+
index = 0
|
|
2398
|
+
while index < len(actual_extra):
|
|
2399
|
+
token = actual_extra[index]
|
|
2400
|
+
if token == "--timeout-seconds":
|
|
2401
|
+
if forwarded_timeout is not None or index + 1 >= len(actual_extra):
|
|
2402
|
+
raise CliError("--timeout-seconds 只能指定一次并且必须带值")
|
|
2403
|
+
try:
|
|
2404
|
+
forwarded_timeout = _parse_probe_timeout(actual_extra[index + 1])
|
|
2405
|
+
except argparse.ArgumentTypeError as exc:
|
|
2406
|
+
raise CliError(str(exc)) from exc
|
|
2407
|
+
index += 2
|
|
2408
|
+
continue
|
|
2409
|
+
if token.startswith("--timeout-seconds="):
|
|
2410
|
+
if forwarded_timeout is not None:
|
|
2411
|
+
raise CliError("--timeout-seconds 只能指定一次")
|
|
2412
|
+
try:
|
|
2413
|
+
forwarded_timeout = _parse_probe_timeout(token.split("=", 1)[1])
|
|
2414
|
+
except argparse.ArgumentTypeError as exc:
|
|
2415
|
+
raise CliError(str(exc)) from exc
|
|
2416
|
+
index += 1
|
|
2417
|
+
continue
|
|
2418
|
+
forwarded.append(token)
|
|
2419
|
+
index += 1
|
|
2420
|
+
|
|
2421
|
+
if configured is not None and forwarded_timeout is not None:
|
|
2422
|
+
raise CliError("--timeout-seconds 只能指定一次")
|
|
2423
|
+
timeout = configured if configured is not None else forwarded_timeout
|
|
2424
|
+
return forwarded, _parse_probe_timeout(
|
|
2425
|
+
DEFAULT_PROBE_TIMEOUT_SECONDS if timeout is None else timeout
|
|
2426
|
+
)
|
|
2427
|
+
|
|
2428
|
+
|
|
2367
2429
|
def command_probe(args: argparse.Namespace, extra_args: list[str] | None = None) -> int:
|
|
2368
2430
|
"""运行探针包装命令,透传选定 probe 的参数。"""
|
|
2369
2431
|
root = args.root.resolve()
|
|
2370
2432
|
script_name = PROBE_SCRIPTS[args.probe_kind]
|
|
2371
|
-
forward_args: list[str] = []
|
|
2372
2433
|
actual_extra = extra_args if extra_args is not None else getattr(args, "probe_args", [])
|
|
2373
|
-
|
|
2374
|
-
forward_args.extend(actual_extra)
|
|
2434
|
+
forward_args, timeout = _extract_probe_timeout(args, list(actual_extra))
|
|
2375
2435
|
if args.probe_kind not in PROBES_WITHOUT_ROOT_ARGUMENT \
|
|
2376
2436
|
and "--root" not in forward_args and "-r" not in forward_args:
|
|
2377
2437
|
forward_args.extend(["--root", str(root)])
|
|
2378
|
-
return _run_script(root, script_name, forward_args, timeout=
|
|
2438
|
+
return _run_script(root, script_name, forward_args, timeout=timeout)
|
|
2379
2439
|
|
|
2380
2440
|
|
|
2381
2441
|
def command_mcp_prune(args: argparse.Namespace) -> int:
|
|
@@ -14,6 +14,7 @@ import json
|
|
|
14
14
|
import os
|
|
15
15
|
import re
|
|
16
16
|
import shutil
|
|
17
|
+
import stat
|
|
17
18
|
import subprocess
|
|
18
19
|
import sys
|
|
19
20
|
import sysconfig
|
|
@@ -633,9 +634,9 @@ def _ensure_project_readme(root: Path, source: Path) -> None:
|
|
|
633
634
|
def _run_script(root: Path, name: str, arguments: list[str], timeout: float | None = None) -> int:
|
|
634
635
|
"""运行 core 脚本并透传退出码。
|
|
635
636
|
|
|
636
|
-
``timeout
|
|
637
|
-
|
|
638
|
-
stdio,保持 None(不设超时)。
|
|
637
|
+
``timeout`` 由调用方提供。``bugx probe`` 使用有界的 120 秒默认看护
|
|
638
|
+
(CLI 可显式调整到 1800 秒以内),以防失控脚本永久挂起;mcp serve
|
|
639
|
+
与 mcp-runtime start 需要长驻/直通 stdio,保持 None(不设超时)。
|
|
639
640
|
"""
|
|
640
641
|
_ensure_core_importable()
|
|
641
642
|
try:
|
|
@@ -685,6 +686,69 @@ def _run_script(root: Path, name: str, arguments: list[str], timeout: float | No
|
|
|
685
686
|
raise CliError(_i18n_exc("common.script_run_failed", f"无法运行 {name}: {exc}", name=name, exc=exc)) from exc
|
|
686
687
|
|
|
687
688
|
|
|
689
|
+
def _remove_tree_force(path: Path) -> None:
|
|
690
|
+
"""Remove an already-validated BugX-owned path despite read-only bits.
|
|
691
|
+
|
|
692
|
+
Windows refuses to unlink read-only files even when their parent directory
|
|
693
|
+
is writable. The helper validates the parent path components before
|
|
694
|
+
changing permissions and never follows symlinks while doing so. Callers
|
|
695
|
+
still remain responsible for the higher-level ownership decision.
|
|
696
|
+
"""
|
|
697
|
+
path = Path(path)
|
|
698
|
+
_assert_no_symlink_components(path.parent)
|
|
699
|
+
if path.is_symlink():
|
|
700
|
+
path.unlink(missing_ok=True)
|
|
701
|
+
return
|
|
702
|
+
if path.is_file():
|
|
703
|
+
try:
|
|
704
|
+
path.unlink()
|
|
705
|
+
except PermissionError:
|
|
706
|
+
parent = path.parent
|
|
707
|
+
if not parent.is_symlink():
|
|
708
|
+
os.chmod(parent, stat.S_IMODE(parent.stat().st_mode) | 0o700)
|
|
709
|
+
os.chmod(path, stat.S_IMODE(path.stat().st_mode) | stat.S_IWUSR)
|
|
710
|
+
path.unlink()
|
|
711
|
+
return
|
|
712
|
+
if not path.exists():
|
|
713
|
+
return
|
|
714
|
+
|
|
715
|
+
for current, _directories, files in os.walk(path, topdown=True, followlinks=False):
|
|
716
|
+
current_path = Path(current)
|
|
717
|
+
try:
|
|
718
|
+
os.chmod(current_path, stat.S_IMODE(current_path.stat().st_mode) | 0o700)
|
|
719
|
+
except OSError:
|
|
720
|
+
pass
|
|
721
|
+
for name in files:
|
|
722
|
+
target = current_path / name
|
|
723
|
+
if target.is_symlink():
|
|
724
|
+
continue
|
|
725
|
+
try:
|
|
726
|
+
os.chmod(target, stat.S_IMODE(target.stat().st_mode) | stat.S_IWUSR)
|
|
727
|
+
except OSError:
|
|
728
|
+
pass
|
|
729
|
+
|
|
730
|
+
def _on_error(func, target, _exc): # noqa: ANN001 - stdlib callback signature
|
|
731
|
+
target_path = Path(target)
|
|
732
|
+
try:
|
|
733
|
+
if not target_path.is_symlink():
|
|
734
|
+
os.chmod(
|
|
735
|
+
target_path,
|
|
736
|
+
stat.S_IMODE(target_path.stat().st_mode)
|
|
737
|
+
| (stat.S_IWUSR if target_path.is_file() else 0o700),
|
|
738
|
+
)
|
|
739
|
+
parent = target_path.parent
|
|
740
|
+
if parent != target_path and not parent.is_symlink():
|
|
741
|
+
os.chmod(parent, stat.S_IMODE(parent.stat().st_mode) | 0o700)
|
|
742
|
+
except OSError:
|
|
743
|
+
pass
|
|
744
|
+
func(target)
|
|
745
|
+
|
|
746
|
+
try:
|
|
747
|
+
shutil.rmtree(path, onexc=_on_error)
|
|
748
|
+
except TypeError: # Python < 3.12
|
|
749
|
+
shutil.rmtree(path, onerror=_on_error)
|
|
750
|
+
|
|
751
|
+
|
|
688
752
|
def _run_script_json(
|
|
689
753
|
root: Path, name: str, arguments: list[str], timeout: float | None = 300.0,
|
|
690
754
|
) -> dict | None:
|
|
@@ -751,6 +815,8 @@ def _python_environment(overrides: dict[str, str] | None = None) -> dict[str, st
|
|
|
751
815
|
continue
|
|
752
816
|
environment["PATH"] = os.pathsep.join(entries)
|
|
753
817
|
environment["PYTHONDONTWRITEBYTECODE"] = "1"
|
|
818
|
+
environment["PYTHONUTF8"] = "1"
|
|
819
|
+
environment["PYTHONIOENCODING"] = "utf-8"
|
|
754
820
|
if "BUGX_PYTHON" not in environment and sys.executable:
|
|
755
821
|
environment["BUGX_PYTHON"] = sys.executable
|
|
756
822
|
if overrides:
|
|
@@ -892,11 +958,34 @@ def get_build_id() -> int | None:
|
|
|
892
958
|
return None
|
|
893
959
|
|
|
894
960
|
|
|
961
|
+
def is_dev_mode() -> bool:
|
|
962
|
+
"""是否处于 dev / alpha 开发模式。正式版(Stable)返回 False。"""
|
|
963
|
+
if os.environ.get("BUGX_DEV") in ("1", "true", "yes", "on"):
|
|
964
|
+
return True
|
|
965
|
+
env = os.environ.get("BUGX_ENV", "").strip().lower()
|
|
966
|
+
if env in ("dev", "development", "local", "test"):
|
|
967
|
+
return True
|
|
968
|
+
try:
|
|
969
|
+
from core.infra.client_metadata import release_channel, client_marker
|
|
970
|
+
channel = release_channel()
|
|
971
|
+
marker = client_marker()
|
|
972
|
+
if channel != "stable" or marker in ("dev", "alpha"):
|
|
973
|
+
return True
|
|
974
|
+
except Exception:
|
|
975
|
+
pass
|
|
976
|
+
return False
|
|
977
|
+
|
|
978
|
+
|
|
895
979
|
def get_full_version() -> str:
|
|
896
|
-
"""
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
980
|
+
"""返回标准版本展示字符串。
|
|
981
|
+
|
|
982
|
+
正式版(Stable / Release)输出纯语义版本(如 0.1.3,不带 Build ID);
|
|
983
|
+
只有 dev / alpha 模式才携带(如 0.1.3+build.1)。
|
|
984
|
+
"""
|
|
985
|
+
if is_dev_mode():
|
|
986
|
+
bid = get_build_id()
|
|
987
|
+
if bid is not None:
|
|
988
|
+
return f"{__version__}+build.{bid}"
|
|
900
989
|
return __version__
|
|
901
990
|
|
|
902
991
|
|
|
@@ -521,6 +521,8 @@ def _claude_app_markers() -> tuple[Path, ...]:
|
|
|
521
521
|
relative_paths = (
|
|
522
522
|
"Claude/Claude.exe",
|
|
523
523
|
"Programs/Claude/Claude.exe",
|
|
524
|
+
"Program Files/Claude/Claude.exe",
|
|
525
|
+
"Program Files (x86)/Claude/Claude.exe",
|
|
524
526
|
)
|
|
525
527
|
for base in bases:
|
|
526
528
|
markers.extend(base / rel for rel in relative_paths)
|
|
@@ -533,6 +535,50 @@ def _claude_app_markers() -> tuple[Path, ...]:
|
|
|
533
535
|
return tuple(dict.fromkeys(markers))
|
|
534
536
|
|
|
535
537
|
|
|
538
|
+
def _kimi_app_markers() -> tuple[Path, ...]:
|
|
539
|
+
"""Return well-known Kimi desktop application locations."""
|
|
540
|
+
home = Path.home()
|
|
541
|
+
markers: list[Path] = []
|
|
542
|
+
if platform.system() == "Darwin":
|
|
543
|
+
markers.extend((
|
|
544
|
+
Path("/Applications/Kimi.app"),
|
|
545
|
+
Path("/Applications/Kimi Code.app"),
|
|
546
|
+
home / "Applications" / "Kimi.app",
|
|
547
|
+
home / "Applications" / "Kimi Code.app",
|
|
548
|
+
home / "Library" / "Application Support" / "kimi-desktop",
|
|
549
|
+
home / "Library" / "Application Support" / "Kimi Code",
|
|
550
|
+
))
|
|
551
|
+
elif platform.system() == "Windows":
|
|
552
|
+
bases = [
|
|
553
|
+
Path(value) for variable in
|
|
554
|
+
("LOCALAPPDATA", "APPDATA", "PROGRAMFILES", "PROGRAMFILES(X86)")
|
|
555
|
+
if (value := os.environ.get(variable))
|
|
556
|
+
]
|
|
557
|
+
bases.extend(_windows_drive_roots())
|
|
558
|
+
relative_paths = (
|
|
559
|
+
"Kimi/Kimi.exe",
|
|
560
|
+
"kimi-desktop/Kimi.exe",
|
|
561
|
+
"Kimi Code/Kimi Code.exe",
|
|
562
|
+
"Programs/Kimi/Kimi.exe",
|
|
563
|
+
"Programs/kimi-desktop/Kimi.exe",
|
|
564
|
+
"Programs/Kimi Code/Kimi Code.exe",
|
|
565
|
+
"Program Files/Kimi Code/Kimi Code.exe",
|
|
566
|
+
"Program Files (x86)/Kimi Code/Kimi Code.exe",
|
|
567
|
+
)
|
|
568
|
+
for base in bases:
|
|
569
|
+
markers.extend(base / rel for rel in relative_paths)
|
|
570
|
+
else:
|
|
571
|
+
markers.extend((
|
|
572
|
+
home / ".local" / "share" / "applications" / "kimi.desktop",
|
|
573
|
+
home / ".local" / "share" / "applications" / "kimi-code.desktop",
|
|
574
|
+
Path("/usr/bin/kimi-desktop"),
|
|
575
|
+
Path("/usr/bin/kimi-code"),
|
|
576
|
+
Path("/opt/Kimi/kimi"),
|
|
577
|
+
Path("/opt/Kimi Code/kimi-code"),
|
|
578
|
+
))
|
|
579
|
+
return tuple(dict.fromkeys(markers))
|
|
580
|
+
|
|
581
|
+
|
|
536
582
|
def _qoder_app_markers() -> tuple[Path, ...]:
|
|
537
583
|
"""Return well-known Qoder desktop application locations."""
|
|
538
584
|
home = Path.home()
|
|
@@ -619,12 +665,22 @@ def _trea_app_markers() -> tuple[Path, ...]:
|
|
|
619
665
|
"Programs/trae/Trae.exe",
|
|
620
666
|
"Trae/Trae.exe",
|
|
621
667
|
"trae/Trae.exe",
|
|
668
|
+
"Program Files/Trae/Trae.exe",
|
|
669
|
+
"Program Files (x86)/Trae/Trae.exe",
|
|
670
|
+
"Program Files/trae/Trae.exe",
|
|
671
|
+
"Program Files (x86)/trae/Trae.exe",
|
|
622
672
|
"Programs/Trae CN/Trae CN.exe",
|
|
623
673
|
"Programs/Trae CN/trae-cn.exe",
|
|
624
674
|
"Programs/Trae CN/Trae.exe",
|
|
625
675
|
"Trae CN/Trae CN.exe",
|
|
626
676
|
"Trae CN/trae-cn.exe",
|
|
627
677
|
"Trae CN/Trae.exe",
|
|
678
|
+
"Program Files/Trae CN/Trae CN.exe",
|
|
679
|
+
"Program Files (x86)/Trae CN/Trae CN.exe",
|
|
680
|
+
"Program Files/Trae CN/trae-cn.exe",
|
|
681
|
+
"Program Files (x86)/Trae CN/trae-cn.exe",
|
|
682
|
+
"Program Files/Trae CN/Trae.exe",
|
|
683
|
+
"Program Files (x86)/Trae CN/Trae.exe",
|
|
628
684
|
)
|
|
629
685
|
for base in bases:
|
|
630
686
|
markers.extend(base / rel for rel in relative_paths)
|
|
@@ -1202,6 +1258,7 @@ CAP_GLOBAL_AGENT_LINK = "global-agent-link" # 注册用户级全局 age
|
|
|
1202
1258
|
CAP_GLOBAL_SKILL_LINK = "global-skill-link" # 注册用户级全局 skill 链接
|
|
1203
1259
|
CAP_NATIVE_MCP_CONFIG = "native-mcp-config" # 需要写宿主原生项目/工作区 MCP 容器
|
|
1204
1260
|
CAP_USER_AGENT_REGISTRATION = "user-agent-registration" # 需要用户级子智能体注册
|
|
1261
|
+
CAP_USER_LEVEL_PLUGIN = "user-level-plugin" # 需要写用户级 Plugin V1 包
|
|
1205
1262
|
CAP_USER_LEVEL_ARTIFACT = "user-level-artifact" # 需要写用户级 Skill / Connector 产物
|
|
1206
1263
|
CAP_WORKSPACE_MIRROR = "workspace-mirror" # 支持工作区同构镜像(如 Roo Code .roo)
|
|
1207
1264
|
#: 需要把入口额外镜像到本宿主的**变体目录**(如 Trae 的 .trae / .trae-cn)。
|
|
@@ -1213,6 +1270,8 @@ HOST_NAME_ZCODE = "zcode"
|
|
|
1213
1270
|
HOST_NAME_CLAUDE = "claude"
|
|
1214
1271
|
HOST_NAME_QODER = "qoder"
|
|
1215
1272
|
HOST_NAME_FUNIDE = "funide"
|
|
1273
|
+
HOST_NAME_KIMI = "kimi"
|
|
1274
|
+
HOST_NAME_MINIMAX = "minimax"
|
|
1216
1275
|
|
|
1217
1276
|
|
|
1218
1277
|
@dataclass(frozen=True)
|
|
@@ -1284,6 +1343,8 @@ class HostAdapter:
|
|
|
1284
1343
|
return ["skill", "extension"]
|
|
1285
1344
|
if self.supports(CAP_DISTRIBUTION_PLUGIN):
|
|
1286
1345
|
return ["plugin"]
|
|
1346
|
+
if self.supports(CAP_USER_LEVEL_PLUGIN):
|
|
1347
|
+
return ["plugin"]
|
|
1287
1348
|
return ["entry"]
|
|
1288
1349
|
|
|
1289
1350
|
def detect(self, root: Path) -> dict[str, object]:
|
|
@@ -1442,6 +1503,70 @@ class ClaudeAdapter(HostAdapter):
|
|
|
1442
1503
|
return _ensure_claude_user_agents(root, source, locale=locale)
|
|
1443
1504
|
|
|
1444
1505
|
|
|
1506
|
+
class KimiAdapter(HostAdapter):
|
|
1507
|
+
"""Kimi Code CLI & Desktop adapter."""
|
|
1508
|
+
|
|
1509
|
+
def _app_markers(self) -> tuple[Path, ...]:
|
|
1510
|
+
return _kimi_app_markers()
|
|
1511
|
+
|
|
1512
|
+
def _user_marker(self) -> bool:
|
|
1513
|
+
configured = os.environ.get("KIMI_CODE_HOME")
|
|
1514
|
+
kimi_home = (
|
|
1515
|
+
Path(configured).expanduser()
|
|
1516
|
+
if configured and configured.strip()
|
|
1517
|
+
else Path.home() / ".kimi-code"
|
|
1518
|
+
)
|
|
1519
|
+
return kimi_home.is_dir()
|
|
1520
|
+
|
|
1521
|
+
def render_required_entry(
|
|
1522
|
+
self, relative: str, source: Path, *, locale: str | None = None,
|
|
1523
|
+
) -> str | None:
|
|
1524
|
+
if relative.endswith("bugx-worker.md"):
|
|
1525
|
+
return render_claude_worker_entry(locale=locale)
|
|
1526
|
+
return None
|
|
1527
|
+
|
|
1528
|
+
def ensure_user_agents(
|
|
1529
|
+
self, root: Path, source: Path, *, locale: str | None = None,
|
|
1530
|
+
) -> dict[str, object] | None:
|
|
1531
|
+
from .commands.plugin_kimi import _ensure_kimi_plugin
|
|
1532
|
+
return _ensure_kimi_plugin(root, source, locale=locale)
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
class MiniMaxAdapter(HostAdapter):
|
|
1536
|
+
"""MiniMax Code desktop Plugin V1 adapter."""
|
|
1537
|
+
|
|
1538
|
+
def _app_markers(self) -> tuple[Path, ...]:
|
|
1539
|
+
plugin = engine_host_plugin(self.name)
|
|
1540
|
+
marker_factory = plugin.identity.app_markers
|
|
1541
|
+
return tuple(marker_factory()) if marker_factory is not None else ()
|
|
1542
|
+
|
|
1543
|
+
def _user_marker(self) -> bool:
|
|
1544
|
+
configured = os.environ.get("MINIMAX_DATA_DIR")
|
|
1545
|
+
data_dir = (
|
|
1546
|
+
Path(configured).expanduser()
|
|
1547
|
+
if configured and configured.strip()
|
|
1548
|
+
else Path.home() / ".minimax"
|
|
1549
|
+
)
|
|
1550
|
+
return (
|
|
1551
|
+
data_dir / "plugins" / "bugx" / ".minimax-plugin" / "plugin.json"
|
|
1552
|
+
).is_file()
|
|
1553
|
+
|
|
1554
|
+
def _project_marker(self, root: Path) -> bool:
|
|
1555
|
+
if self._user_marker():
|
|
1556
|
+
return True
|
|
1557
|
+
return super()._project_marker(root)
|
|
1558
|
+
|
|
1559
|
+
@property
|
|
1560
|
+
def installed_components(self) -> list[str]:
|
|
1561
|
+
return ["plugin", "agent", "worker", "skill", "mcp"]
|
|
1562
|
+
|
|
1563
|
+
def ensure_user_agents(
|
|
1564
|
+
self, root: Path, source: Path, *, locale: str | None = None,
|
|
1565
|
+
) -> dict[str, object] | None:
|
|
1566
|
+
from .commands.plugin_minimax import _ensure_minimax_plugin
|
|
1567
|
+
return _ensure_minimax_plugin(root, source, locale=locale)
|
|
1568
|
+
|
|
1569
|
+
|
|
1445
1570
|
class ZCodeAdapter(HostAdapter):
|
|
1446
1571
|
"""ZCode IDE adapter."""
|
|
1447
1572
|
|
|
@@ -1624,6 +1749,14 @@ class TreaAdapter(HostAdapter):
|
|
|
1624
1749
|
info = super().detect(root)
|
|
1625
1750
|
home = Path.home()
|
|
1626
1751
|
variants: list[str] = []
|
|
1752
|
+
app_markers = self._app_markers()
|
|
1753
|
+
cn_app_markers = tuple(
|
|
1754
|
+
marker for marker in app_markers
|
|
1755
|
+
if any(token in str(marker).casefold() for token in ("trae cn", "trae-cn"))
|
|
1756
|
+
)
|
|
1757
|
+
global_app_markers = tuple(
|
|
1758
|
+
marker for marker in app_markers if marker not in cn_app_markers
|
|
1759
|
+
)
|
|
1627
1760
|
|
|
1628
1761
|
cn_paths = [
|
|
1629
1762
|
Path("/Applications/Trae CN.app"),
|
|
@@ -1632,7 +1765,11 @@ class TreaAdapter(HostAdapter):
|
|
|
1632
1765
|
home / "Library" / "Application Support" / "Trae CN",
|
|
1633
1766
|
root / ".trae-cn",
|
|
1634
1767
|
]
|
|
1635
|
-
if
|
|
1768
|
+
if (
|
|
1769
|
+
shutil.which("trae-cn")
|
|
1770
|
+
or any(p.exists() for p in cn_paths)
|
|
1771
|
+
or any(p.exists() for p in cn_app_markers)
|
|
1772
|
+
):
|
|
1636
1773
|
variants.append("trae-cn")
|
|
1637
1774
|
|
|
1638
1775
|
global_paths = [
|
|
@@ -1643,7 +1780,11 @@ class TreaAdapter(HostAdapter):
|
|
|
1643
1780
|
root / ".trae",
|
|
1644
1781
|
root / ".trea",
|
|
1645
1782
|
]
|
|
1646
|
-
if
|
|
1783
|
+
if (
|
|
1784
|
+
shutil.which("trae")
|
|
1785
|
+
or any(p.exists() for p in global_paths)
|
|
1786
|
+
or any(p.exists() for p in global_app_markers)
|
|
1787
|
+
):
|
|
1647
1788
|
variants.append("trae")
|
|
1648
1789
|
|
|
1649
1790
|
info["detected_variants"] = variants
|
|
@@ -1654,8 +1795,9 @@ class TreaAdapter(HostAdapter):
|
|
|
1654
1795
|
if cn_exe:
|
|
1655
1796
|
info["executable"] = cn_exe
|
|
1656
1797
|
else:
|
|
1657
|
-
for marker in
|
|
1658
|
-
|
|
1798
|
+
for marker in app_markers:
|
|
1799
|
+
marker_name = marker.name.casefold()
|
|
1800
|
+
if ("trae-cn" in marker_name or "trae cn" in marker_name) and marker.is_file():
|
|
1659
1801
|
info["executable"] = str(marker)
|
|
1660
1802
|
break
|
|
1661
1803
|
return info
|
|
@@ -1824,6 +1966,10 @@ HOST_ADAPTERS: tuple[HostAdapter, ...] = (
|
|
|
1824
1966
|
# ZCodeAdapter 只保留 CLI 侧行为覆写。引擎快照不可用时跳过(见
|
|
1825
1967
|
# _plugin_backed_adapters:全新机器上必须先能启动 bugx init)。
|
|
1826
1968
|
*_plugin_backed_adapters(ZCodeAdapter),
|
|
1969
|
+
# DOC-239:声明字段全部来自引擎插件(core/hosts/kimi.py)。
|
|
1970
|
+
*_plugin_backed_adapters(KimiAdapter),
|
|
1971
|
+
# MiniMax Code 桌面端通过 Plugin V1 注册 Agent、Skill 与 MCP。
|
|
1972
|
+
*_plugin_backed_adapters(MiniMaxAdapter),
|
|
1827
1973
|
WorkBuddyAdapter(
|
|
1828
1974
|
"workbuddy", "WorkBuddy AI", "workbuddy", ".workbuddy",
|
|
1829
1975
|
WORKBUDDY_PROJECT_PATHS[0], "skill", WORKBUDDY_PROJECT_PATHS,
|
|
@@ -288,7 +288,7 @@ def engine_worker_entry_dir(name: str) -> str:
|
|
|
288
288
|
#: 进程池执行器)自动追加,不进本表。这不是第二份宿主事实:宿主身份仍在
|
|
289
289
|
#: 插件/``SUPPORTED_HOSTS``,本表只说「CLI 的 host 选项按什么顺序出现」。
|
|
290
290
|
AUTONOMOUS_HOST_BASELINE: tuple[str, ...] = (
|
|
291
|
-
"claude", "codex", "opencode", "dsh", "pi",
|
|
291
|
+
"claude", "codex", "opencode", "dsh", "pi", "kimi",
|
|
292
292
|
)
|
|
293
293
|
|
|
294
294
|
|
|
@@ -375,7 +375,9 @@ def _component_from_plugin(name: str) -> HostComponent:
|
|
|
375
375
|
#: 本清单只用于**定位/枚举插件**,不含任何宿主事实(不复制 label、路径、能力)。
|
|
376
376
|
#: 它随纵切推进增长;全部宿主迁移完成后本清单与 ``HOST_COMPONENTS`` 的本地字面量
|
|
377
377
|
#: 会一起消失。
|
|
378
|
-
PLUGIN_BACKED_HOSTS: tuple[str, ...] = (
|
|
378
|
+
PLUGIN_BACKED_HOSTS: tuple[str, ...] = (
|
|
379
|
+
"cline", "codex", "claude", "pi", "zcode", "kimi", "minimax",
|
|
380
|
+
)
|
|
379
381
|
|
|
380
382
|
|
|
381
383
|
def plugin_backed_components() -> tuple[HostComponent, ...]:
|
|
@@ -15,25 +15,26 @@ if TYPE_CHECKING:
|
|
|
15
15
|
|
|
16
16
|
# 宿主入口 frontmatter 触发文案与 Worker 描述
|
|
17
17
|
AGENT_DESCRIPTION_EN = (
|
|
18
|
-
"An autonomous
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
18
|
+
"An autonomous code review and testing agent designed to safeguard software delivery. "
|
|
19
|
+
"It surfaces hidden bugs for developers to eliminate painful debugging and rework, "
|
|
20
|
+
"while automating black-box, functional, and performance testing across complex edge cases for QA. "
|
|
21
|
+
"Ensures code runs reliably, meets all requirements, and frees engineers to focus on what matters."
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
AGENT_DESCRIPTION_ZH = (
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,"
|
|
26
|
+
"减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;"
|
|
27
|
+
"确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。"
|
|
27
28
|
)
|
|
28
29
|
|
|
29
30
|
BUGX_WORKER_DESCRIPTION_ZH = (
|
|
30
|
-
"BugX
|
|
31
|
+
"BugX 并发测试审查 Worker。由 BugX 主智能体并发调度,负责具体代码模块的审查、缺陷排查与自动化测试验证;"
|
|
31
32
|
"仅作为子智能体工作节点协同运行。"
|
|
32
33
|
)
|
|
33
34
|
|
|
34
35
|
BUGX_WORKER_DESCRIPTION_EN = (
|
|
35
|
-
"A concurrent
|
|
36
|
-
"
|
|
36
|
+
"A concurrent test and review worker dispatched by BugX to inspect assigned modules, "
|
|
37
|
+
"uncover deep bugs, and run automated verification as a collaborative subagent."
|
|
37
38
|
)
|
|
38
39
|
|
|
39
40
|
AGENT_DESCRIPTION = AGENT_DESCRIPTION_ZH
|
|
@@ -1068,7 +1068,7 @@ def _installed_engine_version(destination: Path) -> str | None:
|
|
|
1068
1068
|
except (OSError, ValueError):
|
|
1069
1069
|
payload = None
|
|
1070
1070
|
version = payload.get("bugx_version") if isinstance(payload, dict) else None
|
|
1071
|
-
if version == "0.1.
|
|
1071
|
+
if version == "0.1.3":
|
|
1072
1072
|
version = os.environ.get("BUGX_VERSION", __version__)
|
|
1073
1073
|
if isinstance(version, str) and version.strip():
|
|
1074
1074
|
return _full_engine_version(version.strip(), destination)
|
|
@@ -1081,7 +1081,7 @@ def _installed_engine_version(destination: Path) -> str | None:
|
|
|
1081
1081
|
match = re.search(r'bugx_version:\s*"([^"]+)"', content)
|
|
1082
1082
|
if match:
|
|
1083
1083
|
version = match.group(1)
|
|
1084
|
-
if version == "0.1.
|
|
1084
|
+
if version == "0.1.3":
|
|
1085
1085
|
version = os.environ.get("BUGX_VERSION", __version__)
|
|
1086
1086
|
return _full_engine_version(version, destination)
|
|
1087
1087
|
return None
|
|
@@ -1801,7 +1801,7 @@ def _version_marker(path: Path, pattern: re.Pattern[str], *, allow_symlink: bool
|
|
|
1801
1801
|
except (OSError, UnicodeError, CliError):
|
|
1802
1802
|
return None
|
|
1803
1803
|
value = match.group(1) if match else None
|
|
1804
|
-
if value == "0.1.
|
|
1804
|
+
if value == "0.1.3":
|
|
1805
1805
|
value = os.environ.get("BUGX_VERSION", __version__)
|
|
1806
1806
|
return value if value and _CONTRACT_VERSION_RE.fullmatch(value) else None
|
|
1807
1807
|
|
|
@@ -1815,7 +1815,7 @@ def _json_version_marker(path: Path, key: str) -> str | None:
|
|
|
1815
1815
|
except (OSError, UnicodeError, json.JSONDecodeError, CliError):
|
|
1816
1816
|
return None
|
|
1817
1817
|
value = payload.get(key) if isinstance(payload, dict) else None
|
|
1818
|
-
if value == "0.1.
|
|
1818
|
+
if value == "0.1.3":
|
|
1819
1819
|
value = os.environ.get("BUGX_VERSION", __version__)
|
|
1820
1820
|
return value if isinstance(value, str) and _CONTRACT_VERSION_RE.fullmatch(value) else None
|
|
1821
1821
|
|
|
@@ -123,7 +123,7 @@ def _plugin_manifest(
|
|
|
123
123
|
if not isinstance(name, str) or not re.fullmatch(r"[a-z][a-z0-9-]{1,63}", name):
|
|
124
124
|
raise CliError(_i18n_exc("common.plugin_name_invalid", f"插件名称无效: {path}", path=path))
|
|
125
125
|
version = payload.get("version")
|
|
126
|
-
if version == "0.1.
|
|
126
|
+
if version == "0.1.3":
|
|
127
127
|
version = os.environ.get("BUGX_VERSION", __version__)
|
|
128
128
|
payload["version"] = version
|
|
129
129
|
if not isinstance(version, str) or not PLUGIN_VERSION_RE.fullmatch(version):
|
|
@@ -551,14 +551,14 @@ def _mcp_runtime_doctor_payload(root: Path, runtime_root: Path,
|
|
|
551
551
|
from ..common import _python_environment
|
|
552
552
|
result = subprocess.run(
|
|
553
553
|
[sys.executable, str(_script(root, "mcp_runtime.py")), *script_args],
|
|
554
|
-
cwd=root, capture_output=True,
|
|
554
|
+
cwd=root, capture_output=True, encoding="utf-8", errors="replace", check=False,
|
|
555
555
|
env=_python_environment(), timeout=120,
|
|
556
556
|
)
|
|
557
557
|
if result.returncode != 0 and "--fast" in script_args and "unrecognized arguments: --fast" in (result.stderr or ""):
|
|
558
558
|
script_args_fallback = [a for a in script_args if a != "--fast"]
|
|
559
559
|
result = subprocess.run(
|
|
560
560
|
[sys.executable, str(_script(root, "mcp_runtime.py")), *script_args_fallback],
|
|
561
|
-
cwd=root, capture_output=True,
|
|
561
|
+
cwd=root, capture_output=True, encoding="utf-8", errors="replace", check=False,
|
|
562
562
|
env=_python_environment(), timeout=120,
|
|
563
563
|
)
|
|
564
564
|
try:
|