@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,207 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
4
|
+
// See LICENSE.txt for license information.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const orchestrator_js_1 = require("./orchestrator.js");
|
|
8
|
+
const MODES = new Set(['pr', 'hunt', 'fix', 'release']);
|
|
9
|
+
const KNOWN_FLAGS = new Set([
|
|
10
|
+
'--base-url', '--since', '--phase', '--time', '--budget',
|
|
11
|
+
'--headed', '--tests-root', '--project', '--output', '--help', '-h',
|
|
12
|
+
]);
|
|
13
|
+
function printUsage() {
|
|
14
|
+
console.log(`
|
|
15
|
+
Usage: impact-gate-qa <mode> [options]
|
|
16
|
+
|
|
17
|
+
Modes:
|
|
18
|
+
pr Test changed features from a PR
|
|
19
|
+
hunt Deep-dive into a specific area
|
|
20
|
+
fix Verify healed tests and side effects
|
|
21
|
+
release Full regression + release readiness verdict
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
--base-url <url> Application URL (required)
|
|
25
|
+
--since <ref> Git ref for diff (default: origin/main)
|
|
26
|
+
--phase <1|2|3> Run only up to this phase
|
|
27
|
+
--time <minutes> Time limit (default: 15)
|
|
28
|
+
--budget <usd> LLM budget in USD (default: 2.00)
|
|
29
|
+
--headed Run browser in headed mode
|
|
30
|
+
--tests-root <path> Path to tests directory
|
|
31
|
+
--project <name> Playwright project name
|
|
32
|
+
--output <dir> Output directory (default: .e2e-ai-agents)
|
|
33
|
+
--help Show this help
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
impact-gate-qa pr --since origin/main --base-url http://localhost:8065
|
|
37
|
+
impact-gate-qa hunt "channel settings" --base-url http://localhost:8065
|
|
38
|
+
impact-gate-qa release --base-url http://localhost:8065 --time 30
|
|
39
|
+
impact-gate-qa fix --base-url http://localhost:8065
|
|
40
|
+
`);
|
|
41
|
+
}
|
|
42
|
+
function parseCliArgs(argv) {
|
|
43
|
+
if (argv.length === 0 || argv.includes('--help') || argv.includes('-h')) {
|
|
44
|
+
printUsage();
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const modeArg = argv[0];
|
|
48
|
+
if (!MODES.has(modeArg)) {
|
|
49
|
+
console.error(`Unknown mode: ${modeArg}`);
|
|
50
|
+
printUsage();
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const mode = modeArg;
|
|
54
|
+
let baseUrl = '';
|
|
55
|
+
let since;
|
|
56
|
+
let huntTarget;
|
|
57
|
+
let phase;
|
|
58
|
+
let timeLimitMinutes = mode === 'release' ? 30 : 15;
|
|
59
|
+
let budgetUSD = 2.0;
|
|
60
|
+
let headed = false;
|
|
61
|
+
let testsRoot;
|
|
62
|
+
let project;
|
|
63
|
+
let outputDir;
|
|
64
|
+
// For hunt mode, the second positional arg is the target
|
|
65
|
+
let startFlags = 1;
|
|
66
|
+
if (mode === 'hunt' && argv[1] && !argv[1].startsWith('--')) {
|
|
67
|
+
huntTarget = argv[1];
|
|
68
|
+
startFlags = 2;
|
|
69
|
+
}
|
|
70
|
+
for (let i = startFlags; i < argv.length; i++) {
|
|
71
|
+
const arg = argv[i];
|
|
72
|
+
const next = argv[i + 1];
|
|
73
|
+
switch (arg) {
|
|
74
|
+
case '--base-url':
|
|
75
|
+
baseUrl = next || '';
|
|
76
|
+
i++;
|
|
77
|
+
break;
|
|
78
|
+
case '--since':
|
|
79
|
+
since = next;
|
|
80
|
+
i++;
|
|
81
|
+
break;
|
|
82
|
+
case '--phase': {
|
|
83
|
+
const parsed = parseInt(next || '0', 10);
|
|
84
|
+
if (parsed !== 1 && parsed !== 2 && parsed !== 3) {
|
|
85
|
+
console.error(`Error: --phase must be 1, 2, or 3 (got "${next}")`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
phase = parsed;
|
|
89
|
+
i++;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case '--time': {
|
|
93
|
+
const parsed = parseInt(next || '15', 10);
|
|
94
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
95
|
+
console.error(`Error: --time must be a positive number (got "${next}")`);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
timeLimitMinutes = parsed;
|
|
99
|
+
i++;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
case '--budget': {
|
|
103
|
+
const parsed = parseFloat(next || '2.0');
|
|
104
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
105
|
+
console.error(`Error: --budget must be a positive number (got "${next}")`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
budgetUSD = parsed;
|
|
109
|
+
i++;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case '--headed':
|
|
113
|
+
headed = true;
|
|
114
|
+
break;
|
|
115
|
+
case '--tests-root':
|
|
116
|
+
testsRoot = next;
|
|
117
|
+
i++;
|
|
118
|
+
break;
|
|
119
|
+
case '--project':
|
|
120
|
+
project = next;
|
|
121
|
+
i++;
|
|
122
|
+
break;
|
|
123
|
+
case '--output':
|
|
124
|
+
outputDir = next;
|
|
125
|
+
i++;
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
if (arg.startsWith('--') && !KNOWN_FLAGS.has(arg)) {
|
|
129
|
+
console.error(`Warning: unknown flag "${arg}" (ignored)`);
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Validate --since and hunt target against flag injection (must not start with -)
|
|
135
|
+
if (since && since.startsWith('-')) {
|
|
136
|
+
console.error(`Error: --since value "${since}" looks like a flag, not a git ref`);
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
if (huntTarget && huntTarget.startsWith('-')) {
|
|
140
|
+
console.error(`Error: hunt target "${huntTarget}" looks like a flag`);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
if (!baseUrl) {
|
|
144
|
+
console.error('Error: --base-url is required');
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
// Validate baseUrl is a proper HTTP(S) URL
|
|
148
|
+
try {
|
|
149
|
+
const parsed = new URL(baseUrl);
|
|
150
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
151
|
+
console.error(`Error: --base-url must use http or https (got "${parsed.protocol}")`);
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
// Normalize: remove trailing slash
|
|
155
|
+
baseUrl = parsed.origin + parsed.pathname.replace(/\/+$/, '');
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
console.error(`Error: --base-url is not a valid URL ("${baseUrl}")`);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
// Validate --output stays within project directory
|
|
162
|
+
if (outputDir) {
|
|
163
|
+
const resolved = (0, path_1.resolve)(outputDir);
|
|
164
|
+
const cwd = process.cwd();
|
|
165
|
+
const normalizedCwd = cwd.endsWith(path_1.sep) ? cwd : cwd + path_1.sep;
|
|
166
|
+
if (resolved !== cwd && !resolved.startsWith(normalizedCwd)) {
|
|
167
|
+
console.error(`Error: --output "${outputDir}" resolves outside the project directory`);
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
mode,
|
|
173
|
+
baseUrl,
|
|
174
|
+
since: since || 'origin/main',
|
|
175
|
+
huntTarget,
|
|
176
|
+
phase,
|
|
177
|
+
timeLimitMinutes,
|
|
178
|
+
budgetUSD,
|
|
179
|
+
headed,
|
|
180
|
+
testsRoot,
|
|
181
|
+
project,
|
|
182
|
+
outputDir,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
async function main() {
|
|
186
|
+
const config = parseCliArgs(process.argv.slice(2));
|
|
187
|
+
if (!config) {
|
|
188
|
+
process.exit(0);
|
|
189
|
+
}
|
|
190
|
+
const report = await (0, orchestrator_js_1.runQAAgent)(config);
|
|
191
|
+
// Exit code based on verdict
|
|
192
|
+
switch (report.verdict.decision) {
|
|
193
|
+
case 'go':
|
|
194
|
+
process.exit(0);
|
|
195
|
+
break;
|
|
196
|
+
case 'conditional':
|
|
197
|
+
process.exit(1);
|
|
198
|
+
break;
|
|
199
|
+
case 'no-go':
|
|
200
|
+
process.exit(2);
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
main().catch((error) => {
|
|
205
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
206
|
+
process.exit(1);
|
|
207
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/qa-agent/orchestrator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAA2C,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAY7F,wBAAsB,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiGzE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
|
+
// See LICENSE.txt for license information.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.runQAAgent = runQAAgent;
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const logger_js_1 = require("../logger.js");
|
|
9
|
+
const runner_js_1 = require("./phase1/runner.js");
|
|
10
|
+
const agent_loop_js_1 = require("./phase2/agent_loop.js");
|
|
11
|
+
const verdict_js_1 = require("./phase3/verdict.js");
|
|
12
|
+
const reporter_js_1 = require("./phase3/reporter.js");
|
|
13
|
+
const spec_generator_js_1 = require("./phase3/spec_generator.js");
|
|
14
|
+
const feedback_js_1 = require("./phase3/feedback.js");
|
|
15
|
+
function emptyPhase2Result() {
|
|
16
|
+
return { findings: [], flowsExplored: [], actionsCount: 0, tokensUsed: 0, costUSD: 0, durationMs: 0 };
|
|
17
|
+
}
|
|
18
|
+
async function runQAAgent(inputConfig) {
|
|
19
|
+
const outputDir = inputConfig.outputDir || '.e2e-ai-agents';
|
|
20
|
+
const screenshotDir = inputConfig.screenshotDir || `${outputDir}/qa-screenshots`;
|
|
21
|
+
(0, fs_1.mkdirSync)(screenshotDir, { recursive: true });
|
|
22
|
+
const config = { ...inputConfig, outputDir, screenshotDir };
|
|
23
|
+
// -----------------------------------------------------------------------
|
|
24
|
+
// Phase 1: Scripted (scope resolution + run matched specs)
|
|
25
|
+
// -----------------------------------------------------------------------
|
|
26
|
+
logger_js_1.logger.info('=== Phase 1: Scope & Scripted Tests ===');
|
|
27
|
+
let phase1;
|
|
28
|
+
if (config.phase && config.phase > 1) {
|
|
29
|
+
// Skip Phase 1 — provide empty results
|
|
30
|
+
phase1 = { flows: [], specResults: [] };
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
phase1 = (0, runner_js_1.runPhase1)(config);
|
|
34
|
+
}
|
|
35
|
+
if (phase1.flows.length === 0 && phase1.specResults.length === 0 && !(config.phase && config.phase > 1)) {
|
|
36
|
+
logger_js_1.logger.warn('Phase 1 produced no flows and no spec results — scoping may have failed. Check that route-families.json and plan.json are available.');
|
|
37
|
+
}
|
|
38
|
+
logger_js_1.logger.info('Phase 1 complete', {
|
|
39
|
+
flows: phase1.flows.length,
|
|
40
|
+
specResults: phase1.specResults.length,
|
|
41
|
+
});
|
|
42
|
+
if (config.phase === 1) {
|
|
43
|
+
return earlyReturn(config, phase1);
|
|
44
|
+
}
|
|
45
|
+
// -----------------------------------------------------------------------
|
|
46
|
+
// Phase 2: Autonomous exploration (LLM + agent-browser)
|
|
47
|
+
// -----------------------------------------------------------------------
|
|
48
|
+
logger_js_1.logger.info('=== Phase 2: Autonomous Exploration ===');
|
|
49
|
+
// Verify agent-browser is available before starting the exploration loop
|
|
50
|
+
if (!(config.phase && config.phase > 2)) {
|
|
51
|
+
try {
|
|
52
|
+
(0, child_process_1.execFileSync)('agent-browser', ['--version'], { encoding: 'utf-8', timeout: 5000 });
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
logger_js_1.logger.error('agent-browser CLI not found. Install it (>= 0.18.0) or skip Phase 2 with --phase 1.');
|
|
56
|
+
return earlyReturn(config, phase1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
let phase2;
|
|
60
|
+
if (config.phase && config.phase > 2) {
|
|
61
|
+
phase2 = emptyPhase2Result();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const flows = phase1.flows.length > 0
|
|
65
|
+
? phase1.flows
|
|
66
|
+
: [{ id: 'main', name: 'Main application', priority: 'P1' }];
|
|
67
|
+
// In fix mode, limit Phase 2 to verification only
|
|
68
|
+
const phase2Config = config.mode === 'fix'
|
|
69
|
+
? { ...config, timeLimitMinutes: Math.min(config.timeLimitMinutes ?? 15, 5) }
|
|
70
|
+
: config;
|
|
71
|
+
phase2 = await (0, agent_loop_js_1.runAgentLoop)(phase2Config, flows);
|
|
72
|
+
}
|
|
73
|
+
logger_js_1.logger.info('Phase 2 complete', {
|
|
74
|
+
findings: phase2.findings.length,
|
|
75
|
+
flowsExplored: phase2.flowsExplored.length,
|
|
76
|
+
cost: `$${phase2.costUSD.toFixed(4)}`,
|
|
77
|
+
});
|
|
78
|
+
if (config.phase === 2) {
|
|
79
|
+
return earlyReturn(config, phase1, phase2);
|
|
80
|
+
}
|
|
81
|
+
// -----------------------------------------------------------------------
|
|
82
|
+
// Phase 3: Report + Spec Generation + Verdict
|
|
83
|
+
// -----------------------------------------------------------------------
|
|
84
|
+
logger_js_1.logger.info('=== Phase 3: Report & Verdict ===');
|
|
85
|
+
// Generate specs for discovered bugs
|
|
86
|
+
const generatedSpecs = (0, spec_generator_js_1.generateSpecsForFindings)(phase2.findings, config);
|
|
87
|
+
// Compute verdict
|
|
88
|
+
const verdict = (0, verdict_js_1.computeVerdict)(phase1, phase2);
|
|
89
|
+
// Generate report
|
|
90
|
+
const phase3 = (0, reporter_js_1.generateReport)(config, phase1, phase2, verdict, generatedSpecs);
|
|
91
|
+
// Submit feedback
|
|
92
|
+
try {
|
|
93
|
+
(0, feedback_js_1.submitFeedback)(config);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
logger_js_1.logger.warn('Feedback submission failed', { error: String(err) });
|
|
97
|
+
}
|
|
98
|
+
logger_js_1.logger.info(`=== QA Agent Complete: ${verdict.decision.toUpperCase()} ===`);
|
|
99
|
+
logger_js_1.logger.info(verdict.reason);
|
|
100
|
+
return buildQAReport(config, phase1, phase2, phase3, verdict);
|
|
101
|
+
}
|
|
102
|
+
function earlyReturn(config, phase1, phase2) {
|
|
103
|
+
const p2 = phase2 || emptyPhase2Result();
|
|
104
|
+
const verdict = (0, verdict_js_1.computeVerdict)(phase1, p2);
|
|
105
|
+
const phase3 = (0, reporter_js_1.generateReport)(config, phase1, p2, verdict, []);
|
|
106
|
+
return buildQAReport(config, phase1, p2, phase3, verdict);
|
|
107
|
+
}
|
|
108
|
+
function buildQAReport(config, phase1, phase2, phase3, verdict) {
|
|
109
|
+
return {
|
|
110
|
+
schemaVersion: '1.0.0',
|
|
111
|
+
generatedAt: new Date().toISOString(),
|
|
112
|
+
mode: config.mode,
|
|
113
|
+
config: {
|
|
114
|
+
baseUrl: config.baseUrl,
|
|
115
|
+
timeLimitMinutes: config.timeLimitMinutes,
|
|
116
|
+
budgetUSD: config.budgetUSD,
|
|
117
|
+
},
|
|
118
|
+
phase1,
|
|
119
|
+
phase2,
|
|
120
|
+
phase3,
|
|
121
|
+
verdict,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/qa-agent/phase1/runner.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAC,YAAY,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AAGpE,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,YAAY,CAwBxD"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
|
+
// See LICENSE.txt for license information.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.runPhase1 = runPhase1;
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const logger_js_1 = require("../../logger.js");
|
|
10
|
+
const safe_env_js_1 = require("../safe_env.js");
|
|
11
|
+
const scope_js_1 = require("./scope.js");
|
|
12
|
+
function runPhase1(config) {
|
|
13
|
+
const { flows, specPaths } = (0, scope_js_1.resolveScope)(config);
|
|
14
|
+
logger_js_1.logger.info('Phase 1: Scope resolved', {
|
|
15
|
+
flows: flows.length,
|
|
16
|
+
specDirs: specPaths.length,
|
|
17
|
+
mode: config.mode,
|
|
18
|
+
});
|
|
19
|
+
// Run impact-gate CLI for impact/plan if we have a since ref
|
|
20
|
+
if (config.since && config.mode !== 'release') {
|
|
21
|
+
runE2eAgentsCli(config);
|
|
22
|
+
}
|
|
23
|
+
// Run matched Playwright specs
|
|
24
|
+
const specResults = runMatchedSpecs(specPaths, config);
|
|
25
|
+
return {
|
|
26
|
+
flows,
|
|
27
|
+
specResults,
|
|
28
|
+
planPath: config.testsRoot
|
|
29
|
+
? (0, path_1.join)(config.testsRoot, '.e2e-ai-agents', 'plan.json')
|
|
30
|
+
: undefined,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function runE2eAgentsCli(config) {
|
|
34
|
+
const args = ['impact-gate'];
|
|
35
|
+
switch (config.mode) {
|
|
36
|
+
case 'pr':
|
|
37
|
+
args.push('plan');
|
|
38
|
+
if (config.since)
|
|
39
|
+
args.push('--since', config.since);
|
|
40
|
+
break;
|
|
41
|
+
case 'hunt':
|
|
42
|
+
args.push('impact');
|
|
43
|
+
if (config.huntTarget)
|
|
44
|
+
args.push('--flow-patterns', config.huntTarget);
|
|
45
|
+
if (config.since)
|
|
46
|
+
args.push('--since', config.since);
|
|
47
|
+
break;
|
|
48
|
+
case 'fix':
|
|
49
|
+
args.push('heal');
|
|
50
|
+
break;
|
|
51
|
+
default:
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (config.testsRoot) {
|
|
55
|
+
args.push('--tests-root', config.testsRoot);
|
|
56
|
+
}
|
|
57
|
+
logger_js_1.logger.info('Running impact-gate', { args: args.slice(1) });
|
|
58
|
+
const result = (0, child_process_1.spawnSync)('npx', args, {
|
|
59
|
+
cwd: config.testsRoot || process.cwd(),
|
|
60
|
+
encoding: 'utf-8',
|
|
61
|
+
timeout: 120000,
|
|
62
|
+
maxBuffer: 2 * 1024 * 1024,
|
|
63
|
+
env: (0, safe_env_js_1.safeEnv)(),
|
|
64
|
+
});
|
|
65
|
+
// Exit code 2 = "no changes detected" from impact-gate CLI, not an error
|
|
66
|
+
if (result.status !== 0 && result.status !== 2) {
|
|
67
|
+
logger_js_1.logger.warn('impact-gate exited with non-zero status', {
|
|
68
|
+
status: result.status,
|
|
69
|
+
stderr: (result.stderr || '').slice(0, 500),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function runMatchedSpecs(specPaths, config) {
|
|
74
|
+
const results = [];
|
|
75
|
+
const specFiles = collectSpecFiles(specPaths);
|
|
76
|
+
if (specFiles.length === 0) {
|
|
77
|
+
logger_js_1.logger.info('No spec files found to run');
|
|
78
|
+
return results;
|
|
79
|
+
}
|
|
80
|
+
logger_js_1.logger.info('Running matched specs', { count: specFiles.length });
|
|
81
|
+
for (const specFile of specFiles) {
|
|
82
|
+
const result = runSingleSpec(specFile, config);
|
|
83
|
+
results.push(result);
|
|
84
|
+
}
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
function collectSpecFiles(specPaths) {
|
|
88
|
+
const files = [];
|
|
89
|
+
for (const p of specPaths) {
|
|
90
|
+
if (!(0, fs_1.existsSync)(p))
|
|
91
|
+
continue;
|
|
92
|
+
try {
|
|
93
|
+
const entries = (0, fs_1.readdirSync)(p, { recursive: true, encoding: 'utf-8' });
|
|
94
|
+
for (const entry of entries) {
|
|
95
|
+
if (typeof entry === 'string' && (entry.endsWith('.spec.ts') || entry.endsWith('.test.ts'))) {
|
|
96
|
+
files.push((0, path_1.join)(p, entry));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// Skip unreadable directories
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return files;
|
|
105
|
+
}
|
|
106
|
+
function runSingleSpec(specPath, config) {
|
|
107
|
+
const args = [
|
|
108
|
+
'playwright', 'test',
|
|
109
|
+
specPath,
|
|
110
|
+
'--reporter', 'json',
|
|
111
|
+
];
|
|
112
|
+
if (config.project) {
|
|
113
|
+
args.push('--project', config.project);
|
|
114
|
+
}
|
|
115
|
+
const result = (0, child_process_1.spawnSync)('npx', args, {
|
|
116
|
+
cwd: config.testsRoot || process.cwd(),
|
|
117
|
+
encoding: 'utf-8',
|
|
118
|
+
timeout: 120000,
|
|
119
|
+
maxBuffer: 2 * 1024 * 1024,
|
|
120
|
+
env: (0, safe_env_js_1.safeEnv)(config.baseUrl ? { BASE_URL: config.baseUrl } : {}),
|
|
121
|
+
});
|
|
122
|
+
// Try to parse JSON output
|
|
123
|
+
try {
|
|
124
|
+
const report = JSON.parse(result.stdout || '{}');
|
|
125
|
+
return {
|
|
126
|
+
specPath,
|
|
127
|
+
passed: report.stats?.expected || 0,
|
|
128
|
+
failed: report.stats?.unexpected || 0,
|
|
129
|
+
flaky: report.stats?.flaky || 0,
|
|
130
|
+
skipped: report.stats?.skipped || 0,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return {
|
|
135
|
+
specPath,
|
|
136
|
+
passed: result.status === 0 ? 1 : 0,
|
|
137
|
+
failed: result.status === 0 ? 0 : 1,
|
|
138
|
+
flaky: 0,
|
|
139
|
+
skipped: 0,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/qa-agent/phase1/scope.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAgBtD,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG;IAAC,KAAK,EAAE,UAAU,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAC,CAsDzF"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
|
+
// See LICENSE.txt for license information.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resolveScope = resolveScope;
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const route_families_js_1 = require("../../knowledge/route_families.js");
|
|
9
|
+
function resolveScope(config) {
|
|
10
|
+
const testsRoot = config.testsRoot || process.cwd();
|
|
11
|
+
const planPath = (0, path_1.join)(testsRoot, '.e2e-ai-agents', 'plan.json');
|
|
12
|
+
// Try to read plan.json (written by impact-gate plan command)
|
|
13
|
+
const plan = readPlan(planPath);
|
|
14
|
+
const manifest = (0, route_families_js_1.loadRouteFamilyManifest)(testsRoot, {});
|
|
15
|
+
const flows = [];
|
|
16
|
+
const specPaths = [];
|
|
17
|
+
if (config.mode === 'hunt' && config.huntTarget) {
|
|
18
|
+
return resolveHuntScope(config.huntTarget, manifest, testsRoot);
|
|
19
|
+
}
|
|
20
|
+
if (config.mode === 'release') {
|
|
21
|
+
return resolveReleaseScope(manifest, testsRoot);
|
|
22
|
+
}
|
|
23
|
+
// PR / fix mode: use plan.json flows
|
|
24
|
+
if (plan) {
|
|
25
|
+
const allFlows = [
|
|
26
|
+
...(plan.flows || []),
|
|
27
|
+
...(plan.gaps || []).map((g) => ({ id: g.flowId, name: g.flowName, priority: g.priority })),
|
|
28
|
+
];
|
|
29
|
+
for (const f of allFlows) {
|
|
30
|
+
const family = manifest?.families.find((fam) => fam.id === f.id);
|
|
31
|
+
const url = resolveUrlForFamily(family);
|
|
32
|
+
flows.push({
|
|
33
|
+
id: f.id,
|
|
34
|
+
name: f.name,
|
|
35
|
+
priority: f.priority || 'P1',
|
|
36
|
+
url,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// Collect spec paths from covered flows
|
|
40
|
+
for (const c of plan.coveredFlows || []) {
|
|
41
|
+
if (c.specDirs) {
|
|
42
|
+
for (const dir of c.specDirs) {
|
|
43
|
+
const fullDir = (0, path_1.join)(testsRoot, dir);
|
|
44
|
+
if ((0, fs_1.existsSync)(fullDir)) {
|
|
45
|
+
specPaths.push(fullDir);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Sort by priority: P0 first
|
|
52
|
+
flows.sort((a, b) => a.priority.localeCompare(b.priority));
|
|
53
|
+
return { flows, specPaths };
|
|
54
|
+
}
|
|
55
|
+
function resolveHuntScope(target, manifest, testsRoot) {
|
|
56
|
+
const flows = [];
|
|
57
|
+
const specPaths = [];
|
|
58
|
+
const targetLower = target.toLowerCase();
|
|
59
|
+
if (manifest) {
|
|
60
|
+
for (const family of manifest.families) {
|
|
61
|
+
const matches = family.id.toLowerCase().includes(targetLower) ||
|
|
62
|
+
(family.userFlows || []).some((uf) => uf.toLowerCase().includes(targetLower));
|
|
63
|
+
if (matches) {
|
|
64
|
+
flows.push({
|
|
65
|
+
id: family.id,
|
|
66
|
+
name: family.id,
|
|
67
|
+
priority: family.priority || 'P1',
|
|
68
|
+
url: resolveUrlForFamily(family),
|
|
69
|
+
});
|
|
70
|
+
for (const dir of family.specDirs || []) {
|
|
71
|
+
const fullDir = (0, path_1.join)(testsRoot, dir);
|
|
72
|
+
if ((0, fs_1.existsSync)(fullDir)) {
|
|
73
|
+
specPaths.push(fullDir);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// If no manifest matches, create a generic flow
|
|
80
|
+
if (flows.length === 0) {
|
|
81
|
+
flows.push({ id: target, name: target, priority: 'P1' });
|
|
82
|
+
}
|
|
83
|
+
return { flows, specPaths };
|
|
84
|
+
}
|
|
85
|
+
function resolveReleaseScope(manifest, testsRoot) {
|
|
86
|
+
const flows = [];
|
|
87
|
+
const specPaths = [];
|
|
88
|
+
if (manifest) {
|
|
89
|
+
for (const family of manifest.families) {
|
|
90
|
+
if (family.priority === 'P0' || family.priority === 'P1') {
|
|
91
|
+
flows.push({
|
|
92
|
+
id: family.id,
|
|
93
|
+
name: family.id,
|
|
94
|
+
priority: family.priority,
|
|
95
|
+
url: resolveUrlForFamily(family),
|
|
96
|
+
});
|
|
97
|
+
for (const dir of family.specDirs || []) {
|
|
98
|
+
const fullDir = (0, path_1.join)(testsRoot, dir);
|
|
99
|
+
if ((0, fs_1.existsSync)(fullDir)) {
|
|
100
|
+
specPaths.push(fullDir);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
flows.sort((a, b) => a.priority.localeCompare(b.priority));
|
|
107
|
+
return { flows, specPaths };
|
|
108
|
+
}
|
|
109
|
+
function resolveUrlForFamily(family) {
|
|
110
|
+
if (!family || !family.routes || family.routes.length === 0)
|
|
111
|
+
return undefined;
|
|
112
|
+
// Take the first route pattern and substitute common placeholders
|
|
113
|
+
const route = family.routes[0];
|
|
114
|
+
return route
|
|
115
|
+
.replace(/\{team\}/g, 'default')
|
|
116
|
+
.replace(/\{channel\}/g, 'town-square')
|
|
117
|
+
.replace(/\{user_id\}/g, 'me')
|
|
118
|
+
.replace(/\{[^}]+\}/g, 'test');
|
|
119
|
+
}
|
|
120
|
+
function readPlan(path) {
|
|
121
|
+
if (!(0, fs_1.existsSync)(path))
|
|
122
|
+
return null;
|
|
123
|
+
try {
|
|
124
|
+
return JSON.parse((0, fs_1.readFileSync)(path, 'utf-8'));
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wrapper around the `agent-browser` CLI.
|
|
3
|
+
*
|
|
4
|
+
* Every method calls execFileSync (array form — no shell injection) and
|
|
5
|
+
* returns the stdout string. Session persistence is handled by
|
|
6
|
+
* agent-browser's daemon; the browser stays open between calls.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AgentBrowser {
|
|
9
|
+
private session?;
|
|
10
|
+
constructor(options?: {
|
|
11
|
+
session?: string;
|
|
12
|
+
});
|
|
13
|
+
private args;
|
|
14
|
+
open(url: string): string;
|
|
15
|
+
click(ref: string): string;
|
|
16
|
+
fill(ref: string, value: string): string;
|
|
17
|
+
type(ref: string, value: string): string;
|
|
18
|
+
press(key: string): string;
|
|
19
|
+
scroll(direction: 'up' | 'down', ref?: string): string;
|
|
20
|
+
snapshot(): string;
|
|
21
|
+
screenshot(path?: string): string;
|
|
22
|
+
getUrl(): string;
|
|
23
|
+
getTitle(): string;
|
|
24
|
+
getText(ref: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Run a JS expression in the browser via agent-browser's evaluate command.
|
|
27
|
+
* SECURITY: Only used internally for console error capture. Do NOT expose to LLM tools.
|
|
28
|
+
* Uses execFileSync array form — expression is a CLI arg, NOT JS eval().
|
|
29
|
+
*/
|
|
30
|
+
evaluateInternal(expression: string): string;
|
|
31
|
+
back(): string;
|
|
32
|
+
forward(): string;
|
|
33
|
+
close(): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=agent_browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent_browser.d.ts","sourceRoot":"","sources":["../../../src/qa-agent/phase2/agent_browser.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,OAAO,CAAC,CAAS;gBAEb,OAAO,CAAC,EAAE;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC;IAIxC,OAAO,CAAC,IAAI;IAOZ,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIzB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI1B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAIxC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAIxC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI1B,MAAM,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IAMtD,QAAQ,IAAI,MAAM;IAIlB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IASjC,MAAM,IAAI,MAAM;IAIhB,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI5B;;;;OAIG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAI5C,IAAI,IAAI,MAAM;IAId,OAAO,IAAI,MAAM;IAIjB,KAAK,IAAI,IAAI;CAOhB"}
|