bugx-cli 0.1.3 → 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.
- package/core/README.md +5 -3
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/bugx.md +2 -2
- package/core/bugx_paths.py +10 -2
- package/core/bundled_docs/OVERVIEW.md +310 -0
- package/core/bundled_docs/README.md +10 -0
- package/core/bundled_docs/README_EN.md +278 -0
- package/core/bundled_docs/ai/01_AI_REFERENCE.md +833 -0
- package/core/bundled_docs/ai/02_AI_USAGE.md +161 -0
- package/core/bundled_docs/ai/03_AI_COMMANDS.md +322 -0
- package/core/bundled_docs/guides/01_USER_GUIDE.md +887 -0
- package/core/bundled_docs/guides/02_COMMANDS.md +935 -0
- package/core/bundled_docs/guides/03_TROUBLESHOOTING.md +763 -0
- package/core/bundled_docs/guides/04_CLOUD_AUTH_AND_SYNC_COOKBOOK.md +48 -0
- package/core/bundled_docs/guides/05_HOST_MATRIX_AND_DISPATCH.md +23 -0
- package/core/bundled_docs/guides/06_PROBES_AND_POC_COOKBOOK.md +49 -0
- package/core/bundled_docs/guides/07_LIFECYCLE_AND_RECOVERY_STATES.md +46 -0
- package/core/bundled_docs/guides/08_LESSONS_AND_PRIVACY_BOUNDARY.md +35 -0
- package/core/bundled_docs/hosts/bugx-claude_SKILL.md +326 -0
- package/core/bundled_docs/hosts/bugx-dsh_SKILL.md +229 -0
- package/core/bundled_docs/hosts/bugx-opencode_SKILL.md +129 -0
- package/core/bundled_docs/hosts/bugx-zcode_SKILL.md +459 -0
- package/core/bundled_docs/hosts/bugx_SKILL.md +118 -0
- package/core/bundled_docs/hosts/cline_bugx_SKILL.md +69 -0
- package/core/bundled_docs/hosts/platform_bugx_SKILL.md +50 -0
- package/core/bundled_docs/manifest.json +140 -0
- package/core/bundled_docs/reference/01_ENVIRONMENT_VARIABLES.md +421 -0
- package/core/bundled_docs/reference/04_REPOSITORY_TOPOLOGY.md +180 -0
- package/core/cli-help.txt +7 -3
- package/core/cloud_sync/cloud_client.py +81 -2
- package/core/cloud_sync/endpoint_router.py +22 -9
- package/core/cloud_sync/issue_uploader.py +297 -0
- package/core/cloud_sync/sensitive_filter.py +77 -7
- package/core/contracts/AGENT_GUIDE.md +3 -9
- package/core/contracts/README.md +1 -1
- package/core/contracts/bugx-runtime-contract.md +10 -20
- package/core/contracts/bugx-worker.md +1 -1
- package/core/engine-integrity.json +209 -93
- package/core/host_acp/antigravity.py +153 -0
- package/core/host_runtime/adapters.py +5 -1
- package/core/host_runtime/antigravity.py +162 -0
- package/core/host_runtime/host_bootstrap.py +18 -7
- package/core/host_runtime/host_evaluators.py +4 -4
- package/core/host_runtime/host_registry.py +2 -1
- package/core/host_runtime/mcp_process_tracker.py +30 -3
- package/core/host_runtime/mcp_registry_gate.py +34 -11
- package/core/hosts/antigravity.py +115 -0
- package/core/hosts/codex.py +3 -0
- package/core/hosts/dsh.py +42 -23
- package/core/hosts/minimax.py +5 -4
- package/core/i18n.py +94 -5
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +2 -2
- package/core/launch_phases/README.md +2 -2
- package/core/launch_phases/startup_version_gate.py +2 -2
- package/core/launch_phases/supervisor_bridge.py +2 -0
- package/core/launch_phases/supervisor_degraded.py +7 -5
- package/core/ledger/README.md +1 -1
- package/core/locales/en-US.json +3 -3
- package/core/locales/zh-CN.json +3 -3
- package/core/mcp_runtime_support/environment.py +6 -1
- package/core/metadata.txt +1 -1
- package/core/planning/README.md +1 -1
- package/core/planning/prompt_harness.py +2 -2
- package/core/probes/codebase_memory_probe.py +43 -24
- package/core/probes/probe_registry.py +10 -7
- package/core/prompts/command_routing_en.md +6 -5
- package/core/prompts/command_routing_zh.md +6 -5
- package/core/repair/rsi_rounds.py +3 -0
- package/core/repair/self_heal.py +160 -6
- package/core/retrieval/README.md +1 -1
- package/core/runtime/README.md +1 -1
- package/core/runtime/scenario_eval.py +5 -1
- package/core/runtime/tool_install_targets.py +12 -2
- package/core/skills/README.md +4 -2
- package/core/skills/bugx_docs_cloud_sync.py +658 -0
- package/core/skills/bugx_docs_mcp_server.py +966 -140
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/worker_execution.py +16 -3
- package/core/webui/docs_session_service.py +40 -2
- package/core/webui/mcp_inspector.py +6 -6
- package/ecosystem/integrations/cline/skills/bugx/SKILL.md +46 -46
- package/ecosystem/integrations/dsh/agents/bugx.md +2 -1
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +5 -5
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +2 -2
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/pi/skills/bugx/SKILL.md +5 -5
- package/ecosystem/integrations/qoder/CONNECTORS.md +11 -23
- package/ecosystem/integrations/qoder/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +8 -7
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/agents/bugx-worker.md +14 -18
- package/ecosystem/plugins/bugx/agents/bugx.md +45 -49
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +7 -7
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +2 -2
- package/interfaces/cli/bugx_cli/__init__.py +1 -1
- package/interfaces/cli/bugx_cli/cli.py +138 -8
- package/interfaces/cli/bugx_cli/commands/agent.py +376 -69
- package/interfaces/cli/bugx_cli/commands/cloud.py +42 -1
- package/interfaces/cli/bugx_cli/commands/doctor.py +650 -223
- package/interfaces/cli/bugx_cli/commands/guide.py +143 -0
- package/interfaces/cli/bugx_cli/commands/issue.py +262 -0
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +55 -25
- package/interfaces/cli/bugx_cli/commands/plugin.py +295 -54
- package/interfaces/cli/bugx_cli/commands/plugin_antigravity.py +350 -0
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +2 -2
- package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +154 -62
- package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +308 -108
- package/interfaces/cli/bugx_cli/commands/system.py +11 -1
- package/interfaces/cli/bugx_cli/common.py +39 -8
- package/interfaces/cli/bugx_cli/host_adapters.py +40 -3
- package/interfaces/cli/bugx_cli/hosts/registry.py +3 -2
- package/interfaces/cli/bugx_cli/hosts/template_engine.py +21 -2
- package/interfaces/cli/bugx_cli/infra/__init__.py +4 -0
- package/interfaces/cli/bugx_cli/infra/ai_advisor.py +14 -12
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +76 -10
- package/interfaces/cli/bugx_cli/infra/host_sync.py +66 -1
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +240 -50
- package/package.json +3 -2
- package/pyproject.toml +22 -2
- package/scripts/sync-version.mjs +1 -1
- package/skills/README.md +1 -2
- package/skills/platform/bugx/SKILL.md +50 -0
- package/skills/platform/bugx-user/SKILL.md +0 -92
|
@@ -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(
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
522
|
-
|
|
523
|
-
|
|
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']}`,再运行 `
|
|
518
|
+
f"`mcp.servers.{item['name']}`,再运行 `{hint}`"
|
|
529
519
|
)
|
|
530
520
|
continue
|
|
531
521
|
if status != "configured":
|
|
532
|
-
|
|
533
|
-
hint = str(item["install_hint"])
|
|
522
|
+
hint = str(item.get("install_hint") or "")
|
|
534
523
|
if status == "custom":
|
|
535
524
|
hint += ";检测到自定义命令,BugX 不会覆盖,请由用户确认其版本"
|
|
536
|
-
|
|
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,
|
|
@@ -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
|
|
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":
|
|
652
|
-
return
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugx-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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": {
|
|
@@ -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,7 +70,7 @@
|
|
|
69
70
|
"core/**/*.woff2",
|
|
70
71
|
"core/**/*.js",
|
|
71
72
|
"ecosystem/",
|
|
72
|
-
"skills/platform/bugx
|
|
73
|
+
"skills/platform/bugx/SKILL.md",
|
|
73
74
|
"pyproject.toml",
|
|
74
75
|
"README.md",
|
|
75
76
|
"docs/07_distribution/01_README_NPM.md",
|
package/pyproject.toml
CHANGED
|
@@ -97,7 +97,7 @@ include = ["bugx_cli*"]
|
|
|
97
97
|
|
|
98
98
|
[tool.setuptools.data-files]
|
|
99
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
|
|
100
|
+
"share/bugx-agent/skills/platform/bugx" = ["skills/platform/bugx/SKILL.md"]
|
|
101
101
|
"share/bugx-agent/dsh" = ["ecosystem/integrations/dsh/dsh-patch.yml"]
|
|
102
102
|
"share/bugx-agent/dsh/skills/bugx" = ["ecosystem/integrations/dsh/skills/bugx/SKILL.md"]
|
|
103
103
|
"share/bugx-agent/dsh/skills/bugx-dsh" = ["ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md"]
|
|
@@ -150,7 +150,20 @@ include = ["bugx_cli*"]
|
|
|
150
150
|
"core/contracts/*.md",
|
|
151
151
|
"core/contracts/*.py",
|
|
152
152
|
]
|
|
153
|
-
"share/bugx-agent/core/assets" = [
|
|
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"]
|
|
154
167
|
"share/bugx-agent/core/assets/axe-core" = [
|
|
155
168
|
"core/assets/axe-core/axe.min.js",
|
|
156
169
|
"core/assets/axe-core/LICENSE.txt",
|
|
@@ -197,6 +210,9 @@ include = ["bugx_cli*"]
|
|
|
197
210
|
"core/webui/static/*.html",
|
|
198
211
|
"core/webui/static/*.js",
|
|
199
212
|
"core/webui/static/*.png",
|
|
213
|
+
"core/webui/static/*.jpg",
|
|
214
|
+
"core/webui/static/*.txt",
|
|
215
|
+
"core/webui/static/*.xml",
|
|
200
216
|
"core/webui/static/*.webmanifest",
|
|
201
217
|
]
|
|
202
218
|
"share/bugx-agent/core/webui/static/assets" = [
|
|
@@ -208,6 +224,7 @@ include = ["bugx_cli*"]
|
|
|
208
224
|
"share/bugx-agent/core/prompts" = ["core/prompts/*.md"]
|
|
209
225
|
"share/bugx-agent/core/prompts/rules" = ["core/prompts/rules/*.md"]
|
|
210
226
|
"share/bugx-agent/core/prompts/stages" = ["core/prompts/stages/*.md"]
|
|
227
|
+
"share/bugx-agent/core/prompts/policies" = ["core/prompts/policies/*.json"]
|
|
211
228
|
"share/bugx-agent/core/audit_packs" = ["core/audit_packs/*.md"]
|
|
212
229
|
"share/bugx-agent/core/audit_packs/web-audit" = [
|
|
213
230
|
"core/audit_packs/web-audit/manifest.json",
|
|
@@ -218,6 +235,9 @@ include = ["bugx_cli*"]
|
|
|
218
235
|
"share/bugx-agent/core/audit_packs/web-audit/stages" = [
|
|
219
236
|
"core/audit_packs/web-audit/stages/*.md",
|
|
220
237
|
]
|
|
238
|
+
"share/bugx-agent/core/audit_packs/pitfalls" = [
|
|
239
|
+
"core/audit_packs/pitfalls/*.json",
|
|
240
|
+
]
|
|
221
241
|
"share/bugx-agent/core/audit_packs/mobile-audit" = [
|
|
222
242
|
"core/audit_packs/mobile-audit/manifest.json",
|
|
223
243
|
]
|
package/scripts/sync-version.mjs
CHANGED
|
@@ -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.
|
|
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
|
}
|
package/skills/README.md
CHANGED
|
@@ -15,8 +15,7 @@ skills/
|
|
|
15
15
|
│ └── host-adapter/SKILL.md # - 宿主适配器插件(六面契约)构建与实测避坑手册(含 DSH 升级适配 Runbook)
|
|
16
16
|
│
|
|
17
17
|
├── platform/ # 【平台操作技能】宿主通用的 BugX 操作与漏洞挖掘规范
|
|
18
|
-
│
|
|
19
|
-
│ └── bugx-user/SKILL.md # - 用户上手、云同步、经验复用与故障排查
|
|
18
|
+
│ └── bugx/SKILL.md # - 官方标准 Agent 交互入口(支持按需文档 RAG 与意图决策树)
|
|
20
19
|
│
|
|
21
20
|
└── README.md # 本说明文档
|
|
22
21
|
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bugx
|
|
3
|
+
description: BugX 深度代码审查与缺陷挖掘智能体。提供自主缺陷挖掘、敏捷单点复现(PoC)、环境体检及知识检索能力。
|
|
4
|
+
metadata:
|
|
5
|
+
bugx_version: "0.1.4"
|
|
6
|
+
---
|
|
7
|
+
<!-- bugx-locale: zh-CN -->
|
|
8
|
+
|
|
9
|
+
# BugX 智能体执行手册
|
|
10
|
+
|
|
11
|
+
BugX 核心协议镜像。执行前可通过 `bugx engine path --name bugx.md` 读取完整规范;项目 `.bugx/` 保存运行态与账本。
|
|
12
|
+
|
|
13
|
+
协议镜像版本:0.1.4
|
|
14
|
+
|
|
15
|
+
## 1. 意图分流决策树 (Triage Decision Tree)
|
|
16
|
+
拿到任务第一秒,判定属于哪个分支:
|
|
17
|
+
- **分支 A:单点敏捷排查 / 特定函数 / Diff / 报错堆栈**
|
|
18
|
+
- **标志**:单文件排查、复现某个函数、分析异常报错。
|
|
19
|
+
- **动作**:就地编写轻量复现脚本(PoC)或运行定向测试,使用 `bugx view`, `bugx test-generate`, `bugx test-verify`;**严禁启动重型全流程门禁!**
|
|
20
|
+
- **分支 B:全库漏洞挖掘 / 深度变异 / 多 Worker 并发审计**
|
|
21
|
+
- **标志**:用户明确输入 `/bugx`、要求“全库审计”、“挖掘潜在漏洞”。
|
|
22
|
+
- **动作**:按标准生命周期流转(`engine pre` -> 门禁确认 -> Explore -> Mutate -> Repair -> 结算)。
|
|
23
|
+
- **分支 C:环境诊断 / 依赖修复 / 宿主状态排查**
|
|
24
|
+
- **标志**:命令缺失、版本不一致、MCP 未就绪、依赖报错。
|
|
25
|
+
- **动作**:优先运行 `bugx doctor --root <ROOT> --json` 与 `bugx engine --root <ROOT> status --json`,绝不盲目 `init` 或 `--force`。
|
|
26
|
+
|
|
27
|
+
## 2. 标准五步操作闭环 (5-Step Execution Loop)
|
|
28
|
+
1. **定根**:确定被测项目根绝对路径 `<ROOT>`,严格在 `<ROOT>` 内部执行,禁止全盘发散扫描。
|
|
29
|
+
2. **探况**:先执行只读命令检查运行态(`bugx engine --root <ROOT> status --json` 或 `bugx doctor`)。
|
|
30
|
+
3. **选路**:根据意图挑选命令,严禁盲猜参数。
|
|
31
|
+
4. **承接**:若 `engine pre` 返回退出码 `2`,表示等待宿主单选门禁交互;必须调用宿主原生控件展示选项,按用户选择的 action 执行,禁止文本伪造选择或自旋重试。退出码 `0` 只代表门禁通过,不代表挖掘完成。
|
|
32
|
+
5. **闭环**:缺陷必须给出最小独立复现脚本(PoC)与完整调用栈证据;如实汇报。
|
|
33
|
+
|
|
34
|
+
## 3. 按需知识检索 (On-Demand Knowledge RAG)
|
|
35
|
+
遇到具体参数疑问、云端授权流程、报错排查(如 WinError 32、同步失败)或生命周期细则时,**严禁全盘 grep 盲搜**,优先通过以下途径动态获取精准步骤与文档证据:
|
|
36
|
+
- **CLI 指令**:运行 `bugx guide "<关键词>"`(例如:`bugx guide "云端登录"`、`bugx guide "错题集"`、`bugx guide "doctor 修复"`、`bugx guide "WinError 32"`)。
|
|
37
|
+
- **MCP 工具**:调用 `bugx-docs` 的 `search_docs` 工具(如 `search_docs(query="云端登录", project_id="<ROOT_NAME>")`)。
|
|
38
|
+
获取到操作指引后,直接按文档指引执行下一步。
|
|
39
|
+
|
|
40
|
+
## 4. 高频场景命令(覆盖 90% 日常调用)
|
|
41
|
+
- **环境诊断与体检**:`bugx doctor --root <ROOT> --json`(`bugx doctor --repair` 执行安全自愈)
|
|
42
|
+
- **启动与门禁推进**:`bugx engine --root <ROOT> status --json` / `bugx engine --root <ROOT> pre`
|
|
43
|
+
- **单点复现与验证**:`bugx test-generate --root <ROOT> --scope <PATH::SYM> --out <FILE>` / `bugx test-verify verify --scope <SCOPE>`
|
|
44
|
+
- **报告生成与预览**:`bugx report serve --port 18991`(本地实时可视化看板)
|
|
45
|
+
- **知识检索**:`bugx guide "<关键词>"`
|
|
46
|
+
|
|
47
|
+
## 5. 核心军规与红线
|
|
48
|
+
1. **源码安全与发布边界**:默认严禁推送到 GitHub 或未授权公网远端;仅在本地受控沙箱运行。
|
|
49
|
+
2. **凭据零残留与环境零污染**:`.bugx/` 是运行态账本与证据库,严禁将私有运行时、临时测试文件或凭据引入被测工程生产源码与依赖。
|
|
50
|
+
3. **反盲测与反自洽断言**:缺陷必须给出最小独立复现脚本(PoC)与确定性断言,禁止无证据猜测或伪造结论。
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: bugx-user
|
|
3
|
-
description: Guide BugX users through cloud-connected onboarding, project setup, defensive code review and repair, lesson and experience sync, and symptom-led troubleshooting. Use for first use, cloud login or binding, unexpected Local mode, missing synced knowledge, failed sync, or understanding BugX status and results.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# BugX 用户上手与排障
|
|
7
|
-
|
|
8
|
-
先弄清用户当前卡在哪一步。首次接入走完整主线,已有项目从当前状态继续。面向用户优先引导云端登录、项目绑定、推拉错题和经验,再用这些知识帮助定位、修复和复验项目代码的问题。只有用户明确要求离线时才引导 Local。云端失败时处理失败原因,保留现有状态、账本和队列。
|
|
9
|
-
|
|
10
|
-
使用同一个明确的项目根,命令中的 `.` 指已确认的仓库根。只在用户授权的仓库、账号和数据范围内工作。先展示全量同步的数据范围与敏感策略,获得授权后再执行云端写入。对宿主交互请求使用该请求的真实选项和用户选择。
|
|
11
|
-
|
|
12
|
-
## 先走与症状对应的步骤
|
|
13
|
-
|
|
14
|
-
用户明确要求只同步一部分时,在同步流程的联网或修改授权之前直接答复:“BugX 项目云同步按全量范围执行。当前仅授权部分数据,本次不执行同步。”
|
|
15
|
-
|
|
16
|
-
已有错误输出时用它判断下一步。有云同步或记录缺失时进入「云端同步和经验找不到」。卡在宿主、Provider 或运行态时进入「宿主、交互和运行态恢复」。其余常见问题查症状表。只有首次接入才从安装清单开始。
|
|
17
|
-
|
|
18
|
-
## 从安装到第一次同步
|
|
19
|
-
|
|
20
|
-
1. 用 `bugx --version` 确认 CLI。缺少 CLI 时从选定包源安装 `npm install -g bugx-cli`(Node.js 18+ 和 Python 3.11+)或 `python -m pip install bugx-cli`(Python 3.11+)。用 `bugx hosts --root . --json` 确认宿主标识。已有项目先看 `bugx engine --root . status --json` 和 `bugx cloud status --root . --scope project --json`。保留运行中的项目和待恢复状态。
|
|
21
|
-
2. 确认账号、端点和数据范围。 `bugx cloud config --root . --json` 显示 Base URL 及其来源。已有登录先核验账号。首次或认证失效时用 `bugx auth login --root .`,用户在验证页完成设备授权。无法自动打开时按终端给出的地址和用户码操作。用 `bugx auth status --root . --verify --json` 查正确账号和 `auth_verified=true`,因为该查询可能在验证失败时也退出 0。BugX 云账号与宿主模型凭据分别检查。
|
|
22
|
-
3. 标准云同步按全量范围执行,包含项目登记与画像、项目知识和账号全局知识。用户只授权其中一部分时,直接拒绝该同步请求。包括仅同步当前项目、仅同步知识或排除项目画像的请求。保留现有项目、账本和队列。详情粒度和敏感策略按当前配置执行。新项目使用 `init --cloud-sync sync` 前先核对用户级 `cloud-config.json` 中的 `sync_detail_mode` 和 `sensitive_policy`。若设置了 `BUGX_CLOUD_CONFIG`,以该路径为准。`cloud config --json` 用于核对端点和来源,详情及敏感策略要读有效配置中的对应字段。若用户授权更新默认值,用 `bugx config set cloud.sync_detail_mode <MODE>` 和 `bugx config set cloud.sensitive_policy <POLICY>`。初始化可能立即同步,并会记录用户级数据分享同意。
|
|
23
|
-
- 全量范围已授权且是全新项目时,运行 `bugx init --root . --cloud-sync sync`。核对初始化是否已输出本轮两层的推拉和 ACK 成功证据。尚待首轮同步时,运行 `bugx cloud sync --root . --scope all`。
|
|
24
|
-
- 已有项目,包括 `onboarding=local` 或首次同步失败,保留账本。全量范围已授权后执行 `bugx cloud sync --root . --scope all`。包含 project 的同步成功会置 `onboarding=done`。设备间用同一账号和仓库已提交的 `.bugx-project.json`,分别登录并核对云项目绑定。
|
|
25
|
-
4. 检查本次同步各层 baseline pull、push、post-push pull 的返回,再用 `bugx cloud status --root . --scope all --json` 对照项目 ID、游标、最近错误和 outbox、死信、冲突。 `cloud status` 读本地同步状态。 `done` 表示已启用同步或进入恢复轨道,实际推拉结果以本次网络输出为准。
|
|
26
|
-
|
|
27
|
-
## 完成一轮并在下轮复用经验
|
|
28
|
-
|
|
29
|
-
1. 宿主入口还未装配时用 `bugx install --root . --agent <HOST>`,按提示重启宿主。用 `bugx doctor --root . --strict --json` 核对引擎、宿主入口和 MCP,再在宿主中提交项目、模块或变更范围。遇到已有会话,从状态的下一步续跑。需要解释 CLI 的阶段时按用户指南说明,先核对目标宿主的能力。
|
|
30
|
-
2. 跟踪 `bugx engine --root . status --json`。启动通过后还要看到实际处理进度、覆盖清单和验证证据。逐项看发现位置、影响和复验结论;用户授权修复时按顺序完成变更检查和定向回归。查看收尾状态及 `bugx report --root . --source project --format both`;如果有未决 Finding、未验证范围或缺失的收尾证据,明确对应项和恢复动作。
|
|
31
|
-
3. 在账本中确认已有可共享的错题、事件或工具经验。保留问题症状、已验证原因、修复和复验结果,引导宿主使用当前流程的账本入口。用户明确要求录入时,从 `bugx help lesson` 核对当前版本的 `record`、`incident-add` 或 `tool-feedback` 输入约束,先审查记录内容。用 `bugx knowledge status --root .` 查看账本,再用 `bugx lesson retrieve --root . --query "<症状或模块名>" --json` 查看错题,按同样的 `--root`、`--query` 和 `--json` 参数使用 `lesson incident-lookup` 查故障案例,使用 `lesson tool-lookup` 查工具经验。条件满足时账本提交可后台调度同步。按已确认的全量范围同步并检查实际响应,以确认本轮结果。
|
|
32
|
-
4. 下一轮按项目、模块或错误签名召回经验,优先检查相关代码和已知误判。云端经验是定位线索,确认和修复依赖当轮代码与证据。跨设备验收按下文核对两端记录与同步结果。
|
|
33
|
-
|
|
34
|
-
## 按症状排障
|
|
35
|
-
|
|
36
|
-
| 现象 | 核对与恢复 |
|
|
37
|
-
|---|---|
|
|
38
|
-
| 命令找不到、版本和预期不符 | Windows PowerShell 用 `Get-Command bugx -All`,POSIX shell 用 `command -v bugx` 确认命令来源,再用 `bugx --version` 核对 Build。只有问题指向引擎或安装资产时,再用 `bugx doctor --root . --installation-only --json`。 |
|
|
39
|
-
| `init` 完成后找不到 `$bugx-user` | 项目 Skill 自动安装自 `0.1.2+build.17` 引入。先看实际运行的 Build 和项目根,再查 `.agents/skills/bugx-user/SKILL.md`。旧 Build 先找与安装来源匹配且已确认包含模板的制品。有支持版本但文件缺失时,按原授权云策略重跑一次普通 `init` 并核对打印路径。文件已存在时,检查宿主是否发现该目录并重新加载会话。 |
|
|
40
|
-
| Windows 更新报 `WinError 32`,或失败后 CLI 报模块缺失 | 先用 `Get-Command bugx -All` 和 `python -m pip show bugx-cli` 确认启动器和包的状态,核查占用进程。现有 Codex 会话继续使用原运行进程,文件锁释放前暂停对同一解释器反复重装。急用时可将已核验的 wheel 安装到独立虚拟环境,使用其中的 BugX 启动器。锁释放后用原解释器重装已验证版本,再核对 `bugx --version` 与 `bugx help`。 |
|
|
41
|
-
| 自动进入 Local 或 `sync_pending` | 检查云状态、最近 init/pre 参数和 profile/preset。新项目的 TTY init 省略选项、无策略的 Dev 或未决自治启动、未登录的无交互未决启动都能进入 Local。已启用项目遇到部分网络故障也能继续本地执行并保留队列,此时云端仍待同步。若看到的是 `report_policy=local`,那是报告分享策略,项目知识同步仍看 onboarding 和推拉结果。登录正确账号后,按上面的项目身份与数据范围要求恢复同步,保留账本和队列。 |
|
|
42
|
-
| 已登录但同步失败 | 手头没有远端核验结果时,运行 `bugx auth status --root . --verify --json`。成功以 `auth_verified=true` 和正确账号为准。已经收到 401 时,直接用 `bugx auth login --root .` 重新授权再核验。TLS 或网络不可达时优先修端点与连通性。403 要核对权限和错误详情。 |
|
|
43
|
-
| 云端配置值非法,或 JSON 无法读取 | 能解析 JSON 且错误只点名某个值时,只改已确认的字段。例如用户允许 `summary` 后运行 `bugx config set cloud.sync_detail_mode summary`,再用 `bugx cloud config --root . --json` 验证配置可载入。若整个 JSON 损坏,先备份原配置,再恢复可解析的版本并核对现有端点与策略。直接 `config set` 可能用新配置覆盖坏文件里的其他字段。 |
|
|
44
|
-
| `data_sharing_revoked` | 保留队列并暂停推拉。得到用户明确重新授权后,可用 `bugx config set telemetry.data_sharing true` 恢复用户级许可,再按已授权的全量范围同步。 |
|
|
45
|
-
| 项目未绑定、绑定到另一项目或读不到另一设备的记录 | 对照账号、project_id、仓库根和 `.bugx-project.json`。先用 `cloud status` 和失败摘要确认,再按身份提示绑定。检查记录所属层、同步错误和检索关键词;避免删除状态、手改绑定或创建重复身份。 |
|
|
46
|
-
|
|
47
|
-
## 云端同步和经验找不到
|
|
48
|
-
|
|
49
|
-
先读本轮最终结果,再定位第一个仍未通过的阶段。若 CLI 已自动恢复,最终推拉和 ACK 已成功且状态无对应错误,直接核对目标记录。全量范围还未授权时,按开头直接拒绝。已有全量授权时的标准重试是 `bugx cloud sync --root . --scope all`。状态只读查询可用 `bugx cloud status --root . --scope all --json`,其中 `scope_state`、outbox、inbox 和 conflicts 用于定位当前层。
|
|
50
|
-
|
|
51
|
-
| 阶段 | 先看什么 | 下一步与成功证据 |
|
|
52
|
-
|---|---|---|
|
|
53
|
-
| 入账 | 手头只有报告或 Finding,还是已有账本写入结果和记录 ID | 先在源设备用对应的 `lesson` 查询验证记录。若还没入账,按实际记录类型和现有治理流程处理。源设备能返回目标 ID 后再查同步。 |
|
|
54
|
-
| 过滤或拒绝 | 项目种子、记录状态、详情策略、敏感策略,以及 push 的跳过、拒绝或冲突输出 | 用目标 ID 核对记录类别和策略审计。修正实际不合规的记录或配置,再按授权全量同步。 |
|
|
55
|
-
| 上传 | 本轮出错阶段和 outbox 的 pending / inflight / dead-letter | 先处理本轮错误,保留 operation ID、错误码和队列。恢复后核对对应层的 push 结果。队列为零时仍要核对本轮回执。 |
|
|
56
|
-
| 远端确认 | push 有无失败、冲突或远端版本 | 对照本轮 push 结果和状态。批次成功只说明该批处理结果,要证明一条记录应在接收端核对同一 ID。 |
|
|
57
|
-
| 下载及 ACK | 接收端实际 project_id、pull、inbox、游标和 ACK | 正常时核对导入和游标。最终结果仍显示已提交但 ACK 失败时,先用目标 ID 查本地导入,进入下表的 ACK 分支。 |
|
|
58
|
-
| 检索 | 已导入,当前查询为空、只命中相似标题,或使用了不适用的检索入口 | 用原主题、故障签名或工具分类查询对应类型,比较结果内 ID。同名卡片不能证明目标记录已到账。涉及下一轮 Agent 使用时,还需实际召回的独立证据。 |
|
|
59
|
-
|
|
60
|
-
| 已定位的故障 | 恢复动作和终点 |
|
|
61
|
-
|---|---|
|
|
62
|
-
| ACK 失败,pull 可能已提交 | 保留记录和游标,先处理错误指向的认证、网络或服务端拒绝。全量授权下重试一次标准同步。复核目标 ID 仍在、对应 ACK 正常且错误清除。仍有 ACK 失败时给出 `RECOVERY_REQUIRED`。 |
|
|
63
|
-
| 有 open conflict | 按实际层运行 `bugx cloud conflicts list --root . --scope <SCOPE> --json`,定位具体冲突 ID 和双方内容。明确得到选边决定后才按 CLI 契约处理,远端选边可能联网。检查目标冲突已关闭并核对最终记录。尚无选边决定时保留冲突。 |
|
|
64
|
-
| 有 dead-letter | 按实际层运行 `bugx cloud dead-letter list --root . --scope <SCOPE> --json`,查该条的错误、身份和重试原因。先处理根因。若修复后依然不能重放,保存错误和队列并升级处理。清理是单独授权的管理动作。 |
|
|
65
|
-
| 明确 cursor / baseline 失配 | 先核对目标账号、绑定和错误码,查当前 CLI 的 `--calibrate` 影响范围。仅在已确认是可恢复基线失配且有对应授权时考虑校准。 |
|
|
66
|
-
|
|
67
|
-
### 验收经验跨设备复用
|
|
68
|
-
|
|
69
|
-
选一条已确认可共享、目标设备尚未有的非种子记录。A 与 B 分别初始化自己的项目运行态,通过受控仓库获得同一 `.bugx-project.json`。两个设备分别登录同一云账号,并核对同一云项目 ID。
|
|
70
|
-
|
|
71
|
-
1. A 入账后用实际类型查询,保存记录 ID(如返回的 `pattern_id` 或 `incident_id`)和可安全共享的查询词。B 同样查询,留下一次目标 ID 尚未出现的结果。
|
|
72
|
-
2. 全量授权下在 A 执行标准同步。确认本轮项目绑定、两层推拉与错误状态。再在 B 同步并确认项目层拉取、导入及 ACK 结果。
|
|
73
|
-
3. 在 B 用相同类型的 `lesson` 命令检索,比较返回的记录 ID 和预期内容。工具经验按实际条目的工具名和分类核对。同一标题、旧游标或上一次的 ACK 只可作为线索。
|
|
74
|
-
4. 分别报告入账、同步、另一端检索以及下一轮实际消费的结果。可复用的通过证据是 B 同步前无此记录,同步后返回 A 的同一 ID。若还需证明 Agent 真正在下一轮使用它,进一步查看实际召回或消费记录。
|
|
75
|
-
|
|
76
|
-
## 宿主、交互和运行态恢复
|
|
77
|
-
|
|
78
|
-
从已有的结构化状态或日志选一行。仅缺证据时查该行的首个命令,复核同一项目和运行身份。
|
|
79
|
-
|
|
80
|
-
| 现象 | 最小核对 | 恢复与复核 |
|
|
81
|
-
|---|---|---|
|
|
82
|
-
| `pre` 等待用户选择 | `bugx interaction list --root . --json`。有问题 ID 时用 `bugx interaction show <ID> --root . --json` | 由用户选实际选项,按宿主给出的动作或通过 `bugx interaction answer <ID> --value <VALUE> --root . --json` 提交真实选择。复核请求已消费且门禁推进。 |
|
|
83
|
-
| MCP 工具缺失,或只有独立 stdio 的 tools/list | 用 `bugx doctor --root . --agent <HOST> --strict --json` 核对目标宿主和项目入口 | 刚改配置时先重载目标宿主。确认入口缺失才用 `bugx install --root . --agent <HOST>`。验收以真实宿主会话中正确的项目、角色、session proof 和结构化调用为准。接管和清理只用于已核实的过期实例。 |
|
|
84
|
-
| 宿主 Provider 429 | 已有返回时使用给出的等待窗口。缺证据时查 `bugx log --root . --errors --timing --json` | 等待限流窗口结束后查 `bugx engine --root . status --json` 并按 next_action 续接。复核旧限流已解除、同一运行链路有新回执。BugX 云账号有独立认证检查。 |
|
|
85
|
-
| 有 claim 但没有 worker-start | `bugx supervisor --root . status --json`,对照 Host 的实际 Task 分派和 Worker 身份 | 原宿主按真实任务状态续接。出现匹配的 worker-start 和心跳后再认定它在运行。 |
|
|
86
|
-
| heartbeat 丢失、lease 过期 | `bugx supervisor --root . status --json`,核对租约和最后接受的 checkpoint | 确认无活跃执行且状态要求恢复时,由 Host 用 `bugx supervisor --root . recover`。核对旧 lease 回收、已接受的 checkpoint 一致,随后按新状态动作继续。 |
|
|
87
|
-
| checkpoint 超时或宿主输出截断 | 先查原 checkpoint_id 的持久化回执和当前租约。没有可信回执时核对完整原请求 | 同一租约仍有效且未确认提交时,由原角色用同一 checkpoint_id 和原负载重试。租约已失效交 Host 恢复。复核同一操作 ID 和原始结构化回执,输出仍不全时标 `UNVERIFIED`。 |
|
|
88
|
-
| post 被拦或报告未认证 | `bugx engine --root . status --json`,再按实际缺口查 `bugx supervisor --root . gate --json` | 先处理未结 Finding、coverage 或证据缺口。以正式收尾状态和结构化产物复核。 |
|
|
89
|
-
|
|
90
|
-
交付时给出用户当前阶段、证据、故障原因或未定位项、已采取的动作及复核结果。分享诊断时只提供脱敏的状态、错误码和必要日志片段。保留 `BLOCKED`、`RECOVERY_REQUIRED` 或 `UNVERIFIED` 等真实状态。
|
|
91
|
-
|
|
92
|
-
需要核对当前版本参数时,使用 `bugx help <命令>`,例如 `bugx help cloud`、`bugx help lesson` 和 `bugx help report`。
|