bugx-cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/README.md +190 -186
  2. package/core/README.md +2 -2
  3. package/core/agent/README.md +2 -1
  4. package/core/agent/agent_artifacts.py +8 -6
  5. package/core/agent/agent_eval.py +136 -54
  6. package/core/agent/agent_execution.py +218 -52
  7. package/core/agent/agent_orchestrator.py +14 -8
  8. package/core/agent/agent_targets.py +8 -2
  9. package/core/agent/feature_baseline.py +150 -0
  10. package/core/assets/axe-core/LICENSE-3RD-PARTY.txt +66 -0
  11. package/core/assets/axe-core/LICENSE.txt +362 -0
  12. package/core/assets/axe-core/UPSTREAM.md +10 -0
  13. package/core/assets/axe-core/axe.min.js +12 -0
  14. package/core/assets/bugx-hero-en.svg +74 -0
  15. package/core/assets/bugx-hero-zh.svg +74 -0
  16. package/core/assets/codex.png +0 -0
  17. package/core/assets/dsh.png +0 -0
  18. package/core/assets/webui-chatgpt.jpg +0 -0
  19. package/core/assets/webui-session.jpg +0 -0
  20. package/core/assets/webui-skills.jpg +0 -0
  21. package/core/assets/webui-studio.jpg +0 -0
  22. package/core/assets/webui-zcode.jpg +0 -0
  23. package/core/assets/zcode.png +0 -0
  24. package/core/autonomous_cve/SPEC.md +1 -1
  25. package/core/autonomous_cve/attack_graph_store.py +152 -106
  26. package/core/autonomous_cve/behavior_graph.py +8 -2
  27. package/core/autonomous_cve/verifier.py +4 -1
  28. package/core/bugx.md +1 -1
  29. package/core/bugx_paths.py +43 -8
  30. package/core/cli-help.txt +66 -0
  31. package/core/cloud_sync/SPEC.md +1 -1
  32. package/core/cloud_sync/cloud_client.py +25 -6
  33. package/core/cloud_sync/cloud_onboard.py +42 -1
  34. package/core/cloud_sync/flywheel_client.py +16 -7
  35. package/core/cloud_sync/network_transport.py +24 -3
  36. package/core/cloud_sync/sensitive_filter.py +2 -2
  37. package/core/cloud_sync/sync_push.py +12 -10
  38. package/core/contracts/AGENT_GUIDE.md +6 -9
  39. package/core/contracts/README.md +2 -2
  40. package/core/contracts/bugx-runtime-contract.md +1 -1
  41. package/core/contracts/bugx-worker.md +1 -1
  42. package/core/contracts/engine_gap_contracts.py +86 -3
  43. package/core/coverage/coverage_discovery.py +599 -29
  44. package/core/coverage/coverage_evidence.py +47 -0
  45. package/core/coverage/coverage_forensics.py +9 -0
  46. package/core/coverage/coverage_validate.py +6 -1
  47. package/core/dev_harness/SPEC.md +1 -1
  48. package/core/engine-integrity.json +591 -419
  49. package/core/fuzzing/concurrency_fuzzer.py +53 -0
  50. package/core/fuzzing/differential_oracle.py +562 -27
  51. package/core/fuzzing/fuzz_input.py +109 -6
  52. package/core/fuzzing/stateful_fuzzer.py +72 -0
  53. package/core/governance/secret_redactor.py +22 -10
  54. package/core/host_acp/SPEC.md +1 -1
  55. package/core/host_acp/__init__.py +4 -4
  56. package/core/host_acp/claude.py +59 -1
  57. package/core/host_acp/cline.py +64 -1
  58. package/core/host_acp/codex.py +56 -1
  59. package/core/host_acp/dsh.py +59 -1
  60. package/core/host_acp/opencode.py +56 -1
  61. package/core/host_acp/pi.py +59 -1
  62. package/core/host_acp/zcode.py +59 -1
  63. package/core/host_runtime/SPEC.md +1 -1
  64. package/core/host_runtime/adapters.py +1 -1
  65. package/core/host_runtime/cline.py +13 -0
  66. package/core/host_runtime/host_evaluators.py +44 -4
  67. package/core/host_runtime/host_probe.py +1 -1
  68. package/core/host_runtime/host_provider_arbitrator.py +116 -62
  69. package/core/host_runtime/host_registry.py +15 -8
  70. package/core/host_runtime/mcp_registry_gate.py +12 -1
  71. package/core/host_runtime/pi.py +102 -0
  72. package/core/host_runtime/provider_facts.py +66 -0
  73. package/core/hosts/SPEC.md +1 -1
  74. package/core/hosts/__init__.py +6 -2
  75. package/core/hosts/_dsh_usage.py +1 -1
  76. package/core/hosts/base.py +32 -4
  77. package/core/hosts/claude.py +55 -0
  78. package/core/hosts/cline.py +6 -2
  79. package/core/hosts/codex.py +58 -0
  80. package/core/hosts/dsh.py +9 -1
  81. package/core/hosts/opencode.py +6 -6
  82. package/core/hosts/pi.py +159 -2
  83. package/core/infra/README.md +4 -2
  84. package/core/infra/__init__.py +2 -0
  85. package/core/infra/build_info.py +22 -3
  86. package/core/infra/client_metadata.py +1 -1
  87. package/core/infra/json_utils.py +22 -0
  88. package/core/launch_phases/README.md +2 -2
  89. package/core/launch_phases/SPEC.md +1 -1
  90. package/core/launch_phases/common.py +21 -2
  91. package/core/launch_phases/finding_confirm_phase.py +5 -1
  92. package/core/launch_phases/finding_settlement.py +188 -1
  93. package/core/launch_phases/judge_phase.py +69 -12
  94. package/core/launch_phases/orchestrator_controls.py +11 -7
  95. package/core/launch_phases/post_coverage_sync.py +9 -2
  96. package/core/launch_phases/post_phase.py +139 -3
  97. package/core/launch_phases/post_receipt.py +12 -1
  98. package/core/launch_phases/pre_phase.py +3 -3
  99. package/core/launch_phases/pre_recon_scout.py +53 -36
  100. package/core/launch_phases/pre_state_builder.py +23 -176
  101. package/core/launch_phases/round_orchestrator.py +15 -32
  102. package/core/launch_phases/session_runtime.py +56 -9
  103. package/core/launch_phases/startup_gates.py +36 -8
  104. package/core/launch_phases/startup_interaction.py +68 -12
  105. package/core/launch_phases/startup_version_gate.py +9 -3
  106. package/core/launch_phases/supervisor_bridge.py +46 -17
  107. package/core/launch_phases/supervisor_coverage.py +8 -2
  108. package/core/launch_phases/supervisor_degraded.py +1 -9
  109. package/core/launch_phases/worker_barriers.py +15 -5
  110. package/core/launch_phases/worker_orchestrator.py +105 -25
  111. package/core/ledger/README.md +1 -1
  112. package/core/ledger/SPEC.md +1 -1
  113. package/core/ledger/_facade.py +2 -1
  114. package/core/ledger/archive_ops.py +60 -2
  115. package/core/ledger/cli.py +6 -1
  116. package/core/ledger/export_ops.py +6 -1
  117. package/core/ledger/finding_confirmation.py +48 -6
  118. package/core/ledger/finding_lifecycle.py +428 -5
  119. package/core/ledger/finding_verification.py +44 -8
  120. package/core/ledger/incidents.py +10 -4
  121. package/core/ledger/patterns.py +10 -7
  122. package/core/ledger/receipt_contract.py +17 -1
  123. package/core/ledger/sync_ops.py +21 -16
  124. package/core/ledger/tool_experience.py +2 -1
  125. package/core/ledger/verify_life.py +88 -17
  126. package/core/locales/en-US.json +2 -2
  127. package/core/locales/zh-CN.json +2 -2
  128. package/core/mcp_handlers/SPEC.md +1 -1
  129. package/core/mcp_handlers/base.py +23 -3
  130. package/core/mcp_handlers/channel_lifecycle.py +85 -30
  131. package/core/mcp_handlers/retrieval_handlers.py +11 -1
  132. package/core/mcp_handlers/rpc_server.py +6 -1
  133. package/core/mcp_handlers/supervisor_handlers.py +32 -6
  134. package/core/mcp_handlers/tool_table.py +15 -0
  135. package/core/mcp_runtime_support/environment.py +0 -38
  136. package/core/mcp_runtime_support/verifier.py +0 -52
  137. package/core/metadata.txt +2 -3
  138. package/core/planning/README.md +1 -1
  139. package/core/planning/domain_router.py +4 -2
  140. package/core/planning/dynamic_flow_analyzer.py +219 -14
  141. package/core/planning/judge_pipeline.py +87 -4
  142. package/core/planning/prompt_harness.py +7 -5
  143. package/core/planning/spec_harvester.py +4 -4
  144. package/core/probes/INTERFACE.md +11 -1
  145. package/core/probes/SPEC.md +11 -1
  146. package/core/probes/__init__.py +46 -40
  147. package/core/probes/android_probe.py +177 -9
  148. package/core/probes/codebase_memory_probe.py +57 -0
  149. package/core/probes/desktop_probe.py +104 -0
  150. package/core/probes/differential_probe.py +99 -21
  151. package/core/probes/efficiency_probe.py +64 -0
  152. package/core/probes/ios_binary_probe.py +105 -1
  153. package/core/probes/memory_probe.py +66 -0
  154. package/core/probes/miniprogram_probe.py +75 -13
  155. package/core/probes/mobile_probe.py +215 -30
  156. package/core/probes/native_probe.py +88 -0
  157. package/core/probes/openwiki_probe.py +70 -0
  158. package/core/probes/pattern_probe.py +106 -0
  159. package/core/probes/platform_probe.py +81 -0
  160. package/core/probes/probe_registry.py +108 -7
  161. package/core/probes/sast_fixture_corpus.py +340 -0
  162. package/core/probes/sast_probe.py +553 -52
  163. package/core/probes/sast_rules.py +668 -28
  164. package/core/probes/sca_scanner.py +48 -0
  165. package/core/probes/ui_accessibility.py +149 -0
  166. package/core/probes/ui_audit.py +513 -0
  167. package/core/probes/ui_contract.py +273 -0
  168. package/core/probes/ui_evidence.py +212 -0
  169. package/core/probes/ui_measurements.py +314 -0
  170. package/core/probes/ui_repair.py +250 -0
  171. package/core/probes/ui_review.py +133 -0
  172. package/core/probes/ui_storybook.py +107 -0
  173. package/core/probes/ui_tokens.py +185 -0
  174. package/core/probes/ui_visual_diff.py +131 -0
  175. package/core/probes/web_probe.py +373 -18
  176. package/core/project_profiler/SPEC.md +1 -1
  177. package/core/project_profiler/arbitrator.py +6 -1
  178. package/core/project_profiler/detector.py +8 -1
  179. package/core/project_profiler/strategy.py +51 -15
  180. package/core/prompts/command_routing_en.md +2 -2
  181. package/core/prompts/command_routing_zh.md +2 -2
  182. package/core/prompts/stages/stage_repair.md +1 -1
  183. package/core/repair/README.md +1 -1
  184. package/core/repair/l7_repair_loop.py +1 -4
  185. package/core/repair/rsi_fixer.py +4 -4
  186. package/core/repair/rsi_loop.py +1 -3
  187. package/core/repair/rsi_repair.py +7 -7
  188. package/core/repair/rsi_scope.py +27 -8
  189. package/core/report_engine/SPEC.md +1 -1
  190. package/core/report_engine/attestation.py +8 -4
  191. package/core/report_engine/finding_report.py +2 -1
  192. package/core/report_engine/models.py +7 -9
  193. package/core/report_engine/sast_bridge.py +2 -2
  194. package/core/report_engine/server.py +18 -8
  195. package/core/report_engine/web-conformance.md +123 -18
  196. package/core/report_engine/web_conformance.py +21 -52
  197. package/core/retrieval/README.md +1 -1
  198. package/core/retrieval/SPEC.md +1 -1
  199. package/core/retrieval/code_analyzer.py +50 -14
  200. package/core/retrieval/context_assembler.py +7 -1
  201. package/core/retrieval/knowledge_sync.py +108 -14
  202. package/core/retrieval/symbol_index.py +25 -6
  203. package/core/retrieval/universal_code_matcher.py +234 -49
  204. package/core/runtime/README.md +1 -1
  205. package/core/runtime/bugx_logging.py +78 -7
  206. package/core/runtime/fixture_solidify.py +5 -10
  207. package/core/runtime/incident_eval.py +1 -1
  208. package/core/runtime/model_runner.py +4 -41
  209. package/core/runtime/platform_adapter.py +2 -2
  210. package/core/runtime/prep_validate.py +4 -2
  211. package/core/runtime/project_settings.py +2 -1
  212. package/core/runtime/scenario_eval.py +50 -8
  213. package/core/skills/bugx_docs_mcp_server.py +3 -1
  214. package/core/skills/bugx_mcp_server.py +29 -2
  215. package/core/skills/tools_kb.py +1 -1
  216. package/core/supervisor/README.md +1 -1
  217. package/core/supervisor/SPEC.md +1 -1
  218. package/core/supervisor/budget_governor.py +503 -9
  219. package/core/supervisor/checkpoint_pipeline.py +248 -6
  220. package/core/supervisor/checkpoint_sync.py +13 -0
  221. package/core/supervisor/claim_events.py +1 -1
  222. package/core/supervisor/finding_workflow.py +22 -5
  223. package/core/supervisor/lease_manager.py +1 -1
  224. package/core/supervisor/lifecycle_blocks.py +6 -1
  225. package/core/supervisor/rejection_remedies.py +52 -5
  226. package/core/supervisor/serial_authorization.py +48 -4
  227. package/core/supervisor/task_scheduler.py +2 -2
  228. package/core/supervisor/worker_checkpoint.py +8 -1
  229. package/core/supervisor/worker_runtime.py +8 -2
  230. package/core/supervisor_types/worker_claim.py +9 -0
  231. package/core/webui/README.md +1 -1
  232. package/core/webui/SPEC.md +2 -1
  233. package/core/webui/adapters/claude.py +5 -1
  234. package/core/webui/adapters/cline.py +10 -2
  235. package/core/webui/adapters/codex.py +5 -1
  236. package/core/webui/adapters/dsh.py +5 -1
  237. package/core/webui/docs_session_service.py +2 -2
  238. package/core/webui/mcp_inspector.py +11 -7
  239. package/core/webui/static/00-base.css +1060 -0
  240. package/core/webui/static/01-monitoring.css +802 -0
  241. package/core/webui/static/02-header-actions.css +321 -0
  242. package/core/webui/static/03-trigger-popover.css +697 -0
  243. package/core/webui/static/04-composer.css +628 -0
  244. package/core/webui/static/05-skills-center.css +878 -0
  245. package/core/webui/static/06-mcp-center.css +623 -0
  246. package/core/webui/static/07-skill-detail.css +265 -0
  247. package/core/webui/static/08-files-management.css +167 -0
  248. package/core/webui/static/09-files-center.css +386 -0
  249. package/core/webui/static/10-icons.css +105 -0
  250. package/core/webui/static/11-project-options.css +185 -0
  251. package/core/webui/static/12-profile-tab.css +383 -0
  252. package/core/webui/static/design-tokens.css +113 -0
  253. package/core/webui/static/index.html +14 -1
  254. package/core/webui/workspace_service.py +1 -1
  255. package/docs/07_distribution/01_README_NPM.md +190 -186
  256. package/ecosystem/integrations/README.md +1 -1
  257. package/ecosystem/integrations/dsh/mcp/package.json +1 -1
  258. package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
  259. package/ecosystem/integrations/dsh/ui/package.json +1 -1
  260. package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +4 -4
  261. package/ecosystem/integrations/opencode/mcp-lock.json +14 -6
  262. package/ecosystem/integrations/opencode/opencode.json +23 -12
  263. package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
  264. package/ecosystem/integrations/qoder/connector-meta.json +1 -1
  265. package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
  266. package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +1 -1
  267. package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
  268. package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
  269. package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
  270. package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +2 -2
  271. package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
  272. package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
  273. package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +1 -1
  274. package/interfaces/bin/bugx.js +37 -0
  275. package/interfaces/cli/bugx_cli/__init__.py +4 -2
  276. package/interfaces/cli/bugx_cli/cli.py +11 -4
  277. package/interfaces/cli/bugx_cli/commands/advisory.py +1 -1
  278. package/interfaces/cli/bugx_cli/commands/agent.py +339 -73
  279. package/interfaces/cli/bugx_cli/commands/audit.py +2 -2
  280. package/interfaces/cli/bugx_cli/commands/autonomous.py +1 -1
  281. package/interfaces/cli/bugx_cli/commands/cloud.py +4 -3
  282. package/interfaces/cli/bugx_cli/commands/doctor.py +449 -204
  283. package/interfaces/cli/bugx_cli/commands/interaction.py +5 -1
  284. package/interfaces/cli/bugx_cli/commands/knowledge.py +2 -0
  285. package/interfaces/cli/bugx_cli/commands/lifecycle.py +3 -3
  286. package/interfaces/cli/bugx_cli/commands/plugin.py +55 -20
  287. package/interfaces/cli/bugx_cli/commands/plugin_claude.py +7 -7
  288. package/interfaces/cli/bugx_cli/commands/plugin_funide.py +2 -1
  289. package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +1 -1
  290. package/interfaces/cli/bugx_cli/commands/report.py +2 -6
  291. package/interfaces/cli/bugx_cli/commands/system.py +11 -11
  292. package/interfaces/cli/bugx_cli/common.py +15 -7
  293. package/interfaces/cli/bugx_cli/host_adapters.py +29 -54
  294. package/interfaces/cli/bugx_cli/hosts/registry.py +8 -6
  295. package/interfaces/cli/bugx_cli/infra/ai_advisor.py +157 -27
  296. package/interfaces/cli/bugx_cli/infra/engine_installer.py +18 -10
  297. package/interfaces/cli/bugx_cli/infra/host_sync.py +11 -8
  298. package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +76 -5
  299. package/interfaces/cli/bugx_cli/infra/security.py +13 -6
  300. package/package.json +2 -1
  301. package/pyproject.toml +20 -8
  302. package/scripts/ensure-python.mjs +7 -7
  303. package/scripts/sync-version.mjs +10 -21
  304. package/scripts/test-npm-wrapper.mjs +1 -1
  305. package/core/webui/static/project-settings.css +0 -6458
  306. package/docs/07_distribution/README.md +0 -16
  307. package/docs/README.md +0 -121
  308. package/interfaces/README.md +0 -143
  309. package/interfaces/bin/README.md +0 -35
  310. package/interfaces/cli/README.md +0 -90
  311. package/scripts/README.md +0 -118
@@ -1,16 +0,0 @@
1
- # Distribution:分发与打包说明
2
-
3
- > **定位**:发布到包管理器时**附带给使用者**的说明文件。
4
- > **上级索引**:[docs/README.md](../../docs/README.md) | **规范**:[02_architecture/07_DOC_GOVERNANCE_STANDARD.md](../02_architecture/07_DOC_GOVERNANCE_STANDARD.md)
5
-
6
- ## 内容
7
-
8
- | 文件 | 分发目标 | 被谁使用 |
9
- |---|---|---|
10
- | `02_README_PYPI.md` | Python (PyPI) | `scripts/package_dist.py` 打包时作为包描述 |
11
- | `01_README_NPM.md` | Node.js (npm) | `scripts/package_dist.py` 打包时作为包描述 |
12
-
13
- ## 维护规则
14
-
15
- - 这两个文件**会随发行包发布**,属公开层:**严禁**出现内部工单编号或未实现规划。
16
- - 修改打包脚本(`scripts/package_dist.py`)引用的文件名时,必须同步本目录与 README 索引。
package/docs/README.md DELETED
@@ -1,121 +0,0 @@
1
- ---
2
- title: BugX 文档中心
3
- audience: Public users and maintainers
4
- status: DOCUMENTATION_UNVERIFIED
5
- last-verified: 2026-11-10
6
- ---
7
-
8
- # BugX 文档中心(Documentation Hub)
9
-
10
- > **版本**:1.0.0 | **体系**:按读者分区(Diátaxis + 三受众隔离)
11
- > **规范**:[02_architecture/07_DOC_GOVERNANCE_STANDARD.md](02_architecture/07_DOC_GOVERNANCE_STANDARD.md) — 本目录的命名、分区、状态与维护规则以该文件为唯一权威。
12
-
13
- ---
14
-
15
- ## 目录结构(按读者找,不按文件名猜)
16
-
17
- ```text
18
- docs/
19
- ├── README.md / README_EN.md ← 你在这里
20
- ├── 02_architecture/07_DOC_GOVERNANCE_STANDARD.md ← 文档规范(唯一权威)
21
- │
22
- ├── 01_guides/ 【操作用】我要照着做
23
- ├── 02_architecture/ 【理解用】我要看懂系统
24
- ├── 03_ai/ 【给 AI】宿主运行时上下文
25
- ├── 04_reference/ 【查值用】速查
26
- ├── 05_release-notes/ 【追溯用】微版本流水账本(自动生成)
27
- ├── 06_diagrams/ 【资源】图表文件
28
- ├── 07_distribution/ 【发布用】分发与打包说明
29
- └── 08_internal/ 【内部】仅存运行期必需资产(含工单号,禁止外传)
30
- ```
31
-
32
- **序号即阅读顺序**。插入新分类时整体重排,不留空号;`README.md` 不加序号(工具按固定名定位)。
33
-
34
- ---
35
-
36
- ## 1. 操作指南(`01_guides/`)— 我要照着做
37
-
38
- | 文档 | 内容 |
39
- |---|---|
40
- | [01_USER_GUIDE.md](01_guides/01_USER_GUIDE.md) `01_guides/01_USER_GUIDE.md` | 安装、四层 Host 能力矩阵、审计配置、生命周期、报告解读与恢复 |
41
- | [02_COMMANDS.md](01_guides/02_COMMANDS.md) `01_guides/02_COMMANDS.md` | 当前 CLI 的 42 个顶层命令、分组子命令、参数、副作用与退出码 |
42
- | [03_TROUBLESHOOTING.md](01_guides/03_TROUBLESHOOTING.md) `01_guides/03_TROUBLESHOOTING.md` | 按症状分流的诊断、证据收集、恢复和终止标准 |
43
- | [目录说明](01_guides/README.md) | 该目录索引与维护责任 |
44
-
45
- ## 2. 架构与设计(`02_architecture/`)— 我要看懂系统
46
-
47
- | 文档 | 内容 | 建议读序 |
48
- |---|---|---|
49
- | [04_REPOSITORY_TOPOLOGY.md](02_architecture/04_REPOSITORY_TOPOLOGY.md) `02_architecture/04_REPOSITORY_TOPOLOGY.md` | 六大正交领域:目录树与根层白名单 | **① 先看全貌** |
50
- | [01_ARCHITECTURE.md](02_architecture/01_ARCHITECTURE.md) `02_architecture/01_ARCHITECTURE.md` | 微内核 7 层拓扑、33 个子系统、生命周期时序 | ② 再看分层 |
51
- | [03_BUGX_AUDIT_FLOW.md](02_architecture/03_BUGX_AUDIT_FLOW.md) `02_architecture/03_BUGX_AUDIT_FLOW.md` | Pre / Run / Post / Settle 对抗博弈时序 | ③ 最后看流程 |
52
- | [02_DESIGN_SPEC.md](02_architecture/02_DESIGN_SPEC.md) `02_architecture/02_DESIGN_SPEC.md` | 内部规格演进、修复契约、单测断言总账本 | 查细节时按子系统检索 |
53
- | [05_ARCH_NOMENCLATURE_GUIDE.md](02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md) `02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md` | 命名规范、7 层单向依赖矩阵 | 改代码前 |
54
- | [06_MODULE_GOVERNANCE_SPEC.md](02_architecture/06_MODULE_GOVERNANCE_SPEC.md) `02_architecture/06_MODULE_GOVERNANCE_SPEC.md` | 目录归类、索引守卫、测试调度 | 加文件前 |
55
- | [目录说明](02_architecture/README.md) | 该目录索引与维护责任 |
56
-
57
- ## 3. AI 宿主上下文(`03_ai/`)— 给 Agent 读
58
-
59
- | 文档 | 消费方式 |
60
- |---|---|
61
- | [01_AI_REFERENCE.md](03_ai/01_AI_REFERENCE.md) `03_ai/01_AI_REFERENCE.md` | 宿主启动时注入:CLI 契约、MCP 协议、状态机、验收门禁 |
62
- | [02_AI_USAGE.md](03_ai/02_AI_USAGE.md) `03_ai/02_AI_USAGE.md` | 集成示例,按需查阅 |
63
- | [03_AI_COMMANDS.md](03_ai/03_AI_COMMANDS.md) `03_ai/03_AI_COMMANDS.md` | 命令选路手册 |
64
- | [目录说明](03_ai/README.md) | 该目录索引与写作约束 |
65
-
66
- ## 4. 参考(`04_reference/`)
67
-
68
- | 文档 | 内容 |
69
- |---|---|
70
- | [CHANGELOG.md](../CHANGELOG.md) `CHANGELOG.md` | 面向外部使用者的语义版本变更汇总 |
71
- | [环境变量参考](04_reference/01_ENVIRONMENT_VARIABLES.md) `04_reference/01_ENVIRONMENT_VARIABLES.md` | 环境变量的设置方式、作用域、敏感边界和源码消费清单 |
72
- | [目录说明](04_reference/README.md) | 双轨制说明 |
73
-
74
- ---
75
-
76
- ## 5. 内部研发资产(`08_internal/`)— 禁止外传
77
-
78
- 含内部工单编号,**严禁出现在公开分发物中**。
79
-
80
- 内部目录不属于公开分发物,当前包括标准、发布和文档证据矩阵:
81
-
82
- ```text
83
- docs/08_internal/
84
- ├── 01_standards/ 测试设计规范、宿主迁移清单、L1 快循环、契约清单
85
- ├── 02_release/ 发布指南和内部审计留档
86
- └── 03_documentation/ 产品文档覆盖矩阵和源码证据边界
87
- ```
88
-
89
- **架构真值以 [02_architecture/](02_architecture/README.md) 为准**;内部文档只记录研发操作规范、发布约束和本次文档审计证据。
90
-
91
- 详见 [08_internal/README.md](08_internal/README.md)。
92
-
93
- ---
94
-
95
- ## 我要做 X,该看哪个?
96
-
97
- | 我想…… | 去这里 |
98
- |---|---|
99
- | 装上并跑起来 | [01_guides/01_USER_GUIDE.md](01_guides/01_USER_GUIDE.md) |
100
- | 查某个命令怎么用 | [01_guides/02_COMMANDS.md](01_guides/02_COMMANDS.md) |
101
- | 理解系统怎么分层 | [02_architecture/01_ARCHITECTURE.md](02_architecture/01_ARCHITECTURE.md) |
102
- | 搞清审计流程怎么走 | [02_architecture/03_BUGX_AUDIT_FLOW.md](02_architecture/03_BUGX_AUDIT_FLOW.md) |
103
- | 提一个新需求 | [02_architecture/02_DESIGN_SPEC.md](02_architecture/02_DESIGN_SPEC.md) 对应章节 |
104
- | 写一份技术方案 | `python3 scripts/dev_doc.py plan --title "..."`(方案产出到 08_internal/)|
105
- | 记录一个 bug 的原因与修复 | git 提交说明 + [CHANGELOG.md](../CHANGELOG.md) |
106
- | 看要做什么还没做 | `python3 scripts/dev_doc.py status`(无独立 TODO 文件)|
107
- | 查历史提案 | git 历史(`git log --all -- docs/08_internal/04_proposals`) |
108
- | 改代码前看规范 | [08_internal/01_standards/](08_internal/01_standards/README.md) |
109
- | 发版 | [05_release-notes/](05_release-notes/README.md) |
110
- | 知道文档该怎么写 | [02_architecture/07_DOC_GOVERNANCE_STANDARD.md](02_architecture/07_DOC_GOVERNANCE_STANDARD.md) |
111
-
112
- ---
113
-
114
- ## 维护规则(摘要)
115
-
116
- 1. **每个目录必须有 README**,且与实际文件双向一致 —— 由 `scripts/verify_directory_indices.py --check` 强制。
117
- 2. **新增/删除/改名必须在同一次提交内同步 README** —— 否则提交被拒。
118
- 3. **公开层禁止内部工单编号** —— 由 `docskill status` 检查。
119
- 4. **最大深度 3 层** —— 超过说明分类划分错了。
120
-
121
- 完整规则见 [02_architecture/07_DOC_GOVERNANCE_STANDARD.md](02_architecture/07_DOC_GOVERNANCE_STANDARD.md)。
@@ -1,143 +0,0 @@
1
- # BugX 用户交互与接口层 (User Interfaces & External Entrypoints)
2
-
3
- > 本文档为 BugX `interfaces/` 目录的唯一权威架构全景与接口速查字典。记录了命令行 CLI、Web 控制台与 Node.js 包分发入口的架构拓扑、接口契约与职责边界。
4
-
5
- ---
6
-
7
- ## 1. 交互层架构拓扑 (Interfaces Architecture Topology)
8
-
9
- ```mermaid
10
- flowchart TD
11
- User["人类开发者 / CI 系统 / 外部宿主 Agent"]
12
-
13
- subgraph Interfaces["interfaces/ 交互入口层 (Thin Entrypoint Wrappers)"]
14
- A["bin/ (Node.js npm entry wrapper)"]
15
- B["cli/ (Python Rich/Typer/Click CLI)"]
16
- C["web/ (Embeddable Web Studio Workbench)"]
17
- end
18
-
19
- subgraph Core["core/ 微内核与业务逻辑层"]
20
- K1["launch_bugx.py (阶段编排)"]
21
- K2["supervisor (会话守护)"]
22
- K3["mcp_runtime.py (MCP 服务端)"]
23
- K4["report_engine / webui (报表与数据源)"]
24
- end
25
-
26
- User -->|npx bugx / npm install -g @bugx/cli| A
27
- User -->|bugx / python3 -m ...| B
28
- User -->|http://localhost:18991| C
29
-
30
- A -->|execve python3| B
31
- B -->|驱动| K1
32
- B -->|RPC / API| K2
33
- B -->|启动服务| K4
34
- C -->|REST / WebSocket| K4
35
- ```
36
-
37
- ---
38
-
39
- ## 2. 核心子目录架构与职责说明 (Subdirectories Map)
40
-
41
- | 子目录 | 接口形态 | 核心职责说明 |
42
- | :--- | :--- | :--- |
43
- | `bin/` | Node.js 启动包装 | 包含 `bugx.js`,供 npm 全局安装或 `npx bugx` 唤起时自动寻找环境中的 Python 3.11+ 解释器并无缝转发命令行参数与信号 |
44
- | `cli/` | Python CLI 核心 | 包含 `bugx_cli/` 包,提供现代化的命令行参数解析、交互式多选问答、色彩终端高亮及向微内核发起调用的轻量桥梁 |
45
- | `web/` | Web 交互控制台 | 嵌入式 Web 控制台静态资源与本地开发服务器,提供图表化的审计态势感知、漏洞复盘、图谱探索与可视化工作台 |
46
-
47
- ---
48
-
49
- ## 3. CLI 命令行接口规范 (CLI Interface Specification)
50
-
51
- ### 3.1 统一调用入口与别名
52
- BugX CLI 支持多平台无缝调用方式:
53
- - **生产推荐**:`bugx <command> [options]`(全局安装或 pip 模式)
54
- - **Node.js 免配环境**:`npx @bugx/cli <command> [options]`
55
- - **源码开发模式**:`python3 -m interfaces.cli.bugx_cli.cli <command> [options]`
56
-
57
- ### 3.2 全局通用参数规范 (Global Options)
58
- 所有 CLI 子命令均继承以下标准化全局参数,严禁各子命令自行发明异构同义参数:
59
- - `--root <path>`:指定待审计或操作的目标项目根目录(缺省为当前工作目录 `.`);
60
- - `--json`:开启机器可读的结构化 JSON 输出模式,静默色彩终端与交互式 prompt,便于 CI/CD 解析;
61
- - `-v / --verbose`:输出调试级日志(包含微内核阶段推进细节与子进程命令);
62
- - `-q / --quiet`:静默非关键输出,仅打印最终状态码与致命错误;
63
- - `--confirm-version-transition`:版本跃迁安全确认标志(仅在非 1.0.0 变更受控场景下生效)。
64
-
65
- ### 3.3 核心子命令与职责矩阵 (Command Matrix)
66
- CLI 按功能正交划分为 5 大领域命令族:
67
- 1. **核心审计与攻防**:
68
- - `bugx audit [--profile <name>] [--rule <pack>]`:执行指定代码路径的交互式或定向深度安全审计;
69
- - `bugx autonomous [--headless] [--timeout <sec>]`:一键启动全自动无头自主攻防挖掘与闭环;
70
- - `bugx matrix [--matrix-file <path>]`:执行多环境、多语言、多宿主攻防交叉验证矩阵。
71
- 2. **环境诊断与补丁修复**:
72
- - `bugx doctor [--fix]`:全方位检查 Python 版本、宿主配置、MCP 服务可用性并支持就地自愈;
73
- - `bugx patch [apply|verify] <finding-id>`:提取漏洞复现 PoC 与自动合成补丁,执行双向验证;
74
- - `bugx advisory [query|show] <cve-or-ghsa>`:本地离线或云端检索已知安全通告与漏洞模式。
75
- 3. **生命周期与驻留守护**:
76
- - `bugx lifecycle [status|reset|advance]`:查询当前审计轮次状态机推进进度或强制安全重置;
77
- - `bugx daemon [start|stop|status]`:管理 BugX 后台驻留守护服务与长任务队列;
78
- - `bugx goal [set|list|status]`:长期目标驱动的迭代攻防探索与收敛状态管理。
79
- 4. **报表交付与洞察**:
80
- - `bugx report serve [--port 18991]`:启动本地嵌入式 Web 交互控制台与实时监控大屏;
81
- - `bugx report both [--out <dir>]`:同时渲染输出独立离线 HTML 漏洞报告与 SARIF/JSON 产物;
82
- - `bugx stats [--since <date>]`:聚合统计漏洞拦截率、修复准确率与代码覆盖度指标。
83
- 5. **宿主集成与扩展**:
84
- - `bugx plugin [list|install|uninstall] <host>`:一键向 Cline, OpenCode, Claude, Qoder 等宿主注入插件;
85
- - `bugx skill [list|install|export]`:智能体可调用的标准 Skill 技能包导出与配置;
86
- - `bugx agent [status|handoff|inspect]`:多智能体并发角色状态监控与协作排查。
87
-
88
- ---
89
-
90
- ## 4. Web 控制台与接口规范 (Web Console & API Specification)
91
-
92
- ### 4.1 架构与解耦原则
93
- - **微内核后端解耦**:Web 控制台自身属于轻量展示层与人机协同交互交付中心,其底层数据契约、任务 DAG 拓扑流与 SQLite FTS5 引擎由 `core/webui/` 与 `core/report_engine/` 提供纯粹后端支撑。
94
- - **开箱即用与零外部依赖**:控制台采用自包含单页静态资源(Vanilla/Pretext 原生渲染),无需额外配置复杂 Node.js 构建环境。
95
-
96
- ### 4.2 常用服务启动方式
97
- ```bash
98
- # 启动本地可视化审计工作台(默认端口 18991)
99
- bugx report serve --port 18991
100
-
101
- # 生成并导出独立静态离线 HTML 审计报告与证据链
102
- bugx report both --eval-dir verification/evals/oss --out verification/evals/oss
103
- ```
104
-
105
- ### 4.3 核心功能面板
106
- 1. **实时挖掘工作台 (Live Mining Workbench)**:展示任务 DAG 推进状态、Worker 并发心跳与生命周期状态机;
107
- 2. **双轨证据链报告 (Dual-Track Evidence Report)**:包含 CVE 级漏洞利用 PoC 代码、污染源追踪调用栈与反向修复补丁对比;
108
- 3. **架构拓扑与攻击面图谱 (Attack Graph Visualizer)**:组件依赖拓扑、污染传播网络与人机交互决策点;
109
- 4. **文档治理与知识检索 (Docs Governance & Search)**:Diátaxis 架构规范全文检索与自愈经验错题集。
110
-
111
- ### 4.4 核心 REST / WebSocket 协议契约
112
- - `GET /api/v1/status`:获取当前会话生命周期、引擎版本与活动 Worker 清单;
113
- - `GET /api/v1/findings`:获取结构化漏洞 Finding 列表、严重级别分布与复现证据;
114
- - `GET /api/v1/graph`:获取攻击面拓扑网络图数据(节点、边与污染传播链);
115
- - `GET /api/v1/report/html`:直接获取预渲染完毕的静态报告 HTML;
116
- - `WS /ws/live`:实时双向 WebSocket 通道,广播 Worker 日志、阶段切换事件与检查点信号。
117
-
118
- ---
119
-
120
- ## 5. Node.js 二进制包装器规范 (Binary Wrapper Specification)
121
-
122
- 位于 `bin/bugx.js` 的包装器遵循以下执行契约:
123
- 1. **三级自愈式解释器探测瀑布流 (Discovery Waterfall)**:
124
- - 第 1 级:探测内部捆绑独立运行时 `runtime/python-manifest.json`;
125
- - 第 2 级:探测全局预安装独立运行时 `~/.bugx/python/bin/python3`;
126
- - 第 3 级:按优先级扫描系统 PATH 候选解释器(`python3.14` 至 `python3.11`);
127
- - 容错保底:全部未命中时输出友好的就地自愈安装指引命令,严禁崩溃。
128
- 2. **退出状态码与信号原样透传**:
129
- - 子进程退出码透明返回操作系统,确保 CI/CD 判定零失真;
130
- - `SIGINT` (Ctrl+C) 与 `SIGTERM` 信号原子透传给底层 Python 进程,保障优雅退出与运行时清理。
131
-
132
- ---
133
-
134
- ## 6. 设计原则与边界红线 (Architecture Guardrails)
135
-
136
- 1. **纯粹入口薄壳(Thin Wrapper Invariant)**:
137
- - 交互层仅负责参数解析、格式校验、终端美化渲染与用户交互;
138
- - 严禁在 `interfaces/` 下编写复杂业务逻辑或持久化逻辑,所有核心业务必须委托给 `core/` 下的微内核与子系统完成。
139
- 2. **多语言生态对齐**:
140
- - `bin/bugx.js` 与 Python CLI 必须 100% 保持参数契约一致;
141
- - 参数变动时必须同步更新 CLI 命令树与对应测试。
142
- 3. **文档同步防漂移**:
143
- - `scripts/verify_directory_indices.py --dirs interfaces` 会对本目录所有子系统进行 100% 完备性校验!
@@ -1,35 +0,0 @@
1
- # BugX Interfaces: Executable Binary Wrappers (可执行二进制封装)
2
-
3
- `interfaces/bin/` 包含了 BugX 面向 npm / npx / 全局命令行安装的跨平台可执行二进制脚本包装器。
4
-
5
- ---
6
-
7
- ## 1. 架构拓扑与自愈运行流 (Wrapper Execution Flow)
8
-
9
- ```mermaid
10
- flowchart TD
11
- N["npx bugx / npm install -g @bugx/cli"] --> JS["interfaces/bin/bugx.js<br/>Node.js 跨平台包装器"]
12
- JS --> P1{"1. 优先探测独立捆绑运行时<br/>runtime/python-manifest.json"}
13
- P1 -- 存在 --> PY["执行 Python 运行时"]
14
- P1 -- 不存在 --> P2{"2. 探测全局独立运行时<br/>~/.bugx/python/bin/python3"}
15
- P2 -- 存在 --> PY
16
- P2 -- 不存在 --> P3{"3. 扫描系统 PATH 候选<br/>python3.14 ~ 3.11"}
17
- P3 -- 命中 >=3.11 --> PY
18
- P3 -- 未安装 --> ERR["输出友好诊断指引与自动安装命令"]
19
- PY --> CLI["core/launch_bugx.py / interfaces/cli/bugx_cli/cli.py"]
20
- ```
21
-
22
- ---
23
-
24
- ## 2. 模块文件物理索引与职责清单 (File Inventory)
25
-
26
- | 文件名 | 职责与功能定位 | 运行机制与契约 |
27
- | :--- | :--- | :--- |
28
- | `bugx.js` | npm / 全局 CLI 跨平台包装脚本 | 自动探测并解析 Python 3.11+ 解释器(支持 Bundled / Global Standalone / System PATH),无损透传所有命令行参数与退出状态码 |
29
-
30
- ---
31
-
32
- ## 3. 设计契约与公理
33
-
34
- - **零侵入与零环境要求**:Node 用户无需手动配置 Python 环境,包装器自动完成运行时发现与自愈引导。
35
- - **状态码透明转发**:底层 Python 进程的退出状态码(Exit Code)必须原样返回给操作系统,保证在 CI/CD 流水线中的判定准确。
@@ -1,90 +0,0 @@
1
- # BugX CLI (统一命令行界面与分发框架)
2
-
3
- `interfaces/cli/` 是 BugX 的命令行交互与执行总入口。它承载了 24 个子命令模块、5 大基础设施支持模块、多宿主模板引擎与统一命令路由。
4
-
5
- ---
6
-
7
- ## 1. 架构拓扑与命令分发树 (CLI Command Tree)
8
-
9
- ```mermaid
10
- flowchart TD
11
- CLI["interfaces/cli/bugx_cli/cli.py<br/>CLI 主入口 (Click / Argparse)"]
12
-
13
- subgraph CoreCommands["1. 核心攻防与生命周期命令 (commands/)"]
14
- C1["audit.py<br/>定向/交互式代码安全审计"]
15
- C2["autonomous.py<br/>无头自主攻防运行"]
16
- C3["patch.py<br/>自动化补丁生成与复验"]
17
- C4["report.py<br/>HTML/PDF 报告构建与预览服务"]
18
- C5["lifecycle.py<br/>攻防会话生命周期与阶段推进"]
19
- C6["doctor.py<br/>运行环境自检与诊断修复"]
20
- C7["daemon.py<br/>后台常驻守护服务"]
21
- end
22
-
23
- subgraph HostPluginCommands["2. 宿主与插件命令 (commands/)"]
24
- P1["plugin.py / plugin_*.py<br/>Claude, Cline, Codex, Qoder, ZCode 等宿主插件管理"]
25
- P2["skill.py<br/>智能体技能包安装与导出"]
26
- P3["agent.py<br/>多智能体角色与会话管理"]
27
- end
28
-
29
- subgraph InfraHosts["3. CLI 基础设施与模板 (infra/ & hosts/)"]
30
- I1["infra/security.py<br/>工作区与权限安全护栏"]
31
- I2["infra/engine_installer.py<br/>引擎本地自愈安装与升级"]
32
- I3["infra/host_sync.py<br/>宿主配置双向同步"]
33
- H1["hosts/registry.py<br/>宿主注册表与元数据"]
34
- H2["hosts/template_engine.py<br/>宿主配置模板动态渲染"]
35
- end
36
-
37
- CLI --> CoreCommands
38
- CLI --> HostPluginCommands
39
- CLI --> InfraHosts
40
- ```
41
-
42
- ---
43
-
44
- ## 2. 模块文件物理索引与职责清单 (File Inventory)
45
-
46
- | 相对路径 / 文件名 | 职责与功能定位 | 关联子命令 / 核心能力 |
47
- | :--- | :--- | :--- |
48
- | `bugx_cli/` | CLI 核心包物理目录 | CLI Python 包主体 |
49
- | `bugx_cli/cli.py` | CLI 命令行根入口,处理全局参数(`--root`, `--verbose`, `--json`)并分发子命令 | `bugx` CLI 调度入口 |
50
- | `bugx_cli/common.py` | CLI 终端高亮着色、表格格式化、确认交互与退出码处理 | `print_banner`, `confirm_action` |
51
- | `bugx_cli/host_adapters.py` | 宿主适配器命令行转接层,负责各宿主配置与命令映射 | `HostAdapterRegistry` |
52
- | `bugx_cli/commands/advisory.py` | 安全漏洞情报查询命令(CVE/GHSA 数据库快速检索) | `bugx advisory` |
53
- | `bugx_cli/commands/agent.py` | 攻防智能体协同状态查询与手动介入命令 | `bugx agent` |
54
- | `bugx_cli/commands/audit.py` | 核心攻防审计执行命令,支持指定规则包与目标范围 | `bugx audit` |
55
- | `bugx_cli/commands/autonomous.py` | 全自动无头攻防命令,一键启动无人值守自愈审计 | `bugx autonomous` |
56
- | `bugx_cli/commands/cloud.py` | 云端飞轮知识同步与隐私授权配置命令 | `bugx cloud` |
57
- | `bugx_cli/commands/daemon.py` | BugX 后台驻留守护进程与任务调度管理命令 | `bugx daemon` |
58
- | `bugx_cli/commands/doctor.py` | 系统与环境全方位健康诊断自愈命令 | `bugx doctor` |
59
- | `bugx_cli/commands/goal.py` | 长期目标驱动的迭代攻防探索命令 | `bugx goal` |
60
- | `bugx_cli/commands/knowledge.py` | 历史错题经验与防御知识库检索命令 | `bugx knowledge` |
61
- | `bugx_cli/commands/lifecycle.py` | 审计生命周期阶段查询与控制命令 | `bugx lifecycle` |
62
- | `bugx_cli/commands/matrix.py` | 多维度攻防矩阵与多环境测试命令 | `bugx matrix` |
63
- | `bugx_cli/commands/patch.py` | 代码修复补丁验证与应用命令 | `bugx patch` |
64
- | `bugx_cli/commands/plugin.py` | 宿主插件统一安装、激活与卸载管理命令 | `bugx plugin` |
65
- | `bugx_cli/commands/plugin_claude.py` | Claude 宿主插件专用配置与状态管理 | `bugx plugin claude` |
66
- | `bugx_cli/commands/plugin_cline.py` | Cline 插件专用配置与规则安装 | `bugx plugin cline` |
67
- | `bugx_cli/commands/plugin_codex.py` | OpenAI Codex 插件交互与配置 | `bugx plugin codex` |
68
- | `bugx_cli/commands/plugin_funide.py` | FunIDE 宿主插件专用配置 | `bugx plugin funide` |
69
- | `bugx_cli/commands/plugin_qoder.py` | Qoder 平台专属连接命令 | `bugx plugin qoder` |
70
- | `bugx_cli/commands/plugin_zcode.py` | ZCode 平台配置命令 | `bugx plugin zcode` |
71
- | `bugx_cli/commands/project.py` | 目标工程技术栈探测与画像分析命令 | `bugx project` |
72
- | `bugx_cli/commands/report.py` | 审计报告渲染、PDF 导出与本地大屏服务启动命令 | `bugx report` |
73
- | `bugx_cli/commands/skill.py` | 智能体技能包(Skill Pack)管理与发布命令 | `bugx skill` |
74
- | `bugx_cli/commands/stats.py` | 审计覆盖度与历史拦截统计指标输出命令 | `bugx stats` |
75
- | `bugx_cli/commands/system.py` | 底层配置、缓存清理与引擎版本信息命令 | `bugx system` |
76
- | `bugx_cli/infra/ai_advisor.py` | AI 审计建议与错误诊断生成器 | 智能报错建议 |
77
- | `bugx_cli/infra/engine_installer.py` | 引擎本地安装、就地自愈与路径配置辅助器 | 自动安装与依赖自愈 |
78
- | `bugx_cli/infra/host_sync.py` | 宿主双向配置同步引擎 | 宿主配置热同步 |
79
- | `bugx_cli/infra/mcp_advisor.py` | MCP 服务连接诊断与建议器 | MCP 诊断向导 |
80
- | `bugx_cli/infra/security.py` | CLI 运行期工作区边界防御与安全守卫 | 路径注入防御 |
81
- | `bugx_cli/hosts/base.py` | CLI 宿主模板基础抽象 | 宿主模板基类 |
82
- | `bugx_cli/hosts/registry.py` | 宿主元数据与安装路径集中注册表 | 宿主配置清单 |
83
- | `bugx_cli/hosts/template_engine.py` | 宿主配置文件(JSON/TOML/YAML)安全模板渲染器 | 模板变量安全渲染 |
84
-
85
- ---
86
-
87
- ## 3. 设计原则
88
-
89
- - **开箱即用与容错引导**:遇到错误时优先输出修复建议,严禁直接打印原始 Python 栈追踪给最终用户。
90
- - **参数严格继承**:所有子命令统一遵循全局 `--root` 与 `--json` 参数规范,保证脚本调用的可组合性。
package/scripts/README.md DELETED
@@ -1,118 +0,0 @@
1
- # BugX 自动化与运维脚本体系 (Repository Tooling & Scripts)
2
-
3
- > 本文档为 BugX `scripts/` 目录的唯一权威工具脚本索引字典。收拢管理了仓库的预提交门禁、版本检查、测试选择器、打包发布等核心基座工具,以及五大专业子模块(基准评测、协议冒烟、验收验证、CVE 攻防、对抗靶场)共 80+ 个自动化工具。
4
-
5
- ---
6
-
7
- ## 1. 脚本分类与执行拓扑 (Scripts Taxonomy & Architecture)
8
-
9
- ```mermaid
10
- flowchart TD
11
- subgraph RootCore["scripts/ 根目录核心基座"]
12
- A1["pre_commit_check.py (提交流水线门禁)"]
13
- A2["test_selector.py (自适应差量定向测试引擎)"]
14
- A3["verify_directory_indices.py (全景索引防漂移校验)"]
15
- A4["bump_version.py (全局版本固定1.0.0守护)"]
16
- A5["arch_baseline.py (架构复杂度防恶化棘轮)"]
17
- A6["package_dist.py / export-production.py (打包分发)"]
18
- end
19
-
20
- subgraph Submodules["专业子目录体系 (Submodules)"]
21
- S1["benchmarks/ (性能压测与算法 A/B 评测)"]
22
- S2["smoke/ (宿主交互通道与 L1–L6 阶段协议闭环)"]
23
- S3["verification/ (验收证据核验与对抗闭环验证)"]
24
- S4["cve/ (自治 CVE 流水线与多语言安全审计)"]
25
- S5["adversarial/ (对抗靶场工程与验证矩阵)"]
26
- end
27
-
28
- RootCore --> Submodules
29
- ```
30
-
31
- ---
32
-
33
- ## 2. 常用开发与运维命令速查表 (High-Frequency Commands Quick Reference)
34
-
35
- | 场景与目标 | 推荐执行命令 | 核心功能说明 |
36
- | :--- | :--- | :--- |
37
- | **提交流水线门禁** | `python3 scripts/pre_commit_check.py` | 运行增量测试选择与全一致性检查,防未通过提交 |
38
- | **定向测试选择器** | `python3 scripts/test_selector.py --diff HEAD~1` | 按 Git 差异自动推导并仅运行受影响模块单测 |
39
- | **目录全景防漂移** | `python3 scripts/verify_directory_indices.py --check` | 验证 core/tests/scripts/interfaces/ecosystem 索引 100% 覆盖 |
40
- | **版本号一致性** | `python3 scripts/bump_version.py --check` | 校验 24 处版本号严格固定 1.0.0,杜绝版本漂移 |
41
- | **架构复杂度棘轮** | `python3 scripts/arch_baseline.py --check` | 防架构劣化与循环依赖引入,维持复杂度单调下降 |
42
- | **刷新签名镜像** | `python3 scripts/refresh_signed_mirrors.py` | 重建并刷新核心引擎完整性签名镜像清单 |
43
- | **宿主通道冒烟** | `python3 scripts/smoke/smoke_host_acp.py` | 验证宿主原生 ACP 协议通道与任务闭环 |
44
- | **自治 CVE 流水线** | `python3 scripts/cve/run_autonomous_cve_pipeline.py` | 触发端到端 CVE 漏洞挖掘、反事实验证与补丁合成 |
45
-
46
- ---
47
-
48
- ## 3. 专业子目录索引 (Modular Subdirectories)
49
-
50
- 为了实现系统化治理与高内聚解耦,特定领域的工具与演练套件已归入专业子目录:
51
-
52
- | 子目录 | 职责与收拢范围 | 详细文档指引 |
53
- | :--- | :--- | :--- |
54
- | `benchmarks/` | 性能评测、调度基准、A/B 实验、混沌压测与木桶效应基准测试器 | 参见 [benchmarks/README.md](benchmarks/README.md) |
55
- | `smoke/` | 宿主交互通道(ACP / Headless / Native Task / PTY)与 L1–L6 协议闭环探针 | 参见 [smoke/README.md](smoke/README.md) |
56
- | `verification/` | 标准化验收凭据核验、对抗闭环验证、检索调优与智能体实战效果验证 | 参见 [verification/README.md](verification/README.md) |
57
- | `cve/` | 自治 CVE 挖掘与补丁合成流水线、多语言全品类漏洞审计矩阵与攻防战役 | 参见 [cve/README.md](cve/README.md) |
58
- | `adversarial/` | 对抗性靶场项目自动生成工具与全链路多宿主验证矩阵 | 参见 [adversarial/README.md](adversarial/README.md) |
59
-
60
- ---
61
-
62
- ## 4. 根目录核心基座工具清单 (Root Infrastructure Scripts)
63
-
64
- ### 4.1 提交流水线与版本治理 (6 项)
65
- | 脚本工具 | 职责与使用场景 |
66
- | :--- | :--- |
67
- | `arch_baseline.py` | 架构复杂度与依赖健康度基线收集器与单向棘轮门禁 (Ratchet Guard) |
68
- | `bump_version.py` | 全局版本号声明检查与统一固定守护工具 (保持 1.0.0 与自增 Build ID) |
69
- | `ci_security_gate.py` | CI/CD 流水线安全阻断门禁与 `bugx audit --json` 结果解析桥梁 |
70
- | `dev_doc.py` | 开发文档与生命周期协同自动化 CLI (方案设计审计、受影响单测锁定、发版对齐) |
71
- | `pre_commit_check.py` | Git 提交流水线前置门禁 (按变更文件差量选择定向测试,阻断未注册与失败变更) |
72
- | `verify_directory_indices.py` | 全景索引防漂移校验工具,断言核心目录 README.md 100% 覆盖物理文件 |
73
- | `verify_doc_status.py` | 提案状态字段格式校验(唯一权威):词表 fail-closed,存量 UNKNOWN 必须登记于 `02_DOC_STATUS_BACKLOG.md` |
74
-
75
- ### 4.2 测试调度与规格一致性 (4 项)
76
- | 脚本工具 | 职责与使用场景 |
77
- | :--- | :--- |
78
- | `gen_interface_spec.py` | 包接口规格说明与防漂移校验生成器 (DOC-256 Phase 1) |
79
- | `init_specs.py` | BugX 子包 SPEC.md 接口规格自动化初始化与脚手架生成器 |
80
- | `refresh_signed_mirrors.py` | 刷新核心引擎完整性签名镜像清单 (`engine-integrity.json`) |
81
- | `test_selector.py` | 变更感知测试选择器 CLI(tests/engine 库的命令行薄壳,计算受影响测试白名单) |
82
-
83
- ### 4.3 打包分发与跨生态适配 (8 项)
84
- | 脚本工具 | 职责与使用场景 |
85
- | :--- | :--- |
86
- | `ensure-python.mjs` | Node.js 环境下 Python 3.11+ 解释器自动探测与缺失告警脚本 |
87
- | `export-production.py` | 开发仓向生产源仓单向导出脚本(DOC-033 边界治理) |
88
- | `isolate-npm-readme.mjs` | npm 发布专属轻量 README 生成与隔离处理脚本 |
89
- | `package_dist.py` | BugX 客户端统一打包分发工具(Pip Wheel/Sdist + NPM Tarball) |
90
- | `publish-gitea.sh` | 私有 Gitea 仓库镜像与制品发布 Shell 脚本 |
91
- | `sync-version.mjs` | Node.js npm package.json 与全局版本号同步对齐脚本 |
92
- | `sync_to_public.py` | 双轨同步与开源公共仓库边界治理工具 |
93
- | `test-npm-wrapper.mjs` | Node.js npm 包装器执行契约与 Python 解释器透传冒烟测试 |
94
-
95
- ### 4.4 宿主探针与运行时看门狗 (7 项)
96
- | 脚本工具 | 职责与使用场景 |
97
- | :--- | :--- |
98
- | `host_probe_path.py` | 宿主探针专用 PATH 环境变量动态探测与解析辅助器 |
99
- | `host_service_health.py` | 宿主常驻守护进程与服务健康状态探测器 |
100
- | `layer_ceiling_probe.py` | 按层核验 BugX 能力上限与防御天花板探测工具 |
101
- | `loop_probe.py` | 启动流程静态开环探测器(穷举 launch_bugx 逻辑路径发现死分支) |
102
- | `model_watchdog.py` | 模型额度与调用看门狗(配额耗尽时自适应切换候选模型) |
103
- | `README-watchdog.md` | 模型配额与看门狗运行时机制说明文档 |
104
- | `runtime.lock.json` | 运行时依赖版本与环境锁定元数据文件 |
105
-
106
- ---
107
-
108
- ## 5. 脚本开发与执行守卫规范 (Scripting Guidelines)
109
-
110
- 1. **原子性与退出码规范**:
111
- - 所有门禁脚本(`verify_*`, `pre_commit_*`, `arch_*`)在断言失败时必须返回**非零退出码(exit code 1)**,严禁吞咽异常;
112
- - 必须支持 `--help` 查看命令行参数说明;
113
- - 必须提供 `--check`(门禁断言模式)与 `--report`(排查报告模式)。
114
- 2. **严禁全盘发散扫描**:
115
- - 脚本内部严禁执行 `find ~`、`find /` 或无边界的磁盘扫描;搜索范围必须严格限制在当前工程根目录内。
116
- 3. **文档同步防漂移**:
117
- - 任何新增或删除脚本必须同步更新本文档与对应子目录 README;
118
- - `python3 scripts/verify_directory_indices.py --check` 会自动进行 100% 覆盖率验证!