bugx-cli 0.1.2 → 0.1.4

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 (157) hide show
  1. package/README.md +26 -29
  2. package/core/README.md +5 -3
  3. package/core/agent/agent_orchestrator.py +3 -0
  4. package/core/agent/agent_workspace.py +14 -2
  5. package/core/assets/bugx-wechat-group.png +0 -0
  6. package/core/assets/twitter_promo_art.jpg +0 -0
  7. package/core/assets/twitter_promo_card.svg +166 -0
  8. package/core/assets/twitter_promo_clean.jpg +0 -0
  9. package/core/assets/twitter_terminal_real.png +0 -0
  10. package/core/bugx.md +3 -3
  11. package/core/bugx_paths.py +10 -2
  12. package/core/bundled_docs/OVERVIEW.md +310 -0
  13. package/core/bundled_docs/README.md +10 -0
  14. package/core/bundled_docs/README_EN.md +278 -0
  15. package/core/bundled_docs/ai/01_AI_REFERENCE.md +833 -0
  16. package/core/bundled_docs/ai/02_AI_USAGE.md +161 -0
  17. package/core/bundled_docs/ai/03_AI_COMMANDS.md +322 -0
  18. package/core/bundled_docs/guides/01_USER_GUIDE.md +887 -0
  19. package/core/bundled_docs/guides/02_COMMANDS.md +935 -0
  20. package/core/bundled_docs/guides/03_TROUBLESHOOTING.md +763 -0
  21. package/core/bundled_docs/guides/04_CLOUD_AUTH_AND_SYNC_COOKBOOK.md +48 -0
  22. package/core/bundled_docs/guides/05_HOST_MATRIX_AND_DISPATCH.md +23 -0
  23. package/core/bundled_docs/guides/06_PROBES_AND_POC_COOKBOOK.md +49 -0
  24. package/core/bundled_docs/guides/07_LIFECYCLE_AND_RECOVERY_STATES.md +46 -0
  25. package/core/bundled_docs/guides/08_LESSONS_AND_PRIVACY_BOUNDARY.md +35 -0
  26. package/core/bundled_docs/hosts/bugx-claude_SKILL.md +326 -0
  27. package/core/bundled_docs/hosts/bugx-dsh_SKILL.md +229 -0
  28. package/core/bundled_docs/hosts/bugx-opencode_SKILL.md +129 -0
  29. package/core/bundled_docs/hosts/bugx-zcode_SKILL.md +459 -0
  30. package/core/bundled_docs/hosts/bugx_SKILL.md +118 -0
  31. package/core/bundled_docs/hosts/cline_bugx_SKILL.md +69 -0
  32. package/core/bundled_docs/hosts/platform_bugx_SKILL.md +50 -0
  33. package/core/bundled_docs/manifest.json +140 -0
  34. package/core/bundled_docs/reference/01_ENVIRONMENT_VARIABLES.md +421 -0
  35. package/core/bundled_docs/reference/04_REPOSITORY_TOPOLOGY.md +180 -0
  36. package/core/cli-help.txt +7 -3
  37. package/core/cloud_sync/cloud_client.py +81 -2
  38. package/core/cloud_sync/endpoint_router.py +22 -9
  39. package/core/cloud_sync/issue_uploader.py +297 -0
  40. package/core/cloud_sync/sensitive_filter.py +77 -7
  41. package/core/contracts/AGENT_GUIDE.md +3 -9
  42. package/core/contracts/README.md +1 -1
  43. package/core/contracts/bugx-opencode.md +1 -1
  44. package/core/contracts/bugx-runtime-contract.md +10 -20
  45. package/core/contracts/bugx-worker.md +1 -1
  46. package/core/engine-integrity.json +267 -111
  47. package/core/host_acp/antigravity.py +153 -0
  48. package/core/host_acp/kimi.py +175 -0
  49. package/core/host_acp/minimax.py +28 -0
  50. package/core/host_runtime/adapters.py +5 -1
  51. package/core/host_runtime/antigravity.py +162 -0
  52. package/core/host_runtime/host_bootstrap.py +18 -7
  53. package/core/host_runtime/host_evaluators.py +4 -4
  54. package/core/host_runtime/host_registry.py +25 -4
  55. package/core/host_runtime/mcp_process_tracker.py +30 -3
  56. package/core/host_runtime/mcp_registry_gate.py +34 -11
  57. package/core/hosts/antigravity.py +115 -0
  58. package/core/hosts/codex.py +3 -0
  59. package/core/hosts/dsh.py +43 -24
  60. package/core/hosts/kimi.py +293 -0
  61. package/core/hosts/minimax.py +249 -0
  62. package/core/hosts/zcode.py +5 -0
  63. package/core/i18n.py +94 -5
  64. package/core/infra/README.md +1 -1
  65. package/core/infra/build_info.py +30 -5
  66. package/core/launch_phases/README.md +2 -2
  67. package/core/launch_phases/startup_version_gate.py +2 -2
  68. package/core/launch_phases/supervisor_bridge.py +16 -23
  69. package/core/launch_phases/supervisor_degraded.py +7 -5
  70. package/core/ledger/README.md +1 -1
  71. package/core/locales/en-US.json +3 -3
  72. package/core/locales/zh-CN.json +3 -3
  73. package/core/mcp_runtime_support/environment.py +6 -1
  74. package/core/metadata.txt +2 -2
  75. package/core/planning/README.md +1 -1
  76. package/core/planning/prompt_harness.py +2 -2
  77. package/core/probes/codebase_memory_probe.py +43 -24
  78. package/core/probes/probe_registry.py +10 -7
  79. package/core/prompts/command_routing_en.md +6 -5
  80. package/core/prompts/command_routing_zh.md +6 -5
  81. package/core/repair/rsi_rounds.py +3 -0
  82. package/core/repair/self_heal.py +160 -6
  83. package/core/retrieval/README.md +1 -1
  84. package/core/runtime/README.md +1 -1
  85. package/core/runtime/scenario_eval.py +5 -1
  86. package/core/runtime/setup_ui_env.py +4 -7
  87. package/core/runtime/tool_install_targets.py +12 -2
  88. package/core/skills/README.md +4 -2
  89. package/core/skills/bugx_docs_cloud_sync.py +658 -0
  90. package/core/skills/bugx_docs_mcp_server.py +966 -140
  91. package/core/supervisor/README.md +1 -1
  92. package/core/supervisor/cli.py +2 -2
  93. package/core/supervisor/worker_execution.py +16 -3
  94. package/core/webui/docs_session_service.py +40 -2
  95. package/core/webui/mcp_inspector.py +12 -6
  96. package/core/webui/static/index.html +51 -3
  97. package/core/webui/static/manifest.webmanifest +1 -1
  98. package/core/webui/static/project-settings.js +18 -3
  99. package/core/webui/static/robots.txt +36 -0
  100. package/core/webui/static/sitemap.xml +15 -0
  101. package/docs/07_distribution/01_README_NPM.md +26 -29
  102. package/ecosystem/integrations/cline/skills/bugx/SKILL.md +46 -46
  103. package/ecosystem/integrations/dsh/agents/bugx.md +2 -1
  104. package/ecosystem/integrations/dsh/dsh-patch.yml +2 -2
  105. package/ecosystem/integrations/dsh/mcp/package.json +1 -1
  106. package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +6 -6
  107. package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
  108. package/ecosystem/integrations/dsh/ui/package.json +1 -1
  109. package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +2 -2
  110. package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
  111. package/ecosystem/integrations/pi/skills/bugx/SKILL.md +6 -6
  112. package/ecosystem/integrations/qoder/CONNECTORS.md +11 -23
  113. package/ecosystem/integrations/qoder/connector-meta.json +9 -9
  114. package/ecosystem/integrations/workbuddy/connector-meta.json +9 -9
  115. package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +8 -7
  116. package/ecosystem/plugins/bugx/.claude-plugin/marketplace.json +2 -2
  117. package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +2 -2
  118. package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +4 -4
  119. package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +2 -2
  120. package/ecosystem/plugins/bugx/agents/bugx-worker.md +14 -18
  121. package/ecosystem/plugins/bugx/agents/bugx.md +45 -49
  122. package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +8 -8
  123. package/ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md +1 -1
  124. package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
  125. package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
  126. package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +3 -3
  127. package/interfaces/bin/bugx.js +2 -0
  128. package/interfaces/cli/bugx_cli/__init__.py +2 -2
  129. package/interfaces/cli/bugx_cli/cli.py +153 -8
  130. package/interfaces/cli/bugx_cli/commands/agent.py +568 -136
  131. package/interfaces/cli/bugx_cli/commands/cloud.py +42 -1
  132. package/interfaces/cli/bugx_cli/commands/doctor.py +668 -223
  133. package/interfaces/cli/bugx_cli/commands/guide.py +143 -0
  134. package/interfaces/cli/bugx_cli/commands/issue.py +262 -0
  135. package/interfaces/cli/bugx_cli/commands/lifecycle.py +99 -62
  136. package/interfaces/cli/bugx_cli/commands/plugin.py +301 -60
  137. package/interfaces/cli/bugx_cli/commands/plugin_antigravity.py +350 -0
  138. package/interfaces/cli/bugx_cli/commands/plugin_claude.py +27 -13
  139. package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +440 -0
  140. package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +522 -0
  141. package/interfaces/cli/bugx_cli/commands/plugin_qoder.py +3 -4
  142. package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +4 -5
  143. package/interfaces/cli/bugx_cli/commands/system.py +75 -5
  144. package/interfaces/cli/bugx_cli/common.py +135 -15
  145. package/interfaces/cli/bugx_cli/host_adapters.py +190 -7
  146. package/interfaces/cli/bugx_cli/hosts/registry.py +6 -3
  147. package/interfaces/cli/bugx_cli/hosts/template_engine.py +31 -11
  148. package/interfaces/cli/bugx_cli/infra/__init__.py +4 -0
  149. package/interfaces/cli/bugx_cli/infra/ai_advisor.py +14 -12
  150. package/interfaces/cli/bugx_cli/infra/engine_installer.py +76 -10
  151. package/interfaces/cli/bugx_cli/infra/host_sync.py +66 -1
  152. package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +242 -52
  153. package/package.json +38 -13
  154. package/pyproject.toml +57 -13
  155. package/scripts/sync-version.mjs +1 -1
  156. package/skills/README.md +24 -0
  157. package/skills/platform/bugx/SKILL.md +50 -0
@@ -123,15 +123,22 @@ def _mcp_entry_state(name: str, entry: object) -> str:
123
123
  """Classify a required MCP without executing or resolving external code."""
124
124
  if not isinstance(entry, dict):
125
125
  return "recommended"
126
+ if entry.get("disabled") is True or entry.get("enabled") is False:
127
+ return "disabled"
126
128
  if "enabled" in entry:
127
129
  return "incompatible"
130
+ if name == "bugx-docs" and isinstance(entry.get("url"), str) and entry["url"].strip():
131
+ try:
132
+ from core.host_runtime.mcp_process_tracker import probe_remote_docs_mcp
133
+ probe = probe_remote_docs_mcp({"bugx-docs": entry})
134
+ return "configured" if probe.get("healthy") else "incompatible"
135
+ except Exception:
136
+ return "incompatible"
128
137
  command = entry.get("command")
129
138
  tokens = command if isinstance(command, list) else []
130
139
  tokens = [item for item in tokens if isinstance(item, str)]
131
140
  if _is_incompatible_managed_mcp_command(name, tokens):
132
141
  return "incompatible"
133
- if entry.get("disabled") is True:
134
- return "disabled"
135
142
  if tokens == OPENCODE_PINNED_MCP_COMMANDS.get(name):
136
143
  return "configured"
137
144
  return "custom"
@@ -474,66 +481,51 @@ def provision_targeted_mcp_runtime(root: Path, selected: set[str]) -> set[str]:
474
481
  return probe_existing()
475
482
 
476
483
 
477
- def _mcp_recommendations(root: Path) -> list[dict[str, object]]:
484
+ def _mcp_recommendations(
485
+ root: Path,
486
+ *,
487
+ installed_hosts: set[str] | list[str] | tuple[str, ...] | None = None,
488
+ ) -> list[dict[str, object]]:
478
489
  """Report host MCP recommendations without starting external code."""
479
- config = root.resolve() / CONFIG_NAME
480
- configured: dict[str, object] = {}
481
- if config.is_file() and not config.is_symlink():
482
- try:
483
- payload = json.loads(config.read_text(encoding="utf-8"))
484
- mcp = payload.get("mcp") if isinstance(payload, dict) else None
485
- servers = mcp.get("servers") if isinstance(mcp, dict) else None
486
- if isinstance(servers, dict):
487
- configured = servers
488
- except (OSError, json.JSONDecodeError):
489
- configured = {}
490
- lock_disabled = _lock_disabled_servers()
491
- recommendations: list[dict[str, object]] = []
492
- for item in REQUIRED_MCP_RECOMMENDATIONS:
493
- name = str(item["name"])
494
- entry = configured.get(item["name"])
495
- status = _mcp_entry_state(name, entry)
496
- if name in lock_disabled and status != "incompatible":
497
- # 只要 lock 停用就一律如实报告(不仅是已配置的条目):
498
- # 否则会给用户打印一条**必然失败**的启动命令。
499
- status = "disabled_by_lock"
500
- recommendation = dict(item)
501
- is_conditional_required = name in {"bugx-supervisor", "bugx-supervisor-worker"}
502
- recommendation.update({
503
- "required": is_conditional_required,
504
- "requirement": "conditional" if is_conditional_required else "optional",
505
- "required_when": (
506
- "审查方式=mcp-auto"
507
- if is_conditional_required else "项目类型/审查方向需要该能力"
508
- ),
509
- "status": status,
510
- })
511
- recommendations.append(recommendation)
512
- return recommendations
490
+ return _collect_mcp_recommendations(root, installed_hosts=installed_hosts)
513
491
 
514
492
 
515
493
  def _print_mcp_recommendations(recommendations: list[dict[str, object]]) -> None:
516
494
  """Print a compact host-neutral MCP setup recommendation."""
517
- print(" MCP 工具建议(由宿主 Agent 按需加载,BugX CLI 不启动外部 MCP):")
495
+ print(" MCP 工具配置概览(核心通道随宿主装配;可选能力按项目栈在审计 pre 阶段启用):")
518
496
  for item in recommendations:
519
497
  status = str(item["status"])
520
- marker = "✓" if status in {"configured", "disabled_by_lock"} else "!"
521
- requirement = "条件必需" if item.get("requirement") == "conditional" else "按需"
522
- print(f" {marker} {item['name']}:{requirement};{status};{item['purpose']}")
523
- if status == "disabled_by_lock":
498
+ marker = "✓" if status in {"configured", "disabled_by_lock", "audit_optional", "global_mode"} else "!"
499
+ req = str(item.get("requirement") or "optional")
500
+ if req == "required":
501
+ requirement = "必需"
502
+ elif req == "conditional":
503
+ requirement = "条件必需"
504
+ else:
505
+ requirement = "按需(审计阶段)"
506
+ status_label = {
507
+ "configured": "已就绪",
508
+ "global_mode": "全局随宿主就绪",
509
+ "audit_optional": "延迟至审计按需启用",
510
+ }.get(status, status)
511
+ print(f" {marker} {item['name']}:{requirement};{status_label};{item['purpose']}")
512
+ if status in {"disabled_by_lock", "audit_optional", "global_mode"}:
524
513
  continue
525
514
  if status == "incompatible":
515
+ hint = str(item.get("install_hint") or "")
526
516
  print(
527
517
  f" 建议:旧版 BugX MCP 命令不再接受自动迁移;请手动删除 "
528
- f"`mcp.servers.{item['name']}`,再运行 `bugx install --agent opencode --root <项目路径>`"
518
+ f"`mcp.servers.{item['name']}`,再运行 `{hint}`"
529
519
  )
530
520
  continue
531
521
  if status != "configured":
532
- print(f" 启动命令:{item['command']}")
533
- hint = str(item["install_hint"])
522
+ hint = str(item.get("install_hint") or "")
534
523
  if status == "custom":
535
524
  hint += ";检测到自定义命令,BugX 不会覆盖,请由用户确认其版本"
536
- print(f" 建议:{hint}")
525
+ else:
526
+ print(f" 启动命令:{item['command']}")
527
+ if hint:
528
+ print(f" 建议:{hint}")
537
529
 
538
530
 
539
531
  def _mcp_runtime_doctor_payload(root: Path, runtime_root: Path,
@@ -551,14 +543,14 @@ def _mcp_runtime_doctor_payload(root: Path, runtime_root: Path,
551
543
  from ..common import _python_environment
552
544
  result = subprocess.run(
553
545
  [sys.executable, str(_script(root, "mcp_runtime.py")), *script_args],
554
- cwd=root, capture_output=True, text=True, check=False,
546
+ cwd=root, capture_output=True, encoding="utf-8", errors="replace", check=False,
555
547
  env=_python_environment(), timeout=120,
556
548
  )
557
549
  if result.returncode != 0 and "--fast" in script_args and "unrecognized arguments: --fast" in (result.stderr or ""):
558
550
  script_args_fallback = [a for a in script_args if a != "--fast"]
559
551
  result = subprocess.run(
560
552
  [sys.executable, str(_script(root, "mcp_runtime.py")), *script_args_fallback],
561
- cwd=root, capture_output=True, text=True, check=False,
553
+ cwd=root, capture_output=True, encoding="utf-8", errors="replace", check=False,
562
554
  env=_python_environment(), timeout=120,
563
555
  )
564
556
  try:
@@ -570,10 +562,15 @@ def _mcp_runtime_doctor_payload(root: Path, runtime_root: Path,
570
562
  return result.returncode, payload
571
563
 
572
564
 
573
- def _mcp_runtime_check(root: Path) -> tuple[bool, str]:
574
- """Doctor row for the offline MCP runtime; absence is informational."""
565
+ def _mcp_runtime_check(root: Path, *, strict: bool = False) -> tuple[bool, str]:
566
+ """Doctor row for the offline MCP runtime; absence fails under --strict."""
575
567
  runtime_root = default_mcp_runtime_root()
576
568
  if not runtime_root.exists():
569
+ if strict:
570
+ return False, (
571
+ f"未安装离线 MCP runtime(--strict 严格模式要求就绪):{runtime_root} 不存在;"
572
+ "运行 bugx mcp-runtime install 可构建离线 MCP runtime"
573
+ )
577
574
  return True, (
578
575
  f"未安装离线 MCP runtime(可选):{runtime_root} 不存在;"
579
576
  "运行 bugx mcp-runtime install 可移除宿主 npx 启动路径"
@@ -638,6 +635,176 @@ def _run_external(
638
635
  return stdout, None
639
636
 
640
637
 
638
+ def _collect_mcp_recommendations(
639
+ root: Path,
640
+ *,
641
+ installed_hosts: set[str] | list[str] | tuple[str, ...] | None = None,
642
+ ) -> list[dict[str, object]]:
643
+ """Collect core MCP readiness and optional audit-time capability notes."""
644
+ from .engine_installer import _is_global_home_scope
645
+
646
+ global_scope = _is_global_home_scope(root)
647
+ active_hosts: list[str] = sorted({str(h) for h in (installed_hosts or ()) if str(h)})
648
+ if not active_hosts and not global_scope:
649
+ hosts_path = root.resolve() / ".bugx" / "hosts.json"
650
+ if hosts_path.is_file() and not hosts_path.is_symlink():
651
+ try:
652
+ hosts_data = json.loads(hosts_path.read_text(encoding="utf-8"))
653
+ raw_list = hosts_data.get("installed") if isinstance(hosts_data, dict) else None
654
+ if isinstance(raw_list, list):
655
+ active_hosts = sorted({
656
+ str(item["name"]) for item in raw_list
657
+ if isinstance(item, dict) and isinstance(item.get("name"), str)
658
+ })
659
+ except (OSError, UnicodeError, json.JSONDecodeError):
660
+ active_hosts = []
661
+
662
+ config = root.resolve() / CONFIG_NAME
663
+ configured: dict[str, object] = {}
664
+ if not global_scope and config.is_file() and not config.is_symlink():
665
+ try:
666
+ payload = json.loads(config.read_text(encoding="utf-8"))
667
+ mcp = payload.get("mcp") if isinstance(payload, dict) else None
668
+ servers = mcp.get("servers") if isinstance(mcp, dict) else None
669
+ if isinstance(servers, dict):
670
+ configured = servers
671
+ except (OSError, UnicodeError, json.JSONDecodeError):
672
+ configured = {}
673
+
674
+ lock_disabled = _lock_disabled_servers()
675
+ core_channels = {"bugx-supervisor", "bugx-supervisor-worker", "bugx-docs"}
676
+ missing_hosts: list[str] = []
677
+ if not global_scope and active_hosts:
678
+ try:
679
+ from ..commands.agent import _check_host_mcp_config
680
+
681
+ for host_name in active_hosts:
682
+ ok_host, _ = _check_host_mcp_config(root, host_name)
683
+ if not ok_host:
684
+ missing_hosts.append(host_name)
685
+ except Exception:
686
+ pass
687
+
688
+ recommendations: list[dict[str, object]] = []
689
+ for item in REQUIRED_MCP_RECOMMENDATIONS:
690
+ name = str(item["name"])
691
+ recommendation = dict(item)
692
+ if name in core_channels:
693
+ if active_hosts and not missing_hosts:
694
+ status = "configured"
695
+ hint = f"已在宿主({', '.join(active_hosts)})就绪"
696
+ elif missing_hosts:
697
+ status = "missing"
698
+ hint = (
699
+ "请运行 `bugx install --agent "
700
+ + missing_hosts[0]
701
+ + (f" --root {root}` 补齐核心 MCP" if not global_scope else "` 补齐核心 MCP")
702
+ )
703
+ elif global_scope:
704
+ status = "global_mode"
705
+ hint = "核心通道随宿主全局资产装配;审计具体项目时自动绑定项目根"
706
+ else:
707
+ entry = configured.get(name)
708
+ status = _mcp_entry_state(name, entry)
709
+ hint = str(item.get("install_hint") or "")
710
+ recommendation.update({
711
+ "required": True,
712
+ "requirement": "required",
713
+ "required_when": "已选宿主核心协调与文档检索通道",
714
+ "status": status,
715
+ "install_hint": hint,
716
+ })
717
+ recommendations.append(recommendation)
718
+ continue
719
+
720
+ entry = configured.get(name)
721
+ status = _mcp_entry_state(name, entry) if entry is not None else "audit_optional"
722
+ if name in lock_disabled and status != "incompatible":
723
+ status = "disabled_by_lock"
724
+ recommendation.update({
725
+ "required": False,
726
+ "requirement": "optional",
727
+ "required_when": "项目类型/审查方向需要该能力(审计 pre 阶段按需启用)",
728
+ "status": status,
729
+ "install_hint": (
730
+ str(item.get("install_hint") or "")
731
+ if status in {"custom", "incompatible"}
732
+ else "可选能力 MCP:进入项目审计 `pre` 阶段按技术栈自动探测并询问是否启用"
733
+ ),
734
+ })
735
+ recommendations.append(recommendation)
736
+ return recommendations
737
+
738
+
739
+ def _windows_project_mcp_processes(
740
+ root: Path,
741
+ ) -> tuple[list[dict[str, object]] | None, str | None]:
742
+ """Enumerate project-scoped BugX MCP worker processes on Windows via PowerShell CIM."""
743
+ resolved = str(root.resolve()).lower()
744
+ ps_script = (
745
+ "$ErrorActionPreference='SilentlyContinue';"
746
+ "$now=[DateTimeOffset]::UtcNow;"
747
+ "$items=@(Get-CimInstance Win32_Process | Where-Object { "
748
+ "$_.CommandLine -and $_.CommandLine -match 'bugx_mcp_server\\.py|bugx.*mcp.*serve' "
749
+ "} | ForEach-Object { "
750
+ "$age=0; if ($_.CreationDate) { "
751
+ "try { $age=[Math]::Max(0,[int]($now - [DateTimeOffset]$_.CreationDate).TotalSeconds) } catch {} "
752
+ "}; "
753
+ "[PSCustomObject]@{pid=[int]$_.ProcessId;ppid=[int]$_.ParentProcessId;"
754
+ "age_seconds=[double]$age;command=[string]$_.CommandLine} "
755
+ "});"
756
+ "ConvertTo-Json -InputObject $items -Compress"
757
+ )
758
+ creationflags = getattr(subprocess, "CREATE_NO_WINDOW", 0)
759
+ try:
760
+ res = subprocess.run(
761
+ ["powershell", "-NoProfile", "-NonInteractive", "-Command", ps_script],
762
+ capture_output=True,
763
+ text=True,
764
+ timeout=6,
765
+ check=False,
766
+ creationflags=creationflags,
767
+ )
768
+ except (OSError, subprocess.SubprocessError) as exc:
769
+ return None, f"unsupported_platform: windows powershell enumeration failed ({exc})"
770
+ if res.returncode != 0:
771
+ detail = (res.stderr or res.stdout).strip()[:200] or f"rc={res.returncode}"
772
+ return None, f"unsupported_platform: windows cim query failed ({detail})"
773
+ raw = (res.stdout or "").strip()
774
+ if not raw or raw == "null":
775
+ return [], None
776
+ try:
777
+ parsed = json.loads(raw)
778
+ except json.JSONDecodeError as exc:
779
+ return None, f"unsupported_platform: windows process json parse failed ({exc})"
780
+ if isinstance(parsed, dict):
781
+ parsed = [parsed]
782
+ if not isinstance(parsed, list):
783
+ return [], None
784
+ entries: list[dict[str, object]] = []
785
+ for item in parsed:
786
+ if not isinstance(item, dict):
787
+ continue
788
+ cmd = str(item.get("command") or "")
789
+ if " serve" not in cmd.lower():
790
+ continue
791
+ cmd_norm = cmd.lower().replace("/", "\\")
792
+ root_win = resolved.replace("/", "\\")
793
+ if resolved not in cmd.lower() and root_win not in cmd_norm:
794
+ continue
795
+ pid = item.get("pid")
796
+ ppid = item.get("ppid")
797
+ if not isinstance(pid, int) or pid <= 0:
798
+ continue
799
+ entries.append({
800
+ "pid": pid,
801
+ "ppid": int(ppid) if isinstance(ppid, int) and ppid > 0 else None,
802
+ "age_seconds": float(item.get("age_seconds") or 0.0),
803
+ "command": cmd,
804
+ })
805
+ return entries, None
806
+
807
+
641
808
  def _project_mcp_processes(
642
809
  root: Path,
643
810
  ) -> tuple[list[dict[str, object]] | None, str | None]:
@@ -648,8 +815,8 @@ def _project_mcp_processes(
648
815
  2. ``--root`` 必须与解析后的项目根**精确匹配**(不误伤其他项目/手工进程);
649
816
  3. **活动判定**:进程自己发布的 session proof 若比阈值更新,说明它是**活跃会话**,不得清理。
650
817
  """
651
- if os.name == "nt": # pragma: no cover - 平台不支持时如实返回未知
652
- return None, "unsupported_platform: process enumeration unavailable"
818
+ if os.name == "nt":
819
+ return _windows_project_mcp_processes(root)
653
820
  stdout, failure = _run_external(["ps", "-eo", "pid=,ppid=,etime=,command="])
654
821
  if failure is not None:
655
822
  return None, failure
@@ -683,6 +850,23 @@ def _project_mcp_processes(
683
850
 
684
851
  def _live_pids() -> set[int] | None:
685
852
  """当前存活 PID 集合;枚举失败返回 None(调用方据此回退到保守旧判据)。"""
853
+ if os.name == "nt":
854
+ creationflags = getattr(subprocess, "CREATE_NO_WINDOW", 0)
855
+ try:
856
+ res = subprocess.run(
857
+ [
858
+ "powershell", "-NoProfile", "-NonInteractive", "-Command",
859
+ "Get-CimInstance Win32_Process | ForEach-Object { $_.ProcessId }",
860
+ ],
861
+ capture_output=True, text=True, timeout=5, check=False,
862
+ creationflags=creationflags,
863
+ )
864
+ if res.returncode != 0:
865
+ return None
866
+ live = {int(tok.strip()) for tok in (res.stdout or "").splitlines() if tok.strip().isdigit()}
867
+ return live or None
868
+ except (OSError, subprocess.SubprocessError):
869
+ return None
686
870
  stdout, failure = _run_external(["ps", "-eo", "pid="])
687
871
  if failure is not None:
688
872
  return None
@@ -792,6 +976,12 @@ def _mcp_session_hygiene_check(
792
976
  """Doctor row:同项目 MCP 会话进程数与**遗弃**判定(阈值化 + advisory)。"""
793
977
  entries, failure = _project_mcp_processes(root)
794
978
  if failure is not None:
979
+ lower = failure.lower()
980
+ if any(
981
+ token in lower
982
+ for token in ("unsupported_platform", "unavailable", "permission", "restricted")
983
+ ):
984
+ return True, f"当前环境限制无法枚举项目 MCP 进程,已跳过会话卫生检查({failure})"
795
985
  return False, f"同项目 MCP 进程枚举失败(结果未知):{failure}"
796
986
  if not entries:
797
987
  return True, "无同项目 MCP 会话进程"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bugx-cli",
3
- "version": "0.1.2",
4
- "description": "Host-neutral adversarial white-box and black-box auditing agent CLI wrapper",
3
+ "version": "0.1.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": {
7
7
  "bugx": "interfaces/bin/bugx.js"
@@ -56,6 +56,7 @@
56
56
  "core/webui/**/*.py",
57
57
  "core/webui/adapters/*.py",
58
58
  "core/**/*.json",
59
+ "core/bundled_docs/**",
59
60
  "core/webui/static/",
60
61
  "core/**/*.md",
61
62
  "core/**/*.txt",
@@ -69,41 +70,65 @@
69
70
  "core/**/*.woff2",
70
71
  "core/**/*.js",
71
72
  "ecosystem/",
73
+ "skills/platform/bugx/SKILL.md",
72
74
  "pyproject.toml",
73
75
  "README.md",
74
76
  "docs/07_distribution/01_README_NPM.md",
75
77
  "LICENSE"
76
78
  ],
77
79
  "keywords": [
78
- "agent",
79
- "ai-agent",
80
- "ai-code-audit",
81
- "automated-code-audit",
82
- "code-audit",
83
80
  "code-review",
84
81
  "code-review-agent",
82
+ "automated-testing",
83
+ "testing-agent",
84
+ "autonomous-testing",
85
+ "black-box-testing",
86
+ "functional-testing",
87
+ "performance-testing",
88
+ "software-testing",
89
+ "quality-assurance",
90
+ "qa-automation",
91
+ "qa-agent",
92
+ "bug-detection",
93
+ "bug-hunter",
85
94
  "automated-code-review",
86
- "vibe-coding",
87
- "vibe-coding-security",
95
+ "ai-code-review",
88
96
  "pr-review",
89
97
  "pull-request-review",
90
- "zero-false-positive",
91
- "poc-generator",
92
98
  "security-audit",
93
99
  "vulnerability-scanner",
94
- "vulnerability-mining",
95
100
  "sast",
96
101
  "static-analysis",
102
+ "code-audit",
103
+ "code-quality",
104
+ "ai-agent",
97
105
  "mcp",
98
106
  "mcp-server",
99
- "mcp-security",
107
+ "model-context-protocol",
100
108
  "claude-code",
109
+ "openai-codex",
101
110
  "codex",
111
+ "cursor",
112
+ "trae",
113
+ "windsurf",
114
+ "cline",
115
+ "kimi-code",
116
+ "minimax-code",
102
117
  "opencode",
103
118
  "zcode",
119
+ "ai-testing",
120
+ "test-automation",
104
121
  "devsecops",
105
122
  "cli"
106
123
  ],
124
+ "homepage": "https://bugx.dev",
125
+ "repository": {
126
+ "type": "git",
127
+ "url": "git+https://github.com/Bencibr/bugx.git"
128
+ },
129
+ "bugs": {
130
+ "url": "https://github.com/Bencibr/bugx/issues"
131
+ },
107
132
  "engines": {
108
133
  "node": ">=18.0.0"
109
134
  },
package/pyproject.toml CHANGED
@@ -5,37 +5,52 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "bugx-cli"
7
7
  dynamic = ["version"]
8
- description = "Host-neutral adversarial white-box and black-box auditing agent and automated code review engine"
8
+ description = "Autonomous code review and testing agent. Catches subtle, high-impact bugs, automates black-box and functional QA testing, and safeguards dependable software delivery."
9
9
  readme = "docs/07_distribution/02_README_PYPI.md"
10
10
  requires-python = ">=3.11"
11
11
  license = "BUSL-1.1"
12
12
  keywords = [
13
- "agent",
14
- "ai-agent",
15
- "ai-code-audit",
16
- "automated-code-audit",
17
- "code-audit",
18
13
  "code-review",
19
14
  "code-review-agent",
15
+ "automated-testing",
16
+ "testing-agent",
17
+ "autonomous-testing",
18
+ "black-box-testing",
19
+ "functional-testing",
20
+ "performance-testing",
21
+ "software-testing",
22
+ "quality-assurance",
23
+ "qa-automation",
24
+ "qa-agent",
25
+ "bug-detection",
26
+ "bug-hunter",
20
27
  "automated-code-review",
21
- "vibe-coding",
22
- "vibe-coding-security",
28
+ "ai-code-review",
23
29
  "pr-review",
24
30
  "pull-request-review",
25
- "zero-false-positive",
26
- "poc-generator",
27
31
  "security-audit",
28
32
  "vulnerability-scanner",
29
- "vulnerability-mining",
30
33
  "sast",
31
34
  "static-analysis",
35
+ "code-audit",
36
+ "code-quality",
37
+ "ai-agent",
32
38
  "mcp",
33
39
  "mcp-server",
34
- "mcp-security",
40
+ "model-context-protocol",
35
41
  "claude-code",
36
42
  "openai-codex",
43
+ "codex",
44
+ "cursor",
45
+ "trae",
46
+ "windsurf",
47
+ "cline",
48
+ "kimi-code",
49
+ "minimax-code",
37
50
  "opencode",
38
51
  "zcode",
52
+ "ai-testing",
53
+ "test-automation",
39
54
  "devsecops",
40
55
  ]
41
56
  classifiers = [
@@ -43,6 +58,8 @@ classifiers = [
43
58
  "Intended Audience :: Developers",
44
59
  "Topic :: Security",
45
60
  "Topic :: Software Development :: Quality Assurance",
61
+ "Topic :: Software Development :: Testing",
62
+ "Topic :: Software Development :: Bug Tracking",
46
63
  "Programming Language :: Python :: 3",
47
64
  "Programming Language :: Python :: 3.11",
48
65
  "Programming Language :: Python :: 3.12",
@@ -52,7 +69,10 @@ dependencies = []
52
69
 
53
70
  [project.urls]
54
71
  Homepage = "https://bugx.dev"
72
+ Documentation = "https://bugx.dev"
55
73
  Source = "https://github.com/Bencibr/bugx"
74
+ Issues = "https://github.com/Bencibr/bugx/issues"
75
+ Changelog = "https://github.com/Bencibr/bugx/blob/main/CHANGELOG.md"
56
76
 
57
77
  [project.optional-dependencies]
58
78
  tui = ["pexpect==4.9.0"]
@@ -77,6 +97,7 @@ include = ["bugx_cli*"]
77
97
 
78
98
  [tool.setuptools.data-files]
79
99
  "share/bugx-agent" = ["ecosystem/integrations/opencode/opencode.json", "ecosystem/integrations/opencode/mcp-lock.json", "ecosystem/integrations/opencode/bugx-mcp-manifest.json"]
100
+ "share/bugx-agent/skills/platform/bugx" = ["skills/platform/bugx/SKILL.md"]
80
101
  "share/bugx-agent/dsh" = ["ecosystem/integrations/dsh/dsh-patch.yml"]
81
102
  "share/bugx-agent/dsh/skills/bugx" = ["ecosystem/integrations/dsh/skills/bugx/SKILL.md"]
82
103
  "share/bugx-agent/dsh/skills/bugx-dsh" = ["ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md"]
@@ -102,6 +123,9 @@ include = ["bugx_cli*"]
102
123
  "share/bugx-agent/plugins/bugx/skills/bugx-zcode" = [
103
124
  "ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md",
104
125
  ]
126
+ "share/bugx-agent/plugins/bugx/skills/bugx" = [
127
+ "ecosystem/plugins/bugx/skills/bugx/SKILL.md",
128
+ ]
105
129
  "share/bugx-agent/plugins/bugx/skills/bugx-claude" = [
106
130
  "ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md",
107
131
  ]
@@ -126,7 +150,20 @@ include = ["bugx_cli*"]
126
150
  "core/contracts/*.md",
127
151
  "core/contracts/*.py",
128
152
  ]
129
- "share/bugx-agent/core/assets" = ["core/assets/*.png", "core/assets/*.svg", "core/assets/*.md"]
153
+ "share/bugx-agent/core/assets" = [
154
+ "core/assets/*.png",
155
+ "core/assets/*.svg",
156
+ "core/assets/*.jpg",
157
+ "core/assets/*.md",
158
+ ]
159
+ "share/bugx-agent/core/bundled_docs" = [
160
+ "core/bundled_docs/*.md",
161
+ "core/bundled_docs/*.json",
162
+ ]
163
+ "share/bugx-agent/core/bundled_docs/guides" = ["core/bundled_docs/guides/*.md"]
164
+ "share/bugx-agent/core/bundled_docs/ai" = ["core/bundled_docs/ai/*.md"]
165
+ "share/bugx-agent/core/bundled_docs/reference" = ["core/bundled_docs/reference/*.md"]
166
+ "share/bugx-agent/core/bundled_docs/hosts" = ["core/bundled_docs/hosts/*.md"]
130
167
  "share/bugx-agent/core/assets/axe-core" = [
131
168
  "core/assets/axe-core/axe.min.js",
132
169
  "core/assets/axe-core/LICENSE.txt",
@@ -173,6 +210,9 @@ include = ["bugx_cli*"]
173
210
  "core/webui/static/*.html",
174
211
  "core/webui/static/*.js",
175
212
  "core/webui/static/*.png",
213
+ "core/webui/static/*.jpg",
214
+ "core/webui/static/*.txt",
215
+ "core/webui/static/*.xml",
176
216
  "core/webui/static/*.webmanifest",
177
217
  ]
178
218
  "share/bugx-agent/core/webui/static/assets" = [
@@ -184,6 +224,7 @@ include = ["bugx_cli*"]
184
224
  "share/bugx-agent/core/prompts" = ["core/prompts/*.md"]
185
225
  "share/bugx-agent/core/prompts/rules" = ["core/prompts/rules/*.md"]
186
226
  "share/bugx-agent/core/prompts/stages" = ["core/prompts/stages/*.md"]
227
+ "share/bugx-agent/core/prompts/policies" = ["core/prompts/policies/*.json"]
187
228
  "share/bugx-agent/core/audit_packs" = ["core/audit_packs/*.md"]
188
229
  "share/bugx-agent/core/audit_packs/web-audit" = [
189
230
  "core/audit_packs/web-audit/manifest.json",
@@ -194,6 +235,9 @@ include = ["bugx_cli*"]
194
235
  "share/bugx-agent/core/audit_packs/web-audit/stages" = [
195
236
  "core/audit_packs/web-audit/stages/*.md",
196
237
  ]
238
+ "share/bugx-agent/core/audit_packs/pitfalls" = [
239
+ "core/audit_packs/pitfalls/*.json",
240
+ ]
197
241
  "share/bugx-agent/core/audit_packs/mobile-audit" = [
198
242
  "core/audit_packs/mobile-audit/manifest.json",
199
243
  ]
@@ -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.2') {
18
+ if (pkgJson.version === '0.1.4') {
19
19
  console.error('[bugx] ✗ 源码 package.json 是模板;请先在临时构建树运行 scripts/render_version.py 或 scripts/package_dist.py');
20
20
  process.exit(1);
21
21
  }
@@ -0,0 +1,24 @@
1
+ # BugX Agent Skills (智能体技能体系)
2
+
3
+ 本目录收敛管理 BugX 仓库中所有面向人类工程师与 AI Agent 协作的标准技能(符合带有 YAML Frontmatter 的 `SKILL.md` 规范)。
4
+
5
+ ---
6
+
7
+ ## 目录结构与分类维度
8
+
9
+ ```text
10
+ skills/
11
+ ├── developer/ # 【研发工具技能】开发者与代码助手维护 BugX 自用
12
+ │ ├── defect-hardening/ # - 缺陷彻底消解与补丁工程 (PE) 规范(反向复现+彻底根因消解+红队对抗)
13
+ │ ├── dev-doc/SKILL.md # - 5 问设计方案审计门禁、定向测试策略与版本闭环
14
+ │ ├── directory-governance/ # - 全域目录架构、文件命名、分组索引与防漂移治理规范
15
+ │ └── host-adapter/SKILL.md # - 宿主适配器插件(六面契约)构建与实测避坑手册(含 DSH 升级适配 Runbook)
16
+ │
17
+ ├── platform/ # 【平台操作技能】宿主通用的 BugX 操作与漏洞挖掘规范
18
+ │ └── bugx/SKILL.md # - 官方标准 Agent 交互入口(支持按需文档 RAG 与意图决策树)
19
+ │
20
+ └── README.md # 本说明文档
21
+ ```
22
+
23
+ > [!NOTE]
24
+ > 引擎底层的漏洞挖掘领域攻防规则包(`web-audit`, `mobile-audit`, `desktop-audit` 等)已正名并收拢至 `core/audit_packs/`,不再与外部 Agent Skill 混用。