bugx-cli 0.1.1__py3-none-any.whl
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.
- bugx_cli/__init__.py +6 -0
- bugx_cli/cli.py +1685 -0
- bugx_cli/commands/__init__.py +1 -0
- bugx_cli/commands/advisory.py +94 -0
- bugx_cli/commands/agent.py +4210 -0
- bugx_cli/commands/audit.py +632 -0
- bugx_cli/commands/autonomous.py +260 -0
- bugx_cli/commands/cloud.py +1371 -0
- bugx_cli/commands/daemon.py +50 -0
- bugx_cli/commands/doctor.py +1590 -0
- bugx_cli/commands/goal.py +107 -0
- bugx_cli/commands/interaction.py +248 -0
- bugx_cli/commands/knowledge.py +619 -0
- bugx_cli/commands/lifecycle.py +2763 -0
- bugx_cli/commands/patch.py +1014 -0
- bugx_cli/commands/plugin.py +2749 -0
- bugx_cli/commands/plugin_claude.py +1446 -0
- bugx_cli/commands/plugin_cline.py +269 -0
- bugx_cli/commands/plugin_codex.py +74 -0
- bugx_cli/commands/plugin_funide.py +729 -0
- bugx_cli/commands/plugin_qoder.py +216 -0
- bugx_cli/commands/plugin_zcode.py +710 -0
- bugx_cli/commands/project.py +670 -0
- bugx_cli/commands/report.py +256 -0
- bugx_cli/commands/skill.py +251 -0
- bugx_cli/commands/stats.py +133 -0
- bugx_cli/commands/system.py +2567 -0
- bugx_cli/common.py +906 -0
- bugx_cli/host_adapters.py +1892 -0
- bugx_cli/hosts/__init__.py +80 -0
- bugx_cli/hosts/base.py +99 -0
- bugx_cli/hosts/registry.py +573 -0
- bugx_cli/hosts/template_engine.py +188 -0
- bugx_cli/infra/__init__.py +209 -0
- bugx_cli/infra/ai_advisor.py +851 -0
- bugx_cli/infra/engine_installer.py +1945 -0
- bugx_cli/infra/host_sync.py +548 -0
- bugx_cli/infra/mcp_advisor.py +826 -0
- bugx_cli/infra/security.py +339 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/bugx-mcp-manifest.json +53 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/CATALOG.json +141 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/README.md +254 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/README.md +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/android-interaction.json +81 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/android.json +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/desktop-macos.json +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/ios-interaction.json +34 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/ios.json +23 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/memory-macos.json +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/README.md +51 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/__init__.py +146 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_artifacts.py +766 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_eval.py +1155 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_execution.py +718 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_orchestrator.py +1351 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_targets.py +877 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_workspace.py +770 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/feature_baseline.py +150 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/README.md +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/LICENSE-3RD-PARTY.txt +66 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/LICENSE.txt +362 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/UPSTREAM.md +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/axe.min.js +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-1024.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-512.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-tight.svg +23 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar.svg +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-cn.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-en.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-en.svg +74 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-zh.svg +74 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/codex.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/dsh.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/project-layout.md +42 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/zcode.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/README.md +37 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/manifest.json +94 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/00-scope.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/10-schema-inventory.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/20-query-and-integrity.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/80-evidence-regression.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/manifest.json +123 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/00-scope.md +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/10-process-model.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/20-package-integrity.md +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/30-ui-behavior.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/80-evidence-regression.md +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/memory-testing.md +227 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/manifest.json +155 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/android.md +19 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/h5.md +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/ios.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/miniprogram.md +26 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/webview.md +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/00-scope.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/10-platform-inventory.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/20-masvs-static.md +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/30-component-exposure.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/40-device-behavior.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/80-evidence-regression.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/manifest.json +127 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/00-scope.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/10-static-white-box.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/20-memory-concurrency.md +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/30-behavior-black-box.md +39 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/80-evidence-regression.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/platform-testing.md +174 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/manifest.json +191 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/graphql.md +5 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/h5.md +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/multi-tenant.md +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/oauth.md +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/upload.md +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/websocket.md +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/00-scope.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/10-discovery.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/20-auth-session.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/30-authz-business.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/40-input-output.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/50-state-async.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/60-file-ssrf-deser.md +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/70-config-dependency.md +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/80-evidence-regression.md +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/INTERFACE.md +61 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/README.md +58 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/__init__.py +109 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/attack_graph.py +1096 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/attack_graph_store.py +1868 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/audit_campaign.py +1232 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/behavior_graph.py +465 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/ghsa_advisories.py +174 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/models.py +93 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/mutator.py +87 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/patcher.py +126 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/scout.py +278 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/synthesizer.py +207 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/verifier.py +103 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/bugx.md +1299 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/bugx_paths.py +1881 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cli-help.txt +66 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/INTERFACE.md +32 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/README.md +62 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/__init__.py +23 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/auto_sync.py +398 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_client.py +1218 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_onboard.py +743 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_schema.py +648 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/consent.py +81 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/device_identity.py +307 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/endpoint_router.py +415 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/flywheel_client.py +769 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/network_transport.py +296 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/onboard_wizard.py +493 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sensitive_filter.py +285 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sync_pull.py +695 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sync_push.py +723 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/AGENT_GUIDE.md +359 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/README.md +34 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-blackbox.md +541 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-opencode.md +469 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-quick.md +44 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-runtime-contract.md +353 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-worker.md +470 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/engine_gap_contracts.py +473 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/README.md +70 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/__init__.py +106 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_ai_review.py +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_backfill.py +54 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_bootstrap.py +713 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_business.py +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_cli.py +715 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_discovery.py +1429 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_evidence.py +1024 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_forensics.py +124 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_gate.py +277 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_intelligence.py +734 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_manifest.py +396 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_platform.py +77 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_validate.py +241 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/module_coverage.py +157 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/INTERFACE.md +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/README.md +21 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/__init__.py +5 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/interaction_preset.py +408 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/engine-integrity.json +2797 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/README.md +49 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/__init__.py +82 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/concurrency_fuzzer.py +435 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/differential_oracle.py +1164 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/fuzz_input.py +1291 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/stateful_fuzzer.py +404 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/README.md +61 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/__init__.py +130 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/capacity_planner.py +124 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/dependency_lock.py +317 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/goal_governor.py +754 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/guide_budget.py +458 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/lockdown.sh +50 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/readonly_enforcer.py +154 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/runtime_tool_gate.py +373 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/secret_redactor.py +784 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/token_budget.py +38 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/INTERFACE.md +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/README.md +51 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/__init__.py +121 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/base.py +111 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/claude.py +99 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/cline.py +298 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/codex.py +300 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/dsh.py +106 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/opencode.py +209 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/pi.py +94 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/zcode.py +99 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/INTERFACE.md +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/README.md +62 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/__init__.py +21 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/adapters.py +412 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/autonomous_runner.py +1152 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/cline.py +448 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/common.py +103 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/free_models.py +786 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_bootstrap.py +389 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_evaluators.py +761 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_probe.py +41 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_provider_arbitrator.py +831 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_registry.py +662 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_usage.py +127 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/mcp_process_tracker.py +509 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/mcp_registry_gate.py +379 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/pi.py +102 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/provider_facts.py +66 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/INTERFACE.md +51 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/README.md +67 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/__init__.py +140 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_base_usage.py +152 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_codex_usage.py +297 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_dsh_usage.py +184 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_mcp_toml.py +365 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_zcode_usage.py +269 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/base.py +479 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/claude.py +212 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/cline.py +229 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/codex.py +1006 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/dsh.py +526 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/opencode.py +358 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/pi.py +308 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/zcode.py +219 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/i18n.py +252 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/README.md +41 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/__init__.py +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/build_info.py +105 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/client_metadata.py +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/json_utils.py +22 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/python_runtime.py +540 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/safe_xml.py +221 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_bugx.py +118 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/INTERFACE.md +31 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/README.md +106 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/__init__.py +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/candidate_revalidation.py +484 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/common.py +1060 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/finding_confirm_phase.py +391 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/finding_settlement.py +1432 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/findings_adjudication.py +666 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/findings_snapshot.py +357 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/judge_phase.py +848 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/lesson_context.py +536 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/lifecycle_reporter.py +627 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/orchestrator_controls.py +686 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_commit.py +567 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_coverage_sync.py +598 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_dry_run.py +817 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_observability.py +367 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_phase.py +1223 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_receipt.py +373 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_round_lifecycle.py +786 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_phase.py +1029 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_recon_scout.py +879 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_state_builder.py +1133 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/report_sharing.py +414 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/round_orchestrator.py +1116 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/session_runtime.py +1670 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_gates.py +1050 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_interaction.py +1003 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_version_gate.py +879 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_bridge.py +1253 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_coverage.py +423 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_degraded.py +1211 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_barriers.py +424 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_orchestrator.py +1246 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_prior.py +749 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/INTERFACE.md +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/README.md +160 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/__init__.py +67 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/_facade.py +227 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/archive_ops.py +630 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/auto_materialization.py +459 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/bug-log.md +22 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/cli.py +275 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/export_ops.py +554 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_confirmation.py +1316 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_io.py +299 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_lifecycle.py +730 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_verification.py +405 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/incidents.py +1005 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson-replay-cases.json +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson_ledger.py +241 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson_replay.py +272 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/life_ledger.py +668 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/mistake-book.md +130 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/patterns.py +684 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/receipt_contract.py +269 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/schema.py +1192 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/sync_ops.py +940 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/tool_experience.py +683 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/verify_life.py +1597 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/lesson-ledger.json +275 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/README.md +19 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/en-US.json +462 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/zh-CN.json +462 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/INTERFACE.md +75 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/README.md +62 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/__init__.py +128 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/base.py +717 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/channel_lifecycle.py +751 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/graph_handlers.py +222 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/knowledge_handlers.py +536 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/mining_handlers.py +586 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/resource_prompt_table.py +116 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/retrieval_handlers.py +249 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/rpc_server.py +470 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/supervisor_handlers.py +1461 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/telemetry_handlers.py +227 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/tool_table.py +1030 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/README.md +21 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/__init__.py +1 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/common.py +363 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/environment.py +567 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/verifier.py +758 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/metadata.txt +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/README.md +157 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/__init__.py +242 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/capability_plan.py +187 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/capability_planner.py +195 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/domain_archetype.py +542 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/domain_router.py +269 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/dynamic_flow_analyzer.py +533 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/impact_pruner.py +435 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/intent_adjudicator.py +175 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/judge_pipeline.py +1246 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/logic_analysis.py +419 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/prompt_harness.py +1704 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/source_inspector.py +267 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/spec_harvester.py +449 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/target_sandbox_manager.py +573 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/test_capability_verifier.py +1364 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/tools-kb.md +38 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/unit_kind.py +122 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/INTERFACE.md +83 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/README.md +51 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/SPEC.md +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/__init__.py +76 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/android_probe.py +552 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/base.py +147 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/codebase_memory_probe.py +647 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/desktop_probe.py +342 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/differential_probe.py +434 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/efficiency_probe.py +232 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ios_binary_probe.py +472 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/memory_probe.py +392 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/miniprogram_probe.py +385 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/mobile_probe.py +466 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/native_probe.py +302 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/openwiki_probe.py +263 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/pattern_probe.py +453 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/platform_probe.py +424 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/probe_registry.py +1770 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_fixture_corpus.py +340 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_probe.py +1510 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_rules.py +1481 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sca_scanner.py +779 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_accessibility.py +149 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_audit.py +513 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_contract.py +273 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_evidence.py +212 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_measurements.py +314 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_repair.py +250 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_review.py +133 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_storybook.py +107 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_tokens.py +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_visual_diff.py +131 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/web_probe.py +714 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/INTERFACE.md +62 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/README.md +53 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/SPEC.md +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/__init__.py +201 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/arbitrator.py +316 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/constants.py +247 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/detector.py +399 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/extractors.py +836 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/fingerprint.py +116 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/storage.py +258 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/strategy.py +301 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/README.md +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/codex_dialog_dispatch.md +9 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/command_routing_en.md +42 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/command_routing_zh.md +42 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/l0_router.md +47 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/anti_patterns.md +16 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/concurrency_rules.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/memory_leak_rules.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/prompt_injection_defense.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_explore.md +31 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_gate.md +43 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_mutate.md +42 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_repair.md +85 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/README.md +74 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/__init__.py +169 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/fix_watchlist.py +391 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_dynamic.py +418 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_repair_loop.py +462 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_selfcheck.py +862 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/minimize_repro.py +466 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/patch_synthesizer.py +617 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/regression_pack.py +379 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_fixer.py +910 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_loop.py +311 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_repair.py +348 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_rounds.py +212 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_scope.py +281 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/self_heal.py +604 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_generator.py +1108 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_quality_auditor.py +410 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_strategy.py +511 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/INTERFACE.md +59 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/README.md +69 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/SPEC.md +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/__init__.py +47 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/attestation.py +228 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/authority.py +255 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/finding_report.py +418 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/formal_report_builder.py +924 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/html_renderers.py +696 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/models.py +759 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/pdf_exporter.py +231 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/projects_assets.py +730 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_client.py +743 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_data_builder.py +388 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_share.py +459 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/sast_bridge.py +116 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/server.py +832 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/visual_report_builder.py +796 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/web-conformance.md +168 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/web_conformance.py +428 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/workbench_assets.py +484 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/INTERFACE.md +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/README.md +161 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/__init__.py +3 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/code_analyzer.py +1720 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/codebase_memory_bridge.py +337 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/context_assembler.py +240 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/corpus_fetch.py +369 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/graph_ego.py +597 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_auto.py +662 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_sources.py +168 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_sync.py +1003 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/memory_store.py +480 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/query_planner.py +1020 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/rrf_engine.py +137 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_extractor.py +1209 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_normalizer.py +373 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_spec.py +357 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/symbol_index.py +1151 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/universal_code_matcher.py +622 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/xerj_bridge.py +476 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/xerj_supervisor.py +362 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/README.md +33 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/PROVENANCE.json +30 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/crypto.yaml +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/network.yaml +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/resilience.yaml +47 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/storage.yaml +48 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/LICENSE +173 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/PROVENANCE.json +270 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-asymmetric-key-pair-used-for-multiple-purposes.yml +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-backup-manifest.yml +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-event-bound.yml +49 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-invalidated-enrollment.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-no-confirmation-required.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-validity-duration.yml +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-broken-encryption-algorithms.yaml +9 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-broken-encryption-modes.yaml +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-content-provider-exported.yml +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-custom-deeplink-scheme.yml +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-dangerous-app-permissions.yaml +65 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-data-unencrypted-shared-storage-no-user-interaction-apis.yml +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-data-unencrypted-shared-storage-no-user-interaction-manifest.yml +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-debuggable-flag.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-debugger-checks.yml +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-deeplink-autoverify-missing.yml +33 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-deeplink-unvalidated-parameter.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-device-passcode-present.yml +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-fileprovider-broad-scope.yml +46 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-hardcoded-crypto-keys-usage.yml +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-hardcoded-security-provider.yaml +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-implicit-intent-internal-communication.yml +30 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-implicit-intent-leaking-extras.yml +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-input-field-usage.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-key-generation-with-insufficient-key-length.yml +21 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-keyboard-cache-input-types.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-local-storage-input-validation.yml +48 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-native-debugger-checks.yml +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-checkservertrusted.yml +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-hostname-verification.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-insecure-trust-anchors.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-onreceivedsslerror.yml +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-non-random-use.yml +16 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-object-deserialization.yml +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-overlay-protection.yml +68 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-pendingintent-mutable.yml +39 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-random-apis-insufficient-entropy.yml +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-root-detection.yaml +59 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sdk-version.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-notifications-manifest.yml +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-notifications.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-screenshot.yml +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sql-injection-contentprovider.yml +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-ssl-socket-hostnameverifier.yml +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-strictmode.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-system-alert-window.yml +9 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-allow-local-access.yml +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-bridges.yml +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-safebrowsing.yml +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-url-handlers.yml +41 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/PROVENANCE.json +26 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/network.yaml +37 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/platform.yaml +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/storage.yaml +48 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/LICENSE +165 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/PROVENANCE.json +58 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/auth.yaml +59 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/crypto.yaml +66 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/jailbreak.yaml +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/keyboard.yaml +34 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/logging.yaml +23 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/network.yaml +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/resilience.yaml +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/secrets.yaml +33 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/storage.yaml +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/webview.yaml +32 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/README.md +198 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/__init__.py +3 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/bugx_logging.py +1464 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/daemon_runner.py +623 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/fixture_solidify.py +444 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/global_telemetry.py +549 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/incident_eval.py +148 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interaction.py +605 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interaction_store.py +435 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interactive_menu.py +95 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/log_analytics.py +922 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/mining_quality_framework.py +1387 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/model_runner.py +732 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/platform_adapter.py +579 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/prep_validate.py +478 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_graph.py +827 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_init.py +481 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_profile.py +224 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_settings.py +964 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/provider_window.py +97 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/resume_ticket.py +115 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/scenario_eval.py +856 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/seed_drill.py +549 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/self_audit.py +550 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/session_profile.py +205 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/setup_ui_env.py +229 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/startup_environment.py +859 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/sync_store.py +1421 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/tool_install_targets.py +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/README.md +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/agent-graph.schema.json +368 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/attack-graph.schema.json +88 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/evidence-bundle.schema.json +33 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/skill-pack.schema.json +230 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/worker-checkpoint.schema.json +119 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/secure_atomic.py +289 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/README.md +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/c.txt +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/cpp.txt +32 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/css.txt +70 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/go.txt +46 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/java.txt +30 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/javascript.txt +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/kotlin.txt +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/python.txt +71 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/rust.txt +53 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/swift.txt +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/typescript.txt +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/README.md +53 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/__init__.py +189 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/bugx_docs_mcp_server.py +418 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/bugx_mcp_server.py +1161 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mcp_runtime.py +968 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mcp_session_proof.py +605 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mobile_ui_inspector.py +405 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/skill_pack.py +1214 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/skill_synthesizer.py +1153 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/tools_kb.py +313 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/INTERFACE.md +121 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/README.md +209 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/__init__.py +175 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/audit_supervisor.py +1015 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/budget_governor.py +1254 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_handler.py +368 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_pipeline.py +1564 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_sync.py +653 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/claim_events.py +74 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/claim_sync.py +590 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/cli.py +812 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/context_sync.py +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/coverage_sync.py +115 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_commit.py +470 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_sync.py +688 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_workflow.py +676 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finish_policy.py +224 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finish_sync.py +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/graph_sync.py +669 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/lease_manager.py +788 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/lifecycle_blocks.py +129 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/next_round_sync.py +126 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/observability.py +140 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/recovery_sync.py +165 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/rejection_remedies.py +355 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/round_governor.py +306 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/serial_authorization.py +544 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/start_sync.py +87 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/state_store.py +249 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/supervisor_host.py +511 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/supervisor_models.py +1143 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/systemic_failure.py +104 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/task_scheduler.py +1640 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_checkpoint.py +230 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_execution.py +265 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_handoff.py +192 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_lifecycle.py +396 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_runtime.py +1005 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_sync.py +89 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/README.md +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/__init__.py +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/exceptions.py +52 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/graph_models.py +357 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/path_containment.py +151 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/target_fingerprint.py +310 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/worker_claim.py +411 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/INTERFACE.md +50 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/README.md +57 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/SPEC.md +26 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/__init__.py +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/__init__.py +27 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/base.py +87 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/bugx.py +102 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/claude.py +222 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/cline.py +407 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/codex.py +260 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/dsh.py +177 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/opencode.py +218 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/pi.py +272 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/registry.py +100 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/zcode.py +312 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/api_routes_post.py +668 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/dispatcher.py +1376 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/docs_session_service.py +473 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/handler.py +674 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/ide_cloud_service.py +526 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/mcp_inspector.py +1747 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/00-base.css +1060 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/01-monitoring.css +802 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/02-header-actions.css +321 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/03-trigger-popover.css +697 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/04-composer.css +628 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/05-skills-center.css +878 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/06-mcp-center.css +623 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/07-skill-detail.css +265 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/08-files-management.css +167 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/09-files-center.css +386 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/10-icons.css +105 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/11-project-options.css +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/12-profile-tab.css +383 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/index-CXAsl8mr.js +333 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/index-DHQUtWtx.css +1 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-400-normal-B8Z6Jvzv.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-400-normal-C44pakCn.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-500-normal-Bb4u56_6.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-500-normal-BdVUvljg.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-ext-400-normal-CWV284fw.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-ext-400-normal-DLkyKLvH.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-ext-500-normal-8-8HP2PF.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-ext-500-normal-DaDZE_Na.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-400-normal-BccYJ-vZ.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-400-normal-Cw5-AHNN.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-500-normal-By8GFJzz.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-500-normal-z-Q6FFuG.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-400-normal-DJ5YJwmz.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-400-normal-Dn3IlU-Z.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-500-normal-CUHe9xxf.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-500-normal-DVVamBqs.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-ext-400-normal-CEpydyUl.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-ext-400-normal-Cp7z-ARB.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-ext-500-normal-BYjRCDVy.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-ext-500-normal-D-qasQTj.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-400-normal-BbG3LG1A.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-400-normal-DR1UuFon.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-500-normal-8N8MYVKB.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-500-normal-Bi3OSTTW.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/design-tokens.css +113 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/favicon.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/icon-192.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/index.html +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/manifest.webmanifest +19 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/project-settings.js +9602 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/sw.js +8 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/workspace_service.py +218 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/agents/bugx.md +27 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/dsh-patch.yml +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/cordis.patch.yml +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/index.js +219 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/package.json +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/skills/bugx/SKILL.md +70 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/skills/bugx-dsh/SKILL.md +229 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/client.js +87 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/cordis.patch.yml +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/index.js +7 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/package.json +27 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/mcp-lock.json +3075 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/opencode.json +129 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/README.md +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/index.ts +299 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/manifest.json +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/pi/skills/bugx/SKILL.md +69 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-claude/SKILL.md +326 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-opencode/SKILL.md +129 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-zcode/SKILL.md +459 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/connector-meta.json +19 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/icon.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/skills/bugx/SKILL.md +70 -0
- bugx_cli-0.1.1.dist-info/METADATA +335 -0
- bugx_cli-0.1.1.dist-info/RECORD +762 -0
- bugx_cli-0.1.1.dist-info/WHEEL +5 -0
- bugx_cli-0.1.1.dist-info/entry_points.txt +2 -0
- bugx_cli-0.1.1.dist-info/licenses/LICENSE +55 -0
- bugx_cli-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""受控创建 BugX 生命周期覆盖清单。
|
|
3
|
+
|
|
4
|
+
覆盖清单是启动门禁的输入,不是宿主发现器的输出。这个模块只负责一次性
|
|
5
|
+
的引导创建,并把写入边界与 Supervisor MCP、launch_bugx 共用,避免两个入口
|
|
6
|
+
出现不同的安全判定。
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import hashlib
|
|
12
|
+
import json
|
|
13
|
+
import os
|
|
14
|
+
from dataclasses import replace
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
import core.bugx_paths as bugx_paths
|
|
18
|
+
from core.coverage import module_coverage
|
|
19
|
+
from core.retrieval import symbol_index
|
|
20
|
+
import core.secure_atomic as secure_atomic
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# DES-02:清单发现元数据的读取原语属于「清单格式」的归属方 module_coverage,
|
|
24
|
+
# 已下沉到那里;本模块按需再导出,保持 coverage_bootstrap.<name> 对外可用。
|
|
25
|
+
from core.coverage.module_coverage import ( # noqa: F401 (re-export)
|
|
26
|
+
DISCOVERY_METADATA_END,
|
|
27
|
+
DISCOVERY_METADATA_START,
|
|
28
|
+
bounded_errors,
|
|
29
|
+
build_discovery_metadata,
|
|
30
|
+
manifest_discovery_metadata,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
MANIFEST_NAME = "module-coverage.md"
|
|
35
|
+
INHERIT_NOTE_MARK = "inherited_from="
|
|
36
|
+
_TABLE_HEADER = (
|
|
37
|
+
"| # | 阶段 | 父模块 | 模块 | 路径/范围 | 参与单元 | 最小性 | 难度 | 命中 | "
|
|
38
|
+
"主工具 | 负责任务 | 依赖 | 状态 | 发现数 | 证据/测试 | 备注 |\n"
|
|
39
|
+
"|---|------|--------|------|-----------|----------|--------|------|------|"
|
|
40
|
+
"--------|----------|------|------|--------|-----------|------|\n"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class CoverageBootstrapError(RuntimeError):
|
|
45
|
+
"""覆盖清单不能由当前受控引导安全创建。"""
|
|
46
|
+
|
|
47
|
+
def __init__(self, message: str, *, code: str = "COVERAGE_BOOTSTRAP_FAILED") -> None:
|
|
48
|
+
super().__init__(message)
|
|
49
|
+
self.code = code
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _is_partial_parse_failure(exc: BaseException) -> bool:
|
|
53
|
+
"""Only parser-partial failures may use the file-level fallback.
|
|
54
|
+
|
|
55
|
+
Enumeration, permission, and root-layout failures must remain fail-closed;
|
|
56
|
+
silently turning those into a smaller file list would create false coverage.
|
|
57
|
+
"""
|
|
58
|
+
detail = str(exc)
|
|
59
|
+
return any(marker in detail for marker in (
|
|
60
|
+
"源码解析不完整", "Tree-sitter", "语法树包含 ERROR", "语法解析",
|
|
61
|
+
))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def manifest_path(root: Path) -> Path:
|
|
65
|
+
"""Return the active lifecycle manifest and validate the project layout."""
|
|
66
|
+
return bugx_paths.require(root).state_root / MANIFEST_NAME
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _read_json(path: Path) -> dict[str, object] | None:
|
|
70
|
+
if path.is_symlink() or not path.is_file():
|
|
71
|
+
return None
|
|
72
|
+
try:
|
|
73
|
+
value = json.loads(path.read_text(encoding="utf-8"))
|
|
74
|
+
except (OSError, UnicodeError, json.JSONDecodeError):
|
|
75
|
+
return None
|
|
76
|
+
return value if isinstance(value, dict) else None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _plan_hash_for_manifest(manifest: Path) -> str | None:
|
|
80
|
+
try:
|
|
81
|
+
if manifest.is_symlink() or not manifest.is_file():
|
|
82
|
+
return None
|
|
83
|
+
return hashlib.sha256(manifest.read_bytes()).hexdigest()
|
|
84
|
+
except OSError:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def _debt_from_rows(rows: list) -> dict[str, object]:
|
|
89
|
+
"""按 DOC-011 §5.2/§5.4 分类覆盖债务:单元级 vs 已终态 vs 阻塞。"""
|
|
90
|
+
by_status: dict[str, int] = {}
|
|
91
|
+
for row in rows:
|
|
92
|
+
status = getattr(row, "status", "") or ""
|
|
93
|
+
by_status[status] = by_status.get(status, 0) + 1
|
|
94
|
+
total = len(rows)
|
|
95
|
+
covered = by_status.get("已覆盖", 0)
|
|
96
|
+
# 中文清单:未覆盖/挖掘中/挂起 均为单元级债务;已覆盖为终态
|
|
97
|
+
unit_debt = total - covered
|
|
98
|
+
return {
|
|
99
|
+
"total": total,
|
|
100
|
+
"covered": covered,
|
|
101
|
+
"unit_debt": unit_debt,
|
|
102
|
+
"by_status": by_status,
|
|
103
|
+
"has_unit_debt": unit_debt > 0,
|
|
104
|
+
"has_global_block": False,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def inspect(root: Path) -> dict[str, object]:
|
|
109
|
+
"""Describe whether the current lifecycle needs an explicit bootstrap."""
|
|
110
|
+
root = root.expanduser().resolve()
|
|
111
|
+
scope = bugx_paths.require(root)
|
|
112
|
+
manifest = scope.state_root / MANIFEST_NAME
|
|
113
|
+
if manifest.is_symlink():
|
|
114
|
+
return {
|
|
115
|
+
"ready": False,
|
|
116
|
+
"needs_bootstrap": False,
|
|
117
|
+
"blocked": True,
|
|
118
|
+
"code": "COVERAGE_MANIFEST_SYMLINK",
|
|
119
|
+
"path": str(manifest),
|
|
120
|
+
"detail": f"拒绝使用符号链接覆盖清单: {manifest}",
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
rows: list[dict[str, object]] = []
|
|
124
|
+
errors: list[str] = []
|
|
125
|
+
if manifest.is_file():
|
|
126
|
+
try:
|
|
127
|
+
rows, errors = module_coverage.parse_manifest(manifest)
|
|
128
|
+
except (OSError, UnicodeError, ValueError) as exc:
|
|
129
|
+
errors = [str(exc)]
|
|
130
|
+
if rows and not errors:
|
|
131
|
+
# 对账检查:当前清单中的内部 scope 集合 vs 当前工作区实际发现的 units
|
|
132
|
+
manifest_internal_scopes = {
|
|
133
|
+
getattr(r, "path", "").strip().strip("`").rstrip("/")
|
|
134
|
+
for r in rows if getattr(r, "phase", "") == "内部"
|
|
135
|
+
}
|
|
136
|
+
manifest_internal_scopes = {s for s in manifest_internal_scopes if s and s not in {"-", "待定", "N/A"}}
|
|
137
|
+
|
|
138
|
+
discovery_meta = manifest_discovery_metadata(manifest)
|
|
139
|
+
use_symbols = discovery_meta.get("discovery_mode") not in {"files", "files-only"}
|
|
140
|
+
try:
|
|
141
|
+
current_units = module_coverage.discovery_units(root, symbols=use_symbols, strict=False)
|
|
142
|
+
current_errors = [u for u in current_units if u.get("error")]
|
|
143
|
+
if current_errors or not current_units:
|
|
144
|
+
# 扫描报错或无单元(避免误把扫描异常当成幽灵行)
|
|
145
|
+
current_scopes = None
|
|
146
|
+
else:
|
|
147
|
+
current_scopes = {str(u["scope"]).strip().strip("`").rstrip("/") for u in current_units}
|
|
148
|
+
except Exception:
|
|
149
|
+
current_scopes = None
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
current = bugx_paths.read_current(root)
|
|
153
|
+
polling_id = current.get("polling_id")
|
|
154
|
+
lifecycle_id = current.get("lifecycle_id")
|
|
155
|
+
except Exception:
|
|
156
|
+
polling_id = lifecycle_id = None
|
|
157
|
+
|
|
158
|
+
if current_scopes is not None and manifest_internal_scopes != current_scopes:
|
|
159
|
+
added = sorted(current_scopes - manifest_internal_scopes)
|
|
160
|
+
removed = sorted(manifest_internal_scopes - current_scopes)
|
|
161
|
+
return {
|
|
162
|
+
"ready": False,
|
|
163
|
+
"needs_bootstrap": False,
|
|
164
|
+
"needs_reconcile": True,
|
|
165
|
+
"blocked": False,
|
|
166
|
+
"code": "COVERAGE_MANIFEST_DRIFTED",
|
|
167
|
+
"path": str(manifest),
|
|
168
|
+
"units": len(rows),
|
|
169
|
+
"debt": _debt_from_rows(rows),
|
|
170
|
+
"plan_hash": _plan_hash_for_manifest(manifest),
|
|
171
|
+
"drift_details": {
|
|
172
|
+
"added": added,
|
|
173
|
+
"removed": removed,
|
|
174
|
+
},
|
|
175
|
+
"detail": f"覆盖清单与工作区代码发现漂移:新增 {len(added)} 项,失效幽灵行 {len(removed)} 项,需执行增量对账",
|
|
176
|
+
"session_id": polling_id,
|
|
177
|
+
"lifecycle_id": lifecycle_id,
|
|
178
|
+
**discovery_meta,
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
"ready": True,
|
|
183
|
+
"needs_bootstrap": False,
|
|
184
|
+
"blocked": False,
|
|
185
|
+
"path": str(manifest),
|
|
186
|
+
"units": len(rows),
|
|
187
|
+
"debt": _debt_from_rows(rows),
|
|
188
|
+
"plan_hash": _plan_hash_for_manifest(manifest),
|
|
189
|
+
"session_id": polling_id,
|
|
190
|
+
"lifecycle_id": lifecycle_id,
|
|
191
|
+
**discovery_meta,
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
runtime_exists = scope.runtime.exists() or scope.runtime.is_symlink()
|
|
195
|
+
runtime = _read_json(scope.runtime)
|
|
196
|
+
if runtime_exists and runtime is None:
|
|
197
|
+
return {
|
|
198
|
+
"ready": False,
|
|
199
|
+
"needs_bootstrap": False,
|
|
200
|
+
"blocked": True,
|
|
201
|
+
"code": "COVERAGE_BOOTSTRAP_RUNTIME_INVALID",
|
|
202
|
+
"path": str(manifest),
|
|
203
|
+
"detail": f"运行计时文件损坏或不安全,拒绝先写覆盖清单: {scope.runtime}",
|
|
204
|
+
}
|
|
205
|
+
runtime = runtime or {}
|
|
206
|
+
active = bool(scope.supervisor.is_file() or runtime.get("state") in {"running", "paused"})
|
|
207
|
+
detail = "覆盖清单缺失或没有可调度单元"
|
|
208
|
+
if errors:
|
|
209
|
+
detail = "覆盖清单无法解析:" + "; ".join(str(item) for item in errors[:3])
|
|
210
|
+
if active:
|
|
211
|
+
return {
|
|
212
|
+
"ready": False,
|
|
213
|
+
"needs_bootstrap": False,
|
|
214
|
+
"blocked": True,
|
|
215
|
+
"code": "COVERAGE_BOOTSTRAP_ACTIVE_LIFECYCLE",
|
|
216
|
+
"path": str(manifest),
|
|
217
|
+
"detail": detail + ";当前生命周期已有运行锚点,拒绝自动重建",
|
|
218
|
+
"debt": _debt_from_rows(rows) if rows else {"total": 0, "covered": 0, "unit_debt": 0, "by_status": {}, "has_unit_debt": False, "has_global_block": False},
|
|
219
|
+
}
|
|
220
|
+
# 覆盖债务分类:即使需要引导,也返回待处理债务明细,便于 Round 计划
|
|
221
|
+
debt = _debt_from_rows(rows) if rows else {"total": 0, "covered": 0, "unit_debt": 0, "by_status": {}, "has_unit_debt": False, "has_global_block": False}
|
|
222
|
+
return {
|
|
223
|
+
"ready": False,
|
|
224
|
+
"needs_bootstrap": True,
|
|
225
|
+
"blocked": False,
|
|
226
|
+
"path": str(manifest),
|
|
227
|
+
"detail": detail,
|
|
228
|
+
"debt": debt,
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def _previous_manifest(manifest: Path) -> Path | None:
|
|
233
|
+
"""Find the newest valid sibling lifecycle manifest, if any."""
|
|
234
|
+
lifecycles = manifest.parent.parent.parent
|
|
235
|
+
if not lifecycles.is_dir() or lifecycles.is_symlink():
|
|
236
|
+
return None
|
|
237
|
+
current = manifest.parent.parent.name
|
|
238
|
+
|
|
239
|
+
def number(path: Path) -> int:
|
|
240
|
+
try:
|
|
241
|
+
return int(path.name.rsplit("-", 1)[1])
|
|
242
|
+
except (IndexError, ValueError):
|
|
243
|
+
return 0
|
|
244
|
+
|
|
245
|
+
for candidate in sorted(
|
|
246
|
+
(item for item in lifecycles.iterdir() if item.is_dir() and not item.is_symlink()),
|
|
247
|
+
key=number,
|
|
248
|
+
reverse=True,
|
|
249
|
+
):
|
|
250
|
+
if candidate.name == current:
|
|
251
|
+
continue
|
|
252
|
+
source = candidate / "state" / MANIFEST_NAME
|
|
253
|
+
if source.is_symlink() or not source.is_file():
|
|
254
|
+
continue
|
|
255
|
+
try:
|
|
256
|
+
rows, errors = module_coverage.parse_manifest(source)
|
|
257
|
+
except (OSError, UnicodeError, ValueError):
|
|
258
|
+
continue
|
|
259
|
+
if rows and not errors:
|
|
260
|
+
return source
|
|
261
|
+
return None
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def _find_project_root_from_manifest(manifest: Path) -> Path:
|
|
265
|
+
p = manifest.resolve()
|
|
266
|
+
while p != p.parent:
|
|
267
|
+
if p.name == ".bugx":
|
|
268
|
+
return p.parent
|
|
269
|
+
p = p.parent
|
|
270
|
+
return Path.cwd().resolve()
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def _inheritable_unit_id(row: object) -> str:
|
|
274
|
+
"""Return the stable cross-Session identity of an internal unit.
|
|
275
|
+
|
|
276
|
+
单元编号(#)每个 Session 重新分配,不能作为继承键;跨 Session 稳定的
|
|
277
|
+
只有内部单元的 scope 字符串(``path`` 或 ``path::symbol``)。scope 缺失
|
|
278
|
+
(业务链路行等)或为占位值时返回空串,绝不猜测映射。
|
|
279
|
+
"""
|
|
280
|
+
unit_id = getattr(row, "path", "") or ""
|
|
281
|
+
unit_id = unit_id.strip().strip("`").rstrip("/")
|
|
282
|
+
if not unit_id or unit_id in {"-", "待定", "N/A"}:
|
|
283
|
+
return ""
|
|
284
|
+
return unit_id
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def historical_unit_verdicts(
|
|
288
|
+
root: Path, *, exclude_polling: str | None = None,
|
|
289
|
+
) -> dict[str, dict[str, object]]:
|
|
290
|
+
"""Collect the newest per-unit verdict from previous Sessions' manifests.
|
|
291
|
+
|
|
292
|
+
只读扫描 ``.bugx/pollings/*/lifecycles/*/state/<MANIFEST_NAME>``(默认排除
|
|
293
|
+
当前 polling),按 polling/lifecycle 编号升序遍历、后写覆盖先写,因此每个
|
|
294
|
+
内部单元 id 保留的是「最近一次判定」(含后来被增量重扫重置回未覆盖的)。
|
|
295
|
+
任何解析失败、符号链接或布局异常的历史清单都被跳过,绝不让历史扫描阻断
|
|
296
|
+
引导创建。
|
|
297
|
+
"""
|
|
298
|
+
verdicts: dict[str, dict[str, object]] = {}
|
|
299
|
+
try:
|
|
300
|
+
pollings = bugx_paths.bugx_root(root) / "pollings"
|
|
301
|
+
if not pollings.is_dir() or pollings.is_symlink():
|
|
302
|
+
return verdicts
|
|
303
|
+
|
|
304
|
+
def number(name: str) -> int:
|
|
305
|
+
try:
|
|
306
|
+
return int(name.rsplit("-", 1)[1])
|
|
307
|
+
except (IndexError, ValueError):
|
|
308
|
+
return 0
|
|
309
|
+
|
|
310
|
+
for polling in sorted(
|
|
311
|
+
(item for item in pollings.iterdir()
|
|
312
|
+
if item.is_dir() and not item.is_symlink()
|
|
313
|
+
and bugx_paths.POLLING_ID_RE.fullmatch(item.name)),
|
|
314
|
+
key=lambda item: number(item.name),
|
|
315
|
+
):
|
|
316
|
+
if exclude_polling and polling.name == exclude_polling:
|
|
317
|
+
continue
|
|
318
|
+
lifecycles = polling / "lifecycles"
|
|
319
|
+
if not lifecycles.is_dir() or lifecycles.is_symlink():
|
|
320
|
+
continue
|
|
321
|
+
for lifecycle in sorted(
|
|
322
|
+
(item for item in lifecycles.iterdir()
|
|
323
|
+
if item.is_dir() and not item.is_symlink()
|
|
324
|
+
and bugx_paths.LIFECYCLE_ID_RE.fullmatch(item.name)),
|
|
325
|
+
key=lambda item: number(item.name),
|
|
326
|
+
):
|
|
327
|
+
source = lifecycle / "state" / MANIFEST_NAME
|
|
328
|
+
if source.is_symlink() or not source.is_file():
|
|
329
|
+
continue
|
|
330
|
+
try:
|
|
331
|
+
rows, errors = module_coverage.parse_manifest(source)
|
|
332
|
+
except (OSError, UnicodeError, ValueError):
|
|
333
|
+
continue
|
|
334
|
+
if errors:
|
|
335
|
+
continue
|
|
336
|
+
for row in rows:
|
|
337
|
+
if getattr(row, "phase", "") != "内部":
|
|
338
|
+
continue
|
|
339
|
+
unit_id = _inheritable_unit_id(row)
|
|
340
|
+
if not unit_id:
|
|
341
|
+
continue
|
|
342
|
+
verdicts[unit_id] = {
|
|
343
|
+
"polling_id": polling.name,
|
|
344
|
+
"lifecycle_id": lifecycle.name,
|
|
345
|
+
"status": getattr(row, "status", ""),
|
|
346
|
+
"row": row,
|
|
347
|
+
}
|
|
348
|
+
except OSError:
|
|
349
|
+
# 历史扫描是纯增益:读不到历史就全量 pending,不影响引导安全。
|
|
350
|
+
return verdicts
|
|
351
|
+
return verdicts
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def apply_inherited_coverage(
|
|
355
|
+
discovered: list[str], verdicts: dict[str, dict[str, object]],
|
|
356
|
+
) -> tuple[list[str], dict[str, object]]:
|
|
357
|
+
"""Flip freshly discovered units whose latest historical verdict is covered.
|
|
358
|
+
|
|
359
|
+
继承只影响状态位:``状态→已覆盖``,``证据/测试``与``发现数``保留原
|
|
360
|
+
lifecycle 的可追溯值(证据仍属原 lifecycle,可通过 ``inherited_from``
|
|
361
|
+
备注追溯),其余计划字段(编号/难度/工具/内容哈希)全部来自本次发现。
|
|
362
|
+
最近一次判定不是 covered(未覆盖/挖掘中/挂起/未知)的单元保持 pending。
|
|
363
|
+
"""
|
|
364
|
+
summary: dict[str, object] = {"enabled": True, "applied": 0, "sources": {}}
|
|
365
|
+
if not verdicts:
|
|
366
|
+
return list(discovered), summary
|
|
367
|
+
sources: dict[str, int] = {}
|
|
368
|
+
applied = 0
|
|
369
|
+
rendered: list[str] = []
|
|
370
|
+
for line in discovered:
|
|
371
|
+
stripped = line.lstrip()
|
|
372
|
+
if not stripped.startswith("|") or stripped.startswith(("| #", "|---")):
|
|
373
|
+
rendered.append(line)
|
|
374
|
+
continue
|
|
375
|
+
row = module_coverage.row_from_line(line)
|
|
376
|
+
if getattr(row, "phase", "") != "内部" or row.status == "已覆盖":
|
|
377
|
+
rendered.append(line)
|
|
378
|
+
continue
|
|
379
|
+
record = verdicts.get(_inheritable_unit_id(row))
|
|
380
|
+
if not record or record.get("status") != "已覆盖":
|
|
381
|
+
rendered.append(line)
|
|
382
|
+
continue
|
|
383
|
+
previous = record.get("row")
|
|
384
|
+
source_polling = str(record.get("polling_id") or "unknown")
|
|
385
|
+
source_lifecycle = str(record.get("lifecycle_id") or "unknown")
|
|
386
|
+
row = replace(
|
|
387
|
+
row,
|
|
388
|
+
status="已覆盖",
|
|
389
|
+
findings=str(getattr(previous, "findings", "0") or "0"),
|
|
390
|
+
evidence=str(getattr(previous, "evidence", "待补") or "待补"),
|
|
391
|
+
note=(
|
|
392
|
+
f"{row.note};跨Session继承覆盖: "
|
|
393
|
+
f"{INHERIT_NOTE_MARK}{source_polling}/{source_lifecycle}"
|
|
394
|
+
)[:500],
|
|
395
|
+
)
|
|
396
|
+
rendered.append(module_coverage.row_text(row))
|
|
397
|
+
applied += 1
|
|
398
|
+
sources[source_polling] = sources.get(source_polling, 0) + 1
|
|
399
|
+
summary.update({"applied": applied, "sources": sources})
|
|
400
|
+
return rendered, summary
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
def write_manifest(
|
|
404
|
+
manifest: Path,
|
|
405
|
+
rows: list[str],
|
|
406
|
+
*,
|
|
407
|
+
discovery_metadata: dict[str, object] | None = None,
|
|
408
|
+
) -> None:
|
|
409
|
+
if manifest.is_symlink():
|
|
410
|
+
raise CoverageBootstrapError(
|
|
411
|
+
f"拒绝写入符号链接覆盖清单: {manifest}", code="COVERAGE_MANIFEST_SYMLINK"
|
|
412
|
+
)
|
|
413
|
+
manifest.parent.mkdir(parents=True, exist_ok=True)
|
|
414
|
+
final_rows = list(rows)
|
|
415
|
+
if not any("| 业务 |" in r for r in final_rows):
|
|
416
|
+
try:
|
|
417
|
+
parsed_internals = [
|
|
418
|
+
module_coverage.row_from_line(line)
|
|
419
|
+
for line in final_rows
|
|
420
|
+
if line.lstrip().startswith("|") and not line.lstrip().startswith("| #") and not line.lstrip().startswith("|---")
|
|
421
|
+
]
|
|
422
|
+
if parsed_internals:
|
|
423
|
+
root_candidate = _find_project_root_from_manifest(manifest)
|
|
424
|
+
business_lines = module_coverage.business_discovery_rows(root_candidate, parsed_internals)
|
|
425
|
+
if business_lines:
|
|
426
|
+
final_rows.extend(business_lines)
|
|
427
|
+
except Exception as exc:
|
|
428
|
+
import sys
|
|
429
|
+
print(f"[bootstrap] business_discovery error: {exc}", file=sys.stderr)
|
|
430
|
+
metadata = discovery_metadata or build_discovery_metadata(
|
|
431
|
+
status="complete", mode="symbols",
|
|
432
|
+
)
|
|
433
|
+
metadata_payload = {
|
|
434
|
+
"status": metadata.get("status", "unknown"),
|
|
435
|
+
"discovery_mode": metadata.get("discovery_mode", "unknown"),
|
|
436
|
+
"degraded": bool(metadata.get("degraded", False)),
|
|
437
|
+
"partial": bool(metadata.get("partial", False)),
|
|
438
|
+
"coverage_confidence": metadata.get("coverage_confidence", "unknown"),
|
|
439
|
+
"discovery_errors": bounded_errors(
|
|
440
|
+
metadata.get("discovery_errors") # type: ignore[arg-type]
|
|
441
|
+
if isinstance(metadata.get("discovery_errors"), list)
|
|
442
|
+
else None
|
|
443
|
+
),
|
|
444
|
+
}
|
|
445
|
+
content = (
|
|
446
|
+
"# 最小单元与业务链路覆盖清单(module-coverage)\n\n"
|
|
447
|
+
"## 覆盖发现状态\n\n"
|
|
448
|
+
f"{DISCOVERY_METADATA_START}\n"
|
|
449
|
+
f"{json.dumps(metadata_payload, ensure_ascii=False, indent=2)}\n"
|
|
450
|
+
f"{DISCOVERY_METADATA_END}\n\n"
|
|
451
|
+
f"{module_coverage.SYMBOL_INDEX_MARKER}\n"
|
|
452
|
+
f"{module_coverage.PROJECT_GRAPH_MARKER}\n\n"
|
|
453
|
+
"## 覆盖清单\n\n"
|
|
454
|
+
+ _TABLE_HEADER
|
|
455
|
+
+ "\n".join(final_rows)
|
|
456
|
+
+ "\n"
|
|
457
|
+
)
|
|
458
|
+
temporary = manifest.with_name(f".{manifest.name}.bootstrap.tmp")
|
|
459
|
+
if temporary.exists() or temporary.is_symlink():
|
|
460
|
+
temporary.unlink()
|
|
461
|
+
try:
|
|
462
|
+
temporary.write_text(content, encoding="utf-8")
|
|
463
|
+
parsed_rows, parse_errors = module_coverage.parse_manifest(temporary)
|
|
464
|
+
if parse_errors or not parsed_rows:
|
|
465
|
+
raise CoverageBootstrapError(
|
|
466
|
+
"覆盖清单候选内容无法安全复核:"
|
|
467
|
+
+ "; ".join(parse_errors or ["没有有效最小单元"]),
|
|
468
|
+
code="COVERAGE_DISCOVERY_FAILED",
|
|
469
|
+
)
|
|
470
|
+
# Validate through a temporary regular file, then perform the final
|
|
471
|
+
# replacement with the shared fail-closed writer so a swapped parent
|
|
472
|
+
# or target symlink cannot redirect the manifest.
|
|
473
|
+
secure_atomic.atomic_write_text(manifest, content, mode=0o600, parent_mode=0o700)
|
|
474
|
+
finally:
|
|
475
|
+
# 临时文件只是**复核载体**,不是产物:成功路径同样必须清理,
|
|
476
|
+
# 否则会与正式清单并存(且其默认权限比 0o600 更宽)。
|
|
477
|
+
try:
|
|
478
|
+
temporary.unlink()
|
|
479
|
+
except OSError:
|
|
480
|
+
pass
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
def write_inventory_diff(manifest: Path, changes: dict) -> None:
|
|
484
|
+
"""Persist the rescan result beside the lifecycle manifest."""
|
|
485
|
+
target = manifest.with_name("inventory-diff.json")
|
|
486
|
+
payload = {
|
|
487
|
+
"schema_version": 1,
|
|
488
|
+
"changes": changes,
|
|
489
|
+
}
|
|
490
|
+
secure_atomic.atomic_write_json(target, payload, mode=0o600, parent_mode=0o700)
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
def bootstrap(
|
|
494
|
+
root: Path, *, confirmed: bool = False, inherit_coverage: bool = True,
|
|
495
|
+
reconcile: bool = False,
|
|
496
|
+
) -> dict[str, object]:
|
|
497
|
+
"""Create the manifest after an explicit host/user confirmation.
|
|
498
|
+
|
|
499
|
+
Existing valid manifests are returned unchanged unless reconcile is requested.
|
|
500
|
+
An active Supervisor is never rewritten: changing its unit set would invalidate
|
|
501
|
+
claims and the external baseline.
|
|
502
|
+
|
|
503
|
+
``inherit_coverage``(默认开启)在全新 Session 重建清单时继承历史
|
|
504
|
+
「已覆盖」判定(见 ``historical_unit_verdicts``);显式传 False(CLI
|
|
505
|
+
``--fresh-coverage``)可忽略历史结论全量重审。
|
|
506
|
+
"""
|
|
507
|
+
if not confirmed:
|
|
508
|
+
raise CoverageBootstrapError(
|
|
509
|
+
"覆盖清单引导创建需要宿主先取得用户的‘运行引导创建’确认",
|
|
510
|
+
code="COVERAGE_BOOTSTRAP_CONFIRMATION_REQUIRED",
|
|
511
|
+
)
|
|
512
|
+
root = root.expanduser().resolve()
|
|
513
|
+
state = inspect(root)
|
|
514
|
+
if state.get("ready") and not reconcile:
|
|
515
|
+
return {**state, "created": False, "reused": True, "next_action": "RETRY_START"}
|
|
516
|
+
if state.get("blocked"):
|
|
517
|
+
raise CoverageBootstrapError(
|
|
518
|
+
str(state.get("detail") or "覆盖清单引导被阻断"),
|
|
519
|
+
code=str(state.get("code") or "COVERAGE_BOOTSTRAP_BLOCKED"),
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
manifest = Path(str(state["path"]))
|
|
523
|
+
# 增量对账自愈分支:处理代码发现漂移或幽灵行清理
|
|
524
|
+
if (reconcile or state.get("needs_reconcile")) and manifest.is_file():
|
|
525
|
+
current_rows, errors = module_coverage.parse_manifest(manifest)
|
|
526
|
+
if not errors and current_rows:
|
|
527
|
+
discovery_meta = manifest_discovery_metadata(manifest)
|
|
528
|
+
use_symbols = discovery_meta.get("discovery_mode") not in {"files", "files-only"}
|
|
529
|
+
try:
|
|
530
|
+
discovered, changes = module_coverage.reconcile_discovery_rows(
|
|
531
|
+
current_rows, root, symbols=use_symbols,
|
|
532
|
+
)
|
|
533
|
+
except symbol_index.SourceDiscoveryError as exc:
|
|
534
|
+
raise CoverageBootstrapError(
|
|
535
|
+
f"覆盖清单增量重扫对账失败: {exc}",
|
|
536
|
+
code="COVERAGE_DISCOVERY_FAILED",
|
|
537
|
+
) from exc
|
|
538
|
+
metadata = build_discovery_metadata(
|
|
539
|
+
status="partial" if not use_symbols else "complete",
|
|
540
|
+
mode="files" if not use_symbols else "symbols",
|
|
541
|
+
confidence="low" if not use_symbols else "high",
|
|
542
|
+
)
|
|
543
|
+
write_manifest(manifest, discovered, discovery_metadata=metadata)
|
|
544
|
+
write_inventory_diff(manifest, changes)
|
|
545
|
+
new_rows, parse_errors = module_coverage.parse_manifest(manifest)
|
|
546
|
+
if parse_errors or not new_rows:
|
|
547
|
+
raise CoverageBootstrapError(
|
|
548
|
+
"增量重扫生成的覆盖清单无法复核",
|
|
549
|
+
code="COVERAGE_DISCOVERY_FAILED",
|
|
550
|
+
)
|
|
551
|
+
return {
|
|
552
|
+
"ready": True,
|
|
553
|
+
"created": False,
|
|
554
|
+
"reconciled": True,
|
|
555
|
+
"source": "reconciled_manifest",
|
|
556
|
+
"path": str(manifest),
|
|
557
|
+
"units": len(new_rows),
|
|
558
|
+
"debt": _debt_from_rows(new_rows),
|
|
559
|
+
"plan_hash": _plan_hash_for_manifest(manifest),
|
|
560
|
+
"inventory_diff": changes,
|
|
561
|
+
"next_action": "RETRY_START",
|
|
562
|
+
**metadata,
|
|
563
|
+
}
|
|
564
|
+
# 当前 polling(manifest 位于 pollings/<polling_id>/lifecycles/<id>/state/),
|
|
565
|
+
# 继承扫描时排除自身,只认更早 Session 的判定。
|
|
566
|
+
current_polling = ""
|
|
567
|
+
if bugx_paths.POLLING_ID_RE.fullmatch(manifest.parent.parent.parent.parent.name):
|
|
568
|
+
current_polling = manifest.parent.parent.parent.parent.name
|
|
569
|
+
inheritance: dict[str, object] = {
|
|
570
|
+
"enabled": bool(inherit_coverage), "applied": 0, "sources": {},
|
|
571
|
+
}
|
|
572
|
+
previous = _previous_manifest(manifest)
|
|
573
|
+
if previous is not None:
|
|
574
|
+
previous_rows, errors = module_coverage.parse_manifest(previous)
|
|
575
|
+
if errors or not previous_rows:
|
|
576
|
+
raise CoverageBootstrapError(
|
|
577
|
+
"上一生命周期覆盖清单无法安全沿用",
|
|
578
|
+
code="COVERAGE_BOOTSTRAP_PREVIOUS_INVALID",
|
|
579
|
+
)
|
|
580
|
+
try:
|
|
581
|
+
discovered, changes = module_coverage.reconcile_discovery_rows(
|
|
582
|
+
previous_rows, root,
|
|
583
|
+
symbols=manifest_discovery_metadata(previous).get("discovery_mode")
|
|
584
|
+
not in {"files", "files-only"},
|
|
585
|
+
)
|
|
586
|
+
except symbol_index.SourceDiscoveryError as exc:
|
|
587
|
+
raise CoverageBootstrapError(
|
|
588
|
+
f"新生命周期重扫失败,拒绝沿用旧覆盖结论: {exc}",
|
|
589
|
+
code="COVERAGE_DISCOVERY_FAILED",
|
|
590
|
+
) from exc
|
|
591
|
+
previous_mode = manifest_discovery_metadata(previous).get("discovery_mode")
|
|
592
|
+
metadata = build_discovery_metadata(
|
|
593
|
+
status="partial" if previous_mode in {"files", "files-only"} else "complete",
|
|
594
|
+
mode="files" if previous_mode in {"files", "files-only"} else "symbols",
|
|
595
|
+
confidence="low" if previous_mode in {"files", "files-only"} else "high",
|
|
596
|
+
)
|
|
597
|
+
write_manifest(manifest, discovered, discovery_metadata=metadata)
|
|
598
|
+
write_inventory_diff(manifest, changes)
|
|
599
|
+
rows, parse_errors = module_coverage.parse_manifest(manifest)
|
|
600
|
+
if parse_errors or not rows:
|
|
601
|
+
raise CoverageBootstrapError(
|
|
602
|
+
"增量重扫生成的覆盖清单无法复核",
|
|
603
|
+
code="COVERAGE_DISCOVERY_FAILED",
|
|
604
|
+
)
|
|
605
|
+
return {
|
|
606
|
+
"ready": True,
|
|
607
|
+
"created": True,
|
|
608
|
+
"source": "previous_lifecycle",
|
|
609
|
+
"path": str(manifest),
|
|
610
|
+
"units": len(rows),
|
|
611
|
+
"debt": _debt_from_rows(rows),
|
|
612
|
+
"plan_hash": _plan_hash_for_manifest(manifest),
|
|
613
|
+
"inventory_diff": changes,
|
|
614
|
+
"next_action": "RETRY_START",
|
|
615
|
+
**metadata,
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
try:
|
|
619
|
+
discovered = module_coverage.discovery_rows(root)
|
|
620
|
+
except (OSError, UnicodeError, ValueError, RuntimeError) as exc:
|
|
621
|
+
strict_detail = str(exc)
|
|
622
|
+
if not _is_partial_parse_failure(exc):
|
|
623
|
+
raise CoverageBootstrapError(
|
|
624
|
+
f"覆盖清单自动发现失败: {strict_detail}",
|
|
625
|
+
code="COVERAGE_DISCOVERY_FAILED",
|
|
626
|
+
) from exc
|
|
627
|
+
try:
|
|
628
|
+
# This path only enumerates real, in-root source files. It does
|
|
629
|
+
# not infer symbols from a damaged syntax tree and therefore keeps
|
|
630
|
+
# the minimum scheduling unit conservative.
|
|
631
|
+
degraded_rows = module_coverage.discovery_rows(root, symbols=False)
|
|
632
|
+
except (OSError, UnicodeError, ValueError, RuntimeError) as fallback_exc:
|
|
633
|
+
raise CoverageBootstrapError(
|
|
634
|
+
"严格符号发现失败,文件级安全回退也失败:"
|
|
635
|
+
f"严格错误={strict_detail}; 回退错误={fallback_exc}",
|
|
636
|
+
code="COVERAGE_DISCOVERY_FAILED",
|
|
637
|
+
) from fallback_exc
|
|
638
|
+
if not degraded_rows:
|
|
639
|
+
raise CoverageBootstrapError(
|
|
640
|
+
"严格符号发现失败,且文件级安全回退没有发现任何可安全列出的源码:"
|
|
641
|
+
f"{strict_detail}",
|
|
642
|
+
code="COVERAGE_DISCOVERY_EMPTY",
|
|
643
|
+
) from exc
|
|
644
|
+
if inherit_coverage:
|
|
645
|
+
# 文件级回退同样继承历史 covered:回退只影响发现粒度,不否定
|
|
646
|
+
# 更早 lifecycle 的审计结论(scope 精确一致才继承)。
|
|
647
|
+
degraded_rows, inheritance = apply_inherited_coverage(
|
|
648
|
+
degraded_rows,
|
|
649
|
+
historical_unit_verdicts(root, exclude_polling=current_polling),
|
|
650
|
+
)
|
|
651
|
+
discovery = build_discovery_metadata(
|
|
652
|
+
status="partial",
|
|
653
|
+
mode="files",
|
|
654
|
+
errors=[strict_detail],
|
|
655
|
+
confidence="low",
|
|
656
|
+
)
|
|
657
|
+
write_manifest(manifest, degraded_rows, discovery_metadata=discovery)
|
|
658
|
+
rows, parse_errors = module_coverage.parse_manifest(manifest)
|
|
659
|
+
if parse_errors or not rows:
|
|
660
|
+
raise CoverageBootstrapError(
|
|
661
|
+
"文件级安全回退生成的覆盖清单无法复核:"
|
|
662
|
+
+ "; ".join(parse_errors or ["没有有效最小单元"]),
|
|
663
|
+
code="COVERAGE_DISCOVERY_FAILED",
|
|
664
|
+
)
|
|
665
|
+
return {
|
|
666
|
+
"ready": True,
|
|
667
|
+
"created": True,
|
|
668
|
+
"source": "module_coverage.discovery_rows(files_only)",
|
|
669
|
+
"path": str(manifest),
|
|
670
|
+
"units": len(degraded_rows),
|
|
671
|
+
"debt": _debt_from_rows(rows),
|
|
672
|
+
"plan_hash": _plan_hash_for_manifest(manifest),
|
|
673
|
+
"inherited_coverage": inheritance,
|
|
674
|
+
"next_action": "RETRY_START",
|
|
675
|
+
**discovery,
|
|
676
|
+
}
|
|
677
|
+
if not discovered:
|
|
678
|
+
raise CoverageBootstrapError(
|
|
679
|
+
"项目没有可发现的源码最小单元,无法建立 Supervisor 队列",
|
|
680
|
+
code="COVERAGE_DISCOVERY_EMPTY",
|
|
681
|
+
)
|
|
682
|
+
if inherit_coverage:
|
|
683
|
+
# 全新 Session:把历史「已覆盖」审计结论继承到新清单(R6 复盘结构性
|
|
684
|
+
# 候选 #1),避免每轮重复重审同批入口文件;--fresh-coverage 可关闭。
|
|
685
|
+
discovered, inheritance = apply_inherited_coverage(
|
|
686
|
+
discovered,
|
|
687
|
+
historical_unit_verdicts(root, exclude_polling=current_polling),
|
|
688
|
+
)
|
|
689
|
+
discovery = build_discovery_metadata(status="complete", mode="symbols")
|
|
690
|
+
write_manifest(manifest, discovered, discovery_metadata=discovery)
|
|
691
|
+
try:
|
|
692
|
+
rows, _ = module_coverage.parse_manifest(manifest)
|
|
693
|
+
if not any(r.phase == "业务" for r in rows):
|
|
694
|
+
business_lines = module_coverage.business_discovery_rows(root, rows)
|
|
695
|
+
if business_lines:
|
|
696
|
+
with open(manifest, "a", encoding="utf-8") as f:
|
|
697
|
+
for bl in business_lines:
|
|
698
|
+
f.write(bl + "\n")
|
|
699
|
+
except Exception:
|
|
700
|
+
pass
|
|
701
|
+
rows, _ = module_coverage.parse_manifest(manifest)
|
|
702
|
+
return {
|
|
703
|
+
"ready": True,
|
|
704
|
+
"created": True,
|
|
705
|
+
"source": "module_coverage.discovery_rows",
|
|
706
|
+
"path": str(manifest),
|
|
707
|
+
"units": len(discovered),
|
|
708
|
+
"debt": _debt_from_rows(rows) if rows else {"total": len(discovered), "covered": 0, "unit_debt": len(discovered), "by_status": {"未覆盖": len(discovered)}, "has_unit_debt": True, "has_global_block": False},
|
|
709
|
+
"plan_hash": _plan_hash_for_manifest(manifest),
|
|
710
|
+
"inherited_coverage": inheritance,
|
|
711
|
+
"next_action": "RETRY_START",
|
|
712
|
+
**discovery,
|
|
713
|
+
}
|