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,149 @@
|
|
|
1
|
+
"""Runtime accessibility checks and declarative keyboard journey execution."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import hashlib
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
AXE_VERSION = "4.14.0"
|
|
10
|
+
AXE_SHA256 = "20c09fe157a8a34a30e241aaa1fcdade657734f08ab379ecfbeb7d45cc46e878"
|
|
11
|
+
AXE_TAGS = ("wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def load_axe() -> str:
|
|
15
|
+
path = Path(__file__).resolve().parents[1] / "assets/axe-core/axe.min.js"
|
|
16
|
+
source = path.read_bytes()
|
|
17
|
+
if hashlib.sha256(source).hexdigest() != AXE_SHA256:
|
|
18
|
+
raise ValueError("bundled axe-core hash mismatch")
|
|
19
|
+
return source.decode("utf-8")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def scan_accessibility(page: Any, source: str, selector: str | None = None) -> dict:
|
|
23
|
+
"""Run the bundled engine and retain its automated and incomplete results."""
|
|
24
|
+
from playwright.sync_api import Error
|
|
25
|
+
|
|
26
|
+
metadata = {"version": AXE_VERSION, "sha256": AXE_SHA256, "tags": list(AXE_TAGS),
|
|
27
|
+
"scope": selector or "document"}
|
|
28
|
+
try:
|
|
29
|
+
page.evaluate(source)
|
|
30
|
+
result = page.evaluate(r"""
|
|
31
|
+
async ({tags, version, selector}) => {
|
|
32
|
+
if (window.axe?.version !== version) throw new Error('axe-core did not load');
|
|
33
|
+
const context = selector ? document.querySelector(selector) : document;
|
|
34
|
+
if (!context) throw new Error('accessibility scope is unavailable');
|
|
35
|
+
let timer;
|
|
36
|
+
try {
|
|
37
|
+
const result = await Promise.race([
|
|
38
|
+
axe.run(context, {runOnly: {type: 'tag', values: tags},
|
|
39
|
+
resultTypes: ['violations', 'incomplete']}),
|
|
40
|
+
new Promise((_, reject) => {
|
|
41
|
+
timer = setTimeout(() => reject(new Error('axe-core timed out')), 5000);
|
|
42
|
+
}),
|
|
43
|
+
]);
|
|
44
|
+
const summarize = (rules) => rules.map(rule => ({
|
|
45
|
+
id: rule.id, impact: rule.impact, help: rule.help, url: rule.helpUrl,
|
|
46
|
+
node_count: rule.nodes.length,
|
|
47
|
+
targets: rule.nodes.slice(0, 16).map(node => node.target),
|
|
48
|
+
}));
|
|
49
|
+
return {violations: summarize(result.violations), incomplete: summarize(result.incomplete),
|
|
50
|
+
passed_rules: result.passes.length};
|
|
51
|
+
} finally {
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
""", {"tags": list(AXE_TAGS), "version": AXE_VERSION, "selector": selector})
|
|
56
|
+
except Error as exc:
|
|
57
|
+
return {**metadata, "status": "BLOCKED", "reason": str(exc).splitlines()[0][:280]}
|
|
58
|
+
status = "FAIL" if result["violations"] else (
|
|
59
|
+
"UNVERIFIED" if result["incomplete"] or not result["passed_rules"] else "PASS"
|
|
60
|
+
)
|
|
61
|
+
return {**metadata, **result, "status": status}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
_FOCUS_SAMPLE = r"""
|
|
65
|
+
({focus, indicator}) => {
|
|
66
|
+
const active = document.activeElement;
|
|
67
|
+
const identify = node => node && ({
|
|
68
|
+
tag: node.localName, id: node.id || null, role: node.getAttribute('role')
|
|
69
|
+
});
|
|
70
|
+
const one = selector => {
|
|
71
|
+
const rows = document.querySelectorAll(selector);
|
|
72
|
+
return rows.length === 1 ? rows[0] : null;
|
|
73
|
+
};
|
|
74
|
+
const target = one(focus);
|
|
75
|
+
const marker = one(indicator);
|
|
76
|
+
const shown = node => {
|
|
77
|
+
const box = node.getBoundingClientRect();
|
|
78
|
+
if (!node.checkVisibility({checkOpacity: true, checkVisibilityCSS: true}) ||
|
|
79
|
+
box.width <= 0 || box.height <= 0) return false;
|
|
80
|
+
const left = Math.max(0, box.left), right = Math.min(innerWidth, box.right);
|
|
81
|
+
const top = Math.max(0, box.top), bottom = Math.min(innerHeight, box.bottom);
|
|
82
|
+
if (left >= right || top >= bottom) return false;
|
|
83
|
+
const hit = document.elementFromPoint((left + right) / 2, (top + bottom) / 2);
|
|
84
|
+
return !!hit && (node.contains(hit) || hit.contains(node));
|
|
85
|
+
};
|
|
86
|
+
let paint = null;
|
|
87
|
+
if (marker) {
|
|
88
|
+
const s = getComputedStyle(marker);
|
|
89
|
+
const outline = s.outlineStyle !== 'none' && parseFloat(s.outlineWidth) > 0 &&
|
|
90
|
+
s.outlineColor !== 'transparent' && !/,\s*0\)$/.test(s.outlineColor);
|
|
91
|
+
const shadowColors = s.boxShadow.match(/rgba?\([^)]*\)/g) || [];
|
|
92
|
+
const shadow = s.boxShadow !== 'none' &&
|
|
93
|
+
shadowColors.some(color => !/,\s*0\)$/.test(color));
|
|
94
|
+
paint = {
|
|
95
|
+
outline: outline ? [s.outlineStyle, s.outlineWidth, s.outlineColor, s.outlineOffset] : null,
|
|
96
|
+
shadow: shadow ? s.boxShadow : null,
|
|
97
|
+
border: s.borderTopStyle !== 'none' && parseFloat(s.borderTopWidth) > 0 ?
|
|
98
|
+
[s.borderTopWidth, s.borderTopStyle, s.borderTopColor] : null,
|
|
99
|
+
background: s.backgroundColor,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
active: identify(active), matched: !!target && target === active,
|
|
104
|
+
shown: !!target && shown(target), marker_shown: !!marker && shown(marker), paint,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def keyboard_journey(page: Any, steps: list[dict]) -> dict:
|
|
111
|
+
"""Press real browser keys and assert each declared focus transition."""
|
|
112
|
+
from playwright.sync_api import TimeoutError
|
|
113
|
+
|
|
114
|
+
results = []
|
|
115
|
+
for step in steps:
|
|
116
|
+
selector = step["focus"]
|
|
117
|
+
targets = {"focus": selector, "indicator": step.get("indicator", selector)}
|
|
118
|
+
before = page.evaluate(_FOCUS_SAMPLE, targets)
|
|
119
|
+
page.keyboard.press(step["key"])
|
|
120
|
+
try:
|
|
121
|
+
page.wait_for_function(
|
|
122
|
+
"""selector => {
|
|
123
|
+
const nodes = document.querySelectorAll(selector);
|
|
124
|
+
return nodes.length === 1 && nodes[0] === document.activeElement;
|
|
125
|
+
}""",
|
|
126
|
+
arg=selector, timeout=900,
|
|
127
|
+
).dispose()
|
|
128
|
+
except TimeoutError:
|
|
129
|
+
pass
|
|
130
|
+
observed = page.evaluate(_FOCUS_SAMPLE, targets)
|
|
131
|
+
old, new = before["paint"], observed["paint"]
|
|
132
|
+
if not observed["matched"] or not observed["shown"]:
|
|
133
|
+
status, reason = "FAIL", "expected focus was not reached or was obscured"
|
|
134
|
+
elif not observed["marker_shown"] or new is None:
|
|
135
|
+
status, reason = "FAIL", "declared indicator target is missing or obscured"
|
|
136
|
+
elif old is None or before["matched"]:
|
|
137
|
+
status, reason = "UNVERIFIED", "no unfocused indicator sample for this step"
|
|
138
|
+
elif any(new[field] and new[field] != old[field]
|
|
139
|
+
for field in ("outline", "shadow", "border", "background")):
|
|
140
|
+
status, reason = "PASS", "focus target and indicator change observed"
|
|
141
|
+
else:
|
|
142
|
+
status, reason = "FAIL", "no visible change in the declared indicator styles"
|
|
143
|
+
results.append({**step, "status": status, "reason": reason, "before": before, "after": observed})
|
|
144
|
+
if status == "FAIL":
|
|
145
|
+
break
|
|
146
|
+
status = "FAIL" if any(row["status"] == "FAIL" for row in results) else (
|
|
147
|
+
"UNVERIFIED" if not results or any(row["status"] == "UNVERIFIED" for row in results) else "PASS"
|
|
148
|
+
)
|
|
149
|
+
return {"status": status, "steps": results, "planned_steps": len(steps)}
|
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Audit a rendered Web UI against browser measurements and DESIGN.md."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import math
|
|
9
|
+
import sys
|
|
10
|
+
import tempfile
|
|
11
|
+
from importlib.util import find_spec
|
|
12
|
+
from multiprocessing import get_context
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any
|
|
15
|
+
from urllib.parse import urljoin, urlsplit
|
|
16
|
+
|
|
17
|
+
if not __package__:
|
|
18
|
+
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
|
19
|
+
|
|
20
|
+
from core.probes.ui_accessibility import keyboard_journey, load_axe, scan_accessibility
|
|
21
|
+
from core.probes.ui_contract import IDENTIFIER, UIContract, UIContractError, load_ui_contract
|
|
22
|
+
from core.probes.ui_evidence import combine_status, make_manifest, write_ui_evidence
|
|
23
|
+
from core.probes.ui_measurements import CHECK_JOURNEY, MEASURE_UI
|
|
24
|
+
from core.probes.ui_repair import repair_tokens
|
|
25
|
+
from core.probes.ui_review import review_ui, validate_model_tag
|
|
26
|
+
from core.probes.ui_storybook import STORY_ROOT, StorybookError, StorybookIndex, read_storybook, wait_for_story
|
|
27
|
+
from core.probes.ui_visual_diff import compare_visual
|
|
28
|
+
from core.probes.web_probe import WebDynamicProbe
|
|
29
|
+
from core.secure_atomic import atomic_write_json
|
|
30
|
+
|
|
31
|
+
DEFAULT_VIEWPORTS = (
|
|
32
|
+
("desktop", 1440, 900), ("tablet", 768, 1024),
|
|
33
|
+
("mobile", 390, 844), ("landscape", 844, 390),
|
|
34
|
+
)
|
|
35
|
+
ZOOM_BASE = {"width": 1280, "height": 1024}
|
|
36
|
+
ZOOMS = (2, 4)
|
|
37
|
+
TIMEOUT_MS = 5000
|
|
38
|
+
# 浏览器冷启动(尤其带扩展的 persistent context 首次注册 service worker)
|
|
39
|
+
# 与本机的页面等待不是一个量级;共用 5s 会把启动慢误报成 zoom 用例 BLOCKED。
|
|
40
|
+
BROWSER_START_TIMEOUT_MS = 20000
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def origin(url: str) -> tuple[str, str, int]:
|
|
44
|
+
"""Return the canonical origin of an HTTP URL without embedded credentials."""
|
|
45
|
+
parsed = urlsplit(url)
|
|
46
|
+
if parsed.scheme not in {"http", "https"} or not parsed.hostname or parsed.username is not None:
|
|
47
|
+
raise UIContractError("expected an absolute HTTP(S) URL without credentials")
|
|
48
|
+
return parsed.scheme, parsed.hostname, parsed.port or (443 if parsed.scheme == "https" else 80)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _viewport(raw: str) -> tuple[str, int, int]:
|
|
52
|
+
try:
|
|
53
|
+
name, size = raw.split("=", 1)
|
|
54
|
+
width, height = map(int, size.lower().split("x", 1))
|
|
55
|
+
if IDENTIFIER.fullmatch(name) and not name.startswith(("zoom-", "journey-", "keyboard-")):
|
|
56
|
+
if 240 <= width <= 2560 and 240 <= height <= 1600:
|
|
57
|
+
return name, width, height
|
|
58
|
+
except ValueError:
|
|
59
|
+
pass
|
|
60
|
+
raise argparse.ArgumentTypeError("viewport must be NAME=WIDTHxHEIGHT, e.g. mobile=390x844")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _capture(
|
|
64
|
+
page: Any, name: str, url: str, directory: Path, browser_version: str,
|
|
65
|
+
*, axe: str, actions: list[dict] | None = None, after_navigation: Any = None,
|
|
66
|
+
inspect_page: Any = None, expect_origin: bool = False, masks: tuple[str, ...] = (),
|
|
67
|
+
story: dict | None = None,
|
|
68
|
+
) -> dict:
|
|
69
|
+
from playwright.sync_api import Error
|
|
70
|
+
|
|
71
|
+
def ready(current: Any) -> None:
|
|
72
|
+
if (expect_origin or story) and origin(current.url) != origin(url):
|
|
73
|
+
raise UIContractError("audit page navigated outside the configured origin")
|
|
74
|
+
if story:
|
|
75
|
+
wait_for_story(current, story, TIMEOUT_MS)
|
|
76
|
+
else:
|
|
77
|
+
current.locator("body").wait_for(state="visible", timeout=TIMEOUT_MS)
|
|
78
|
+
if after_navigation is not None:
|
|
79
|
+
after_navigation(current)
|
|
80
|
+
|
|
81
|
+
def inspect(current: Any) -> dict:
|
|
82
|
+
if (expect_origin or story) and origin(current.url) != origin(url):
|
|
83
|
+
raise UIContractError("audit action navigated outside the configured origin")
|
|
84
|
+
inspected = inspect_page(current) if inspect_page is not None else {}
|
|
85
|
+
if (expect_origin or story) and origin(current.url) != origin(url):
|
|
86
|
+
raise UIContractError("audit action navigated outside the configured origin")
|
|
87
|
+
if story:
|
|
88
|
+
wait_for_story(current, story, TIMEOUT_MS)
|
|
89
|
+
return {**inspected, "axe": scan_accessibility(current, axe, STORY_ROOT if story else None)}
|
|
90
|
+
|
|
91
|
+
try:
|
|
92
|
+
raw = WebDynamicProbe.capture_browser_page(
|
|
93
|
+
page, url, actions=actions, timeout=TIMEOUT_MS / 1000,
|
|
94
|
+
screenshot_path=directory / f"{name}.png", screenshot_full_page=False,
|
|
95
|
+
screenshot_masks=masks,
|
|
96
|
+
browser_version=browser_version, after_navigation=ready, inspect_page=inspect,
|
|
97
|
+
)
|
|
98
|
+
except (Error, UIContractError, StorybookError) as exc:
|
|
99
|
+
return {"name": name, "status": "BLOCKED", "reason": str(exc).splitlines()[0][:400],
|
|
100
|
+
**({"story": story} if story else {})}
|
|
101
|
+
evidence = raw["evidence"]
|
|
102
|
+
# Keep browser diagnostics useful without retaining console messages or request URLs.
|
|
103
|
+
for key in ("console", "page_errors", "request_failures", "http_errors"):
|
|
104
|
+
evidence[f"{key}_count"] = len(evidence.pop(key))
|
|
105
|
+
status = raw["http_status"]
|
|
106
|
+
return {"name": name, "status": "PASS" if status and 200 <= status < 300 else "BLOCKED",
|
|
107
|
+
**raw, **({"story": story} if story else {})}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _measure(page: Any, name: str, contract: UIContract) -> dict:
|
|
111
|
+
from playwright.sync_api import TimeoutError
|
|
112
|
+
|
|
113
|
+
page.evaluate("() => Promise.race([document.fonts.ready, new Promise(r => setTimeout(r, 1000))])"
|
|
114
|
+
".then(() => undefined)")
|
|
115
|
+
details = page.evaluate(MEASURE_UI, {
|
|
116
|
+
"tokens": contract.tokens or {},
|
|
117
|
+
"components": [row for row in contract.components if not row.get("profiles") or name in row["profiles"]],
|
|
118
|
+
"contrast": list(contract.contrast), "reflow": list(contract.reflow),
|
|
119
|
+
})
|
|
120
|
+
actionable = [(rule, observed) for rule, observed in zip(contract.reflow, details["anchors"], strict=True)
|
|
121
|
+
if rule.get("interactive") and observed["status"] == "PASS"]
|
|
122
|
+
if not actionable:
|
|
123
|
+
return details
|
|
124
|
+
scroll = page.evaluate_handle("""selectors => {
|
|
125
|
+
const positions = new Map();
|
|
126
|
+
for (const selector of selectors) {
|
|
127
|
+
for (let node = document.querySelector(selector); node; node = node.parentElement) {
|
|
128
|
+
positions.set(node, [node.scrollLeft, node.scrollTop]);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {x: scrollX, y: scrollY, positions};
|
|
132
|
+
}""", [rule["selector"] for rule, _ in actionable])
|
|
133
|
+
try:
|
|
134
|
+
for rule, observed in actionable:
|
|
135
|
+
try:
|
|
136
|
+
page.locator(rule["selector"]).click(trial=True, timeout=1200)
|
|
137
|
+
except TimeoutError:
|
|
138
|
+
observed.update(status="FAIL", reason="control failed Playwright actionability checks")
|
|
139
|
+
finally:
|
|
140
|
+
scroll.evaluate("""({x, y, positions}) => {
|
|
141
|
+
for (const [node, [left, top]] of positions)
|
|
142
|
+
node.scrollTo({left, top, behavior: 'instant'});
|
|
143
|
+
window.scrollTo({left: x, top: y, behavior: 'instant'});
|
|
144
|
+
}""")
|
|
145
|
+
scroll.dispose()
|
|
146
|
+
return details
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _zoom_extension(directory: Path) -> Path:
|
|
150
|
+
extension = directory / "extension"
|
|
151
|
+
extension.mkdir()
|
|
152
|
+
(extension / "manifest.json").write_text(json.dumps({
|
|
153
|
+
"manifest_version": 3, "name": "BugX audit page zoom", "version": "1.0",
|
|
154
|
+
"background": {"service_worker": "zoom.js"},
|
|
155
|
+
}), encoding="utf-8")
|
|
156
|
+
(extension / "zoom.js").write_text("chrome.runtime.onInstalled.addListener(() => {});\n",
|
|
157
|
+
encoding="utf-8")
|
|
158
|
+
return extension
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _zoom_capture(chromium: Any, extension: Path, profile: Path, factor: int, url: str,
|
|
162
|
+
directory: Path, contract: UIContract, theme: str, confined: bool,
|
|
163
|
+
axe: str, masks: tuple[str, ...], story: dict | None = None) -> dict:
|
|
164
|
+
from playwright.sync_api import Error
|
|
165
|
+
|
|
166
|
+
name = f"zoom-{factor * 100}"
|
|
167
|
+
try:
|
|
168
|
+
with chromium.launch_persistent_context(
|
|
169
|
+
str(profile), channel="chromium", headless=True, viewport=ZOOM_BASE,
|
|
170
|
+
color_scheme=theme, service_workers="block", timeout=BROWSER_START_TIMEOUT_MS,
|
|
171
|
+
args=[f"--disable-extensions-except={extension}", f"--load-extension={extension}"],
|
|
172
|
+
) as context:
|
|
173
|
+
worker = (context.service_workers[0] if context.service_workers else
|
|
174
|
+
context.wait_for_event("serviceworker", timeout=BROWSER_START_TIMEOUT_MS))
|
|
175
|
+
tab_id = worker.evaluate("""async () => {
|
|
176
|
+
const tabs = await chrome.tabs.query({});
|
|
177
|
+
if (tabs.length !== 1) throw new Error('Expected one isolated audit tab');
|
|
178
|
+
return tabs[0].id;
|
|
179
|
+
}""")
|
|
180
|
+
page = context.pages[0]
|
|
181
|
+
version = context.new_cdp_session(page).send("Browser.getVersion")["product"]
|
|
182
|
+
observed_factor = None
|
|
183
|
+
|
|
184
|
+
def zoom(current: Any) -> None:
|
|
185
|
+
nonlocal observed_factor
|
|
186
|
+
observed_factor = worker.evaluate("""async ({id, factor}) => {
|
|
187
|
+
await chrome.tabs.setZoomSettings(id, {mode: 'automatic', scope: 'per-tab'});
|
|
188
|
+
await chrome.tabs.setZoom(id, factor);
|
|
189
|
+
return chrome.tabs.getZoom(id);
|
|
190
|
+
}""", {"id": tab_id, "factor": factor})
|
|
191
|
+
if not math.isclose(observed_factor, factor):
|
|
192
|
+
raise UIContractError("Chromium did not apply the requested native zoom")
|
|
193
|
+
current.wait_for_function(
|
|
194
|
+
"""({width, height, factor}) =>
|
|
195
|
+
innerWidth === width && innerHeight === height &&
|
|
196
|
+
Math.abs(devicePixelRatio - factor) < 0.01""",
|
|
197
|
+
arg={"width": ZOOM_BASE["width"] // factor,
|
|
198
|
+
"height": ZOOM_BASE["height"] // factor, "factor": factor},
|
|
199
|
+
timeout=TIMEOUT_MS,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
capture = _capture(
|
|
203
|
+
page, name, url, directory, version, axe=axe, actions=[{"type": "press", "key": "Tab"}],
|
|
204
|
+
after_navigation=zoom, inspect_page=lambda current: _measure(current, name, contract),
|
|
205
|
+
expect_origin=confined, masks=masks, story=story,
|
|
206
|
+
)
|
|
207
|
+
measured = capture.get("inspection", {}).get("viewport", {})
|
|
208
|
+
if capture["status"] == "PASS" and (
|
|
209
|
+
measured.get("width") != ZOOM_BASE["width"] // factor or
|
|
210
|
+
not math.isclose(measured.get("dpr", 0), factor, abs_tol=0.01)
|
|
211
|
+
):
|
|
212
|
+
capture.update(status="BLOCKED", reason="native zoom changed before capture")
|
|
213
|
+
return {**capture, "zoom": {"method": "chromium-tabs", "requested": factor,
|
|
214
|
+
"observed": observed_factor, "base_viewport": ZOOM_BASE}}
|
|
215
|
+
except Error as exc:
|
|
216
|
+
return {"name": name, "status": "BLOCKED", "reason": str(exc).splitlines()[0][:400]}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _journey(context: Any, url: str, directory: Path, version: str, rule: dict,
|
|
220
|
+
axe: str, masks: tuple[str, ...], *, keyboard: bool = False,
|
|
221
|
+
storybook: StorybookIndex | None = None, base_story: dict | None = None) -> dict:
|
|
222
|
+
from playwright.sync_api import TimeoutError
|
|
223
|
+
|
|
224
|
+
story = base_story
|
|
225
|
+
if "story" in rule:
|
|
226
|
+
if storybook is None:
|
|
227
|
+
raise UIContractError("story journeys require --storybook")
|
|
228
|
+
story = storybook.story(rule["story"])
|
|
229
|
+
elif "path" in rule:
|
|
230
|
+
story = None
|
|
231
|
+
target = story["preview_url"] if story else urljoin(url, rule.get("path", ""))
|
|
232
|
+
prefix = "keyboard" if keyboard else "journey"
|
|
233
|
+
name = f"{prefix}-{rule['id']}"
|
|
234
|
+
expected_origin = origin(target)
|
|
235
|
+
page = context.new_page()
|
|
236
|
+
|
|
237
|
+
def guard(route: Any) -> None:
|
|
238
|
+
request = route.request
|
|
239
|
+
if request.is_navigation_request() and request.frame == page.main_frame:
|
|
240
|
+
try:
|
|
241
|
+
same_origin = origin(request.url) == expected_origin
|
|
242
|
+
except ValueError:
|
|
243
|
+
same_origin = False
|
|
244
|
+
if not same_origin:
|
|
245
|
+
route.abort()
|
|
246
|
+
return
|
|
247
|
+
route.continue_()
|
|
248
|
+
|
|
249
|
+
page.route("**/*", guard)
|
|
250
|
+
|
|
251
|
+
def inspect(current: Any) -> dict:
|
|
252
|
+
if keyboard:
|
|
253
|
+
return keyboard_journey(current, rule["steps"])
|
|
254
|
+
checks = rule["expect"]
|
|
255
|
+
try:
|
|
256
|
+
result = current.wait_for_function(
|
|
257
|
+
f"(rules) => {{ const rows = ({CHECK_JOURNEY})(rules);"
|
|
258
|
+
" return rows.every(row => row.passed) ? rows : false; }",
|
|
259
|
+
arg=checks, timeout=2500,
|
|
260
|
+
)
|
|
261
|
+
return {"status": "PASS", "assertions": result.json_value()}
|
|
262
|
+
except TimeoutError:
|
|
263
|
+
return {"status": "FAIL", "assertions": current.evaluate(CHECK_JOURNEY, checks)}
|
|
264
|
+
|
|
265
|
+
actions = [{**action, "timeout": 2.5} for action in rule.get("actions", [])]
|
|
266
|
+
capture = _capture(page, name, target, directory, version, axe=axe, actions=actions, inspect_page=inspect,
|
|
267
|
+
expect_origin=True, masks=masks, story=story)
|
|
268
|
+
if capture["status"] == "PASS":
|
|
269
|
+
capture["status"] = capture["inspection"]["status"]
|
|
270
|
+
if not keyboard:
|
|
271
|
+
capture["state"] = rule["state"]
|
|
272
|
+
return capture
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def run_ui_audit(
|
|
276
|
+
url: str, directory: Path, viewports: tuple[tuple[str, int, int], ...],
|
|
277
|
+
contract: UIContract, *, root: Path, axe: str, theme: str,
|
|
278
|
+
run_journeys: bool, confined: bool = False, masks: tuple[str, ...] = (),
|
|
279
|
+
browser_temp: Path | None = None,
|
|
280
|
+
storybook: StorybookIndex | None = None, story_id: str | None = None,
|
|
281
|
+
) -> dict:
|
|
282
|
+
"""Render each viewport and journey in an isolated browser context."""
|
|
283
|
+
from playwright.sync_api import sync_playwright
|
|
284
|
+
|
|
285
|
+
captures: list[dict] = []
|
|
286
|
+
journeys: list[dict] = []
|
|
287
|
+
keyboard: list[dict] = []
|
|
288
|
+
state_plan = contract.journeys if run_journeys else ()
|
|
289
|
+
keyboard_plan = contract.keyboard if run_journeys else ()
|
|
290
|
+
story = storybook.story(story_id) if storybook is not None and story_id else None
|
|
291
|
+
with WebDynamicProbe.browser_slot(), sync_playwright() as playwright:
|
|
292
|
+
with playwright.chromium.launch(headless=True, timeout=BROWSER_START_TIMEOUT_MS) as browser:
|
|
293
|
+
for name, width, height in viewports:
|
|
294
|
+
with browser.new_context(
|
|
295
|
+
viewport={"width": width, "height": height}, color_scheme=theme, service_workers="block",
|
|
296
|
+
) as context:
|
|
297
|
+
captures.append(_capture(
|
|
298
|
+
context.new_page(), name, url, directory, browser.version, axe=axe,
|
|
299
|
+
actions=[{"type": "press", "key": "Tab"}], expect_origin=confined,
|
|
300
|
+
inspect_page=lambda page: _measure(page, name, contract), masks=masks, story=story,
|
|
301
|
+
))
|
|
302
|
+
for is_keyboard, plan, cases in (
|
|
303
|
+
(False, state_plan, journeys), (True, keyboard_plan, keyboard),
|
|
304
|
+
):
|
|
305
|
+
for rule in plan:
|
|
306
|
+
with browser.new_context(viewport=ZOOM_BASE, color_scheme=theme, service_workers="block") as context:
|
|
307
|
+
cases.append(_journey(context, url, directory, browser.version, rule,
|
|
308
|
+
axe, masks, keyboard=is_keyboard,
|
|
309
|
+
storybook=storybook, base_story=story))
|
|
310
|
+
with tempfile.TemporaryDirectory(prefix="bugx-ui-chromium-", dir=browser_temp) as temp:
|
|
311
|
+
zoom_root = Path(temp)
|
|
312
|
+
extension = _zoom_extension(zoom_root)
|
|
313
|
+
for factor in ZOOMS:
|
|
314
|
+
captures.append(_zoom_capture(playwright.chromium, extension, zoom_root / str(factor),
|
|
315
|
+
factor, url, directory, contract, theme, confined, axe, masks, story))
|
|
316
|
+
manifest = make_manifest(
|
|
317
|
+
root=root, url=url, theme=theme,
|
|
318
|
+
rules={"path": contract.source, "sha256": contract.sha256,
|
|
319
|
+
"contrast": bool(contract.contrast), "reflow": bool(contract.reflow),
|
|
320
|
+
"token_source": contract.token_source},
|
|
321
|
+
planned={
|
|
322
|
+
"captures": [name for name, _, _ in viewports] + [f"zoom-{factor * 100}" for factor in ZOOMS],
|
|
323
|
+
"journeys": [f"journey-{rule['id']}" for rule in state_plan],
|
|
324
|
+
"keyboard_journeys": [f"keyboard-{rule['id']}" for rule in keyboard_plan],
|
|
325
|
+
},
|
|
326
|
+
captures=captures, journeys=journeys, keyboard=keyboard,
|
|
327
|
+
)
|
|
328
|
+
if story:
|
|
329
|
+
manifest["storybook"] = story
|
|
330
|
+
return manifest
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def _recheck_worker(receipt: Path, render_args: tuple, options: dict) -> None:
|
|
334
|
+
try:
|
|
335
|
+
result = {"manifest": run_ui_audit(*render_args, **options)}
|
|
336
|
+
except Exception as exc:
|
|
337
|
+
result = {"error": (str(exc) or type(exc).__name__).splitlines()[0][:400]}
|
|
338
|
+
atomic_write_json(receipt, result)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def _bounded_recheck(render_args: tuple, options: dict, *, timeout: float = 35) -> dict:
|
|
342
|
+
"""Keep a browser hang in the read-only worker from holding a CSS transaction."""
|
|
343
|
+
with tempfile.TemporaryDirectory(prefix="bugx-ui-recheck-") as temporary:
|
|
344
|
+
directory = Path(temporary).resolve()
|
|
345
|
+
receipt = directory / "result.json"
|
|
346
|
+
process = get_context("spawn").Process(
|
|
347
|
+
target=_recheck_worker,
|
|
348
|
+
args=(receipt, render_args, {**options, "browser_temp": directory}),
|
|
349
|
+
)
|
|
350
|
+
process.start()
|
|
351
|
+
try:
|
|
352
|
+
process.join(timeout)
|
|
353
|
+
if process.is_alive():
|
|
354
|
+
raise TimeoutError(f"browser recheck exceeded {timeout:g} seconds")
|
|
355
|
+
if process.exitcode != 0 or not receipt.is_file():
|
|
356
|
+
raise RuntimeError(f"browser recheck exited without a receipt ({process.exitcode})")
|
|
357
|
+
result = json.loads(receipt.read_bytes())
|
|
358
|
+
if "error" in result:
|
|
359
|
+
raise RuntimeError(result["error"])
|
|
360
|
+
return result["manifest"]
|
|
361
|
+
finally:
|
|
362
|
+
if process.is_alive():
|
|
363
|
+
process.terminate()
|
|
364
|
+
process.join(2)
|
|
365
|
+
if process.is_alive():
|
|
366
|
+
process.kill()
|
|
367
|
+
process.join(2)
|
|
368
|
+
if process.is_alive():
|
|
369
|
+
raise RuntimeError("read-only browser recheck process could not be reaped")
|
|
370
|
+
process.close()
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def _output_directory(path: Path | None) -> Path:
|
|
374
|
+
if path is None:
|
|
375
|
+
return Path(tempfile.mkdtemp(prefix="bugx-visual-audit-")).resolve()
|
|
376
|
+
result = path.expanduser().resolve()
|
|
377
|
+
result.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
378
|
+
if any(result.iterdir()):
|
|
379
|
+
raise UIContractError("--out-dir must be empty to preserve earlier evidence")
|
|
380
|
+
return result
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
def main(argv: list[str] | None = None) -> int:
|
|
384
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
385
|
+
target = parser.add_mutually_exclusive_group(required=True)
|
|
386
|
+
target.add_argument("--url", help="target page URL")
|
|
387
|
+
target.add_argument("--storybook", help="running or published Storybook base URL")
|
|
388
|
+
story_mode = parser.add_mutually_exclusive_group()
|
|
389
|
+
story_mode.add_argument("--story", help="exact Storybook story ID to audit")
|
|
390
|
+
story_mode.add_argument("--list-stories", action="store_true", help="list renderable Storybook story IDs")
|
|
391
|
+
parser.add_argument("--root", type=Path, default=Path.cwd(), help="target project root")
|
|
392
|
+
parser.add_argument("--design", type=Path, help="design specification (default: root/DESIGN.md)")
|
|
393
|
+
parser.add_argument("--out-dir", type=Path, help="empty output directory (default: system temp)")
|
|
394
|
+
parser.add_argument("--viewport", action="append", type=_viewport, metavar="NAME=WIDTHxHEIGHT")
|
|
395
|
+
parser.add_argument("--color-scheme", choices=("light", "dark"), default="light")
|
|
396
|
+
parser.add_argument("--journeys", action="store_true", help="execute declared UI actions and assertions")
|
|
397
|
+
parser.add_argument("--vision-model", help="installed local Ollama vision model tag")
|
|
398
|
+
parser.add_argument("--vision-port", type=int, default=11434, help="local Ollama port")
|
|
399
|
+
parser.add_argument("--repair-css", type=Path, help="preview token edits to this project stylesheet")
|
|
400
|
+
parser.add_argument("--apply", action="store_true", help="apply and reverify the preview on a loopback page")
|
|
401
|
+
parser.add_argument("--reference-url", help="approved reference page or Storybook base URL")
|
|
402
|
+
parser.add_argument("--visual-mask", action="append", default=[], metavar="CSS_SELECTOR",
|
|
403
|
+
help="ignore the visible area of a dynamic element on both pages")
|
|
404
|
+
parser.add_argument("--visual-max-diff", type=float, metavar="FRACTION",
|
|
405
|
+
help="maximum fraction of changed pixels (default 0.001)")
|
|
406
|
+
parser.add_argument("--strict", action="store_true", help="return 2 for incomplete or failing rules")
|
|
407
|
+
args = parser.parse_args(argv)
|
|
408
|
+
try:
|
|
409
|
+
if bool(args.story or args.list_stories) != bool(args.storybook):
|
|
410
|
+
raise UIContractError("--storybook requires --story or --list-stories")
|
|
411
|
+
book = read_storybook(args.storybook) if args.storybook else None
|
|
412
|
+
if args.list_stories:
|
|
413
|
+
print(json.dumps({"status": "PASS", "index": book.index_url,
|
|
414
|
+
"index_version": book.version, "index_sha256": book.sha256,
|
|
415
|
+
"stories": list(book.stories.values())}, ensure_ascii=False, indent=2))
|
|
416
|
+
return 0
|
|
417
|
+
url = book.story(args.story)["preview_url"] if book else args.url
|
|
418
|
+
_, hostname, _ = origin(url)
|
|
419
|
+
if args.apply and (args.repair_css is None or hostname not in {"127.0.0.1", "::1", "localhost"}):
|
|
420
|
+
raise UIContractError("--apply requires --repair-css and a loopback URL")
|
|
421
|
+
if not 1 <= args.vision_port <= 65535:
|
|
422
|
+
raise UIContractError("--vision-port must be within 1–65535")
|
|
423
|
+
if args.vision_model is not None:
|
|
424
|
+
validate_model_tag(args.vision_model)
|
|
425
|
+
if args.reference_url is not None:
|
|
426
|
+
origin(args.reference_url)
|
|
427
|
+
if find_spec("PIL") is None:
|
|
428
|
+
raise UIContractError("visual comparison requires Pillow from the bugx-cli[ui] extra")
|
|
429
|
+
elif args.visual_mask or args.visual_max_diff is not None:
|
|
430
|
+
raise UIContractError("visual options require --reference-url")
|
|
431
|
+
masks = tuple(args.visual_mask)
|
|
432
|
+
if len(set(masks)) != len(masks) or len(masks) > 12 or any(
|
|
433
|
+
not selector.strip() or len(selector) > 256 for selector in masks
|
|
434
|
+
):
|
|
435
|
+
raise UIContractError("provide at most 12 unique, nonempty visual mask selectors")
|
|
436
|
+
limit = args.visual_max_diff if args.visual_max_diff is not None else 0.001
|
|
437
|
+
if not 0 <= limit <= 1:
|
|
438
|
+
raise UIContractError("--visual-max-diff must be within 0–1")
|
|
439
|
+
root = args.root.resolve(strict=True)
|
|
440
|
+
contract = load_ui_contract(root, args.design)
|
|
441
|
+
story_ids = {item["story"] for item in contract.journeys + contract.keyboard if "story" in item
|
|
442
|
+
and args.journeys}
|
|
443
|
+
if story_ids and book is None:
|
|
444
|
+
raise UIContractError("declared story journeys require --storybook")
|
|
445
|
+
for story_id in story_ids:
|
|
446
|
+
book.story(story_id)
|
|
447
|
+
reference_book = read_storybook(args.reference_url) if book and args.reference_url else None
|
|
448
|
+
reference_url = args.reference_url
|
|
449
|
+
if reference_book:
|
|
450
|
+
reference_url = reference_book.story(args.story)["preview_url"]
|
|
451
|
+
for story_id in story_ids:
|
|
452
|
+
reference_book.story(story_id)
|
|
453
|
+
axe = load_axe()
|
|
454
|
+
viewports = tuple(args.viewport or DEFAULT_VIEWPORTS)
|
|
455
|
+
names = {name for name, _, _ in viewports}
|
|
456
|
+
if len(names) != len(viewports) or len(names) > 8:
|
|
457
|
+
raise UIContractError("provide at most eight uniquely named viewports")
|
|
458
|
+
known = names | {f"zoom-{factor * 100}" for factor in ZOOMS}
|
|
459
|
+
for item in contract.components:
|
|
460
|
+
if set(item.get("profiles", [])) - known:
|
|
461
|
+
raise UIContractError(f"component {item['id']} references an unknown viewport")
|
|
462
|
+
directory = _output_directory(args.out_dir)
|
|
463
|
+
|
|
464
|
+
render_options = dict(root=root, axe=axe, theme=args.color_scheme, run_journeys=args.journeys,
|
|
465
|
+
confined=args.apply or reference_url is not None, masks=masks,
|
|
466
|
+
storybook=book, story_id=args.story)
|
|
467
|
+
|
|
468
|
+
reference = None
|
|
469
|
+
reference_dir = directory / "reference"
|
|
470
|
+
if reference_url is not None:
|
|
471
|
+
reference_dir.mkdir(mode=0o700)
|
|
472
|
+
reference = run_ui_audit(reference_url, reference_dir, viewports, contract,
|
|
473
|
+
**{**render_options, "storybook": reference_book})
|
|
474
|
+
write_ui_evidence(reference_dir, reference)
|
|
475
|
+
|
|
476
|
+
def scan(output: Path, *, recheck: bool = False) -> dict:
|
|
477
|
+
render_args = (url, output, viewports, contract)
|
|
478
|
+
result = (_bounded_recheck(render_args, render_options) if recheck
|
|
479
|
+
else run_ui_audit(*render_args, **render_options))
|
|
480
|
+
if reference is not None:
|
|
481
|
+
visual = compare_visual(reference, result, reference_dir, output, limit)
|
|
482
|
+
result.update(visual_regression=visual,
|
|
483
|
+
status=combine_status([result["status"], visual["status"]]))
|
|
484
|
+
return result
|
|
485
|
+
|
|
486
|
+
manifest = scan(directory)
|
|
487
|
+
if args.repair_css is not None:
|
|
488
|
+
atomic_write_json(directory / "before.json", manifest)
|
|
489
|
+
repair, verified = repair_tokens(root, args.repair_css, directory, contract, manifest,
|
|
490
|
+
apply=args.apply, verify=lambda output: scan(output, recheck=True))
|
|
491
|
+
manifest = {**(verified if verified is not None else manifest), "repair": repair}
|
|
492
|
+
manifest["visual_ai_review"] = review_ui(manifest["captures"], contract.markdown,
|
|
493
|
+
args.vision_model, args.vision_port)
|
|
494
|
+
write_ui_evidence(directory, manifest)
|
|
495
|
+
print(json.dumps({
|
|
496
|
+
"status": manifest["status"], "manifest": str(directory / "manifest.json"),
|
|
497
|
+
"dynamic_evidence": str(directory / "dynamic-evidence.json"),
|
|
498
|
+
"checks": manifest["dynamic_evidence"]["checks"], "design": manifest["design_system"],
|
|
499
|
+
"visual_review": manifest["visual_ai_review"]["status"], "repair": manifest.get("repair"),
|
|
500
|
+
"visual_regression": manifest.get("visual_regression", {}).get("status"),
|
|
501
|
+
"storybook": manifest.get("storybook"),
|
|
502
|
+
}, ensure_ascii=False, indent=2))
|
|
503
|
+
if manifest.get("repair", {}).get("status") in {"BLOCKED", "ROLLED_BACK", "RECOVERY_REQUIRED"}:
|
|
504
|
+
return 2
|
|
505
|
+
return 2 if args.strict and manifest["status"] != "PASS" else 0
|
|
506
|
+
except Exception as exc:
|
|
507
|
+
print(json.dumps({"status": "BLOCKED", "error": str(exc).splitlines()[0][:500]},
|
|
508
|
+
ensure_ascii=False), file=sys.stderr)
|
|
509
|
+
return 2
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
if __name__ == "__main__":
|
|
513
|
+
raise SystemExit(main())
|