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.
- package/README.md +26 -29
- package/core/README.md +5 -3
- package/core/agent/agent_orchestrator.py +3 -0
- package/core/agent/agent_workspace.py +14 -2
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/assets/twitter_promo_art.jpg +0 -0
- package/core/assets/twitter_promo_card.svg +166 -0
- package/core/assets/twitter_promo_clean.jpg +0 -0
- package/core/assets/twitter_terminal_real.png +0 -0
- package/core/bugx.md +3 -3
- 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-opencode.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 +267 -111
- package/core/host_acp/antigravity.py +153 -0
- package/core/host_acp/kimi.py +175 -0
- package/core/host_acp/minimax.py +28 -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 +25 -4
- 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 +43 -24
- package/core/hosts/kimi.py +293 -0
- package/core/hosts/minimax.py +249 -0
- package/core/hosts/zcode.py +5 -0
- package/core/i18n.py +94 -5
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +30 -5
- 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 +16 -23
- 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 +2 -2
- 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/setup_ui_env.py +4 -7
- 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/cli.py +2 -2
- package/core/supervisor/worker_execution.py +16 -3
- package/core/webui/docs_session_service.py +40 -2
- package/core/webui/mcp_inspector.py +12 -6
- package/core/webui/static/index.html +51 -3
- package/core/webui/static/manifest.webmanifest +1 -1
- package/core/webui/static/project-settings.js +18 -3
- package/core/webui/static/robots.txt +36 -0
- package/core/webui/static/sitemap.xml +15 -0
- package/docs/07_distribution/01_README_NPM.md +26 -29
- package/ecosystem/integrations/cline/skills/bugx/SKILL.md +46 -46
- package/ecosystem/integrations/dsh/agents/bugx.md +2 -1
- package/ecosystem/integrations/dsh/dsh-patch.yml +2 -2
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +6 -6
- package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +2 -2
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/pi/skills/bugx/SKILL.md +6 -6
- package/ecosystem/integrations/qoder/CONNECTORS.md +11 -23
- package/ecosystem/integrations/qoder/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +8 -7
- package/ecosystem/plugins/bugx/.claude-plugin/marketplace.json +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +4 -4
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/agents/bugx-worker.md +14 -18
- package/ecosystem/plugins/bugx/agents/bugx.md +45 -49
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +8 -8
- package/ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +3 -3
- package/interfaces/bin/bugx.js +2 -0
- package/interfaces/cli/bugx_cli/__init__.py +2 -2
- package/interfaces/cli/bugx_cli/cli.py +153 -8
- package/interfaces/cli/bugx_cli/commands/agent.py +568 -136
- package/interfaces/cli/bugx_cli/commands/cloud.py +42 -1
- package/interfaces/cli/bugx_cli/commands/doctor.py +668 -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 +99 -62
- package/interfaces/cli/bugx_cli/commands/plugin.py +301 -60
- package/interfaces/cli/bugx_cli/commands/plugin_antigravity.py +350 -0
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +27 -13
- package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +440 -0
- package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +522 -0
- package/interfaces/cli/bugx_cli/commands/plugin_qoder.py +3 -4
- package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +4 -5
- package/interfaces/cli/bugx_cli/commands/system.py +75 -5
- package/interfaces/cli/bugx_cli/common.py +135 -15
- package/interfaces/cli/bugx_cli/host_adapters.py +190 -7
- package/interfaces/cli/bugx_cli/hosts/registry.py +6 -3
- package/interfaces/cli/bugx_cli/hosts/template_engine.py +31 -11
- 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 +242 -52
- package/package.json +38 -13
- package/pyproject.toml +57 -13
- package/scripts/sync-version.mjs +1 -1
- package/skills/README.md +24 -0
- package/skills/platform/bugx/SKILL.md +50 -0
package/core/locales/en-US.json
CHANGED
|
@@ -415,8 +415,8 @@
|
|
|
415
415
|
"prompt.tier.default.description": "General default model",
|
|
416
416
|
"prompt.tier.explore.description": "High-throughput scanning model (Flash / Haiku / GPT-4o-mini), for large-scale unit and route exploration",
|
|
417
417
|
"prompt.tier.gate.description": "Fast lightweight model (Flash / Haiku / GPT-4o-mini), for fast gates and baseline checks",
|
|
418
|
-
"prompt.tier.mutate.description": "Deep reasoning model (Sonnet / DeepSeek-R1 / GPT-4o), for concurrency race, state simulation, and differential testing",
|
|
419
|
-
"prompt.tier.repair.description": "High-precision code engineering model (Claude
|
|
418
|
+
"prompt.tier.mutate.description": "Deep reasoning model (Claude Sonnet 5.5 / Gemini 4 Carbon / DeepSeek-R1 / GPT-4o), for concurrency race, state simulation, and differential testing",
|
|
419
|
+
"prompt.tier.repair.description": "High-precision code engineering model (Claude Sonnet 5.5 / Opus 5.5 / Codex), for minimal TDD fix and unit test closure",
|
|
420
420
|
"prompt.workers.shared_instruction_body": "You are a BugX concurrent worker. The host has already atomically claimed the coverage unit(s) below; do not claim again.\n1. Resolve the global script with `bugx engine path --name audit_supervisor.py`, then confirm actual start (returned execution_id must stay unchanged; copy the preoccupied value verbatim, omit it when unconfirmed, and never generate/replace it):\n <Python> <global-engine>/audit_supervisor.py worker-start --root . \\\n --state {state_rel} --worker <claimed worker_id> --provider <provider>\n2. Complete exploration → test → evidence verification for assigned units; write all evidence to artifact_root returned by claim. Each coverage unit must have its own unique artifact file; never overwrite or modify it after submitting its checkpoint.\n Modifying shared source without host-provided git worktree is prohibited; fixes are performed serially by host;\n Do not write shared runtime, do not write life, do not run verify_life.py settle, do not generate final report.\n3. Submit checkpoint (life_delta must be JSON number 0, never string \\\"0\\\"; artifact_path must reside in own artifact_root):\n <Python> <global-engine>/audit_supervisor.py checkpoint --root . \\\n --state {state_rel} --worker <claimed worker_id> --input <payload.json>\n payload.json must contain unique and retryable checkpoint_id covering all claimed units. expected_revision may be included only when returned by the immediately preceding MCP response; otherwise omit it and never guess 0/1.\n coverage=covered is a coverage state; evidence.status must be passed with exit_code=0. Other evidence.status values are only failed/error/skipped/blocked; never put covered in evidence.status. Each candidate finding's evidence must be a list of objects `[{{\"path\": \"<relative_path>\", \"line\": <positive_int>}}]`, never a \"path:line\" string. If a finding sets `reproducible=true`, it must include a non-empty `reproduction` command or step list; otherwise do not mark it reproducible.\n4. Call bugx_supervisor_heartbeat immediately after a successful worker-start (your first liveness proof), then every <=5 minutes; before any long command (>60s probes/tests) call MCP bugx_supervisor_begin_long_call (expected_seconds<=1800, keep-alive window so the lease survives the command) before any long command (>60s probes/tests), then call bugx_supervisor_heartbeat every 5 minutes; leases will be reclaimed by host if stuck; do not treat ordinary claim as execution or call a project `.bugx/core` entry.\n4a. If a checkpoint is rejected (run_id/execution_receipt/cross-epoch), rewrite the probe output to a NEW file inside artifact_root and resubmit via the bounded finalizer (worker_checkpoint.py finalize, step 3 pattern) rebound to the current epoch; never blindly re-run probes.",
|
|
421
421
|
"prompt.workers.shared_instruction_header": "【Shared Instructions】Paste the following block into each worker's Task prompt:",
|
|
422
422
|
"prompt.workers.task_harness_banner": " [Active Stage Harness Injection Task Package]:",
|
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
"host.entry.body.qoder_worker": "\n# BugX Worker — Qoder concurrent worker sub-agent\n\nYou are BugX's concurrent worker sub-agent, dispatched in parallel within a Round by the main agent through Qoder's subagent capability (`subagent_type=bugx-worker`). First read and obey the following global engine protocols via `bugx engine path --name <file>`; they are the only authoritative entities and this entry does not copy their content:\n\n- `bugx engine path --name bugx-worker.md`: worker unit-level execution rules (four start-up steps, mining discipline, case-filing oracle, hard evidence gate, checkpoint submission);\n- `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`: lifetime, Supervisor, evidence, and reporting protocols.\n\nThese files are provided by the global engine; do not inspect the project's `.bugx/core`. If the project lacks `.bugx/manifest.json`, stop immediately and report this to the dispatcher. The dispatcher must first run the read-only command `bugx engine --root <ROOT> status --json`; only a result of `UNINITIALIZED` permits `bugx engine --root <ROOT> pre` to safely prepare a fresh project. If the result is `FATAL_BLOCKED`, another blocked state, or the status check fails, preserve project data and stop; never bypass the gate with `bugx init`, `bugx reset`, or `--force`. After the project layout is safely prepared, the dispatcher may refresh host Worker integration from the main session if needed. A Worker never runs host-control initialization or installation commands and never executes protocol steps while the layout is missing.\n\n## Worker role boundary (mandatory)\n\n- Handle only the coverage units or affinity task bundles the Supervisor assigns to you: `claim` (skip when the host has pre-reserved) → `worker-start` → mine and produce evidence → `checkpoint`; `life_delta` must be 0, and you never write lifetime, settle accounts, produce the final report, or take units outside the list.\n- Use only the worker channel: the Supervisor MCP's `bugx-supervisor-worker` tools (claim/worker_start/tool_call/heartbeat/checkpoint), or the same-named subcommands of `audit_supervisor.py` in the global engine; never call host-control tools (start/bootstrap/next_round/bind_context/finish/fail/recover) and never run the host-control entries' `pre|post|settle`.\n- Evidence may only be written into the `artifact_root` returned by the claim; out-of-bounds paths are rejected by the Supervisor. Unless the dispatcher explicitly provides an independent git worktree, never modify shared worktree source — fixes are performed serially by the host.\n- During long commands send a heartbeat every 5 minutes; on a non-zero return or `CONTROL_PAUSED`/`CONTROL_ABORTED`, stop at a safe boundary and report the state to the dispatcher.\n\n## Qoder Worker interaction adaptation (mandatory)\n\nA worker is a sub-agent: it presents no startup gate and must not call `AskUserQuestion` — a regular start is decided automatically by project configuration and raises no serial startup questionnaire. When a user decision is truly required, end directly and report the raw `BUGX_INTERACTION_REQUEST <json>` to the dispatcher; never answer on your own or guess options. Treat the worker itself as non-TTY: forward only the current single-choice request and continue once the dispatcher returns the answer.\n",
|
|
455
455
|
"plugin.zcode_plugin_boundary": "## User-level plugin boundary (plugin form only)\n\nThis entry is registered as a ZCode plugin (agent name `{agent_ref}`) and can be used across projects. Before operating on a project, run the read-only command `bugx engine --root . status --json`: only a result of `UNINITIALIZED` permits `bugx engine --root . pre` to safely prepare a fresh project. If the result is `FATAL_BLOCKED`, another blocked state, or the status check fails, preserve project data and stop; never bypass the gate with `bugx init`, `bugx reset`, or `--force`. This entry is not a substitute for the global engine payload.\n",
|
|
456
456
|
"plugin.chatgpt_skill_banner": "This is the BugX ChatGPT Skill mirror. Before executing, read the global protocol via `bugx engine path --name AGENT_GUIDE.md` and `bugx engine path --name bugx.md`; the global engine is the only authoritative source for protocol and runtime.\n\nProtocol Mirror Version: {version}\n",
|
|
457
|
-
"host.entry.section.commands": "## Host Route (before intent triage)\n\n- **ZCode host**: prefer loading the sibling `bugx-zcode` skill (ZCode-specific handbook: direct-drive path, rpc fallback, field-tested remedies). If it is not registered in the current session (newly installed skills need a host-session restart to appear), apply its core conclusions directly: after `workers` pre-claim, **drive the protocol channel from the host session** (worker MCP tools or `bugx supervisor rpc --role worker`, caller_role=worker); do not default to wrapping the worker in a subagent; `run_sandboxed_probe` must carry the current Task's lease_id/execution_id.\n- All other hosts follow the sections below.\n\n\n\n## How to Use This Skill (AI Meta-Guidance and Intent Decision Tree)\n\nWhen you (the AI) trigger and read this Skill, strictly follow this cognitive model and execution order:\n\n### 1. Intent Decision Tree\nIn the first second of receiving a task, classify which branch it belongs to:\n- **Branch A: Focused Quick Triage / Specific Function / Diff / Error Stack**\n - **Indicators**: Single-file inspection, reproducing a specific function, analyzing an exception stack trace.\n - **Action**: Write a lightweight reproduction test (PoC) or run targeted tests locally using `bugx view`, `bugx test-generate`, `bugx test-verify`; **strictly forbid starting heavy full-lifecycle gates!**\n- **Branch B: Full-Repository Vulnerability Hunting / Deep Mutation / Parallel Worker Audit**\n - **Indicators**: User explicitly triggers `/bugx`, requests \"full codebase audit\", or \"hunt deep vulnerabilities\".\n - **Action**: Follow the canonical lifecycle progression (`engine pre` -> gate confirmation -> Explore -> Mutate -> Repair -> post settlement).\n- **Branch C: Environment Diagnosis / Dependency Repair / Host Inspection**\n - **Action**: Run `bugx doctor --root <ROOT> --json` and `bugx engine --root <ROOT> status --json`; never use `init` or `--force` blindly.\n\n### 2. Standard 5-Step Execution Loop\n1. **Target Root**: Confirm the target repository's absolute path `<ROOT>`; strictly restrict operations within `<ROOT>`, and forbid broad filesystem scans.\n2. **Inspect State**: Run read-only commands to check runtime state first (`bugx engine --root <ROOT> status --json` or `bugx doctor`).\n3. **Select Route**: Pick commands based on intent; if parameters are needed, run `bugx help <top-level-cmd>` (e.g. `bugx help cloud`) to read live syntax dynamically; never guess.\n4. **Handle Gates**: If `engine pre` exits with code `2`, it signals waiting for host structured gate interaction; present options via the host's native control and execute the controlled action selected by the user. Do not fabricate choices or spin-loop. Exit code `0` confirms gate passage only, not audit completion.\n5. **Close the Loop**: Defects require standalone reproduction scripts (PoC) and call-stack evidence; report truthfully using the 6 standard status terms (read-only inspection, project ready, gate ready, test execution, mining launched, mining completed).\n\n### 3. Core Action Matrix (High-Frequency Commands Covering 90% of Calls)\n- **Environment Diagnosis**: `bugx doctor --root <ROOT> --json` (`--repair-assets` for repair)\n- **Startup and Gates**: Run `bugx engine --root <ROOT> status --json` first. Only when the status is `UNINITIALIZED`, run `bugx engine --root <ROOT> pre` to prepare a fresh project; do not run `bugx init` first when starting mining through a host plugin; it is a separate explicit CLI operation and does not replace the status/pre state machine. If the status is `FATAL_BLOCKED`, another blocked state, or the status check fails, preserve the state and stop; never use `init`, `reset`, or `--force` to bypass the gate.\n- **Reproduction and Mutation**: `bugx test-generate --root <ROOT> --scope <PATH::SYM> --out <FILE>` / `bugx test-verify verify --scope <SCOPE>`\n- **Supervisor and Concurrency**: `bugx supervisor status --root <ROOT>`\n- **Telemetry and Logs**: `bugx telemetry inspect` / `bugx log --root <ROOT> --errors`\n- **Dual Reports and Preview**: `bugx report both --eval-dir verification/evals/oss --out verification/evals/oss` / `bugx report serve --port 18991`\n\n### 4. Compact Command Radar (
|
|
457
|
+
"host.entry.section.commands": "## Host Route (before intent triage)\n\n- **ZCode host**: prefer loading the sibling `bugx-zcode` skill (ZCode-specific handbook: direct-drive path, rpc fallback, field-tested remedies). If it is not registered in the current session (newly installed skills need a host-session restart to appear), apply its core conclusions directly: after `workers` pre-claim, **drive the protocol channel from the host session** (worker MCP tools or `bugx supervisor rpc --role worker`, caller_role=worker); do not default to wrapping the worker in a subagent; `run_sandboxed_probe` must carry the current Task's lease_id/execution_id.\n- All other hosts follow the sections below.\n\n\n\n## How to Use This Skill (AI Meta-Guidance and Intent Decision Tree)\n\nWhen you (the AI) trigger and read this Skill, strictly follow this cognitive model and execution order:\n\n### 1. Intent Decision Tree\nIn the first second of receiving a task, classify which branch it belongs to:\n- **Branch A: Focused Quick Triage / Specific Function / Diff / Error Stack**\n - **Indicators**: Single-file inspection, reproducing a specific function, analyzing an exception stack trace.\n - **Action**: Write a lightweight reproduction test (PoC) or run targeted tests locally using `bugx view`, `bugx test-generate`, `bugx test-verify`; **strictly forbid starting heavy full-lifecycle gates!**\n- **Branch B: Full-Repository Vulnerability Hunting / Deep Mutation / Parallel Worker Audit**\n - **Indicators**: User explicitly triggers `/bugx`, requests \"full codebase audit\", or \"hunt deep vulnerabilities\".\n - **Action**: Follow the canonical lifecycle progression (`engine pre` -> gate confirmation -> Explore -> Mutate -> Repair -> post settlement).\n- **Branch C: Environment Diagnosis / Dependency Repair / Host Inspection**\n - **Action**: Run `bugx doctor --root <ROOT> --json` and `bugx engine --root <ROOT> status --json`; never use `init` or `--force` blindly.\n\n### 2. Standard 5-Step Execution Loop\n1. **Target Root**: Confirm the target repository's absolute path `<ROOT>`; strictly restrict operations within `<ROOT>`, and forbid broad filesystem scans.\n2. **Inspect State**: Run read-only commands to check runtime state first (`bugx engine --root <ROOT> status --json` or `bugx doctor`).\n3. **Select Route**: Pick commands based on intent; if parameters are needed, run `bugx help <top-level-cmd>` (e.g. `bugx help cloud`) to read live syntax dynamically; never guess.\n4. **Handle Gates**: If `engine pre` exits with code `2`, it signals waiting for host structured gate interaction; present options via the host's native control and execute the controlled action selected by the user. Do not fabricate choices or spin-loop. Exit code `0` confirms gate passage only, not audit completion.\n5. **Close the Loop**: Defects require standalone reproduction scripts (PoC) and call-stack evidence; report truthfully using the 6 standard status terms (read-only inspection, project ready, gate ready, test execution, mining launched, mining completed).\n\n### 3. Core Action Matrix (High-Frequency Commands Covering 90% of Calls)\n- **Live Guide Lookup**: `bugx guide \"<keyword>\"` (queries synced official docs and project docs; pass `--offline` for airgap environments)\n- **Environment Diagnosis**: `bugx doctor --root <ROOT> --json` (`--repair-assets` for repair)\n- **Startup and Gates**: Run `bugx engine --root <ROOT> status --json` first. Only when the status is `UNINITIALIZED`, run `bugx engine --root <ROOT> pre` to prepare a fresh project; do not run `bugx init` first when starting mining through a host plugin; it is a separate explicit CLI operation and does not replace the status/pre state machine. If the status is `FATAL_BLOCKED`, another blocked state, or the status check fails, preserve the state and stop; never use `init`, `reset`, or `--force` to bypass the gate.\n- **Reproduction and Mutation**: `bugx test-generate --root <ROOT> --scope <PATH::SYM> --out <FILE>` / `bugx test-verify verify --scope <SCOPE>`\n- **Supervisor and Concurrency**: `bugx supervisor status --root <ROOT>`\n- **Telemetry and Logs**: `bugx telemetry inspect` / `bugx log --root <ROOT> --errors`\n- **Dual Reports and Preview**: `bugx report both --eval-dir verification/evals/oss --out verification/evals/oss` / `bugx report serve --port 18991`\n\n### 4. Compact Command Radar (43 Top-level Commands Classified Index)\nTo invoke any command below, inspect exact parameters dynamically via `bugx help <cmd>`; never guess:\n- **Diagnostics and Inspection (10)**: `help`, `completion`, `guide`, `hosts`, `doctor`, `log`, `stats`, `view`, `project`, `self-audit`\n- **Core Lifecycle and Hosts (15)**: `init`, `install`, `reset`, `uninstall`, `dsh`, `engine`, `supervisor`, `daemon`, `config`, `plugin`, `mcp`, `capability`, `mcp-runtime`, `update`, `interaction`\n- **Deep Audit and Verification (10)**: `audit`, `probe`, `logic-analysis`, `mining-audit`, `test-generate`, `test-audit`, `test-verify`, `patch-forge`, `autonomous`, `goal`\n- **Cloud, Knowledge, and Delivery (8)**: `cloud`, `auth`, `telemetry`, `knowledge`, `lesson`, `skill`, `advisory`, `report`\n\n### 5. Mandatory Rules and Deprecated Command Redirection\n- **Gate Blockage Forbids Destructive Repairs**: `FATAL_BLOCKED` must never be bypassed using `init`, `reset`, or `--force`; preserve logs and state first.\n- **Deprecated Command Redirections**: `matrix` -> `bugx audit`; `console` -> `bugx report serve`; `watch` -> `bugx log --watch`; `test` is not a public command. For development checks, create a minimal temporary verification script outside the repository or run tests owned by the target project, then delete the process file.\n",
|
|
458
458
|
"host.entry.description.codex": "Codex-specific BugX operation Skill for starting, resuming and diagnosing BugX audits and reviewing local model and token usage. Preserve the complete Agent workflow, native user gates and evidence validation while dispatching native Workers for the actual project scope.",
|
|
459
459
|
"prompt.plugin.chatgpt_shared_skill_write_failed": "Shared global Skill write failed (plugin registration unaffected): {error}",
|
|
460
460
|
"exception.plugin.claude_usage_skill_missing": "Claude host manual skill is missing; installation cannot complete: {path}\nThis file is a mandatory load listed in bugx/SKILL.md, not an optional add-on.\nFix: ensure ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md is tracked by git, then rebuild the wheel."
|
package/core/locales/zh-CN.json
CHANGED
|
@@ -415,8 +415,8 @@
|
|
|
415
415
|
"prompt.tier.default.description": "通用默认模型",
|
|
416
416
|
"prompt.tier.explore.description": "高吞吐扫描模型 (Flash / Haiku / GPT-4o-mini),适用于大规模单元与路由勘察",
|
|
417
417
|
"prompt.tier.gate.description": "快速轻量级模型 (Flash / Haiku / GPT-4o-mini),适用于快速门禁与基线核验",
|
|
418
|
-
"prompt.tier.mutate.description": "深度推理模型 (Sonnet / DeepSeek-R1 / GPT-4o),适用于并发竞态、状态推演与差分验证",
|
|
419
|
-
"prompt.tier.repair.description": "高精度工程代码模型 (Claude
|
|
418
|
+
"prompt.tier.mutate.description": "深度推理模型 (Claude Sonnet 5.5 / Gemini 4 Carbon / DeepSeek-R1 / GPT-4o),适用于并发竞态、状态推演与差分验证",
|
|
419
|
+
"prompt.tier.repair.description": "高精度工程代码模型 (Claude Sonnet 5.5 / Opus 5.5 / Codex),适用于 TDD 最小修复与单测闭环",
|
|
420
420
|
"prompt.workers.shared_instruction_body": "你是 BugX 并发 worker。宿主已经原子预占了下面给你的 coverage unit(s);不要再次 claim。\n1. 先通过 `bugx engine path --name audit_supervisor.py` 定位全局脚本,再确认真实启动(返回的 execution_id 必须保持不变;只能逐字复制预占值,无法确认时省略,禁止生成/替换):\n <Python> <全局引擎>/audit_supervisor.py worker-start --root . \\\n --state {state_rel} --worker <预占 worker_id> --provider <provider>\n2. 对分配单元完成勘察 → 测试 → 证据复验;所有证据写入预占 claim 返回的 artifact_root。每个 coverage unit 必须使用独立且唯一的 artifact 文件;提交 checkpoint 后不得覆盖或修改。\n 没有宿主提供的独立 git worktree 时禁止修改共享源码,修复由宿主串行完成;\n 不写共享运行态、不写 life、不跑 verify_life.py settle、不生成最终报告。\n3. 提交 checkpoint(JSON 中 life_delta 必须是数字 0,不能写成字符串 \\\"0\\\";artifact_path 必须位于自己的 artifact_root):\n <Python> <全局引擎>/audit_supervisor.py checkpoint --root . \\\n --state {state_rel} --worker <预占 worker_id> --input <payload.json>\n payload.json 必须包含本次提交唯一且可重试的 checkpoint_id,覆盖所有领取的 units。expected_revision 只有在同一 MCP 响应刚返回该值时才能原样带上;否则省略,禁止猜测 0/1。\n coverage=covered 表示覆盖状态;evidence.status 必须填 passed(且 exit_code=0),其他证据状态只能是 failed/error/skipped/blocked,不能填 covered。每个 candidate finding 的 evidence 必须是对象列表 `[{{\"path\": \"<相对路径>\", \"line\": <正整数行号>}}]`,严禁写成 `path:line` 字符串。候选 finding 若 `reproducible=true`,必须同时填写非空 `reproduction`,内容应是可复现命令或步骤;没有复现步骤就不要标记为可复现。\n4. worker-start 成功后立即调用一次 bugx_supervisor_heartbeat(这是启动后的首个活性证明),此后每 ≤5 分钟一次;长命令(预计 >60s 的探针/测试)开始前先调用 bugx_supervisor_begin_long_call(expected_seconds≤1800,声明保活窗口防止租约在命令执行中被回收),窗口结束后每 5 分钟调用 bugx_supervisor_heartbeat;卡住由宿主回收租约,不要把普通 claim 当成真实执行,也不要调用项目 `.bugx/core` 入口。\n4a. checkpoint 被拒(run_id/execution_receipt/跨纪元证据)时,把探针输出重写到 artifact_root 下的新文件,再用步骤 3 的收尾器(worker_checkpoint.py finalize)按当前纪元重建合规 checkpoint,勿盲目重跑探针。",
|
|
421
421
|
"prompt.workers.shared_instruction_header": "【共享指令】把下面这段粘进每个 worker 的 Task 提示词:",
|
|
422
422
|
"prompt.workers.task_harness_banner": " [主动注入 Stage Harness 任务包]:",
|
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
"host.entry.body.qoder_worker": "\n# BugX Worker — Qoder 并发 Worker 子智能体\n\n你是 BugX 的并发 worker 子智能体,由主 Agent 通过 Qoder 的 subagent 能力(`subagent_type=bugx-worker`)在 Round 内并发派发。先通过 `bugx engine path --name <文件>` 读取并遵守以下全局引擎协议;它们是唯一权威实体,本入口不复制其内容:\n\n- `bugx engine path --name bugx-worker.md`:worker 单元级执行规则(开工四步、挖掘纪律、立案 oracle、证据硬门槛、checkpoint 提交);\n- `bugx engine path --name bugx-runtime-contract.md` 与 `bugx engine path --name bugx-quick.md`:寿命、Supervisor、证据和报告协议。\n\n上述文件由全局引擎提供,不检查项目 `.bugx/core`。若项目缺少 `.bugx/manifest.json`,立即停止并将事实报告给派发方。派发方必须先运行只读命令 `bugx engine --root <ROOT> status --json`:只有结果为 `UNINITIALIZED` 时才运行 `bugx engine --root <ROOT> pre` 安全准备新项目;若为 `FATAL_BLOCKED`、其他阻断状态或检查失败,保留项目数据并停止,不得用 `bugx init`、`bugx reset` 或 `--force` 绕过。项目布局准备完成后,如需刷新宿主 Worker 集成,由派发方在主会话中执行;Worker 不运行主控初始化或安装命令,也不在布局缺失时执行协议步骤。\n\n## Worker 角色边界(强制)\n\n- 只负责 Supervisor 分配给你的覆盖单元或亲和任务包:`claim`(宿主已预占时跳过)→ `worker-start` → 挖掘举证 → `checkpoint`;`life_delta` 必须为 0,不写寿命、不结算、不生成最终报告、不领取清单外的单元。\n- 只能使用 worker 通道:Supervisor MCP 的 `bugx-supervisor-worker` 工具(claim/worker_start/tool_call/heartbeat/checkpoint),或全局引擎中的 `audit_supervisor.py` 的同名子命令;不得调用宿主控制工具(start/bootstrap/next_round/bind_context/finish/fail/recover),不得执行宿主控制入口的 `pre|post|settle`。\n- 证据只能写入 claim 返回的 `artifact_root`,越界路径会被 Supervisor 拒绝;没有派发方明确提供独立 git worktree 时,不得修改共享工作树源码,修复由宿主串行完成。\n- 长命令期间每 5 分钟补一次 heartbeat;返回非零或 `CONTROL_PAUSED`/`CONTROL_ABORTED` 时,停在安全边界并把状态报告给派发方。\n\n## Qoder Worker 交互适配(强制)\n\nWorker 是子智能体,不呈现任何启动门禁,也不得调用 `AskUserQuestion`——常规启动由项目配置自动决策,不发起串行启动问卷。确需用户决策时,直接结束并把 `BUGX_INTERACTION_REQUEST <json>` 原文报告给派发方,不得自行作答或猜选项。Worker 自身按非 TTY 处理:只转发当前一个单选请求,答案由派发方回传后再继续。\n",
|
|
455
455
|
"plugin.zcode_plugin_boundary": "## 用户级插件边界(插件形态专用)\n\n本入口以 ZCode 插件(agent 命名 `{agent_ref}`)注册,可跨项目使用。操作项目前先运行只读命令 `bugx engine --root . status --json`:仅当返回 `UNINITIALIZED` 时,才运行 `bugx engine --root . pre` 安全准备新项目;返回 `FATAL_BLOCKED`、其他阻断状态或检查失败时,保留数据并停止,严禁用 `bugx init`、`bugx reset` 或 `--force` 绕过。本入口不能替代全局引擎载荷。\n",
|
|
456
456
|
"plugin.chatgpt_skill_banner": "这是 BugX 的 ChatGPT Skill 镜像。执行前通过 `bugx engine path --name AGENT_GUIDE.md` 和 `bugx engine path --name bugx.md` 读取全局协议;全局引擎是协议和运行时的唯一权威来源。\n\n协议镜像版本:{version}\n",
|
|
457
|
-
"host.entry.section.commands": "## 宿主路由(先于意图分流)\n\n- **ZCode 宿主**:优先加载同插件 `bugx-zcode` skill(ZCode 专属手册:直驱路径、rpc 回退、坑位对策)。若当前会话未注册该 skill(新装 skill 需重启宿主会话才可见),直接按其核心结论执行:`workers` 预占后**由宿主会话直驱协议通道**(worker MCP 工具或 `bugx supervisor rpc --role worker`,caller_role=worker),勿默认为 worker 派发子代理;`run_sandboxed_probe` 必须携带本次 Task 的 lease_id/execution_id。\n- 其余宿主按后续章节执行。\n\n\n\n## 如何使用本技能(AI 执行元指南与意图决策树)\n\n当你(AI)触发并阅读本技能时,请无条件遵循以下认知模型与执行时序:\n\n### 1. 意图决策树(Triage Decision Tree)\n拿到任务第一秒,判定属于哪个分支:\n- **分支 A:单点敏捷排查 / 特定函数 / Diff / 报错堆栈**\n - **标志**:单文件排查、复现某个函数、分析异常报错。\n - **动作**:就地编写轻量复现脚本(PoC)或运行定向测试,使用 `bugx view`, `bugx test-generate`, `bugx test-verify`;**严禁启动重型全流程门禁!**\n- **分支 B:全库漏洞挖掘 / 深度变异 / 多 Worker 并发审计**\n - **标志**:用户明确输入 `/bugx`、要求“全库审计”、“挖掘潜在漏洞”。\n - **动作**:按标准生命周期流转(`engine pre` -> 门禁确认 -> Explore -> Mutate -> Repair -> 结算)。\n- **分支 C:环境诊断 / 依赖修复 / 宿主状态排查**\n - **动作**:优先运行 `bugx doctor --root <ROOT> --json` 与 `bugx engine --root <ROOT> status --json`,绝不盲目 `init` 或 `--force`。\n\n### 2. 标准五步操作闭环(5-Step Execution Loop)\n1. **定根**:确定被测项目根绝对路径 `<ROOT>`,严格在 `<ROOT>` 内部执行,禁止全盘发散扫描。\n2. **探况**:先执行只读命令检查运行态(`bugx engine --root <ROOT> status --json` 或 `bugx doctor`)。\n3. **选路**:根据意图挑选命令;若需查阅参数,运行 `bugx help <顶层命令>`(如 `bugx help cloud`)按需动态读取,严禁盲猜。\n4. **承接**:若 `engine pre` 返回退出码 `2`,表示等待宿主单选门禁交互;必须调用宿主原生控件展示选项,按用户选择的 action 执行,禁止文本伪造选择或自旋重试。退出码 `0` 只代表门禁通过,不代表挖掘完成。\n5. **闭环**:缺陷必须给出最小独立复现脚本(PoC)与完整调用栈证据;使用 6 大标准汇报用词(只读检查、项目就绪、门禁就绪、测试执行、挖掘启动、挖掘完成)如实汇报。\n\n### 3. 高频场景命令(覆盖 90% 日常调用)\n- **环境诊断**:`bugx doctor --root <ROOT> --json`(`--repair-assets` 按需修复)\n- **启动与门禁**:先运行 `bugx engine --root <ROOT> status --json`;仅当状态为 `UNINITIALIZED` 时运行 `bugx engine --root <ROOT> pre` 自动准备新项目。挖掘启动不要先调用 `bugx init`;它是独立 CLI 初始化操作,不替代 status/pre 状态机。若状态为 `FATAL_BLOCKED`、其他阻断状态或检查失败,保留现场并停止;禁止用 `init`、`reset` 或 `--force` 绕过门禁。\n- **单点复现与变异**:`bugx test-generate --root <ROOT> --scope <PATH::SYM> --out <FILE>` / `bugx test-verify verify --scope <SCOPE>`\n- **Supervisor 与并发排查**:`bugx supervisor status --root <ROOT>`\n- **脱敏飞轮与日志**:`bugx telemetry inspect` / `bugx log --root <ROOT> --errors`\n- **双轨报告与预览**:`bugx report both --eval-dir verification/evals/oss --out verification/evals/oss` / `bugx report serve --port 18991`\n\n### 4. 紧凑型命令全景雷达(
|
|
457
|
+
"host.entry.section.commands": "## 宿主路由(先于意图分流)\n\n- **ZCode 宿主**:优先加载同插件 `bugx-zcode` skill(ZCode 专属手册:直驱路径、rpc 回退、坑位对策)。若当前会话未注册该 skill(新装 skill 需重启宿主会话才可见),直接按其核心结论执行:`workers` 预占后**由宿主会话直驱协议通道**(worker MCP 工具或 `bugx supervisor rpc --role worker`,caller_role=worker),勿默认为 worker 派发子代理;`run_sandboxed_probe` 必须携带本次 Task 的 lease_id/execution_id。\n- 其余宿主按后续章节执行。\n\n\n\n## 如何使用本技能(AI 执行元指南与意图决策树)\n\n当你(AI)触发并阅读本技能时,请无条件遵循以下认知模型与执行时序:\n\n### 1. 意图决策树(Triage Decision Tree)\n拿到任务第一秒,判定属于哪个分支:\n- **分支 A:单点敏捷排查 / 特定函数 / Diff / 报错堆栈**\n - **标志**:单文件排查、复现某个函数、分析异常报错。\n - **动作**:就地编写轻量复现脚本(PoC)或运行定向测试,使用 `bugx view`, `bugx test-generate`, `bugx test-verify`;**严禁启动重型全流程门禁!**\n- **分支 B:全库漏洞挖掘 / 深度变异 / 多 Worker 并发审计**\n - **标志**:用户明确输入 `/bugx`、要求“全库审计”、“挖掘潜在漏洞”。\n - **动作**:按标准生命周期流转(`engine pre` -> 门禁确认 -> Explore -> Mutate -> Repair -> 结算)。\n- **分支 C:环境诊断 / 依赖修复 / 宿主状态排查**\n - **动作**:优先运行 `bugx doctor --root <ROOT> --json` 与 `bugx engine --root <ROOT> status --json`,绝不盲目 `init` 或 `--force`。\n\n### 2. 标准五步操作闭环(5-Step Execution Loop)\n1. **定根**:确定被测项目根绝对路径 `<ROOT>`,严格在 `<ROOT>` 内部执行,禁止全盘发散扫描。\n2. **探况**:先执行只读命令检查运行态(`bugx engine --root <ROOT> status --json` 或 `bugx doctor`)。\n3. **选路**:根据意图挑选命令;若需查阅参数,运行 `bugx help <顶层命令>`(如 `bugx help cloud`)按需动态读取,严禁盲猜。\n4. **承接**:若 `engine pre` 返回退出码 `2`,表示等待宿主单选门禁交互;必须调用宿主原生控件展示选项,按用户选择的 action 执行,禁止文本伪造选择或自旋重试。退出码 `0` 只代表门禁通过,不代表挖掘完成。\n5. **闭环**:缺陷必须给出最小独立复现脚本(PoC)与完整调用栈证据;使用 6 大标准汇报用词(只读检查、项目就绪、门禁就绪、测试执行、挖掘启动、挖掘完成)如实汇报。\n\n### 3. 高频场景命令(覆盖 90% 日常调用)\n- **手册即时检索**:`bugx guide \"<关键词>\"`(官方热点同步 + 本地项目文档检索;离线加 `--offline`)\n- **环境诊断**:`bugx doctor --root <ROOT> --json`(`--repair-assets` 按需修复)\n- **启动与门禁**:先运行 `bugx engine --root <ROOT> status --json`;仅当状态为 `UNINITIALIZED` 时运行 `bugx engine --root <ROOT> pre` 自动准备新项目。挖掘启动不要先调用 `bugx init`;它是独立 CLI 初始化操作,不替代 status/pre 状态机。若状态为 `FATAL_BLOCKED`、其他阻断状态或检查失败,保留现场并停止;禁止用 `init`、`reset` 或 `--force` 绕过门禁。\n- **单点复现与变异**:`bugx test-generate --root <ROOT> --scope <PATH::SYM> --out <FILE>` / `bugx test-verify verify --scope <SCOPE>`\n- **Supervisor 与并发排查**:`bugx supervisor status --root <ROOT>`\n- **脱敏飞轮与日志**:`bugx telemetry inspect` / `bugx log --root <ROOT> --errors`\n- **双轨报告与预览**:`bugx report both --eval-dir verification/evals/oss --out verification/evals/oss` / `bugx report serve --port 18991`\n\n### 4. 紧凑型命令全景雷达(43 个顶层命令分类索引)\n如需调用以下命令,通过 `bugx help <命令>` 动态获取具体参数与子命令,严禁盲猜:\n- **诊断与探索 (10)**:`help`, `completion`, `guide`, `hosts`, `doctor`, `log`, `stats`, `view`, `project`, `self-audit`\n- **核心生命周期与宿主 (15)**:`init`, `install`, `reset`, `uninstall`, `dsh`, `engine`, `supervisor`, `daemon`, `config`, `plugin`, `mcp`, `capability`, `mcp-runtime`, `update`, `interaction`\n- **深度审计与测试验证 (10)**:`audit`, `probe`, `logic-analysis`, `mining-audit`, `test-generate`, `test-audit`, `test-verify`, `patch-forge`, `autonomous`, `goal`\n- **云端、知识与交付 (8)**:`cloud`, `auth`, `telemetry`, `knowledge`, `lesson`, `skill`, `advisory`, `report`\n\n### 5. 核心军规与废弃命令重定向\n- **阻断不授权暴力修复**:`FATAL_BLOCKED` 严禁使用 `init`、`reset`、`--force` 绕过,先保留报告和日志。\n- **废弃命令重定向**:`matrix` -> `bugx audit`;`console` -> `bugx report serve`;`watch` -> `bugx log --watch`;`test` 不是公共命令。开发验证请在仓库外生成最小临时验证脚本,或运行被测目标项目自带的测试,完成后删除过程文件。\n",
|
|
458
458
|
"host.entry.description.codex": "Codex 宿主专属 BugX 操作 Skill。用于在 Codex 中启动、恢复和排障 BugX 审计及读取本地模型与 Token 用量。保留完整 Agent 流程、原生用户门禁和证据校验;按项目规模分派真实原生 Worker。",
|
|
459
459
|
"prompt.plugin.chatgpt_shared_skill_write_failed": "共享全局 Skill 写入失败(不影响插件注册):{error}",
|
|
460
460
|
"exception.plugin.claude_usage_skill_missing": "Claude 宿主手册 Skill 缺失,无法完成安装:{path}\n该文件是 bugx/SKILL.md 要求的强制加载项,不属于可选增强件。\n修复:确认仓库内 ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md 已纳入版本控制(git add),并重新构建 wheel。"
|
|
@@ -364,7 +364,12 @@ def _install_pypi_environment(
|
|
|
364
364
|
python = executable
|
|
365
365
|
venv_dir = _venv_dir(staging, env_id)
|
|
366
366
|
_create_venv(venv_dir, python, python_spec)
|
|
367
|
-
|
|
367
|
+
bin_dir = _venv_bin_dir(staging, env_id)
|
|
368
|
+
pip = bin_dir / ("pip.exe" if os.name == "nt" else "pip")
|
|
369
|
+
if not pip.is_file() and os.name == "nt":
|
|
370
|
+
alt_pip = bin_dir / "pip"
|
|
371
|
+
if alt_pip.is_file():
|
|
372
|
+
pip = alt_pip
|
|
368
373
|
if not pip.is_file() or pip.is_symlink():
|
|
369
374
|
raise McpRuntimeError(f"venv 未提供普通文件形式的 pip,拒绝受限安装: {pip}")
|
|
370
375
|
command = [str(pip), "install", *PYPI_INSTALL_FLAGS, "-r", str(requirements)]
|
package/core/metadata.txt
CHANGED
package/core/planning/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BugX Planning & Slicing Engine (能力规划、领域路由、代码切片与仲裁流水线)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `0.1.
|
|
3
|
+
> **版本契约**: `0.1.4` | **所属分层**: `Layer 2: 分析、切片与探测引擎`
|
|
4
4
|
> **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md)
|
|
5
5
|
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
|
|
6
6
|
|
|
@@ -150,13 +150,13 @@ _STAGE_TIER_MAP: dict[str, dict[str, Any]] = {
|
|
|
150
150
|
},
|
|
151
151
|
"mutate": {
|
|
152
152
|
"tier": "tier_2_deep_reasoning",
|
|
153
|
-
"description": "深度推理模型 (Sonnet / DeepSeek-R1 / GPT-4o),适用于并发竞态、状态推演与差分验证",
|
|
153
|
+
"description": "深度推理模型 (Claude Sonnet 5.5 / Gemini 4 Carbon / DeepSeek-R1 / GPT-4o),适用于并发竞态、状态推演与差分验证",
|
|
154
154
|
"allowed_actions": ["fuzz", "perturb", "differential_test", "race_detect", "test_verify"],
|
|
155
155
|
"recommended_tools": ["bugx_test_verify", "bugx_test_mutate", "bugx_fuzz_input", "bugx_fuzz_concurrency", "bugx_fuzz_stateful"],
|
|
156
156
|
},
|
|
157
157
|
"repair": {
|
|
158
158
|
"tier": "tier_3_precise_code",
|
|
159
|
-
"description": "高精度工程代码模型 (Claude
|
|
159
|
+
"description": "高精度工程代码模型 (Claude Sonnet 5.5 / Opus 5.5 / Codex),适用于 TDD 最小修复与单测闭环",
|
|
160
160
|
"allowed_actions": ["minimize_repro", "tdd_fix", "directed_test", "post_settle", "test_verify"],
|
|
161
161
|
"recommended_tools": ["bugx_minimize_repro", "bugx_test_verify"],
|
|
162
162
|
},
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""探测 codebase-memory-mcp 安装、版本和当前仓库索引状态。
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
仍负责不漏文件、不漏配置资产的覆盖事实。审计必须在准备记录中保存本命令结果。
|
|
4
|
+
它是 BugX 的必装核心代码图谱引擎:缺失或版本不匹配时必须直接安装修复,
|
|
5
|
+
严禁静默降级或豁免放行;本地 symbol_index/project_graph 负责全量资产清单与交叉校验。
|
|
7
6
|
"""
|
|
8
7
|
|
|
9
8
|
from __future__ import annotations
|
|
@@ -25,12 +24,14 @@ import re
|
|
|
25
24
|
import signal
|
|
26
25
|
import shutil
|
|
27
26
|
import subprocess
|
|
27
|
+
import sys
|
|
28
|
+
import sysconfig
|
|
28
29
|
from pathlib import Path
|
|
29
30
|
|
|
30
31
|
if __package__:
|
|
31
|
-
from ..runtime.tool_install_targets import
|
|
32
|
+
from ..runtime.tool_install_targets import REQUIRED_TOOL_PACKAGE_SPECS
|
|
32
33
|
else:
|
|
33
|
-
from core.runtime.tool_install_targets import
|
|
34
|
+
from core.runtime.tool_install_targets import REQUIRED_TOOL_PACKAGE_SPECS
|
|
34
35
|
|
|
35
36
|
PROJECT_URL = "https://github.com/DeusData/codebase-memory-mcp"
|
|
36
37
|
RELEASE_URL = f"{PROJECT_URL}/releases"
|
|
@@ -79,7 +80,7 @@ def _probe_environment() -> dict[str, str]:
|
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
def _pinned_cli_version() -> str | None:
|
|
82
|
-
spec =
|
|
83
|
+
spec = REQUIRED_TOOL_PACKAGE_SPECS.get("codebase-memory", "").strip()
|
|
83
84
|
match = re.fullmatch(r"codebase-memory-mcp==(?P<version>\d+(?:\.\d+){1,3})", spec)
|
|
84
85
|
return match.group("version") if match else None
|
|
85
86
|
|
|
@@ -98,21 +99,34 @@ def _binary_candidates(
|
|
|
98
99
|
"""Return bounded, deduplicated candidates, preferring managed user bin dirs.
|
|
99
100
|
|
|
100
101
|
A caller-supplied binary is an explicit selection and remains authoritative.
|
|
101
|
-
Otherwise, inspect the configured uv/XDG executable directories before
|
|
102
|
+
Otherwise, inspect the configured BugX/uv/XDG executable directories before
|
|
102
103
|
arbitrary PATH entries so an unrelated workspace binary cannot shadow the
|
|
103
104
|
installed tool.
|
|
104
105
|
"""
|
|
105
106
|
if binary:
|
|
106
107
|
return [str(binary)], False
|
|
107
108
|
|
|
108
|
-
home = Path(environment.get("HOME") or str(Path.home()))
|
|
109
|
+
home = Path(environment.get("HOME") or environment.get("USERPROFILE") or str(Path.home()))
|
|
110
|
+
scripts_dir = "Scripts" if os.name == "nt" else "bin"
|
|
111
|
+
bugx_tool_bin = str(home / ".bugx" / "tools" / "codebase-memory" / scripts_dir)
|
|
112
|
+
bugx_bin = str(home / ".bugx" / "bin")
|
|
113
|
+
python_scripts = None
|
|
114
|
+
try:
|
|
115
|
+
python_scripts = sysconfig.get_path("scripts")
|
|
116
|
+
except (KeyError, TypeError, ValueError):
|
|
117
|
+
python_scripts = None
|
|
118
|
+
|
|
109
119
|
directories: list[str] = []
|
|
110
120
|
for value in (
|
|
121
|
+
bugx_tool_bin,
|
|
122
|
+
bugx_bin,
|
|
111
123
|
environment.get("UV_TOOL_BIN_DIR"),
|
|
112
124
|
environment.get("XDG_BIN_HOME"),
|
|
113
125
|
str(Path(environment["XDG_DATA_HOME"]).parent / "bin")
|
|
114
126
|
if environment.get("XDG_DATA_HOME") else None,
|
|
115
127
|
str(home / ".local" / "bin"),
|
|
128
|
+
str(Path(sys.executable).parent),
|
|
129
|
+
python_scripts,
|
|
116
130
|
*environment.get("PATH", "").split(os.pathsep),
|
|
117
131
|
):
|
|
118
132
|
if not value:
|
|
@@ -141,7 +155,7 @@ def _binary_candidates(
|
|
|
141
155
|
|
|
142
156
|
def _resolve_binary(
|
|
143
157
|
environment: dict[str, str], expected_version: str, binary: str | None = None,
|
|
144
|
-
*, timeout_seconds: float =
|
|
158
|
+
*, timeout_seconds: float = 30.0,
|
|
145
159
|
) -> tuple[str | None, str | None, list[dict[str, str]], bool]:
|
|
146
160
|
"""Find an executable whose strict ``--version`` output matches the pin."""
|
|
147
161
|
candidates, truncated = _binary_candidates(environment, binary)
|
|
@@ -170,7 +184,7 @@ def resolve_compatible_binary(
|
|
|
170
184
|
*, environment: dict[str, str] | None = None,
|
|
171
185
|
expected_version: str | None = None,
|
|
172
186
|
binary: str | None = None,
|
|
173
|
-
timeout_seconds: float =
|
|
187
|
+
timeout_seconds: float = 30.0,
|
|
174
188
|
) -> str | None:
|
|
175
189
|
"""Return only a CLI that reports the repository's exact pinned version."""
|
|
176
190
|
environment = environment or _probe_environment()
|
|
@@ -321,7 +335,12 @@ def _unsupported_output_detail(stdout: str, stderr: str) -> str:
|
|
|
321
335
|
)
|
|
322
336
|
|
|
323
337
|
|
|
324
|
-
def inspect(
|
|
338
|
+
def inspect(
|
|
339
|
+
root: Path,
|
|
340
|
+
binary: str | None = None,
|
|
341
|
+
*,
|
|
342
|
+
check_project_index: bool = True,
|
|
343
|
+
) -> dict:
|
|
325
344
|
root = root.resolve()
|
|
326
345
|
environment = _probe_environment()
|
|
327
346
|
checks: list[dict] = []
|
|
@@ -387,6 +406,8 @@ def inspect(root: Path, binary: str | None = None) -> dict:
|
|
|
387
406
|
"expected": expected_version,
|
|
388
407
|
},
|
|
389
408
|
))
|
|
409
|
+
if not check_project_index:
|
|
410
|
+
return _report(root, checks, version_text, None)
|
|
390
411
|
projects_result, retry_note, transient = _list_projects_with_retry(executable, environment)
|
|
391
412
|
if projects_result is None:
|
|
392
413
|
checks.append({
|
|
@@ -528,14 +549,12 @@ def _report(root: Path, checks: list[dict], version: str | None,
|
|
|
528
549
|
ready = all(check["ok"] for check in checks)
|
|
529
550
|
return {
|
|
530
551
|
"status": "READY" if ready else "DEGRADED",
|
|
531
|
-
#
|
|
532
|
-
# this capability. required remains false because local enumeration is
|
|
533
|
-
# a valid fallback for small/offline projects.
|
|
552
|
+
# 必装核心能力:缺失或版本不匹配时必须阻断修复,禁止降级放行。
|
|
534
553
|
"required_check": True,
|
|
535
|
-
"required":
|
|
554
|
+
"required": True,
|
|
536
555
|
"recommended": True,
|
|
537
|
-
"hard_dependency":
|
|
538
|
-
"role": "semantic-graph-
|
|
556
|
+
"hard_dependency": True,
|
|
557
|
+
"role": "semantic-graph-core",
|
|
539
558
|
"required_for": [
|
|
540
559
|
"functional-minimization",
|
|
541
560
|
"business-flow-discovery",
|
|
@@ -552,8 +571,8 @@ def _report(root: Path, checks: list[dict], version: str | None,
|
|
|
552
571
|
),
|
|
553
572
|
"project": project.get("name") if project else None,
|
|
554
573
|
"checks": checks,
|
|
555
|
-
"fallback": "symbol_index.py + project_graph.py",
|
|
556
|
-
"install": f"pipx install --force {
|
|
574
|
+
"fallback": "symbol_index.py + project_graph.py(仅作辅助基线对照,不得替代必装组件)",
|
|
575
|
+
"install": f"pipx install --force {REQUIRED_TOOL_PACKAGE_SPECS['codebase-memory']}(或 bugx doctor --repair)",
|
|
557
576
|
"configure": "codebase-memory-mcp install,然后重启 AI 编程工具并索引项目",
|
|
558
577
|
"source": RELEASE_URL,
|
|
559
578
|
}
|
|
@@ -564,14 +583,13 @@ def print_report(report: dict, as_json: bool = False) -> None:
|
|
|
564
583
|
print(json.dumps(report, ensure_ascii=False, indent=2))
|
|
565
584
|
return
|
|
566
585
|
print(
|
|
567
|
-
f"[{report['status']}] codebase-memory-mcp
|
|
586
|
+
f"[{report['status']}] codebase-memory-mcp(必装核心代码图谱;缺失时阻断,不做降级放行)"
|
|
568
587
|
)
|
|
569
588
|
for check in report["checks"]:
|
|
570
589
|
print(f" {'✓' if check['ok'] else '!'} {check['name']}: {check['detail']}")
|
|
571
590
|
if report["status"] != "READY":
|
|
572
|
-
print(f" →
|
|
591
|
+
print(f" → 安装:{report['install']}")
|
|
573
592
|
print(f" → 配置:{report['configure']}")
|
|
574
|
-
print(f" → 本轮回退:{report['fallback']}")
|
|
575
593
|
|
|
576
594
|
|
|
577
595
|
def main(argv: list[str] | None = None) -> int:
|
|
@@ -580,8 +598,9 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
580
598
|
parser.add_argument("--root", type=Path, default=Path.cwd())
|
|
581
599
|
parser.add_argument("--json", action="store_true")
|
|
582
600
|
parser.add_argument("--strict", action="store_true")
|
|
601
|
+
parser.add_argument("--installation-only", action="store_true")
|
|
583
602
|
args = parser.parse_args(argv)
|
|
584
|
-
report = inspect(args.root)
|
|
603
|
+
report = inspect(args.root, check_project_index=not args.installation_only)
|
|
585
604
|
print_report(report, args.json)
|
|
586
605
|
return 1 if args.strict and report["status"] != "READY" else 0
|
|
587
606
|
|
|
@@ -635,7 +654,7 @@ def run_static_degraded(root: Path, *, binary: str | None = None) -> dict:
|
|
|
635
654
|
"findings": [],
|
|
636
655
|
"evidence": evidence,
|
|
637
656
|
"fallback": "symbol_index.py + project_graph.py(本地全量枚举,不依赖语义图谱)",
|
|
638
|
-
"install": f"pipx install --force {
|
|
657
|
+
"install": f"pipx install --force {REQUIRED_TOOL_PACKAGE_SPECS['codebase-memory']}",
|
|
639
658
|
"metadata": {
|
|
640
659
|
"degraded_mode": "local_coverage_facts_only",
|
|
641
660
|
"semantic_graph_available": False,
|
|
@@ -55,12 +55,17 @@ def normalized_tool_environment(environ: Mapping[str, str] | None = None) -> dic
|
|
|
55
55
|
"""Return a child environment that can see common user tool locations."""
|
|
56
56
|
environment = dict(os.environ if environ is None else environ)
|
|
57
57
|
entries = [item for item in environment.get("PATH", "").split(os.pathsep) if item]
|
|
58
|
-
|
|
58
|
+
scripts_dir = "Scripts" if os.name == "nt" else "bin"
|
|
59
|
+
candidates = [
|
|
60
|
+
environment.get("BUGX_TOOL_PATH", ""),
|
|
61
|
+
str(Path.home() / ".bugx" / "tools" / "codebase-memory" / scripts_dir),
|
|
62
|
+
str(Path.home() / ".bugx" / "bin"),
|
|
63
|
+
str(Path.home() / ".local" / "bin"),
|
|
64
|
+
]
|
|
59
65
|
if os.name != "nt":
|
|
60
66
|
candidates.extend((
|
|
61
67
|
"/opt/homebrew/bin", "/usr/local/bin",
|
|
62
68
|
"/home/linuxbrew/.linuxbrew/bin",
|
|
63
|
-
str(Path.home() / ".local" / "bin"),
|
|
64
69
|
str(Path.home() / ".cargo" / "bin"),
|
|
65
70
|
))
|
|
66
71
|
for candidate in candidates:
|
|
@@ -161,13 +166,11 @@ _BUILTIN_PROBES: tuple[ProbeDescriptor, ...] = (
|
|
|
161
166
|
script="codebase_memory_probe.py",
|
|
162
167
|
domain="knowledge",
|
|
163
168
|
accepts_root=True,
|
|
164
|
-
description="Codebase Memory MCP
|
|
169
|
+
description="Codebase Memory MCP 必装核心代码图谱探针",
|
|
165
170
|
priority=30,
|
|
166
171
|
lifecycle="preflight",
|
|
167
|
-
#
|
|
168
|
-
|
|
169
|
-
# 项目 ``tooling_exemptions`` 显式豁免;critical 能力不得豁免。
|
|
170
|
-
critical=False,
|
|
172
|
+
# 必装核心组件:缺失或未就绪必须安装修复并阻断,禁止经 tooling_exemptions 豁免降级。
|
|
173
|
+
critical=True,
|
|
171
174
|
),
|
|
172
175
|
ProbeDescriptor(
|
|
173
176
|
name="pattern",
|
|
@@ -23,6 +23,7 @@ In the first second of receiving a task, classify which branch it belongs to:
|
|
|
23
23
|
5. **Close the Loop**: Defects require standalone reproduction scripts (PoC) and call-stack evidence; report truthfully using the 6 standard status terms (read-only inspection, project ready, gate ready, test execution, mining launched, mining completed).
|
|
24
24
|
|
|
25
25
|
### 3. Core Action Matrix (High-Frequency Commands Covering 90% of Calls)
|
|
26
|
+
- **Live Guide Lookup**: `bugx guide "<keyword>"` (`--offline` queries bundled official baseline + project docs without network)
|
|
26
27
|
- **Environment Diagnosis**: `bugx doctor --root <ROOT> --json` (`--repair-assets` for repair)
|
|
27
28
|
- **Startup and Gates**: `bugx engine --root <ROOT> status --json` / `bugx engine --root <ROOT> pre` (fresh projects use `bugx init --root <ROOT>`)
|
|
28
29
|
- **Reproduction and Mutation**: `bugx test-generate --root <ROOT> --scope <PATH::SYM> --out <FILE>` / `bugx test-verify verify --scope <SCOPE>`
|
|
@@ -30,12 +31,12 @@ In the first second of receiving a task, classify which branch it belongs to:
|
|
|
30
31
|
- **Telemetry and Logs**: `bugx telemetry inspect` / `bugx log --root <ROOT> --errors`
|
|
31
32
|
- **Dual Reports and Preview**: `bugx report both --eval-dir verification/evals/oss --out verification/evals/oss` / `bugx report serve --port 18991`
|
|
32
33
|
|
|
33
|
-
### 4. Compact Command Radar (
|
|
34
|
+
### 4. Compact Command Radar (43 Top-level Commands Classified Index)
|
|
34
35
|
To invoke any command below, inspect exact parameters dynamically via `bugx help <cmd>`; never guess:
|
|
35
|
-
- **Diagnostics and Inspection (
|
|
36
|
-
- **Core Lifecycle and Hosts (
|
|
37
|
-
- **Deep Audit and Verification (10)**: `audit`, `probe`, `
|
|
38
|
-
- **Knowledge
|
|
36
|
+
- **Diagnostics and Inspection (10)**: `help`, `completion`, `guide`, `hosts`, `doctor`, `log`, `stats`, `view`, `project`, `self-audit`
|
|
37
|
+
- **Core Lifecycle and Hosts (15)**: `init`, `install`, `reset`, `uninstall`, `dsh`, `engine`, `supervisor`, `daemon`, `config`, `plugin`, `mcp`, `capability`, `mcp-runtime`, `update`, `interaction`
|
|
38
|
+
- **Deep Audit and Verification (10)**: `audit`, `probe`, `logic-analysis`, `mining-audit`, `test-generate`, `test-audit`, `test-verify`, `patch-forge`, `autonomous`, `goal`
|
|
39
|
+
- **Cloud, Knowledge, and Delivery (8)**: `cloud`, `auth`, `telemetry`, `knowledge`, `lesson`, `skill`, `advisory`, `report`
|
|
39
40
|
|
|
40
41
|
### 5. Mandatory Rules and Deprecated Command Redirection
|
|
41
42
|
- **Gate Blockage Forbids Destructive Repairs**: `FATAL_BLOCKED` must never be bypassed using `init`, `reset`, or `--force`; preserve logs and state first.
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
5. **闭环**:缺陷必须给出最小独立复现脚本(PoC)与完整调用栈证据;使用 6 大标准汇报用词(只读检查、项目就绪、门禁就绪、测试执行、挖掘启动、挖掘完成)如实汇报。
|
|
24
24
|
|
|
25
25
|
### 3. 高频场景命令(覆盖 90% 日常调用)
|
|
26
|
+
- **手册即时检索**:`bugx guide "<关键词>"`(支持 `--offline` 离线查官档与当前项目文档)
|
|
26
27
|
- **环境诊断**:`bugx doctor --root <ROOT> --json`(`--repair-assets` 按需修复)
|
|
27
28
|
- **启动与门禁**:`bugx engine --root <ROOT> status --json` / `bugx engine --root <ROOT> pre`(全新项目使用 `bugx init --root <ROOT>` 初始化)
|
|
28
29
|
- **单点复现与变异**:`bugx test-generate --root <ROOT> --scope <PATH::SYM> --out <FILE>` / `bugx test-verify verify --scope <SCOPE>`
|
|
@@ -30,12 +31,12 @@
|
|
|
30
31
|
- **脱敏飞轮与日志**:`bugx telemetry inspect` / `bugx log --root <ROOT> --errors`
|
|
31
32
|
- **双轨报告与预览**:`bugx report both --eval-dir verification/evals/oss --out verification/evals/oss` / `bugx report serve --port 18991`
|
|
32
33
|
|
|
33
|
-
### 4. 紧凑型命令全景雷达(
|
|
34
|
+
### 4. 紧凑型命令全景雷达(43 个顶层命令分类索引)
|
|
34
35
|
如需调用以下命令,通过 `bugx help <命令>` 动态获取具体参数与子命令,严禁盲猜:
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
36
|
+
- **诊断与探索 (10)**:`help`, `completion`, `guide`, `hosts`, `doctor`, `log`, `stats`, `view`, `project`, `self-audit`
|
|
37
|
+
- **核心生命周期与宿主 (15)**:`init`, `install`, `reset`, `uninstall`, `dsh`, `engine`, `supervisor`, `daemon`, `config`, `plugin`, `mcp`, `capability`, `mcp-runtime`, `update`, `interaction`
|
|
38
|
+
- **深度审计与测试验证 (10)**:`audit`, `probe`, `logic-analysis`, `mining-audit`, `test-generate`, `test-audit`, `test-verify`, `patch-forge`, `autonomous`, `goal`
|
|
39
|
+
- **云端、知识与交付 (8)**:`cloud`, `auth`, `telemetry`, `knowledge`, `lesson`, `skill`, `advisory`, `report`
|
|
39
40
|
|
|
40
41
|
### 5. 核心军规与废弃命令重定向
|
|
41
42
|
- **阻断不授权暴力修复**:`FATAL_BLOCKED` 严禁使用 `init`、`reset`、`--force` 绕过,先保留报告和日志。
|
|
@@ -64,6 +64,9 @@ def _run_round(*, level_ids: list[str] | None, baseline: Path | None,
|
|
|
64
64
|
try:
|
|
65
65
|
proc = subprocess.run(
|
|
66
66
|
argv, cwd=str(REPO_ROOT), capture_output=True, text=True,
|
|
67
|
+
# RSI 轮次是机器编排,不允许 scenario_eval 继承宿主 TTY 后
|
|
68
|
+
# 在任何未预期的交互门禁上无限等待。
|
|
69
|
+
stdin=subprocess.DEVNULL,
|
|
67
70
|
timeout=timeout, check=False,
|
|
68
71
|
)
|
|
69
72
|
except subprocess.TimeoutExpired:
|