@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,257 @@
|
|
|
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.runGitRaw = runGitRaw;
|
|
6
|
+
exports.isTestFile = isTestFile;
|
|
7
|
+
exports.getChangedFiles = getChangedFiles;
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const utils_js_1 = require("./utils.js");
|
|
10
|
+
// Directories that contain CI/tooling/docs/tests — never relevant to impact analysis.
|
|
11
|
+
const IGNORED_DIR_SEGMENTS = [
|
|
12
|
+
'.github',
|
|
13
|
+
'.claude',
|
|
14
|
+
'.vscode',
|
|
15
|
+
'.idea',
|
|
16
|
+
'node_modules',
|
|
17
|
+
'e2e-tests',
|
|
18
|
+
'__tests__',
|
|
19
|
+
'__mocks__',
|
|
20
|
+
'testlib',
|
|
21
|
+
'scripts',
|
|
22
|
+
];
|
|
23
|
+
// Exact filenames (basename) that are never relevant.
|
|
24
|
+
const IGNORED_BASENAMES = new Set([
|
|
25
|
+
'package.json',
|
|
26
|
+
'package-lock.json',
|
|
27
|
+
'.gitignore',
|
|
28
|
+
'.prettierignore',
|
|
29
|
+
'.prettierrc',
|
|
30
|
+
'.eslintrc',
|
|
31
|
+
'.eslintrc.js',
|
|
32
|
+
'.eslintrc.json',
|
|
33
|
+
'.editorconfig',
|
|
34
|
+
'.npmrc',
|
|
35
|
+
'.mcp.json',
|
|
36
|
+
'CHANGELOG.md',
|
|
37
|
+
'README.md',
|
|
38
|
+
'LICENSE',
|
|
39
|
+
'LICENSE.txt',
|
|
40
|
+
'tsconfig.json',
|
|
41
|
+
'jest.config.js',
|
|
42
|
+
'jest.config.ts',
|
|
43
|
+
'babel.config.js',
|
|
44
|
+
'webpack.config.js',
|
|
45
|
+
'Makefile',
|
|
46
|
+
'config.mk',
|
|
47
|
+
'go.mod',
|
|
48
|
+
'go.sum',
|
|
49
|
+
]);
|
|
50
|
+
// Extensions that are never source code.
|
|
51
|
+
const IGNORED_EXTENSIONS = new Set([
|
|
52
|
+
'.md',
|
|
53
|
+
'.txt',
|
|
54
|
+
'.lock',
|
|
55
|
+
'.png', '.jpg', '.jpeg', '.gif', '.svg', '.ico',
|
|
56
|
+
'.woff', '.woff2', '.ttf', '.eot',
|
|
57
|
+
'.yml', '.yaml',
|
|
58
|
+
'.sh',
|
|
59
|
+
]);
|
|
60
|
+
// File patterns that indicate test/spec files (not production code).
|
|
61
|
+
const TEST_FILE_PATTERNS = [
|
|
62
|
+
/\.spec\.[tj]sx?$/,
|
|
63
|
+
/\.test\.[tj]sx?$/,
|
|
64
|
+
/_test\.go$/,
|
|
65
|
+
/\.stories\.[tj]sx?$/,
|
|
66
|
+
/\.d\.ts$/,
|
|
67
|
+
];
|
|
68
|
+
// Config file patterns that are not production source code.
|
|
69
|
+
const CONFIG_FILE_PATTERNS = [
|
|
70
|
+
/\.config\.[tj]sx?$/,
|
|
71
|
+
/\.config\.json$/,
|
|
72
|
+
/\.config\.js$/,
|
|
73
|
+
];
|
|
74
|
+
function isRelevantFile(file) {
|
|
75
|
+
const segments = file.split('/');
|
|
76
|
+
const basename = segments[segments.length - 1] || file;
|
|
77
|
+
if (IGNORED_BASENAMES.has(basename)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
for (const seg of segments) {
|
|
81
|
+
if (IGNORED_DIR_SEGMENTS.includes(seg)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const dotIdx = basename.lastIndexOf('.');
|
|
86
|
+
if (dotIdx > 0) {
|
|
87
|
+
const ext = basename.slice(dotIdx).toLowerCase();
|
|
88
|
+
if (IGNORED_EXTENSIONS.has(ext)) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Filter test/spec files — they don't impact production features
|
|
93
|
+
for (const pattern of TEST_FILE_PATTERNS) {
|
|
94
|
+
if (pattern.test(basename)) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Filter config files
|
|
99
|
+
for (const pattern of CONFIG_FILE_PATTERNS) {
|
|
100
|
+
if (pattern.test(basename)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
function runGitRaw(args, cwd) {
|
|
107
|
+
const result = (0, child_process_1.spawnSync)('git', args, {
|
|
108
|
+
cwd,
|
|
109
|
+
encoding: 'utf-8',
|
|
110
|
+
timeout: 30000,
|
|
111
|
+
});
|
|
112
|
+
if (result.error || result.status !== 0) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return result.stdout;
|
|
116
|
+
}
|
|
117
|
+
function runGit(args, cwd) {
|
|
118
|
+
const output = runGitRaw(args, cwd);
|
|
119
|
+
if (output === null) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
return output
|
|
123
|
+
.split('\n')
|
|
124
|
+
.map((file) => file.trim())
|
|
125
|
+
.filter(Boolean)
|
|
126
|
+
.map((file) => (0, utils_js_1.normalizePath)(file));
|
|
127
|
+
}
|
|
128
|
+
function parseStatusLines(lines) {
|
|
129
|
+
const files = [];
|
|
130
|
+
for (const line of lines) {
|
|
131
|
+
if (!line)
|
|
132
|
+
continue;
|
|
133
|
+
if (line.length < 4)
|
|
134
|
+
continue;
|
|
135
|
+
const pathPart = line.slice(3).trim();
|
|
136
|
+
if (!pathPart)
|
|
137
|
+
continue;
|
|
138
|
+
if (pathPart.includes('->')) {
|
|
139
|
+
const parts = pathPart.split('->').map((part) => part.trim());
|
|
140
|
+
const target = parts[parts.length - 1];
|
|
141
|
+
if (target) {
|
|
142
|
+
files.push((0, utils_js_1.normalizePath)(target));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
files.push((0, utils_js_1.normalizePath)(pathPart));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return files;
|
|
150
|
+
}
|
|
151
|
+
// Comment-line patterns by file extension.
|
|
152
|
+
// A diff that ONLY touches these lines is a comment-only change (typo fix, doc update).
|
|
153
|
+
const COMMENT_PATTERNS = [
|
|
154
|
+
{ extensions: ['.go'], pattern: /^\s*(\/\/|\/\*|\*)/ },
|
|
155
|
+
{ extensions: ['.ts', '.tsx', '.js', '.jsx'], pattern: /^\s*(\/\/|\/\*|\*|\*\/)/ },
|
|
156
|
+
{ extensions: ['.py'], pattern: /^\s*#/ },
|
|
157
|
+
{ extensions: ['.css', '.scss'], pattern: /^\s*(\/\*|\*|\*\/)/ },
|
|
158
|
+
];
|
|
159
|
+
/**
|
|
160
|
+
* Check if a file's diff only changes comment lines (no code changes).
|
|
161
|
+
* Returns true if the diff is comment-only and can be safely excluded.
|
|
162
|
+
*/
|
|
163
|
+
function isCommentOnlyDiff(file, repoRoot, baseRef) {
|
|
164
|
+
const diff = runGitRaw(['diff', `${baseRef}..HEAD`, '-U0', '--', file], repoRoot);
|
|
165
|
+
if (!diff)
|
|
166
|
+
return false;
|
|
167
|
+
const ext = file.slice(file.lastIndexOf('.'));
|
|
168
|
+
const commentEntry = COMMENT_PATTERNS.find((cp) => cp.extensions.includes(ext));
|
|
169
|
+
if (!commentEntry)
|
|
170
|
+
return false;
|
|
171
|
+
// Extract only added/removed content lines (skip diff headers)
|
|
172
|
+
const contentLines = diff
|
|
173
|
+
.split('\n')
|
|
174
|
+
.filter((line) => (line.startsWith('+') || line.startsWith('-')) && !line.startsWith('+++') && !line.startsWith('---'));
|
|
175
|
+
if (contentLines.length === 0)
|
|
176
|
+
return false;
|
|
177
|
+
// Every changed line must be a comment line
|
|
178
|
+
return contentLines.every((line) => {
|
|
179
|
+
const content = line.slice(1).trim(); // Remove +/- prefix
|
|
180
|
+
return content === '' || commentEntry.pattern.test(content);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Check if a file path is a test file (spec, test, or in test directories).
|
|
185
|
+
* Shared across pipeline and crew orchestrators.
|
|
186
|
+
*/
|
|
187
|
+
function isTestFile(file) {
|
|
188
|
+
const normalized = file.replace(/\\/g, '/');
|
|
189
|
+
return /\.(spec|test)\.(ts|tsx|js|jsx)$/.test(normalized) ||
|
|
190
|
+
/\.snap$/.test(normalized) ||
|
|
191
|
+
/_test\.go$/.test(normalized) ||
|
|
192
|
+
normalized.includes('__tests__/') ||
|
|
193
|
+
normalized.includes('__snapshots__/') ||
|
|
194
|
+
normalized.includes('/tests/') ||
|
|
195
|
+
normalized.includes('/test/');
|
|
196
|
+
}
|
|
197
|
+
function getChangedFiles(appRoot, since, options) {
|
|
198
|
+
try {
|
|
199
|
+
const files = new Set();
|
|
200
|
+
let baseRef = since;
|
|
201
|
+
let baseStrategy = 'direct';
|
|
202
|
+
const mergeBase = runGitRaw(['merge-base', since, 'HEAD'], appRoot);
|
|
203
|
+
if (mergeBase) {
|
|
204
|
+
const candidate = mergeBase
|
|
205
|
+
.split('\n')
|
|
206
|
+
.map((line) => line.trim())
|
|
207
|
+
.find(Boolean);
|
|
208
|
+
if (candidate) {
|
|
209
|
+
baseRef = candidate;
|
|
210
|
+
baseStrategy = 'merge-base';
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Get repo root so we capture ALL changed files (including server/, webapp/, etc.)
|
|
214
|
+
// not just files under the appRoot subdirectory.
|
|
215
|
+
const repoRoot = runGitRaw(['rev-parse', '--show-toplevel'], appRoot)?.trim() || appRoot;
|
|
216
|
+
const diffFiles = runGit(['diff', '--name-only', `${baseRef}..HEAD`], repoRoot);
|
|
217
|
+
if (!diffFiles) {
|
|
218
|
+
return { files: [], filteredTestFiles: [], error: 'git diff failed' };
|
|
219
|
+
}
|
|
220
|
+
diffFiles.forEach((file) => files.add(file));
|
|
221
|
+
if (options?.includeUncommitted) {
|
|
222
|
+
const staged = runGit(['diff', '--name-only', '--cached'], repoRoot) || [];
|
|
223
|
+
staged.forEach((file) => files.add(file));
|
|
224
|
+
const unstaged = runGit(['diff', '--name-only'], repoRoot) || [];
|
|
225
|
+
unstaged.forEach((file) => files.add(file));
|
|
226
|
+
const statusOutput = runGitRaw(['status', '--porcelain'], repoRoot);
|
|
227
|
+
if (statusOutput) {
|
|
228
|
+
const statusLines = statusOutput.split('\n').filter(Boolean);
|
|
229
|
+
parseStatusLines(statusLines).forEach((file) => files.add(file));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const allFiles = Array.from(files);
|
|
233
|
+
const relevant = [];
|
|
234
|
+
const filteredTestFiles = [];
|
|
235
|
+
for (const f of allFiles) {
|
|
236
|
+
if (isRelevantFile(f)) {
|
|
237
|
+
// Skip files where the diff only touches comments (typo fixes, doc updates)
|
|
238
|
+
if (isCommentOnlyDiff(f, repoRoot, baseRef)) {
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
relevant.push(f);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
// Only capture files that were filtered because they match test patterns.
|
|
245
|
+
// Config, docs, workflow files etc. are not useful for PR-test detection.
|
|
246
|
+
const basename = f.split('/').pop() || f;
|
|
247
|
+
if (TEST_FILE_PATTERNS.some((p) => p.test(basename))) {
|
|
248
|
+
filteredTestFiles.push(f);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return { files: relevant, filteredTestFiles, baseRef, baseStrategy };
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
return { files: [], filteredTestFiles: [], error: 'git diff failed' };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface FinalizeGeneratedTestsOptions {
|
|
2
|
+
appPath: string;
|
|
3
|
+
testsRoot?: string;
|
|
4
|
+
gapReportPath?: string;
|
|
5
|
+
branch?: string;
|
|
6
|
+
commitMessage?: string;
|
|
7
|
+
createPr?: boolean;
|
|
8
|
+
prTitle?: string;
|
|
9
|
+
prBody?: string;
|
|
10
|
+
baseBranch?: string;
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface FinalizeGeneratedTestsResult {
|
|
14
|
+
repoRoot: string;
|
|
15
|
+
branch: string;
|
|
16
|
+
stagedPaths: string[];
|
|
17
|
+
committed: boolean;
|
|
18
|
+
commitSha?: string;
|
|
19
|
+
prUrl?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function finalizeGeneratedTests(options: FinalizeGeneratedTestsOptions): FinalizeGeneratedTestsResult;
|
|
22
|
+
//# sourceMappingURL=handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../src/agent/handoff.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,6BAA6B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,4BAA4B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AA+HD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,4BAA4B,CAmE3G"}
|
|
@@ -0,0 +1,180 @@
|
|
|
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.finalizeGeneratedTests = finalizeGeneratedTests;
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
function runCommand(bin, args, cwd, opts = {}) {
|
|
10
|
+
try {
|
|
11
|
+
const stdout = (0, child_process_1.execFileSync)(bin, args, { cwd, encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] });
|
|
12
|
+
return { ok: true, stdout: stdout.trim(), stderr: '' };
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (opts.allowFailure) {
|
|
16
|
+
const cause = error;
|
|
17
|
+
const stdout = typeof cause.stdout === 'string' ? cause.stdout : cause.stdout?.toString('utf-8') || '';
|
|
18
|
+
const stderr = typeof cause.stderr === 'string' ? cause.stderr : cause.stderr?.toString('utf-8') || cause.message || '';
|
|
19
|
+
return { ok: false, stdout: stdout.trim(), stderr: stderr.trim() };
|
|
20
|
+
}
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function normalizeBranchName(branch) {
|
|
25
|
+
if (!branch || !branch.trim()) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const trimmed = branch.trim();
|
|
29
|
+
if (trimmed.startsWith('codex/')) {
|
|
30
|
+
return trimmed;
|
|
31
|
+
}
|
|
32
|
+
return `codex/${trimmed.replace(/^\/+/, '')}`;
|
|
33
|
+
}
|
|
34
|
+
function resolveRepoRoot(appPath) {
|
|
35
|
+
const abs = (0, path_1.resolve)(appPath);
|
|
36
|
+
const result = runCommand('git', ['-C', abs, 'rev-parse', '--show-toplevel'], abs, { allowFailure: true });
|
|
37
|
+
if (!result.ok || !result.stdout) {
|
|
38
|
+
throw new Error(`Unable to find git repository root from ${abs}: ${result.stderr || 'git rev-parse failed'}`);
|
|
39
|
+
}
|
|
40
|
+
return result.stdout;
|
|
41
|
+
}
|
|
42
|
+
function readGapReport(path) {
|
|
43
|
+
if (!(0, fs_1.existsSync)(path)) {
|
|
44
|
+
throw new Error(`Gap report not found: ${path}`);
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
return JSON.parse((0, fs_1.readFileSync)(path, 'utf-8'));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
51
|
+
throw new Error(`Unable to parse gap report at ${path}: ${message}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function uniq(values) {
|
|
55
|
+
return Array.from(new Set(values.filter(Boolean)));
|
|
56
|
+
}
|
|
57
|
+
function toRepoRelative(repoRoot, absoluteOrRelative) {
|
|
58
|
+
const absolute = (0, path_1.resolve)(absoluteOrRelative);
|
|
59
|
+
return (0, path_1.relative)(repoRoot, absolute) || '.';
|
|
60
|
+
}
|
|
61
|
+
function isRepoRelativePathSafe(path) {
|
|
62
|
+
if (!path || path === '.') {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
if (path.startsWith('..') || path.includes('/../') || path.includes('\\..\\')) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
function collectStageTargets(repoRoot, appPath, testsRoot, gap) {
|
|
71
|
+
const targets = [];
|
|
72
|
+
const applied = gap.applied || {};
|
|
73
|
+
for (const patched of applied.patchedFiles || []) {
|
|
74
|
+
targets.push(toRepoRelative(repoRoot, (0, path_1.resolve)(appPath, patched)));
|
|
75
|
+
}
|
|
76
|
+
for (const generated of applied.generatedTests || []) {
|
|
77
|
+
targets.push(toRepoRelative(repoRoot, generated));
|
|
78
|
+
}
|
|
79
|
+
for (const result of gap.pipeline?.results || []) {
|
|
80
|
+
if (result.generatedDir) {
|
|
81
|
+
targets.push(toRepoRelative(repoRoot, result.generatedDir));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const artifacts = ['gap.json', 'impact.json', 'plan.json', 'ci-summary.md', 'pr-comment.md'];
|
|
85
|
+
for (const file of artifacts) {
|
|
86
|
+
targets.push(toRepoRelative(repoRoot, (0, path_1.resolve)(testsRoot, '.e2e-ai-agents', file)));
|
|
87
|
+
}
|
|
88
|
+
return uniq(targets).filter((path) => isRepoRelativePathSafe(path) && (0, fs_1.existsSync)((0, path_1.resolve)(repoRoot, path)));
|
|
89
|
+
}
|
|
90
|
+
function ensureBranch(repoRoot, requestedBranch, dryRun = false) {
|
|
91
|
+
const current = runCommand('git', ['branch', '--show-current'], repoRoot, { allowFailure: true });
|
|
92
|
+
const currentBranch = current.stdout || 'HEAD';
|
|
93
|
+
const normalized = normalizeBranchName(requestedBranch);
|
|
94
|
+
if (!normalized) {
|
|
95
|
+
return currentBranch;
|
|
96
|
+
}
|
|
97
|
+
if (currentBranch === normalized) {
|
|
98
|
+
return currentBranch;
|
|
99
|
+
}
|
|
100
|
+
const exists = runCommand('git', ['rev-parse', '--verify', normalized], repoRoot, { allowFailure: true }).ok;
|
|
101
|
+
if (!dryRun) {
|
|
102
|
+
if (exists) {
|
|
103
|
+
runCommand('git', ['checkout', normalized], repoRoot);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
runCommand('git', ['checkout', '-b', normalized], repoRoot);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return normalized;
|
|
110
|
+
}
|
|
111
|
+
function hasStagedChanges(repoRoot) {
|
|
112
|
+
const result = runCommand('git', ['diff', '--cached', '--name-only'], repoRoot, { allowFailure: true });
|
|
113
|
+
if (!result.ok) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return result.stdout.trim().length > 0;
|
|
117
|
+
}
|
|
118
|
+
function finalizeGeneratedTests(options) {
|
|
119
|
+
const appPath = (0, path_1.resolve)(options.appPath);
|
|
120
|
+
const testsRoot = (0, path_1.resolve)(options.testsRoot || options.appPath);
|
|
121
|
+
const repoRoot = resolveRepoRoot(appPath);
|
|
122
|
+
const gapReportPath = options.gapReportPath || (0, path_1.resolve)(testsRoot, '.e2e-ai-agents', 'gap.json');
|
|
123
|
+
const gap = readGapReport(gapReportPath);
|
|
124
|
+
const stageTargets = collectStageTargets(repoRoot, appPath, testsRoot, gap);
|
|
125
|
+
const commitMessage = options.commitMessage || 'test(e2e): add generated coverage and healed specs';
|
|
126
|
+
const dryRun = Boolean(options.dryRun);
|
|
127
|
+
const branch = ensureBranch(repoRoot, options.branch, dryRun);
|
|
128
|
+
if (stageTargets.length === 0) {
|
|
129
|
+
return {
|
|
130
|
+
repoRoot,
|
|
131
|
+
branch,
|
|
132
|
+
stagedPaths: [],
|
|
133
|
+
committed: false,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
for (const path of stageTargets) {
|
|
137
|
+
if (!dryRun) {
|
|
138
|
+
runCommand('git', ['add', '--', path], repoRoot, { allowFailure: true });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
let committed = false;
|
|
142
|
+
let commitSha;
|
|
143
|
+
if (!dryRun && hasStagedChanges(repoRoot)) {
|
|
144
|
+
runCommand('git', ['commit', '-m', commitMessage], repoRoot);
|
|
145
|
+
committed = true;
|
|
146
|
+
const head = runCommand('git', ['rev-parse', 'HEAD'], repoRoot, { allowFailure: true });
|
|
147
|
+
if (head.ok) {
|
|
148
|
+
commitSha = head.stdout;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
let prUrl;
|
|
152
|
+
if (!dryRun && options.createPr) {
|
|
153
|
+
const args = ['pr', 'create'];
|
|
154
|
+
if (options.prTitle) {
|
|
155
|
+
args.push('--title', options.prTitle);
|
|
156
|
+
}
|
|
157
|
+
if (options.prBody) {
|
|
158
|
+
args.push('--body', options.prBody);
|
|
159
|
+
}
|
|
160
|
+
if (options.baseBranch) {
|
|
161
|
+
args.push('--base', options.baseBranch);
|
|
162
|
+
}
|
|
163
|
+
if (!options.prTitle && !options.prBody) {
|
|
164
|
+
args.push('--fill');
|
|
165
|
+
}
|
|
166
|
+
const result = runCommand('gh', args, repoRoot, { allowFailure: true });
|
|
167
|
+
if (!result.ok) {
|
|
168
|
+
throw new Error(`Failed to create PR via gh: ${result.stderr || 'unknown error'}`);
|
|
169
|
+
}
|
|
170
|
+
prUrl = result.stdout.split('\n').find((line) => line.startsWith('http')) || result.stdout;
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
repoRoot,
|
|
174
|
+
branch,
|
|
175
|
+
stagedPaths: stageTargets,
|
|
176
|
+
committed,
|
|
177
|
+
commitSha,
|
|
178
|
+
prUrl,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PipelineConfig } from './config.js';
|
|
2
|
+
import type { FlowImpact } from './types.js';
|
|
3
|
+
import type { ApiSurfaceCatalog, CommandResult, PipelineResult, PipelineSummary } from './pipeline_types.js';
|
|
4
|
+
export declare function findSpecFiles(root: string): string[];
|
|
5
|
+
export declare function findDisallowedDescribeFiles(root: string): string[];
|
|
6
|
+
export declare function hasCommand(command: string, cwd: string): boolean;
|
|
7
|
+
export declare function hasPlaywrightAgentDefinitions(testsRoot: string): boolean;
|
|
8
|
+
export declare function hasPlaywrightConfig(testsRoot: string): boolean;
|
|
9
|
+
export declare function bootstrapPlaywrightAgentDefinitions(testsRoot: string, pipeline: PipelineConfig, timeoutMs: number): CommandResult;
|
|
10
|
+
export declare function resolveAgentSeedSpec(testsRoot: string): string | null;
|
|
11
|
+
export declare function buildPlaywrightAgentsPrompt(flow: FlowImpact, seedFile: string, planFile: string, testFile: string, includeHealer: boolean): string;
|
|
12
|
+
export declare function buildPlaywrightHealerPrompt(testFile: string, extra?: string): string;
|
|
13
|
+
export declare function runPlaywrightAgentsFlow(testsRoot: string, flow: FlowImpact, pipeline: PipelineConfig, outputDir: string, preferredTestFile: string, seedFile: string, apiSurface: ApiSurfaceCatalog, playwrightBinary: string | null, mcpTimeoutMs: number, mcpRetries: number): PipelineResult;
|
|
14
|
+
export declare function runPlaywrightAgentsPipeline(testsRoot: string, flows: FlowImpact[], pipeline: PipelineConfig): PipelineSummary;
|
|
15
|
+
//# sourceMappingURL=llm_agents_flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm_agents_flow.d.ts","sourceRoot":"","sources":["../../src/agent/llm_agents_flow.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAC,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAQ3G,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAepD;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAGlE;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAGhE;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAQxE;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAU9D;AAED,wBAAgB,mCAAmC,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAMjI;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA2CrE;AAED,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,OAAO,GACvB,MAAM,CAmCR;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBpF;AAED,wBAAgB,uBAAuB,CACnC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,iBAAiB,EAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,EAC/B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACnB,cAAc,CAiNhB;AAED,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,EAAE,EACnB,QAAQ,EAAE,cAAc,GACzB,eAAe,CAsGjB"}
|