bugx-cli 0.1.3 → 0.1.5
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/agent/agent_execution.py +7 -0
- 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 +311 -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 +838 -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 +25 -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 +422 -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/coverage/coverage_ai_review.py +15 -11
- package/core/coverage/coverage_bootstrap.py +18 -13
- package/core/coverage/coverage_discovery.py +1 -1
- package/core/dev_harness/interaction_preset.py +1 -1
- package/core/engine-integrity.json +283 -159
- package/core/host_acp/README.md +4 -0
- package/core/host_acp/agnescode.py +128 -0
- package/core/host_acp/antigravity.py +153 -0
- package/core/host_runtime/README.md +3 -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 +3 -1
- package/core/host_runtime/mcp_process_tracker.py +30 -3
- package/core/host_runtime/mcp_registry_gate.py +34 -11
- package/core/hosts/README.md +4 -0
- package/core/hosts/agnescode.py +415 -0
- 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/hosts/opencode.py +11 -3
- package/core/i18n.py +94 -5
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +2 -2
- package/core/infra/python_runtime.py +4 -1
- package/core/launch_phases/README.md +2 -2
- package/core/launch_phases/finding_confirm_phase.py +1 -1
- package/core/launch_phases/semantic_recon.py +3 -19
- 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/launch_phases/verify_loop.py +3 -19
- package/core/ledger/README.md +1 -1
- package/core/ledger/finding_confirmation.py +1 -1
- package/core/ledger/finding_verification.py +2 -20
- package/core/ledger/fp_ledger.py +3 -19
- package/core/ledger/life_ledger.py +7 -33
- package/core/ledger/schema.py +1 -1
- package/core/locales/en-US.json +3 -3
- package/core/locales/zh-CN.json +3 -3
- package/core/mcp_handlers/supervisor_handlers.py +1 -1
- package/core/mcp_runtime_support/common.py +6 -0
- package/core/mcp_runtime_support/environment.py +88 -24
- package/core/metadata.txt +1 -1
- package/core/planning/README.md +1 -1
- package/core/planning/prompt_harness.py +2 -2
- package/core/planning/target_sandbox_manager.py +2 -0
- package/core/probes/codebase_memory_probe.py +43 -24
- package/core/probes/mobile_probe.py +1 -0
- package/core/probes/probe_registry.py +10 -7
- package/core/probes/sast_probe.py +1 -1
- package/core/probes/sca_scanner.py +1 -1
- package/core/project_profiler/constants.py +1 -1
- 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/retrieval/symbol_index.py +227 -52
- package/core/runtime/README.md +1 -1
- package/core/runtime/daemon_runner.py +3 -2
- package/core/runtime/project_init.py +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/skills/bugx_mcp_server.py +9 -0
- package/core/skills/mcp_session_proof.py +3 -31
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/finding_commit.py +3 -24
- package/core/supervisor/task_scheduler.py +5 -2
- package/core/supervisor/worker_execution.py +16 -3
- package/core/supervisor/worker_handoff.py +2 -2
- 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 +4 -4
- package/ecosystem/integrations/opencode/mcp-lock.json +1 -1
- 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 +153 -8
- package/interfaces/cli/bugx_cli/commands/agent.py +376 -69
- package/interfaces/cli/bugx_cli/commands/audit.py +2 -1
- 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 +56 -26
- package/interfaces/cli/bugx_cli/commands/patch.py +5 -1
- package/interfaces/cli/bugx_cli/commands/plugin.py +306 -56
- 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 +46 -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# BugX 运行时契约(0.1.
|
|
1
|
+
# BugX 运行时契约(0.1.5)
|
|
2
2
|
|
|
3
3
|
这是部署到用户级全局引擎 `~/.bugx/core/` 的最小运行时契约。项目不再保存
|
|
4
4
|
`.bugx/core` 可执行入口;需要定位本文件时使用 `bugx engine path --name bugx-runtime-contract.md`。
|
|
@@ -45,11 +45,7 @@ runtime 的 `commit_status`、`commit_boundary`、`commit_ref`、`commit_error`
|
|
|
45
45
|
| 宿主控制角色 | `caller_role=host` |
|
|
46
46
|
| Worker 角色 | `caller_role=worker` |
|
|
47
47
|
|
|
48
|
-
`bugx-docs`
|
|
49
|
-
`README.md`、`docs/**/*.md` 和 `core/**/*.md` 到 `.bugx/knowledge/docs.sqlite3` 的 SQLite FTS5
|
|
50
|
-
数据库;工具调用必须带匹配的 `project_id`,设置 `BUGX_DOCS_TOKEN` 时还必须通过 token 校验。
|
|
51
|
-
返回结果必须带文档版本、来源、SHA-256、捕获时间和私有范围标记;scope/token/索引失败时拒绝返回
|
|
52
|
-
内容,不能伪造 Context7 citation。
|
|
48
|
+
`bugx-docs` 是独立的双作用域只读文档 MCP(默认本地 `stdio`,可选 `--docs-transport remote` 仅直连官方库),不属于 Supervisor 角色通道。它将 BugX 官方基线(`bugx:official`,优先挂载 `~/.bugx/cache/docs/<contract_version>/<sha256>.sqlite3` 不可变缓存,断网或只读时降级至随包 `core/bundled_docs/`)与当前项目私有文档(`project:<id>`,严格保留在 `<ROOT>/.bugx/knowledge/docs.sqlite3`,绝不上云)按 `document_sections` + `sections_fts(trigram)` 分域索引;暴露 `resolve_library`、`search_docs`、`list_sections`、`fetch_doc` 工具,调用默认联合检索 `all` 或指定作用域,设置 `BUGX_DOCS_TOKEN` 时校验访问令牌,并返回版本、来源、`heading_path`、`doc_tier` 与内容哈希;与结构化错题/经验台账(`lesson-ledger`)及语料库保持正交隔离,绝不混库或把文档正文当作可执行指令。
|
|
53
49
|
|
|
54
50
|
`status`、`gate` 是只读查询;`start`、`bootstrap_coverage`、`next_round`、
|
|
55
51
|
`bind_context`、`sync_finding_decisions`、`finish`、`fail`、`recover` 只允许宿主角色;`claim`、`worker_start`、
|
|
@@ -288,31 +284,25 @@ MCP 配置变化通常需要重启宿主会话。当前子进程没有 `BUGX_MCP
|
|
|
288
284
|
Cookie 或资产秘密。`asset_summary` 是调度层复用计数,不等价于漏洞检出率,收益需通过 A/B
|
|
289
285
|
测试确认。
|
|
290
286
|
|
|
291
|
-
##
|
|
287
|
+
## 代码库图与语法核心契约
|
|
292
288
|
|
|
293
|
-
`codebase-memory-mcp`
|
|
294
|
-
匹配时,启动器设置图增强标志,`codebase_memory_bridge.py` 将高可信跨文件调用关系交给
|
|
295
|
-
`project_graph.py`;每条关系必须映射到当前 `symbol_index.py` 已发现的文件和符号。低可信、
|
|
296
|
-
过期、部分解析、缺失或调用失败的关系不得进入业务链路,保留本地关系图并记录 DEGRADED。
|
|
297
|
-
源码、配置、依赖、构建、CI、插件和部署资产的全量清单始终由本地枚举负责;图谱只能增强
|
|
298
|
-
语义分组和跨模块链路,不能单独证明覆盖完成。
|
|
289
|
+
`codebase-memory-mcp==0.12.1`(`critical=True`)与 `tree-sitter-language-pack==1.14.3` 是 BugX 安装与诊断期的**全局核心必装能力**,不在可选项豁免或静默降级范围内。`bugx install` / `bugx doctor --repair` 直接将其装配到隔离环境(`~/.bugx/tools/codebase-memory` 与 `~/.bugx/tools/pydeps`)并做版本校验。READY 且索引代际匹配时,启动器设置图增强标志,`codebase_memory_bridge.py` 将高可信跨文件调用关系交给 `project_graph.py`;每条关系必须映射到当前 `symbol_index.py` 已发现的文件和符号。低可信、过期或部分解析关系不得混入业务链路。源码、配置、依赖、构建、CI、插件和部署资产的全量清单始终由本地枚举负责;图谱负责语义分组和跨模块链路,与本地基线互相印证。
|
|
299
290
|
|
|
300
291
|
### 启动降级通道的四分类(机器语义,禁止文案判定)
|
|
301
292
|
|
|
302
293
|
启动前探针的降级项由 `probe_registry` 产出**机器字段**,门禁只认字段、不解析任何人类文案;
|
|
303
294
|
四类语义绝不可混用:
|
|
304
295
|
|
|
305
|
-
1. `NOT_APPLICABLE` / `DEFERRED
|
|
296
|
+
1. `NOT_APPLICABLE` / `DEFERRED`(项目形态不适用或按需延迟):报告状态本身即结论,降级项被**剪枝为 0 项**。
|
|
306
297
|
例:纯 Python 工程的 `native`(无原生源文件)与 `desktop`(无桌面框架)探针返回
|
|
307
|
-
`NOT_APPLICABLE`,其 CLI 退出码为 `0`——"本项目没有该形态"不是"环境能力缺口"
|
|
298
|
+
`NOT_APPLICABLE`,其 CLI 退出码为 `0`——"本项目没有该形态"不是"环境能力缺口";可选项目 MCP/UI 工具(`playwright`、`postmcp`、`codindex` 等)在全局 `install`/非 `--strict` `doctor` 阶段延迟至进入项目审计后按需决策。
|
|
308
299
|
2. `advisory`(`required=False` 建议性探针):缺失/超时按注册表策略**不阻断**,但决策与收据
|
|
309
300
|
必须留痕(`status=not_applicable`、`receipt.source=probe_advisory`),不得静默消失。
|
|
310
301
|
3. `transient`(已安装但本次探测超时):由注册中心超时路径或探针 `check.transient` 置位。
|
|
311
|
-
`critical=False`
|
|
312
|
-
`critical=True`
|
|
313
|
-
4.
|
|
314
|
-
`tooling_exemptions`
|
|
315
|
-
`codebase-memory-mcp/cli`),`critical=True` 的能力**不得**豁免。豁免读取只要求该配置文件
|
|
302
|
+
仅 `critical=False` 的可选能力允许瞬态降级,
|
|
303
|
+
`critical=True` 的能力(如 `codebase-memory`、`tree-sitter`)仍然阻断——超时不能替关键能力背书。
|
|
304
|
+
4. 真实缺口:先穷尽自愈装配;仍失败时仅非关键可选能力可经项目 `.bugx/config.json` 的
|
|
305
|
+
`tooling_exemptions` 显式豁免(支持探针级前缀匹配),`critical=True` 的能力**不得**豁免(如 `codebase-memory` 不得绕过)。豁免读取只要求该配置文件
|
|
316
306
|
存在且可读,不要求完整 lifecycle 布局——阻断提示指向的通道必须真的可用。
|
|
317
307
|
|
|
318
308
|
启动恢复阶段对已经授权的 `share_pending` 执行幂等重放;该恢复动作位于当前 Session
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
"""AI 覆盖复核机制(DOC-AIREV
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"""AI 覆盖复核机制(DOC-AIREV):双轨目录排除架构——静态白名单打底 + AI 语义复核扫尾。
|
|
2
|
+
|
|
3
|
+
设计约束(双轨互补契约):
|
|
4
|
+
|
|
5
|
+
1. **Track 1(静态确定性白名单/基线)**:由引擎在文件系统遍历层自动硬排除公认的
|
|
6
|
+
依赖、生成物、工具链与运行态目录(如 ``.git``、``node_modules``、``dist``、
|
|
7
|
+
``build``、``.tools``、``artifacts`` 等),防止超大非源码目录在第一阶段拖死进程。
|
|
8
|
+
2. **Track 2(AI 语义全量扫尾复核)**:静态白名单绝非万能——针对白名单放行的
|
|
9
|
+
**所有剩余顶层目录**,引擎打包结构特征、文件摘录与 import 可达性证据
|
|
10
|
+
(``candidate_groups``),由宿主 AI 逐一过一遍并做出 ``product`` / ``exclude``
|
|
11
|
+
语义裁决,清洗自定义构建物、私有脚本库与非产品夹具。
|
|
12
|
+
3. **单向权威与持久化**:AI 裁决只能**移出**单元(``exclude``),不能添加;
|
|
13
|
+
裁决持久化到 ``.bugx/knowledge/coverage-review.json``,带裁决理由/时间/
|
|
14
|
+
裁决者/证据包摘要,可审计可回滚(重审覆盖即可推翻)。
|
|
15
|
+
4. **换项目零迁移**:候选组按当次发现结果动态生成,不携带任何项目名清单。
|
|
12
16
|
"""
|
|
13
17
|
|
|
14
18
|
from __future__ import annotations
|
|
@@ -492,7 +492,7 @@ def write_inventory_diff(manifest: Path, changes: dict) -> None:
|
|
|
492
492
|
|
|
493
493
|
def bootstrap(
|
|
494
494
|
root: Path, *, confirmed: bool = False, inherit_coverage: bool = True,
|
|
495
|
-
reconcile: bool = False,
|
|
495
|
+
reconcile: bool = False, symbols: bool = True,
|
|
496
496
|
) -> dict[str, object]:
|
|
497
497
|
"""Create the manifest after an explicit host/user confirmation.
|
|
498
498
|
|
|
@@ -616,7 +616,7 @@ def bootstrap(
|
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
try:
|
|
619
|
-
discovered = module_coverage.discovery_rows(root)
|
|
619
|
+
discovered = module_coverage.discovery_rows(root, symbols=symbols)
|
|
620
620
|
except (OSError, UnicodeError, ValueError, RuntimeError) as exc:
|
|
621
621
|
strict_detail = str(exc)
|
|
622
622
|
if not _is_partial_parse_failure(exc):
|
|
@@ -686,18 +686,23 @@ def bootstrap(
|
|
|
686
686
|
discovered,
|
|
687
687
|
historical_unit_verdicts(root, exclude_polling=current_polling),
|
|
688
688
|
)
|
|
689
|
-
discovery =
|
|
689
|
+
discovery = (
|
|
690
|
+
build_discovery_metadata(status="complete", mode="symbols")
|
|
691
|
+
if symbols
|
|
692
|
+
else build_discovery_metadata(status="complete", mode="files", confidence="medium")
|
|
693
|
+
)
|
|
690
694
|
write_manifest(manifest, discovered, discovery_metadata=discovery)
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
695
|
+
if symbols:
|
|
696
|
+
try:
|
|
697
|
+
rows, _ = module_coverage.parse_manifest(manifest)
|
|
698
|
+
if not any(r.phase == "业务" for r in rows):
|
|
699
|
+
business_lines = module_coverage.business_discovery_rows(root, rows)
|
|
700
|
+
if business_lines:
|
|
701
|
+
with open(manifest, "a", encoding="utf-8") as f:
|
|
702
|
+
for bl in business_lines:
|
|
703
|
+
f.write(bl + "\n")
|
|
704
|
+
except Exception:
|
|
705
|
+
pass
|
|
701
706
|
rows, _ = module_coverage.parse_manifest(manifest)
|
|
702
707
|
return {
|
|
703
708
|
"ready": True,
|
|
@@ -929,7 +929,7 @@ def discovery_row(number: str, unit: dict, *, reset: bool = True,
|
|
|
929
929
|
note += f" platform:{unit_platform_name}"
|
|
930
930
|
difficulty = "3"
|
|
931
931
|
calc_risk: float | None = None
|
|
932
|
-
if root is not None:
|
|
932
|
+
if root is not None and unit.get("parser") != "files-only":
|
|
933
933
|
try:
|
|
934
934
|
operation_cache = risk_cache if risk_cache is not None else {}
|
|
935
935
|
calc_risk = cached_unit_risk_score(file_path, root, digest, operation_cache)
|
|
@@ -58,7 +58,7 @@ def _read_preset_raw_payload(root: Path | None = None) -> dict[str, Any]:
|
|
|
58
58
|
|
|
59
59
|
try:
|
|
60
60
|
st = preset_file.stat()
|
|
61
|
-
if bool(st.st_mode & 0o002): # world-writable 防御
|
|
61
|
+
if os.name == "posix" and bool(st.st_mode & 0o002): # world-writable 防御
|
|
62
62
|
return {}
|
|
63
63
|
|
|
64
64
|
payload = json.loads(preset_file.read_text(encoding="utf-8"))
|