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
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
# 环境变量参考(Environment Variables)
|
|
2
|
+
|
|
3
|
+
> **生成方式**:从 `core/` + `interfaces/` 代码真值自动提取(扫描 `os.environ` 消费点与写入点),
|
|
4
|
+
> 覆盖 **144 个**直接消费的 `BUGX_*` 变量(另 56 个为 f-string 动态构造形态,以各消费点代码为准)。
|
|
5
|
+
> **最后对账**:2026-11-25。新增变量必须同一次提交内同步本表。
|
|
6
|
+
|
|
7
|
+
## 三级配置权限(先读这里)
|
|
8
|
+
|
|
9
|
+
| 级别 | 含义 | 谁该设置 | 数量 |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| **USER 用户可配** | 值格式与影响见下表;设置错误最多功能不生效,不会破坏状态 | 用户/宿主 AI 按需 | 116 |
|
|
12
|
+
| **AUTO 系统自动** | 引擎在生命周期内自动写入的状态管道——**手动设置会被下次运行覆盖,或干扰进行中的会话** | 引擎自动 | 20 |
|
|
13
|
+
| **INTERNAL 禁止修改** | 测试注入/内部管道专用——手动设置可能破坏哈希链校验或隔离边界 | 仅测试框架 | 8 |
|
|
14
|
+
|
|
15
|
+
**排障提示**:环境变量问题优先 `bugx doctor` 定位;清除自设变量用 `unset BUGX_X`(临时)
|
|
16
|
+
或删 shell profile 条目(永久)。**AUTO/INTERNAL 变量出现在你的 shell profile 里就是错误信号。**
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
## 0. 设置方式、清理和作用域
|
|
20
|
+
|
|
21
|
+
本页的“普通用户稳定设置”才是建议手动配置的公共入口;后面的源码消费清单只是审计和排障索引,不是让用户把所有 `BUGX_*` 变量都导出。`AUTO` 和 `INTERNAL` 变量只由 Host、引擎或测试框架注入;手动写入可能破坏 session、身份、哈希链或隔离边界。源码没有定义一条适用于所有变量的统一优先级:能用显式 CLI 参数时,优先使用 `--root`、`--scope`、`--privacy`、`--cloud-sync` 等参数,再按具体消费点判断环境变量与用户级配置的关系。
|
|
22
|
+
|
|
23
|
+
### 0.1 POSIX shell 和 PowerShell
|
|
24
|
+
|
|
25
|
+
POSIX shell(bash/zsh)可以只对一次命令设置变量:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
BUGX_PROJECT_ROOT=/path/to/project BUGX_LOG_LEVEL=INFO \
|
|
29
|
+
bugx engine --root /path/to/project status --json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
需要在当前 shell 的后续命令中复用时:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
export BUGX_PROJECT_ROOT=/path/to/project
|
|
36
|
+
export BUGX_LOG_LEVEL=INFO
|
|
37
|
+
bugx hosts --root "$BUGX_PROJECT_ROOT" --json
|
|
38
|
+
unset BUGX_PROJECT_ROOT BUGX_LOG_LEVEL
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
PowerShell 的对应写法是:
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
$env:BUGX_PROJECT_ROOT = (Get-Location).Path
|
|
45
|
+
$env:BUGX_LOG_LEVEL = "INFO"
|
|
46
|
+
bugx hosts --root $env:BUGX_PROJECT_ROOT --json
|
|
47
|
+
Remove-Item Env:BUGX_PROJECT_ROOT,Env:BUGX_LOG_LEVEL
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
非交互初始化必须由命令显式选择同步范围;环境变量不会替代这个门禁:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
BUGX_NON_INTERACTIVE=1 bugx init --root /path/to/project --cloud-sync local
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
BugX 不把仓库中的 `.env` 文件作为统一配置契约。不要把 token、API key、refresh token 或密码写进仓库、项目 `.bugx/`、命令历史或文档;秘密应通过受控的进程环境或 `auth` 凭据流程提供,使用后清理 shell 环境。
|
|
57
|
+
|
|
58
|
+
### 0.2 最容易混淆的 scope
|
|
59
|
+
|
|
60
|
+
| 变量 | 默认/示例 | 真实作用域和设置注意 |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| `BUGX_PROJECT_ROOT` | 当前目录;示例 `/path/to/project` | 项目范围;必须是已存在目录。没有显式 `--root` 时作为项目根候选;无效路径 fail-closed。它不改变全局 engine、knowledge 或 cloud 账号。 |
|
|
63
|
+
| `BUGX_HOME` | `~/.bugx` | 用户范围;云配置和部分安装/资产回落路径会使用它,**不是**所有 `BUGX_GLOBAL_*` 的统一前缀。 |
|
|
64
|
+
| `BUGX_GLOBAL_ENGINE_ROOT` / `BUGX_GLOBAL_KNOWLEDGE_ROOT` | `~/.bugx/core` / `~/.bugx/knowledge` | 用户全局范围;影响所有项目,不应指向被测项目或提交到仓库。显式 `BUGX_GLOBAL_ENGINE_ROOT` 优先于 `BUGX_DEV_MODE`。 |
|
|
65
|
+
| `BUGX_CLOUD_CONFIG` / `BUGX_CLOUD_CREDENTIALS` / `BUGX_CLOUD_DEVICE_ID` | `~/.bugx/` 下的受控文件 | 用户级云状态、凭据文件和设备身份文件的路径覆盖;`BUGX_CLOUD_CREDENTIALS` 是**文件路径**,不是 token 值。它们不是项目 scope。 |
|
|
66
|
+
| `BUGX_CLOUD_API_BASE` | 经授权的 HTTPS URL | 远端范围;改变网络目的地,可能影响 auth、sync、upload 和 report。它不是 project scope,设置后必须核对授权和 TLS。 |
|
|
67
|
+
| `BUGX_TELEMETRY_ENABLED` | `1/true/yes/on` 或 `0/false/no/off` | 当前进程的遥测总闸门;默认未设置,读取 `telemetry.data_sharing`,两者都未配置时默认开启。`0` 同时阻止本地全局遥测写入、飞轮入队、flush/upload 和安装/心跳上报;非法值按关闭处理。持久化 `telemetry.data_sharing=false` 是硬撤销,不能用 `1` 打开;它不改变 knowledge scope。 |
|
|
68
|
+
| `BUGX_ACCEPT_DATA_SHARING=1` | 未设置 | 预同意入口,仅对「未表态」(配置无 `telemetry.data_sharing`)生效;用户显式撤销(`false`)时无论是否设置该变量,遥测 egress 一律拒绝。没有用户明确授权时不要设置;它不替代 `--cloud-sync` 或 `cloud sync --scope`。 |
|
|
69
|
+
| `BUGX_REPORT_REDACTION=standard` | 源码默认 `off` | 远程报告分享的脱敏模式;`standard` 仍不是上传授权,也不能保证业务内容全部可公开。 |
|
|
70
|
+
| `BUGX_CA_BUNDLE` / `BUGX_ENV` | CA 文件 / `prod`、`dev`、`local`、`test` | 网络 TLS 范围;优先使用 `BUGX_CA_BUNDLE` 保留证书校验。未知 `BUGX_ENV` 按严格模式处理;不要用 `BUGX_DEV_TLS_NO_VERIFY=1` 修复生产证书问题。 |
|
|
71
|
+
| `BUGX_PYTHON` / `BUGX_NODE_BIN` / `BUGX_NPM_BIN` | 受支持的可执行文件路径 | 运行时或 MCP runtime 工具选择;不改变项目/云端 scope。 |
|
|
72
|
+
|
|
73
|
+
`BUGX_GLOBAL_*` 改动会跨项目生效;`BUGX_CLOUD_*` 可能改变用户级文件或远端目的地;`BUGX_PROJECT_ROOT` 只绑定项目。不要因为同名都以 `BUGX_` 开头就把三者混用。
|
|
74
|
+
|
|
75
|
+
### 0.3 不能手写来伪造状态
|
|
76
|
+
|
|
77
|
+
- `BUGX_INTERACTION_REQUEST` 是引擎输出给宿主的结构化交互请求,不是用户答案;真实选择通过 `interaction` 命令或宿主控件回传。
|
|
78
|
+
- `BUGX_NATIVE_AGENT_ID`、`BUGX_MCP_SESSION_PROOF`、`BUGX_PROCESS_PID`、`BUGX_HOST_PID`、`BUGX_CLI_VERSION`、`BUGX_BUILD_ID` 等是身份、session、进程或版本证据;不能用固定字符串冒充 Worker/Host。
|
|
79
|
+
- `BUGX_HOST` **不是宿主选择器**。当前宿主识别以主动探查和配置事实为准;该变量最多作为缺少 runtime host 时的报告 fallback,设置成 `opencode` 等不能替代真实宿主。
|
|
80
|
+
- `BUGX_TEST_*`、`BUGX_SANDBOX_TEST`、`BUGX_TEST_CONTEXT`、`BUGX_TEST_ALLOW_ENGINE_REPO_GIT_WRITE` 是测试/探针写保护上下文,不是生产配置;不要用它们绕过门禁。
|
|
81
|
+
|
|
82
|
+
### 0.4 Dev 模式:设置时机、最小参数和恢复
|
|
83
|
+
|
|
84
|
+
Dev 模式要先区分“源码 engine 来源”和“生命周期快捷策略”:
|
|
85
|
+
|
|
86
|
+
| 配置 | 必须值 | 生效条件 | 作用域 | 是否会改变生命周期策略 |
|
|
87
|
+
|---|---|---|---|---|
|
|
88
|
+
| `BUGX_DEV_MODE` | `1` | 当前进程必须能识别真实 BugX checkout;根目录有 `.git`、`scripts/bump_version.py`,且 `core/bugx.md`、`core/launch_bugx.py` 存在 | 当前进程 | 否,只让 engine 解析到源码 `core/` |
|
|
89
|
+
| `BUGX_DEV_ASSET_ROOT` | `1` | 与上行相同 | 当前进程 | 否,是兼容别名 |
|
|
90
|
+
| `BUGX_GLOBAL_ENGINE_ROOT` | 完整 engine 目录 | 显式设置时优先级高于 Dev engine | 用户全局/当前进程 | 否,但会使 Dev engine 不生效 |
|
|
91
|
+
| `BUGX_ASSET_ROOT` | 完整、受信的资产目录 | 必须包含所需入口并通过安全路径校验 | 当前进程 | 否;不是 Dev mode 开关 |
|
|
92
|
+
| `engine ... pre --dev` | CLI flag | 只在用户明确接受自动化副作用时使用 | 当前 lifecycle | 是:自动审查、自动修复、自动轮询、按轮次提交、resume、启动动作 start、策略 approve |
|
|
93
|
+
|
|
94
|
+
源码开发但保留人工修复/提交策略时,先用一次性环境变量确认 engine,再运行普通 `pre`:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
env -u BUGX_GLOBAL_ENGINE_ROOT \
|
|
98
|
+
BUGX_DEV_MODE=1 \
|
|
99
|
+
bugx engine --root <PROJECT_ROOT> path --name launch_bugx.py
|
|
100
|
+
|
|
101
|
+
env -u BUGX_GLOBAL_ENGINE_ROOT \
|
|
102
|
+
BUGX_DEV_MODE=1 \
|
|
103
|
+
bugx engine --root <PROJECT_ROOT> pre \
|
|
104
|
+
--fix-mode log-only \
|
|
105
|
+
--commit-policy manual \
|
|
106
|
+
--cloud-sync local
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
PowerShell 中使用同样的顺序,并把当前进程的显式 engine override 暂时移除:
|
|
110
|
+
|
|
111
|
+
```powershell
|
|
112
|
+
$env:BUGX_DEV_MODE = "1"
|
|
113
|
+
Remove-Item Env:BUGX_GLOBAL_ENGINE_ROOT -ErrorAction SilentlyContinue
|
|
114
|
+
bugx engine --root <PROJECT_ROOT> path --name launch_bugx.py
|
|
115
|
+
bugx engine --root <PROJECT_ROOT> pre --fix-mode log-only --commit-policy manual --cloud-sync local
|
|
116
|
+
Remove-Item Env:BUGX_DEV_MODE -ErrorAction SilentlyContinue
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
纯源码 Dev engine 的第一条命令必须输出:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
<BUGX_SOURCE_CHECKOUT>/core/launch_bugx.py
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
输出仍来自 `~/.bugx/core`、wheel、npm 包或其他目录时,说明当前进程没有使用源码 engine;先检查 `command -v bugx`、checkout marker、`BUGX_GLOBAL_ENGINE_ROOT` 和 `BUGX_ASSET_ROOT`,不要继续执行 `pre`。
|
|
126
|
+
|
|
127
|
+
只有在隔离、可回滚且得到明确授权的项目中,才使用极速生命周期:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
env -u BUGX_GLOBAL_ENGINE_ROOT \
|
|
131
|
+
-u BUGX_ASSET_ROOT \
|
|
132
|
+
BUGX_DEV_MODE=1 \
|
|
133
|
+
bugx engine --root <PROJECT_ROOT> pre --dev --cloud-sync local
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`--dev` 的 `fix-mode` 当前默认为 `auto`,`commit-policy` 默认为 `round`;它不是只读模式,可能执行目标代码、写 `.bugx/`、修改目标文件和创建 Git commit。显式 `--cloud-sync` 或项目 profile 中已有 cloud policy 会覆盖 Dev 的 local 缺省;`sync` 是联网/数据分享出口,`local` 不会撤销用户级 consent。
|
|
137
|
+
|
|
138
|
+
退出时只清理本次配置,并恢复用户原有的 override:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
unset BUGX_DEV_MODE BUGX_DEV_ASSET_ROOT
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Dev 诊断的停止条件:engine path 不是当前 checkout、出现未知来源的 engine/asset 混用、`pre` 返回 2/3 或其他非零、目标代码发生未授权修改、状态为 `BLOCKED`/`RECOVERY_REQUIRED`,或没有新的外部证据却准备重复同一命令。详细症状路由见[用户故障排查](../guides/03_TROUBLESHOOTING.md) §2.5。
|
|
145
|
+
|
|
146
|
+
## 1. 普通用户稳定设置
|
|
147
|
+
|
|
148
|
+
普通用户通常只需要下面这些变量;其余变量先按源码消费清单或内部排障说明处理,不要因为变量名以 `BUGX_` 开头就导出:
|
|
149
|
+
|
|
150
|
+
| 变量 | 什么时候设置 | 值与默认 | 作用域/副作用 |
|
|
151
|
+
|---|---|---|---|
|
|
152
|
+
| `BUGX_PROJECT_ROOT` | 当前 cwd 不是目标项目,或宿主工作区路径不可靠 | 已存在目录;默认候选为 cwd | project;不改变全局 engine、knowledge 或 cloud 账号 |
|
|
153
|
+
| `BUGX_DEV_MODE` | 需要让真实源码 checkout 的 engine 立即生效 | `1`;默认未设置 | 当前进程;只改变 engine 来源,不开启自治 |
|
|
154
|
+
| `BUGX_DEV_ASSET_ROOT` | 旧脚本只能识别 Dev 兼容别名 | `1`;默认未设置 | 当前进程;与 `BUGX_DEV_MODE` 二选一 |
|
|
155
|
+
| `BUGX_GLOBAL_ENGINE_ROOT` | 需要隔离多份已安装 engine,且不使用源码 Dev engine | 完整 engine 目录 | user-global/current process;显式设置会覆盖 Dev engine |
|
|
156
|
+
| `BUGX_ASSET_ROOT` | 需要使用已确认完整且受信的资产目录 | 完整目录路径 | current process;不是 Dev mode,可能改变资产来源 |
|
|
157
|
+
| `BUGX_LOG_LEVEL` | 需要增加或减少本地日志粒度 | 由当前实现接受的级别;默认通常为 `INFO` | current process;改变日志量,不改变证据状态 |
|
|
158
|
+
| `BUGX_REPORT_REDACTION` | 远程报告需要标准脱敏 | `standard`;源码默认 `off` | report/network;不等于上传授权 |
|
|
159
|
+
| `BUGX_CA_BUNDLE` | 企业 CA 或受控 TLS 链需要显式指定 | CA 文件路径 | network;保留证书校验,不能用来绕过 TLS |
|
|
160
|
+
| `BUGX_ENV` | 当前部署明确要求 prod/dev/local/test 环境语义 | 按消费点接受的值;未知值走严格处理 | network/runtime;不应随意从生产改成 dev |
|
|
161
|
+
| `BUGX_PYTHON` | 需要指定受支持的 Python 解释器 | 可执行文件路径 | current process/runtime;不改变项目 scope |
|
|
162
|
+
| `BUGX_NODE_BIN` / `BUGX_NPM_BIN` | 使用 npm/MCP runtime 且默认 Node 不可用 | 可执行文件路径 | current process/runtime;不代表 Host 已 ready |
|
|
163
|
+
| `BUGX_NON_INTERACTIVE` | CI/headless 已明确准备好所有选择 | `1` | current process;不会替用户同意 cloud、修复或删除动作 |
|
|
164
|
+
| `BUGX_DISABLE_VERSION_CHECK` | air-gap 或用户不希望启动时提示更新 | `1`/`true`/`yes`;默认未设置 | current process;只关闭启动阶段的后台版本提示,不关闭显式 `bugx update --check` 或 `bugx update` |
|
|
165
|
+
| `BUGX_CLOUD_CONFIG` | 需要把云端配置放在受控用户目录,或做一次性隔离配置 | 文件路径;默认 `~/.bugx/cloud-config.json` | user-global;改变 consent、scope/detail/policy、Base URL 等云配置,可能改变所有项目的网络行为 |
|
|
166
|
+
| `BUGX_CLOUD_CREDENTIALS` / `BUGX_CLOUD_DEVICE_ID` | 需要隔离登录凭据或设备身份文件 | 文件路径;默认位于 `~/.bugx/` | user-global;只设置路径,不要把 token/ID 值直接写进变量说明、项目或日志 |
|
|
167
|
+
| `BUGX_CLOUD_API_BASE` | 需要使用已授权的自建/代理云端 | HTTPS URL;默认由云端配置/正式端点决定 | remote destination;改变 auth、cloud sync、bundle upload、log-report 等网络目的地,必须重新核对 TLS/权限 |
|
|
168
|
+
| `BUGX_CLOUD_ROUTE_CACHE` | 需要隔离或清理云端路由测速缓存 | 文件路径;默认 `~/.bugx/cloud-route-cache.json` | user-global;只影响路由缓存,不改变数据授权;`cloud config --refresh-route` 是更安全的清理入口 |
|
|
169
|
+
| `BUGX_TELEMETRY_ENDPOINT` | 需要把飞轮遥测发送到已授权端点 | HTTPS URL;未设置时跟随 cloud API 配置 | remote destination;只影响 telemetry,不等于 knowledge sync endpoint |
|
|
170
|
+
| `BUGX_TELEMETRY_PASSPHRASE` | 非交互导出加密遥测包 | 口令;默认未设置 | current process;可能出现在进程环境,优先交互输入,绝不写日志或提交到仓库 |
|
|
171
|
+
| `BUGX_FLYWHEEL_OUTBOX` / `BUGX_FLYWHEEL_AUDIT` | 需要把遥测队列/出网审计放入隔离目录 | 文件路径;默认 `~/.bugx/telemetry/flywheel_outbox.sqlite3` 与 `egress_audit.log` | user-global;改变本地遥测证据位置,不改变 consent 或网络目的地 |
|
|
172
|
+
| `BUGX_TELEMETRY_ENABLED` | 需要在 CI、air-gap 或单次命令中关闭遥测 | `0/1` 等布尔文本;默认未设置,未配置持久化开关时产品默认 `true` | current process;`0` 或非法值是 fail-closed 总闸门,关闭本地统计、飞轮和安装心跳;持久化 `false` 不能用 `1` 绕过;不删除已有 audit/outbox |
|
|
173
|
+
| `BUGX_PRIVACY_STRICT` | 当前进程需要严格限制飞轮字段 | `1` | current process/telemetry;进一步缩小遥测 payload,不代替用户授权,也不改变 knowledge `sensitive_policy` |
|
|
174
|
+
|
|
175
|
+
设置后应立即用对应命令验证实际解析结果;没有验证输出时,变量只能报告为“已设置”,不能报告为“已生效”。普通用户不应手动设置 `BUGX_NATIVE_AGENT_ID`、`BUGX_MCP_SESSION_PROOF`、`BUGX_HOST`、`BUGX_PROCESS_PID`、`BUGX_HOST_PID`、`BUGX_TEST_*` 或 AUTO/INTERNAL 变量。
|
|
176
|
+
|
|
177
|
+
### 1.1 版本检查与更新的环境边界
|
|
178
|
+
|
|
179
|
+
启动版本检查由 `core/launch_phases/startup_version_gate.py` 在后台执行,网络失败不会阻塞启动;`BUGX_DISABLE_VERSION_CHECK=1` 只跳过这条启动提示。显式更新仍使用当前安装来源:npm wrapper 由包装器注入 `BUGX_CLI_SOURCE=npm`,用户不要手动伪造这个变量来把 pip 安装冒充 npm 安装。
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
# 仅本次启动跳过版本提示;不会禁用显式检查/更新
|
|
183
|
+
BUGX_DISABLE_VERSION_CHECK=1 bugx engine --root /path/to/project status --json
|
|
184
|
+
|
|
185
|
+
# 显式检查仍会联网查询服务端;不需要依赖启动提示
|
|
186
|
+
bugx update --check --root /path/to/project
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
更新服务端返回的发布身份必须包含 `release_id`、`artifact_kind`、SHA-256 和合法版本。更新会写用户级收据目录 `~/.bugx/update/receipts/`,不把收据写入项目 `.bugx/`;收据只保存版本、阶段、状态和 `project_root_fingerprint`(项目根路径的本地 SHA-256 短指纹),不落盘完整绝对路径,也不应手动改写。成功状态为 `COMPLETE`;安装器后续阶段失败为 `RECOVERY_REQUIRED`,先看 receipt 和 `bugx doctor --installation-only` 再恢复。
|
|
190
|
+
|
|
191
|
+
### 1.2 云端变量的最小核对清单
|
|
192
|
+
|
|
193
|
+
遇到“会不会上传”的问题,不要只检查变量是否存在,按数据面核对:
|
|
194
|
+
|
|
195
|
+
| 数据面 | 触发命令 | 关键变量/配置 | 本地证据 | 结论边界 |
|
|
196
|
+
|---|---|---|---|---|
|
|
197
|
+
| Knowledge sync | `bugx cloud sync`、部分 `pre/onboard` | `BUGX_CLOUD_CONFIG`、`telemetry.data_sharing`、`cloud.sync_scope_default`、`cloud.sync_detail_mode`、`cloud.sensitive_policy` | `<ROOT>/.bugx/cloud-sync/state.sqlite3` 或全局 store、policy audit | 设置 cloud config 不等于已同步;启动 onboarding 可能扩大到 global+project |
|
|
198
|
+
| Project profile | `bugx project sync` | `BUGX_CLOUD_API_BASE`、credential/device path | `<ROOT>/.bugx/cloud-project.json` 与 `--json` 的 `status/project_id/synced` | 绑定文件不等于 profile 已被云端接收 |
|
|
199
|
+
| Telemetry | `bugx telemetry flush|upload` | `BUGX_FLYWHEEL_OUTBOX`、`BUGX_FLYWHEEL_AUDIT`、`BUGX_TELEMETRY_ENDPOINT`、`BUGX_PRIVACY_STRICT` | outbox、egress audit、`telemetry inspect --latest --json` | 与 knowledge schema 独立;发送成功项才从队列清除 |
|
|
200
|
+
| Diagnostic/feedback | `cloud log-report`、非 dry-run `cloud feedback` | `BUGX_CLOUD_API_BASE`、credential、`BUGX_CLOUD_CONFIG` | 命令输出的 bytes/lines 或 updated/missing、退出码 | 默认不上传;日志内容需人工审查 |
|
|
201
|
+
|
|
202
|
+
环境变量只改变解析、路径、策略或端点;它们不会凭空生成 consent、Host session、Worker receipt、远端 ACK 或完整生命周期。对于 `BUGX_CLOUD_API_BASE`、`BUGX_TELEMETRY_ENDPOINT`、`BUGX_CLOUD_CREDENTIALS` 等变量,必须把实际值视为敏感/受控配置,文档和诊断报告只记录“已设置、来源和脱敏 URL”。
|
|
203
|
+
|
|
204
|
+
## 2. 源码消费清单(USER 类别,不等于公共 API)
|
|
205
|
+
|
|
206
|
+
### 开发与引擎装配(5)
|
|
207
|
+
|
|
208
|
+
| 变量 | 值格式 | 设置后的影响 | 默认值 | 主消费点 |
|
|
209
|
+
|---|---|---|---|---|
|
|
210
|
+
| `BUGX_ASSET_ROOT` | 绝对路径 | 资产目录覆盖(配合 readonly view 加固使用) | `""` | `interfaces/cli/bugx_cli/commands/system.py (+3 处)` |
|
|
211
|
+
| `BUGX_BUILD_ID` | 正整数 | 覆盖 Build ID 读取(仅构建脚本内部用) | `无默认(None/空)` | `core/infra/build_info.py (+1 处)` |
|
|
212
|
+
| `BUGX_CLI_VERSION` | 语义版本 | 覆盖 CLI 版本识别(仅诊断用) | `必填` | `core/launch_phases/startup_version_gate.py (+1 处)` |
|
|
213
|
+
| `BUGX_DEV_ASSET_ROOT` | 1 | BUGX_DEV_MODE 兼容别名 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/system.py (+1 处)` |
|
|
214
|
+
| `BUGX_DEV_MODE` | 1 | 源码开发模式:引擎根随仓库 core/ 走,改源码即时生效免安装 | `无默认(None/空)` | `interfaces/cli/bugx_cli/infra/engine_installer.py` |
|
|
215
|
+
|
|
216
|
+
### 运行时行为(56)
|
|
217
|
+
|
|
218
|
+
| 变量 | 值格式 | 设置后的影响 | 默认值 | 主消费点 |
|
|
219
|
+
|---|---|---|---|---|
|
|
220
|
+
| `BUGX_CLI_SOURCE` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `interfaces/cli/bugx_cli/commands/lifecycle.py` | `""` | `interfaces/cli/bugx_cli/commands/lifecycle.py` |
|
|
221
|
+
| `BUGX_CODEBASE_MEMORY_TIMEOUT_SECONDS` | 正秒数 | codebase-memory 探针超时 | `无默认(None/空)` | `core/probes/codebase_memory_probe.py` |
|
|
222
|
+
| `BUGX_DISABLE_EXTERNAL_SAST` | 1 | 禁用外部 SAST 工具(semgrep/bandit 等),仅用内置探针 | `无默认(None/空)` | `core/probes/sast_probe.py` |
|
|
223
|
+
| `BUGX_DOCTOR_NO_LLM` | 1 | doctor 跳过 LLM 顾问 | `无默认(None/空)` | `interfaces/cli/bugx_cli/infra/ai_advisor.py` |
|
|
224
|
+
| `BUGX_ENV` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/infra/client_metadata.py` | `""` | `core/infra/client_metadata.py` |
|
|
225
|
+
| `BUGX_FORCE_INSTALL` | 1 | 跳过安装前置确认 | `无默认(None/空)` | `core/launch_phases/supervisor_bridge.py` |
|
|
226
|
+
| `BUGX_GLOBAL_CACHE_ROOT` | 绝对路径 | 覆盖全局缓存根目录 | `无默认(None/空)` | `core/bugx_paths.py` |
|
|
227
|
+
| `BUGX_GLOBAL_ENGINE_ROOT` | 绝对路径 | 覆盖全局引擎根目录(默认 ~/.bugx/core)。多环境隔离、沙箱测试必备 | `"" \| str(Path.home(` | `core/bugx_paths.py (+8 处)` |
|
|
228
|
+
| `BUGX_GLOBAL_SKILLS_DIR` | 绝对路径 | 覆盖全局 skills 目录 | `无默认(None/空)` | `core/bugx_paths.py` |
|
|
229
|
+
| `BUGX_HEADLESS` | 1 | 声明 headless 环境(无 TUI/无原生交互) | `""` | `core/cloud_sync/onboard_wizard.py (+2 处)` |
|
|
230
|
+
| `BUGX_HOME` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/cloud_sync/consent.py (+7 处)` | `"" \| str(Path.home(` | `core/cloud_sync/consent.py (+7 处)` |
|
|
231
|
+
| `BUGX_HOST` | 宿主名 | 宿主提示(进程树探查优先,无兜底权) | `无默认(None/空)` | `core/launch_phases/finding_settlement.py (+1 处)` |
|
|
232
|
+
| `BUGX_INTENT_NO_LLM` | 1 | 意图推断跳过 LLM(纯规则匹配) | `无默认(None/空)` | `interfaces/cli/bugx_cli/infra/ai_advisor.py` |
|
|
233
|
+
| `BUGX_LOCALE` | locale 代码(如 zh-CN/en-US) | 覆盖界面与报告语言 | `无默认(None/空)` | `core/planning/prompt_harness.py` |
|
|
234
|
+
| `BUGX_LOG_LEVEL` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/runtime/bugx_logging.py (+1 处)` | `"" \| "INFO"` | `core/runtime/bugx_logging.py (+1 处)` |
|
|
235
|
+
| `BUGX_LOG_VERBOSE` | 1 | 开启详细日志输出 | `无默认(None/空)` | `core/mcp_handlers/rpc_server.py` |
|
|
236
|
+
| `BUGX_MAX_AUTO_BUSINESS_UNITS` | 正整数 | 自动业务链路单元的数量上限 | `无默认(None/空)` | `core/coverage/coverage_discovery.py` |
|
|
237
|
+
| `BUGX_MAX_CONCURRENCY` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/supervisor/supervisor_models.py` | `无默认(None/空)` | `core/supervisor/supervisor_models.py` |
|
|
238
|
+
| `BUGX_MAX_CONCURRENCY_CEILING` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/supervisor/supervisor_models.py` | `无默认(None/空)` | `core/supervisor/supervisor_models.py` |
|
|
239
|
+
| `BUGX_MCP_RUNTIME_ROOT` | 绝对路径 | 覆盖 MCP runtime 目录 | `无默认(None/空)` | `core/runtime/project_init.py (+1 处)` |
|
|
240
|
+
| `BUGX_NATIVE_AGENT_ID` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/skills/bugx_mcp_server.py` | `无默认(None/空)` | `core/skills/bugx_mcp_server.py` |
|
|
241
|
+
| `BUGX_NODE_BIN` | 绝对路径 | 覆盖 node 可执行文件路径(npm wrapper 用) | `无默认(None/空)` | `core/mcp_runtime_support/verifier.py` |
|
|
242
|
+
| `BUGX_NONINTERACTIVE` | 1 | 强制非交互模式(全部 gate 走默认或回灌) | `""` | `core/cloud_sync/onboard_wizard.py` |
|
|
243
|
+
| `BUGX_NON_INTERACTIVE` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/cloud_sync/onboard_wizard.py (+2 处)` | `无默认(None/空)` | `core/cloud_sync/onboard_wizard.py (+2 处)` |
|
|
244
|
+
| `BUGX_NO_AUTO_HEAL` | 1 | 禁用自动自愈(.bugx 布局损坏时 fail-closed 而非重建) | `无默认(None/空)` | `interfaces/cli/bugx_cli/infra/ai_advisor.py` |
|
|
245
|
+
| `BUGX_NO_PROGRESS` | 1 | 禁用进度条输出(CI/日志采集环境) | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/agent.py` |
|
|
246
|
+
| `BUGX_NPM_BIN` | 绝对路径 | 覆盖 npm 可执行文件路径 | `无默认(None/空)` | `core/mcp_runtime_support/environment.py` |
|
|
247
|
+
| `BUGX_OFFLINE` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/cloud_sync/endpoint_router.py (+2 处)` | `无默认(None/空)` | `core/cloud_sync/endpoint_router.py (+2 处)` |
|
|
248
|
+
| `BUGX_PATCH_VERIFICATION_API_KEY` | API Key | 补丁验证 API 的凭据 | `""` | `interfaces/cli/bugx_cli/commands/patch.py` |
|
|
249
|
+
| `BUGX_PATCH_VERIFY_TIMEOUT` | 正秒数 | 补丁验证命令的超时上限 | `"30"` | `core/supervisor/worker_runtime.py` |
|
|
250
|
+
| `BUGX_POC_TIMEOUT` | 正秒数 | PoC 复现命令的超时上限 | `"10"` | `core/supervisor/worker_runtime.py` |
|
|
251
|
+
| `BUGX_PRIVACY_STRICT` | 1/true | 严格隐私模式(等价 --privacy strict) | `无默认(None/空)` | `core/cloud_sync/flywheel_client.py` |
|
|
252
|
+
| `BUGX_PROBE_TIMEOUT` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/cloud_sync/cloud_client.py (+1 处)` | `"0.8"` | `core/cloud_sync/cloud_client.py (+1 处)` |
|
|
253
|
+
| `BUGX_PROBE_TIMEOUT_CODEBASE_MEMORY` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/probes/codebase_memory_probe.py` | `无默认(None/空)` | `core/probes/codebase_memory_probe.py` |
|
|
254
|
+
| `BUGX_PROBE_TIMEOUT_SECONDS` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/probes/codebase_memory_probe.py (+1 处)` | `无默认(None/空)` | `core/probes/codebase_memory_probe.py (+1 处)` |
|
|
255
|
+
| `BUGX_PROFILE_NO_LLM` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/project_profiler/arbitrator.py (+2 处)` | `必填` | `core/project_profiler/arbitrator.py (+2 处)` |
|
|
256
|
+
| `BUGX_PROJECT_ROOT` | 绝对路径 | 钉住项目根目录,优先级高于 cwd 探查 | `""` | `core/bugx_paths.py (+11 处)` |
|
|
257
|
+
| `BUGX_PYTHON` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/infra/python_runtime.py` | `必填` | `core/infra/python_runtime.py` |
|
|
258
|
+
| `BUGX_PYTHON_RUNTIME_DIR` | 绝对路径 | 覆盖 Python 运行时目录 | `无默认(None/空)` | `core/infra/python_runtime.py` |
|
|
259
|
+
| `BUGX_RECON_REFRESH` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/launch_phases/pre_recon_scout.py` | `无默认(None/空)` | `core/launch_phases/pre_recon_scout.py` |
|
|
260
|
+
| `BUGX_RECON_TIMEOUT` | 正秒数 | 侦察阶段超时上限 | `无默认(None/空)` | `core/launch_phases/pre_recon_scout.py (+1 处)` |
|
|
261
|
+
| `BUGX_REPORT_REDACTION` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/report_engine/report_client.py` | `REDACTION_DEFAULT` | `core/report_engine/report_client.py` |
|
|
262
|
+
| `BUGX_RESET_BACKUP_ROOT` | 绝对路径 | 覆盖 reset 备份的存放根目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin.py` |
|
|
263
|
+
| `BUGX_SCOUT_MODEL` | provider/model | 侦察阶段模型覆盖 | `无默认(None/空)` | `core/hosts/opencode.py` |
|
|
264
|
+
| `BUGX_SELF_HEAL_SEARCH` | 1 | 允许自愈时的全局搜索定位 | `""` | `core/repair/self_heal.py` |
|
|
265
|
+
| `BUGX_SELF_HEAL_SEARCH_CMD` | 命令模板 | 自愈搜索使用的自定义命令 | `""` | `core/repair/self_heal.py` |
|
|
266
|
+
| `BUGX_SKIP_ROUTE_PROBE` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/cloud_sync/endpoint_router.py` | `无默认(None/空)` | `core/cloud_sync/endpoint_router.py` |
|
|
267
|
+
| `BUGX_SLOW_THRESHOLD_SECONDS` | 正秒数 | 慢命令判定阈值(超过记性能异味) | `无默认(None/空)` | `core/launch_phases/round_orchestrator.py (+1 处)` |
|
|
268
|
+
| `BUGX_SMOKE_MODEL` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/hosts/opencode.py` | `无默认(None/空)` | `core/hosts/opencode.py` |
|
|
269
|
+
| `BUGX_STRICT_BUDGET` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/launch_phases/startup_gates.py` | `""` | `core/launch_phases/startup_gates.py` |
|
|
270
|
+
| `BUGX_TARGET_PORT` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/runtime/daemon_runner.py` | `无默认(None/空)` | `core/runtime/daemon_runner.py` |
|
|
271
|
+
| `BUGX_TARGET_START_CMD` | 命令行 | 被测目标服务的启动命令(服务探活/恢复用) | `无默认(None/空)` | `core/runtime/daemon_runner.py` |
|
|
272
|
+
| `BUGX_TOOLING_CHOICES` | tool=action ... | 工具门禁处置回传 | `""` | `core/launch_phases/supervisor_degraded.py` |
|
|
273
|
+
| `BUGX_TRANSPORT` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/supervisor/supervisor_host.py` | `""` | `core/supervisor/supervisor_host.py` |
|
|
274
|
+
| `BUGX_UNINSTALL_BACKUP_ROOT` | 绝对路径 | 覆盖 uninstall 备份的存放根目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin.py` |
|
|
275
|
+
| `BUGX_USE_CODEBASE_MEMORY` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/launch_phases/supervisor_bridge.py (+3 处)` | `必填` | `core/launch_phases/supervisor_bridge.py (+3 处)` |
|
|
276
|
+
|
|
277
|
+
### 生命周期与并发(4)
|
|
278
|
+
|
|
279
|
+
| 变量 | 值格式 | 设置后的影响 | 默认值 | 主消费点 |
|
|
280
|
+
|---|---|---|---|---|
|
|
281
|
+
| `BUGX_DAEMON` | 1 | 守护进程模式标记(daemon 子进程内部传递) | `无默认(None/空)` | `core/launch_phases/post_round_lifecycle.py` |
|
|
282
|
+
| `BUGX_RELEASE_CHANNEL` | stable/alpha | 发布通道选择(影响 update 源) | `无默认(None/空)` | `core/infra/client_metadata.py` |
|
|
283
|
+
| `BUGX_WORKERS_MAX` | 正整数 | 覆盖 Worker 并发上限(默认按 CPU 与宿主能力) | `无默认(None/空)` | `core/supervisor/supervisor_models.py` |
|
|
284
|
+
| `BUGX_WORKER_TIMEOUT` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/supervisor/worker_runtime.py` | `无默认(None/空)` | `core/supervisor/worker_runtime.py` |
|
|
285
|
+
|
|
286
|
+
### 宿主适配(23)
|
|
287
|
+
|
|
288
|
+
| 变量 | 值格式 | 设置后的影响 | 默认值 | 主消费点 |
|
|
289
|
+
|---|---|---|---|---|
|
|
290
|
+
| `BUGX_CHATGPT_PLUGIN_ROOT` | 绝对路径 | 覆盖 ChatGPT 插件根目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin.py` |
|
|
291
|
+
| `BUGX_CLAUDE_DESKTOP_SESSIONS_DIR` | 绝对路径 | 覆盖 Claude Desktop 会话目录探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_claude.py` |
|
|
292
|
+
| `BUGX_CLAUDE_DESKTOP_SKILLS_DIR` | 绝对路径 | 覆盖 Claude Desktop skills 目录探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_claude.py` |
|
|
293
|
+
| `BUGX_CLAUDE_DESKTOP_SUPPORT_DIR` | 绝对路径 | 覆盖 Claude Desktop support 目录探测位置 | `""` | `interfaces/cli/bugx_cli/commands/plugin_claude.py` |
|
|
294
|
+
| `BUGX_CLAUDE_GLOBAL_DIST_DIR` | 绝对路径 | 覆盖 Claude 全局分发目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_claude.py` |
|
|
295
|
+
| `BUGX_CLAUDE_PLUGINS_DIR` | 绝对路径 | 覆盖 Claude 插件目录探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_claude.py` |
|
|
296
|
+
| `BUGX_CLAUDE_SETTINGS_PATH` | 绝对路径 | 覆盖 Claude settings.json 探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_claude.py` |
|
|
297
|
+
| `BUGX_CLAUDE_USER_AGENTS_DIR` | 绝对路径 | 覆盖 Claude Desktop/Code 用户级 agents 目录探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_claude.py` |
|
|
298
|
+
| `BUGX_CLAUDE_USER_SKILLS_DIR` | 绝对路径 | 覆盖 Claude 用户级 skills 目录探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_claude.py` |
|
|
299
|
+
| `BUGX_CLINE_USER_AGENTS_DIR` | 绝对路径 | 覆盖 Cline 用户级 agents 目录探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_cline.py` |
|
|
300
|
+
| `BUGX_CODEX_CONFIG` | 绝对路径 | 覆盖 Codex config.toml 探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin.py` |
|
|
301
|
+
| `BUGX_FUNIDE_DATA_DIR` | 绝对路径 | 覆盖 FunIDE 数据目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/host_adapters.py` |
|
|
302
|
+
| `BUGX_FUNIDE_PROFILE_DIR` | 绝对路径 | 覆盖 FunIDE profile 目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/host_adapters.py` |
|
|
303
|
+
| `BUGX_FUNIDE_SETTINGS_PATH` | 绝对路径 | 覆盖 FunIDE settings 路径 | `无默认(None/空)` | `interfaces/cli/bugx_cli/host_adapters.py` |
|
|
304
|
+
| `BUGX_FUNIDE_USER_AGENTS_DIR` | 绝对路径 | 覆盖 FunIDE 用户级 agents 目录探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/host_adapters.py` |
|
|
305
|
+
| `BUGX_OPENCODE_MODEL` | provider/model | OpenCode 子进程模型 | `""` | `core/hosts/opencode.py (+1 处)` |
|
|
306
|
+
| `BUGX_QODER_USER_AGENTS_DIR` | 绝对路径 | 覆盖 Qoder 用户级 agents 目录探测位置 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_qoder.py` |
|
|
307
|
+
| `BUGX_QODER_USER_MCP_PATH` | 绝对路径 | 覆盖 Qoder 用户级 MCP 配置路径 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_qoder.py` |
|
|
308
|
+
| `BUGX_QODER_USER_PLUGINS_DIR` | 绝对路径 | 覆盖 Qoder 插件目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_qoder.py` |
|
|
309
|
+
| `BUGX_QODER_USER_PLUGIN_CACHE_DIR` | 绝对路径 | 覆盖 Qoder 插件缓存目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_qoder.py` |
|
|
310
|
+
| `BUGX_QODER_USER_SETTINGS_PATH` | 绝对路径 | 覆盖 Qoder settings 路径 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_qoder.py` |
|
|
311
|
+
| `BUGX_QODER_USER_SKILLS_DIR` | 绝对路径 | 覆盖 Qoder skills 目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_qoder.py` |
|
|
312
|
+
| `BUGX_ZCODE_PLUGIN_ROOT` | 绝对路径 | 覆盖 ZCode 插件根目录 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/plugin_zcode.py` |
|
|
313
|
+
|
|
314
|
+
### 云端与数据共享(19)
|
|
315
|
+
|
|
316
|
+
| 变量 | 值格式 | 设置后的影响 | 默认值 | 主消费点 |
|
|
317
|
+
|---|---|---|---|---|
|
|
318
|
+
| `BUGX_ACCEPT_DATA_SHARING` | 1/true | 仅作为 init 的预同意入口;不会覆盖 `telemetry.data_sharing=false`,也不是当前进程遥测总闸门 | `无默认(None/空)` | `interfaces/cli/bugx_cli/commands/cloud.py` |
|
|
319
|
+
| `BUGX_TELEMETRY_ENABLED` | 1/true/yes/on 或 0/false/no/off | 当前进程遥测总闸门;关闭本地全局统计写入、飞轮入队/flush 和安装心跳;非法值按关闭处理;持久化 `false` 是硬撤销,不能用 `1` 绕过 | 未设置;持久化开关缺失时遥测默认开启 | `core/cloud_sync/consent.py`、`core/runtime/global_telemetry.py`、`core/cloud_sync/flywheel_client.py` |
|
|
320
|
+
| `BUGX_AIR_GAP` | 1 | 气隙模式:禁用所有外部网络访问 | `无默认(None/空)` | `core/launch_phases/common.py (+1 处)` |
|
|
321
|
+
| `BUGX_CLOUD_API` | URL | 云端 API 地址覆盖(自建/代理部署) | `"https://bugx.dev"` | `core/skills/skill_pack.py` |
|
|
322
|
+
| `BUGX_CLOUD_API_BASE` | URL | 云端 API 基址覆盖 | `""` | `core/cloud_sync/endpoint_router.py (+3 处)` |
|
|
323
|
+
| `BUGX_CLOUD_MAX_PULL_PAGES` | 正整数 | 云端 pull 的最大分页数 | `"1000"` | `core/cloud_sync/cloud_client.py` |
|
|
324
|
+
| `BUGX_CLOUD_PAGE_SIZE` | 正整数 | 云端分页大小 | `"100"` | `core/cloud_sync/cloud_client.py` |
|
|
325
|
+
| `BUGX_CLOUD_RETRIES` | 正整数 | 云端请求重试次数 | `"1"` | `core/cloud_sync/cloud_client.py` |
|
|
326
|
+
| `BUGX_CLOUD_ROUTE_TTL` | 正秒数 | 云端路由缓存 TTL | `"86400" \| str(DEFAULT_ROUTE_TTL` | `core/cloud_sync/cloud_client.py (+1 处)` |
|
|
327
|
+
| `BUGX_CLOUD_TIMEOUT` | 正秒数 | 云端请求超时 | `"8"` | `core/cloud_sync/cloud_client.py` |
|
|
328
|
+
| `BUGX_GLOBAL_TELEMETRY_PATH` | 绝对路径 | 覆盖全局遥测数据文件路径 | `无默认(None/空)` | `core/bugx_paths.py` |
|
|
329
|
+
| `BUGX_GLOBAL_TELEMETRY_ROOT` | 绝对路径 | 覆盖全局遥测数据根目录 | `无默认(None/空)` | `core/bugx_paths.py` |
|
|
330
|
+
| `BUGX_OTLP_ENDPOINT` | URL | OTLP 遥测上报端点(自建观测平台) | `无默认(None/空)` | `core/runtime/bugx_logging.py` |
|
|
331
|
+
| `BUGX_SHARE_API_BASE` | URL | 分享 API 地址覆盖 | `"https://bugx.dev"` | `core/report_engine/report_client.py` |
|
|
332
|
+
| `BUGX_SHARE_API_PATH` | 路径 | 分享 API 路径覆盖 | `"/api/v1/agent/runs"` | `core/report_engine/report_client.py` |
|
|
333
|
+
| `BUGX_SHARE_RETRIES` | 正整数 | 分享上传重试次数 | `"1"` | `core/report_engine/report_client.py` |
|
|
334
|
+
| `BUGX_SHARE_TIMEOUT` | 正秒数 | 分享上传超时 | `"8"` | `core/report_engine/report_client.py` |
|
|
335
|
+
| `BUGX_TELEMETRY_ENDPOINT` | URL | 遥测上报端点覆盖;必须是 HTTPS,HTTP 仅允许 localhost 回环 | `无默认(None/空)`;未设置时跟随 cloud API 配置/正式端点 | `core/cloud_sync/flywheel_client.py` |
|
|
336
|
+
| `BUGX_TELEMETRY_PASSPHRASE` | 口令 | 遥测载荷加密口令 | `无默认(None/空)` | `core/cloud_sync/flywheel_client.py (+1 处)` |
|
|
337
|
+
|
|
338
|
+
### 网络与安全(8)
|
|
339
|
+
|
|
340
|
+
| 变量 | 值格式 | 设置后的影响 | 默认值 | 主消费点 |
|
|
341
|
+
|---|---|---|---|---|
|
|
342
|
+
| `BUGX_CA_BUNDLE` | PEM 文件路径 | 自定义 CA 证书包(企业自签 TLS) | `""` | `core/cloud_sync/network_transport.py (+1 处)` |
|
|
343
|
+
| `BUGX_DISABLE_VERSION_CHECK` | 1 | 禁用云端版本检查 | `""` | `core/launch_phases/startup_version_gate.py (+2 处)` |
|
|
344
|
+
| `BUGX_DOCS_CACHE_DIR` | 目录路径 | 覆盖 `bugx-docs` 官方文档不可变缓存根目录 | `~/.bugx/cache/docs` | `core/skills/bugx_docs_cloud_sync.py` |
|
|
345
|
+
| `BUGX_DOCS_OFFLINE` | 1 / true / yes | 强制 `bugx-docs` 严格零出网离线模式 | `未设置(遵循 cloud.docs_remote_enabled)` | `core/skills/bugx_docs_cloud_sync.py` |
|
|
346
|
+
| `BUGX_DOCS_PROJECT` | 项目标识 | bugx-docs MCP 的项目标识 | `无默认(None/空)` | `core/skills/bugx_docs_mcp_server.py` |
|
|
347
|
+
| `BUGX_DOCS_REMOTE_URL` | HTTPS URL(本机测试允许 HTTP) | 覆盖 `bugx-docs` 云端官档同步与直查基地址 | `跟随 cloud.base_url` | `core/skills/bugx_docs_cloud_sync.py` |
|
|
348
|
+
| `BUGX_DOCS_TOKEN` | 令牌 | bugx-docs MCP 的访问令牌 | `无默认(None/空)` | `core/skills/bugx_docs_mcp_server.py` |
|
|
349
|
+
| `BUGX_DOCS_VERSION` | 版本号 | bugx-docs MCP 检索的文档版本 | `无默认(None/空)` | `core/skills/bugx_docs_mcp_server.py` |
|
|
350
|
+
|
|
351
|
+
### 测试与探针(2)
|
|
352
|
+
|
|
353
|
+
| 变量 | 值格式 | 设置后的影响 | 默认值 | 主消费点 |
|
|
354
|
+
|---|---|---|---|---|
|
|
355
|
+
| `BUGX_TEST_ALLOW_ENGINE_REPO_GIT_WRITE` | 字符串(按消费点校验) | 覆盖该功能默认行为;语义见 `core/launch_phases/post_commit.py` | `无默认(None/空)` | `core/launch_phases/post_commit.py` |
|
|
356
|
+
| `BUGX_TEST_CONTEXT` | 1 | 测试上下文标记:触发 git 写门护栏 | `无默认(None/空)` | `core/cloud_sync/flywheel_client.py (+1 处)` |
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
## 3. 系统自动设置(AUTO,勿手动设置)
|
|
360
|
+
|
|
361
|
+
### 运行时行为(13)
|
|
362
|
+
|
|
363
|
+
| 变量 | 引擎写入时机 | 注意 |
|
|
364
|
+
|---|---|---|
|
|
365
|
+
| `BUGX_CLIENT_MARKER` | `core/infra/client_metadata.py` | 手动设置会干扰进行中的会话状态 |
|
|
366
|
+
| `BUGX_COVERAGE_MANIFEST` | `interfaces/cli/bugx_cli/commands/autonomous.py` | 手动设置会干扰进行中的会话状态 |
|
|
367
|
+
| `BUGX_HOST_PID` | `core/launch_phases/session_runtime.py` | 手动设置会干扰进行中的会话状态 |
|
|
368
|
+
| `BUGX_HOST_SURFACE` | `core/supervisor/supervisor_host.py` | 手动设置会干扰进行中的会话状态 |
|
|
369
|
+
| `BUGX_INTERACTION` | `core/supervisor/supervisor_host.py` | 手动设置会干扰进行中的会话状态 |
|
|
370
|
+
| `BUGX_INTERACTION_ENVIRONMENT` | `core/launch_phases/startup_interaction.py` | 手动设置会干扰进行中的会话状态 |
|
|
371
|
+
| `BUGX_INTERACTION_VERIFIED` | `core/supervisor/supervisor_host.py` | 手动设置会干扰进行中的会话状态 |
|
|
372
|
+
| `BUGX_PROCESS_MODE` | `core/supervisor/supervisor_host.py` | 手动设置会干扰进行中的会话状态 |
|
|
373
|
+
| `BUGX_PROCESS_PID` | `core/launch_phases/session_runtime.py` | 手动设置会干扰进行中的会话状态 |
|
|
374
|
+
| `BUGX_RECON_SCOUT_ACTIVE` | `core/launch_phases/pre_recon_scout.py` | 手动设置会干扰进行中的会话状态 |
|
|
375
|
+
| `BUGX_SELF_CHECK` | `interfaces/cli/bugx_cli/commands/agent.py` | 手动设置会干扰进行中的会话状态 |
|
|
376
|
+
| `BUGX_TRACE_ID` | `core/runtime/model_runner.py` | 手动设置会干扰进行中的会话状态 |
|
|
377
|
+
| `BUGX_WEBUI_DRY_RUN_IDE` | `core/webui/ide_cloud_service.py` | 手动设置会干扰进行中的会话状态 |
|
|
378
|
+
|
|
379
|
+
### 生命周期与并发(1)
|
|
380
|
+
|
|
381
|
+
| 变量 | 引擎写入时机 | 注意 |
|
|
382
|
+
|---|---|---|
|
|
383
|
+
| `BUGX_ACP` | `core/supervisor/supervisor_host.py` | 手动设置会干扰进行中的会话状态 |
|
|
384
|
+
|
|
385
|
+
### 云端与数据共享(6)
|
|
386
|
+
|
|
387
|
+
| 变量 | 引擎写入时机 | 注意 |
|
|
388
|
+
|---|---|---|
|
|
389
|
+
| `BUGX_CLOUD_AUTOSYNC_WORKER` | `core/ledger/schema.py` | 手动设置会干扰进行中的会话状态 |
|
|
390
|
+
| `BUGX_CLOUD_CONFIG` | `core/cloud_sync/cloud_client.py (+4 处)` | 手动设置会干扰进行中的会话状态 |
|
|
391
|
+
| `BUGX_CLOUD_CREDENTIALS` | `core/cloud_sync/cloud_client.py (+2 处)` | 手动设置会干扰进行中的会话状态 |
|
|
392
|
+
| `BUGX_CLOUD_DEVICE_ID` | `core/cloud_sync/cloud_client.py (+1 处)` | 手动设置会干扰进行中的会话状态 |
|
|
393
|
+
| `BUGX_CLOUD_ROUTE_CACHE` | `core/cloud_sync/cloud_client.py (+2 处)` | 手动设置会干扰进行中的会话状态 |
|
|
394
|
+
| `BUGX_CLOUD_SYNC_ACTIVE` | `core/cloud_sync/cloud_onboard.py (+1 处)` | 手动设置会干扰进行中的会话状态 |
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
## 4. 禁止修改(INTERNAL)
|
|
398
|
+
|
|
399
|
+
### 运行时行为(6)
|
|
400
|
+
|
|
401
|
+
| 变量 | 引擎写入时机 | 注意 |
|
|
402
|
+
|---|---|---|
|
|
403
|
+
| `BUGX_FLYWHEEL_AUDIT` | `core/cloud_sync/flywheel_client.py` | 仅测试框架注入;手动设置可能破坏校验边界 |
|
|
404
|
+
| `BUGX_FLYWHEEL_OUTBOX` | `core/cloud_sync/flywheel_client.py` | 仅测试框架注入;手动设置可能破坏校验边界 |
|
|
405
|
+
| `BUGX_FREE_MODEL` | `core/host_runtime/free_models.py` | 仅测试框架注入;手动设置可能破坏校验边界 |
|
|
406
|
+
| `BUGX_GLOBAL_KNOWLEDGE_ROOT` | `core/bugx_paths.py (+3 处)` | 仅测试框架注入;手动设置可能破坏校验边界 |
|
|
407
|
+
| `BUGX_READONLY_CONCURRENCY` | `core/launch_phases/worker_orchestrator.py` | 仅测试框架注入;手动设置可能破坏校验边界 |
|
|
408
|
+
| `BUGX_TEXT_MENU` | `core/runtime/interactive_menu.py` | 仅测试框架注入;手动设置可能破坏校验边界 |
|
|
409
|
+
|
|
410
|
+
### 生命周期与并发(1)
|
|
411
|
+
|
|
412
|
+
| 变量 | 引擎写入时机 | 注意 |
|
|
413
|
+
|---|---|---|
|
|
414
|
+
| `BUGX_AUTO_PROVISION` | `core/launch_phases/supervisor_degraded.py` | 仅测试框架注入;手动设置可能破坏校验边界 |
|
|
415
|
+
|
|
416
|
+
### 测试与探针(1)
|
|
417
|
+
|
|
418
|
+
| 变量 | 引擎写入时机 | 注意 |
|
|
419
|
+
|---|---|---|
|
|
420
|
+
| `BUGX_TEST_TARGET_DIR` | `core/repair/test_generator.py` | 仅测试框架注入;手动设置可能破坏校验边界 |
|
|
421
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# 全域全景架构与权威目录拓扑 (System Architecture & Repository Topology)
|
|
2
|
+
|
|
3
|
+
> **文档编号**: `DOC-TOPOLOGY` | **基线版本**: `0.1.4` | **更新日期**: 2026-11-25
|
|
4
|
+
> **文档定位**: Diátaxis - Explanation (工程拓扑、架构正交性与目录层级权威白皮书)
|
|
5
|
+
> **关联规范**: ``docs/02_architecture/01_ARCHITECTURE.md`` (`docs/02_architecture/01_ARCHITECTURE.md`) (系统高层架构设计), ``docs/02_architecture/02_DESIGN_SPEC.md`` (`docs/02_architecture/02_DESIGN_SPEC.md`) (设计规约总账), ``AGENTS.md`` (`AGENTS.md`) (工程开发宪法)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🏛️ 一、 架构设计哲学:六大正交领域模型 (Hexagonal Domain Architecture)
|
|
10
|
+
|
|
11
|
+
针对历史迭代中产生的概念实体混淆、界面与生态割裂、评测靶场漫延等深层结构病灶,BugX 遵循现代六边形微内核架构(Hexagonal Microkernel Architecture)与清晰架构(Clean Architecture)的第一性原理,确立了**面向人类直觉自解释与机器严密正交的六大顶级领域**:
|
|
12
|
+
|
|
13
|
+
```mermaid
|
|
14
|
+
graph TD
|
|
15
|
+
subgraph PRESENTATION["1. interfaces/ · 交付与交互层"]
|
|
16
|
+
CLI["cli/bugx_cli/<br/>• 终端命令分发器<br/>• 43 个顶层命令实现<br/>• 诊断/门禁/状态机"]
|
|
17
|
+
BIN["bin/bugx.js<br/>• Node CLI 包装器<br/>• 运行环境自愈"]
|
|
18
|
+
WEB["web/<br/>• Security Workbench<br/>• 双轨报告可视化引擎<br/>• 前端静态与 HTTP 服务"]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
subgraph CORE_ENGINE["2. core/ · 纯粹攻防微内核"]
|
|
22
|
+
MICROKERNEL["微内核与状态机<br/>(audit_supervisor / launch_bugx)"]
|
|
23
|
+
AUDIT_PACKS["audit_packs/ (攻防规则包)<br/>• web-audit (Web 漏洞挖掘 DAG)<br/>• mobile-audit (移动安全)<br/>• desktop-audit (客户端安全)<br/>• native-audit (C/C++ 内存并发)<br/>• data-audit (数据流安全)"]
|
|
24
|
+
LEDGER["事实证据链与事件账本<br/>(finding_ledger / settling)"]
|
|
25
|
+
PROBES["多维代码分析探针<br/>(AST / Taint / Secret / Memory)"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
subgraph ECOSYSTEM_LAYER["3. ecosystem/ · 宿主生态中心"]
|
|
29
|
+
INTEGRATIONS["integrations/ (平台连接器)<br/>• dsh (DeepSeek Harness)<br/>• pi (Pi 扩展)<br/>• qoder (Qoder 连接器)<br/>• workbuddy (WorkBuddy 接入)<br/>• cline (Cline 宿主镜像)"]
|
|
30
|
+
PLUGINS["plugins/ (官方插件集)<br/>• bugx (codex / zcode / claude)"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
subgraph SKILLS_MARKET["4. skills/ · 标准智能体技能"]
|
|
34
|
+
DEV_SKILLS["developer/<br/>• dev-doc (方案设计与审计)<br/>• host-adapter (宿主开发)"]
|
|
35
|
+
PLATFORM_SKILLS["platform/bugx/<br/>• 真实人机可读 SKILL.md"]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
subgraph VERIFICATION_CENTER["5. verification/ · 质量与评测中心"]
|
|
39
|
+
EVALS["verification/evals/<br/>• 真实漏洞挖掘基准集<br/>• 多语言场景用例"]
|
|
40
|
+
SANDBOXES["sandboxes/<br/>• CVE 动态复现靶场<br/>• 隔离运行沙箱"]
|
|
41
|
+
BASELINES["baselines/<br/>• 架构防恶化基线与度量<br/>• 耗时画像快照"]
|
|
42
|
+
PATCHES["patches/<br/>• 历史防御加固补丁集"]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
subgraph SUPPORT_LAYER["6. 工程治理与支撑层"]
|
|
46
|
+
CONFIG["config/<br/>静态策略与引擎配置"]
|
|
47
|
+
DOCS["docs/<br/>架构规范、CHANGELOG 与发版说明"]
|
|
48
|
+
SCRIPTS["scripts/<br/>自动化构建、发版、门禁流水线"]
|
|
49
|
+
PROCESS["仓库外临时验证工作区<br/>• 只保留过程文件<br/>• 验证完成后物理删除"]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
PRESENTATION -->|CLI/RPC 驱动| CORE_ENGINE
|
|
53
|
+
PRESENTATION -->|管理与挂载| ECOSYSTEM_LAYER
|
|
54
|
+
SKILLS_MARKET -.->|指导开发者与 AI Agent 交互| PRESENTATION
|
|
55
|
+
VERIFICATION_CENTER -->|漏洞评测与回归守门| CORE_ENGINE
|
|
56
|
+
SUPPORT_LAYER -->|全生命周期约束与守护| CORE_ENGINE
|
|
57
|
+
PROCESS -.->|短期验证,不入仓| CORE_ENGINE
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 🌲 二、 权威全景目录层级树 (Directory Hierarchy)
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
bug-hunter/
|
|
66
|
+
├── 1. interfaces/ # ★【交付与交互层】所有人机与终端呈现交互逻辑 (详情见 interfaces/README.md)
|
|
67
|
+
│ ├── cli/ # - 统一命令行界面与命令分发树 (interfaces/cli/README.md)
|
|
68
|
+
│ ├── bin/ # - Node CLI 跨平台包装器 (interfaces/bin/README.md)
|
|
69
|
+
│ └── web/ # - 统一可视化控制台与报告系统 (interfaces/web/README.md)
|
|
70
|
+
│
|
|
71
|
+
├── 2. core/ # ★【纯粹攻防微内核】核心调度、状态机与攻防规则,零前端生态杂质 (core/README.md)
|
|
72
|
+
│ ├── launch_phases/ # - 审计生命周期流水线 (core/launch_phases/README.md)
|
|
73
|
+
│ ├── supervisor/ # - 并发协调与智能体调度中心 (core/supervisor/README.md)
|
|
74
|
+
│ ├── hosts/ # - 多宿主 AI 插件适配层 (core/hosts/README.md)
|
|
75
|
+
│ ├── host_runtime/ # - 宿主运行时与自主执行引擎 (core/host_runtime/README.md)
|
|
76
|
+
│ ├── host_acp/ # - ACP 宿主协议适配层 (core/host_acp/README.md)
|
|
77
|
+
│ ├── ledger/ # - 攻防复盘账本与错题经验库 (core/ledger/README.md)
|
|
78
|
+
│ ├── webui/ # - 内置攻防工作台与实时大屏服务 (core/webui/README.md)
|
|
79
|
+
│ ├── project_profiler/ # - 目标代码画像与技术栈自动探测 (core/project_profiler/README.md)
|
|
80
|
+
│ ├── mcp_handlers/ # - MCP RPC 服务端与工具分发 (core/mcp_handlers/README.md)
|
|
81
|
+
│ ├── report_engine/ # - 攻防成果与漏洞报告生成引擎 (core/report_engine/README.md)
|
|
82
|
+
│ ├── retrieval/ # - 代码切片、拓扑与混合检索增强 (core/retrieval/README.md)
|
|
83
|
+
│ ├── autonomous_cve/ # - 自主脆弱性发现与修复引擎 (core/autonomous_cve/README.md)
|
|
84
|
+
│ ├── seed_corpus/ # - 多语言攻防高危模式种子语料库 (core/seed_corpus/README.md)
|
|
85
|
+
│ ├── adapters/ # - 移动端与多平台原生交互配置 (core/adapters/README.md)
|
|
86
|
+
│ ├── assets/ # - 官方品牌视觉与图形资产 (core/assets/README.md)
|
|
87
|
+
│ ├── audit_packs/ # - 领域级攻防规则包 (core/audit_packs/README.md)
|
|
88
|
+
│ ├── dev_harness/ # - 开发与测试桩运行夹具 (core/dev_harness/README.md)
|
|
89
|
+
│ ├── locales/ # - 多语言国际化文案字典 (core/locales/README.md)
|
|
90
|
+
│ ├── mcp_runtime_support/ # - MCP 运行时支撑工具库 (core/mcp_runtime_support/README.md)
|
|
91
|
+
│ ├── probes/ # - 多形态目标运行时探针 (core/probes/README.md)
|
|
92
|
+
│ ├── prompts/ # - 提示词体系与对抗防御规则 (core/prompts/README.md)
|
|
93
|
+
│ ├── rules/ # - 静态安全分析与攻防规则集 (core/rules/README.md)
|
|
94
|
+
│ ├── schemas/ # - 核心数据契约与 JSON Schema (core/schemas/README.md)
|
|
95
|
+
│ ├── supervisor_types/ # - 协调层强类型定义与类型守护 (core/supervisor_types/README.md)
|
|
96
|
+
│ └── cloud_sync/ # - 云端飞轮协同与跨端知识同步 (core/cloud_sync/README.md)
|
|
97
|
+
│
|
|
98
|
+
├── 3. ecosystem/ # ★【宿主生态中心】一站式管理所有第三方 AI 平台接入 (ecosystem/README.md)
|
|
99
|
+
│ ├── integrations/ # - 宿主与平台连接工程 (ecosystem/integrations/README.md)
|
|
100
|
+
│ └── plugins/ # - 各宿主官方插件发布包 (ecosystem/plugins/README.md)
|
|
101
|
+
│
|
|
102
|
+
├── 4. skills/ # ★【标准 Agent 技能库】给人与 AI 助手阅读的标准 SKILL.md
|
|
103
|
+
│ ├── developer/ # - 面向开发者的工程技能(dev-doc, host-adapter, directory-governance 等)
|
|
104
|
+
│ └── platform/bugx/ # - BugX 平台通用自主审查技能
|
|
105
|
+
│
|
|
106
|
+
├── 5. verification/ # ★【质量与评测中心】统一管理基准评测、靶场与基线
|
|
107
|
+
│ ├── evals/ # - 真实漏洞挖掘评测套件与场景案例
|
|
108
|
+
│ ├── sandboxes/ # - CVE 复现动态沙箱与运行时靶场
|
|
109
|
+
│ ├── baselines/ # - 架构防恶化基线与耗时画像快照
|
|
110
|
+
│ └── patches/ # - 历史攻防验证补丁集
|
|
111
|
+
│
|
|
112
|
+
├── 6. 工程支撑层 (标准工程规范)
|
|
113
|
+
│ ├── config/ # ★【静态配置中心】系统策略、引擎完整性与注册表配置
|
|
114
|
+
│ ├── docs/ # ★【文档与自述中心】系统设计、CHANGELOG、多语言与发版自述
|
|
115
|
+
│ ├── scripts/ # ★【自动化流水线】构建、打包、发版与质量门禁脚本 (scripts/README.md)
|
|
116
|
+
│ └── (仓库外临时验证工作区) # ★【过程文件】验证完成后物理删除,不进入 Git
|
|
117
|
+
│
|
|
118
|
+
└── 7. 根目录法定受控非隐藏清单 (严格仅保留 7 项,杜绝任何杂乱碎屑)
|
|
119
|
+
├── pyproject.toml # - Python 项目与打包配置
|
|
120
|
+
├── package.json # - Node 项目与包装器配置 (已内联 files 白名单)
|
|
121
|
+
├── Jenkinsfile # - 自动化 CI/CD 流水线声明
|
|
122
|
+
├── MANIFEST.in # - Python 发版清单
|
|
123
|
+
├── AGENTS.md # - 全局智能体开发宪法与行为约束
|
|
124
|
+
├── LICENSE # - 开源许可证 (BSL-1.1)
|
|
125
|
+
└── README.md # - ★ 唯一且权威的项目主自述
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 🔍 三、 领域职责边界与接口规约
|
|
131
|
+
|
|
132
|
+
### 1. 交付与交互层 (`interfaces/`)
|
|
133
|
+
- **定位**:对外沟通的门户与壳层,负责命令行解析、跨语言环境适配与可视化报表呈现。
|
|
134
|
+
- **边界约束**:
|
|
135
|
+
- 严禁在 `interfaces/` 中实现底层的漏洞挖掘、符号解析或状态机推进算法;
|
|
136
|
+
- 统一通过 `interfaces/cli/bugx_cli/infra/security.py` 的动态解析器 `_find_repo_root()` 定位引擎资源。
|
|
137
|
+
|
|
138
|
+
### 2. 纯粹攻防微内核 (`core/`)
|
|
139
|
+
- **定位**:漏洞挖掘引擎的大脑与状态机中心。
|
|
140
|
+
- **正名规范**:将过去混淆命名为 `skills/` 的攻防知识库物理正名为 **`core/audit_packs/`**(包含 `web-audit`, `mobile-audit`, `desktop-audit`, `native-audit`, `data-audit` 5 大攻击规则集),从概念上彻底消除与外部 Agent Skill 的命名冲突。
|
|
141
|
+
- **边界约束**:彻底剥离任何 HTML/CSS/JS 静态资产或宿主私有代码。
|
|
142
|
+
|
|
143
|
+
### 3. 宿主生态中心 (`ecosystem/`)
|
|
144
|
+
- **定位**:一站式收敛第三方 AI 平台接入。
|
|
145
|
+
- **集成矩阵**:
|
|
146
|
+
- `ecosystem/integrations/`:宿主深度连接器(如 DSH 原生 UI、Pi 扩展、WorkBuddy 插件、Cline 镜像等);
|
|
147
|
+
- `ecosystem/plugins/`:遵循各宿主规范打包的插件发布物(Codex 插件、ZCode 插件、Claude Code 插件等);
|
|
148
|
+
- **边界约束**:严禁在仓库根目录下为单个宿主保留私货点目录(如 `.cline/`, `.dsh/`, `.zcode/` 已彻底清零)。
|
|
149
|
+
|
|
150
|
+
### 4. 标准智能体技能 (`skills/`)
|
|
151
|
+
- **定位**:供人类开发者与 AI 编程助手直接查阅和调用的标准 Prompt 与操作规范(带 YAML Frontmatter 的标准 `SKILL.md`)。
|
|
152
|
+
- **细分**:
|
|
153
|
+
- `skills/developer/`:面向项目开发者的工程规范 Skill(如 `dev-doc`, `host-adapter`);
|
|
154
|
+
- `skills/platform/bugx/`:BugX 平台对外统一呈现的核心自主审查技能。
|
|
155
|
+
|
|
156
|
+
### 5. 质量与评测中心 (`verification/`)
|
|
157
|
+
- **定位**:工程质量、模型能力与漏洞挖掘有效性的证伪防御体系。
|
|
158
|
+
- **资产构成**:
|
|
159
|
+
- `evals/`:真实攻防 Benchmark 评测集与典型 PoC 用例(物理路径为 `verification/evals/`);
|
|
160
|
+
- `sandboxes/`:CVE 漏洞复现沙箱靶场;
|
|
161
|
+
- `baselines/`:耗时画像与防恶化架构基线(`arch-baseline.json`);
|
|
162
|
+
- `patches/`:已验证的历史修复补丁。
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📋 四、 根目录物理纯洁性宪法
|
|
167
|
+
|
|
168
|
+
根目录下严格执行**法定白名单原则**,严禁任何未授权文件长期滞留:
|
|
169
|
+
|
|
170
|
+
1. **法定 7 项非隐藏文件**:
|
|
171
|
+
- 包管理与工程构建:`pyproject.toml`, `package.json`, `MANIFEST.in`, `Jenkinsfile`;
|
|
172
|
+
- 规范、法务与主自述:`AGENTS.md`, `LICENSE`, `README.md`。
|
|
173
|
+
2. **法定 3 项隐藏环境文件**:
|
|
174
|
+
- `.gitignore`(唯一 Git 忽略配置);
|
|
175
|
+
- `.nvmrc`(Node 24 运行时声明);
|
|
176
|
+
- `.python-version`(Python 3.14.6 运行时声明)。
|
|
177
|
+
3. **彻底绝迹的违规杂质**:
|
|
178
|
+
- 严禁任何本地测试产生的隐藏目录(`.pytest_cache`, `.ruff_cache`, `.idea`, `.bugx`)提交进版本库;
|
|
179
|
+
- 严禁任何多语言或发版专用 README 平铺在根目录(已全部归档至 `docs/` 与 `docs/07_distribution/`);
|
|
180
|
+
- 严禁任何临时测试碎片(如 `.bugx-project.json`, `chk_req.json`, `ev*.json`)。
|