@teevee98/synapse-hub 0.0.0-stage → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/agents/api-engineer.md +67 -0
- package/.agents/agents/failure-analyst.md +75 -0
- package/.agents/agents/live-explorer.md +70 -0
- package/.agents/agents/orchestrator.md +104 -0
- package/.agents/agents/perf-engineer.md +74 -0
- package/.agents/agents/pom-crafter.md +112 -0
- package/.agents/agents/quality-gatekeeper.md +87 -0
- package/.agents/agents/test-designer.md +73 -0
- package/.agents/agents/test-runner.md +67 -0
- package/.agents/rules/author-integrity-guard.md +33 -0
- package/.agents/rules/communication-style.md +18 -0
- package/.agents/rules/context-engineering.md +37 -0
- package/.agents/rules/git-push-protocol.md +33 -0
- package/.agents/rules/graphify.md +14 -0
- package/.agents/rules/lessons-learned.md +25 -0
- package/.agents/rules/mandatory-playwright-live.md +25 -0
- package/.agents/rules/mobile_appium_rules.md +43 -0
- package/.agents/rules/performance_testing_rules.md +35 -0
- package/.agents/rules/skill-precedence.md +29 -0
- package/.agents/rules/systematic-debugging.md +36 -0
- package/.agents/skills/actor-qa-swarm/SKILL.md +77 -0
- package/.agents/skills/actor-qa-swarm/examples/broker_sharding_sample.json +12 -0
- package/.agents/skills/agent-orchestration-multi-agent-optimize/SKILL.md +88 -0
- package/.agents/skills/agent-orchestration-multi-agent-optimize/examples/swarm_workload_config.json +15 -0
- package/.agents/skills/agentless-qa-repair/SKILL.md +69 -0
- package/.agents/skills/agentless-qa-repair/examples/healing_report_sample.json +17 -0
- package/.agents/skills/agentless-qa-repair/examples/three_phase_repair_workflow.md +40 -0
- package/.agents/skills/antigravity-test-sentinel/SKILL.md +63 -0
- package/.agents/skills/antigravity-test-sentinel/examples/dod_gate_policy.json +11 -0
- package/.agents/skills/antigravity-test-sentinel/examples/sprint_dod_enforcement.md +47 -0
- package/.agents/skills/api-network-mocking-interception/SKILL.md +142 -0
- package/.agents/skills/api-network-mocking-interception/examples/network_route_stub.json +9 -0
- package/.agents/skills/api-spec-to-e2e-matrix/SKILL.md +80 -0
- package/.agents/skills/api-spec-to-e2e-matrix/examples/sample_openapi.json +19 -0
- package/.agents/skills/architecture-decision-records/SKILL.md +64 -0
- package/.agents/skills/architecture-decision-records/examples/0001-record-architecture-decisions.md +12 -0
- package/.agents/skills/auth-session-and-cookie-manager/SKILL.md +75 -0
- package/.agents/skills/auth-session-and-cookie-manager/examples/multi_role_auth_matrix.md +70 -0
- package/.agents/skills/auth-session-and-cookie-manager/examples/storage_state_sample.json +11 -0
- package/.agents/skills/backend-load-and-stress-patterns/SKILL.md +85 -0
- package/.agents/skills/backend-load-and-stress-patterns/examples/k6_load_test_sample.js +13 -0
- package/.agents/skills/backend-load-and-stress-patterns/references/k6_load_template.js +82 -0
- package/.agents/skills/bats-testing-patterns/SKILL.md +100 -0
- package/.agents/skills/bats-testing-patterns/examples/cli_runner_test.bats +6 -0
- package/.agents/skills/bats-testing-patterns/resources/implementation-playbook.md +614 -0
- package/.agents/skills/clean-pom-crafter/SKILL.md +110 -0
- package/.agents/skills/clean-pom-crafter/examples/standard_test_case.groovy +28 -0
- package/.agents/skills/clean-pom-crafter/references/pom_patterns.groovy +138 -0
- package/.agents/skills/code-refactoring-refactor-clean/SKILL.md +64 -0
- package/.agents/skills/code-refactoring-refactor-clean/examples/refactored_page_sample.groovy +9 -0
- package/.agents/skills/code-refactoring-refactor-clean/examples/refactored_playwright_pom.ts +52 -0
- package/.agents/skills/code-refactoring-refactor-clean/resources/implementation-playbook.md +881 -0
- package/.agents/skills/consumer-driven-contract-testing/SKILL.md +147 -0
- package/.agents/skills/consumer-driven-contract-testing/examples/order_service_pact.json +45 -0
- package/.agents/skills/db-state-verifier-and-seeder/SKILL.md +123 -0
- package/.agents/skills/db-state-verifier-and-seeder/examples/db_fixture_seed.json +12 -0
- package/.agents/skills/e2e-testing-patterns/SKILL.md +103 -0
- package/.agents/skills/e2e-testing-patterns/examples/playwright_sharded_config.ts +12 -0
- package/.agents/skills/e2e-testing-patterns/resources/implementation-playbook.md +522 -0
- package/.agents/skills/event-stream-qa-orchestrator/SKILL.md +79 -0
- package/.agents/skills/event-stream-qa-orchestrator/examples/timeline_sample.jsonl +2 -0
- package/.agents/skills/failure-autopsy-and-healing/SKILL.md +66 -0
- package/.agents/skills/failure-autopsy-and-healing/examples/closed_loop_healing_walkthrough.md +48 -0
- package/.agents/skills/failure-autopsy-and-healing/examples/sample_junit_failure.xml +8 -0
- package/.agents/skills/failure-autopsy-and-healing/references/healing_matrix.md +64 -0
- package/.agents/skills/failure-autopsy-and-healing/references/qa_investigation_protocol.md +56 -0
- package/.agents/skills/failure-autopsy-and-healing/scripts/triage_failures.sh +83 -0
- package/.agents/skills/file-and-report-validator/SKILL.md +90 -0
- package/.agents/skills/file-and-report-validator/examples/sample_export_schema.json +14 -0
- package/.agents/skills/flaky-test-sentinel-and-quarantine/SKILL.md +114 -0
- package/.agents/skills/flaky-test-sentinel-and-quarantine/examples/quarantine_registry.json +11 -0
- package/.agents/skills/gherkin-to-suite/SKILL.md +103 -0
- package/.agents/skills/gherkin-to-suite/examples/checkout.feature +39 -0
- package/.agents/skills/gherkin-to-suite/examples/suite_report_sample.json +334 -0
- package/.agents/skills/github-actions-templates/SKILL.md +77 -0
- package/.agents/skills/github-actions-templates/examples/matrix_test_pipeline.yml +8 -0
- package/.agents/skills/graphify-impact-analyzer/SKILL.md +76 -0
- package/.agents/skills/graphify-impact-analyzer/examples/dependency_blast_radius.json +8 -0
- package/.agents/skills/katalon-cli-runner/SKILL.md +76 -0
- package/.agents/skills/katalon-cli-runner/examples/headless_kre_exec.sh +3 -0
- package/.agents/skills/katalon-cli-runner/references/groovy-patterns.md +209 -0
- package/.agents/skills/katalon-cli-runner/references/katalon-api.md +155 -0
- package/.agents/skills/katalon-cli-runner/references/runner_commands.md +67 -0
- package/.agents/skills/lam-script-generator/SKILL.md +123 -0
- package/.agents/skills/lam-script-generator/examples/user_story_sample.md +8 -0
- package/.agents/skills/lean-code-ladder/SKILL.md +94 -0
- package/.agents/skills/lean-code-ladder/examples/ladder_walkthrough.md +37 -0
- package/.agents/skills/lean-impact-scoreboard/SKILL.md +48 -0
- package/.agents/skills/lean-impact-scoreboard/examples/sample_benchmark_gain.md +20 -0
- package/.agents/skills/lean-impact-scoreboard/examples/sample_scoreboard.md +15 -0
- package/.agents/skills/meta-prompt-crafter/SKILL.md +107 -0
- package/.agents/skills/meta-prompt-crafter/examples/qa_prompt_template.md +35 -0
- package/.agents/skills/mipro-prompt-compiler/SKILL.md +59 -0
- package/.agents/skills/mipro-prompt-compiler/examples/compiled_module_sample.json +22 -0
- package/.agents/skills/mipro-prompt-compiler/examples/dspy_assertion_optimizer_case.md +46 -0
- package/.agents/skills/mobile-appium-som/SKILL.md +88 -0
- package/.agents/skills/mobile-appium-som/examples/BaseScreen.java +88 -0
- package/.agents/skills/mobile-appium-som/examples/LoginScreen.java +46 -0
- package/.agents/skills/mobile-appium-som/examples/TC_MobileLogin.java +43 -0
- package/.agents/skills/persistent-planning-files/SKILL.md +108 -0
- package/.agents/skills/persistent-planning-files/examples/task_plan_example.md +56 -0
- package/.agents/skills/playwright-live-interaction/SKILL.md +131 -0
- package/.agents/skills/playwright-live-interaction/examples/live_probe_script.js +5 -0
- package/.agents/skills/playwright-live-interaction/references/advanced_superpowers.md +160 -0
- package/.agents/skills/playwright-live-interaction/references/compact_accessibility_snapshots.md +75 -0
- package/.agents/skills/playwright-live-interaction/references/recipes.md +388 -0
- package/.agents/skills/playwright-live-interaction/references/swarm_orchestration.md +134 -0
- package/.agents/skills/playwright-webapp-testing/SKILL.md +93 -0
- package/.agents/skills/playwright-webapp-testing/examples/server_lifecycle_playwright.py +63 -0
- package/.agents/skills/qa-aci-interface/SKILL.md +67 -0
- package/.agents/skills/qa-aci-interface/examples/surgical_code_window_walkthrough.md +40 -0
- package/.agents/skills/qa-aci-interface/examples/surgical_edit_sample.json +12 -0
- package/.agents/skills/qa-memory-os/SKILL.md +80 -0
- package/.agents/skills/qa-memory-os/examples/archival_memory_sample.json +21 -0
- package/.agents/skills/rbt-manual-testing/SKILL.md +137 -0
- package/.agents/skills/rbt-manual-testing/examples/checkout_rbt_manual_suite.md +25 -0
- package/.agents/skills/rbt-manual-testing/references/field_validation_checklist.md +29 -0
- package/.agents/skills/repo-quality-audit/SKILL.md +68 -0
- package/.agents/skills/repo-quality-audit/examples/sample_audit_walkthrough.md +15 -0
- package/.agents/skills/repo-quality-audit/examples/sample_repo_audit.md +33 -0
- package/.agents/skills/review-spec/SKILL.md +60 -0
- package/.agents/skills/review-spec/examples/pocock_grilling_decision_rubric.md +40 -0
- package/.agents/skills/review-spec/examples/sample_spec_review.md +33 -0
- package/.agents/skills/security-dast-sentinel/SKILL.md +119 -0
- package/.agents/skills/security-dast-sentinel/examples/dast_scan_config.json +10 -0
- package/.agents/skills/security-dast-sentinel/references/AI-AND-LLM.md +113 -0
- package/.agents/skills/security-dast-sentinel/references/ATTACK-CLASSES.md +89 -0
- package/.agents/skills/security-dast-sentinel/references/dast_recipes.ts +33 -0
- package/.agents/skills/self-healing-locator/SKILL.md +86 -0
- package/.agents/skills/self-healing-locator/examples/aom_diff_sample.json +16 -0
- package/.agents/skills/senior-code-review/SKILL.md +108 -0
- package/.agents/skills/senior-code-review/examples/sample_review_walkthrough.md +29 -0
- package/.agents/skills/skillspector-security-guard/SKILL.md +57 -0
- package/.agents/skills/skillspector-security-guard/examples/audit_threat_vectors_report.json +35 -0
- package/.agents/skills/skillspector-security-guard/examples/safe_mcp_config.json +12 -0
- package/.agents/skills/surgical-coding-principles/SKILL.md +89 -0
- package/.agents/skills/surgical-coding-principles/examples/surgical_vs_scope_creep.md +46 -0
- package/.agents/skills/synthetic-test-data-generator/SKILL.md +135 -0
- package/.agents/skills/synthetic-test-data-generator/examples/idempotent_data_recipe.json +9 -0
- package/.agents/skills/systematic-debugging/SKILL.md +100 -0
- package/.agents/skills/systematic-debugging/examples/four_phase_case.md +44 -0
- package/.agents/skills/technical-debt-harvester/SKILL.md +70 -0
- package/.agents/skills/technical-debt-harvester/examples/sample_debt_ledger.md +25 -0
- package/.agents/skills/technical-debt-harvester/examples/sample_ledger_output.md +20 -0
- package/.agents/skills/test-driven-development/SKILL.md +114 -0
- package/.agents/skills/test-driven-development/examples/red_green_refactor_qa.md +78 -0
- package/.agents/skills/token-and-context-optimizer/SKILL.md +70 -0
- package/.agents/skills/token-and-context-optimizer/examples/distilled_log_sample.txt +3 -0
- package/.agents/skills/token-and-context-optimizer/references/context_engineering_guide.md +49 -0
- package/.agents/skills/tot-exploratory-testing/SKILL.md +59 -0
- package/.agents/skills/tot-exploratory-testing/examples/payment_gateway_tot_tree.json +62 -0
- package/.agents/skills/tot-exploratory-testing/examples/tot_graph_sample.json +35 -0
- package/.agents/skills/verification-before-completion/SKILL.md +100 -0
- package/.agents/skills/verification-before-completion/examples/evidence_log_example.md +46 -0
- package/.agents/skills/visual-regression-sentinel/SKILL.md +82 -0
- package/.agents/skills/visual-regression-sentinel/examples/visual_mask_rules.json +9 -0
- package/.agents/skills/wcag-audit-patterns/SKILL.md +77 -0
- package/.agents/skills/wcag-audit-patterns/examples/wcag_compliance_checklist.json +10 -0
- package/.agents/skills/wcag-audit-patterns/resources/implementation-playbook.md +541 -0
- package/.agents/skills/web-agent-gym-benchmarking/SKILL.md +62 -0
- package/.agents/skills/web-agent-gym-benchmarking/examples/benchmark_report_sample.json +22 -0
- package/.agents/skills/web-agent-gym-benchmarking/examples/enterprise_tasks_suite.json +38 -0
- package/.agents/skills/web-vitals-and-performance-profiler/SKILL.md +65 -0
- package/.agents/skills/web-vitals-and-performance-profiler/examples/cwv_budget_policy.json +6 -0
- package/.agents/skills/web-vitals-and-performance-profiler/examples/playwright_cwv_profiler_fixture.ts +118 -0
- package/.agents/templates/completion_report.md +57 -0
- package/.agents/workflows/analyze_requirement_document.md +18 -0
- package/.agents/workflows/export_testcases_excel.md +32 -0
- package/.agents/workflows/generate_combinatorial_test_data.md +28 -0
- package/.agents/workflows/generate_cross_module_test_plan.md +37 -0
- package/.agents/workflows/generate_manual_testcases_rbt.md +56 -0
- package/.agents/workflows/generate_requirements_from_website.md +25 -0
- package/.agents/workflows/generate_testcases_from_requirements.md +21 -0
- package/.agents/workflows/graphify.md +10 -0
- package/.agents/workflows/test-impact.md +15 -0
- package/.agents/workflows/verify.md +34 -0
- package/.cursor/rules/agents.mdc +16 -0
- package/.cursor/rules/language.mdc +7 -0
- package/.cursor/rules/synapse-qa.mdc +24 -0
- package/.cursorrules +27 -0
- package/.dockerignore +53 -0
- package/.pre-commit-hooks.yaml +14 -0
- package/.windsurfrules +26 -0
- package/AGENTS.md +86 -0
- package/CLAUDE.md +54 -0
- package/Dockerfile +81 -0
- package/LICENSE +52 -0
- package/NOTICE +264 -0
- package/README.en.md +172 -0
- package/README.md +171 -2
- package/action.yml +51 -0
- package/agentskills.json +16 -0
- package/bin/agent-qa.js +138 -0
- package/docker-compose.yml +74 -0
- package/docs/ARCHITECTURE.en.md +197 -0
- package/docs/ARCHITECTURE.md +198 -0
- package/docs/CI_CD_INTEGRATION.en.md +170 -0
- package/docs/CI_CD_INTEGRATION.md +170 -0
- package/docs/CLI_REFERENCE.en.md +175 -0
- package/docs/CLI_REFERENCE.md +177 -0
- package/docs/CONTRIBUTING.en.md +49 -0
- package/docs/CONTRIBUTING.md +49 -0
- package/docs/PERFORMANCE_AUDIT_REPORT.md +784 -0
- package/docs/PLUGIN_DEVELOPMENT_GUIDE.md +127 -0
- package/docs/QUALITY_GATES.en.md +121 -0
- package/docs/QUALITY_GATES.md +121 -0
- package/docs/TOKEN_QUOTA_PLAYBOOK.md +41 -0
- package/docs/TOOL_CATALOG.md +129 -0
- package/docs/adopted-ecosystem-tools.md +96 -0
- package/docs/research/EXTERNAL_AGENT_SKILLS_SURVEY.md +1062 -0
- package/docs/research/agent_skill_training_analysis.md +1359 -0
- package/docs/schemas/synapse.config.schema.json +87 -0
- package/package.json +94 -4
- package/plugin.json +31 -0
- package/scripts/generate_skill_examples.py +244 -0
- package/scripts/install.ps1 +112 -0
- package/scripts/install_global_plugin.ps1 +94 -0
- package/scripts/install_global_plugin.sh +49 -0
- package/scripts/lint_skills.ps1 +57 -0
- package/scripts/package_dist.py +337 -0
- package/scripts/setup.sh +59 -0
- package/scripts/update_hub.ps1 +19 -0
- package/scripts/update_hub.sh +15 -0
- package/skills_manifest.json +854 -0
- package/synapse.config.json +32 -0
- package/templates/PROJECT_AI_GUIDE_TEMPLATE.md +111 -0
- package/templates/PROJECT_STATE_TEMPLATE.md +20 -0
- package/templates/ai_bridges/CLAUDE.md +54 -0
- package/templates/ai_bridges/copilot-instructions.md +20 -0
- package/templates/ai_bridges/cursor_synapse_qa.mdc +24 -0
- package/templates/ai_bridges/windsurfrules +26 -0
- package/templates/ci/github-actions-synapse.yml +95 -0
- package/templates/ci/gitlab-ci-synapse.yml +16 -0
- package/templates/ui/index.html +1069 -0
- package/templates/welcome.html.tmpl +2079 -0
- package/tools/.infer_baseline.json +30 -0
- package/tools/TOOLS_RUNBOOK.md +1553 -0
- package/tools/TOOL_CATALOG.json +1769 -0
- package/tools/__init__.py +43 -0
- package/tools/_openapi_parser.py +158 -0
- package/tools/agent_canary.py +525 -0
- package/tools/agentless_patcher.py +417 -0
- package/tools/analyze_project.py +258 -0
- package/tools/api_drift_sentinel.py +208 -0
- package/tools/api_fuzzer.py +762 -0
- package/tools/author_integrity.py +184 -0
- package/tools/auto_heal.py +271 -0
- package/tools/auto_heal_reflexion.py +532 -0
- package/tools/autogen_qa_broker.py +844 -0
- package/tools/benchmark_swarm_context.py +394 -0
- package/tools/browser_helpers.js +746 -0
- package/tools/browsergym_eval.py +236 -0
- package/tools/bug_reporter.py +252 -0
- package/tools/bump_version.py +423 -0
- package/tools/cache_resolver.py +1214 -0
- package/tools/check_env.py +426 -0
- package/tools/check_version_sync.py +256 -0
- package/tools/ci_healing_hook.py +126 -0
- package/tools/cli.py +1598 -0
- package/tools/config_decoupler.py +253 -0
- package/tools/contract_validator.py +141 -0
- package/tools/core/__init__.py +70 -0
- package/tools/core/adapters.py +431 -0
- package/tools/core/circuit_breaker.py +263 -0
- package/tools/core/cli_runtime.py +66 -0
- package/tools/core/file_lock.py +159 -0
- package/tools/core/i18n.py +394 -0
- package/tools/core/memory_bus.py +905 -0
- package/tools/core/process_supervisor.py +332 -0
- package/tools/core/telemetry.py +329 -0
- package/tools/count_tokens.py +1267 -0
- package/tools/create_mock_docx.py +104 -0
- package/tools/dashboard_generator.py +2419 -0
- package/tools/db_sandbox.py +675 -0
- package/tools/debt_harvester.py +237 -0
- package/tools/distill_log.py +161 -0
- package/tools/dspy_qa_signatures.py +356 -0
- package/tools/e2e_flow_prober.py +132 -0
- package/tools/export_postman_collection.py +945 -0
- package/tools/flaky_detector.py +389 -0
- package/tools/fsm_enforcer.py +450 -0
- package/tools/fsm_middleware.py +401 -0
- package/tools/fuzz_payloads.py +197 -0
- package/tools/generate_allure_report.py +88 -0
- package/tools/generate_api_matrix.py +193 -0
- package/tools/generate_jmx_plan.py +1322 -0
- package/tools/generate_sbom.py +252 -0
- package/tools/generate_tc_from_story.py +203 -0
- package/tools/generate_test_reports.py +133 -0
- package/tools/generate_tool_catalog.py +482 -0
- package/tools/gherkin_suite.py +758 -0
- package/tools/git_pre_commit_guard.py +298 -0
- package/tools/goldfish_review.py +366 -0
- package/tools/heal/__init__.py +28 -0
- package/tools/heal_pr_automator.py +220 -0
- package/tools/heuristic_locator_matcher.py +351 -0
- package/tools/hub_publisher.py +623 -0
- package/tools/humanize_linter.py +438 -0
- package/tools/infer_linter.py +977 -0
- package/tools/init_config.py +307 -0
- package/tools/interview_story.py +116 -0
- package/tools/jira_sync.py +566 -0
- package/tools/jtl_analyzer.py +474 -0
- package/tools/lint/__init__.py +30 -0
- package/tools/lint_ai_docs.py +374 -0
- package/tools/lookup_tc.py +165 -0
- package/tools/lookup_xpath.py +167 -0
- package/tools/matrix_sharder.py +148 -0
- package/tools/mcp/__init__.py +18 -0
- package/tools/mcp_docx_server.ps1 +13 -0
- package/tools/mcp_docx_server.py +851 -0
- package/tools/mcp_excel_server.ps1 +13 -0
- package/tools/mcp_excel_server.py +441 -0
- package/tools/mcp_server.py +724 -0
- package/tools/md_to_xlsx.py +327 -0
- package/tools/micro_mutator.py +887 -0
- package/tools/mipro_assertion_tuner.py +210 -0
- package/tools/network_mock_shield.py +311 -0
- package/tools/newman_analyzer.py +384 -0
- package/tools/omni_emitter.py +579 -0
- package/tools/omni_parser.py +450 -0
- package/tools/omni_transpiler.py +168 -0
- package/tools/openxml_guard.py +438 -0
- package/tools/output_formatter.py +182 -0
- package/tools/package_release.py +325 -0
- package/tools/perf/__init__.py +24 -0
- package/tools/pinpoint_failure.py +190 -0
- package/tools/project_state.py +171 -0
- package/tools/qa_event_stream.py +358 -0
- package/tools/repo_map.py +346 -0
- package/tools/report/__init__.py +32 -0
- package/tools/reversible_sandbox.py +344 -0
- package/tools/safety_firewall.py +437 -0
- package/tools/security_coverage_ledger.py +538 -0
- package/tools/security_scanner.py +229 -0
- package/tools/senior_code_review.py +393 -0
- package/tools/setup_project.py +770 -0
- package/tools/skill_collision_guard.py +304 -0
- package/tools/skill_profiles.py +217 -0
- package/tools/skill_vault.py +481 -0
- package/tools/skillspector.py +1278 -0
- package/tools/smart_visual_masker.py +132 -0
- package/tools/spec_drift_sentinel.py +438 -0
- package/tools/swe_qa_aci.py +369 -0
- package/tools/synapse_observer.py +485 -0
- package/tools/synapse_qa_bench.py +190 -0
- package/tools/sync_agent_rules.py +274 -0
- package/tools/telemetry_correlator.py +397 -0
- package/tools/template_excel_exporter.py +514 -0
- package/tools/templates/jmeter-distributed/README.md +54 -0
- package/tools/templates/jmeter-distributed/docker-compose.yml +83 -0
- package/tools/test_impact.py +419 -0
- package/tools/test_memory_os.py +462 -0
- package/tools/textgrad_mutation_optimizer.py +237 -0
- package/tools/tms_sync_bridge.py +834 -0
- package/tools/tot_exploratory_tester.py +239 -0
- package/tools/trace_data_flow.py +240 -0
- package/tools/traffic_session_converter.py +256 -0
- package/tools/trend_analytics.py +314 -0
- package/tools/ui_server.py +401 -0
- package/tools/universal_ir.py +488 -0
- package/tools/update_sentinel.py +383 -0
- package/tools/validate_groovy_scripts.py +173 -0
- package/tools/verify_all.py +1259 -0
- package/tools/visual_diff_canvas.py +143 -0
- package/tools/visual_som_helper.py +550 -0
- package/tools/watch_mode.py +308 -0
- package/tools/wcag_audit.py +239 -0
- package/tools/welcome_page.py +290 -0
package/tools/cli.py
ADDED
|
@@ -0,0 +1,1598 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) 2026 Thế Vị (@TeeVee998). All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
# Project: Synapse-Hub (https://github.com/TeeVee998/Synapse-Hub)
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
Enterprise Agent-QA CLI Entrypoint
|
|
8
|
+
----------------------------------
|
|
9
|
+
Provides a centralized command-line interface for the Synapse Hub ecosystem.
|
|
10
|
+
Dispatches commands to underlying specialized tools in tools/.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
import json
|
|
16
|
+
import re
|
|
17
|
+
import difflib
|
|
18
|
+
import argparse
|
|
19
|
+
from typing import Optional
|
|
20
|
+
|
|
21
|
+
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
22
|
+
if hasattr(sys.stdout, 'reconfigure'):
|
|
23
|
+
try:
|
|
24
|
+
sys.stdout.reconfigure(encoding='utf-8')
|
|
25
|
+
sys.stderr.reconfigure(encoding='utf-8')
|
|
26
|
+
except Exception:
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
30
|
+
REPO_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, ".."))
|
|
31
|
+
sys.path.insert(0, SCRIPT_DIR)
|
|
32
|
+
if REPO_ROOT not in sys.path:
|
|
33
|
+
sys.path.insert(0, REPO_ROOT)
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
from tools.core.i18n import resolve_language, t, persist_language_preference
|
|
37
|
+
except ImportError:
|
|
38
|
+
try:
|
|
39
|
+
from core.i18n import resolve_language, t, persist_language_preference
|
|
40
|
+
except ImportError:
|
|
41
|
+
def resolve_language(lang=None):
|
|
42
|
+
return "en"
|
|
43
|
+
def t(key, lang=None, **kwargs):
|
|
44
|
+
return key
|
|
45
|
+
def persist_language_preference(lang, target_dir=None):
|
|
46
|
+
return ""
|
|
47
|
+
|
|
48
|
+
# ANSI Color formatting
|
|
49
|
+
def _is_color_allowed() -> bool:
|
|
50
|
+
if os.environ.get("NO_COLOR") is not None or os.environ.get("TERM") == "dumb":
|
|
51
|
+
return False
|
|
52
|
+
if os.environ.get("FORCE_COLOR") in ("1", "true", "TRUE"):
|
|
53
|
+
return True
|
|
54
|
+
return hasattr(sys.stdout, "isatty") and sys.stdout.isatty()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
_use_color = _is_color_allowed()
|
|
58
|
+
CYAN = "\033[96m" if _use_color else ""
|
|
59
|
+
GREEN = "\033[92m" if _use_color else ""
|
|
60
|
+
YELLOW = "\033[93m" if _use_color else ""
|
|
61
|
+
RED = "\033[91m" if _use_color else ""
|
|
62
|
+
BOLD = "\033[1m" if _use_color else ""
|
|
63
|
+
RESET = "\033[0m" if _use_color else ""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def cmd_set_lang(args):
|
|
67
|
+
"""Sets and persists the CLI interface language preference."""
|
|
68
|
+
target_lang = getattr(args, "language", None)
|
|
69
|
+
if not target_lang:
|
|
70
|
+
cur = resolve_language()
|
|
71
|
+
if cur == "vi":
|
|
72
|
+
print("Ngôn ngữ giao diện hiện tại: Tiếng Việt (vi). Cú pháp: agent-qa set-lang <en|vi>")
|
|
73
|
+
else:
|
|
74
|
+
print("Current interface language: English (en). Usage: agent-qa set-lang <en|vi>")
|
|
75
|
+
sys.exit(0)
|
|
76
|
+
target_lang = str(target_lang).strip().lower()
|
|
77
|
+
if target_lang not in ("en", "vi"):
|
|
78
|
+
cur = resolve_language()
|
|
79
|
+
if cur == "vi":
|
|
80
|
+
print(f"❌ Lỗi: Mã ngôn ngữ '{target_lang}' không được hỗ trợ. Vui lòng chọn 'en' hoặc 'vi'.")
|
|
81
|
+
else:
|
|
82
|
+
print(f"❌ Error: Invalid language '{target_lang}'. Supported: 'en', 'vi'.")
|
|
83
|
+
sys.exit(2)
|
|
84
|
+
|
|
85
|
+
target_dir = os.getcwd() if getattr(args, "local", False) else None
|
|
86
|
+
cfg_file = persist_language_preference(target_lang, target_dir=target_dir)
|
|
87
|
+
os.environ["SYNAPSE_LANG"] = target_lang
|
|
88
|
+
|
|
89
|
+
lang_names = {
|
|
90
|
+
"en": "English" if target_lang == "en" else "Tiếng Anh",
|
|
91
|
+
"vi": "Vietnamese" if target_lang == "en" else "Tiếng Việt"
|
|
92
|
+
}
|
|
93
|
+
lang_name = lang_names.get(target_lang, target_lang)
|
|
94
|
+
print(t("lang_saved", lang=target_lang, lang_name=lang_name, lang_code=target_lang, config_path=cfg_file))
|
|
95
|
+
print(f"\n{t('tip_lang_switch', lang=target_lang)}")
|
|
96
|
+
sys.exit(0)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def cmd_version(args):
|
|
100
|
+
"""Displays the current hub version, skill catalog count, and license information."""
|
|
101
|
+
manifest_path = os.path.join(REPO_ROOT, "skills_manifest.json")
|
|
102
|
+
version = "3.8.2"
|
|
103
|
+
if os.path.exists(manifest_path):
|
|
104
|
+
try:
|
|
105
|
+
import json
|
|
106
|
+
with open(manifest_path, "r", encoding="utf-8") as f:
|
|
107
|
+
data = json.load(f)
|
|
108
|
+
version = data.get("version", version)
|
|
109
|
+
except (OSError, json.JSONDecodeError):
|
|
110
|
+
data = {}
|
|
111
|
+
print(f"Agent-QA Hub CLI v{version}")
|
|
112
|
+
manifest_skills = 42
|
|
113
|
+
if os.path.exists(manifest_path):
|
|
114
|
+
try:
|
|
115
|
+
import json
|
|
116
|
+
with open(manifest_path, "r", encoding="utf-8") as f:
|
|
117
|
+
manifest_skills = json.load(f).get("totalSkills", 42)
|
|
118
|
+
except (OSError, json.JSONDecodeError):
|
|
119
|
+
manifest_skills = 42
|
|
120
|
+
print(f"Catalog: {manifest_skills} Standardized Skills | 9 Subagent Swarm Profiles")
|
|
121
|
+
print("Created by: Thế Vị (@TeeVee998) <https://github.com/TeeVee998/Synapse-Hub>")
|
|
122
|
+
print("License : MIT (Attribution Required)")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def cmd_verify_author(args):
|
|
126
|
+
"""Validates author attribution and MIT provenance integrity across the repository."""
|
|
127
|
+
from author_integrity import verify_author_attribution, get_canonical_watermark, enforce_author_attribution
|
|
128
|
+
valid, violations = verify_author_attribution()
|
|
129
|
+
if valid:
|
|
130
|
+
print(f"✅ Author attribution & provenance verified: {get_canonical_watermark()}")
|
|
131
|
+
sys.exit(0)
|
|
132
|
+
else:
|
|
133
|
+
enforce_author_attribution(strict=True)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _strip_interface_lang_flags(args: list) -> list:
|
|
137
|
+
"""Strips global interface language flags (--lang/ -l {en,vi}) from forwarded args.
|
|
138
|
+
|
|
139
|
+
CRITICAL DOMAIN INVARIANT: Only strips when the language value is in ('en', 'vi').
|
|
140
|
+
Preserves tool-specific flags like '--lang=python' or '--lang cypress'.
|
|
141
|
+
"""
|
|
142
|
+
if not args:
|
|
143
|
+
return []
|
|
144
|
+
filtered = []
|
|
145
|
+
skip_next = False
|
|
146
|
+
for i, a in enumerate(args):
|
|
147
|
+
if skip_next:
|
|
148
|
+
skip_next = False
|
|
149
|
+
continue
|
|
150
|
+
if a in ("--lang", "-l") and i + 1 < len(args) and args[i + 1].strip().lower() in ("en", "vi"):
|
|
151
|
+
skip_next = True
|
|
152
|
+
continue
|
|
153
|
+
if a.startswith(("--lang=", "-l=")):
|
|
154
|
+
val = a.split("=", 1)[1].strip().lower()
|
|
155
|
+
if val in ("en", "vi"):
|
|
156
|
+
continue
|
|
157
|
+
filtered.append(a)
|
|
158
|
+
return filtered
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _forward_subcommand_args(args_or_name=None) -> list:
|
|
162
|
+
"""Safely extracts and forwards arguments intended for the underlying subcommand tool."""
|
|
163
|
+
subcmd = args_or_name if isinstance(args_or_name, str) else getattr(args_or_name, "subcommand", None)
|
|
164
|
+
if subcmd and subcmd in sys.argv:
|
|
165
|
+
raw_args = sys.argv[sys.argv.index(subcmd) + 1:]
|
|
166
|
+
else:
|
|
167
|
+
raw_args = sys.argv[2:] if len(sys.argv) > 2 else []
|
|
168
|
+
|
|
169
|
+
return [sys.argv[0]] + _strip_interface_lang_flags(raw_args)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def cmd_verify(args):
|
|
174
|
+
"""Executes the 11 Quality Gates Definition of Done (DoD) verification suite."""
|
|
175
|
+
from verify_all import main as verify_main
|
|
176
|
+
sys.argv = _forward_subcommand_args(args)
|
|
177
|
+
sys.exit(verify_main())
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def cmd_lint(args):
|
|
181
|
+
"""Runs the Meta Infer-style AST Fake-Pass, zero-assertion, and hard sleep scanner."""
|
|
182
|
+
from infer_linter import main as lint_main
|
|
183
|
+
sys.argv = _forward_subcommand_args(args)
|
|
184
|
+
sys.exit(lint_main())
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def cmd_heal(args):
|
|
188
|
+
"""Interacts with the central episodic self-healing solution memory cache."""
|
|
189
|
+
from cache_resolver import main as heal_main
|
|
190
|
+
sys.argv = _forward_subcommand_args(args)
|
|
191
|
+
sys.exit(heal_main())
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def cmd_distill(args):
|
|
195
|
+
"""Distills and filters high-volume CI/CD test execution logs by ~95%."""
|
|
196
|
+
from distill_log import main as distill_main
|
|
197
|
+
sys.argv = _forward_subcommand_args(args)
|
|
198
|
+
sys.exit(distill_main())
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def cmd_impact(args):
|
|
202
|
+
"""Analyzes code change impact and scopes affected tests using AST graph mapping."""
|
|
203
|
+
from test_impact import main as impact_main
|
|
204
|
+
sys.argv = _forward_subcommand_args(args)
|
|
205
|
+
sys.exit(impact_main())
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def cmd_clean(args):
|
|
209
|
+
"""Cleans temporary build files, __pycache__, and compiled bytecode across the repository."""
|
|
210
|
+
import shutil
|
|
211
|
+
removed_count = 0
|
|
212
|
+
print("🧹 Cleaning temporary build artifacts and bytecode caches...")
|
|
213
|
+
for root, dirs, files in os.walk(REPO_ROOT):
|
|
214
|
+
for d in list(dirs):
|
|
215
|
+
if d == "__pycache__":
|
|
216
|
+
full_dir = os.path.join(root, d)
|
|
217
|
+
try:
|
|
218
|
+
shutil.rmtree(full_dir)
|
|
219
|
+
removed_count += 1
|
|
220
|
+
dirs.remove(d)
|
|
221
|
+
except Exception as e:
|
|
222
|
+
print(f"⚠️ Could not remove {full_dir}: {e}")
|
|
223
|
+
for f in files:
|
|
224
|
+
if f.endswith((".pyc", ".pyo", ".tmp")):
|
|
225
|
+
try:
|
|
226
|
+
os.remove(os.path.join(root, f))
|
|
227
|
+
removed_count += 1
|
|
228
|
+
except OSError as err:
|
|
229
|
+
getattr(args, "verbose", False) and print(f"Notice: Could not remove {f}: {err}")
|
|
230
|
+
print(f"✅ Cleanup finished: {removed_count} build artifacts and caches removed.")
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def cmd_flaky(args):
|
|
234
|
+
"""Detects non-deterministic flaky tests and manages quarantine governance."""
|
|
235
|
+
from flaky_detector import main as flaky_main
|
|
236
|
+
sys.argv = _forward_subcommand_args(args)
|
|
237
|
+
sys.exit(flaky_main())
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def cmd_canary(args):
|
|
241
|
+
"""Executes the autonomous canary self-healing benchmark across 8 failure vectors."""
|
|
242
|
+
from agent_canary import main as canary_main
|
|
243
|
+
sys.argv = _forward_subcommand_args(args)
|
|
244
|
+
sys.exit(canary_main())
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def cmd_analyze(args):
|
|
248
|
+
"""Runs comprehensive 5-in-1 project health and AST architecture analysis."""
|
|
249
|
+
from analyze_project import main as analyze_main
|
|
250
|
+
sys.argv = _forward_subcommand_args(args)
|
|
251
|
+
sys.exit(analyze_main())
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def cmd_setup(args):
|
|
255
|
+
"""Bootstraps a target test repository with AI guide, Git hook, and AST map."""
|
|
256
|
+
from setup_project import main as setup_main
|
|
257
|
+
sys.argv = _forward_subcommand_args(args)
|
|
258
|
+
sys.exit(setup_main())
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def cmd_doctor(args):
|
|
262
|
+
"""Runs a 1-click diagnostic check of system environment, tools, and dependencies."""
|
|
263
|
+
from check_env import main as check_env_main
|
|
264
|
+
sys.argv = _forward_subcommand_args(args)
|
|
265
|
+
sys.exit(check_env_main())
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def cmd_uninstall(args):
|
|
269
|
+
"""Reverts and cleans configuration files and Git hooks installed by setup in target project."""
|
|
270
|
+
from setup_project import uninstall_setup, resolve_target_repo
|
|
271
|
+
target = getattr(args, "target", None)
|
|
272
|
+
target_repo = resolve_target_repo(cli_target=target)
|
|
273
|
+
sys.exit(uninstall_setup(target_repo))
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def cmd_auto_heal(args):
|
|
277
|
+
"""Executes closed-loop test failure diagnosis and creates a locator healing plan."""
|
|
278
|
+
from auto_heal import main as auto_heal_main
|
|
279
|
+
sys.argv = _forward_subcommand_args(args)
|
|
280
|
+
sys.exit(auto_heal_main())
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def cmd_safety_check(args):
|
|
284
|
+
"""Validates actions against the Action Safety Firewall to prevent destructive operations."""
|
|
285
|
+
from safety_firewall import main as safety_main
|
|
286
|
+
sys.argv = _forward_subcommand_args(args)
|
|
287
|
+
sys.exit(safety_main())
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def cmd_contract_drift(args):
|
|
291
|
+
"""Detects breaking API changes across OpenAPI / Swagger contract specifications."""
|
|
292
|
+
from api_drift_sentinel import main as drift_main
|
|
293
|
+
sys.argv = _forward_subcommand_args(args)
|
|
294
|
+
sys.exit(drift_main())
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def cmd_mcp_serve(args):
|
|
298
|
+
"""Starts the JSON-RPC 2.0 stdio Model Context Protocol (MCP) server."""
|
|
299
|
+
from mcp_server import run_stdio_server
|
|
300
|
+
run_stdio_server()
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def cmd_mutate(args):
|
|
304
|
+
"""Injects syntactic micro-mutations to measure test assertion sensitivity."""
|
|
305
|
+
from micro_mutator import main as mut_main
|
|
306
|
+
sys.argv = _forward_subcommand_args(args)
|
|
307
|
+
sys.exit(mut_main())
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def cmd_heal_pr(args):
|
|
311
|
+
"""Calculates self-healing confidence and generates an automated Git pull request draft."""
|
|
312
|
+
from heal_pr_automator import main as pr_main
|
|
313
|
+
sys.argv = _forward_subcommand_args(args)
|
|
314
|
+
sys.exit(pr_main())
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def cmd_shard(args):
|
|
318
|
+
"""Balances parallel CI/CD test execution using duration-balanced bin-packing."""
|
|
319
|
+
from matrix_sharder import main as shard_main
|
|
320
|
+
sys.argv = _forward_subcommand_args(args)
|
|
321
|
+
sys.exit(shard_main())
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def cmd_transpile(args):
|
|
325
|
+
from omni_transpiler import transpile_file
|
|
326
|
+
res = transpile_file(args.source, args.to, args.out)
|
|
327
|
+
print(f"✅ Transpiled '{args.source}' -> {args.to} ({len(res)} files):")
|
|
328
|
+
for p, code in res.items():
|
|
329
|
+
print(f" • {p} ({len(code.splitlines())} lines)")
|
|
330
|
+
if not args.out:
|
|
331
|
+
print("---")
|
|
332
|
+
print(code)
|
|
333
|
+
print("---")
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
def cmd_omni_scan(args):
|
|
337
|
+
from omni_transpiler import scan_repository
|
|
338
|
+
inv = scan_repository(args.path)
|
|
339
|
+
if getattr(args, "json", False):
|
|
340
|
+
print(json.dumps(inv, indent=2))
|
|
341
|
+
else:
|
|
342
|
+
print("======================================================================")
|
|
343
|
+
print(" OMNI-AUTOMATION POLYGLOT REPOSITORY INVENTORY (0-TOKEN AST SCAN)")
|
|
344
|
+
print("======================================================================")
|
|
345
|
+
print(f"📁 Target Directory : {inv['repository']}")
|
|
346
|
+
print(f"📄 Scanned Files : {inv['total_files_scanned']}")
|
|
347
|
+
print(f"🌐 Languages Detected : {inv['languages']}")
|
|
348
|
+
print(f"⚡ Frameworks : {inv['frameworks']}")
|
|
349
|
+
print(f"🏛️ Page Classes Found : {len(inv['pages'])}")
|
|
350
|
+
print(f"🎯 Total Locators : {inv['total_locators']}")
|
|
351
|
+
print(f"⚙️ Action Methods : {inv['total_methods']}")
|
|
352
|
+
print(f"🧪 Test Cases Found : {len(inv['test_cases'])}")
|
|
353
|
+
print("======================================================================")
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def cmd_report_bug(args):
|
|
357
|
+
from bug_reporter import main as bug_main
|
|
358
|
+
sys.argv = _forward_subcommand_args(args)
|
|
359
|
+
sys.exit(bug_main())
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def cmd_mock_shield(args):
|
|
363
|
+
from network_mock_shield import main as mock_main
|
|
364
|
+
sys.argv = _forward_subcommand_args(args)
|
|
365
|
+
sys.exit(mock_main())
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def cmd_visual_mask(args):
|
|
369
|
+
from smart_visual_masker import main as mask_main
|
|
370
|
+
sys.argv = _forward_subcommand_args(args)
|
|
371
|
+
sys.exit(mask_main())
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def cmd_review_spec(args):
|
|
375
|
+
from goldfish_review import main as review_main
|
|
376
|
+
sys.argv = _forward_subcommand_args(args)
|
|
377
|
+
sys.exit(review_main())
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def cmd_drift_check(args):
|
|
381
|
+
from spec_drift_sentinel import main as drift_main
|
|
382
|
+
sys.argv = _forward_subcommand_args(args)
|
|
383
|
+
sys.exit(drift_main())
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def cmd_ci_hook(args):
|
|
387
|
+
from ci_healing_hook import main as hook_main
|
|
388
|
+
sys.argv = _forward_subcommand_args(args)
|
|
389
|
+
sys.exit(hook_main())
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
def cmd_migrate(args):
|
|
393
|
+
"""Migrates an entire legacy test suite (Katalon, Cypress, Selenium) to modern target (Playwright TS)."""
|
|
394
|
+
from omni_transpiler import transpile_file
|
|
395
|
+
src = getattr(args, "src", None)
|
|
396
|
+
dest = getattr(args, "dest", None) or "playwright_suite"
|
|
397
|
+
target = getattr(args, "target", "playwright-ts")
|
|
398
|
+
if not src:
|
|
399
|
+
print("❌ Error: --src parameter is required for migrate.")
|
|
400
|
+
sys.exit(1)
|
|
401
|
+
|
|
402
|
+
if os.path.isdir(src):
|
|
403
|
+
migrated_count = 0
|
|
404
|
+
test_exts = {".groovy", ".java", ".js", ".ts", ".py"}
|
|
405
|
+
for root, _, files in os.walk(src):
|
|
406
|
+
for f in files:
|
|
407
|
+
if os.path.splitext(f)[1].lower() in test_exts:
|
|
408
|
+
file_path = os.path.join(root, f)
|
|
409
|
+
try:
|
|
410
|
+
transpile_file(file_path, target, output_dir=dest, hermetic=True)
|
|
411
|
+
migrated_count += 1
|
|
412
|
+
except (OSError, ValueError, SyntaxError) as e:
|
|
413
|
+
print(f" ⚠️ Skipping {f}: {e}")
|
|
414
|
+
print(f"✅ [MIGRATION COMPLETE] {migrated_count} test files converted to {target} in '{dest}'.")
|
|
415
|
+
else:
|
|
416
|
+
transpile_file(src, target, output_dir=dest, hermetic=True)
|
|
417
|
+
print(f"✅ [MIGRATION COMPLETE] '{src}' -> {target} in '{dest}'.")
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
def cmd_decouple_config(args):
|
|
421
|
+
from config_decoupler import main as decouple_main
|
|
422
|
+
sys.argv = _forward_subcommand_args(args)
|
|
423
|
+
sys.exit(decouple_main())
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def cmd_fuzz_api(args):
|
|
427
|
+
from api_fuzzer import main as fuzz_main
|
|
428
|
+
sys.argv = _forward_subcommand_args(args)
|
|
429
|
+
sys.exit(fuzz_main())
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
def cmd_som(args):
|
|
433
|
+
from visual_som_helper import main as som_main
|
|
434
|
+
sys.argv = _forward_subcommand_args(args)
|
|
435
|
+
sys.exit(som_main())
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
def cmd_gherkin(args):
|
|
439
|
+
from gherkin_suite import main as gherkin_main
|
|
440
|
+
sys.argv = _forward_subcommand_args(args)
|
|
441
|
+
sys.exit(gherkin_main())
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
def cmd_export_postman(args):
|
|
445
|
+
from export_postman_collection import main as postman_main
|
|
446
|
+
sys.argv = _forward_subcommand_args(args)
|
|
447
|
+
sys.exit(postman_main())
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def cmd_generate_jmx(args):
|
|
451
|
+
from generate_jmx_plan import main as jmx_main
|
|
452
|
+
sys.argv = _forward_subcommand_args(args)
|
|
453
|
+
sys.exit(jmx_main())
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
def cmd_skillspector(args):
|
|
457
|
+
from skillspector import main as skillspector_main
|
|
458
|
+
sys.argv = _forward_subcommand_args(args)
|
|
459
|
+
sys.exit(skillspector_main())
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def cmd_skills(args):
|
|
463
|
+
from skill_profiles import main as skills_main
|
|
464
|
+
sys.argv = _forward_subcommand_args(args)
|
|
465
|
+
sys.exit(skills_main())
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
def cmd_analyze_jtl(args):
|
|
469
|
+
from jtl_analyzer import main as jtl_main
|
|
470
|
+
sys.argv = _forward_subcommand_args(args)
|
|
471
|
+
sys.exit(jtl_main())
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
def cmd_export_excel(args):
|
|
475
|
+
"""Converts Markdown test cases into styled Excel, cloning corporate template if configured."""
|
|
476
|
+
from template_excel_exporter import main as excel_main
|
|
477
|
+
sys.argv = _forward_subcommand_args(args)
|
|
478
|
+
sys.exit(excel_main())
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
def cmd_init_config(args):
|
|
482
|
+
"""Initializes a canonical .synapse.json configuration file for Spoke target projects."""
|
|
483
|
+
from init_config import main as init_cfg_main
|
|
484
|
+
sys.argv = _forward_subcommand_args(args)
|
|
485
|
+
sys.exit(init_cfg_main())
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
def cmd_help(args):
|
|
489
|
+
"""Displays command-line help and usage documentation."""
|
|
490
|
+
parser = getattr(args, "_parser", None)
|
|
491
|
+
if parser:
|
|
492
|
+
parser.print_help()
|
|
493
|
+
sys.exit(0)
|
|
494
|
+
print("Run 'agent-qa --help' to view command-line usage.")
|
|
495
|
+
sys.exit(0)
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
def cmd_correlate_telemetry(args):
|
|
499
|
+
from telemetry_correlator import main as telem_main
|
|
500
|
+
sys.argv = _forward_subcommand_args(args)
|
|
501
|
+
sys.exit(telem_main())
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
def cmd_analyze_newman(args):
|
|
505
|
+
from newman_analyzer import main as newman_main
|
|
506
|
+
sys.argv = _forward_subcommand_args(args)
|
|
507
|
+
sys.exit(newman_main())
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
def cmd_update(args):
|
|
511
|
+
import update_sentinel
|
|
512
|
+
if getattr(args, "check", False):
|
|
513
|
+
has_update, cur, rem = update_sentinel.check_for_updates(force=True, notify=False)
|
|
514
|
+
print(f"Current Hub Version : v{cur}")
|
|
515
|
+
print(f"Latest Upstream : v{rem if rem else 'Unknown'}")
|
|
516
|
+
if has_update:
|
|
517
|
+
print(f"⚠️ An update is available: v{cur} -> v{rem}. Run 'agent-qa update' to upgrade.")
|
|
518
|
+
sys.exit(1)
|
|
519
|
+
else:
|
|
520
|
+
print("✅ Synapse-Hub is up to date.")
|
|
521
|
+
sys.exit(0)
|
|
522
|
+
update_sentinel.perform_update()
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
def cmd_tokens(args):
|
|
526
|
+
import count_tokens
|
|
527
|
+
sys.argv = _forward_subcommand_args(args)
|
|
528
|
+
count_tokens.main()
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
def cmd_dashboard(args):
|
|
532
|
+
import dashboard_generator
|
|
533
|
+
sys.argv = _forward_subcommand_args(args)
|
|
534
|
+
dashboard_generator.main()
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
def cmd_watch(args):
|
|
538
|
+
import watch_mode
|
|
539
|
+
sys.argv = _forward_subcommand_args(args)
|
|
540
|
+
watch_mode.main()
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
def cmd_welcome(args):
|
|
544
|
+
import welcome_page
|
|
545
|
+
sys.argv = _forward_subcommand_args(args)
|
|
546
|
+
welcome_page.main()
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
def cmd_wcag_audit(args):
|
|
550
|
+
from wcag_audit import main as wcag_main
|
|
551
|
+
sys.argv = _forward_subcommand_args(args)
|
|
552
|
+
sys.exit(wcag_main())
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
def cmd_lookup_tc(args):
|
|
556
|
+
from lookup_tc import main as tc_main
|
|
557
|
+
sys.argv = _forward_subcommand_args(args)
|
|
558
|
+
sys.exit(tc_main())
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
def cmd_lookup_xpath(args):
|
|
562
|
+
from lookup_xpath import main as xpath_main
|
|
563
|
+
sys.argv = _forward_subcommand_args(args)
|
|
564
|
+
sys.exit(xpath_main())
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
def cmd_trace_data_flow(args):
|
|
568
|
+
from trace_data_flow import main as tdf_main
|
|
569
|
+
sys.argv = _forward_subcommand_args(args)
|
|
570
|
+
sys.exit(tdf_main())
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
def cmd_generate_tc(args):
|
|
574
|
+
from generate_tc_from_story import main as gen_tc_main
|
|
575
|
+
sys.argv = _forward_subcommand_args(args)
|
|
576
|
+
sys.exit(gen_tc_main())
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
def cmd_pinpoint_failure(args):
|
|
580
|
+
from pinpoint_failure import main as pp_main
|
|
581
|
+
sys.argv = _forward_subcommand_args(args)
|
|
582
|
+
sys.exit(pp_main())
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
def cmd_sync_rules(args):
|
|
586
|
+
from sync_agent_rules import main as sync_rules_main
|
|
587
|
+
sys.argv = _forward_subcommand_args(args)
|
|
588
|
+
sys.exit(sync_rules_main())
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
def cmd_api_matrix(args):
|
|
592
|
+
from generate_api_matrix import main as api_matrix_main
|
|
593
|
+
sys.argv = _forward_subcommand_args(args)
|
|
594
|
+
sys.exit(api_matrix_main())
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
def cmd_canvas_diff(args):
|
|
598
|
+
from visual_diff_canvas import main as canvas_diff_main
|
|
599
|
+
sys.argv = _forward_subcommand_args(args)
|
|
600
|
+
sys.exit(canvas_diff_main())
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
def cmd_validate_groovy(args):
|
|
604
|
+
from validate_groovy_scripts import main as groovy_main
|
|
605
|
+
sys.argv = _forward_subcommand_args(args)
|
|
606
|
+
sys.exit(groovy_main())
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
def cmd_check_version(args):
|
|
610
|
+
from check_version_sync import main as ver_sync_main
|
|
611
|
+
sys.argv = _forward_subcommand_args(args)
|
|
612
|
+
sys.exit(ver_sync_main())
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
def cmd_mcp_excel(args):
|
|
616
|
+
from mcp_excel_server import main as mcp_excel_main
|
|
617
|
+
sys.argv = _forward_subcommand_args(args)
|
|
618
|
+
sys.exit(mcp_excel_main())
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
def cmd_mcp_docx(args):
|
|
622
|
+
from mcp_docx_server import main as mcp_docx_main
|
|
623
|
+
sys.argv = _forward_subcommand_args(args)
|
|
624
|
+
sys.exit(mcp_docx_main())
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
def cmd_debt(args):
|
|
628
|
+
"""Harvests shortcut: and deliberate debt comments into a tracked technical debt ledger."""
|
|
629
|
+
from debt_harvester import main as debt_main
|
|
630
|
+
sys.argv = _forward_subcommand_args(args)
|
|
631
|
+
sys.exit(debt_main())
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
def cmd_review(args):
|
|
635
|
+
"""Senior developer diff & code review checking bugs, security, scale, missing tests, and bloat."""
|
|
636
|
+
from senior_code_review import main as review_main
|
|
637
|
+
sys.argv = _forward_subcommand_args(args)
|
|
638
|
+
sys.exit(review_main())
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
def cmd_release(args):
|
|
642
|
+
"""1-Click atomic release: bumps version across all files, runs 11 Quality Gates, tags & pushes to trigger NPM Trusted Publishing."""
|
|
643
|
+
from bump_version import main as bump_main
|
|
644
|
+
forwarded = _forward_subcommand_args(args)
|
|
645
|
+
if "--no-push" not in forwarded and "--push" not in forwarded:
|
|
646
|
+
forwarded.append("--push")
|
|
647
|
+
if "--commit" not in forwarded and "--no-commit" not in forwarded:
|
|
648
|
+
forwarded.append("--commit")
|
|
649
|
+
sys.argv = forwarded
|
|
650
|
+
sys.exit(bump_main())
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
def cmd_hub_publish(args):
|
|
654
|
+
"""End-to-End Hub release & publish pipeline: push to main, tag, release, GitHub Packages, and NPM Registry."""
|
|
655
|
+
from hub_publisher import main as publisher_main
|
|
656
|
+
sys.argv = _forward_subcommand_args(args)
|
|
657
|
+
sys.exit(publisher_main())
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
def cmd_ui(args):
|
|
661
|
+
"""Launches the interactive QA Mission Control Web UI."""
|
|
662
|
+
from ui_server import run_server
|
|
663
|
+
target = getattr(args, "target", None) or getattr(args, "repo", None)
|
|
664
|
+
run_server(host=args.host, port=args.port, open_browser=not args.no_browser, target_dir=target)
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
def cmd_jira_sync(args):
|
|
668
|
+
"""Synchronizes test cases, user stories, execution results, and bugs with Jira/Xray."""
|
|
669
|
+
from jira_sync import main as jira_main
|
|
670
|
+
sys.argv = _forward_subcommand_args(args)
|
|
671
|
+
sys.exit(jira_main())
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
def cmd_trend(args):
|
|
675
|
+
"""Historical Quality Trend & Flakiness Analytics Engine."""
|
|
676
|
+
from trend_analytics import main as trend_main
|
|
677
|
+
sys.argv = _forward_subcommand_args(args)
|
|
678
|
+
sys.exit(trend_main())
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
def _hub_version():
|
|
682
|
+
manifest_path = os.path.join(REPO_ROOT, "skills_manifest.json")
|
|
683
|
+
version = "3.8.2"
|
|
684
|
+
if os.path.exists(manifest_path):
|
|
685
|
+
try:
|
|
686
|
+
import json
|
|
687
|
+
with open(manifest_path, "r", encoding="utf-8") as f:
|
|
688
|
+
version = json.load(f).get("version", version)
|
|
689
|
+
except (OSError, json.JSONDecodeError):
|
|
690
|
+
version = "3.8.2"
|
|
691
|
+
return version
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
def _extract_cli_lang(argv: Optional[list] = None) -> Optional[str]:
|
|
695
|
+
"""Scans argv (or sys.argv) early for explicit --lang {en,vi} or -l {en,vi} flag."""
|
|
696
|
+
target_args = argv if argv is not None else sys.argv
|
|
697
|
+
for i, arg in enumerate(target_args):
|
|
698
|
+
if arg in ("--lang", "-l") and i + 1 < len(target_args):
|
|
699
|
+
val = target_args[i + 1].strip().lower()
|
|
700
|
+
if val in ("en", "vi"):
|
|
701
|
+
os.environ["SYNAPSE_LANG"] = val
|
|
702
|
+
return val
|
|
703
|
+
elif arg.startswith(("--lang=", "-l=")):
|
|
704
|
+
val = arg.split("=", 1)[1].strip().lower()
|
|
705
|
+
if val in ("en", "vi"):
|
|
706
|
+
os.environ["SYNAPSE_LANG"] = val
|
|
707
|
+
return val
|
|
708
|
+
return None
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
CORE_COMMAND_SPECS = [
|
|
712
|
+
("doctor", "cmd_doctor"),
|
|
713
|
+
("setup", "cmd_setup"),
|
|
714
|
+
("init-config", "cmd_init_config"),
|
|
715
|
+
("lint", "cmd_lint"),
|
|
716
|
+
("verify", "cmd_verify"),
|
|
717
|
+
("export-excel", "cmd_export_excel"),
|
|
718
|
+
("welcome", "cmd_welcome"),
|
|
719
|
+
("ui", "cmd_ui"),
|
|
720
|
+
("dashboard", "cmd_dashboard"),
|
|
721
|
+
("analyze", "cmd_analyze"),
|
|
722
|
+
("set-lang", "cmd_set_lang"),
|
|
723
|
+
]
|
|
724
|
+
|
|
725
|
+
ADVANCED_HIGHLIGHT_SPECS = [
|
|
726
|
+
("mutate", "cmd_mutate"),
|
|
727
|
+
("auto-heal", "cmd_auto_heal"),
|
|
728
|
+
("som", "cmd_som"),
|
|
729
|
+
("fuzz-api", "cmd_fuzz_api"),
|
|
730
|
+
("transpile", "cmd_transpile"),
|
|
731
|
+
]
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
def _render_tiered_cli_help(lang: str) -> str:
|
|
735
|
+
"""Renders the localized, tiered CLI help banner for Core & Daily Workflows."""
|
|
736
|
+
lines = [
|
|
737
|
+
f"\n{BOLD}{CYAN}======================================================================{RESET}",
|
|
738
|
+
f"{BOLD}{CYAN} 🧠 {t('banner_title', lang=lang)} {RESET}",
|
|
739
|
+
f"{BOLD}{CYAN}======================================================================{RESET}",
|
|
740
|
+
f"{t('version_info', lang=lang, version=_hub_version())}\n",
|
|
741
|
+
f"{BOLD}{t('usage_title', lang=lang)}{RESET}",
|
|
742
|
+
f"{t('usage_syntax', lang=lang)}\n",
|
|
743
|
+
f"{BOLD}{t('core_commands_title', lang=lang)}{RESET}",
|
|
744
|
+
]
|
|
745
|
+
|
|
746
|
+
for cmd, msg_key in CORE_COMMAND_SPECS:
|
|
747
|
+
lines.append(f" {BOLD}{GREEN}{cmd:<14}{RESET} {t(msg_key, lang=lang)}")
|
|
748
|
+
|
|
749
|
+
lines.append(f"\n{BOLD}{t('advanced_highlights_title', lang=lang)}{RESET}")
|
|
750
|
+
for cmd, msg_key in ADVANCED_HIGHLIGHT_SPECS:
|
|
751
|
+
lines.append(f" {CYAN}{cmd:<14}{RESET} {t(msg_key, lang=lang)}")
|
|
752
|
+
|
|
753
|
+
lines.append(f"\n{BOLD}{t('general_options_title', lang=lang)}{RESET}")
|
|
754
|
+
lines.append(f" {BOLD}-a, --all{RESET} {t('opt_all', lang=lang)}")
|
|
755
|
+
lines.append(f" {BOLD}--version{RESET} {t('opt_version', lang=lang)}")
|
|
756
|
+
lines.append(f" {BOLD}--offline{RESET} {t('opt_offline', lang=lang)}")
|
|
757
|
+
lines.append(f" {BOLD}-q, --quiet{RESET} {t('opt_quiet', lang=lang)}")
|
|
758
|
+
lines.append(f" {BOLD}--lang {{en,vi}}{RESET} {t('opt_lang', lang=lang)}")
|
|
759
|
+
|
|
760
|
+
lines.append(f"\n{YELLOW}{t('tips_header', lang=lang)}{RESET}")
|
|
761
|
+
lines.append(f" {t('tip_all', lang=lang)}")
|
|
762
|
+
lines.append(f" {t('tip_cmd', lang=lang)}")
|
|
763
|
+
lines.append(f" {t('tip_welcome', lang=lang)}")
|
|
764
|
+
lines.append(f" {t('tip_lang_switch', lang=lang)}\n")
|
|
765
|
+
return "\n".join(lines)
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
class SynapseArgumentParser(argparse.ArgumentParser):
|
|
769
|
+
"""Enhanced ArgumentParser providing bilingual support and fuzzy Did-You-Mean suggestions."""
|
|
770
|
+
|
|
771
|
+
def __init__(self, *args, lang: Optional[str] = None, **kwargs):
|
|
772
|
+
super().__init__(*args, **kwargs)
|
|
773
|
+
self.lang = lang or resolve_language(_extract_cli_lang())
|
|
774
|
+
self._localize_argparse_groups()
|
|
775
|
+
|
|
776
|
+
def _localize_argparse_groups(self):
|
|
777
|
+
"""Applies active language localization to built-in argparse section titles and help."""
|
|
778
|
+
if self.lang == "vi":
|
|
779
|
+
if self.prog == "agent-qa":
|
|
780
|
+
self._positionals.title = "Tham số và lệnh khả dụng"
|
|
781
|
+
self._optionals.title = "Tùy chọn chung"
|
|
782
|
+
else:
|
|
783
|
+
self._positionals.title = "Tham số vị trí"
|
|
784
|
+
self._optionals.title = "Tùy chọn"
|
|
785
|
+
for a in self._actions:
|
|
786
|
+
if a.dest == "help":
|
|
787
|
+
a.help = "Hiển thị hướng dẫn sử dụng và thoát"
|
|
788
|
+
else:
|
|
789
|
+
if self.prog == "agent-qa":
|
|
790
|
+
self._positionals.title = "positional arguments"
|
|
791
|
+
self._optionals.title = "general options"
|
|
792
|
+
else:
|
|
793
|
+
self._positionals.title = "positional arguments"
|
|
794
|
+
self._optionals.title = "options"
|
|
795
|
+
for a in self._actions:
|
|
796
|
+
if a.dest == "help":
|
|
797
|
+
a.help = "show this help message and exit"
|
|
798
|
+
|
|
799
|
+
def error(self, message):
|
|
800
|
+
m = re.search(r"(?:argument\s+)?subcommand:\s+invalid choice:\s+'([^']+)'", message)
|
|
801
|
+
if m:
|
|
802
|
+
bad_choice = m.group(1)
|
|
803
|
+
choices = []
|
|
804
|
+
for action in self._actions:
|
|
805
|
+
if isinstance(action, argparse._SubParsersAction):
|
|
806
|
+
choices = list(action.choices.keys())
|
|
807
|
+
break
|
|
808
|
+
matches = difflib.get_close_matches(bad_choice, choices, n=3, cutoff=0.4)
|
|
809
|
+
err_msg = t("typo_error", lang=self.lang, choice=bad_choice)
|
|
810
|
+
sys.stderr.write(f"\n{BOLD}{RED}{err_msg}{RESET}\n")
|
|
811
|
+
if matches:
|
|
812
|
+
suggestions = ", ".join(f"{BOLD}{GREEN}{c}{RESET}" for c in matches)
|
|
813
|
+
sug_msg = t("typo_suggest", lang=self.lang, suggestions=suggestions)
|
|
814
|
+
hint_msg = t("typo_help_hint", lang=self.lang, first_match=matches[0])
|
|
815
|
+
sys.stderr.write(f"{sug_msg}\n\n")
|
|
816
|
+
sys.stderr.write(f"{hint_msg}\n\n")
|
|
817
|
+
else:
|
|
818
|
+
list_msg = t("typo_list_hint", lang=self.lang)
|
|
819
|
+
sys.stderr.write(f"{list_msg}\n\n")
|
|
820
|
+
sys.exit(2)
|
|
821
|
+
super().error(message)
|
|
822
|
+
|
|
823
|
+
def _delegate_subcommand_help(self):
|
|
824
|
+
"""Attempts to delegate help display to underlying tool if handler forwards args."""
|
|
825
|
+
custom_actions = [a for a in self._actions if not isinstance(a, argparse._HelpAction)]
|
|
826
|
+
if custom_actions:
|
|
827
|
+
return
|
|
828
|
+
|
|
829
|
+
if "--help" in sys.argv or "-h" in sys.argv:
|
|
830
|
+
subcmd = self.prog.split()[-1] if " " in self.prog else self.prog
|
|
831
|
+
if subcmd in ("mcp-excel", "mcp-docx", "mcp-serve"):
|
|
832
|
+
return
|
|
833
|
+
handler = self._defaults.get("func")
|
|
834
|
+
if handler and "_forward_subcommand_args" in getattr(getattr(handler, "__code__", None), "co_names", ()):
|
|
835
|
+
try:
|
|
836
|
+
ns = argparse.Namespace(subcommand=subcmd)
|
|
837
|
+
handler(ns)
|
|
838
|
+
except SystemExit as exc:
|
|
839
|
+
sys.exit(exc.code if exc.code is not None else 0)
|
|
840
|
+
except Exception as _err:
|
|
841
|
+
_ = _err
|
|
842
|
+
|
|
843
|
+
def format_help(self):
|
|
844
|
+
self._localize_argparse_groups()
|
|
845
|
+
|
|
846
|
+
# If this is a subcommand parser (e.g. agent-qa mutate --help)
|
|
847
|
+
if self.prog != "agent-qa":
|
|
848
|
+
self._delegate_subcommand_help()
|
|
849
|
+
base_help = super().format_help()
|
|
850
|
+
switch_tip = f"\n{YELLOW}{t('tip_lang_switch', lang=self.lang)}{RESET}\n"
|
|
851
|
+
return base_help + switch_tip
|
|
852
|
+
|
|
853
|
+
# Check if full list is requested via --all or -a
|
|
854
|
+
if "--all" in sys.argv or "-a" in sys.argv:
|
|
855
|
+
base_help = super().format_help()
|
|
856
|
+
switch_tip = f"\n{YELLOW}{t('tip_lang_switch', lang=self.lang)}{RESET}\n"
|
|
857
|
+
return base_help + switch_tip
|
|
858
|
+
|
|
859
|
+
return _render_tiered_cli_help(self.lang)
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
def _lh(en_text: str, vi_text: str, lang: str) -> str:
|
|
863
|
+
"""Selects localized text based on the active language code ('en' or 'vi')."""
|
|
864
|
+
return vi_text if lang == "vi" else en_text
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
def _register_core_and_setup_commands(subparsers, lang: Optional[str] = None):
|
|
869
|
+
"""Registers core environment, setup, and informational subcommands."""
|
|
870
|
+
lang = lang or resolve_language(_extract_cli_lang())
|
|
871
|
+
# help
|
|
872
|
+
p_help = subparsers.add_parser("help", help=t("cmd_help", lang=lang))
|
|
873
|
+
p_help.add_argument("--all", "-a", action="store_true", dest="show_all", help=t("opt_all", lang=lang))
|
|
874
|
+
p_help.set_defaults(func=cmd_help)
|
|
875
|
+
|
|
876
|
+
# set-lang
|
|
877
|
+
p_set_lang = subparsers.add_parser(
|
|
878
|
+
"set-lang",
|
|
879
|
+
aliases=["lang"],
|
|
880
|
+
help=t("cmd_set_lang", lang=lang)
|
|
881
|
+
)
|
|
882
|
+
p_set_lang.add_argument(
|
|
883
|
+
"language",
|
|
884
|
+
choices=["en", "vi"],
|
|
885
|
+
nargs="?",
|
|
886
|
+
help=_lh("Language code to set and persist (en: English, vi: Vietnamese)", "Mã ngôn ngữ cần thiết lập và ghi nhớ (en: Tiếng Anh, vi: Tiếng Việt)", lang)
|
|
887
|
+
)
|
|
888
|
+
p_set_lang.add_argument(
|
|
889
|
+
"--local",
|
|
890
|
+
action="store_true",
|
|
891
|
+
help=_lh("Persist to local .synapse.json in current directory", "Lưu cấu hình vào file .synapse.json tại thư mục hiện tại", lang)
|
|
892
|
+
)
|
|
893
|
+
p_set_lang.set_defaults(func=cmd_set_lang)
|
|
894
|
+
|
|
895
|
+
# init-config
|
|
896
|
+
p_init_cfg = subparsers.add_parser(
|
|
897
|
+
"init-config",
|
|
898
|
+
aliases=["init"],
|
|
899
|
+
help=t("cmd_init_config", lang=lang)
|
|
900
|
+
)
|
|
901
|
+
p_init_cfg.add_argument(
|
|
902
|
+
"target_dir",
|
|
903
|
+
nargs="?",
|
|
904
|
+
default=".",
|
|
905
|
+
help=_lh("Target directory to initialize configuration (default: .)", "Thư mục đích khởi tạo file cấu hình (mặc định: .)", lang)
|
|
906
|
+
)
|
|
907
|
+
p_init_cfg.add_argument(
|
|
908
|
+
"-t", "--template",
|
|
909
|
+
dest="template_path",
|
|
910
|
+
default=None,
|
|
911
|
+
help=_lh("Path to template Excel file (.xlsx)", "Đường dẫn file template Excel (.xlsx)", lang)
|
|
912
|
+
)
|
|
913
|
+
p_init_cfg.add_argument(
|
|
914
|
+
"-a", "--author",
|
|
915
|
+
default=None,
|
|
916
|
+
help=_lh("Author or QA Lead name", "Tên tác giả / QA Lead phụ trách dự án", lang)
|
|
917
|
+
)
|
|
918
|
+
p_init_cfg.add_argument(
|
|
919
|
+
"--tester",
|
|
920
|
+
default=None,
|
|
921
|
+
help=_lh("Tester or QA engineer name", "Tên kiểm thử viên phụ trách", lang)
|
|
922
|
+
)
|
|
923
|
+
p_init_cfg.add_argument(
|
|
924
|
+
"-s", "--sheet-name",
|
|
925
|
+
dest="sample_sheet",
|
|
926
|
+
default=None,
|
|
927
|
+
help=_lh("Sample worksheet name to clone (default: Test Cases)", "Tên worksheet mẫu cần clone (mặc định: Test Cases)", lang)
|
|
928
|
+
)
|
|
929
|
+
p_init_cfg.add_argument(
|
|
930
|
+
"-p", "--project-name",
|
|
931
|
+
default=None,
|
|
932
|
+
help=_lh("Project identifier name (default: directory name)", "Tên định danh của dự án (mặc định: tên thư mục)", lang)
|
|
933
|
+
)
|
|
934
|
+
p_init_cfg.add_argument(
|
|
935
|
+
"--module-code",
|
|
936
|
+
default="MOD",
|
|
937
|
+
help=_lh("Abbreviated module code (default: MOD)", "Mã module viết tắt (mặc định: MOD)", lang)
|
|
938
|
+
)
|
|
939
|
+
p_init_cfg.add_argument(
|
|
940
|
+
"--module-name",
|
|
941
|
+
default="General Module",
|
|
942
|
+
help=_lh("Test module name (default: General Module)", "Tên phân hệ kiểm thử (mặc định: General Module)", lang)
|
|
943
|
+
)
|
|
944
|
+
p_init_cfg.add_argument(
|
|
945
|
+
"--out-dir",
|
|
946
|
+
dest="default_output_dir",
|
|
947
|
+
default="reports",
|
|
948
|
+
help=_lh("Default report export directory (default: reports)", "Thư mục xuất báo cáo mặc định (mặc định: reports)", lang)
|
|
949
|
+
)
|
|
950
|
+
p_init_cfg.add_argument(
|
|
951
|
+
"-f", "--force",
|
|
952
|
+
action="store_true",
|
|
953
|
+
help=_lh("Overwrite .synapse.json if it already exists", "Ghi đè file .synapse.json nếu đã tồn tại", lang)
|
|
954
|
+
)
|
|
955
|
+
p_init_cfg.add_argument(
|
|
956
|
+
"--dry-run",
|
|
957
|
+
action="store_true",
|
|
958
|
+
help=_lh("Print JSON configuration to stdout without writing to disk", "In nội dung file JSON ra màn hình mà không ghi xuống ổ đĩa", lang)
|
|
959
|
+
)
|
|
960
|
+
p_init_cfg.add_argument(
|
|
961
|
+
"-i", "--interactive",
|
|
962
|
+
action="store_true",
|
|
963
|
+
help=_lh("Enable interactive Q&A wizard mode", "Kích hoạt chế độ hỏi đáp tương tác trực tiếp", lang)
|
|
964
|
+
)
|
|
965
|
+
p_init_cfg.set_defaults(func=cmd_init_config)
|
|
966
|
+
# version
|
|
967
|
+
p_ver = subparsers.add_parser("version", help=t("cmd_version", lang=lang))
|
|
968
|
+
p_ver.set_defaults(func=cmd_version)
|
|
969
|
+
|
|
970
|
+
# setup
|
|
971
|
+
p_setup = subparsers.add_parser("setup", help=t("cmd_setup", lang=lang))
|
|
972
|
+
p_setup.set_defaults(func=cmd_setup)
|
|
973
|
+
|
|
974
|
+
# doctor
|
|
975
|
+
p_doctor = subparsers.add_parser("doctor", description=_lh("Enterprise Environment Diagnostic Tool", "Công cụ chẩn đoán môi trường kiểm thử doanh nghiệp", lang), help=t("cmd_doctor", lang=lang))
|
|
976
|
+
p_doctor.add_argument("target", nargs="?", default=None, help=_lh("Target repository path to diagnose", "Đường dẫn thư mục dự án cần chẩn đoán", lang))
|
|
977
|
+
p_doctor.add_argument("--repo", "--path", dest="repo_path", default=None, help=_lh("Target repository path", "Đường dẫn thư mục dự án mục tiêu", lang))
|
|
978
|
+
p_doctor.add_argument("--insecure", action="store_true", help=_lh("Allow unverified SSL certificates during connectivity checks", "Cho phép bỏ qua kiểm tra chứng chỉ SSL", lang))
|
|
979
|
+
p_doctor.set_defaults(func=cmd_doctor)
|
|
980
|
+
|
|
981
|
+
# uninstall
|
|
982
|
+
p_uninstall = subparsers.add_parser("uninstall", help=t("cmd_uninstall", lang=lang))
|
|
983
|
+
p_uninstall.add_argument("target", nargs="?", default=None, help=_lh("Target repository path to revert", "Đường dẫn thư mục dự án cần gỡ bỏ cài đặt", lang))
|
|
984
|
+
p_uninstall.set_defaults(func=cmd_uninstall)
|
|
985
|
+
|
|
986
|
+
# welcome
|
|
987
|
+
p_welcome = subparsers.add_parser("welcome", description=_lh("Interactive Visual Landing Page", "Trang Landing Page trực quan giới thiệu Synapse Hub", lang), help=t("cmd_welcome", lang=lang))
|
|
988
|
+
p_welcome.add_argument("target", nargs="?", default=None, help=_lh("Target repository directory (default: current directory)", "Thư mục dự án mục tiêu (mặc định: thư mục hiện tại)", lang))
|
|
989
|
+
p_welcome.add_argument("--output", "-o", default=None, help=_lh("Output HTML file path (default: reports/WELCOME.html)", "Đường dẫn file HTML đầu ra (mặc định: reports/WELCOME.html)", lang))
|
|
990
|
+
p_welcome.add_argument("--lang", choices=["vi", "en"], default="vi", help=_lh("Default initial language (vi: Vietnamese, en: English, default: vi)", "Ngôn ngữ khởi tạo mặc định (vi: Tiếng Việt, en: Tiếng Anh, mặc định: vi)", lang))
|
|
991
|
+
p_welcome.add_argument("--no-browser", action="store_true", help=_lh("Do not open the browser after generating the page", "Không tự động mở trình duyệt sau khi tạo trang", lang))
|
|
992
|
+
p_welcome.add_argument("--open", action="store_true", help=_lh("Explicitly open the browser", "Tự động mở trình duyệt sau khi tạo trang", lang))
|
|
993
|
+
p_welcome.add_argument("--first-run", action="store_true", help=_lh("Only open if running for the first time (e.g. npm install or first pull)", "Chỉ mở trình duyệt nếu là lần chạy đầu tiên", lang))
|
|
994
|
+
p_welcome.set_defaults(func=cmd_welcome)
|
|
995
|
+
|
|
996
|
+
# ui
|
|
997
|
+
p_ui = subparsers.add_parser(
|
|
998
|
+
"ui",
|
|
999
|
+
help=t("cmd_ui", lang=lang)
|
|
1000
|
+
)
|
|
1001
|
+
p_ui.add_argument(
|
|
1002
|
+
"target",
|
|
1003
|
+
nargs="?",
|
|
1004
|
+
default=None,
|
|
1005
|
+
help=_lh("Target project directory (default: CWD)", "Thư mục dự án mục tiêu (mặc định: CWD)", lang)
|
|
1006
|
+
)
|
|
1007
|
+
p_ui.add_argument(
|
|
1008
|
+
"--repo", "--target",
|
|
1009
|
+
dest="repo",
|
|
1010
|
+
default=None,
|
|
1011
|
+
help=_lh("Target project directory", "Thư mục dự án mục tiêu", lang)
|
|
1012
|
+
)
|
|
1013
|
+
p_ui.add_argument(
|
|
1014
|
+
"--port", "-p",
|
|
1015
|
+
type=int,
|
|
1016
|
+
default=8080,
|
|
1017
|
+
help=_lh("TCP port to listen on (default: 8080)", "Cổng TCP khởi chạy (mặc định: 8080)", lang)
|
|
1018
|
+
)
|
|
1019
|
+
p_ui.add_argument(
|
|
1020
|
+
"--host",
|
|
1021
|
+
default="127.0.0.1",
|
|
1022
|
+
help=_lh("Host interface (default: 127.0.0.1)", "Host interface (mặc định: 127.0.0.1)", lang)
|
|
1023
|
+
)
|
|
1024
|
+
p_ui.add_argument(
|
|
1025
|
+
"--no-browser",
|
|
1026
|
+
action="store_true",
|
|
1027
|
+
help=_lh("Do not automatically open browser", "Không tự động mở trình duyệt", lang)
|
|
1028
|
+
)
|
|
1029
|
+
p_ui.set_defaults(func=cmd_ui)
|
|
1030
|
+
|
|
1031
|
+
# dashboard
|
|
1032
|
+
p_dashboard = subparsers.add_parser("dashboard", help=t("cmd_dashboard", lang=lang))
|
|
1033
|
+
p_dashboard.add_argument("target", nargs="?", default=None, help=_lh("Target repository directory (default: current or Hub)", "Thư mục dự án mục tiêu (mặc định: thư mục hiện tại hoặc Hub)", lang))
|
|
1034
|
+
p_dashboard.add_argument("--output", "-o", help=_lh("Output HTML file path (default: <target>/reports/PROJECT_DASHBOARD.html)", "Đường dẫn file HTML đầu ra (mặc định: <target>/reports/PROJECT_DASHBOARD.html)", lang))
|
|
1035
|
+
p_dashboard.add_argument("--open", action="store_true", help=_lh("Automatically open generated dashboard in default browser", "Tự động mở dashboard trên trình duyệt mặc định", lang))
|
|
1036
|
+
p_dashboard.add_argument("--json", action="store_true", help=_lh("Print summary JSON to stdout", "In tóm tắt kết quả dưới dạng JSON ra màn hình", lang))
|
|
1037
|
+
p_dashboard.add_argument("--lang", choices=["vi", "en"], default="vi", help=_lh("Default display language (vi: Vietnamese, en: English, default: vi)", "Ngôn ngữ hiển thị mặc định (vi: Tiếng Việt, en: Tiếng Anh, mặc định: vi)", lang))
|
|
1038
|
+
p_dashboard.set_defaults(func=cmd_dashboard)
|
|
1039
|
+
|
|
1040
|
+
# clean
|
|
1041
|
+
p_clean = subparsers.add_parser("clean", help=t("cmd_clean", lang=lang))
|
|
1042
|
+
p_clean.set_defaults(func=cmd_clean)
|
|
1043
|
+
|
|
1044
|
+
# update
|
|
1045
|
+
p_update = subparsers.add_parser("update", help=t("cmd_update", lang=lang))
|
|
1046
|
+
p_update.add_argument("--check", action="store_true", help=_lh("Check for available updates without applying", "Kiểm tra bản cập nhật mới mà không áp dụng", lang))
|
|
1047
|
+
p_update.set_defaults(func=cmd_update)
|
|
1048
|
+
|
|
1049
|
+
# check-version
|
|
1050
|
+
p_ver_sync = subparsers.add_parser("check-version", help=t("cmd_check_version", lang=lang))
|
|
1051
|
+
p_ver_sync.add_argument("--expected-version", "-e", help=_lh("Expected version string (e.g. from git tag)", "Chuỗi phiên bản kỳ vọng (ví dụ từ git tag)", lang), default=None)
|
|
1052
|
+
p_ver_sync.set_defaults(func=cmd_check_version)
|
|
1053
|
+
|
|
1054
|
+
# sync-rules
|
|
1055
|
+
p_sync_rules = subparsers.add_parser("sync-rules", help=t("cmd_sync_rules", lang=lang))
|
|
1056
|
+
p_sync_rules.add_argument("--check", action="store_true", help=_lh("Verify all AI bridges are in sync without writing", "Kiểm tra tính đồng bộ của cầu nối AI mà không ghi file", lang))
|
|
1057
|
+
p_sync_rules.set_defaults(func=cmd_sync_rules)
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
def _register_testing_and_execution_commands(subparsers, lang: Optional[str] = None):
|
|
1061
|
+
"""Registers automated testing, linting, healing, and mutation subcommands."""
|
|
1062
|
+
lang = lang or resolve_language(_extract_cli_lang())
|
|
1063
|
+
# verify
|
|
1064
|
+
p_verify = subparsers.add_parser("verify", help=t("cmd_verify", lang=lang))
|
|
1065
|
+
p_verify.set_defaults(func=cmd_verify)
|
|
1066
|
+
|
|
1067
|
+
# lint
|
|
1068
|
+
p_lint = subparsers.add_parser("lint", help=t("cmd_lint", lang=lang))
|
|
1069
|
+
p_lint.set_defaults(func=cmd_lint)
|
|
1070
|
+
|
|
1071
|
+
# auto-heal
|
|
1072
|
+
p_auto_heal = subparsers.add_parser("auto-heal", help=t("cmd_auto_heal", lang=lang))
|
|
1073
|
+
p_auto_heal.set_defaults(func=cmd_auto_heal)
|
|
1074
|
+
|
|
1075
|
+
# heal-pr
|
|
1076
|
+
p_heal_pr = subparsers.add_parser("heal-pr", help=t("cmd_heal_pr", lang=lang))
|
|
1077
|
+
p_heal_pr.set_defaults(func=cmd_heal_pr)
|
|
1078
|
+
|
|
1079
|
+
# heal (memory cache)
|
|
1080
|
+
p_heal = subparsers.add_parser("heal", help=t("cmd_heal", lang=lang))
|
|
1081
|
+
p_heal.set_defaults(func=cmd_heal)
|
|
1082
|
+
|
|
1083
|
+
# mutate
|
|
1084
|
+
p_mut = subparsers.add_parser("mutate", help=t("cmd_mutate", lang=lang).replace("%", "%%"))
|
|
1085
|
+
p_mut.set_defaults(func=cmd_mutate)
|
|
1086
|
+
|
|
1087
|
+
# shard
|
|
1088
|
+
p_shard = subparsers.add_parser("shard", help=t("cmd_shard", lang=lang))
|
|
1089
|
+
p_shard.set_defaults(func=cmd_shard)
|
|
1090
|
+
|
|
1091
|
+
# sync-jira
|
|
1092
|
+
p_jira = subparsers.add_parser(
|
|
1093
|
+
"sync-jira",
|
|
1094
|
+
add_help=False,
|
|
1095
|
+
aliases=["jira", "jira-sync"],
|
|
1096
|
+
help=t("cmd_sync_jira", lang=lang)
|
|
1097
|
+
)
|
|
1098
|
+
p_jira.set_defaults(func=cmd_jira_sync)
|
|
1099
|
+
|
|
1100
|
+
# trend
|
|
1101
|
+
p_trend = subparsers.add_parser(
|
|
1102
|
+
"trend",
|
|
1103
|
+
add_help=False,
|
|
1104
|
+
aliases=["trends", "history"],
|
|
1105
|
+
help=t("cmd_trend", lang=lang)
|
|
1106
|
+
)
|
|
1107
|
+
p_trend.set_defaults(func=cmd_trend)
|
|
1108
|
+
|
|
1109
|
+
# flaky
|
|
1110
|
+
p_flaky = subparsers.add_parser("flaky", help=t("cmd_flaky", lang=lang))
|
|
1111
|
+
p_flaky.set_defaults(func=cmd_flaky)
|
|
1112
|
+
|
|
1113
|
+
# canary
|
|
1114
|
+
p_canary = subparsers.add_parser("canary", help=t("cmd_canary", lang=lang))
|
|
1115
|
+
p_canary.set_defaults(func=cmd_canary)
|
|
1116
|
+
|
|
1117
|
+
# watch
|
|
1118
|
+
p_watch = subparsers.add_parser("watch", help=t("cmd_watch", lang=lang))
|
|
1119
|
+
p_watch.add_argument("target", nargs="?", default=".", help=_lh("Directory to monitor (default: current directory)", "Thư mục cần giám sát (mặc định: thư mục hiện tại)", lang))
|
|
1120
|
+
p_watch.add_argument("--debounce", type=float, default=0.8, help=_lh("Debounce interval in seconds (default: 0.8)", "Khoảng thời gian debounce tính bằng giây (mặc định: 0.8)", lang))
|
|
1121
|
+
p_watch.add_argument("--inactivity-timeout", type=float, default=0.0, help=_lh("Inactivity timeout in seconds to trigger stuck warning (default: 0 = disabled)", "Thời gian chờ không hoạt động để cảnh báo tắc nghẽn tính bằng giây (mặc định: 0 = tắt)", lang))
|
|
1122
|
+
p_watch.add_argument("--once", action="store_true", help=_lh("Run incremental scan once on all files and exit", "Chạy quét gia tăng một lần trên toàn bộ tệp và thoát", lang))
|
|
1123
|
+
p_watch.set_defaults(func=cmd_watch)
|
|
1124
|
+
|
|
1125
|
+
# pinpoint-failure
|
|
1126
|
+
p_pinpoint = subparsers.add_parser("pinpoint-failure", help=t("cmd_pinpoint_failure", lang=lang))
|
|
1127
|
+
p_pinpoint.add_argument("report_file", nargs="?", default="", help=_lh("Path to JUnit XML test report", "Đường dẫn tới file báo cáo kiểm thử JUnit XML", lang))
|
|
1128
|
+
p_pinpoint.set_defaults(func=cmd_pinpoint_failure)
|
|
1129
|
+
|
|
1130
|
+
# ci-hook
|
|
1131
|
+
p_ci = subparsers.add_parser("ci-hook", help=t("cmd_ci_hook", lang=lang))
|
|
1132
|
+
p_ci.set_defaults(func=cmd_ci_hook)
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
def _register_audit_and_inspection_commands(subparsers, lang: Optional[str] = None):
|
|
1136
|
+
"""Registers security, architecture, and code quality inspection subcommands."""
|
|
1137
|
+
lang = lang or resolve_language(_extract_cli_lang())
|
|
1138
|
+
# analyze
|
|
1139
|
+
p_analyze = subparsers.add_parser("analyze", help=t("cmd_analyze", lang=lang))
|
|
1140
|
+
p_analyze.set_defaults(func=cmd_analyze)
|
|
1141
|
+
|
|
1142
|
+
# debt
|
|
1143
|
+
p_debt = subparsers.add_parser("debt", aliases=["harvest-debt"], help=t("cmd_debt", lang=lang))
|
|
1144
|
+
p_debt.add_argument("target", nargs="?", default=".", help=_lh("Directory to scan (default: current directory)", "Thư mục cần quét (mặc định: thư mục hiện tại)", lang))
|
|
1145
|
+
p_debt.add_argument("--keyword", "-k", default=None, help=_lh("Custom marker keyword (default: shortcut or ponytail)", "Từ khóa đánh dấu nợ kỹ thuật tùy chỉnh (mặc định: shortcut hoặc ponytail)", lang))
|
|
1146
|
+
p_debt.add_argument("--output", "-o", default=None, help=_lh("Save report to Markdown file", "Lưu báo cáo vào file Markdown", lang))
|
|
1147
|
+
p_debt.add_argument("--json", action="store_true", help=_lh("Output results in JSON format", "Xuất kết quả dưới định dạng JSON", lang))
|
|
1148
|
+
p_debt.set_defaults(func=cmd_debt)
|
|
1149
|
+
|
|
1150
|
+
# review
|
|
1151
|
+
p_review = subparsers.add_parser("review", aliases=["code-review"], help=t("cmd_review", lang=lang))
|
|
1152
|
+
p_review.add_argument("target_dir", nargs="?", default=".", help=_lh("Repository directory (default: current directory)", "Thư mục dự án (mặc định: thư mục hiện tại)", lang))
|
|
1153
|
+
p_review.add_argument("--staged", action="store_true", help=_lh("Review staged git changes", "Đánh giá các thay đổi git đã staged", lang))
|
|
1154
|
+
p_review.add_argument("--branch", default=None, help=_lh("Review changes against a git branch or commit ref", "Đánh giá thay đổi so với nhánh git hoặc commit ref", lang))
|
|
1155
|
+
p_review.add_argument("--json", action="store_true", help=_lh("Output results in JSON format", "Xuất kết quả dưới định dạng JSON", lang))
|
|
1156
|
+
p_review.set_defaults(func=cmd_review)
|
|
1157
|
+
|
|
1158
|
+
# safety-check
|
|
1159
|
+
p_safety = subparsers.add_parser("safety-check", help=t("cmd_safety_check", lang=lang))
|
|
1160
|
+
p_safety.set_defaults(func=cmd_safety_check)
|
|
1161
|
+
|
|
1162
|
+
# contract-drift
|
|
1163
|
+
p_drift = subparsers.add_parser("contract-drift", help=t("cmd_contract_drift", lang=lang))
|
|
1164
|
+
p_drift.set_defaults(func=cmd_contract_drift)
|
|
1165
|
+
|
|
1166
|
+
# skillspector
|
|
1167
|
+
p_skillspector = subparsers.add_parser("skillspector", help=t("cmd_skillspector", lang=lang))
|
|
1168
|
+
p_skillspector.add_argument("path", nargs="?", default=".", help=_lh("Skill directory or file to scan (default: current directory)", "Thư mục hoặc tệp kỹ năng cần quét (mặc định: thư mục hiện tại)", lang))
|
|
1169
|
+
p_skillspector.add_argument("--format", choices=["terminal", "json", "markdown", "sarif"], default="terminal", help=_lh("Output format", "Định dạng đầu ra", lang))
|
|
1170
|
+
p_skillspector.add_argument("--output", "-o", help=_lh("Write report to output file", "Ghi báo cáo ra tệp đầu ra", lang))
|
|
1171
|
+
p_skillspector.add_argument("--strict", action="store_true", help=_lh("Fail with non-zero exit code on HIGH/CRITICAL finding", "Thoát với mã lỗi khác 0 khi phát hiện cảnh báo HIGH/CRITICAL", lang))
|
|
1172
|
+
p_skillspector.set_defaults(func=cmd_skillspector)
|
|
1173
|
+
|
|
1174
|
+
# skills / profiles
|
|
1175
|
+
p_skills = subparsers.add_parser("skills", aliases=["profiles", "list-skills"], help=t("cmd_skills", lang=lang))
|
|
1176
|
+
p_skills.add_argument("--profile", "-p", help=_lh("Filter skills by capability profile (core-web-qa, perf-and-load, api-security, enterprise-rbt)", "Lọc kỹ năng theo gói năng lực (core-web-qa, perf-and-load, api-security, enterprise-rbt)", lang))
|
|
1177
|
+
p_skills.add_argument("--list-profiles", "-l", action="store_true", help=_lh("List all available capability profiles with summaries", "Liệt kê danh sách tất cả các gói năng lực kèm tóm tắt", lang))
|
|
1178
|
+
p_skills.add_argument("--category", "-c", help=_lh("Filter skills by category", "Lọc kỹ năng theo danh mục", lang))
|
|
1179
|
+
p_skills.add_argument("--query", "-q", help=_lh("Search skills by keyword", "Tìm kiếm kỹ năng theo từ khóa", lang))
|
|
1180
|
+
p_skills.add_argument("--format", choices=["text", "json"], default="text", help=_lh("Output format (text or json)", "Định dạng xuất kết quả (text hoặc json)", lang))
|
|
1181
|
+
p_skills.set_defaults(func=cmd_skills)
|
|
1182
|
+
|
|
1183
|
+
# verify-author
|
|
1184
|
+
p_author = subparsers.add_parser("verify-author", help=t("cmd_verify_author", lang=lang))
|
|
1185
|
+
p_author.set_defaults(func=cmd_verify_author)
|
|
1186
|
+
|
|
1187
|
+
# wcag-audit
|
|
1188
|
+
p_wcag = subparsers.add_parser("wcag-audit", help=t("cmd_wcag_audit", lang=lang))
|
|
1189
|
+
p_wcag.add_argument("target", nargs="?", default=".", help=_lh("Target HTML file or directory to audit", "Tệp HTML hoặc thư mục cần kiểm toán WCAG", lang))
|
|
1190
|
+
p_wcag.set_defaults(func=cmd_wcag_audit)
|
|
1191
|
+
|
|
1192
|
+
# impact
|
|
1193
|
+
p_impact = subparsers.add_parser("impact", help=t("cmd_impact", lang=lang))
|
|
1194
|
+
p_impact.set_defaults(func=cmd_impact)
|
|
1195
|
+
|
|
1196
|
+
# review-spec
|
|
1197
|
+
p_review_spec = subparsers.add_parser("review-spec", help=t("cmd_review_spec", lang=lang))
|
|
1198
|
+
p_review_spec.add_argument("spec_file", nargs="?", default="", help=_lh("Path to specification file (Markdown or Gherkin .feature, use '-' for stdin)", "Đường dẫn tới file đặc tả (Markdown hoặc Gherkin .feature, dùng '-' cho stdin)", lang))
|
|
1199
|
+
p_review_spec.add_argument("--stdin", action="store_true", help=_lh("Read specification from standard input (stdin)", "Đọc nội dung đặc tả từ luồng vào chuẩn (stdin)", lang))
|
|
1200
|
+
p_review_spec.add_argument("--json", action="store_true", help=_lh("Output machine-readable JSON format", "Xuất định dạng JSON cho máy đọc", lang))
|
|
1201
|
+
p_review_spec.add_argument("--min-score", type=int, default=80, help=_lh("Minimum readiness score threshold (default: 80)", "Ngưỡng điểm sẵn sàng tối thiểu (mặc định: 80)", lang))
|
|
1202
|
+
p_review_spec.set_defaults(func=cmd_review_spec)
|
|
1203
|
+
|
|
1204
|
+
# drift-check
|
|
1205
|
+
p_spec_drift = subparsers.add_parser("drift-check", help=t("cmd_drift_check", lang=lang))
|
|
1206
|
+
p_spec_drift.add_argument("--spec", required=True, help=_lh("Path to specification file (Markdown or Gherkin .feature)", "Đường dẫn tới file đặc tả (Markdown hoặc Gherkin .feature)", lang))
|
|
1207
|
+
p_spec_drift.add_argument("--code", required=True, help=_lh("Path to test script or directory of test scripts", "Đường dẫn tới kịch bản test hoặc thư mục kịch bản", lang))
|
|
1208
|
+
p_spec_drift.add_argument("--markdown", "-m", help=_lh("Path to export Markdown drift report (e.g. SPEC_DRIFT_REPORT.md)", "Đường dẫn xuất báo cáo độ lệch Markdown (ví dụ: SPEC_DRIFT_REPORT.md)", lang))
|
|
1209
|
+
p_spec_drift.add_argument("--json", action="store_true", help=_lh("Output machine-readable JSON format", "Xuất định dạng JSON cho máy đọc", lang))
|
|
1210
|
+
p_spec_drift.set_defaults(func=cmd_drift_check)
|
|
1211
|
+
|
|
1212
|
+
# trace-data-flow
|
|
1213
|
+
p_trace = subparsers.add_parser("trace-data-flow", help=t("cmd_trace_data_flow", lang=lang))
|
|
1214
|
+
p_trace.add_argument("target", nargs="?", default=".", help=_lh("Target test directory to inspect", "Thư mục kiểm thử mục tiêu cần phân tích luồng dữ liệu", lang))
|
|
1215
|
+
p_trace.set_defaults(func=cmd_trace_data_flow)
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
def _register_platform_and_tools_commands(subparsers, lang: Optional[str] = None):
|
|
1219
|
+
"""Registers protocol generators, converters, MCP servers, and utility subcommands."""
|
|
1220
|
+
lang = lang or resolve_language(_extract_cli_lang())
|
|
1221
|
+
# distill
|
|
1222
|
+
p_distill = subparsers.add_parser("distill", help=t("cmd_distill", lang=lang).replace("%", "%%"))
|
|
1223
|
+
p_distill.set_defaults(func=cmd_distill)
|
|
1224
|
+
|
|
1225
|
+
# gherkin
|
|
1226
|
+
p_gherkin = subparsers.add_parser("gherkin", help=t("cmd_gherkin", lang=lang))
|
|
1227
|
+
p_gherkin.set_defaults(func=cmd_gherkin)
|
|
1228
|
+
|
|
1229
|
+
# transpile
|
|
1230
|
+
p_trans = subparsers.add_parser("transpile", help=t("cmd_transpile", lang=lang))
|
|
1231
|
+
p_trans.add_argument("source", help=_lh("Source file path", "Đường dẫn file nguồn kiểm thử", lang))
|
|
1232
|
+
p_trans.add_argument("--to", required=True, choices=["playwright-ts", "playwright-python", "selenium-java", "katalon-groovy", "cypress-js"], help=_lh("Target framework", "Framework kiểm thử mục tiêu chuyển đổi", lang))
|
|
1233
|
+
p_trans.add_argument("--out", default=None, help=_lh("Output directory", "Thư mục lưu trữ kết quả đầu ra", lang))
|
|
1234
|
+
p_trans.set_defaults(func=cmd_transpile)
|
|
1235
|
+
|
|
1236
|
+
# omni-scan
|
|
1237
|
+
p_omni = subparsers.add_parser("omni-scan", help=t("cmd_omni_scan", lang=lang))
|
|
1238
|
+
p_omni.add_argument("path", default=".", nargs="?", help=_lh("Directory to scan", "Thư mục cần quét danh mục test", lang))
|
|
1239
|
+
p_omni.add_argument("--json", action="store_true", help=_lh("Output raw JSON", "Xuất kết quả định dạng JSON thô", lang))
|
|
1240
|
+
p_omni.set_defaults(func=cmd_omni_scan)
|
|
1241
|
+
|
|
1242
|
+
# report-bug
|
|
1243
|
+
p_bug = subparsers.add_parser("report-bug", help=t("cmd_report_bug", lang=lang))
|
|
1244
|
+
p_bug.set_defaults(func=cmd_report_bug)
|
|
1245
|
+
|
|
1246
|
+
# mock-shield
|
|
1247
|
+
p_mock = subparsers.add_parser("mock-shield", help=t("cmd_mock_shield", lang=lang))
|
|
1248
|
+
p_mock.set_defaults(func=cmd_mock_shield)
|
|
1249
|
+
|
|
1250
|
+
# visual-mask
|
|
1251
|
+
p_mask = subparsers.add_parser("visual-mask", help=t("cmd_visual_mask", lang=lang))
|
|
1252
|
+
p_mask.set_defaults(func=cmd_visual_mask)
|
|
1253
|
+
|
|
1254
|
+
# migrate
|
|
1255
|
+
p_migrate = subparsers.add_parser("migrate", help=t("cmd_migrate", lang=lang))
|
|
1256
|
+
p_migrate.add_argument("--src", required=True, help=_lh("Source legacy test suite file or directory", "Đường dẫn file hoặc thư mục kịch bản test cũ", lang))
|
|
1257
|
+
p_migrate.add_argument("--dest", default="playwright_suite", help=_lh("Destination directory for migrated code", "Thư mục lưu mã nguồn kiểm thử mới sau khi chuyển đổi", lang))
|
|
1258
|
+
p_migrate.add_argument("--target", default="playwright-ts", choices=["playwright-ts", "playwright-python", "selenium-java", "cypress-js"], help=_lh("Target framework", "Framework kiểm thử mục tiêu", lang))
|
|
1259
|
+
p_migrate.set_defaults(func=cmd_migrate)
|
|
1260
|
+
|
|
1261
|
+
# decouple-config
|
|
1262
|
+
p_decouple = subparsers.add_parser("decouple-config", help=t("cmd_decouple_config", lang=lang))
|
|
1263
|
+
p_decouple.add_argument("target", nargs="?", default=os.getcwd(), help=_lh("Target directory to scan", "Thư mục cần quét tách cấu hình", lang))
|
|
1264
|
+
p_decouple.add_argument("--fix", action="store_true", help=_lh("Apply environment variable replacements in-place", "Áp dụng thay thế biến môi trường trực tiếp trên tệp", lang))
|
|
1265
|
+
p_decouple.add_argument("--out-dir", default=None, help=_lh("Output directory for config profiles", "Thư mục lưu các file hồ sơ cấu hình môi trường", lang))
|
|
1266
|
+
p_decouple.set_defaults(func=cmd_decouple_config)
|
|
1267
|
+
|
|
1268
|
+
# fuzz-api
|
|
1269
|
+
p_fuzz = subparsers.add_parser("fuzz-api", help=t("cmd_fuzz_api", lang=lang))
|
|
1270
|
+
p_fuzz.set_defaults(func=cmd_fuzz_api)
|
|
1271
|
+
|
|
1272
|
+
# som
|
|
1273
|
+
p_som = subparsers.add_parser("som", help=t("cmd_som", lang=lang))
|
|
1274
|
+
p_som.set_defaults(func=cmd_som)
|
|
1275
|
+
|
|
1276
|
+
# export-postman
|
|
1277
|
+
p_postman = subparsers.add_parser("export-postman", help=t("cmd_export_postman", lang=lang))
|
|
1278
|
+
p_postman.set_defaults(func=cmd_export_postman)
|
|
1279
|
+
|
|
1280
|
+
# generate-jmx
|
|
1281
|
+
p_jmx = subparsers.add_parser("generate-jmx", help=t("cmd_generate_jmx", lang=lang))
|
|
1282
|
+
p_jmx.set_defaults(func=cmd_generate_jmx)
|
|
1283
|
+
|
|
1284
|
+
# analyze-jtl
|
|
1285
|
+
p_jtl = subparsers.add_parser("analyze-jtl", help=t("cmd_analyze_jtl", lang=lang))
|
|
1286
|
+
p_jtl.set_defaults(func=cmd_analyze_jtl)
|
|
1287
|
+
|
|
1288
|
+
# export-excel
|
|
1289
|
+
p_excel = subparsers.add_parser(
|
|
1290
|
+
"export-excel",
|
|
1291
|
+
help=t("cmd_export_excel", lang=lang)
|
|
1292
|
+
)
|
|
1293
|
+
p_excel.add_argument(
|
|
1294
|
+
"input",
|
|
1295
|
+
nargs="?",
|
|
1296
|
+
help=_lh("Path to Markdown test cases specification file (.md)", "Đường dẫn file Markdown test cases (.md)", lang)
|
|
1297
|
+
)
|
|
1298
|
+
p_excel.add_argument(
|
|
1299
|
+
"-o", "--output",
|
|
1300
|
+
help=_lh("Path to output Excel file (.xlsx)", "Đường dẫn file Excel đầu ra (.xlsx)", lang)
|
|
1301
|
+
)
|
|
1302
|
+
p_excel.add_argument(
|
|
1303
|
+
"-t", "--template",
|
|
1304
|
+
help=_lh("Path to corporate template Excel file", "Đường dẫn file Excel template doanh nghiệp", lang)
|
|
1305
|
+
)
|
|
1306
|
+
p_excel.add_argument(
|
|
1307
|
+
"-s", "--sample-sheet",
|
|
1308
|
+
default=None,
|
|
1309
|
+
help=_lh("Sample worksheet name to clone", "Tên worksheet mẫu cần clone", lang)
|
|
1310
|
+
)
|
|
1311
|
+
p_excel.add_argument(
|
|
1312
|
+
"--sheet-name",
|
|
1313
|
+
help=_lh("Target worksheet name (default: Test Cases)", "Tên worksheet mục tiêu (mặc định: Test Cases)", lang)
|
|
1314
|
+
)
|
|
1315
|
+
p_excel.add_argument(
|
|
1316
|
+
"--module-code",
|
|
1317
|
+
default="MODULE",
|
|
1318
|
+
help=_lh("Module code (default: MODULE)", "Mã phân hệ (Module Code)", lang)
|
|
1319
|
+
)
|
|
1320
|
+
p_excel.add_argument(
|
|
1321
|
+
"--module-name",
|
|
1322
|
+
default="Test Module",
|
|
1323
|
+
help=_lh("Test module name (default: Test Module)", "Tên phân hệ kiểm thử", lang)
|
|
1324
|
+
)
|
|
1325
|
+
p_excel.add_argument(
|
|
1326
|
+
"--author",
|
|
1327
|
+
default=None,
|
|
1328
|
+
help=_lh("Author or QA Lead name", "Tên tác giả / QA Lead", lang)
|
|
1329
|
+
)
|
|
1330
|
+
p_excel.add_argument(
|
|
1331
|
+
"--tester",
|
|
1332
|
+
default=None,
|
|
1333
|
+
help=_lh("Tester or QA engineer name", "Tên kiểm thử viên", lang)
|
|
1334
|
+
)
|
|
1335
|
+
p_excel.add_argument(
|
|
1336
|
+
"--standalone",
|
|
1337
|
+
action="store_true",
|
|
1338
|
+
help=_lh("Keep only newly exported sheet, remove others", "Chỉ giữ lại sheet mới xuất, xóa các sheet khác", lang)
|
|
1339
|
+
)
|
|
1340
|
+
p_excel.set_defaults(func=cmd_export_excel)
|
|
1341
|
+
|
|
1342
|
+
# correlate-telemetry
|
|
1343
|
+
p_telemetry = subparsers.add_parser("correlate-telemetry", help=t("cmd_correlate_telemetry", lang=lang))
|
|
1344
|
+
p_telemetry.set_defaults(func=cmd_correlate_telemetry)
|
|
1345
|
+
|
|
1346
|
+
# analyze-newman
|
|
1347
|
+
p_newman = subparsers.add_parser("analyze-newman", help=t("cmd_analyze_newman", lang=lang))
|
|
1348
|
+
p_newman.set_defaults(func=cmd_analyze_newman)
|
|
1349
|
+
|
|
1350
|
+
# tokens
|
|
1351
|
+
p_tokens = subparsers.add_parser("tokens", help=t("cmd_tokens", lang=lang))
|
|
1352
|
+
p_tokens.add_argument("--platform", "-p", choices=["auto", "antigravity", "cursor", "claude", "all"], default="auto", help=_lh("AI platform to audit (default: auto)", "Nền tảng AI cần kiểm toán token (mặc định: auto)", lang))
|
|
1353
|
+
p_tokens.add_argument("--session", type=str, help=_lh("Specific session ID or index to audit", "Mã phiên hoặc chỉ số phiên cụ thể cần kiểm toán", lang))
|
|
1354
|
+
p_tokens.add_argument("--current", action="store_true", help=_lh("Audit current active conversation", "Kiểm toán phiên hội thoại đang hoạt động hiện tại", lang))
|
|
1355
|
+
p_tokens.add_argument("--last", action="store_true", help=_lh("Audit previous completed session (default)", "Kiểm toán phiên hội thoại hoàn thành gần nhất (mặc định)", lang))
|
|
1356
|
+
p_tokens.add_argument("--last-task", action="store_true", help=_lh("Audit specifically the last turn of target session", "Kiểm toán riêng lượt trao đổi cuối của phiên mục tiêu", lang))
|
|
1357
|
+
p_tokens.add_argument("--turns", action="store_true", help=_lh("Show full turn-by-turn breakdown table", "Hiển thị bảng chi tiết phân tích từng lượt trao đổi", lang))
|
|
1358
|
+
p_tokens.add_argument("--rolling", "--budget", action="store_true", dest="rolling", help=_lh("Show 5-hour and 7-day rolling window quota & remaining tokens", "Hiển thị định mức cửa sổ 5 giờ và 7 ngày kèm lượng token còn lại", lang))
|
|
1359
|
+
p_tokens.add_argument("--savings", action="store_true", help=_lh("Show Hub vs. Non-Hub token and cost savings comparison", "So sánh tỷ lệ tiết kiệm token và chi phí giữa Hub và Non-Hub", lang))
|
|
1360
|
+
p_tokens.add_argument("--header", action="store_true", help=_lh("Print Pre-Flight confirmation block lines", "In khối xác nhận Pre-Flight", lang))
|
|
1361
|
+
p_tokens.add_argument("--list", action="store_true", help=_lh("List recent conversations", "Liệt kê danh sách các phiên hội thoại gần đây", lang))
|
|
1362
|
+
p_tokens.add_argument("--pricing", choices=["gemini-flash", "gemini-pro", "claude-sonnet", "claude-opus", "gpt-4o", "gpt-4o-mini"], default=None, help=_lh("Model pricing basis (default: auto-detected)", "Bảng giá mô hình áp dụng tính chi phí (mặc định: tự động phát hiện)", lang))
|
|
1363
|
+
p_tokens.add_argument("--json", action="store_true", help=_lh("Output machine-readable JSON format", "Xuất kết quả định dạng JSON cho máy đọc", lang))
|
|
1364
|
+
p_tokens.add_argument("--file", type=str, help=_lh("Direct path to a transcript.jsonl file", "Đường dẫn trực tiếp tới tệp nhật ký transcript.jsonl", lang))
|
|
1365
|
+
p_tokens.set_defaults(func=cmd_tokens)
|
|
1366
|
+
|
|
1367
|
+
# lookup-tc
|
|
1368
|
+
p_lookup_tc = subparsers.add_parser("lookup-tc", help=t("cmd_lookup_tc", lang=lang))
|
|
1369
|
+
p_lookup_tc.add_argument("query", nargs="?", default="", help=_lh("Query keyword or TC ID", "Từ khóa tìm kiếm hoặc mã Test Case (TC ID)", lang))
|
|
1370
|
+
p_lookup_tc.set_defaults(func=cmd_lookup_tc)
|
|
1371
|
+
|
|
1372
|
+
# lookup-xpath
|
|
1373
|
+
p_lookup_xpath = subparsers.add_parser("lookup-xpath", help=t("cmd_lookup_xpath", lang=lang))
|
|
1374
|
+
p_lookup_xpath.add_argument("query", nargs="?", default="", help=_lh("Element text, test-id, or locator label", "Văn bản phần tử, thuộc tính test-id hoặc nhãn định vị", lang))
|
|
1375
|
+
p_lookup_xpath.set_defaults(func=cmd_lookup_xpath)
|
|
1376
|
+
|
|
1377
|
+
# generate-tc
|
|
1378
|
+
p_gen_tc = subparsers.add_parser("generate-tc", help=t("cmd_generate_tc", lang=lang))
|
|
1379
|
+
p_gen_tc.add_argument("story_file", nargs="?", default="", help=_lh("Path to markdown/text user story specification", "Đường dẫn tới tệp đặc tả user story bằng Markdown hoặc văn bản", lang))
|
|
1380
|
+
p_gen_tc.set_defaults(func=cmd_generate_tc)
|
|
1381
|
+
|
|
1382
|
+
# api-matrix
|
|
1383
|
+
p_api_mat = subparsers.add_parser("api-matrix", help=t("cmd_api_matrix", lang=lang))
|
|
1384
|
+
p_api_mat.add_argument("--spec", "-s", help=_lh("Path to OpenAPI / Swagger JSON/YAML file", "Đường dẫn tới file OpenAPI / Swagger định dạng JSON hoặc YAML", lang))
|
|
1385
|
+
p_api_mat.add_argument("--format", "-f", choices=["markdown", "json"], default="markdown", help=_lh("Output format (markdown, json)", "Định dạng đầu ra (markdown, json)", lang))
|
|
1386
|
+
p_api_mat.add_argument("--output", "-o", help=_lh("Output file path", "Đường dẫn tệp đầu ra", lang))
|
|
1387
|
+
p_api_mat.add_argument("--sample", action="store_true", help=_lh("Generate a sample matrix using built-in demonstration schema", "Tạo ma trận mẫu sử dụng lược đồ minh họa có sẵn", lang))
|
|
1388
|
+
p_api_mat.set_defaults(func=cmd_api_matrix)
|
|
1389
|
+
|
|
1390
|
+
# canvas-diff
|
|
1391
|
+
p_canvas = subparsers.add_parser("canvas-diff", help=t("cmd_canvas_diff", lang=lang))
|
|
1392
|
+
p_canvas.add_argument("canvas_args", nargs="*", help=_lh("Subcommand (compare/check-blank) and image paths", "Lệnh con (compare/check-blank) và đường dẫn ảnh", lang))
|
|
1393
|
+
p_canvas.set_defaults(func=cmd_canvas_diff)
|
|
1394
|
+
|
|
1395
|
+
# validate-groovy
|
|
1396
|
+
p_groovy = subparsers.add_parser("validate-groovy", help=t("cmd_validate_groovy", lang=lang))
|
|
1397
|
+
p_groovy.add_argument("target", nargs="?", default=None, help=_lh("Target repository or file to validate", "Thư mục dự án hoặc tệp kịch bản cần kiểm tra cú pháp", lang))
|
|
1398
|
+
p_groovy.add_argument("--dir", "-d", help=_lh("Explicit directory to scan", "Thư mục cụ thể cần quét kiểm tra", lang))
|
|
1399
|
+
p_groovy.set_defaults(func=cmd_validate_groovy)
|
|
1400
|
+
|
|
1401
|
+
# mcp-serve
|
|
1402
|
+
p_mcp = subparsers.add_parser("mcp-serve", help=t("cmd_mcp_serve", lang=lang))
|
|
1403
|
+
p_mcp.set_defaults(func=cmd_mcp_serve)
|
|
1404
|
+
|
|
1405
|
+
# mcp-excel
|
|
1406
|
+
p_mcp_excel = subparsers.add_parser("mcp-excel", help=t("cmd_mcp_excel", lang=lang))
|
|
1407
|
+
p_mcp_excel.set_defaults(func=cmd_mcp_excel)
|
|
1408
|
+
|
|
1409
|
+
# mcp-docx
|
|
1410
|
+
p_mcp_docx = subparsers.add_parser("mcp-docx", help=t("cmd_mcp_docx", lang=lang))
|
|
1411
|
+
p_mcp_docx.set_defaults(func=cmd_mcp_docx)
|
|
1412
|
+
|
|
1413
|
+
# release
|
|
1414
|
+
p_release = subparsers.add_parser("release", help=t("cmd_release", lang=lang))
|
|
1415
|
+
p_release.add_argument("action", nargs="?", default="patch", help=_lh("patch | minor | major | <explicit_version> (default: patch)", "patch | minor | major | <phiên_bản_cụ_thể> (mặc định: patch)", lang))
|
|
1416
|
+
p_release.add_argument("--push", action="store_true", default=True, help=_lh("Auto-push commit and tag to origin to trigger CI release (default: true)", "Tự động đẩy commit và tag lên origin để kích hoạt CI release (mặc định: true)", lang))
|
|
1417
|
+
p_release.add_argument("--no-push", dest="push", action="store_false", help=_lh("Do not push to remote", "Không đẩy lên kho chứa từ xa (remote)", lang))
|
|
1418
|
+
p_release.add_argument("--no-test", action="store_true", help=_lh("Skip running tests before release", "Bỏ qua việc chạy kiểm thử trước khi phát hành", lang))
|
|
1419
|
+
p_release.set_defaults(func=cmd_release)
|
|
1420
|
+
|
|
1421
|
+
# publish / hub-push
|
|
1422
|
+
p_publish = subparsers.add_parser(
|
|
1423
|
+
"publish",
|
|
1424
|
+
aliases=["hub-push", "push-hub"],
|
|
1425
|
+
help=t("cmd_publish", lang=lang)
|
|
1426
|
+
)
|
|
1427
|
+
p_publish.add_argument("--message", "-m", help=_lh("Optional commit message for unstaged/pending changes", "Thông điệp commit tùy chọn cho các thay đổi chưa commit", lang))
|
|
1428
|
+
p_publish.add_argument("--skip-verify", action="store_true", help=_lh("Skip running 11 Quality Gates DoD before push", "Bỏ qua kiểm tra 11 Cổng Chất Lượng DoD trước khi đẩy", lang))
|
|
1429
|
+
p_publish.add_argument("--dry-run", action="store_true", help=_lh("Simulate all steps without pushing or publishing", "Mô phỏng toàn bộ các bước mà không thực sự đẩy hay xuất bản", lang))
|
|
1430
|
+
p_publish.add_argument("--no-wait", action="store_true", help=_lh("Fire and forget without waiting for CI workflow / npm verification", "Chạy nền mà không chờ quy trình CI workflow / kiểm tra NPM hoàn tất", lang))
|
|
1431
|
+
p_publish.add_argument("--timeout", type=int, default=180, help=_lh("Maximum seconds to wait for npm publication", "Thời gian chờ tối đa tính bằng giây cho việc xuất bản NPM", lang))
|
|
1432
|
+
p_publish.set_defaults(func=cmd_hub_publish)
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
def _handle_interactive_wizard(parser, args):
|
|
1436
|
+
"""Offers a friendly quick-start menu if running in an interactive terminal."""
|
|
1437
|
+
is_interactive = hasattr(sys.stdin, "isatty") and sys.stdin.isatty() and not os.environ.get("CI") and not os.environ.get("SYNAPSE_NON_INTERACTIVE")
|
|
1438
|
+
if is_interactive:
|
|
1439
|
+
print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
|
|
1440
|
+
print(f"{BOLD}{CYAN} 🧠 SYNAPSE HUB — INTERACTIVE TERMINAL WIZARD {RESET}")
|
|
1441
|
+
print(f"{BOLD}{CYAN}======================================================================{RESET}")
|
|
1442
|
+
if parser.lang == "vi":
|
|
1443
|
+
print("Chào bạn! Hãy chọn nhanh một tác vụ để bắt đầu (hoặc nhấn Enter để xem Trợ Giúp):")
|
|
1444
|
+
print(f" {BOLD}1.{RESET} 🩺 {BOLD}Doctor{RESET} - Kiểm tra chẩn đoán môi trường (Node, Python, Chrome, Git)")
|
|
1445
|
+
print(f" {BOLD}2.{RESET} 🚀 {BOLD}Setup{RESET} - Thiết lập bảo vệ 1-click cho dự án kiểm thử mục tiêu")
|
|
1446
|
+
print(f" {BOLD}3.{RESET} ⚙️ {BOLD}Init-Config{RESET} - Khởi tạo file cấu hình .synapse.json chuẩn hóa cho dự án Spoke")
|
|
1447
|
+
print(f" {BOLD}4.{RESET} 🔍 {BOLD}Lint{RESET} - Quét phát hiện test pass ảo, 0 assert, sleep cứng")
|
|
1448
|
+
print(f" {BOLD}5.{RESET} 🛡️ {BOLD}Verify{RESET} - Chạy kiểm tra 11 Cổng Chất Lượng DoD")
|
|
1449
|
+
print(f" {BOLD}6.{RESET} 📊 {BOLD}Export-Excel{RESET} - Xuất test cases Markdown sang file Excel (.xlsx)")
|
|
1450
|
+
print(f" {BOLD}7.{RESET} 🌐 {BOLD}Welcome{RESET} - Mở trang Landing Page trực quan")
|
|
1451
|
+
print(f" {BOLD}8.{RESET} ❓ {BOLD}Help{RESET} - Xem danh sách đầy đủ tất cả các lệnh CLI")
|
|
1452
|
+
print(f"{BOLD}{CYAN}======================================================================{RESET}")
|
|
1453
|
+
prompt = f"Nhập lựa chọn {BOLD}[1-8]{RESET} (mặc định: 8): "
|
|
1454
|
+
else:
|
|
1455
|
+
print("Welcome! Select a quick workflow to begin (or press Enter to view Help):")
|
|
1456
|
+
print(f" {BOLD}1.{RESET} 🩺 {BOLD}Doctor{RESET} - Diagnostic environment check (Node, Python, Chrome, Git)")
|
|
1457
|
+
print(f" {BOLD}2.{RESET} 🚀 {BOLD}Setup{RESET} - 1-click bootstrap & protection for target test project")
|
|
1458
|
+
print(f" {BOLD}3.{RESET} ⚙️ {BOLD}Init-Config{RESET} - Initialize standardized .synapse.json config for Spoke project")
|
|
1459
|
+
print(f" {BOLD}4.{RESET} 🔍 {BOLD}Lint{RESET} - AST scan catching fake-passes, 0 asserts, hard sleeps")
|
|
1460
|
+
print(f" {BOLD}5.{RESET} 🛡️ {BOLD}Verify{RESET} - Execute 11 Quality Gates Definition of Done (DoD)")
|
|
1461
|
+
print(f" {BOLD}6.{RESET} 📊 {BOLD}Export-Excel{RESET} - Export Markdown test cases to enterprise Excel (.xlsx)")
|
|
1462
|
+
print(f" {BOLD}7.{RESET} 🌐 {BOLD}Welcome{RESET} - Launch interactive visual landing page")
|
|
1463
|
+
print(f" {BOLD}8.{RESET} ❓ {BOLD}Help{RESET} - Display full list of CLI commands")
|
|
1464
|
+
print(f"{BOLD}{CYAN}======================================================================{RESET}")
|
|
1465
|
+
prompt = f"Enter choice {BOLD}[1-8]{RESET} (default: 8): "
|
|
1466
|
+
try:
|
|
1467
|
+
choice = input(prompt).strip()
|
|
1468
|
+
except (EOFError, KeyboardInterrupt):
|
|
1469
|
+
print()
|
|
1470
|
+
sys.exit(0)
|
|
1471
|
+
|
|
1472
|
+
dispatch_map = {
|
|
1473
|
+
"1": ("doctor", cmd_doctor),
|
|
1474
|
+
"2": ("setup", cmd_setup),
|
|
1475
|
+
"3": ("init-config", cmd_init_config),
|
|
1476
|
+
"4": ("lint", cmd_lint),
|
|
1477
|
+
"5": ("verify", cmd_verify),
|
|
1478
|
+
"6": ("export-excel", cmd_export_excel),
|
|
1479
|
+
"7": ("welcome", cmd_welcome),
|
|
1480
|
+
}
|
|
1481
|
+
if choice in dispatch_map:
|
|
1482
|
+
subcmd, handler = dispatch_map[choice]
|
|
1483
|
+
args.subcommand = subcmd
|
|
1484
|
+
return handler(args)
|
|
1485
|
+
|
|
1486
|
+
parser.print_help()
|
|
1487
|
+
show_all = getattr(args, "show_all", False) or "--all" in sys.argv or "-a" in sys.argv
|
|
1488
|
+
if show_all:
|
|
1489
|
+
print(f"\n💡 {t('tip_welcome', lang=parser.lang)}")
|
|
1490
|
+
sys.exit(0)
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
def build_parser(active_lang: str) -> SynapseArgumentParser:
|
|
1494
|
+
"""Builds and configures the root SynapseArgumentParser with all arguments and subcommands."""
|
|
1495
|
+
parser = SynapseArgumentParser(
|
|
1496
|
+
prog="agent-qa",
|
|
1497
|
+
description=t("hub_cli_description", lang=active_lang),
|
|
1498
|
+
lang=active_lang
|
|
1499
|
+
)
|
|
1500
|
+
parser.add_argument(
|
|
1501
|
+
"--version",
|
|
1502
|
+
action="version",
|
|
1503
|
+
version=f"Agent-QA Hub CLI v{_hub_version()}",
|
|
1504
|
+
help=t("opt_version", lang=parser.lang)
|
|
1505
|
+
)
|
|
1506
|
+
parser.add_argument(
|
|
1507
|
+
"--all", "-a",
|
|
1508
|
+
action="store_true",
|
|
1509
|
+
dest="show_all",
|
|
1510
|
+
help=t("opt_all", lang=parser.lang)
|
|
1511
|
+
)
|
|
1512
|
+
parser.add_argument(
|
|
1513
|
+
"--offline", "--offline-deterministic",
|
|
1514
|
+
action="store_true",
|
|
1515
|
+
dest="offline",
|
|
1516
|
+
help=t("opt_offline", lang=parser.lang).replace("%", "%%")
|
|
1517
|
+
)
|
|
1518
|
+
parser.add_argument(
|
|
1519
|
+
"-q", "--quiet",
|
|
1520
|
+
action="store_true",
|
|
1521
|
+
dest="quiet",
|
|
1522
|
+
help=t("opt_quiet", lang=parser.lang)
|
|
1523
|
+
)
|
|
1524
|
+
parser.add_argument(
|
|
1525
|
+
"-l", "--lang",
|
|
1526
|
+
choices=["en", "vi"],
|
|
1527
|
+
type=str.lower,
|
|
1528
|
+
default=None,
|
|
1529
|
+
dest="lang",
|
|
1530
|
+
help=t("opt_lang", lang=parser.lang)
|
|
1531
|
+
)
|
|
1532
|
+
subparsers = parser.add_subparsers(
|
|
1533
|
+
dest="subcommand",
|
|
1534
|
+
help=t("subcommands_help", lang=parser.lang),
|
|
1535
|
+
parser_class=lambda **kw: SynapseArgumentParser(lang=parser.lang, **kw)
|
|
1536
|
+
)
|
|
1537
|
+
|
|
1538
|
+
# Modular command registration (Refactored Command Dispatcher Pattern)
|
|
1539
|
+
_register_core_and_setup_commands(subparsers, lang=parser.lang)
|
|
1540
|
+
_register_testing_and_execution_commands(subparsers, lang=parser.lang)
|
|
1541
|
+
_register_audit_and_inspection_commands(subparsers, lang=parser.lang)
|
|
1542
|
+
_register_platform_and_tools_commands(subparsers, lang=parser.lang)
|
|
1543
|
+
return parser
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
def main():
|
|
1547
|
+
cli_lang = _extract_cli_lang()
|
|
1548
|
+
if cli_lang:
|
|
1549
|
+
try:
|
|
1550
|
+
persist_language_preference(cli_lang)
|
|
1551
|
+
except Exception as _err:
|
|
1552
|
+
_ = _err
|
|
1553
|
+
active_lang = resolve_language(cli_lang)
|
|
1554
|
+
parser = build_parser(active_lang)
|
|
1555
|
+
args, unknown = parser.parse_known_args()
|
|
1556
|
+
if getattr(args, "offline", False):
|
|
1557
|
+
os.environ["AGENT_QA_OFFLINE"] = "1"
|
|
1558
|
+
if active_lang == "vi":
|
|
1559
|
+
print("🔒 [CHẾ ĐỘ OFFLINE] Chế độ cục bộ 100% không mạng. Sử dụng AST & Heuristics nội bộ.")
|
|
1560
|
+
else:
|
|
1561
|
+
print("🔒 [OFFLINE MODE] Air-Gapped Deterministic Mode Active. 100% Local AST & Heuristics (Zero External API calls).")
|
|
1562
|
+
if getattr(args, "show_all", False) or "--all" in sys.argv or "-a" in sys.argv:
|
|
1563
|
+
parser.print_help()
|
|
1564
|
+
print(f"\n💡 {t('tip_welcome', lang=parser.lang)}")
|
|
1565
|
+
return
|
|
1566
|
+
if cli_lang and not args.subcommand and not unknown:
|
|
1567
|
+
cfg_path = persist_language_preference(cli_lang)
|
|
1568
|
+
lang_names = {
|
|
1569
|
+
"en": "English" if cli_lang == "en" else "Tiếng Anh",
|
|
1570
|
+
"vi": "Vietnamese" if cli_lang == "en" else "Tiếng Việt"
|
|
1571
|
+
}
|
|
1572
|
+
lang_name = lang_names.get(cli_lang, cli_lang)
|
|
1573
|
+
print(t("lang_saved", lang=cli_lang, lang_name=lang_name, lang_code=cli_lang, config_path=cfg_path))
|
|
1574
|
+
print(f"\n{t('tip_lang_switch', lang=cli_lang)}")
|
|
1575
|
+
return
|
|
1576
|
+
if not args.subcommand:
|
|
1577
|
+
if unknown:
|
|
1578
|
+
parser.error(f"unrecognized arguments: {' '.join(unknown)}")
|
|
1579
|
+
return _handle_interactive_wizard(parser, args)
|
|
1580
|
+
if args.subcommand == "help":
|
|
1581
|
+
args._parser = parser
|
|
1582
|
+
|
|
1583
|
+
from author_integrity import assert_integrity_or_raise
|
|
1584
|
+
assert_integrity_or_raise()
|
|
1585
|
+
|
|
1586
|
+
if getattr(args, "quiet", False):
|
|
1587
|
+
os.environ["SYNAPSE_QUIET"] = "1"
|
|
1588
|
+
elif args.subcommand not in ("update", "mcp-serve", "version", "help"):
|
|
1589
|
+
try:
|
|
1590
|
+
import update_sentinel
|
|
1591
|
+
update_sentinel.check_for_updates(force=False, notify=True)
|
|
1592
|
+
except (ImportError, OSError, TimeoutError):
|
|
1593
|
+
_ = False
|
|
1594
|
+
args.func(args)
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
if __name__ == "__main__":
|
|
1598
|
+
main()
|