@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
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Omni-Parser: Universal Polyglot AST & Structure Parser
|
|
4
|
+
------------------------------------------------------
|
|
5
|
+
Zero-Token deterministic parser supporting Java, TypeScript/JavaScript,
|
|
6
|
+
Python, Groovy (Katalon), and C#.
|
|
7
|
+
Extracts Page Classes, Locators, Action Methods, and Test Cases into
|
|
8
|
+
the Universal Intermediate Representation (universal_ir.ProjectIR).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import re
|
|
13
|
+
from typing import Dict, List, Optional, Tuple
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
from tools.universal_ir import (
|
|
17
|
+
ProjectIR, PageClassIR, TestCaseIR, MethodIR, StepIR, LocatorIR,
|
|
18
|
+
ActionType, LocatorStrategy, AssertionType, WaitStrategy
|
|
19
|
+
)
|
|
20
|
+
except ImportError:
|
|
21
|
+
from universal_ir import (
|
|
22
|
+
ProjectIR, PageClassIR, TestCaseIR, MethodIR, StepIR, LocatorIR,
|
|
23
|
+
ActionType, LocatorStrategy, AssertionType, WaitStrategy
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def extract_quoted_string(match_groups: Tuple[Optional[str], Optional[str]]) -> str:
|
|
28
|
+
"""Helper to return the unescaped string from either double-quote or single-quote match."""
|
|
29
|
+
g1, g2 = match_groups
|
|
30
|
+
val = g1 if g1 else (g2 if g2 else "")
|
|
31
|
+
return val.replace(r"\'", "'").replace(r'\"', '"')
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class OmniParser:
|
|
35
|
+
"""Universal Zero-Token Polyglot Parser for Automation Codebases."""
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def detect_language_and_framework(file_path: str, content: str) -> Tuple[str, str]:
|
|
39
|
+
ext = os.path.splitext(file_path)[1].lower()
|
|
40
|
+
|
|
41
|
+
# Groovy / Katalon
|
|
42
|
+
if ext == ".groovy":
|
|
43
|
+
return "groovy", "katalon"
|
|
44
|
+
|
|
45
|
+
# Java
|
|
46
|
+
if ext == ".java":
|
|
47
|
+
if "playwright" in content.lower():
|
|
48
|
+
return "java", "playwright"
|
|
49
|
+
if "restassured" in content.lower():
|
|
50
|
+
return "java", "restassured"
|
|
51
|
+
return "java", "selenium"
|
|
52
|
+
|
|
53
|
+
# TypeScript / JavaScript
|
|
54
|
+
if ext in [".ts", ".tsx", ".js", ".jsx"]:
|
|
55
|
+
lang = "typescript" if "ts" in ext else "javascript"
|
|
56
|
+
if "@playwright/test" in content or "page.locator" in content or "getByRole" in content:
|
|
57
|
+
return lang, "playwright"
|
|
58
|
+
if "cy." in content or "cypress" in content.lower():
|
|
59
|
+
return lang, "cypress"
|
|
60
|
+
if "webdriverio" in content.lower() or "browser.$" in content:
|
|
61
|
+
return lang, "webdriverio"
|
|
62
|
+
return lang, "playwright"
|
|
63
|
+
|
|
64
|
+
# Python
|
|
65
|
+
if ext == ".py":
|
|
66
|
+
if "playwright" in content:
|
|
67
|
+
return "python", "playwright"
|
|
68
|
+
if "selenium" in content:
|
|
69
|
+
return "python", "selenium"
|
|
70
|
+
if "robot" in content.lower():
|
|
71
|
+
return "python", "robot"
|
|
72
|
+
return "python", "pytest"
|
|
73
|
+
|
|
74
|
+
# C#
|
|
75
|
+
if ext == ".cs":
|
|
76
|
+
if "playwright" in content.lower():
|
|
77
|
+
return "csharp", "playwright"
|
|
78
|
+
return "csharp", "selenium"
|
|
79
|
+
|
|
80
|
+
return "unknown", "generic"
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def parse_code(cls, content: str, file_path: str = "virtual_file.ts") -> ProjectIR:
|
|
84
|
+
"""Parses in-memory automation code string into ProjectIR."""
|
|
85
|
+
lang, framework = cls.detect_language_and_framework(file_path, content)
|
|
86
|
+
basename = os.path.basename(file_path)
|
|
87
|
+
raw_name = os.path.splitext(basename)[0]
|
|
88
|
+
# Sanitize identifier: strip spec/test/e2e suffixes and invalid punctuation
|
|
89
|
+
clean_name = re.sub(r'[\._-]?(?:e2e-spec|spec|test|cy)\b.*$', '', raw_name, flags=re.IGNORECASE)
|
|
90
|
+
clean_name = re.sub(r'[^a-zA-Z0-9_]', '_', clean_name).strip('_')
|
|
91
|
+
if not clean_name:
|
|
92
|
+
clean_name = "Generated"
|
|
93
|
+
if clean_name[0].isdigit():
|
|
94
|
+
clean_name = f"Mod_{clean_name}"
|
|
95
|
+
sanitized_name = clean_name[0].upper() + clean_name[1:] if clean_name else "Generated"
|
|
96
|
+
|
|
97
|
+
project = ProjectIR(
|
|
98
|
+
name=sanitized_name,
|
|
99
|
+
source_language=lang,
|
|
100
|
+
source_framework=framework
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
if lang in ["typescript", "javascript"]:
|
|
104
|
+
cls._parse_ts_js(content, project, framework)
|
|
105
|
+
elif lang == "java":
|
|
106
|
+
cls._parse_java(content, project, framework)
|
|
107
|
+
elif lang == "groovy":
|
|
108
|
+
cls._parse_groovy(content, project, framework)
|
|
109
|
+
elif lang == "python":
|
|
110
|
+
cls._parse_python(content, project, framework)
|
|
111
|
+
elif lang == "csharp":
|
|
112
|
+
cls._parse_csharp(content, project, framework)
|
|
113
|
+
else:
|
|
114
|
+
cls._parse_generic(content, project)
|
|
115
|
+
|
|
116
|
+
return project
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def parse_file(cls, file_path: str) -> ProjectIR:
|
|
120
|
+
if not os.path.exists(file_path):
|
|
121
|
+
raise FileNotFoundError(f"Source file not found: {file_path}")
|
|
122
|
+
|
|
123
|
+
with open(file_path, "r", encoding="utf-8", errors="replace") as f:
|
|
124
|
+
content = f.read()
|
|
125
|
+
|
|
126
|
+
return cls.parse_code(content, file_path)
|
|
127
|
+
|
|
128
|
+
# -------------------------------------------------------------------------
|
|
129
|
+
# TypeScript / JavaScript Parser
|
|
130
|
+
# -------------------------------------------------------------------------
|
|
131
|
+
@classmethod
|
|
132
|
+
def _parse_ts_js(cls, content: str, project: ProjectIR, framework: str):
|
|
133
|
+
class_match = re.search(r"class\s+([A-Za-z0-9_]+)(?:\s+extends\s+([A-Za-z0-9_]+))?", content)
|
|
134
|
+
page_name = class_match.group(1) if class_match else f"{project.name}Page"
|
|
135
|
+
base_class = class_match.group(2) if (class_match and class_match.group(2)) else "BasePage"
|
|
136
|
+
|
|
137
|
+
page = PageClassIR(name=page_name, base_class=base_class)
|
|
138
|
+
locators: Dict[str, LocatorIR] = {}
|
|
139
|
+
|
|
140
|
+
# 1. Playwright getByRole
|
|
141
|
+
role_matches = re.finditer(
|
|
142
|
+
r"(?:readonly\s+)?(?:this\.)?([A-Za-z0-9_$]+)\s*=\s*(?:this\.)?page\.getByRole\(\s*(?:\"([^\"]*)\"|'([^']*)')(?:\s+as\s+[A-Za-z0-9_]+)?\s*,\s*\{\s*name:\s*(?:\"([^\"]*)\"|'([^']*)')\s*\}\s*\)",
|
|
143
|
+
content
|
|
144
|
+
)
|
|
145
|
+
for m in role_matches:
|
|
146
|
+
loc_name = m.group(1)
|
|
147
|
+
role_type = extract_quoted_string((m.group(2), m.group(3)))
|
|
148
|
+
acc_name = extract_quoted_string((m.group(4), m.group(5)))
|
|
149
|
+
locators[loc_name] = LocatorIR(name=loc_name, strategy=LocatorStrategy.ROLE, value=f"{role_type}[name='{acc_name}']")
|
|
150
|
+
|
|
151
|
+
# 2. Playwright getByTestId
|
|
152
|
+
tid_matches = re.finditer(
|
|
153
|
+
r"(?:readonly\s+)?(?:this\.)?([A-Za-z0-9_$]+)\s*=\s*(?:this\.)?page\.getByTestId\(\s*(?:\"([^\"]*)\"|'([^']*)')\s*\)",
|
|
154
|
+
content
|
|
155
|
+
)
|
|
156
|
+
for m in tid_matches:
|
|
157
|
+
loc_name = m.group(1)
|
|
158
|
+
val = extract_quoted_string((m.group(2), m.group(3)))
|
|
159
|
+
locators[loc_name] = LocatorIR(name=loc_name, strategy=LocatorStrategy.TEST_ID, value=val)
|
|
160
|
+
|
|
161
|
+
# 3. Playwright getByLabel
|
|
162
|
+
label_matches = re.finditer(
|
|
163
|
+
r"(?:readonly\s+)?(?:this\.)?([A-Za-z0-9_$]+)\s*=\s*(?:this\.)?page\.getByLabel\(\s*(?:\"([^\"]*)\"|'([^']*)')\s*\)",
|
|
164
|
+
content
|
|
165
|
+
)
|
|
166
|
+
for m in label_matches:
|
|
167
|
+
loc_name = m.group(1)
|
|
168
|
+
val = extract_quoted_string((m.group(2), m.group(3)))
|
|
169
|
+
locators[loc_name] = LocatorIR(name=loc_name, strategy=LocatorStrategy.LABEL, value=val)
|
|
170
|
+
|
|
171
|
+
# 4. Playwright page.locator('...')
|
|
172
|
+
loc_matches = re.finditer(
|
|
173
|
+
r"""(?:readonly\s+)?(?:this\.)?([A-Za-z0-9_$]+)\s*=\s*(?:this\.)?page\.locator\(\s*(?:\"((?:[^"\\]|\\.)*)\"|'((?:[^'\\]|\\.)*)')\s*\)""",
|
|
174
|
+
content
|
|
175
|
+
)
|
|
176
|
+
for m in loc_matches:
|
|
177
|
+
loc_name = m.group(1)
|
|
178
|
+
selector = extract_quoted_string((m.group(2), m.group(3)))
|
|
179
|
+
strat = LocatorStrategy.XPATH if selector.startswith(("//", "(//")) else LocatorStrategy.CSS
|
|
180
|
+
locators[loc_name] = LocatorIR(name=loc_name, strategy=strat, value=selector)
|
|
181
|
+
|
|
182
|
+
page.locators = list(locators.values())
|
|
183
|
+
|
|
184
|
+
# Methods
|
|
185
|
+
method_blocks = re.findall(r"(async\s+)?([A-Za-z0-9_$]+)\s*\(([^)]*)\)\s*(?::\s*[^\{]+)?\s*\{([^}]+)\}", content, re.MULTILINE)
|
|
186
|
+
for _, m_name, params_str, body in method_blocks:
|
|
187
|
+
if m_name in ["constructor"]:
|
|
188
|
+
continue
|
|
189
|
+
params = [p.strip().split(":")[0].strip() for p in params_str.split(",") if p.strip()]
|
|
190
|
+
steps = cls._extract_steps_from_body(body)
|
|
191
|
+
page.methods.append(MethodIR(name=m_name, parameters=params, steps=steps))
|
|
192
|
+
|
|
193
|
+
project.pages.append(page)
|
|
194
|
+
|
|
195
|
+
# Test cases (Playwright `test(...)` or Cypress / Mocha `it(...)`)
|
|
196
|
+
test_blocks = re.findall(
|
|
197
|
+
r"(?:test|it)(?:\.only|\.skip)?\s*\(\s*(?:\"([^\"]*)\"|'([^']*)')\s*,\s*(?:async\s*)?(?:\([^)]*\)|function\s*\([^)]*\))\s*=>?\s*\{([^}]+)\}",
|
|
198
|
+
content,
|
|
199
|
+
re.MULTILINE
|
|
200
|
+
)
|
|
201
|
+
for idx, (t_m1, t_m2, t_body) in enumerate(test_blocks, 1):
|
|
202
|
+
t_title = t_m1 if t_m1 else t_m2
|
|
203
|
+
steps = cls._extract_steps_from_body(t_body)
|
|
204
|
+
project.test_cases.append(TestCaseIR(id=f"TC_{idx:03d}", title=t_title, steps=steps))
|
|
205
|
+
|
|
206
|
+
# -------------------------------------------------------------------------
|
|
207
|
+
# Java Parser (Selenium & Playwright)
|
|
208
|
+
# -------------------------------------------------------------------------
|
|
209
|
+
@classmethod
|
|
210
|
+
def _parse_java(cls, content: str, project: ProjectIR, framework: str):
|
|
211
|
+
class_match = re.search(r"public\s+class\s+([A-Za-z0-9_]+)(?:\s+extends\s+([A-Za-z0-9_]+))?", content)
|
|
212
|
+
page_name = class_match.group(1) if class_match else f"{project.name}Page"
|
|
213
|
+
base_class = class_match.group(2) if (class_match and class_match.group(2)) else "BasePage"
|
|
214
|
+
|
|
215
|
+
page = PageClassIR(name=page_name, base_class=base_class)
|
|
216
|
+
locators: Dict[str, LocatorIR] = {}
|
|
217
|
+
|
|
218
|
+
# 1. Selenium @FindBy annotations
|
|
219
|
+
findby_matches = re.finditer(
|
|
220
|
+
r"@FindBy\s*\(\s*([a-zA-Z0-9_]+)\s*=\s*(?:\"([^\"]*)\"|'([^']*)')\s*\)\s*(?:(?:private|public|protected|static|final)\s+)*(?:WebElement|List<WebElement>)\s+([A-Za-z0-9_]+);",
|
|
221
|
+
content
|
|
222
|
+
)
|
|
223
|
+
for m in findby_matches:
|
|
224
|
+
by_type = m.group(1).lower()
|
|
225
|
+
selector = extract_quoted_string((m.group(2), m.group(3)))
|
|
226
|
+
var_name = m.group(4)
|
|
227
|
+
strat = LocatorStrategy.XPATH if by_type == "xpath" else (LocatorStrategy.ID if by_type == "id" else LocatorStrategy.CSS)
|
|
228
|
+
locators[var_name] = LocatorIR(name=var_name, strategy=strat, value=selector)
|
|
229
|
+
|
|
230
|
+
# 2. By locators
|
|
231
|
+
by_matches = re.finditer(
|
|
232
|
+
r"(?:(?:private|public|protected|static|final)\s+)*By\s+([A-Za-z0-9_]+)\s*=\s*By\.([a-zA-Z0-9_]+)\s*\(\s*(?:\"([^\"]*)\"|'([^']*)')\s*\);",
|
|
233
|
+
content
|
|
234
|
+
)
|
|
235
|
+
for m in by_matches:
|
|
236
|
+
var_name = m.group(1)
|
|
237
|
+
by_type = m.group(2).lower()
|
|
238
|
+
selector = extract_quoted_string((m.group(3), m.group(4)))
|
|
239
|
+
strat = LocatorStrategy.XPATH if "xpath" in by_type else (LocatorStrategy.ID if "id" in by_type else LocatorStrategy.CSS)
|
|
240
|
+
locators[var_name] = LocatorIR(name=var_name, strategy=strat, value=selector)
|
|
241
|
+
|
|
242
|
+
page.locators = list(locators.values())
|
|
243
|
+
|
|
244
|
+
# 3. Methods
|
|
245
|
+
method_blocks = re.findall(r"(?:public|protected|private)\s+([A-Za-z0-9_<>\s]+)\s+([A-Za-z0-9_]+)\s*\(([^)]*)\)\s*(?:throws\s+[A-Za-z0-9_,\s]+)?\s*\{([^}]+)\}", content, re.MULTILINE)
|
|
246
|
+
for ret_type, m_name, params_str, body in method_blocks:
|
|
247
|
+
if m_name == page_name:
|
|
248
|
+
continue
|
|
249
|
+
params = [p.strip().split()[-1] for p in params_str.split(",") if p.strip()]
|
|
250
|
+
steps = cls._extract_steps_from_body(body)
|
|
251
|
+
page.methods.append(MethodIR(name=m_name, parameters=params, return_type=ret_type.strip(), steps=steps))
|
|
252
|
+
|
|
253
|
+
project.pages.append(page)
|
|
254
|
+
|
|
255
|
+
# 4. TestNG / JUnit
|
|
256
|
+
test_matches = re.findall(r"@Test[^\n]*\s*(?:public|void|\s)+([A-Za-z0-9_]+)\s*\([^)]*\)[^{]*\{([^}]+)\}", content, re.MULTILINE)
|
|
257
|
+
for idx, (t_name, t_body) in enumerate(test_matches, 1):
|
|
258
|
+
steps = cls._extract_steps_from_body(t_body)
|
|
259
|
+
project.test_cases.append(TestCaseIR(id=f"TC_{idx:03d}", title=t_name, steps=steps))
|
|
260
|
+
|
|
261
|
+
# -------------------------------------------------------------------------
|
|
262
|
+
# Groovy / Katalon Parser (Clean POM Flat Architecture)
|
|
263
|
+
# -------------------------------------------------------------------------
|
|
264
|
+
@classmethod
|
|
265
|
+
def _parse_groovy(cls, content: str, project: ProjectIR, framework: str):
|
|
266
|
+
class_match = re.search(r"class\s+([A-Za-z0-9_]+)(?:\s+extends\s+([A-Za-z0-9_]+))?", content)
|
|
267
|
+
page_name = class_match.group(1) if class_match else f"{project.name}Page"
|
|
268
|
+
base_class = class_match.group(2) if (class_match and class_match.group(2)) else "BasePage"
|
|
269
|
+
|
|
270
|
+
page = PageClassIR(name=page_name, base_class=base_class)
|
|
271
|
+
locators: Dict[str, LocatorIR] = {}
|
|
272
|
+
|
|
273
|
+
# Extract static final String XPaths
|
|
274
|
+
xpath_matches = re.finditer(
|
|
275
|
+
r"(?:(?:public|private|protected|static|final)\s+)*(?:String|def)\s+([A-Za-z0-9_]+)\s*=\s*(?:\"([^\"]*)\"|'([^']*)')",
|
|
276
|
+
content
|
|
277
|
+
)
|
|
278
|
+
for m in xpath_matches:
|
|
279
|
+
var_name = m.group(1)
|
|
280
|
+
selector = extract_quoted_string((m.group(2), m.group(3)))
|
|
281
|
+
strat = LocatorStrategy.XPATH if selector.startswith(("//", "(//")) else LocatorStrategy.CSS
|
|
282
|
+
locators[var_name] = LocatorIR(name=var_name, strategy=strat, value=selector)
|
|
283
|
+
|
|
284
|
+
page.locators = list(locators.values())
|
|
285
|
+
|
|
286
|
+
# Methods
|
|
287
|
+
method_blocks = re.findall(r"(?:(?:public|private|protected|def|static|void|[A-Za-z0-9_<>]+)\s+)+([A-Za-z0-9_]+)\s*\(([^)]*)\)\s*\{([^}]+)\}", content, re.MULTILINE)
|
|
288
|
+
for m_name, params_str, body in method_blocks:
|
|
289
|
+
if m_name in [page_name, "main"]:
|
|
290
|
+
continue
|
|
291
|
+
params = [p.strip().split()[-1] for p in params_str.split(",") if p.strip()]
|
|
292
|
+
steps = cls._extract_steps_from_body(body)
|
|
293
|
+
page.methods.append(MethodIR(name=m_name, parameters=params, steps=steps))
|
|
294
|
+
|
|
295
|
+
project.pages.append(page)
|
|
296
|
+
|
|
297
|
+
if not class_match:
|
|
298
|
+
steps = cls._extract_steps_from_body(content)
|
|
299
|
+
project.test_cases.append(TestCaseIR(id="TC_001", title=project.name, steps=steps))
|
|
300
|
+
|
|
301
|
+
# -------------------------------------------------------------------------
|
|
302
|
+
# Python Parser (Pytest / Playwright / Selenium)
|
|
303
|
+
# -------------------------------------------------------------------------
|
|
304
|
+
@classmethod
|
|
305
|
+
def _parse_python(cls, content: str, project: ProjectIR, framework: str):
|
|
306
|
+
class_match = re.search(r"class\s+([A-Za-z0-9_]+)(?:\(([^)]+)\))?:", content)
|
|
307
|
+
page_name = class_match.group(1) if class_match else f"{project.name}Page"
|
|
308
|
+
base_class = class_match.group(2) if (class_match and class_match.group(2)) else "BasePage"
|
|
309
|
+
|
|
310
|
+
page = PageClassIR(name=page_name, base_class=base_class)
|
|
311
|
+
locators: Dict[str, LocatorIR] = {}
|
|
312
|
+
|
|
313
|
+
loc_matches = re.finditer(
|
|
314
|
+
r"self\.([a-zA-Z0-9_]+)\s*=\s*(?:self\.)?page\.locator\(\s*(?:\"([^\"]*)\"|'([^']*)')\s*\)",
|
|
315
|
+
content
|
|
316
|
+
)
|
|
317
|
+
for m in loc_matches:
|
|
318
|
+
name = m.group(1)
|
|
319
|
+
sel = extract_quoted_string((m.group(2), m.group(3)))
|
|
320
|
+
strat = LocatorStrategy.XPATH if sel.startswith(("//", "(//")) else LocatorStrategy.CSS
|
|
321
|
+
locators[name] = LocatorIR(name=name, strategy=strat, value=sel)
|
|
322
|
+
|
|
323
|
+
role_matches = re.finditer(
|
|
324
|
+
r"self\.([a-zA-Z0-9_]+)\s*=\s*(?:self\.)?page\.get_by_role\(\s*(?:\"([^\"]*)\"|'([^']*)')\s*,\s*name=(?:\"([^\"]*)\"|'([^']*)')\s*\)",
|
|
325
|
+
content
|
|
326
|
+
)
|
|
327
|
+
for m in role_matches:
|
|
328
|
+
name = m.group(1)
|
|
329
|
+
r_type = extract_quoted_string((m.group(2), m.group(3)))
|
|
330
|
+
r_name = extract_quoted_string((m.group(4), m.group(5)))
|
|
331
|
+
locators[name] = LocatorIR(name=name, strategy=LocatorStrategy.ROLE, value=f"{r_type}[name='{r_name}']")
|
|
332
|
+
|
|
333
|
+
page.locators = list(locators.values())
|
|
334
|
+
|
|
335
|
+
func_blocks = re.findall(r"def\s+([A-Za-z0-9_]+)\s*\(([^)]*)\)\s*(?:->\s*[^:]+)?:(.*?)(?=\n\s*def\s+|\Z)", content, re.DOTALL)
|
|
336
|
+
for f_name, f_params, f_body in func_blocks:
|
|
337
|
+
if f_name.startswith("test_"):
|
|
338
|
+
steps = cls._extract_steps_from_body(f_body)
|
|
339
|
+
project.test_cases.append(TestCaseIR(id=f"TC_{len(project.test_cases)+1:03d}", title=f_name, steps=steps))
|
|
340
|
+
elif f_name != "__init__":
|
|
341
|
+
params = [p.strip().split(":")[0].strip() for p in f_params.split(",") if p.strip() and p.strip() != "self"]
|
|
342
|
+
steps = cls._extract_steps_from_body(f_body)
|
|
343
|
+
page.methods.append(MethodIR(name=f_name, parameters=params, steps=steps))
|
|
344
|
+
|
|
345
|
+
project.pages.append(page)
|
|
346
|
+
|
|
347
|
+
# -------------------------------------------------------------------------
|
|
348
|
+
# C# Parser (.NET Selenium / Playwright)
|
|
349
|
+
# -------------------------------------------------------------------------
|
|
350
|
+
@classmethod
|
|
351
|
+
def _parse_csharp(cls, content: str, project: ProjectIR, framework: str):
|
|
352
|
+
class_match = re.search(r"class\s+([A-Za-z0-9_]+)(?:\s*:\s*([A-Za-z0-9_]+))?", content)
|
|
353
|
+
page_name = class_match.group(1) if class_match else f"{project.name}Page"
|
|
354
|
+
base_class = class_match.group(2) if (class_match and class_match.group(2)) else "BasePage"
|
|
355
|
+
|
|
356
|
+
page = PageClassIR(name=page_name, base_class=base_class)
|
|
357
|
+
project.pages.append(page)
|
|
358
|
+
|
|
359
|
+
# -------------------------------------------------------------------------
|
|
360
|
+
# Generic Fallback Parser
|
|
361
|
+
# -------------------------------------------------------------------------
|
|
362
|
+
@classmethod
|
|
363
|
+
def _parse_generic(cls, content: str, project: ProjectIR):
|
|
364
|
+
page = PageClassIR(name=f"{project.name}Page")
|
|
365
|
+
steps = cls._extract_steps_from_body(content)
|
|
366
|
+
project.test_cases.append(TestCaseIR(id="TC_001", title=project.name, steps=steps))
|
|
367
|
+
project.pages.append(page)
|
|
368
|
+
|
|
369
|
+
# -------------------------------------------------------------------------
|
|
370
|
+
# Universal Step Extractor (With Async/Sync Bridge & Antipattern Sanitizer)
|
|
371
|
+
# -------------------------------------------------------------------------
|
|
372
|
+
@classmethod
|
|
373
|
+
def _extract_steps_from_body(cls, body: str) -> List[StepIR]:
|
|
374
|
+
steps: List[StepIR] = []
|
|
375
|
+
# Unroll Cypress .then() closures into sequential lines
|
|
376
|
+
normalized_body = re.sub(r"\.then\s*\(\s*\([^)]*\)\s*=>\s*\{?", "\n", body)
|
|
377
|
+
|
|
378
|
+
for line in normalized_body.splitlines():
|
|
379
|
+
line_str = line.strip()
|
|
380
|
+
if not line_str or line_str.startswith(("//", "#", "/*", "*")) or line_str in ["}", "});"]:
|
|
381
|
+
continue
|
|
382
|
+
|
|
383
|
+
# 0. Detect Hardcoded Sleep Antipatterns (Thread.sleep, WebUI.delay, cy.wait, time.sleep)
|
|
384
|
+
sleep_m = re.search(r"(?:Thread\.sleep|WebUI\.delay|time\.sleep|cy\.wait)\s*\(\s*(\d+)\s*\)", line_str, re.IGNORECASE)
|
|
385
|
+
if sleep_m:
|
|
386
|
+
sleep_val = int(sleep_m.group(1))
|
|
387
|
+
ms = sleep_val * 1000 if sleep_val <= 60 else sleep_val # WebUI.delay(3) vs Thread.sleep(3000)
|
|
388
|
+
steps.append(StepIR(
|
|
389
|
+
action=ActionType.WAIT,
|
|
390
|
+
wait_strategy=WaitStrategy.STATIC_SLEEP,
|
|
391
|
+
is_sanitized_wait=True,
|
|
392
|
+
timeout_ms=ms,
|
|
393
|
+
description=f"Auto-healed from static sleep {line_str}"
|
|
394
|
+
))
|
|
395
|
+
continue
|
|
396
|
+
|
|
397
|
+
# 1. Cypress Command Chaining: cy.get('selector').action(...)
|
|
398
|
+
cy_chain = re.search(r"cy\.get\(\s*(?:\"([^\"]*)\"|'([^']*)')\s*\)\s*\.\s*(click|type|clear|should)\s*\(([^)]*)\)", line_str, re.IGNORECASE)
|
|
399
|
+
if cy_chain:
|
|
400
|
+
sel = extract_quoted_string((cy_chain.group(1), cy_chain.group(2)))
|
|
401
|
+
cy_act = cy_chain.group(3).lower()
|
|
402
|
+
cy_args = cy_chain.group(4)
|
|
403
|
+
if cy_act == "click":
|
|
404
|
+
steps.append(StepIR(action=ActionType.CLICK, target=sel, description=f"Cypress click on {sel}"))
|
|
405
|
+
elif cy_act in ["type", "clear"]:
|
|
406
|
+
m_type = re.search(r"(?:\"([^\"]*)\"|'([^']*)')", cy_args)
|
|
407
|
+
type_val = extract_quoted_string((m_type.group(1), m_type.group(2))) if m_type else ""
|
|
408
|
+
steps.append(StepIR(action=ActionType.FILL, target=sel, value=type_val, description=f"Cypress type on {sel}"))
|
|
409
|
+
elif cy_act == "should":
|
|
410
|
+
steps.append(StepIR(action=ActionType.ASSERT, target=sel, assertion_type=AssertionType.VISIBLE, description=line_str))
|
|
411
|
+
continue
|
|
412
|
+
|
|
413
|
+
# 2. Navigation
|
|
414
|
+
nav_m = re.search(r"(?:goto|navigate|openBrowser|navigateToUrl|visit|get)\s*\(\s*(?:\"([^\"]*)\"|'([^']*)')\s*\)", line_str, re.IGNORECASE)
|
|
415
|
+
if nav_m:
|
|
416
|
+
val = extract_quoted_string((nav_m.group(1), nav_m.group(2)))
|
|
417
|
+
steps.append(StepIR(action=ActionType.GOTO, value=val, description=f"Navigate to {val}"))
|
|
418
|
+
continue
|
|
419
|
+
|
|
420
|
+
# 3. Click
|
|
421
|
+
click_m = re.search(r"(?:click|clickJS)\s*\(\s*(?:(?:\"([^\"]*)\"|'([^']*)')|([A-Za-z0-9_$.]+))?\s*\)", line_str, re.IGNORECASE)
|
|
422
|
+
if click_m:
|
|
423
|
+
target = extract_quoted_string((click_m.group(1), click_m.group(2))) or click_m.group(3) or "element"
|
|
424
|
+
target_clean = target.replace("this.", "").replace("self.", "")
|
|
425
|
+
steps.append(StepIR(action=ActionType.CLICK, target=target_clean, description=f"Click on {target_clean}"))
|
|
426
|
+
continue
|
|
427
|
+
|
|
428
|
+
# 4. Fill
|
|
429
|
+
fill_m = re.search(r"(?:fill|sendKeys|setText|type)\s*\(\s*(?:([A-Za-z0-9_$.]+)\s*,\s*)?(?:\"([^\"]*)\"|'([^']*)')\s*\)", line_str, re.IGNORECASE)
|
|
430
|
+
if fill_m:
|
|
431
|
+
target = fill_m.group(1) or "input"
|
|
432
|
+
val = extract_quoted_string((fill_m.group(2), fill_m.group(3)))
|
|
433
|
+
target_clean = target.replace("this.", "").replace("self.", "")
|
|
434
|
+
steps.append(StepIR(action=ActionType.FILL, target=target_clean, value=val, description=f"Fill {val} into {target_clean}"))
|
|
435
|
+
continue
|
|
436
|
+
|
|
437
|
+
# 5. Assertions
|
|
438
|
+
if any(k in line_str for k in ["expect", "Assert.", "verify", "should("]):
|
|
439
|
+
if "visible" in line_str.lower() or "present" in line_str.lower():
|
|
440
|
+
steps.append(StepIR(action=ActionType.ASSERT, assertion_type=AssertionType.VISIBLE, description=line_str))
|
|
441
|
+
elif "equal" in line_str.lower() or "match" in line_str.lower():
|
|
442
|
+
steps.append(StepIR(action=ActionType.ASSERT, assertion_type=AssertionType.EQUALS, description=line_str))
|
|
443
|
+
else:
|
|
444
|
+
steps.append(StepIR(action=ActionType.ASSERT, description=line_str))
|
|
445
|
+
continue
|
|
446
|
+
|
|
447
|
+
if "(" in line_str and ")" in line_str:
|
|
448
|
+
steps.append(StepIR(action=ActionType.CUSTOM_CALL, description=line_str))
|
|
449
|
+
|
|
450
|
+
return steps
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Omni-Transpiler & Repository Scanner
|
|
4
|
+
-----------------------------------
|
|
5
|
+
Connects OmniParser and OmniEmitter to provide:
|
|
6
|
+
1. Instant 0-token transpilation between test automation frameworks.
|
|
7
|
+
2. Recursive repo scanner that inventories Page Classes, Locators, and Test Cases
|
|
8
|
+
across polyglot codebases (Java, Groovy, TS, Python, C#).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
import json
|
|
14
|
+
import argparse
|
|
15
|
+
from typing import Dict, Any, Optional
|
|
16
|
+
|
|
17
|
+
# Dynamic imports
|
|
18
|
+
try:
|
|
19
|
+
from tools.universal_ir import resolve_hermetic_fixtures
|
|
20
|
+
from tools.omni_parser import OmniParser
|
|
21
|
+
from tools.omni_emitter import OmniEmitter
|
|
22
|
+
except ImportError:
|
|
23
|
+
from universal_ir import resolve_hermetic_fixtures
|
|
24
|
+
from omni_parser import OmniParser
|
|
25
|
+
from omni_emitter import OmniEmitter
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def transpile_file(
|
|
29
|
+
source_path: str,
|
|
30
|
+
target_framework: str,
|
|
31
|
+
output_dir: Optional[str] = None,
|
|
32
|
+
hermetic: bool = True
|
|
33
|
+
) -> Dict[str, str]:
|
|
34
|
+
"""Transpiles a single automation source file to the target framework."""
|
|
35
|
+
if not os.path.exists(source_path):
|
|
36
|
+
raise FileNotFoundError(f"Source file not found: {source_path}")
|
|
37
|
+
|
|
38
|
+
# 1. Parse source with 0-token deterministic parser
|
|
39
|
+
project_ir = OmniParser.parse_file(source_path)
|
|
40
|
+
|
|
41
|
+
# 2. Resolve data dependencies & inject hermetic pre-flight fixtures
|
|
42
|
+
if hermetic:
|
|
43
|
+
project_ir = resolve_hermetic_fixtures(project_ir)
|
|
44
|
+
|
|
45
|
+
# 3. Emit target code
|
|
46
|
+
emitted_files = OmniEmitter.emit(project_ir, target_framework)
|
|
47
|
+
|
|
48
|
+
# 4. Write to disk if output_dir specified
|
|
49
|
+
if output_dir:
|
|
50
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
51
|
+
for rel_path, content in emitted_files.items():
|
|
52
|
+
full_out_path = os.path.join(output_dir, rel_path)
|
|
53
|
+
os.makedirs(os.path.dirname(full_out_path), exist_ok=True)
|
|
54
|
+
with open(full_out_path, "w", encoding="utf-8") as f:
|
|
55
|
+
f.write(content)
|
|
56
|
+
|
|
57
|
+
return emitted_files
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def scan_repository(repo_path: str) -> Dict[str, Any]:
|
|
61
|
+
"""
|
|
62
|
+
Recursively scans a repository and builds a unified polyglot inventory
|
|
63
|
+
of all Page Objects, Locators, and Test Cases with 0 tokens.
|
|
64
|
+
"""
|
|
65
|
+
if not os.path.exists(repo_path):
|
|
66
|
+
raise FileNotFoundError(f"Path does not exist: {repo_path}")
|
|
67
|
+
|
|
68
|
+
inventory: Dict[str, Any] = {
|
|
69
|
+
"repository": os.path.abspath(repo_path),
|
|
70
|
+
"total_files_scanned": 0,
|
|
71
|
+
"languages": {},
|
|
72
|
+
"frameworks": {},
|
|
73
|
+
"pages": [],
|
|
74
|
+
"test_cases": [],
|
|
75
|
+
"total_locators": 0,
|
|
76
|
+
"total_methods": 0
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
test_extensions = {".java", ".ts", ".js", ".groovy", ".py", ".cs"}
|
|
80
|
+
exclude_dirs = {"node_modules", ".git", ".gradle", "build", "target", "dist", ".gemini", "__pycache__"}
|
|
81
|
+
|
|
82
|
+
for root, dirs, files in os.walk(repo_path):
|
|
83
|
+
dirs[:] = [d for d in dirs if d not in exclude_dirs]
|
|
84
|
+
for f in files:
|
|
85
|
+
ext = os.path.splitext(f)[1].lower()
|
|
86
|
+
if ext in test_extensions:
|
|
87
|
+
file_full = os.path.join(root, f)
|
|
88
|
+
try:
|
|
89
|
+
p_ir = OmniParser.parse_file(file_full)
|
|
90
|
+
inventory["total_files_scanned"] += 1
|
|
91
|
+
|
|
92
|
+
# Language counts
|
|
93
|
+
inventory["languages"][p_ir.source_language] = inventory["languages"].get(p_ir.source_language, 0) + 1
|
|
94
|
+
inventory["frameworks"][p_ir.source_framework] = inventory["frameworks"].get(p_ir.source_framework, 0) + 1
|
|
95
|
+
|
|
96
|
+
for p in p_ir.pages:
|
|
97
|
+
if p.locators or p.methods:
|
|
98
|
+
inventory["pages"].append({
|
|
99
|
+
"name": p.name,
|
|
100
|
+
"file": os.path.relpath(file_full, repo_path).replace("\\", "/"),
|
|
101
|
+
"locators_count": len(p.locators),
|
|
102
|
+
"methods_count": len(p.methods)
|
|
103
|
+
})
|
|
104
|
+
inventory["total_locators"] = int(inventory.get("total_locators", 0)) + len(p.locators)
|
|
105
|
+
inventory["total_methods"] = int(inventory.get("total_methods", 0)) + len(p.methods)
|
|
106
|
+
|
|
107
|
+
for tc in p_ir.test_cases:
|
|
108
|
+
inventory["test_cases"].append({
|
|
109
|
+
"id": tc.id,
|
|
110
|
+
"title": tc.title,
|
|
111
|
+
"file": os.path.relpath(file_full, repo_path).replace("\\", "/"),
|
|
112
|
+
"steps_count": len(tc.steps)
|
|
113
|
+
})
|
|
114
|
+
except Exception as parse_err:
|
|
115
|
+
sys.stderr.write(f"Notice: Parse IR skipped for {f}: {parse_err}\n")
|
|
116
|
+
|
|
117
|
+
return inventory
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def main():
|
|
121
|
+
parser = argparse.ArgumentParser(description="Omni-Transpiler & Polyglot Test Inventory Scanner")
|
|
122
|
+
sub = parser.add_subparsers(dest="cmd")
|
|
123
|
+
|
|
124
|
+
# transpile command
|
|
125
|
+
p_trans = sub.add_parser("transpile", help="Transpile test files across languages and frameworks")
|
|
126
|
+
p_trans.add_argument("source", help="Source file path")
|
|
127
|
+
p_trans.add_argument("--to", required=True, choices=OmniEmitter.SUPPORTED_TARGETS, help="Target framework")
|
|
128
|
+
p_trans.add_argument("--out", default=None, help="Output directory")
|
|
129
|
+
p_trans.add_argument("--no-hermetic", action="store_true", help="Disable automatic hermetic data dependency resolution")
|
|
130
|
+
|
|
131
|
+
# scan command
|
|
132
|
+
p_scan = sub.add_parser("scan", help="Scan repository and build polyglot test inventory")
|
|
133
|
+
p_scan.add_argument("path", default=".", nargs="?", help="Directory to scan")
|
|
134
|
+
p_scan.add_argument("--json", action="store_true", help="Output raw JSON")
|
|
135
|
+
|
|
136
|
+
args = parser.parse_args()
|
|
137
|
+
|
|
138
|
+
if args.cmd == "transpile":
|
|
139
|
+
res = transpile_file(args.source, args.to, args.out, hermetic=not args.no_hermetic)
|
|
140
|
+
print(f"✅ Successfully transpiled '{args.source}' -> {args.to} ({len(res)} files generated):")
|
|
141
|
+
for p, code in res.items():
|
|
142
|
+
print(f" • {p} ({len(code.splitlines())} lines)")
|
|
143
|
+
if not args.out:
|
|
144
|
+
print("---")
|
|
145
|
+
print(code)
|
|
146
|
+
print("---")
|
|
147
|
+
|
|
148
|
+
elif args.cmd == "scan":
|
|
149
|
+
inv = scan_repository(args.path)
|
|
150
|
+
if args.json:
|
|
151
|
+
print(json.dumps(inv, indent=2))
|
|
152
|
+
else:
|
|
153
|
+
print("======================================================================")
|
|
154
|
+
print(" OMNI-AUTOMATION POLYGLOT REPOSITORY INVENTORY (0-TOKEN AST SCAN)")
|
|
155
|
+
print("======================================================================")
|
|
156
|
+
print(f"📁 Target Directory : {inv['repository']}")
|
|
157
|
+
print(f"📄 Scanned Files : {inv['total_files_scanned']}")
|
|
158
|
+
print(f"🌐 Languages Detected : {inv['languages']}")
|
|
159
|
+
print(f"⚡ Frameworks : {inv['frameworks']}")
|
|
160
|
+
print(f"🏛️ Page Classes Found : {len(inv['pages'])}")
|
|
161
|
+
print(f"🎯 Total Locators : {inv['total_locators']}")
|
|
162
|
+
print(f"⚙️ Action Methods : {inv['total_methods']}")
|
|
163
|
+
print(f"🧪 Test Cases Found : {len(inv['test_cases'])}")
|
|
164
|
+
print("======================================================================")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if __name__ == "__main__":
|
|
168
|
+
main()
|