bugx-cli 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +89 -210
  2. package/core/README.md +1 -1
  3. package/core/agent/agent_execution.py +7 -0
  4. package/core/agent/agent_targets.py +5 -1
  5. package/core/agent/agent_workspace.py +10 -2
  6. package/core/autonomous_cve/run_fault_matrix.py +692 -0
  7. package/core/autonomous_cve/run_oss_cve_exploit_verify.py +608 -0
  8. package/core/autonomous_cve/run_six_worker_penetration.py +382 -0
  9. package/core/autonomous_cve/verifier.py +5 -7
  10. package/core/bugx.md +1 -1
  11. package/core/bugx_paths.py +2 -2
  12. package/core/bundled_docs/OVERVIEW.md +70 -236
  13. package/core/bundled_docs/README.md +2 -2
  14. package/core/bundled_docs/README_EN.md +67 -211
  15. package/core/bundled_docs/ai/01_AI_REFERENCE.md +11 -6
  16. package/core/bundled_docs/ai/02_AI_USAGE.md +1 -1
  17. package/core/bundled_docs/ai/03_AI_COMMANDS.md +1 -1
  18. package/core/bundled_docs/guides/01_USER_GUIDE.md +5 -5
  19. package/core/bundled_docs/guides/02_COMMANDS.md +3 -3
  20. package/core/bundled_docs/guides/03_TROUBLESHOOTING.md +4 -4
  21. package/core/bundled_docs/guides/05_HOST_MATRIX_AND_DISPATCH.md +4 -2
  22. package/core/bundled_docs/hosts/bugx_SKILL.md +2 -2
  23. package/core/bundled_docs/hosts/platform_bugx_SKILL.md +2 -2
  24. package/core/bundled_docs/manifest.json +22 -22
  25. package/core/bundled_docs/reference/01_ENVIRONMENT_VARIABLES.md +1 -0
  26. package/core/bundled_docs/reference/04_REPOSITORY_TOPOLOGY.md +1 -1
  27. package/core/cloud_sync/flywheel_client.py +89 -0
  28. package/core/contracts/README.md +1 -1
  29. package/core/contracts/bugx-runtime-contract.md +1 -1
  30. package/core/contracts/bugx-worker.md +1 -1
  31. package/core/coverage/coverage_ai_review.py +15 -11
  32. package/core/coverage/coverage_bootstrap.py +18 -13
  33. package/core/coverage/coverage_discovery.py +1 -1
  34. package/core/coverage/coverage_gate.py +12 -2
  35. package/core/coverage/coverage_manifest.py +1 -1
  36. package/core/coverage/coverage_validate.py +5 -3
  37. package/core/dev_harness/interaction_preset.py +1 -1
  38. package/core/engine-integrity.json +183 -163
  39. package/core/host_acp/README.md +4 -0
  40. package/core/host_acp/agnescode.py +128 -0
  41. package/core/host_runtime/README.md +3 -0
  42. package/core/host_runtime/adapters.py +45 -6
  43. package/core/host_runtime/autonomous_runner.py +3 -2
  44. package/core/host_runtime/host_registry.py +7 -1
  45. package/core/hosts/README.md +4 -0
  46. package/core/hosts/__init__.py +1 -0
  47. package/core/hosts/agnescode.py +415 -0
  48. package/core/hosts/base.py +1 -0
  49. package/core/hosts/claude.py +6 -0
  50. package/core/hosts/cline.py +6 -0
  51. package/core/hosts/codex.py +10 -1
  52. package/core/hosts/kimi.py +6 -4
  53. package/core/hosts/opencode.py +12 -4
  54. package/core/hosts/zcode.py +6 -0
  55. package/core/infra/README.md +1 -1
  56. package/core/infra/build_info.py +2 -2
  57. package/core/infra/python_runtime.py +4 -1
  58. package/core/launch_phases/README.md +2 -2
  59. package/core/launch_phases/finding_confirm_phase.py +1 -1
  60. package/core/launch_phases/semantic_recon.py +3 -19
  61. package/core/launch_phases/startup_gates.py +10 -1
  62. package/core/launch_phases/startup_version_gate.py +2 -2
  63. package/core/launch_phases/verify_loop.py +3 -19
  64. package/core/ledger/README.md +1 -1
  65. package/core/ledger/finding_confirmation.py +1 -1
  66. package/core/ledger/finding_verification.py +2 -20
  67. package/core/ledger/fp_ledger.py +3 -19
  68. package/core/ledger/life_ledger.py +7 -33
  69. package/core/ledger/schema.py +1 -1
  70. package/core/locales/en-US.json +2 -0
  71. package/core/locales/zh-CN.json +2 -0
  72. package/core/mcp_handlers/supervisor_handlers.py +34 -2
  73. package/core/mcp_handlers/telemetry_handlers.py +32 -0
  74. package/core/mcp_handlers/tool_table.py +34 -0
  75. package/core/mcp_runtime_support/common.py +6 -0
  76. package/core/mcp_runtime_support/environment.py +82 -23
  77. package/core/metadata.txt +1 -1
  78. package/core/planning/README.md +1 -1
  79. package/core/planning/target_sandbox_manager.py +2 -0
  80. package/core/probes/mobile_probe.py +1 -0
  81. package/core/probes/sast_probe.py +1 -1
  82. package/core/probes/sca_scanner.py +1 -1
  83. package/core/project_profiler/constants.py +1 -1
  84. package/core/retrieval/README.md +1 -1
  85. package/core/retrieval/symbol_index.py +229 -53
  86. package/core/retrieval/universal_code_matcher.py +1 -0
  87. package/core/runtime/README.md +1 -1
  88. package/core/runtime/daemon_runner.py +3 -2
  89. package/core/runtime/mining_quality_framework.py +2 -1
  90. package/core/runtime/project_init.py +1 -1
  91. package/core/runtime/scenario_eval.py +5 -2
  92. package/core/skills/bugx_mcp_server.py +9 -0
  93. package/core/skills/mcp_session_proof.py +3 -31
  94. package/core/supervisor/README.md +1 -1
  95. package/core/supervisor/finding_commit.py +3 -24
  96. package/core/supervisor/task_scheduler.py +5 -2
  97. package/core/supervisor/worker_execution.py +5 -0
  98. package/core/supervisor/worker_handoff.py +2 -2
  99. package/docs/07_distribution/01_README_NPM.md +89 -210
  100. package/ecosystem/integrations/dsh/mcp/package.json +2 -2
  101. package/ecosystem/integrations/dsh/ui/package.json +1 -1
  102. package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +3 -3
  103. package/ecosystem/integrations/opencode/mcp-lock.json +1 -1
  104. package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
  105. package/ecosystem/integrations/qoder/connector-meta.json +1 -1
  106. package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
  107. package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +1 -1
  108. package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
  109. package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
  110. package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
  111. package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +2 -2
  112. package/interfaces/cli/bugx_cli/__init__.py +1 -1
  113. package/interfaces/cli/bugx_cli/cli.py +15 -0
  114. package/interfaces/cli/bugx_cli/commands/agent.py +18 -0
  115. package/interfaces/cli/bugx_cli/commands/audit.py +5 -6
  116. package/interfaces/cli/bugx_cli/commands/doctor.py +1 -1
  117. package/interfaces/cli/bugx_cli/commands/lifecycle.py +1 -1
  118. package/interfaces/cli/bugx_cli/commands/patch.py +5 -1
  119. package/interfaces/cli/bugx_cli/commands/plugin.py +31 -2
  120. package/interfaces/cli/bugx_cli/commands/plugin_claude.py +2 -2
  121. package/interfaces/cli/bugx_cli/host_adapters.py +167 -1
  122. package/interfaces/cli/bugx_cli/hosts/registry.py +33 -1
  123. package/interfaces/cli/bugx_cli/infra/engine_installer.py +4 -4
  124. package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
  125. package/package.json +1 -1
  126. package/scripts/sync-version.mjs +1 -1
  127. package/skills/platform/bugx/SKILL.md +2 -2
@@ -1821,7 +1821,7 @@
1821
1821
  }
1822
1822
  },
1823
1823
  "semgrep": {
1824
- "python": ">=3.12,<3.14",
1824
+ "python": ">=3.12",
1825
1825
  "packages": {
1826
1826
  "annotated-types": {
1827
1827
  "version": "0.8.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "name": "bugx-pi",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "host": "pi",
6
6
  "kind": "extension",
7
7
  "entry": "index.ts",
@@ -7,7 +7,7 @@
7
7
  "description_en": "BugX is an autonomous code review and testing agent designed to safeguard software delivery: it surfaces hidden, deep bugs for developers right after writing code to eliminate painful debugging and rework; automates black-box, functional, and performance testing across complex edge cases for QA; and ensures software strictly meets functional requirements with rock-solid stability and resilience. By taking over tedious verification, BugX frees engineers from manual grunt work, boosts team velocity, elevates code quality, and significantly lowers long-term maintenance costs—putting technology to work for people.",
8
8
  "source": "bugx-agent",
9
9
  "type": "mcp-connector",
10
- "version": "0.1.4",
10
+ "version": "0.1.6",
11
11
  "homepage": "https://bugx.dev",
12
12
  "website": "https://bugx.dev",
13
13
  "examples_zh": [
@@ -7,7 +7,7 @@
7
7
  "description_en": "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.",
8
8
  "source": "bugx-agent",
9
9
  "type": "skill-only",
10
- "version": "0.1.4",
10
+ "version": "0.1.6",
11
11
  "examples_zh": [
12
12
  "运行代码审查,排查深层 Bug 与性能隐患",
13
13
  "自动化运行功能验证与黑盒测试"
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: bugx
3
3
  description: BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  author: BugX
6
6
  ---
7
7
  <!-- bugx-locale: zh-CN -->
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugx",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "bugx_build_id": 98,
5
5
  "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.",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugx",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "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.",
5
5
  "skills": "./skills/",
6
6
  "homepage": "https://bugx.dev",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugx",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "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.",
5
5
  "homepage": "https://bugx.dev",
6
6
  "author": {
@@ -2,7 +2,7 @@
2
2
  name: bugx
3
3
  description: BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。
4
4
  metadata:
5
- bugx_version: "0.1.4"
5
+ bugx_version: "0.1.6"
6
6
  ---
7
7
  <!-- bugx-locale: zh-CN -->
8
8
 
@@ -10,7 +10,7 @@ metadata:
10
10
 
11
11
  BugX ChatGPT Skill 镜像。执行前用 `bugx engine path --name AGENT_GUIDE.md` 和 `bugx engine path --name bugx.md` 读取全局协议;项目 `.bugx/` 只保存状态与配置。
12
12
 
13
- 协议镜像版本:0.1.4
13
+ 协议镜像版本:0.1.6
14
14
 
15
15
  ## ChatGPT 原生交互适配(强制)
16
16
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  import os
4
4
 
5
- __version__ = os.environ.get("BUGX_VERSION", "0.1.4")
5
+ __version__ = os.environ.get("BUGX_VERSION", "0.1.6")
6
6
  __build_id__: int = 1
@@ -13,6 +13,21 @@ import typing
13
13
  from pathlib import Path
14
14
 
15
15
 
16
+ def _ensure_utf8_stdio() -> None:
17
+ """Force UTF-8 stdio and child Python encoding on Windows (avoid GBK/cp1252 crashes)."""
18
+ os.environ.setdefault("PYTHONUTF8", "1")
19
+ for stream, err_mode in ((sys.stdin, "strict"), (sys.stdout, "replace"), (sys.stderr, "replace")):
20
+ reconf = getattr(stream, "reconfigure", None)
21
+ if callable(reconf):
22
+ try:
23
+ reconf(encoding="utf-8", errors=err_mode)
24
+ except (OSError, ValueError):
25
+ pass
26
+
27
+
28
+ _ensure_utf8_stdio()
29
+
30
+
16
31
  def _fast_dispatch_mcp_serve() -> None:
17
32
  """Start the stdio MCP script before heavy CLI imports.
18
33
 
@@ -4244,6 +4244,24 @@ def _check_host_mcp_config(root: Path, host_name: str, *, repair: bool = False)
4244
4244
  detail += ";Agent 入口存在但不能替代 Trea MCP 配置"
4245
4245
  return False, detail + ";请运行 bugx install --agent trea"
4246
4246
 
4247
+ if host_name == "copilot":
4248
+ candidates = (
4249
+ (root / ".vscode" / "mcp.json", "mcpServers"),
4250
+ (root / ".mcp.json", "flat"),
4251
+ )
4252
+ ok, detail = _validate_host_supervisor_mcp(candidates, root)
4253
+ project_entry = root / ".github" / "agents" / "bugx.agent.md"
4254
+ instructions_entry = root / ".github" / "copilot-instructions.md"
4255
+ user_entry = Path.home() / ".copilot" / "agents" / "bugx.agent.md"
4256
+ has_entry = (project_entry.is_file() and instructions_entry.is_file()) or user_entry.is_file()
4257
+ if ok and has_entry:
4258
+ return True, detail + ";GitHub Copilot Agent/MCP 入口已就绪"
4259
+ if not has_entry:
4260
+ detail += ";缺少 .github/agents/bugx.agent.md 或 .github/copilot-instructions.md"
4261
+ elif not ok:
4262
+ detail += ";Agent 入口存在但缺少 .vscode/mcp.json 配置"
4263
+ return False, detail + ";请运行 bugx install --agent copilot"
4264
+
4247
4265
  if host_name == "pi":
4248
4266
  ext_manifest = root / ".pi" / "extensions" / "bugx" / "manifest.json"
4249
4267
  skill_file = root / ".pi" / "skills" / "bugx" / "SKILL.md"
@@ -12,6 +12,7 @@ import argparse
12
12
  import hashlib
13
13
  import importlib
14
14
  import json
15
+ import os
15
16
  import stat
16
17
  import sys
17
18
  import time
@@ -115,7 +116,7 @@ def _private_runtime_root() -> Path:
115
116
  if runtime_root.exists():
116
117
  if not runtime_root.is_dir():
117
118
  raise ValueError("Agent audit runtime path must be a directory")
118
- if stat.S_IMODE(runtime_root.stat().st_mode) & 0o077:
119
+ if os.name == "posix" and stat.S_IMODE(runtime_root.stat().st_mode) & 0o077:
119
120
  raise ValueError("Agent audit runtime directory must be private (mode 0700)")
120
121
  else:
121
122
  runtime_root.mkdir(parents=True, mode=0o700)
@@ -330,10 +331,8 @@ def _command_audit_penetration(args: argparse.Namespace) -> int:
330
331
  from ..infra.security import _find_repo_root
331
332
  repo_root = _find_repo_root(Path(__file__))
332
333
  core_root = repo_root / "core"
333
- scripts_root = repo_root / "scripts"
334
- for p in (core_root, scripts_root):
335
- if str(p) not in sys.path:
336
- sys.path.insert(0, str(p))
334
+ if str(core_root) not in sys.path:
335
+ sys.path.insert(0, str(core_root))
337
336
 
338
337
  from core.infra.build_info import get_full_version_string
339
338
  from core.probes.sast_probe import run_scan as run_sast_scan
@@ -349,7 +348,7 @@ def _command_audit_penetration(args: argparse.Namespace) -> int:
349
348
  )
350
349
  # 脚本已随 DOC-232 迁入 ``scripts/cve/``:旧路径 ``run_six_worker_penetration``
351
350
  # 从仓库根已不可导入,``bugx audit --deep`` 会直接 fail-closed。包名显式写全。
352
- from scripts.cve.run_six_worker_penetration import run_six_worker_penetration
351
+ from core.autonomous_cve.run_six_worker_penetration import run_six_worker_penetration
353
352
  from core.report_engine.models import (
354
353
  _compliance_notes as get_compliance_notes,
355
354
  _remediation_roadmap as build_remediation_roadmap,
@@ -1164,7 +1164,7 @@ def _repair_active_host_mcp_config(
1164
1164
  write_host_mcp_config(root, host_name)
1165
1165
  elif not is_home_scope and host_name == "opencode":
1166
1166
  _ensure_opencode_config(root)
1167
- elif not is_home_scope and host_name in {"claude", "codex", "cline", "trea", "funide", "qoder"}:
1167
+ elif not is_home_scope and host_name in {"claude", "codex", "cline", "trea", "funide", "qoder", "copilot"}:
1168
1168
  write_host_mcp_config(root, host_name)
1169
1169
  else:
1170
1170
  return False
@@ -84,7 +84,7 @@ def _assemble_project_materials(root: Path, source: Path, layout: Any) -> None:
84
84
  from core.coverage import coverage_bootstrap
85
85
  coverage = coverage_bootstrap.inspect(root)
86
86
  if not coverage.get("ready") and not coverage.get("blocked"):
87
- coverage_bootstrap.bootstrap(root, confirmed=True)
87
+ coverage_bootstrap.bootstrap(root, confirmed=True, symbols=False)
88
88
  except Exception:
89
89
  pass
90
90
 
@@ -732,7 +732,11 @@ def _run_sandbox_script(
732
732
  if script_path.suffix == ".py":
733
733
  cmd = [sys.executable, str(script_path)]
734
734
  elif script_path.suffix == ".sh":
735
- cmd = ["/bin/bash", str(script_path)]
735
+ import shutil as _shutil
736
+ bash_exe = _shutil.which("bash") or ("/bin/bash" if os.name != "nt" else None)
737
+ if not bash_exe:
738
+ return -1, "当前系统缺少 bash,无法执行 .sh 脚本"
739
+ cmd = [bash_exe, str(script_path)]
736
740
  else:
737
741
  cmd = [str(script_path)]
738
742
 
@@ -1489,10 +1489,19 @@ def write_host_mcp_config(
1489
1489
  target = root / migrated.project_relpath
1490
1490
  payload = _load_json_object(target, engine_host_label(host_name))
1491
1491
  servers_key = migrated.container_key
1492
- servers = payload.get(servers_key)
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)
1493
1502
  if servers is None:
1494
1503
  servers = {}
1495
- payload[servers_key] = servers
1504
+ container[leaf_key] = servers
1496
1505
  if not isinstance(servers, dict):
1497
1506
  raise CliError(
1498
1507
  _i18n_exc(
@@ -1585,6 +1594,22 @@ def write_host_mcp_config(
1585
1594
  if not isinstance(servers, dict):
1586
1595
  raise CliError(_i18n_exc("plugin.trea_servers_not_object", f"Trea 配置 {servers_key} 不是对象,拒绝写入: {target}", servers_key=servers_key, target=target))
1587
1596
  desired = _host_supervisor_server_definitions(shape="trea", optional_names=optional_names)
1597
+ elif host_name == "copilot":
1598
+ target = root / ".vscode" / "mcp.json"
1599
+ payload = _load_json_object(target, "GitHub Copilot")
1600
+ servers_key = "mcpServers"
1601
+ servers = payload.get(servers_key)
1602
+ if servers is None:
1603
+ servers = {}
1604
+ payload[servers_key] = servers
1605
+ if not isinstance(servers, dict):
1606
+ raise CliError(f"GitHub Copilot 配置 {servers_key} 不是对象,拒绝写入: {target}")
1607
+ desired = _host_supervisor_server_definitions(
1608
+ shape="copilot",
1609
+ optional_names=optional_names,
1610
+ docs_transport=docs_transport,
1611
+ docs_remote_url=docs_remote_url,
1612
+ )
1588
1613
  else:
1589
1614
  raise CliError(_i18n_exc("plugin.unsupported_mcp_host", f"不支持写入 MCP 的宿主: {host_name}", host_name=host_name))
1590
1615
 
@@ -1676,6 +1701,8 @@ def write_host_mcp_config(
1676
1701
  optional_names=optional_names)
1677
1702
  if host_name == "trea":
1678
1703
  _sync_trae_mcp_mirror(root, desired, optional_names=optional_names)
1704
+ elif host_name == "copilot":
1705
+ _sync_mcp_mirror("copilot", "copilot", root / ".mcp.json", desired, optional_names=optional_names)
1679
1706
  if not changed:
1680
1707
  return "unchanged", target, None, False
1681
1708
 
@@ -2333,6 +2360,8 @@ def _host_project_mcp_config_target(root: Path, host_name: str) -> tuple[Path, s
2333
2360
  migrated = engine_host_mcp_write(host_name)
2334
2361
  if migrated is not None and migrated.project_relpath and not migrated.custom_writer:
2335
2362
  return root / migrated.project_relpath, migrated.container_key
2363
+ if host_name == "copilot":
2364
+ return root / ".vscode" / "mcp.json", "mcpServers"
2336
2365
  if host_name == "funide":
2337
2366
  return root / ".mcp.json", "mcpServers"
2338
2367
  if host_name in {"chatgpt", "workbuddy", "codebuddy"}:
@@ -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.4"
265
+ bugx_version: "0.1.6"
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.4
273
+ 协议镜像版本:0.1.6
274
274
 
275
275
  ## Claude 原生交互适配(强制)
276
276
 
@@ -16,7 +16,11 @@ import re
16
16
  import shutil
17
17
  import subprocess
18
18
 
19
- from .hosts.registry import QODER_PROJECT_MCP_PATHS, engine_host_plugin
19
+ from .hosts.registry import (
20
+ COPILOT_PROJECT_PATHS,
21
+ QODER_PROJECT_MCP_PATHS,
22
+ engine_host_plugin,
23
+ )
20
24
  from .hosts.template_engine import (
21
25
  AGENT_DESCRIPTION,
22
26
  AGENT_DESCRIPTION_EN,
@@ -1408,6 +1412,11 @@ class OpenCodeAdapter(HostAdapter):
1408
1412
  pass
1409
1413
 
1410
1414
 
1415
+ class AgnesCodeAdapter(HostAdapter):
1416
+ """Agnes Code CLI adapter."""
1417
+ pass
1418
+
1419
+
1411
1420
  class CodexAdapter(HostAdapter):
1412
1421
  """Codex CLI adapter(仅 CLI 侧行为覆写)。
1413
1422
 
@@ -1873,6 +1882,151 @@ class FunIdeAdapter(HostAdapter):
1873
1882
  return _ensure_funide_user_agents(root, source, locale=locale)
1874
1883
 
1875
1884
 
1885
+ def _copilot_app_markers() -> tuple[Path, ...]:
1886
+ home = Path.home()
1887
+ system = platform.system()
1888
+ markers: list[Path] = []
1889
+ if system == "Darwin":
1890
+ markers.extend([
1891
+ Path("/Applications/Visual Studio Code.app"),
1892
+ Path("/Applications/Visual Studio Code - Insiders.app"),
1893
+ home / "Applications" / "Visual Studio Code.app",
1894
+ ])
1895
+ elif system == "Windows":
1896
+ local_app = os.environ.get("LOCALAPPDATA", "")
1897
+ prog_files = os.environ.get("ProgramFiles", "")
1898
+ if local_app:
1899
+ markers.append(Path(local_app) / "Programs" / "Microsoft VS Code" / "Code.exe")
1900
+ if prog_files:
1901
+ markers.append(Path(prog_files) / "Microsoft VS Code" / "Code.exe")
1902
+ else:
1903
+ markers.extend([
1904
+ Path("/usr/bin/code"),
1905
+ Path("/usr/share/code/code"),
1906
+ home / ".vscode",
1907
+ ])
1908
+ markers.extend([
1909
+ home / ".copilot",
1910
+ home / ".config" / "github-copilot",
1911
+ ])
1912
+ for tool_name in ("code", "gh", "copilot"):
1913
+ found = shutil.which(tool_name)
1914
+ if found:
1915
+ markers.append(Path(found))
1916
+ return tuple(markers)
1917
+
1918
+
1919
+ def _copilot_user_agents_dir() -> Path:
1920
+ override = os.environ.get("BUGX_COPILOT_USER_AGENTS_DIR")
1921
+ if override:
1922
+ return Path(override).expanduser().resolve()
1923
+ return (Path.home() / ".copilot" / "agents").resolve()
1924
+
1925
+
1926
+ def _ensure_copilot_user_agents(root: Path, source: Path, *, locale: str | None = None) -> dict[str, object]:
1927
+ from .common import _atomic_write_global_file, _backup_host_resource, CliError
1928
+ from .hosts.registry import get_component
1929
+ from .hosts.template_engine import render_host_entry
1930
+
1931
+ agents_dir = _copilot_user_agents_dir()
1932
+ if agents_dir.is_symlink():
1933
+ raise CliError(f"拒绝写入符号链接 GitHub Copilot 用户级 agents 目录: {agents_dir}")
1934
+ agents_dir.mkdir(parents=True, exist_ok=True)
1935
+ target = agents_dir / "bugx.agent.md"
1936
+ if target.is_symlink():
1937
+ raise CliError(f"拒绝覆盖符号链接 GitHub Copilot 用户级智能体: {target}")
1938
+
1939
+ component = get_component("copilot")
1940
+ content = render_host_entry(component, source, locale=locale)
1941
+ payload = content.encode("utf-8")
1942
+
1943
+ written: list[dict[str, object]] = []
1944
+ backups: list[Path] = []
1945
+ if target.is_file() and target.read_bytes() == payload:
1946
+ written.append({
1947
+ "path": str(target),
1948
+ "status": "unchanged",
1949
+ "backup": None,
1950
+ "created": False,
1951
+ })
1952
+ else:
1953
+ backup = _backup_host_resource(root, "copilot", target) if target.exists() else None
1954
+ if backup is not None:
1955
+ backups.append(backup)
1956
+ _atomic_write_global_file(target, payload)
1957
+ written.append({
1958
+ "path": str(target),
1959
+ "status": "created" if backup is None else "upgraded",
1960
+ "backup": str(backup) if backup is not None else None,
1961
+ "created": backup is None,
1962
+ })
1963
+
1964
+ return {
1965
+ "dir": str(agents_dir),
1966
+ "path": str(target),
1967
+ "written": written,
1968
+ "backups": backups,
1969
+ }
1970
+
1971
+
1972
+ def render_copilot_instructions(*, locale: str | None = None) -> str:
1973
+ loc = (locale or "").strip().lower()
1974
+ if not loc:
1975
+ try:
1976
+ import core.i18n as i18n
1977
+ loc = i18n.resolve_locale().resolved_locale
1978
+ except Exception:
1979
+ loc = "zh-cn"
1980
+ if loc.startswith("zh"):
1981
+ return (
1982
+ "# GitHub Copilot 专属 BugX 审计指令\n\n"
1983
+ "在当前项目中进行代码审查、排查 Bug 或执行安全性测试时:\n"
1984
+ "- 优先唤起或参考 `.github/agents/bugx.agent.md` 中的 BugX 审计智能体;\n"
1985
+ "- 通过 `bugx engine path --name bugx-runtime-contract.md` 和 `bugx engine path --name bugx-quick.md` 读取全局权威协议;\n"
1986
+ "- 充分利用 `.vscode/mcp.json` 中配置的 `bugx-supervisor` 与 `bugx-supervisor-worker` 工具,以证据为中心,坚持“无 PoC 实跑证据不立案”的原则;\n"
1987
+ "- 严格遵守租约管理与零误报核验门禁,不在长代码段前偷懒跳过。\n"
1988
+ )
1989
+ return (
1990
+ "# GitHub Copilot Instructions for BugX\n\n"
1991
+ "When auditing code, reviewing pull requests, or verifying security defects in this project:\n"
1992
+ "- Invoke or follow the BugX agent definition in `.github/agents/bugx.agent.md`.\n"
1993
+ "- Load global protocols via `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`.\n"
1994
+ "- Leverage the BugX Supervisor MCP tools configured in `.vscode/mcp.json` for verified, reproducible audit findings.\n"
1995
+ "- Adhere strictly to the lifetime, lease heartbeat, and zero-false-alarm verification gates.\n"
1996
+ )
1997
+
1998
+
1999
+ class CopilotAdapter(HostAdapter):
2000
+ """GitHub Copilot IDE / Agent adapter."""
2001
+
2002
+ def _app_markers(self) -> tuple[Path, ...]:
2003
+ return _copilot_app_markers()
2004
+
2005
+ def _user_marker(self) -> bool:
2006
+ return (_copilot_user_agents_dir() / "bugx.agent.md").is_file()
2007
+
2008
+ def detect(self, root: Path) -> dict[str, object]:
2009
+ info = super().detect(root)
2010
+ user_entry = _copilot_user_agents_dir() / "bugx.agent.md"
2011
+ info.update({
2012
+ "user_marker": user_entry.is_file(),
2013
+ "user_agent_path": str(user_entry),
2014
+ })
2015
+ return info
2016
+
2017
+ def render_required_entry(
2018
+ self, relative: str, source: Path, *, locale: str | None = None,
2019
+ ) -> str | None:
2020
+ if relative == ".github/copilot-instructions.md":
2021
+ return render_copilot_instructions(locale=locale)
2022
+ return None
2023
+
2024
+ def ensure_user_agents(
2025
+ self, root: Path, source: Path, *, locale: str | None = None,
2026
+ ) -> dict[str, object] | None:
2027
+ return _ensure_copilot_user_agents(root, source, locale=locale)
2028
+
2029
+
1876
2030
  # dsh 宿主适配器 — 基于补丁覆盖层 + Skills 注入
1877
2031
  class DshAdapter(HostAdapter):
1878
2032
  """DeepSeek Harness (dsh) adapter."""
@@ -2007,6 +2161,7 @@ HOST_ADAPTERS: tuple[HostAdapter, ...] = (
2007
2161
  # MiniMax Code 桌面端通过 Plugin V1 注册 Agent、Skill 与 MCP。
2008
2162
  *_plugin_backed_adapters(MiniMaxAdapter),
2009
2163
  *_plugin_backed_adapters(AntigravityAdapter),
2164
+ *_plugin_backed_adapters(AgnesCodeAdapter),
2010
2165
  WorkBuddyAdapter(
2011
2166
  "workbuddy", "WorkBuddy AI", "workbuddy", ".workbuddy",
2012
2167
  WORKBUDDY_PROJECT_PATHS[0], "skill", WORKBUDDY_PROJECT_PATHS,
@@ -2053,6 +2208,17 @@ HOST_ADAPTERS: tuple[HostAdapter, ...] = (
2053
2208
  ".github/agents/bugx.agent.md", "agent",
2054
2209
  capabilities=frozenset({CAP_NATIVE_MCP_CONFIG, CAP_USER_AGENT_REGISTRATION}),
2055
2210
  ),
2211
+ CopilotAdapter(
2212
+ "copilot", "GitHub Copilot", "copilot", ".github/agents/bugx.agent.md",
2213
+ ".github/agents/bugx.agent.md", "agent",
2214
+ required_paths=COPILOT_PROJECT_PATHS,
2215
+ capabilities=frozenset({
2216
+ CAP_NATIVE_MCP_CONFIG,
2217
+ CAP_USER_AGENT_REGISTRATION,
2218
+ CAP_EXTRA_TRACKED_PATHS,
2219
+ }),
2220
+ aliases=("github-copilot", "gh-copilot", "copilot-chat"),
2221
+ ),
2056
2222
  )
2057
2223
 
2058
2224
 
@@ -44,6 +44,11 @@ WORKBUDDY_PROJECT_PATHS = (
44
44
  ".codebuddy/skills/bugx/SKILL.md",
45
45
  )
46
46
  QODER_PROJECT_MCP_PATHS = (".mcp.json", ".qoder/settings.json")
47
+ COPILOT_PROJECT_PATHS = (
48
+ ".github/agents/bugx.agent.md",
49
+ ".github/copilot-instructions.md",
50
+ )
51
+ COPILOT_PROJECT_MCP_PATHS = (".vscode/mcp.json", ".mcp.json")
47
52
 
48
53
 
49
54
  def _packaged_asset_cores() -> tuple[Path, ...]:
@@ -377,7 +382,7 @@ def _component_from_plugin(name: str) -> HostComponent:
377
382
  #: 它随纵切推进增长;全部宿主迁移完成后本清单与 ``HOST_COMPONENTS`` 的本地字面量
378
383
  #: 会一起消失。
379
384
  PLUGIN_BACKED_HOSTS: tuple[str, ...] = (
380
- "cline", "codex", "claude", "pi", "zcode", "kimi", "minimax", "antigravity",
385
+ "cline", "codex", "claude", "pi", "zcode", "kimi", "minimax", "antigravity", "agnescode",
381
386
  )
382
387
 
383
388
 
@@ -551,6 +556,33 @@ HOST_COMPONENTS: tuple[HostComponent, ...] = (
551
556
  execution=ExecutionContract(supports_headless=False, host_surface="desktop"),
552
557
  capabilities=frozenset({CAP_NATIVE_MCP_CONFIG, CAP_USER_AGENT_REGISTRATION}),
553
558
  ),
559
+ HostComponent(
560
+ name="copilot",
561
+ label="GitHub Copilot",
562
+ executable="copilot",
563
+ marker=".github/agents/bugx.agent.md",
564
+ install=InstallContract(
565
+ "agent",
566
+ ".github/agents/bugx.agent.md",
567
+ required_paths=COPILOT_PROJECT_PATHS,
568
+ ),
569
+ interaction=InteractionContract(
570
+ tool="GitHub Copilot Chat / Agent UI",
571
+ single_select="由 GitHub Copilot UI 或受控选项执行",
572
+ multi_select="由 GitHub Copilot UI 承接",
573
+ availability="GitHub Copilot 为 IDE 扩展/Agent Host",
574
+ fallback="BUGX_INTERACTION_REQUEST → Copilot UI;无承接者则通过受控选择动作继续",
575
+ failure="无结构化交互环境时阻断",
576
+ ),
577
+ mcp=McpContract(config_relpaths=COPILOT_PROJECT_MCP_PATHS),
578
+ execution=ExecutionContract(supports_headless=False, host_surface="desktop"),
579
+ aliases=("github-copilot", "gh-copilot", "copilot-chat"),
580
+ capabilities=frozenset({
581
+ CAP_NATIVE_MCP_CONFIG,
582
+ CAP_USER_AGENT_REGISTRATION,
583
+ CAP_EXTRA_TRACKED_PATHS,
584
+ }),
585
+ ),
554
586
  )
555
587
 
556
588
 
@@ -1112,7 +1112,7 @@ def _installed_engine_version(destination: Path) -> str | None:
1112
1112
  except (OSError, ValueError):
1113
1113
  payload = None
1114
1114
  version = payload.get("bugx_version") if isinstance(payload, dict) else None
1115
- if version == "0.1.4":
1115
+ if version == "0.1.6":
1116
1116
  version = os.environ.get("BUGX_VERSION", __version__)
1117
1117
  if isinstance(version, str) and version.strip():
1118
1118
  return _full_engine_version(version.strip(), destination)
@@ -1125,7 +1125,7 @@ def _installed_engine_version(destination: Path) -> str | None:
1125
1125
  match = re.search(r'bugx_version:\s*"([^"]+)"', content)
1126
1126
  if match:
1127
1127
  version = match.group(1)
1128
- if version == "0.1.4":
1128
+ if version == "0.1.6":
1129
1129
  version = os.environ.get("BUGX_VERSION", __version__)
1130
1130
  return _full_engine_version(version, destination)
1131
1131
  return None
@@ -1867,7 +1867,7 @@ def _version_marker(path: Path, pattern: re.Pattern[str], *, allow_symlink: bool
1867
1867
  except (OSError, UnicodeError, CliError):
1868
1868
  return None
1869
1869
  value = match.group(1) if match else None
1870
- if value == "0.1.4":
1870
+ if value == "0.1.6":
1871
1871
  value = os.environ.get("BUGX_VERSION", __version__)
1872
1872
  return value if value and _CONTRACT_VERSION_RE.fullmatch(value) else None
1873
1873
 
@@ -1881,7 +1881,7 @@ def _json_version_marker(path: Path, key: str) -> str | None:
1881
1881
  except (OSError, UnicodeError, json.JSONDecodeError, CliError):
1882
1882
  return None
1883
1883
  value = payload.get(key) if isinstance(payload, dict) else None
1884
- if value == "0.1.4":
1884
+ if value == "0.1.6":
1885
1885
  value = os.environ.get("BUGX_VERSION", __version__)
1886
1886
  return value if isinstance(value, str) and _CONTRACT_VERSION_RE.fullmatch(value) else None
1887
1887
 
@@ -165,7 +165,7 @@ def _plugin_manifest(
165
165
  if not isinstance(name, str) or not re.fullmatch(r"[a-z][a-z0-9-]{1,63}", name):
166
166
  raise CliError(_i18n_exc("common.plugin_name_invalid", f"插件名称无效: {path}", path=path))
167
167
  version = payload.get("version")
168
- if version == "0.1.4":
168
+ if version == "0.1.6":
169
169
  version = os.environ.get("BUGX_VERSION", __version__)
170
170
  payload["version"] = version
171
171
  if not isinstance(version, str) or not PLUGIN_VERSION_RE.fullmatch(version):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugx-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Autonomous code review and testing agent CLI wrapper. Catches subtle, high-impact bugs, automates black-box and functional QA testing, and safeguards dependable software delivery.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,7 +15,7 @@ if (!version || !/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(version)) {
15
15
  // temporary/build tree before npm reads the manifest.
16
16
  const pkgJsonPath = join(pkgRoot, 'package.json');
17
17
  const pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
18
- if (pkgJson.version === '0.1.4') {
18
+ if (pkgJson.version === '0.1.6') {
19
19
  console.error('[bugx] ✗ 源码 package.json 是模板;请先在临时构建树运行 scripts/render_version.py 或 scripts/package_dist.py');
20
20
  process.exit(1);
21
21
  }
@@ -2,7 +2,7 @@
2
2
  name: bugx
3
3
  description: BugX 深度代码审查与缺陷挖掘智能体。提供自主缺陷挖掘、敏捷单点复现(PoC)、环境体检及知识检索能力。
4
4
  metadata:
5
- bugx_version: "0.1.4"
5
+ bugx_version: "0.1.6"
6
6
  ---
7
7
  <!-- bugx-locale: zh-CN -->
8
8
 
@@ -10,7 +10,7 @@ metadata:
10
10
 
11
11
  BugX 核心协议镜像。执行前可通过 `bugx engine path --name bugx.md` 读取完整规范;项目 `.bugx/` 保存运行态与账本。
12
12
 
13
- 协议镜像版本:0.1.4
13
+ 协议镜像版本:0.1.6
14
14
 
15
15
  ## 1. 意图分流决策树 (Triage Decision Tree)
16
16
  拿到任务第一秒,判定属于哪个分支: