@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,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamic generation profile — replaces hardcoded Mattermost references with
|
|
3
|
+
* project-specific configuration. Enables impact-gate to generate tests for any project.
|
|
4
|
+
*/
|
|
5
|
+
import type { KnowledgeGraph } from '../knowledge/kg_types.js';
|
|
6
|
+
import type { TestType } from '../knowledge/route_families.js';
|
|
7
|
+
export interface GenerationProfile {
|
|
8
|
+
projectName: string;
|
|
9
|
+
testFramework: string;
|
|
10
|
+
importStatement: string;
|
|
11
|
+
conventions: string[];
|
|
12
|
+
copyrightHeader?: string;
|
|
13
|
+
testMode: TestType;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the generation profile from config and optional KG metadata.
|
|
17
|
+
* - If profile='mattermost' or Mattermost is detected, returns Mattermost profile.
|
|
18
|
+
* - If KG is present, derives project-specific profile from it.
|
|
19
|
+
* - Otherwise, returns generic Playwright profile.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveGenerationProfile(config?: {
|
|
22
|
+
profile?: string;
|
|
23
|
+
testMode?: TestType;
|
|
24
|
+
}, kg?: KnowledgeGraph | null): GenerationProfile;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if a profile is the Mattermost profile (for backward compatibility checks).
|
|
27
|
+
*/
|
|
28
|
+
export declare function isMattermostProfile(profile: GenerationProfile): boolean;
|
|
29
|
+
//# sourceMappingURL=generation_profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generation_profile.d.ts","sourceRoot":"","sources":["../../src/prompts/generation_profile.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,gCAAgC,CAAC;AAG7D,MAAM,WAAW,iBAAiB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;CACtB;AA8CD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACpC,MAAM,CAAC,EAAE;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAC,EAChD,EAAE,CAAC,EAAE,cAAc,GAAG,IAAI,GAC3B,iBAAiB,CAmCnB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAEvE"}
|
|
@@ -0,0 +1,151 @@
|
|
|
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.resolveGenerationProfile = resolveGenerationProfile;
|
|
6
|
+
exports.isMattermostProfile = isMattermostProfile;
|
|
7
|
+
const framework_adapter_js_1 = require("../adapters/framework_adapter.js");
|
|
8
|
+
const MATTERMOST_PROFILE = {
|
|
9
|
+
projectName: 'Mattermost',
|
|
10
|
+
testFramework: 'Playwright',
|
|
11
|
+
importStatement: '@mattermost/playwright-lib',
|
|
12
|
+
conventions: [
|
|
13
|
+
'Import ONLY from "@mattermost/playwright-lib" — no other test framework imports.',
|
|
14
|
+
'Every test must call `await pw.initSetup()` first.',
|
|
15
|
+
'Use `await pw.testBrowser.login(user)` to log in — never hardcode credentials.',
|
|
16
|
+
'Use `expect` from "@mattermost/playwright-lib" — do NOT import from "@playwright/test".',
|
|
17
|
+
'Include the copyright header for new files.',
|
|
18
|
+
],
|
|
19
|
+
copyrightHeader: [
|
|
20
|
+
'// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.',
|
|
21
|
+
'// See LICENSE.txt for license information.',
|
|
22
|
+
].join('\n'),
|
|
23
|
+
testMode: 'ui',
|
|
24
|
+
};
|
|
25
|
+
const DEFAULT_PLAYWRIGHT_PROFILE = {
|
|
26
|
+
projectName: 'Project',
|
|
27
|
+
testFramework: 'Playwright',
|
|
28
|
+
importStatement: '@playwright/test',
|
|
29
|
+
conventions: [
|
|
30
|
+
'Import from "@playwright/test" for test and expect.',
|
|
31
|
+
'Use page fixtures provided by Playwright.',
|
|
32
|
+
'Prefer ARIA roles and data-testid attributes for selectors.',
|
|
33
|
+
'Write one test per scenario with a descriptive name.',
|
|
34
|
+
],
|
|
35
|
+
testMode: 'ui',
|
|
36
|
+
};
|
|
37
|
+
const DEFAULT_API_PROFILE = {
|
|
38
|
+
projectName: 'Project',
|
|
39
|
+
testFramework: 'vitest + supertest',
|
|
40
|
+
importStatement: 'vitest',
|
|
41
|
+
conventions: [
|
|
42
|
+
'Import from "vitest" for test and expect.',
|
|
43
|
+
'Use supertest for HTTP request assertions.',
|
|
44
|
+
'Validate response status codes, headers, and body structure.',
|
|
45
|
+
'Test both success and error paths for each endpoint.',
|
|
46
|
+
],
|
|
47
|
+
testMode: 'api',
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Resolves the generation profile from config and optional KG metadata.
|
|
51
|
+
* - If profile='mattermost' or Mattermost is detected, returns Mattermost profile.
|
|
52
|
+
* - If KG is present, derives project-specific profile from it.
|
|
53
|
+
* - Otherwise, returns generic Playwright profile.
|
|
54
|
+
*/
|
|
55
|
+
function resolveGenerationProfile(config, kg) {
|
|
56
|
+
// Explicit Mattermost profile
|
|
57
|
+
if (config?.profile === 'mattermost') {
|
|
58
|
+
return { ...MATTERMOST_PROFILE };
|
|
59
|
+
}
|
|
60
|
+
// KG-based profile derivation
|
|
61
|
+
if (kg) {
|
|
62
|
+
const frameworks = kg.project.frameworks.map((f) => f.toLowerCase());
|
|
63
|
+
const isMattermost = kg.project.name.toLowerCase().includes('mattermost') ||
|
|
64
|
+
frameworks.includes('@mattermost/playwright-lib');
|
|
65
|
+
if (isMattermost) {
|
|
66
|
+
return { ...MATTERMOST_PROFILE };
|
|
67
|
+
}
|
|
68
|
+
const testMode = config?.testMode || deriveTestMode(frameworks);
|
|
69
|
+
const testFramework = deriveTestFramework(frameworks, testMode);
|
|
70
|
+
const importStatement = deriveImportStatement(frameworks, testMode);
|
|
71
|
+
return {
|
|
72
|
+
projectName: kg.project.name || 'Project',
|
|
73
|
+
testFramework,
|
|
74
|
+
importStatement,
|
|
75
|
+
conventions: buildConventions(testFramework, importStatement, testMode),
|
|
76
|
+
testMode,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// Default profiles based on test mode
|
|
80
|
+
if (config?.testMode === 'api') {
|
|
81
|
+
return { ...DEFAULT_API_PROFILE };
|
|
82
|
+
}
|
|
83
|
+
return { ...DEFAULT_PLAYWRIGHT_PROFILE };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Checks if a profile is the Mattermost profile (for backward compatibility checks).
|
|
87
|
+
*/
|
|
88
|
+
function isMattermostProfile(profile) {
|
|
89
|
+
return profile.importStatement === '@mattermost/playwright-lib';
|
|
90
|
+
}
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// Internal helpers
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
function deriveTestMode(frameworks) {
|
|
95
|
+
const uiSet = new Set(framework_adapter_js_1.UI_FRAMEWORKS);
|
|
96
|
+
const apiSet = new Set(framework_adapter_js_1.API_FRAMEWORKS);
|
|
97
|
+
const hasUiFramework = frameworks.some((f) => uiSet.has(f));
|
|
98
|
+
const hasApiFramework = frameworks.some((f) => apiSet.has(f));
|
|
99
|
+
if (hasUiFramework && hasApiFramework)
|
|
100
|
+
return 'both';
|
|
101
|
+
if (hasApiFramework && !hasUiFramework)
|
|
102
|
+
return 'api';
|
|
103
|
+
return 'ui';
|
|
104
|
+
}
|
|
105
|
+
function deriveTestFramework(frameworks, testMode) {
|
|
106
|
+
if (testMode === 'api') {
|
|
107
|
+
if (frameworks.includes('pytest'))
|
|
108
|
+
return 'pytest';
|
|
109
|
+
if (frameworks.includes('jest'))
|
|
110
|
+
return 'jest + supertest';
|
|
111
|
+
return 'vitest + supertest';
|
|
112
|
+
}
|
|
113
|
+
if (frameworks.includes('cypress'))
|
|
114
|
+
return 'Cypress';
|
|
115
|
+
if (frameworks.includes('selenium'))
|
|
116
|
+
return 'Selenium';
|
|
117
|
+
return 'Playwright';
|
|
118
|
+
}
|
|
119
|
+
function deriveImportStatement(frameworks, testMode) {
|
|
120
|
+
if (testMode === 'api') {
|
|
121
|
+
if (frameworks.includes('pytest'))
|
|
122
|
+
return 'pytest';
|
|
123
|
+
if (frameworks.includes('jest'))
|
|
124
|
+
return 'jest';
|
|
125
|
+
return 'vitest';
|
|
126
|
+
}
|
|
127
|
+
if (frameworks.includes('cypress'))
|
|
128
|
+
return 'cypress';
|
|
129
|
+
return '@playwright/test';
|
|
130
|
+
}
|
|
131
|
+
function buildConventions(testFramework, importStatement, testMode) {
|
|
132
|
+
const conventions = [];
|
|
133
|
+
if (testMode === 'api' || testMode === 'both') {
|
|
134
|
+
conventions.push(`Import from "${importStatement}" for test and expect.`);
|
|
135
|
+
conventions.push('Validate response status codes, headers, and body structure.');
|
|
136
|
+
conventions.push('Test both success and error paths for each endpoint.');
|
|
137
|
+
}
|
|
138
|
+
if (testMode === 'ui' || testMode === 'both') {
|
|
139
|
+
if (testFramework.includes('Playwright')) {
|
|
140
|
+
conventions.push('Import from "@playwright/test" for test and expect.');
|
|
141
|
+
conventions.push('Use page fixtures provided by Playwright.');
|
|
142
|
+
}
|
|
143
|
+
else if (testFramework.includes('Cypress')) {
|
|
144
|
+
conventions.push('Use cy.* commands for browser interaction.');
|
|
145
|
+
}
|
|
146
|
+
conventions.push('Prefer ARIA roles and data-testid attributes for selectors.');
|
|
147
|
+
}
|
|
148
|
+
conventions.push('Write one test per scenario with a descriptive name of what the user does and what is verified.');
|
|
149
|
+
conventions.push('NEVER fabricate test IDs. Use descriptive names only.');
|
|
150
|
+
return conventions;
|
|
151
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FlowDecision } from '../validation/output_schema.js';
|
|
2
|
+
import type { GenerationProfile } from './generation_profile.js';
|
|
3
|
+
export interface HealPromptContext {
|
|
4
|
+
specPath: string;
|
|
5
|
+
status: 'failed' | 'flaky';
|
|
6
|
+
decision?: FlowDecision;
|
|
7
|
+
failureDetail?: string;
|
|
8
|
+
/** Last 3 console errors from the test run */
|
|
9
|
+
consoleErrors?: string[];
|
|
10
|
+
profile?: GenerationProfile;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Builds a route-family-aware heal prompt for the playwright-test-healer agent.
|
|
14
|
+
* Enriches the base healer constraints with flow context so the agent understands
|
|
15
|
+
* what the test is supposed to verify, reducing hallucination during selector repair.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildHealPrompt(ctx: HealPromptContext): string;
|
|
18
|
+
/**
|
|
19
|
+
* Builds a minimal quality-fix prompt for spec files that fail content validation
|
|
20
|
+
* (e.g. contain test.describe, test.only, wrong imports).
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildQualityFixPrompt(specPath: string, qualityIssues: string[], profile?: GenerationProfile): string;
|
|
23
|
+
//# sourceMappingURL=heal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heal.d.ts","sourceRoot":"","sources":["../../src/prompts/heal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAEjE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAG/D,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAgE9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAmBpH"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.buildHealPrompt = buildHealPrompt;
|
|
6
|
+
exports.buildQualityFixPrompt = buildQualityFixPrompt;
|
|
7
|
+
const sanitize_js_1 = require("../crew/sanitize.js");
|
|
8
|
+
const generation_profile_js_1 = require("./generation_profile.js");
|
|
9
|
+
/**
|
|
10
|
+
* Builds a route-family-aware heal prompt for the playwright-test-healer agent.
|
|
11
|
+
* Enriches the base healer constraints with flow context so the agent understands
|
|
12
|
+
* what the test is supposed to verify, reducing hallucination during selector repair.
|
|
13
|
+
*/
|
|
14
|
+
function buildHealPrompt(ctx) {
|
|
15
|
+
const flowBlock = ctx.decision
|
|
16
|
+
? [
|
|
17
|
+
'',
|
|
18
|
+
'FLOW CONTEXT (use to understand test intent — do not change test objectives):',
|
|
19
|
+
` Flow: ${(0, sanitize_js_1.sanitizeForPrompt)(ctx.decision.flowName)}`,
|
|
20
|
+
` Route Family: ${ctx.decision.routeFamily}${ctx.decision.featureId ? ` / ${ctx.decision.featureId}` : ''}`,
|
|
21
|
+
` Route: ${ctx.decision.specificRoute || '(family-level)'}`,
|
|
22
|
+
` User Actions: ${(0, sanitize_js_1.sanitizeForPrompt)(ctx.decision.userActions.join('; ')) || 'not specified'}`,
|
|
23
|
+
` Evidence: ${(0, sanitize_js_1.sanitizeForPrompt)(ctx.decision.evidence)}`,
|
|
24
|
+
].join('\n')
|
|
25
|
+
: '';
|
|
26
|
+
const statusNote = ctx.status === 'flaky'
|
|
27
|
+
? 'This test is FLAKY (passes sometimes, fails other times). Look for race conditions, missing waits, or order-dependent state.'
|
|
28
|
+
: 'This test is FAILING consistently. The selector, URL, or API call is likely broken.';
|
|
29
|
+
const failureBlock = ctx.failureDetail
|
|
30
|
+
? `\nFailure detail:\n${(0, sanitize_js_1.sanitizeForPrompt)(ctx.failureDetail)}`
|
|
31
|
+
: '';
|
|
32
|
+
const consoleBlock = ctx.consoleErrors && ctx.consoleErrors.length > 0
|
|
33
|
+
? `\nRecent console errors from test run:\n${ctx.consoleErrors.slice(-3).map((e) => ` - ${(0, sanitize_js_1.sanitizeForPrompt)(e)}`).join('\n')}`
|
|
34
|
+
: '';
|
|
35
|
+
const importLib = ctx.profile?.importStatement || '@playwright/test';
|
|
36
|
+
const isMM = ctx.profile ? (0, generation_profile_js_1.isMattermostProfile)(ctx.profile) : false;
|
|
37
|
+
const projectLabel = ctx.profile?.projectName || 'Project';
|
|
38
|
+
const frameworkLabel = ctx.profile?.testFramework || 'Playwright';
|
|
39
|
+
const constraints = isMM
|
|
40
|
+
? [
|
|
41
|
+
`- Import ONLY from "${importLib}". Do not use "@playwright/test" directly.`,
|
|
42
|
+
'- Do not use test.describe or test.only.',
|
|
43
|
+
'- Keep a single tag string matching the route family (e.g. "@channels", "@scheduled_posts").',
|
|
44
|
+
`- Use only existing ${projectLabel} ${frameworkLabel} fixture and page-object APIs.`,
|
|
45
|
+
'- Do NOT invent new pw.* clients or page object methods that do not exist.',
|
|
46
|
+
'- Avoid brittle class selectors (.backstage-navbar, .admin-console__wrapper, .left-panel, .panel-card).',
|
|
47
|
+
]
|
|
48
|
+
: [
|
|
49
|
+
`- Import from "${importLib}".`,
|
|
50
|
+
'- Keep a single tag string matching the route family.',
|
|
51
|
+
`- Use only existing ${projectLabel} ${frameworkLabel} page-object APIs.`,
|
|
52
|
+
'- Do NOT invent page object methods that do not exist.',
|
|
53
|
+
];
|
|
54
|
+
return [
|
|
55
|
+
`Heal this specific ${frameworkLabel} test file and keep edits minimal.`,
|
|
56
|
+
'',
|
|
57
|
+
`Target test file: ${ctx.specPath}`,
|
|
58
|
+
`Status: ${ctx.status.toUpperCase()} — ${statusNote}`,
|
|
59
|
+
failureBlock,
|
|
60
|
+
consoleBlock,
|
|
61
|
+
flowBlock,
|
|
62
|
+
'',
|
|
63
|
+
'Healing constraints (must follow):',
|
|
64
|
+
...constraints,
|
|
65
|
+
'- Prefer stable assertions using URL patterns, data-testid attributes, ARIA roles, and page-object methods.',
|
|
66
|
+
'- For flaky tests: add explicit waits (waitFor, expect().toBeVisible()) before interactions.',
|
|
67
|
+
'- Keep the test intent and scenario unchanged — only fix what is broken.',
|
|
68
|
+
'- If behavior is genuinely broken server-side, mark test.fixme with a clear comment explaining why.',
|
|
69
|
+
'',
|
|
70
|
+
'Run and fix this test until it compiles and passes, or mark test.fixme when the behavior is truly broken.',
|
|
71
|
+
].filter((line) => line !== null).join('\n');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Builds a minimal quality-fix prompt for spec files that fail content validation
|
|
75
|
+
* (e.g. contain test.describe, test.only, wrong imports).
|
|
76
|
+
*/
|
|
77
|
+
function buildQualityFixPrompt(specPath, qualityIssues, profile) {
|
|
78
|
+
const importLib = profile?.importStatement || '@playwright/test';
|
|
79
|
+
const frameworkLabel = profile?.testFramework || 'Playwright';
|
|
80
|
+
return [
|
|
81
|
+
`Fix quality issues in this ${frameworkLabel} spec file. Make minimal edits only.`,
|
|
82
|
+
'',
|
|
83
|
+
`Target file: ${specPath}`,
|
|
84
|
+
'',
|
|
85
|
+
'Issues to fix:',
|
|
86
|
+
...qualityIssues.map((issue) => ` - ${issue}`),
|
|
87
|
+
'',
|
|
88
|
+
'Rules:',
|
|
89
|
+
`- Import only from "${importLib}".`,
|
|
90
|
+
'- Remove test.describe wrappers (flatten to top-level test() calls).',
|
|
91
|
+
'- Remove test.only calls.',
|
|
92
|
+
'- Ensure each test has exactly one tag string.',
|
|
93
|
+
'- Do not change test logic — only fix structural quality issues.',
|
|
94
|
+
].join('\n');
|
|
95
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RouteFamily } from '../knowledge/route_families.js';
|
|
2
|
+
import type { SpecEntry } from '../knowledge/spec_index.js';
|
|
3
|
+
import { type ApiSurfaceCatalog } from '../knowledge/api_surface.js';
|
|
4
|
+
export interface ImpactPromptContext {
|
|
5
|
+
family: RouteFamily;
|
|
6
|
+
featureId?: string;
|
|
7
|
+
changedFiles: Array<{
|
|
8
|
+
path: string;
|
|
9
|
+
snippet?: string;
|
|
10
|
+
}>;
|
|
11
|
+
existingSpecs: SpecEntry[];
|
|
12
|
+
apiSurface: ApiSurfaceCatalog;
|
|
13
|
+
contextBlock: string;
|
|
14
|
+
projectName?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildImpactPrompt(ctx: ImpactPromptContext): string;
|
|
17
|
+
export interface ImpactAgentResponse {
|
|
18
|
+
flows: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
route?: string;
|
|
22
|
+
userActions?: string[];
|
|
23
|
+
priority?: string;
|
|
24
|
+
confidence?: number;
|
|
25
|
+
evidence?: string;
|
|
26
|
+
pageObjects?: string[];
|
|
27
|
+
changedFiles?: string[];
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export declare function parseImpactResponse(text: string): ImpactAgentResponse | null;
|
|
31
|
+
//# sourceMappingURL=impact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact.d.ts","sourceRoot":"","sources":["../../src/prompts/impact.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAA4B,KAAK,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAE9F,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IACtD,aAAa,EAAE,SAAS,EAAE,CAAC;IAC3B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CA0DlE;AAED,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,KAAK,CAAC;QACT,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,CAAC,CAAC;CACN;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAM5E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.buildImpactPrompt = buildImpactPrompt;
|
|
6
|
+
exports.parseImpactResponse = parseImpactResponse;
|
|
7
|
+
const json_extract_js_1 = require("./json_extract.js");
|
|
8
|
+
const spec_index_js_1 = require("../knowledge/spec_index.js");
|
|
9
|
+
const api_surface_js_1 = require("../knowledge/api_surface.js");
|
|
10
|
+
function buildImpactPrompt(ctx) {
|
|
11
|
+
const familyRoutes = ctx.family.routes.join(', ');
|
|
12
|
+
const featureNote = ctx.featureId ? `\nFEATURE: ${ctx.featureId}` : '';
|
|
13
|
+
const pageObjectNames = ctx.family.pageObjects || [];
|
|
14
|
+
const componentNames = ctx.family.components || [];
|
|
15
|
+
const allClassNames = [...pageObjectNames, ...componentNames];
|
|
16
|
+
const apiSurfaceBlock = allClassNames.length > 0
|
|
17
|
+
? (0, api_surface_js_1.formatApiSurfaceForPrompt)(ctx.apiSurface, allClassNames)
|
|
18
|
+
: 'No page objects or components mapped for this family.';
|
|
19
|
+
const specsBlock = ctx.existingSpecs.length > 0
|
|
20
|
+
? (0, spec_index_js_1.formatSpecsForPrompt)(ctx.existingSpecs)
|
|
21
|
+
: 'No existing specs found for this route family.';
|
|
22
|
+
const changedFilesBlock = ctx.changedFiles
|
|
23
|
+
.map((f) => {
|
|
24
|
+
if (f.snippet) {
|
|
25
|
+
return `${f.path}:\n\`\`\`\n${f.snippet}\n\`\`\``;
|
|
26
|
+
}
|
|
27
|
+
return f.path;
|
|
28
|
+
})
|
|
29
|
+
.join('\n\n');
|
|
30
|
+
return [
|
|
31
|
+
`You are analyzing code changes in ${ctx.projectName || 'the project'} to identify impacted user-facing flows.`,
|
|
32
|
+
'',
|
|
33
|
+
`ROUTE FAMILY: ${ctx.family.id}`,
|
|
34
|
+
`ROUTES: ${familyRoutes}`,
|
|
35
|
+
featureNote,
|
|
36
|
+
'',
|
|
37
|
+
`PAGE OBJECTS AND COMPONENTS:`,
|
|
38
|
+
apiSurfaceBlock,
|
|
39
|
+
'',
|
|
40
|
+
`EXISTING SPECS FOR THIS FAMILY (${ctx.existingSpecs.length}):`,
|
|
41
|
+
specsBlock,
|
|
42
|
+
'',
|
|
43
|
+
`CHANGED FILES (${ctx.changedFiles.length}):`,
|
|
44
|
+
changedFilesBlock,
|
|
45
|
+
'',
|
|
46
|
+
ctx.contextBlock,
|
|
47
|
+
'',
|
|
48
|
+
'For each changed file, identify impacted user-facing flows.',
|
|
49
|
+
'',
|
|
50
|
+
'Return strict JSON only with this shape:',
|
|
51
|
+
'{"flows":[{"id":"<flow_id>","name":"<human readable name>","route":"<specific route from ROUTES>","userActions":["<what the user does>"],"priority":"P0|P1|P2","confidence":0-100,"evidence":"<why this flow is impacted>","pageObjects":["<page object used>"],"changedFiles":["<files>"]}]}',
|
|
52
|
+
'',
|
|
53
|
+
'Rules:',
|
|
54
|
+
'- ONLY use routes listed in ROUTES above.',
|
|
55
|
+
'- ONLY reference page objects and components listed above.',
|
|
56
|
+
'- Each flow must describe a specific user action, not a generic category.',
|
|
57
|
+
'- If you cannot determine the impacted flow with high confidence, return:',
|
|
58
|
+
' {"id":"unknown","name":"cannot determine","confidence":0,"evidence":"<reason>","userActions":[],"changedFiles":["<files>"]}',
|
|
59
|
+
'- Do NOT default to /admin_console/reporting/system_analytics unless the changed files are literally analytics code.',
|
|
60
|
+
'- Do NOT invent routes, page objects, or methods that are not listed above.',
|
|
61
|
+
'- Keep at most 8 flows.',
|
|
62
|
+
'- Prioritize true user-impacting flows; avoid low-value internal buckets.',
|
|
63
|
+
].filter(Boolean).join('\n');
|
|
64
|
+
}
|
|
65
|
+
function parseImpactResponse(text) {
|
|
66
|
+
return (0, json_extract_js_1.extractJsonFromResponse)(text, (obj) => obj != null && typeof obj === 'object' && Array.isArray(obj.flows));
|
|
67
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared JSON extraction from LLM text responses.
|
|
3
|
+
* Handles fenced code blocks, bare JSON, and partial text.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Extract and parse JSON from LLM response text.
|
|
7
|
+
* Tries fenced code blocks first, then raw text.
|
|
8
|
+
* Returns null if no valid JSON found.
|
|
9
|
+
*
|
|
10
|
+
* @param text - Raw LLM response text
|
|
11
|
+
* @param validate - Predicate to check if parsed object has the expected shape
|
|
12
|
+
*/
|
|
13
|
+
export declare function extractJsonFromResponse<T>(text: string, validate: (obj: unknown) => obj is T): T | null;
|
|
14
|
+
//# sourceMappingURL=json_extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_extract.d.ts","sourceRoot":"","sources":["../../src/prompts/json_extract.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAqBvG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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.extractJsonFromResponse = extractJsonFromResponse;
|
|
6
|
+
/**
|
|
7
|
+
* Shared JSON extraction from LLM text responses.
|
|
8
|
+
* Handles fenced code blocks, bare JSON, and partial text.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Extract and parse JSON from LLM response text.
|
|
12
|
+
* Tries fenced code blocks first, then raw text.
|
|
13
|
+
* Returns null if no valid JSON found.
|
|
14
|
+
*
|
|
15
|
+
* @param text - Raw LLM response text
|
|
16
|
+
* @param validate - Predicate to check if parsed object has the expected shape
|
|
17
|
+
*/
|
|
18
|
+
function extractJsonFromResponse(text, validate) {
|
|
19
|
+
const fenced = text.match(/```(?:json)?\s*([\s\S]*?)```/i);
|
|
20
|
+
const candidates = fenced ? [fenced[1], text] : [text];
|
|
21
|
+
for (const candidate of candidates) {
|
|
22
|
+
const start = candidate.indexOf('{');
|
|
23
|
+
const end = candidate.lastIndexOf('}');
|
|
24
|
+
if (start < 0 || end <= start) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const raw = candidate.slice(start, end + 1);
|
|
28
|
+
try {
|
|
29
|
+
const parsed = JSON.parse(raw);
|
|
30
|
+
if (validate(parsed)) {
|
|
31
|
+
return parsed;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategist prompt — designs overall test strategy from impact analysis,
|
|
3
|
+
* cross-impact data, and regression risk.
|
|
4
|
+
*/
|
|
5
|
+
import type { FlowDecision } from '../validation/output_schema.js';
|
|
6
|
+
import type { CrossImpact, RegressionRisk } from '../crew/types.js';
|
|
7
|
+
export interface StrategistPromptContext {
|
|
8
|
+
impactedFlows: FlowDecision[];
|
|
9
|
+
crossImpacts: CrossImpact[];
|
|
10
|
+
regressionRisks: RegressionRisk[];
|
|
11
|
+
}
|
|
12
|
+
export declare function buildStrategistPrompt(ctx: StrategistPromptContext): string;
|
|
13
|
+
export interface StrategistAgentResponse {
|
|
14
|
+
strategy: Array<{
|
|
15
|
+
flowId: string;
|
|
16
|
+
flowName: string;
|
|
17
|
+
priority: 'P0' | 'P1' | 'P2' | string;
|
|
18
|
+
approach: 'full-test' | 'smoke-test' | 'skip' | 'manual-review' | string;
|
|
19
|
+
rationale: string;
|
|
20
|
+
testCategories: string[];
|
|
21
|
+
crossImpactRisk: 'high' | 'medium' | 'low' | 'none' | string;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
export declare function parseStrategistResponse(text: string): StrategistAgentResponse | null;
|
|
25
|
+
//# sourceMappingURL=strategist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategist.d.ts","sourceRoot":"","sources":["../../src/prompts/strategist.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAgB,MAAM,kBAAkB,CAAC;AAIjF,MAAM,WAAW,uBAAuB;IACpC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,eAAe,EAAE,cAAc,EAAE,CAAC;CACrC;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,uBAAuB,GAAG,MAAM,CA4D1E;AAED,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,KAAK,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;QACtC,QAAQ,EAAE,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,eAAe,GAAG,MAAM,CAAC;QACzE,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,eAAe,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;KAChE,CAAC,CAAC;CACN;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,CAMpF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.buildStrategistPrompt = buildStrategistPrompt;
|
|
6
|
+
exports.parseStrategistResponse = parseStrategistResponse;
|
|
7
|
+
const sanitize_js_1 = require("../crew/sanitize.js");
|
|
8
|
+
const json_extract_js_1 = require("./json_extract.js");
|
|
9
|
+
function buildStrategistPrompt(ctx) {
|
|
10
|
+
const flowsBlock = ctx.impactedFlows
|
|
11
|
+
.map((f) => {
|
|
12
|
+
const specs = f.existingSpecs.map((s) => `${s.path} (${s.coverageLevel})`).join(', ') || 'none';
|
|
13
|
+
return [
|
|
14
|
+
`- ${f.flowId} (${f.priority}): ${f.flowName}`,
|
|
15
|
+
` Route Family: ${f.routeFamily}`,
|
|
16
|
+
` Action: ${f.action}`,
|
|
17
|
+
` Confidence: ${f.confidence}%`,
|
|
18
|
+
` Existing Coverage: ${specs}`,
|
|
19
|
+
` User Actions: ${(0, sanitize_js_1.sanitizeForPrompt)(f.userActions.join('; ') || 'unknown')}`,
|
|
20
|
+
` Changed Files: ${f.changedFiles.join(', ')}`,
|
|
21
|
+
].join('\n');
|
|
22
|
+
})
|
|
23
|
+
.join('\n\n');
|
|
24
|
+
const crossImpactBlock = ctx.crossImpacts.length > 0
|
|
25
|
+
? ctx.crossImpacts.map((ci) => `- ${ci.sourceFamily} → ${ci.affectedFamily} (${ci.riskLevel}): ${ci.sharedDependency} — ${ci.evidence}`).join('\n')
|
|
26
|
+
: 'No cross-family impacts detected.';
|
|
27
|
+
const regressionBlock = ctx.regressionRisks.length > 0
|
|
28
|
+
? ctx.regressionRisks.map((r) => `- ${r.familyId} (risk=${r.riskScore}): ${r.reason}`).join('\n')
|
|
29
|
+
: 'No regression risk data available.';
|
|
30
|
+
return [
|
|
31
|
+
'You are a senior QA strategist designing the overall test strategy for a code change.',
|
|
32
|
+
'',
|
|
33
|
+
`IMPACTED FLOWS (${ctx.impactedFlows.length}):`,
|
|
34
|
+
flowsBlock,
|
|
35
|
+
'',
|
|
36
|
+
'CROSS-FAMILY IMPACTS:',
|
|
37
|
+
crossImpactBlock,
|
|
38
|
+
'',
|
|
39
|
+
'REGRESSION RISK:',
|
|
40
|
+
regressionBlock,
|
|
41
|
+
'',
|
|
42
|
+
'TASK: Design a prioritized test strategy for each impacted flow.',
|
|
43
|
+
'',
|
|
44
|
+
'For each flow, decide:',
|
|
45
|
+
'1. Approach: full-test (comprehensive), smoke-test (critical path only), skip, or manual-review',
|
|
46
|
+
'2. Priority: P0 (critical path), P1 (important), P2 (nice to have)',
|
|
47
|
+
'3. Test categories to cover (from: happy-path, edge-case, boundary, negative, state-transition, race-condition, permission, accessibility, performance)',
|
|
48
|
+
'4. Cross-impact risk level based on shared dependencies',
|
|
49
|
+
'',
|
|
50
|
+
'Return strict JSON only with this shape:',
|
|
51
|
+
'{"strategy":[{"flowId":"<id>","flowName":"<name>","priority":"P0|P1|P2","approach":"full-test|smoke-test|skip|manual-review","rationale":"<why this approach>","testCategories":["happy-path","edge-case",...],"crossImpactRisk":"high|medium|low|none"}]}',
|
|
52
|
+
'',
|
|
53
|
+
'Rules:',
|
|
54
|
+
'- P0 flows with create_spec or add_scenarios action should always get full-test.',
|
|
55
|
+
'- Flows with high cross-impact risk should be promoted to at least P1.',
|
|
56
|
+
'- Flows with high regression risk should include edge-case and boundary categories.',
|
|
57
|
+
'- Skip flows only if confidence < 30 AND no cross-impact risk.',
|
|
58
|
+
'- Include accessibility category for any flow involving interactive UI elements.',
|
|
59
|
+
'- Include permission category for any flow involving role-based features.',
|
|
60
|
+
'- Keep rationale concise (1-2 sentences) explaining why this approach was chosen.',
|
|
61
|
+
].join('\n');
|
|
62
|
+
}
|
|
63
|
+
function parseStrategistResponse(text) {
|
|
64
|
+
return (0, json_extract_js_1.extractJsonFromResponse)(text, (obj) => obj != null && typeof obj === 'object' && Array.isArray(obj.strategy));
|
|
65
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Designer prompt — designs structured test cases across 9 categories.
|
|
3
|
+
* Replaces flat scenariosToAdd with rich TestCase[] that feed the Generator.
|
|
4
|
+
*/
|
|
5
|
+
import type { FlowDecision } from '../validation/output_schema.js';
|
|
6
|
+
import { type ApiSurfaceCatalog } from '../knowledge/api_surface.js';
|
|
7
|
+
import type { SpecEntry } from '../knowledge/spec_index.js';
|
|
8
|
+
import type { StrategyEntry, CrossImpact } from '../crew/types.js';
|
|
9
|
+
import type { GenerationProfile } from './generation_profile.js';
|
|
10
|
+
export interface TestDesignerPromptContext {
|
|
11
|
+
flow: FlowDecision;
|
|
12
|
+
strategy: StrategyEntry;
|
|
13
|
+
apiSurface: ApiSurfaceCatalog;
|
|
14
|
+
existingSpecs: SpecEntry[];
|
|
15
|
+
crossImpacts: CrossImpact[];
|
|
16
|
+
profile?: GenerationProfile;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildTestDesignerPrompt(ctx: TestDesignerPromptContext): string;
|
|
19
|
+
export interface TestDesignerAgentResponse {
|
|
20
|
+
testDesign: {
|
|
21
|
+
flowId: string;
|
|
22
|
+
flowName: string;
|
|
23
|
+
testCases: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
type: 'happy-path' | 'edge-case' | 'boundary' | 'negative' | 'state-transition' | 'race-condition' | 'permission' | 'accessibility' | 'performance' | string;
|
|
26
|
+
preconditions: string[];
|
|
27
|
+
steps: string[];
|
|
28
|
+
expectedOutcome: string;
|
|
29
|
+
priority: 'P0' | 'P1' | 'P2' | string;
|
|
30
|
+
rationale: string;
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare function parseTestDesignerResponse(text: string): TestDesignerAgentResponse | null;
|
|
35
|
+
//# sourceMappingURL=test-designer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-designer.d.ts","sourceRoot":"","sources":["../../src/prompts/test-designer.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAA4B,KAAK,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9F,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAC,aAAa,EAAE,WAAW,EAAa,MAAM,kBAAkB,CAAC;AAE7E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE/D,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,aAAa,EAAE,SAAS,EAAE,CAAC;IAC3B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,yBAAyB,GAAG,MAAM,CAuF9E;AAED,MAAM,WAAW,yBAAyB;IACtC,UAAU,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,KAAK,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,YAAY,GAAG,eAAe,GAAG,aAAa,GAAG,MAAM,CAAC;YAC7J,aAAa,EAAE,MAAM,EAAE,CAAC;YACxB,KAAK,EAAE,MAAM,EAAE,CAAC;YAChB,eAAe,EAAE,MAAM,CAAC;YACxB,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;YACtC,SAAS,EAAE,MAAM,CAAC;SACrB,CAAC,CAAC;KACN,CAAC;CACL;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,yBAAyB,GAAG,IAAI,CAQxF"}
|