@yasserkhanorg/impact-gate 2.0.0
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/LICENSE +168 -0
- package/README.md +520 -0
- package/dist/adapters/cypress.d.ts +10 -0
- package/dist/adapters/cypress.d.ts.map +1 -0
- package/dist/adapters/cypress.js +86 -0
- package/dist/adapters/framework_adapter.d.ts +41 -0
- package/dist/adapters/framework_adapter.d.ts.map +1 -0
- package/dist/adapters/framework_adapter.js +152 -0
- package/dist/adapters/playwright.d.ts +10 -0
- package/dist/adapters/playwright.d.ts.map +1 -0
- package/dist/adapters/playwright.js +86 -0
- package/dist/adapters/pytest.d.ts +10 -0
- package/dist/adapters/pytest.d.ts.map +1 -0
- package/dist/adapters/pytest.js +96 -0
- package/dist/adapters/supertest.d.ts +12 -0
- package/dist/adapters/supertest.d.ts.map +1 -0
- package/dist/adapters/supertest.js +85 -0
- package/dist/agent/api_catalog.d.ts +11 -0
- package/dist/agent/api_catalog.d.ts.map +1 -0
- package/dist/agent/api_catalog.js +210 -0
- package/dist/agent/config.d.ts +193 -0
- package/dist/agent/config.d.ts.map +1 -0
- package/dist/agent/config.js +875 -0
- package/dist/agent/feedback.d.ts +91 -0
- package/dist/agent/feedback.d.ts.map +1 -0
- package/dist/agent/feedback.js +323 -0
- package/dist/agent/git.d.ts +19 -0
- package/dist/agent/git.d.ts.map +1 -0
- package/dist/agent/git.js +257 -0
- package/dist/agent/handoff.d.ts +22 -0
- package/dist/agent/handoff.d.ts.map +1 -0
- package/dist/agent/handoff.js +180 -0
- package/dist/agent/llm_agents_flow.d.ts +15 -0
- package/dist/agent/llm_agents_flow.d.ts.map +1 -0
- package/dist/agent/llm_agents_flow.js +434 -0
- package/dist/agent/native_flow.d.ts +6 -0
- package/dist/agent/native_flow.d.ts.map +1 -0
- package/dist/agent/native_flow.js +179 -0
- package/dist/agent/pipeline.d.ts +7 -0
- package/dist/agent/pipeline.d.ts.map +1 -0
- package/dist/agent/pipeline.js +260 -0
- package/dist/agent/pipeline_types.d.ts +54 -0
- package/dist/agent/pipeline_types.d.ts.map +1 -0
- package/dist/agent/pipeline_types.js +4 -0
- package/dist/agent/pipeline_utils.d.ts +12 -0
- package/dist/agent/pipeline_utils.d.ts.map +1 -0
- package/dist/agent/pipeline_utils.js +156 -0
- package/dist/agent/plan.d.ts +170 -0
- package/dist/agent/plan.d.ts.map +1 -0
- package/dist/agent/plan.js +86 -0
- package/dist/agent/playwright_report.d.ts +8 -0
- package/dist/agent/playwright_report.d.ts.map +1 -0
- package/dist/agent/playwright_report.js +126 -0
- package/dist/agent/process_runner.d.ts +10 -0
- package/dist/agent/process_runner.d.ts.map +1 -0
- package/dist/agent/process_runner.js +92 -0
- package/dist/agent/spec_generator.d.ts +5 -0
- package/dist/agent/spec_generator.d.ts.map +1 -0
- package/dist/agent/spec_generator.js +253 -0
- package/dist/agent/test_path.d.ts +2 -0
- package/dist/agent/test_path.d.ts.map +1 -0
- package/dist/agent/test_path.js +23 -0
- package/dist/agent/traceability_capture.d.ts +18 -0
- package/dist/agent/traceability_capture.d.ts.map +1 -0
- package/dist/agent/traceability_capture.js +313 -0
- package/dist/agent/traceability_ingest.d.ts +21 -0
- package/dist/agent/traceability_ingest.d.ts.map +1 -0
- package/dist/agent/traceability_ingest.js +237 -0
- package/dist/agent/types.d.ts +42 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +4 -0
- package/dist/agent/utils.d.ts +13 -0
- package/dist/agent/utils.d.ts.map +1 -0
- package/dist/agent/utils.js +152 -0
- package/dist/agent/validation_runner.d.ts +5 -0
- package/dist/agent/validation_runner.d.ts.map +1 -0
- package/dist/agent/validation_runner.js +77 -0
- package/dist/agentic/fix_loop.d.ts +26 -0
- package/dist/agentic/fix_loop.d.ts.map +1 -0
- package/dist/agentic/fix_loop.js +96 -0
- package/dist/agentic/playwright_runner.d.ts +43 -0
- package/dist/agentic/playwright_runner.d.ts.map +1 -0
- package/dist/agentic/playwright_runner.js +165 -0
- package/dist/agentic/runner.d.ts +27 -0
- package/dist/agentic/runner.d.ts.map +1 -0
- package/dist/agentic/runner.js +210 -0
- package/dist/agentic/types.d.ts +62 -0
- package/dist/agentic/types.d.ts.map +1 -0
- package/dist/agentic/types.js +4 -0
- package/dist/agents/coverage-evaluator.d.ts +8 -0
- package/dist/agents/coverage-evaluator.d.ts.map +1 -0
- package/dist/agents/coverage-evaluator.js +41 -0
- package/dist/agents/cross-impact.d.ts +13 -0
- package/dist/agents/cross-impact.d.ts.map +1 -0
- package/dist/agents/cross-impact.js +140 -0
- package/dist/agents/executor.d.ts +8 -0
- package/dist/agents/executor.d.ts.map +1 -0
- package/dist/agents/executor.js +75 -0
- package/dist/agents/explorer.d.ts +12 -0
- package/dist/agents/explorer.d.ts.map +1 -0
- package/dist/agents/explorer.js +43 -0
- package/dist/agents/generator.d.ts +8 -0
- package/dist/agents/generator.d.ts.map +1 -0
- package/dist/agents/generator.js +77 -0
- package/dist/agents/healer.d.ts +8 -0
- package/dist/agents/healer.d.ts.map +1 -0
- package/dist/agents/healer.js +31 -0
- package/dist/agents/impact-analyst.d.ts +8 -0
- package/dist/agents/impact-analyst.d.ts.map +1 -0
- package/dist/agents/impact-analyst.js +38 -0
- package/dist/agents/regression-advisor.d.ts +8 -0
- package/dist/agents/regression-advisor.d.ts.map +1 -0
- package/dist/agents/regression-advisor.js +116 -0
- package/dist/agents/strategist.d.ts +9 -0
- package/dist/agents/strategist.d.ts.map +1 -0
- package/dist/agents/strategist.js +92 -0
- package/dist/agents/test-designer.d.ts +8 -0
- package/dist/agents/test-designer.d.ts.map +1 -0
- package/dist/agents/test-designer.js +111 -0
- package/dist/anthropic_provider.d.ts +65 -0
- package/dist/anthropic_provider.d.ts.map +1 -0
- package/dist/anthropic_provider.js +334 -0
- package/dist/api.d.ts +48 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +151 -0
- package/dist/base_provider.d.ts +109 -0
- package/dist/base_provider.d.ts.map +1 -0
- package/dist/base_provider.js +203 -0
- package/dist/budget_ledger.d.ts +28 -0
- package/dist/budget_ledger.d.ts.map +1 -0
- package/dist/budget_ledger.js +62 -0
- package/dist/cache/cached_provider.d.ts +49 -0
- package/dist/cache/cached_provider.d.ts.map +1 -0
- package/dist/cache/cached_provider.js +91 -0
- package/dist/cache/response_cache.d.ts +79 -0
- package/dist/cache/response_cache.d.ts.map +1 -0
- package/dist/cache/response_cache.js +177 -0
- package/dist/cli/commands/analyze.d.ts +3 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +77 -0
- package/dist/cli/commands/bootstrap.d.ts +3 -0
- package/dist/cli/commands/bootstrap.d.ts.map +1 -0
- package/dist/cli/commands/bootstrap.js +109 -0
- package/dist/cli/commands/cost_report.d.ts +3 -0
- package/dist/cli/commands/cost_report.d.ts.map +1 -0
- package/dist/cli/commands/cost_report.js +115 -0
- package/dist/cli/commands/crew.d.ts +3 -0
- package/dist/cli/commands/crew.d.ts.map +1 -0
- package/dist/cli/commands/crew.js +255 -0
- package/dist/cli/commands/feedback.d.ts +3 -0
- package/dist/cli/commands/feedback.d.ts.map +1 -0
- package/dist/cli/commands/feedback.js +39 -0
- package/dist/cli/commands/finalize.d.ts +3 -0
- package/dist/cli/commands/finalize.d.ts.map +1 -0
- package/dist/cli/commands/finalize.js +41 -0
- package/dist/cli/commands/gate.d.ts +3 -0
- package/dist/cli/commands/gate.d.ts.map +1 -0
- package/dist/cli/commands/gate.js +89 -0
- package/dist/cli/commands/generate.d.ts +4 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +108 -0
- package/dist/cli/commands/heal.d.ts +3 -0
- package/dist/cli/commands/heal.d.ts.map +1 -0
- package/dist/cli/commands/heal.js +60 -0
- package/dist/cli/commands/impact.d.ts +4 -0
- package/dist/cli/commands/impact.d.ts.map +1 -0
- package/dist/cli/commands/impact.js +33 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +169 -0
- package/dist/cli/commands/llm_health.d.ts +2 -0
- package/dist/cli/commands/llm_health.d.ts.map +1 -0
- package/dist/cli/commands/llm_health.js +22 -0
- package/dist/cli/commands/plan.d.ts +4 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +120 -0
- package/dist/cli/commands/plan_crew.d.ts +17 -0
- package/dist/cli/commands/plan_crew.d.ts.map +1 -0
- package/dist/cli/commands/plan_crew.js +316 -0
- package/dist/cli/commands/traceability.d.ts +4 -0
- package/dist/cli/commands/traceability.d.ts.map +1 -0
- package/dist/cli/commands/traceability.js +77 -0
- package/dist/cli/commands/train.d.ts +3 -0
- package/dist/cli/commands/train.d.ts.map +1 -0
- package/dist/cli/commands/train.js +391 -0
- package/dist/cli/defaults.d.ts +35 -0
- package/dist/cli/defaults.d.ts.map +1 -0
- package/dist/cli/defaults.js +172 -0
- package/dist/cli/errors.d.ts +27 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +57 -0
- package/dist/cli/parse_args.d.ts +6 -0
- package/dist/cli/parse_args.d.ts.map +1 -0
- package/dist/cli/parse_args.js +257 -0
- package/dist/cli/types.d.ts +87 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +4 -0
- package/dist/cli/usage.d.ts +2 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +109 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +194 -0
- package/dist/crew/context.d.ts +55 -0
- package/dist/crew/context.d.ts.map +1 -0
- package/dist/crew/context.js +36 -0
- package/dist/crew/orchestrator.d.ts +50 -0
- package/dist/crew/orchestrator.d.ts.map +1 -0
- package/dist/crew/orchestrator.js +329 -0
- package/dist/crew/protocol.d.ts +46 -0
- package/dist/crew/protocol.d.ts.map +1 -0
- package/dist/crew/protocol.js +4 -0
- package/dist/crew/provider.d.ts +17 -0
- package/dist/crew/provider.d.ts.map +1 -0
- package/dist/crew/provider.js +36 -0
- package/dist/crew/sanitize.d.ts +3 -0
- package/dist/crew/sanitize.d.ts.map +1 -0
- package/dist/crew/sanitize.js +31 -0
- package/dist/crew/types.d.ts +52 -0
- package/dist/crew/types.d.ts.map +1 -0
- package/dist/crew/types.js +4 -0
- package/dist/crew/workflows.d.ts +52 -0
- package/dist/crew/workflows.d.ts.map +1 -0
- package/dist/crew/workflows.js +36 -0
- package/dist/custom_provider.d.ts +20 -0
- package/dist/custom_provider.d.ts.map +1 -0
- package/dist/custom_provider.js +277 -0
- package/dist/engine/ai_enrichment.d.ts +44 -0
- package/dist/engine/ai_enrichment.d.ts.map +1 -0
- package/dist/engine/ai_enrichment.js +267 -0
- package/dist/engine/diff_loader.d.ts +11 -0
- package/dist/engine/diff_loader.d.ts.map +1 -0
- package/dist/engine/diff_loader.js +63 -0
- package/dist/engine/impact_engine.d.ts +72 -0
- package/dist/engine/impact_engine.d.ts.map +1 -0
- package/dist/engine/impact_engine.js +298 -0
- package/dist/engine/plan_builder.d.ts +11 -0
- package/dist/engine/plan_builder.d.ts.map +1 -0
- package/dist/engine/plan_builder.js +599 -0
- package/dist/esm/adapters/cypress.js +49 -0
- package/dist/esm/adapters/framework_adapter.js +114 -0
- package/dist/esm/adapters/playwright.js +49 -0
- package/dist/esm/adapters/pytest.js +59 -0
- package/dist/esm/adapters/supertest.js +48 -0
- package/dist/esm/agent/api_catalog.js +199 -0
- package/dist/esm/agent/config.js +872 -0
- package/dist/esm/agent/feedback.js +317 -0
- package/dist/esm/agent/git.js +252 -0
- package/dist/esm/agent/handoff.js +177 -0
- package/dist/esm/agent/llm_agents_flow.js +421 -0
- package/dist/esm/agent/native_flow.js +175 -0
- package/dist/esm/agent/pipeline.js +256 -0
- package/dist/esm/agent/pipeline_types.js +3 -0
- package/dist/esm/agent/pipeline_utils.js +146 -0
- package/dist/esm/agent/plan.js +83 -0
- package/dist/esm/agent/playwright_report.js +123 -0
- package/dist/esm/agent/process_runner.js +83 -0
- package/dist/esm/agent/spec_generator.js +249 -0
- package/dist/esm/agent/test_path.js +20 -0
- package/dist/esm/agent/traceability_capture.js +310 -0
- package/dist/esm/agent/traceability_ingest.js +234 -0
- package/dist/esm/agent/types.js +3 -0
- package/dist/esm/agent/utils.js +138 -0
- package/dist/esm/agent/validation_runner.js +73 -0
- package/dist/esm/agentic/fix_loop.js +91 -0
- package/dist/esm/agentic/playwright_runner.js +161 -0
- package/dist/esm/agentic/runner.js +207 -0
- package/dist/esm/agentic/types.js +3 -0
- package/dist/esm/agents/coverage-evaluator.js +37 -0
- package/dist/esm/agents/cross-impact.js +136 -0
- package/dist/esm/agents/executor.js +71 -0
- package/dist/esm/agents/explorer.js +39 -0
- package/dist/esm/agents/generator.js +73 -0
- package/dist/esm/agents/healer.js +27 -0
- package/dist/esm/agents/impact-analyst.js +34 -0
- package/dist/esm/agents/regression-advisor.js +112 -0
- package/dist/esm/agents/strategist.js +88 -0
- package/dist/esm/agents/test-designer.js +107 -0
- package/dist/esm/anthropic_provider.js +326 -0
- package/dist/esm/api.js +143 -0
- package/dist/esm/base_provider.js +198 -0
- package/dist/esm/budget_ledger.js +58 -0
- package/dist/esm/cache/cached_provider.js +85 -0
- package/dist/esm/cache/response_cache.js +140 -0
- package/dist/esm/cli/commands/analyze.js +74 -0
- package/dist/esm/cli/commands/bootstrap.js +106 -0
- package/dist/esm/cli/commands/cost_report.js +112 -0
- package/dist/esm/cli/commands/crew.js +252 -0
- package/dist/esm/cli/commands/feedback.js +36 -0
- package/dist/esm/cli/commands/finalize.js +38 -0
- package/dist/esm/cli/commands/gate.js +86 -0
- package/dist/esm/cli/commands/generate.js +105 -0
- package/dist/esm/cli/commands/heal.js +57 -0
- package/dist/esm/cli/commands/impact.js +30 -0
- package/dist/esm/cli/commands/init.js +133 -0
- package/dist/esm/cli/commands/llm_health.js +19 -0
- package/dist/esm/cli/commands/plan.js +117 -0
- package/dist/esm/cli/commands/plan_crew.js +309 -0
- package/dist/esm/cli/commands/traceability.js +73 -0
- package/dist/esm/cli/commands/train.js +355 -0
- package/dist/esm/cli/defaults.js +165 -0
- package/dist/esm/cli/errors.js +52 -0
- package/dist/esm/cli/parse_args.js +251 -0
- package/dist/esm/cli/types.js +3 -0
- package/dist/esm/cli/usage.js +106 -0
- package/dist/esm/cli.js +192 -0
- package/dist/esm/crew/context.js +32 -0
- package/dist/esm/crew/orchestrator.js +325 -0
- package/dist/esm/crew/protocol.js +3 -0
- package/dist/esm/crew/provider.js +33 -0
- package/dist/esm/crew/sanitize.js +27 -0
- package/dist/esm/crew/types.js +3 -0
- package/dist/esm/crew/workflows.js +33 -0
- package/dist/esm/custom_provider.js +273 -0
- package/dist/esm/engine/ai_enrichment.js +264 -0
- package/dist/esm/engine/diff_loader.js +59 -0
- package/dist/esm/engine/impact_engine.js +291 -0
- package/dist/esm/engine/plan_builder.js +593 -0
- package/dist/esm/index.js +72 -0
- package/dist/esm/knowledge/api_surface.js +408 -0
- package/dist/esm/knowledge/cluster_utils.js +60 -0
- package/dist/esm/knowledge/context_loader.js +85 -0
- package/dist/esm/knowledge/failure_history.js +121 -0
- package/dist/esm/knowledge/kg_bridge.js +381 -0
- package/dist/esm/knowledge/kg_types.js +3 -0
- package/dist/esm/knowledge/route_families.js +393 -0
- package/dist/esm/knowledge/spec_index.js +122 -0
- package/dist/esm/logger.js +115 -0
- package/dist/esm/mcp-server.js +621 -0
- package/dist/esm/metrics/prometheus.js +149 -0
- package/dist/esm/model_router.js +59 -0
- package/dist/esm/ollama_provider.js +301 -0
- package/dist/esm/openai_provider.js +243 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/pipeline/orchestrator.js +228 -0
- package/dist/esm/pipeline/spec_verifier.js +75 -0
- package/dist/esm/pipeline/stage0_preprocess.js +102 -0
- package/dist/esm/pipeline/stage1_impact.js +140 -0
- package/dist/esm/pipeline/stage2_coverage.js +153 -0
- package/dist/esm/pipeline/stage3_generation.js +284 -0
- package/dist/esm/pipeline/stage4_heal.js +288 -0
- package/dist/esm/progress.js +112 -0
- package/dist/esm/prompts/coverage.js +57 -0
- package/dist/esm/prompts/cross-impact.js +53 -0
- package/dist/esm/prompts/generation.js +297 -0
- package/dist/esm/prompts/generation_profile.js +147 -0
- package/dist/esm/prompts/heal.js +91 -0
- package/dist/esm/prompts/impact.js +63 -0
- package/dist/esm/prompts/json_extract.js +36 -0
- package/dist/esm/prompts/strategist.js +61 -0
- package/dist/esm/prompts/test-designer.js +92 -0
- package/dist/esm/provider_factory.js +366 -0
- package/dist/esm/provider_interface.js +23 -0
- package/dist/esm/provider_utils.js +96 -0
- package/dist/esm/qa-agent/cli.js +205 -0
- package/dist/esm/qa-agent/orchestrator.js +120 -0
- package/dist/esm/qa-agent/phase1/runner.js +139 -0
- package/dist/esm/qa-agent/phase1/scope.js +126 -0
- package/dist/esm/qa-agent/phase2/agent_browser.js +95 -0
- package/dist/esm/qa-agent/phase2/agent_loop.js +351 -0
- package/dist/esm/qa-agent/phase2/exploration_state.js +97 -0
- package/dist/esm/qa-agent/phase2/tools.js +386 -0
- package/dist/esm/qa-agent/phase2/vision.js +75 -0
- package/dist/esm/qa-agent/phase3/feedback.js +34 -0
- package/dist/esm/qa-agent/phase3/reporter.js +145 -0
- package/dist/esm/qa-agent/phase3/spec_generator.js +62 -0
- package/dist/esm/qa-agent/phase3/verdict.js +66 -0
- package/dist/esm/qa-agent/safe_env.js +23 -0
- package/dist/esm/qa-agent/types.js +3 -0
- package/dist/esm/reporters/junit.js +86 -0
- package/dist/esm/reporters/reporter.js +3 -0
- package/dist/esm/reporters/sarif.js +132 -0
- package/dist/esm/resilience/circuit_breaker.js +78 -0
- package/dist/esm/resilience/retry.js +56 -0
- package/dist/esm/sanitize.js +66 -0
- package/dist/esm/training/enricher.js +345 -0
- package/dist/esm/training/kg_scanner.js +115 -0
- package/dist/esm/training/merger.js +204 -0
- package/dist/esm/training/scanner.js +923 -0
- package/dist/esm/training/types.js +6 -0
- package/dist/esm/training/validator.js +254 -0
- package/dist/esm/validation/guardrails.js +101 -0
- package/dist/esm/validation/output_schema.js +80 -0
- package/dist/esm/version.js +33 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +169 -0
- package/dist/knowledge/api_surface.d.ts +37 -0
- package/dist/knowledge/api_surface.d.ts.map +1 -0
- package/dist/knowledge/api_surface.js +418 -0
- package/dist/knowledge/cluster_utils.d.ts +28 -0
- package/dist/knowledge/cluster_utils.d.ts.map +1 -0
- package/dist/knowledge/cluster_utils.js +67 -0
- package/dist/knowledge/context_loader.d.ts +13 -0
- package/dist/knowledge/context_loader.d.ts.map +1 -0
- package/dist/knowledge/context_loader.js +90 -0
- package/dist/knowledge/failure_history.d.ts +39 -0
- package/dist/knowledge/failure_history.d.ts.map +1 -0
- package/dist/knowledge/failure_history.js +128 -0
- package/dist/knowledge/kg_bridge.d.ts +31 -0
- package/dist/knowledge/kg_bridge.d.ts.map +1 -0
- package/dist/knowledge/kg_bridge.js +388 -0
- package/dist/knowledge/kg_types.d.ts +75 -0
- package/dist/knowledge/kg_types.d.ts.map +1 -0
- package/dist/knowledge/kg_types.js +4 -0
- package/dist/knowledge/route_families.d.ts +98 -0
- package/dist/knowledge/route_families.d.ts.map +1 -0
- package/dist/knowledge/route_families.js +410 -0
- package/dist/knowledge/spec_index.d.ts +18 -0
- package/dist/knowledge/spec_index.d.ts.map +1 -0
- package/dist/knowledge/spec_index.js +128 -0
- package/dist/logger.d.ts +31 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +119 -0
- package/dist/mcp-server.d.ts +68 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +629 -0
- package/dist/metrics/prometheus.d.ts +37 -0
- package/dist/metrics/prometheus.d.ts.map +1 -0
- package/dist/metrics/prometheus.js +153 -0
- package/dist/model_router.d.ts +28 -0
- package/dist/model_router.d.ts.map +1 -0
- package/dist/model_router.js +63 -0
- package/dist/ollama_provider.d.ts +65 -0
- package/dist/ollama_provider.d.ts.map +1 -0
- package/dist/ollama_provider.js +309 -0
- package/dist/openai_provider.d.ts +23 -0
- package/dist/openai_provider.d.ts.map +1 -0
- package/dist/openai_provider.js +251 -0
- package/dist/pipeline/orchestrator.d.ts +33 -0
- package/dist/pipeline/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestrator.js +231 -0
- package/dist/pipeline/spec_verifier.d.ts +20 -0
- package/dist/pipeline/spec_verifier.d.ts.map +1 -0
- package/dist/pipeline/spec_verifier.js +79 -0
- package/dist/pipeline/stage0_preprocess.d.ts +31 -0
- package/dist/pipeline/stage0_preprocess.d.ts.map +1 -0
- package/dist/pipeline/stage0_preprocess.js +105 -0
- package/dist/pipeline/stage1_impact.d.ts +19 -0
- package/dist/pipeline/stage1_impact.d.ts.map +1 -0
- package/dist/pipeline/stage1_impact.js +143 -0
- package/dist/pipeline/stage2_coverage.d.ts +19 -0
- package/dist/pipeline/stage2_coverage.d.ts.map +1 -0
- package/dist/pipeline/stage2_coverage.js +156 -0
- package/dist/pipeline/stage3_generation.d.ts +43 -0
- package/dist/pipeline/stage3_generation.d.ts.map +1 -0
- package/dist/pipeline/stage3_generation.js +287 -0
- package/dist/pipeline/stage4_heal.d.ts +62 -0
- package/dist/pipeline/stage4_heal.d.ts.map +1 -0
- package/dist/pipeline/stage4_heal.js +294 -0
- package/dist/progress.d.ts +22 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +116 -0
- package/dist/prompts/coverage.d.ts +39 -0
- package/dist/prompts/coverage.d.ts.map +1 -0
- package/dist/prompts/coverage.js +61 -0
- package/dist/prompts/cross-impact.d.ts +23 -0
- package/dist/prompts/cross-impact.d.ts.map +1 -0
- package/dist/prompts/cross-impact.js +57 -0
- package/dist/prompts/generation.d.ts +25 -0
- package/dist/prompts/generation.d.ts.map +1 -0
- package/dist/prompts/generation.js +302 -0
- package/dist/prompts/generation_profile.d.ts +29 -0
- package/dist/prompts/generation_profile.d.ts.map +1 -0
- package/dist/prompts/generation_profile.js +151 -0
- package/dist/prompts/heal.d.ts +23 -0
- package/dist/prompts/heal.d.ts.map +1 -0
- package/dist/prompts/heal.js +95 -0
- package/dist/prompts/impact.d.ts +31 -0
- package/dist/prompts/impact.d.ts.map +1 -0
- package/dist/prompts/impact.js +67 -0
- package/dist/prompts/json_extract.d.ts +14 -0
- package/dist/prompts/json_extract.d.ts.map +1 -0
- package/dist/prompts/json_extract.js +39 -0
- package/dist/prompts/strategist.d.ts +25 -0
- package/dist/prompts/strategist.d.ts.map +1 -0
- package/dist/prompts/strategist.js +65 -0
- package/dist/prompts/test-designer.d.ts +35 -0
- package/dist/prompts/test-designer.d.ts.map +1 -0
- package/dist/prompts/test-designer.js +96 -0
- package/dist/provider_factory.d.ts +104 -0
- package/dist/provider_factory.d.ts.map +1 -0
- package/dist/provider_factory.js +371 -0
- package/dist/provider_interface.d.ts +365 -0
- package/dist/provider_interface.d.ts.map +1 -0
- package/dist/provider_interface.js +28 -0
- package/dist/provider_utils.d.ts +39 -0
- package/dist/provider_utils.d.ts.map +1 -0
- package/dist/provider_utils.js +103 -0
- package/dist/qa-agent/cli.d.ts +3 -0
- package/dist/qa-agent/cli.d.ts.map +1 -0
- package/dist/qa-agent/cli.js +207 -0
- package/dist/qa-agent/orchestrator.d.ts +3 -0
- package/dist/qa-agent/orchestrator.d.ts.map +1 -0
- package/dist/qa-agent/orchestrator.js +123 -0
- package/dist/qa-agent/phase1/runner.d.ts +3 -0
- package/dist/qa-agent/phase1/runner.d.ts.map +1 -0
- package/dist/qa-agent/phase1/runner.js +142 -0
- package/dist/qa-agent/phase1/scope.d.ts +6 -0
- package/dist/qa-agent/phase1/scope.d.ts.map +1 -0
- package/dist/qa-agent/phase1/scope.js +129 -0
- package/dist/qa-agent/phase2/agent_browser.d.ts +35 -0
- package/dist/qa-agent/phase2/agent_browser.d.ts.map +1 -0
- package/dist/qa-agent/phase2/agent_browser.js +99 -0
- package/dist/qa-agent/phase2/agent_loop.d.ts +3 -0
- package/dist/qa-agent/phase2/agent_loop.d.ts.map +1 -0
- package/dist/qa-agent/phase2/agent_loop.js +357 -0
- package/dist/qa-agent/phase2/exploration_state.d.ts +12 -0
- package/dist/qa-agent/phase2/exploration_state.d.ts.map +1 -0
- package/dist/qa-agent/phase2/exploration_state.js +109 -0
- package/dist/qa-agent/phase2/tools.d.ts +28 -0
- package/dist/qa-agent/phase2/tools.d.ts.map +1 -0
- package/dist/qa-agent/phase2/tools.js +390 -0
- package/dist/qa-agent/phase2/vision.d.ts +3 -0
- package/dist/qa-agent/phase2/vision.d.ts.map +1 -0
- package/dist/qa-agent/phase2/vision.js +78 -0
- package/dist/qa-agent/phase3/feedback.d.ts +3 -0
- package/dist/qa-agent/phase3/feedback.d.ts.map +1 -0
- package/dist/qa-agent/phase3/feedback.js +37 -0
- package/dist/qa-agent/phase3/reporter.d.ts +3 -0
- package/dist/qa-agent/phase3/reporter.d.ts.map +1 -0
- package/dist/qa-agent/phase3/reporter.js +148 -0
- package/dist/qa-agent/phase3/spec_generator.d.ts +3 -0
- package/dist/qa-agent/phase3/spec_generator.d.ts.map +1 -0
- package/dist/qa-agent/phase3/spec_generator.js +65 -0
- package/dist/qa-agent/phase3/verdict.d.ts +3 -0
- package/dist/qa-agent/phase3/verdict.d.ts.map +1 -0
- package/dist/qa-agent/phase3/verdict.js +69 -0
- package/dist/qa-agent/safe_env.d.ts +3 -0
- package/dist/qa-agent/safe_env.d.ts.map +1 -0
- package/dist/qa-agent/safe_env.js +26 -0
- package/dist/qa-agent/types.d.ts +130 -0
- package/dist/qa-agent/types.d.ts.map +1 -0
- package/dist/qa-agent/types.js +4 -0
- package/dist/reporters/junit.d.ts +6 -0
- package/dist/reporters/junit.d.ts.map +1 -0
- package/dist/reporters/junit.js +89 -0
- package/dist/reporters/reporter.d.ts +42 -0
- package/dist/reporters/reporter.d.ts.map +1 -0
- package/dist/reporters/reporter.js +4 -0
- package/dist/reporters/sarif.d.ts +7 -0
- package/dist/reporters/sarif.d.ts.map +1 -0
- package/dist/reporters/sarif.js +135 -0
- package/dist/resilience/circuit_breaker.d.ts +36 -0
- package/dist/resilience/circuit_breaker.d.ts.map +1 -0
- package/dist/resilience/circuit_breaker.js +82 -0
- package/dist/resilience/retry.d.ts +11 -0
- package/dist/resilience/retry.d.ts.map +1 -0
- package/dist/resilience/retry.js +59 -0
- package/dist/sanitize.d.ts +15 -0
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/sanitize.js +71 -0
- package/dist/training/enricher.d.ts +17 -0
- package/dist/training/enricher.d.ts.map +1 -0
- package/dist/training/enricher.js +350 -0
- package/dist/training/kg_scanner.d.ts +13 -0
- package/dist/training/kg_scanner.d.ts.map +1 -0
- package/dist/training/kg_scanner.js +118 -0
- package/dist/training/merger.d.ts +15 -0
- package/dist/training/merger.d.ts.map +1 -0
- package/dist/training/merger.js +208 -0
- package/dist/training/scanner.d.ts +36 -0
- package/dist/training/scanner.d.ts.map +1 -0
- package/dist/training/scanner.js +932 -0
- package/dist/training/types.d.ts +117 -0
- package/dist/training/types.d.ts.map +1 -0
- package/dist/training/types.js +9 -0
- package/dist/training/validator.d.ts +21 -0
- package/dist/training/validator.d.ts.map +1 -0
- package/dist/training/validator.js +262 -0
- package/dist/validation/guardrails.d.ts +31 -0
- package/dist/validation/guardrails.d.ts.map +1 -0
- package/dist/validation/guardrails.js +112 -0
- package/dist/validation/output_schema.d.ts +67 -0
- package/dist/validation/output_schema.d.ts.map +1 -0
- package/dist/validation/output_schema.js +84 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +36 -0
- package/package.json +126 -0
- package/schemas/flow-decision.schema.json +83 -0
- package/schemas/gap.schema.json +18 -0
- package/schemas/impact.schema.json +455 -0
- package/schemas/plan.schema.json +491 -0
- package/schemas/route-families.schema.json +137 -0
- package/schemas/subsystem-risk-map.schema.json +62 -0
- package/schemas/traceability-input.schema.json +122 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
+
// See LICENSE.txt for license information.
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
import { normalizePath } from './utils.js';
|
|
6
|
+
function asRecord(value) {
|
|
7
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
function asArray(value) {
|
|
13
|
+
return Array.isArray(value) ? value : [];
|
|
14
|
+
}
|
|
15
|
+
function isFailureStatus(value) {
|
|
16
|
+
return value === 'failed' || value === 'timedOut' || value === 'interrupted';
|
|
17
|
+
}
|
|
18
|
+
function classifyTestInstability(testNode) {
|
|
19
|
+
const outcome = typeof testNode.outcome === 'string' ? testNode.outcome : '';
|
|
20
|
+
if (outcome === 'unexpected') {
|
|
21
|
+
return 'failed';
|
|
22
|
+
}
|
|
23
|
+
if (outcome === 'flaky') {
|
|
24
|
+
return 'flaky';
|
|
25
|
+
}
|
|
26
|
+
const status = typeof testNode.status === 'string' ? testNode.status : '';
|
|
27
|
+
if (status === 'flaky') {
|
|
28
|
+
return 'flaky';
|
|
29
|
+
}
|
|
30
|
+
if (isFailureStatus(status)) {
|
|
31
|
+
return 'failed';
|
|
32
|
+
}
|
|
33
|
+
let sawFailure = false;
|
|
34
|
+
let sawPass = false;
|
|
35
|
+
for (const resultValue of asArray(testNode.results)) {
|
|
36
|
+
const resultNode = asRecord(resultValue);
|
|
37
|
+
if (!resultNode) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const resultStatus = typeof resultNode.status === 'string' ? resultNode.status : '';
|
|
41
|
+
if (isFailureStatus(resultStatus)) {
|
|
42
|
+
sawFailure = true;
|
|
43
|
+
}
|
|
44
|
+
else if (resultStatus === 'passed') {
|
|
45
|
+
sawPass = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (sawFailure && sawPass) {
|
|
49
|
+
return 'flaky';
|
|
50
|
+
}
|
|
51
|
+
if (sawFailure) {
|
|
52
|
+
return 'failed';
|
|
53
|
+
}
|
|
54
|
+
return 'stable';
|
|
55
|
+
}
|
|
56
|
+
function relativize(pathValue, roots) {
|
|
57
|
+
const normalized = normalizePath(pathValue);
|
|
58
|
+
for (const root of roots) {
|
|
59
|
+
const normalizedRoot = normalizePath(resolve(root));
|
|
60
|
+
if (normalized === normalizedRoot) {
|
|
61
|
+
return '.';
|
|
62
|
+
}
|
|
63
|
+
if (normalized.startsWith(`${normalizedRoot}/`)) {
|
|
64
|
+
return normalized.slice(normalizedRoot.length + 1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return normalized;
|
|
68
|
+
}
|
|
69
|
+
function collectUnstableSpecs(value, roots, unstableMap) {
|
|
70
|
+
const node = asRecord(value);
|
|
71
|
+
if (!node) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
for (const specValue of asArray(node.specs)) {
|
|
75
|
+
const specNode = asRecord(specValue);
|
|
76
|
+
if (!specNode || typeof specNode.file !== 'string') {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
let failingTests = 0;
|
|
80
|
+
let flakyTests = 0;
|
|
81
|
+
for (const testValue of asArray(specNode.tests)) {
|
|
82
|
+
const testNode = asRecord(testValue);
|
|
83
|
+
if (!testNode) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const instability = classifyTestInstability(testNode);
|
|
87
|
+
if (instability === 'failed') {
|
|
88
|
+
failingTests += 1;
|
|
89
|
+
}
|
|
90
|
+
else if (instability === 'flaky') {
|
|
91
|
+
flakyTests += 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (failingTests === 0 && flakyTests === 0) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const specPath = relativize(specNode.file, roots);
|
|
98
|
+
const existing = unstableMap.get(specPath);
|
|
99
|
+
const mergedFailing = (existing?.failingTests || 0) + failingTests;
|
|
100
|
+
const mergedFlaky = (existing?.flakyTests || 0) + flakyTests;
|
|
101
|
+
unstableMap.set(specPath, {
|
|
102
|
+
specPath,
|
|
103
|
+
status: mergedFailing > 0 ? 'failed' : 'flaky',
|
|
104
|
+
failingTests: mergedFailing,
|
|
105
|
+
flakyTests: mergedFlaky,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
for (const suite of asArray(node.suites)) {
|
|
109
|
+
collectUnstableSpecs(suite, roots, unstableMap);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export function extractPlaywrightUnstableSpecs(reportPath, roots) {
|
|
113
|
+
const fullPath = resolve(reportPath);
|
|
114
|
+
const raw = JSON.parse(readFileSync(fullPath, 'utf-8'));
|
|
115
|
+
const unstableMap = new Map();
|
|
116
|
+
collectUnstableSpecs(raw, roots, unstableMap);
|
|
117
|
+
return Array.from(unstableMap.values()).sort((a, b) => {
|
|
118
|
+
if (a.status !== b.status) {
|
|
119
|
+
return a.status === 'failed' ? -1 : 1;
|
|
120
|
+
}
|
|
121
|
+
return a.specPath.localeCompare(b.specPath);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
+
// See LICENSE.txt for license information.
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { spawnSync } from 'child_process';
|
|
6
|
+
export function resolvePlaywrightBinary(testsRoot) {
|
|
7
|
+
const unixPath = join(testsRoot, 'node_modules', '.bin', 'playwright');
|
|
8
|
+
const windowsPath = join(testsRoot, 'node_modules', '.bin', 'playwright.cmd');
|
|
9
|
+
if (existsSync(unixPath)) {
|
|
10
|
+
return unixPath;
|
|
11
|
+
}
|
|
12
|
+
if (existsSync(windowsPath)) {
|
|
13
|
+
return windowsPath;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
export function summarizeCommandOutput(stdout, stderr) {
|
|
18
|
+
const combined = [stdout, stderr].filter(Boolean).join('\n').trim();
|
|
19
|
+
if (!combined) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
const lines = combined.split('\n').slice(-20);
|
|
23
|
+
return lines.join('\n').slice(0, 2000);
|
|
24
|
+
}
|
|
25
|
+
export function runCommand(command, args, cwd, timeoutMs = 60 * 60 * 1000, envOverride) {
|
|
26
|
+
// When spawning `claude`, unset CLAUDECODE so nested invocations are allowed.
|
|
27
|
+
// Claude Code sets this variable to block nested sessions; child processes
|
|
28
|
+
// that spawn their own claude instance must run without it.
|
|
29
|
+
let env = envOverride;
|
|
30
|
+
if (!env && command === 'claude') {
|
|
31
|
+
const { CLAUDECODE: _, ...rest } = process.env;
|
|
32
|
+
env = rest;
|
|
33
|
+
}
|
|
34
|
+
const result = spawnSync(command, args, {
|
|
35
|
+
cwd,
|
|
36
|
+
encoding: 'utf-8',
|
|
37
|
+
timeout: timeoutMs,
|
|
38
|
+
stdio: 'pipe',
|
|
39
|
+
...(env ? { env } : {}),
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
status: result.status ?? 1,
|
|
43
|
+
stdout: result.stdout || '',
|
|
44
|
+
stderr: result.stderr || '',
|
|
45
|
+
error: result.error ? result.error.message : undefined,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function resolveMcpCommandTimeoutMs(pipeline) {
|
|
49
|
+
const value = pipeline.mcpCommandTimeoutMs;
|
|
50
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
51
|
+
return 180000;
|
|
52
|
+
}
|
|
53
|
+
return Math.max(60000, Math.min(15 * 60 * 1000, Math.round(value)));
|
|
54
|
+
}
|
|
55
|
+
export function resolveMcpRetries(pipeline) {
|
|
56
|
+
const value = pipeline.mcpRetries;
|
|
57
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
return Math.max(0, Math.min(5, Math.round(value)));
|
|
61
|
+
}
|
|
62
|
+
export function isRetryableMcpFailure(result) {
|
|
63
|
+
const haystack = [result.error || '', result.stderr || '', result.stdout || ''].join('\n').toLowerCase();
|
|
64
|
+
return haystack.includes('etimedout') ||
|
|
65
|
+
haystack.includes('timed out') ||
|
|
66
|
+
haystack.includes('econnreset') ||
|
|
67
|
+
haystack.includes('429') ||
|
|
68
|
+
haystack.includes('rate limit') ||
|
|
69
|
+
haystack.includes('temporar');
|
|
70
|
+
}
|
|
71
|
+
export function runCommandWithRetries(command, args, cwd, timeoutMs, retries) {
|
|
72
|
+
let result = runCommand(command, args, cwd, timeoutMs);
|
|
73
|
+
for (let attempt = 1; attempt <= retries; attempt += 1) {
|
|
74
|
+
if (result.status === 0) {
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
if (!isRetryableMcpFailure(result)) {
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
result = runCommand(command, args, cwd, timeoutMs);
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
+
// See LICENSE.txt for license information.
|
|
3
|
+
import { collectMatches, escapeRegExp, parseInitSetupBindings } from './api_catalog.js';
|
|
4
|
+
import { firstFlowFiles } from './pipeline_utils.js';
|
|
5
|
+
export function validateGeneratedSpecContent(content, apiSurface) {
|
|
6
|
+
const issues = [];
|
|
7
|
+
if (/\btest\.describe\s*\(/.test(content)) {
|
|
8
|
+
issues.push({
|
|
9
|
+
code: 'disallowed-describe',
|
|
10
|
+
message: 'Generated tests must not use test.describe.',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
if (/\btest\.only\s*\(/.test(content)) {
|
|
14
|
+
issues.push({
|
|
15
|
+
code: 'disallowed-only',
|
|
16
|
+
message: 'Generated tests must not use test.only.',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (!/\btest\s*\(/.test(content)) {
|
|
20
|
+
issues.push({
|
|
21
|
+
code: 'missing-test',
|
|
22
|
+
message: 'Generated file does not include a test() declaration.',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (/\btag\s*:\s*\[/.test(content)) {
|
|
26
|
+
issues.push({
|
|
27
|
+
code: 'tag-array-disallowed',
|
|
28
|
+
message: 'Generated tests must use a single tag string, not a tag array.',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const hasTagOption = /\btag\s*:\s*['"][^'"]+['"]/.test(content);
|
|
32
|
+
const hasTagInTitle = /\btest(?:\.\w+)?\s*\(\s*['"][^'"]*@ai-assisted[^'"]*['"]/.test(content);
|
|
33
|
+
if (!(hasTagOption || hasTagInTitle) || !/@ai-assisted/.test(content)) {
|
|
34
|
+
issues.push({
|
|
35
|
+
code: 'missing-tag',
|
|
36
|
+
message: "Generated tests must include '@ai-assisted' either as tag option or in test title.",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (/\bsystemConsolePage\.toBeVisible\s*\(/.test(content)) {
|
|
40
|
+
issues.push({
|
|
41
|
+
code: 'fragile-system-console-visibility',
|
|
42
|
+
message: 'Avoid systemConsolePage.toBeVisible(); it relies on legacy backstage navigation that may be absent.',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const fragileSelectors = [
|
|
46
|
+
'.backstage-navbar',
|
|
47
|
+
'.admin-console__wrapper',
|
|
48
|
+
'.left-panel',
|
|
49
|
+
'.panel-card',
|
|
50
|
+
].filter((selector) => content.includes(selector));
|
|
51
|
+
if (fragileSelectors.length > 0) {
|
|
52
|
+
issues.push({
|
|
53
|
+
code: 'fragile-selector',
|
|
54
|
+
message: `Avoid brittle class selectors in generated tests: ${Array.from(new Set(fragileSelectors)).join(', ')}`,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (apiSurface) {
|
|
58
|
+
const unknownPwProps = Array.from(collectMatches(content, /\bpw\.([A-Za-z_][A-Za-z0-9_]*)\b/g)).filter((prop) => !apiSurface.pwProps.has(prop));
|
|
59
|
+
const unknownBrowserMethods = Array.from(collectMatches(content, /\bpw\.testBrowser\.([A-Za-z_][A-Za-z0-9_]*)\b/g)).filter((method) => !apiSurface.testBrowserMethods.has(method));
|
|
60
|
+
const unknownNestedPwMembers = [];
|
|
61
|
+
for (const match of content.matchAll(/\bpw\.([A-Za-z_][A-Za-z0-9_]*)\.([A-Za-z_][A-Za-z0-9_]*)\b/g)) {
|
|
62
|
+
const objectName = match[1];
|
|
63
|
+
const methodName = match[2];
|
|
64
|
+
if (!objectName || !methodName || objectName === 'testBrowser') {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const knownMethods = apiSurface.pwNestedMethods.get(objectName);
|
|
68
|
+
if (!knownMethods || !knownMethods.has(methodName)) {
|
|
69
|
+
unknownNestedPwMembers.push(`pw.${objectName}.${methodName}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const unknownChannelMembers = Array.from(collectMatches(content, /\bchannelsPage\.([A-Za-z_][A-Za-z0-9_]*)\b/g)).filter((member) => !apiSurface.channelsPageMembers.has(member));
|
|
73
|
+
const unknownSidebarMembers = Array.from(collectMatches(content, /\bchannelsPage\.sidebarRight\.([A-Za-z_][A-Za-z0-9_]*)\b/g)).filter((member) => !apiSurface.sidebarRightMembers.has(member));
|
|
74
|
+
const initSetupBindings = parseInitSetupBindings(content);
|
|
75
|
+
const unknownInitSetupKeys = initSetupBindings
|
|
76
|
+
.map((binding) => binding.key)
|
|
77
|
+
.filter((key) => !apiSurface.initSetupKeys.has(key));
|
|
78
|
+
const unknownInitSetupVariableMethods = [];
|
|
79
|
+
for (const binding of initSetupBindings) {
|
|
80
|
+
const knownMethods = apiSurface.initSetupVariableMethods.get(binding.variable);
|
|
81
|
+
if (!knownMethods || knownMethods.size === 0) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const methodPattern = new RegExp(`\\b${escapeRegExp(binding.variable)}\\.([A-Za-z_][A-Za-z0-9_]*)\\b`, 'g');
|
|
85
|
+
for (const method of collectMatches(content, methodPattern)) {
|
|
86
|
+
if (!knownMethods.has(method)) {
|
|
87
|
+
unknownInitSetupVariableMethods.push(`${binding.variable}.${method}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const unknown = [
|
|
92
|
+
...unknownPwProps.map((value) => `pw.${value}`),
|
|
93
|
+
...unknownBrowserMethods.map((value) => `pw.testBrowser.${value}`),
|
|
94
|
+
...unknownNestedPwMembers,
|
|
95
|
+
...unknownChannelMembers.map((value) => `channelsPage.${value}`),
|
|
96
|
+
...unknownSidebarMembers.map((value) => `channelsPage.sidebarRight.${value}`),
|
|
97
|
+
...unknownInitSetupKeys.map((value) => `pw.initSetup.{${value}}`),
|
|
98
|
+
...unknownInitSetupVariableMethods,
|
|
99
|
+
];
|
|
100
|
+
if (unknown.length > 0) {
|
|
101
|
+
issues.push({
|
|
102
|
+
code: 'unknown-api-surface',
|
|
103
|
+
message: `Generated test uses unknown API/page-object members: ${Array.from(new Set(unknown)).join(', ')}`,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return issues;
|
|
108
|
+
}
|
|
109
|
+
export function createNativePlaywrightSpec(flow, slug, strategy) {
|
|
110
|
+
const linkedFiles = firstFlowFiles(flow).join(', ') || 'N/A';
|
|
111
|
+
const header = [
|
|
112
|
+
"import {test, expect} from '@mattermost/playwright-lib';",
|
|
113
|
+
'',
|
|
114
|
+
'/**',
|
|
115
|
+
` * Auto-generated by @yasserkhanorg/impact-gate`,
|
|
116
|
+
` * Flow: ${flow.id} (${flow.name})`,
|
|
117
|
+
` * Strategy: ${strategy}`,
|
|
118
|
+
` * Linked files: ${linkedFiles}`,
|
|
119
|
+
' */',
|
|
120
|
+
];
|
|
121
|
+
const start = [
|
|
122
|
+
`test('${flow.priority}: ${flow.name} generated coverage', {tag: '@ai-assisted'}, async ({pw}) => {`,
|
|
123
|
+
' const {user, team} = await pw.initSetup();',
|
|
124
|
+
' const {channelsPage} = await pw.testBrowser.login(user);',
|
|
125
|
+
' await channelsPage.goto(team.name);',
|
|
126
|
+
];
|
|
127
|
+
const end = [
|
|
128
|
+
'});',
|
|
129
|
+
'',
|
|
130
|
+
];
|
|
131
|
+
if (strategy === 'thread-reply') {
|
|
132
|
+
return [
|
|
133
|
+
...header,
|
|
134
|
+
...start,
|
|
135
|
+
` const parentMessage = \`ai-${slug}-parent-\${Date.now()}\`;`,
|
|
136
|
+
' await channelsPage.postMessage(parentMessage);',
|
|
137
|
+
' const rootPost = await channelsPage.getLastPost();',
|
|
138
|
+
' await rootPost.openAThread();',
|
|
139
|
+
` const replyMessage = \`ai-${slug}-reply-\${Date.now()}\`;`,
|
|
140
|
+
' await channelsPage.sidebarRight.postMessage(replyMessage);',
|
|
141
|
+
' const lastReply = await channelsPage.sidebarRight.getLastPost();',
|
|
142
|
+
' await expect(lastReply.container).toContainText(replyMessage);',
|
|
143
|
+
...end,
|
|
144
|
+
].join('\n');
|
|
145
|
+
}
|
|
146
|
+
if (strategy === 'lifecycle-channel') {
|
|
147
|
+
return [
|
|
148
|
+
...header,
|
|
149
|
+
...start,
|
|
150
|
+
` const channelName = \`ai-${slug}-\${Date.now().toString().slice(-6)}\`;`,
|
|
151
|
+
" await channelsPage.newChannel(channelName, 'O');",
|
|
152
|
+
' await expect(channelsPage.page).toHaveURL(new RegExp(`/channels/${channelName}$`));',
|
|
153
|
+
...end,
|
|
154
|
+
].join('\n');
|
|
155
|
+
}
|
|
156
|
+
if (strategy === 'channel-settings') {
|
|
157
|
+
return [
|
|
158
|
+
...header,
|
|
159
|
+
...start,
|
|
160
|
+
' await channelsPage.openChannelSettings();',
|
|
161
|
+
" await expect(channelsPage.page.getByRole('dialog', {name: 'Channel Settings'})).toBeVisible();",
|
|
162
|
+
" await channelsPage.page.keyboard.press('Escape');",
|
|
163
|
+
...end,
|
|
164
|
+
].join('\n');
|
|
165
|
+
}
|
|
166
|
+
if (strategy === 'channel-switch') {
|
|
167
|
+
return [
|
|
168
|
+
...header,
|
|
169
|
+
...start,
|
|
170
|
+
" await channelsPage.goto(team.name, 'off-topic');",
|
|
171
|
+
" await expect(channelsPage.page).toHaveURL(/\\/channels\\/off-topic$/);",
|
|
172
|
+
" await expect(channelsPage.page.locator('#channelHeaderTitle')).toContainText(/off-topic/i);",
|
|
173
|
+
...end,
|
|
174
|
+
].join('\n');
|
|
175
|
+
}
|
|
176
|
+
if (strategy === 'markdown-post') {
|
|
177
|
+
return [
|
|
178
|
+
...header,
|
|
179
|
+
...start,
|
|
180
|
+
` const message = '**ai-${slug}-bold** _italic_';`,
|
|
181
|
+
' await channelsPage.postMessage(message);',
|
|
182
|
+
' const lastPost = await channelsPage.getLastPost();',
|
|
183
|
+
" await expect(lastPost.container.locator('strong')).toBeVisible();",
|
|
184
|
+
...end,
|
|
185
|
+
].join('\n');
|
|
186
|
+
}
|
|
187
|
+
if (strategy === 'mentions-post') {
|
|
188
|
+
return [
|
|
189
|
+
...header,
|
|
190
|
+
...start,
|
|
191
|
+
' const mention = `@${user.username}`;',
|
|
192
|
+
' await channelsPage.postMessage(`Ping ${mention}`);',
|
|
193
|
+
' const lastPost = await channelsPage.getLastPost();',
|
|
194
|
+
' await expect(lastPost.container).toContainText(mention);',
|
|
195
|
+
...end,
|
|
196
|
+
].join('\n');
|
|
197
|
+
}
|
|
198
|
+
if (strategy === 'realtime-post') {
|
|
199
|
+
return [
|
|
200
|
+
...header,
|
|
201
|
+
...start,
|
|
202
|
+
` const message = \`ai-${slug}-realtime-\${Date.now()}\`;`,
|
|
203
|
+
' await channelsPage.postMessage(message);',
|
|
204
|
+
' const lastPost = await channelsPage.getLastPost();',
|
|
205
|
+
' await expect(lastPost.container).toContainText(message);',
|
|
206
|
+
" await expect(channelsPage.page.locator('#channel_view')).toBeVisible();",
|
|
207
|
+
...end,
|
|
208
|
+
].join('\n');
|
|
209
|
+
}
|
|
210
|
+
if (strategy === 'message-post') {
|
|
211
|
+
return [
|
|
212
|
+
...header,
|
|
213
|
+
...start,
|
|
214
|
+
` const message = \`ai-${slug}-message-\${Date.now()}\`;`,
|
|
215
|
+
' await channelsPage.postMessage(message);',
|
|
216
|
+
' await expect(channelsPage.getLastPost()).toContainText(message);',
|
|
217
|
+
...end,
|
|
218
|
+
].join('\n');
|
|
219
|
+
}
|
|
220
|
+
if (strategy === 'channel-baseline') {
|
|
221
|
+
return [
|
|
222
|
+
...header,
|
|
223
|
+
...start,
|
|
224
|
+
" await expect(channelsPage.page.locator('#channelHeaderTitle')).toBeVisible();",
|
|
225
|
+
" await expect(channelsPage.page.locator('#SidebarContainer')).toBeVisible();",
|
|
226
|
+
...end,
|
|
227
|
+
].join('\n');
|
|
228
|
+
}
|
|
229
|
+
if (strategy === 'search-baseline') {
|
|
230
|
+
return [
|
|
231
|
+
...header,
|
|
232
|
+
...start,
|
|
233
|
+
` const searchTerm = \`ai-${slug}-\${Date.now().toString().slice(-6)}\`;`,
|
|
234
|
+
' await channelsPage.postMessage(searchTerm);',
|
|
235
|
+
' await channelsPage.globalHeader.openSearch();',
|
|
236
|
+
' await channelsPage.searchBox.searchInput.fill(searchTerm);',
|
|
237
|
+
" await channelsPage.page.keyboard.press('Enter');",
|
|
238
|
+
" await expect(channelsPage.page.locator('#searchContainer')).toBeVisible();",
|
|
239
|
+
...end,
|
|
240
|
+
].join('\n');
|
|
241
|
+
}
|
|
242
|
+
return [
|
|
243
|
+
...header,
|
|
244
|
+
...start,
|
|
245
|
+
' await expect(channelsPage.page).toHaveURL(/\\/channels\\//);',
|
|
246
|
+
" await expect(channelsPage.page.locator('#channelHeaderTitle')).toBeVisible();",
|
|
247
|
+
...end,
|
|
248
|
+
].join('\n');
|
|
249
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
+
// See LICENSE.txt for license information.
|
|
3
|
+
function normalizeTestName(test) {
|
|
4
|
+
return test.replace(/ \(flags:.*\)$/, '').trim();
|
|
5
|
+
}
|
|
6
|
+
export function inferSubsystemFromTestPath(test) {
|
|
7
|
+
const normalized = normalizeTestName(test).replace(/^\/+/, '');
|
|
8
|
+
const parts = normalized.split('/').filter(Boolean);
|
|
9
|
+
if (parts.length === 0) {
|
|
10
|
+
return 'unknown';
|
|
11
|
+
}
|
|
12
|
+
const specsIdx = parts.findIndex((part) => part === 'specs' || part === 'tests');
|
|
13
|
+
if (specsIdx >= 0 && specsIdx + 1 < parts.length) {
|
|
14
|
+
return parts[specsIdx + 1] || 'unknown';
|
|
15
|
+
}
|
|
16
|
+
if (parts.length >= 2 && (parts[0] === 'e2e-tests' || parts[0] === 'playwright')) {
|
|
17
|
+
return parts[1] || 'unknown';
|
|
18
|
+
}
|
|
19
|
+
return parts[0] || 'unknown';
|
|
20
|
+
}
|