@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,251 @@
|
|
|
1
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
+
// See LICENSE.txt for license information.
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
import { dirname, join, resolve } from 'path';
|
|
5
|
+
import { logger } from '../logger.js';
|
|
6
|
+
export const CONFIG_CANDIDATES = [
|
|
7
|
+
'impact-gate.config.json',
|
|
8
|
+
'.impact-gate.config.json',
|
|
9
|
+
'e2e-ai-agents.config.json',
|
|
10
|
+
'.e2e-ai-agents.config.json',
|
|
11
|
+
];
|
|
12
|
+
export function findConfigUpwards(startDir) {
|
|
13
|
+
if (!startDir) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
let current = resolve(startDir);
|
|
17
|
+
while (true) {
|
|
18
|
+
for (const candidate of CONFIG_CANDIDATES) {
|
|
19
|
+
const fullPath = join(current, candidate);
|
|
20
|
+
if (existsSync(fullPath)) {
|
|
21
|
+
return fullPath;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const parent = dirname(current);
|
|
25
|
+
if (parent === current) {
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
current = parent;
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
export function resolveAutoConfig(args) {
|
|
33
|
+
if (args.configPath) {
|
|
34
|
+
return args.configPath;
|
|
35
|
+
}
|
|
36
|
+
const searchRoots = [
|
|
37
|
+
process.cwd(),
|
|
38
|
+
args.testsRoot,
|
|
39
|
+
args.path,
|
|
40
|
+
].filter(Boolean);
|
|
41
|
+
for (const root of searchRoots) {
|
|
42
|
+
const found = findConfigUpwards(root);
|
|
43
|
+
if (found) {
|
|
44
|
+
return found;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const csvSplit = (v) => v.split(',').map((s) => s.trim()).filter(Boolean);
|
|
50
|
+
// prettier-ignore
|
|
51
|
+
const FLAGS = {
|
|
52
|
+
// -- boolean flags --
|
|
53
|
+
'--help': { key: 'help', type: 'boolean', aliases: ['-h'] },
|
|
54
|
+
'--apply': { key: 'apply', type: 'boolean' },
|
|
55
|
+
'--allow-fallback': { key: 'allowFallback', type: 'boolean' },
|
|
56
|
+
'--pipeline': { key: 'pipeline', type: 'boolean' },
|
|
57
|
+
'--pipeline-mcp': { key: 'pipelineMcp', type: 'boolean' },
|
|
58
|
+
'--pipeline-mcp-allow-fallback': { key: 'pipelineMcpAllowFallback', type: 'boolean' },
|
|
59
|
+
'--pipeline-mcp-only': { key: 'pipelineMcpOnly', type: 'boolean' },
|
|
60
|
+
'--pipeline-headless': { key: 'pipelineHeadless', type: 'boolean' },
|
|
61
|
+
'--pipeline-headed': { key: 'pipelineHeadless', type: 'boolean-false' },
|
|
62
|
+
'--pipeline-parallel': { key: 'pipelineParallel', type: 'boolean' },
|
|
63
|
+
'--pipeline-dry-run': { key: 'pipelineDryRun', type: 'boolean' },
|
|
64
|
+
'--fail-on-must-add-tests': { key: 'failOnMustAddTests', type: 'boolean' },
|
|
65
|
+
'--crew': { key: 'crew', type: 'boolean' },
|
|
66
|
+
'--create-pr': { key: 'createPr', type: 'boolean' },
|
|
67
|
+
'--dry-run': { key: 'dryRun', type: 'boolean' },
|
|
68
|
+
'--generate': { key: 'analyzeGenerate', type: 'boolean' },
|
|
69
|
+
'--heal': { key: 'analyzeHeal', type: 'boolean' },
|
|
70
|
+
'--no-ai': { key: 'noAi', type: 'boolean' },
|
|
71
|
+
'--degraded-mode': { key: 'degradedMode', type: 'boolean' },
|
|
72
|
+
'--enrich': { key: 'trainEnrich', type: 'boolean' },
|
|
73
|
+
'--no-enrich': { key: 'trainEnrich', type: 'boolean-false' },
|
|
74
|
+
'--validate': { key: 'trainValidate', type: 'boolean' },
|
|
75
|
+
'--yes': { key: 'trainYes', type: 'boolean', aliases: ['-y'] },
|
|
76
|
+
'--verbose': { key: 'verbose', type: 'boolean', aliases: ['-v'] },
|
|
77
|
+
'--json': { key: 'jsonOutput', type: 'boolean' },
|
|
78
|
+
'--mattermost': { key: 'profile', type: 'boolean', transform: () => 'mattermost' },
|
|
79
|
+
// -- string flags --
|
|
80
|
+
'--config': { key: 'configPath', type: 'string' },
|
|
81
|
+
'--path': { key: 'path', type: 'string' },
|
|
82
|
+
'--tests-root': { key: 'testsRoot', type: 'string' },
|
|
83
|
+
'--framework': { key: 'framework', type: 'string', transform: (v) => v },
|
|
84
|
+
'--scenarios': { key: 'generateScenarios', type: 'string' },
|
|
85
|
+
'--pipeline-output': { key: 'pipelineOutput', type: 'string' },
|
|
86
|
+
'--pipeline-base-url': { key: 'pipelineBaseUrl', type: 'string' },
|
|
87
|
+
'--pipeline-project': { key: 'pipelineProject', type: 'string' },
|
|
88
|
+
'--spec': { key: 'specPDF', type: 'string' },
|
|
89
|
+
'--since': { key: 'gitSince', type: 'string' },
|
|
90
|
+
'--llm-provider': { key: 'llmProvider', type: 'string' },
|
|
91
|
+
'--ci-comment-path': { key: 'ciCommentPath', type: 'string' },
|
|
92
|
+
'--github-output': { key: 'githubOutputPath', type: 'string' },
|
|
93
|
+
'--feedback-input': { key: 'feedbackInputPath', type: 'string' },
|
|
94
|
+
'--traceability-report': { key: 'traceabilityReportPath', type: 'string' },
|
|
95
|
+
'--traceability-capture-output': { key: 'traceabilityCaptureOutputPath', type: 'string' },
|
|
96
|
+
'--traceability-coverage-map': { key: 'traceabilityCoverageMapPath', type: 'string' },
|
|
97
|
+
'--traceability-changed-files': { key: 'traceabilityChangedFilesPath', type: 'string' },
|
|
98
|
+
'--traceability-input': { key: 'traceabilityInputPath', type: 'string' },
|
|
99
|
+
'--branch': { key: 'branch', type: 'string' },
|
|
100
|
+
'--commit-message': { key: 'commitMessage', type: 'string' },
|
|
101
|
+
'--pr-title': { key: 'prTitle', type: 'string' },
|
|
102
|
+
'--pr-body': { key: 'prBody', type: 'string' },
|
|
103
|
+
'--pr-base': { key: 'prBase', type: 'string' },
|
|
104
|
+
'--generate-output': { key: 'analyzeGenerateOutputDir', type: 'string' },
|
|
105
|
+
'--heal-report': { key: 'analyzeHealReport', type: 'string' },
|
|
106
|
+
'--flow-catalog': { key: 'flowCatalogPath', type: 'string' },
|
|
107
|
+
'--output': { key: 'trainOutput', type: 'string' },
|
|
108
|
+
'--server-path': { key: 'serverPath', type: 'string' },
|
|
109
|
+
'--workflow': { key: 'crewWorkflow', type: 'string' },
|
|
110
|
+
'--crew-workflow': { key: 'crewWorkflow', type: 'string' },
|
|
111
|
+
// -- number flags (with isFinite guard) --
|
|
112
|
+
'--pipeline-scenarios': { key: 'pipelineScenarios', type: 'number' },
|
|
113
|
+
'--time': { key: 'timeLimitMinutes', type: 'number' },
|
|
114
|
+
'--budget-usd': { key: 'budgetUSD', type: 'number' },
|
|
115
|
+
'--budget-tokens': { key: 'budgetTokens', type: 'number' },
|
|
116
|
+
'--policy-min-confidence': { key: 'policyMinConfidence', type: 'number' },
|
|
117
|
+
'--policy-safe-merge-confidence': { key: 'policySafeMergeConfidence', type: 'number' },
|
|
118
|
+
'--policy-force-full-on-warnings': { key: 'policyWarningsThreshold', type: 'number' },
|
|
119
|
+
'--traceability-min-hits': { key: 'traceabilityMinHits', type: 'number' },
|
|
120
|
+
'--traceability-max-files-per-test': { key: 'traceabilityMaxFilesPerTest', type: 'number' },
|
|
121
|
+
'--traceability-max-age-days': { key: 'traceabilityMaxAgeDays', type: 'number' },
|
|
122
|
+
'--pr': { key: 'trainPr', type: 'number' },
|
|
123
|
+
// -- number-raw flags (no isFinite guard, assigned directly via Number()) --
|
|
124
|
+
'--max-attempts': { key: 'maxAttempts', type: 'number-raw', transform: (v) => parseInt(v, 10) },
|
|
125
|
+
'--pipeline-mcp-timeout-ms': { key: 'pipelineMcpTimeoutMs', type: 'number-raw' },
|
|
126
|
+
'--pipeline-mcp-retries': { key: 'pipelineMcpRetries', type: 'number-raw' },
|
|
127
|
+
// -- enum flags --
|
|
128
|
+
'--profile': { key: 'profile', type: 'enum', enumValues: ['default', 'mattermost'] },
|
|
129
|
+
'--pipeline-browser': { key: 'pipelineBrowser', type: 'enum', enumValues: ['chrome', 'chromium', 'firefox', 'webkit'] },
|
|
130
|
+
'--policy-enforcement-mode': { key: 'policyEnforcementMode', type: 'enum', enumValues: ['advisory', 'warn', 'block'] },
|
|
131
|
+
// -- csv flags --
|
|
132
|
+
'--patterns': { key: 'testPatterns', type: 'csv' },
|
|
133
|
+
'--flow-patterns': { key: 'flowPatterns', type: 'csv' },
|
|
134
|
+
'--flow-exclude': { key: 'flowExclude', type: 'csv' },
|
|
135
|
+
'--plugins': { key: 'plugins', type: 'csv' },
|
|
136
|
+
'--policy-risky-patterns': { key: 'policyRiskyPatterns', type: 'csv' },
|
|
137
|
+
'--policy-block-actions': {
|
|
138
|
+
key: 'policyBlockActions',
|
|
139
|
+
type: 'csv',
|
|
140
|
+
transform: (v) => csvSplit(v).filter((s) => s === 'run-now' || s === 'must-add-tests' || s === 'safe-to-merge'),
|
|
141
|
+
},
|
|
142
|
+
// -- gate command --
|
|
143
|
+
'--threshold': { key: 'gateThreshold', type: 'number' },
|
|
144
|
+
// -- bootstrap command --
|
|
145
|
+
'--kg-path': { key: 'bootstrapKgPath', type: 'string' },
|
|
146
|
+
'--scaffold-framework': { key: 'bootstrapScaffoldFramework', type: 'boolean' },
|
|
147
|
+
'--test-mode': { key: 'bootstrapTestMode', type: 'enum', enumValues: ['ui', 'api', 'both'] },
|
|
148
|
+
'--max-families': { key: 'bootstrapMaxFamilies', type: 'number' },
|
|
149
|
+
};
|
|
150
|
+
// Build a lookup from alias -> canonical flag name
|
|
151
|
+
const ALIAS_MAP = {};
|
|
152
|
+
for (const [flag, def] of Object.entries(FLAGS)) {
|
|
153
|
+
ALIAS_MAP[flag] = flag;
|
|
154
|
+
if (def.aliases) {
|
|
155
|
+
for (const alias of def.aliases) {
|
|
156
|
+
ALIAS_MAP[alias] = flag;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const COMMANDS = new Set([
|
|
161
|
+
'init', 'impact', 'plan', 'heal', 'suggest', 'generate',
|
|
162
|
+
'finalize-generated-tests', 'feedback',
|
|
163
|
+
'traceability-capture', 'traceability-ingest',
|
|
164
|
+
'analyze', 'llm-health', 'train', 'crew', 'cost-report', 'gate',
|
|
165
|
+
'bootstrap',
|
|
166
|
+
]);
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// Parser
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
function setField(obj, key, value) {
|
|
171
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
172
|
+
obj[key] = value;
|
|
173
|
+
}
|
|
174
|
+
export function parseArgs(argv) {
|
|
175
|
+
const parsed = { apply: false, help: false };
|
|
176
|
+
if (argv.length === 0) {
|
|
177
|
+
return parsed;
|
|
178
|
+
}
|
|
179
|
+
const command = argv[0];
|
|
180
|
+
if (COMMANDS.has(command)) {
|
|
181
|
+
parsed.command = command;
|
|
182
|
+
}
|
|
183
|
+
const startIndex = parsed.command ? 1 : 0;
|
|
184
|
+
for (let i = startIndex; i < argv.length; i += 1) {
|
|
185
|
+
const arg = argv[i];
|
|
186
|
+
const canonical = ALIAS_MAP[arg];
|
|
187
|
+
if (!canonical) {
|
|
188
|
+
if (arg.startsWith('--')) {
|
|
189
|
+
logger.warn(`Unknown flag "${arg}" (ignored)`);
|
|
190
|
+
}
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const def = FLAGS[canonical];
|
|
194
|
+
const next = argv[i + 1];
|
|
195
|
+
switch (def.type) {
|
|
196
|
+
case 'boolean':
|
|
197
|
+
setField(parsed, def.key, def.transform ? def.transform('') : true);
|
|
198
|
+
break;
|
|
199
|
+
case 'boolean-false':
|
|
200
|
+
setField(parsed, def.key, false);
|
|
201
|
+
break;
|
|
202
|
+
case 'string':
|
|
203
|
+
if (next) {
|
|
204
|
+
setField(parsed, def.key, def.transform ? def.transform(next) : next);
|
|
205
|
+
i += 1;
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
case 'number':
|
|
209
|
+
if (next) {
|
|
210
|
+
const value = Number(next);
|
|
211
|
+
if (Number.isFinite(value)) {
|
|
212
|
+
setField(parsed, def.key, value);
|
|
213
|
+
}
|
|
214
|
+
i += 1;
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case 'number-raw':
|
|
218
|
+
if (next) {
|
|
219
|
+
const rawValue = def.transform ? def.transform(next) : Number(next);
|
|
220
|
+
// Allow non-number transforms through; reject NaN/Infinity for numbers
|
|
221
|
+
if (typeof rawValue === 'number') {
|
|
222
|
+
if (Number.isFinite(rawValue)) {
|
|
223
|
+
setField(parsed, def.key, rawValue);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
setField(parsed, def.key, rawValue);
|
|
228
|
+
}
|
|
229
|
+
i += 1;
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
case 'csv':
|
|
233
|
+
if (next) {
|
|
234
|
+
setField(parsed, def.key, def.transform ? def.transform(next) : csvSplit(next));
|
|
235
|
+
i += 1;
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
case 'enum':
|
|
239
|
+
if (next) {
|
|
240
|
+
if (def.enumValues.includes(next)) {
|
|
241
|
+
setField(parsed, def.key, next);
|
|
242
|
+
}
|
|
243
|
+
i += 1;
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
default:
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return parsed;
|
|
251
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
+
// See LICENSE.txt for license information.
|
|
3
|
+
export function printUsage() {
|
|
4
|
+
console.log([
|
|
5
|
+
'Usage:',
|
|
6
|
+
' impact-gate <command> [options]',
|
|
7
|
+
'',
|
|
8
|
+
'Core CI workflow:',
|
|
9
|
+
' impact --path <app-root> [options]',
|
|
10
|
+
' plan --path <app-root> [options]',
|
|
11
|
+
' suggest --path <app-root> [options]',
|
|
12
|
+
' gate --path <app-root> --threshold <n> [--since <ref>]',
|
|
13
|
+
'',
|
|
14
|
+
'Optional AI workflow:',
|
|
15
|
+
' analyze --path <app-root> [--tests-root <path>] [--since <ref>] [--generate] [--generate-output <dir>] [--heal] [--heal-report <json>]',
|
|
16
|
+
' generate [--scenarios <path|json>] [--max-attempts <n>] [--dry-run]',
|
|
17
|
+
' heal --path <app-root> --traceability-report <json> [options]',
|
|
18
|
+
' finalize-generated-tests --path <app-root> [options]',
|
|
19
|
+
'',
|
|
20
|
+
'Setup and calibration:',
|
|
21
|
+
' init [--yes]',
|
|
22
|
+
' train --path <project-root> [--no-enrich] [--validate] [--since <ref>] [--pr <num>]',
|
|
23
|
+
' bootstrap --path <app-root> [options]',
|
|
24
|
+
' feedback --path <app-root> --feedback-input <json>',
|
|
25
|
+
' traceability-capture --path <app-root> --traceability-report <json>',
|
|
26
|
+
' traceability-ingest --path <app-root> --traceability-input <json>',
|
|
27
|
+
' cost-report [--path <app-root>]',
|
|
28
|
+
' llm-health',
|
|
29
|
+
'',
|
|
30
|
+
'Advanced / experimental:',
|
|
31
|
+
' crew --path <app-root> [--crew-workflow <name>] [--plugins <paths>]',
|
|
32
|
+
'',
|
|
33
|
+
'Options:',
|
|
34
|
+
' --config <path> Path to impact-gate.config.json (auto-discovered if present)',
|
|
35
|
+
' --path <project-root> Path to the project root (scans both frontend and backend)',
|
|
36
|
+
' --profile <name> default | mattermost',
|
|
37
|
+
' --mattermost Shortcut for --profile mattermost',
|
|
38
|
+
' --tests-root <path> Path to tests root (optional)',
|
|
39
|
+
' --framework <name> auto | playwright | cypress | pytest | supertest | selenium',
|
|
40
|
+
' --patterns <globs> Comma-separated test patterns',
|
|
41
|
+
' --flow-patterns <g> Comma-separated flow discovery patterns',
|
|
42
|
+
' --flow-exclude <g> Comma-separated flow exclude patterns',
|
|
43
|
+
' --plugins <paths> Comma-separated plugin module paths for crew workflows',
|
|
44
|
+
' --flow-catalog <path> Path to flow catalog JSON',
|
|
45
|
+
' --allow-fallback Allow impact analysis without diff',
|
|
46
|
+
' --pipeline Run Playwright AI pipeline for missing P0/P1 flows',
|
|
47
|
+
' --pipeline-scenarios Number of scenarios per flow (default 3)',
|
|
48
|
+
' --pipeline-output Output directory for generated tests',
|
|
49
|
+
' --pipeline-base-url Base URL for Playwright runs',
|
|
50
|
+
' --pipeline-browser Browser: chrome|chromium|firefox|webkit',
|
|
51
|
+
' --pipeline-headless Run in headless mode',
|
|
52
|
+
' --pipeline-headed Run in headed mode',
|
|
53
|
+
' --pipeline-project Playwright project name',
|
|
54
|
+
' --pipeline-parallel Enable parallel mode in generator',
|
|
55
|
+
' --pipeline-dry-run Do not execute pipeline (report only)',
|
|
56
|
+
' --pipeline-mcp Use Playwright MCP server for exploration/healing',
|
|
57
|
+
' --pipeline-mcp-allow-fallback Allow non-MCP fallback if official MCP setup fails',
|
|
58
|
+
' --pipeline-mcp-only Require MCP for UI exploration (fail if unavailable)',
|
|
59
|
+
' --pipeline-mcp-timeout-ms <n> Timeout per MCP CLI invocation in milliseconds',
|
|
60
|
+
' --pipeline-mcp-retries <n> Retry count for retryable MCP CLI failures',
|
|
61
|
+
' --spec <path> Optional spec PDF for context',
|
|
62
|
+
' --since <git-ref> Git ref for impact analysis (default HEAD~1)',
|
|
63
|
+
' --time <minutes> Time limit in minutes',
|
|
64
|
+
' --budget-usd <amount> Max LLM budget in USD',
|
|
65
|
+
' --budget-tokens <n> Max LLM tokens',
|
|
66
|
+
' --llm-provider <name> LLM provider: auto | anthropic | openai | ollama',
|
|
67
|
+
' --policy-min-confidence <n> Minimum confidence for targeted suite',
|
|
68
|
+
' --policy-safe-merge-confidence <n> Confidence needed for safe-to-merge',
|
|
69
|
+
' --policy-force-full-on-warnings <n> Escalate to full at warning count',
|
|
70
|
+
' --policy-risky-patterns <globs> Comma-separated risky file globs',
|
|
71
|
+
' --policy-enforcement-mode <mode> advisory | warn | block',
|
|
72
|
+
' --policy-block-actions <actions> Comma-separated CI actions to block/warn',
|
|
73
|
+
' --crew Run Crew enrichment and attach insights to plan output',
|
|
74
|
+
' --crew-workflow <name> full-qa | quick-check | design-only',
|
|
75
|
+
' --ci-comment-path <path> Write CI markdown summary',
|
|
76
|
+
' --github-output <path> Write GitHub Actions outputs',
|
|
77
|
+
' --fail-on-must-add-tests Exit non-zero on must-add-tests decision',
|
|
78
|
+
' --feedback-input <path> Path to recommendation feedback JSON',
|
|
79
|
+
' --traceability-report <path> Path to Playwright JSON report for traceability capture',
|
|
80
|
+
' --traceability-capture-output <path> Output path for generated traceability ingest JSON',
|
|
81
|
+
' --traceability-coverage-map <path> Optional coverage map (test<->files) to enrich traceability capture',
|
|
82
|
+
' --traceability-changed-files <path> Optional changed-files list/JSON fallback for traceability capture',
|
|
83
|
+
' --traceability-input <path> Path to traceability ingest JSON payload',
|
|
84
|
+
' --traceability-min-hits <n> Minimum signal hits required per file mapping',
|
|
85
|
+
' --traceability-max-files-per-test <n> Cap max mapped files per test',
|
|
86
|
+
' --traceability-max-age-days <n> Drop stale mappings older than N days',
|
|
87
|
+
' --branch <name> Optional handoff branch (prefixed with codex/)',
|
|
88
|
+
' --commit-message <m> Commit message for finalize-generated-tests',
|
|
89
|
+
' --create-pr Open PR with gh after commit',
|
|
90
|
+
' --pr-title <title> PR title for finalize-generated-tests',
|
|
91
|
+
' --pr-body <body> PR body for finalize-generated-tests',
|
|
92
|
+
' --pr-base <branch> PR base branch for finalize-generated-tests',
|
|
93
|
+
' (auto-heal-pr defaults to base=master)',
|
|
94
|
+
' --dry-run Preview actions without mutating git state',
|
|
95
|
+
' --max-attempts <n> Max fix attempts per scenario (default: 3)',
|
|
96
|
+
' --scenarios <path|json> Scenarios file/JSON for generate command',
|
|
97
|
+
' --apply Apply data-testid patches and generate tests',
|
|
98
|
+
' (legacy shortcut; prefer approve-and-generate)',
|
|
99
|
+
' --no-enrich Disable LLM enrichment (offline mode, train command)',
|
|
100
|
+
' --validate Validate manifest against git history (train command)',
|
|
101
|
+
' --pr <number> GitHub PR number for validation (requires gh CLI)',
|
|
102
|
+
' --yes, -y Non-interactive mode (train command)',
|
|
103
|
+
' --output <path> Output path for route-families.json (train command)',
|
|
104
|
+
' --help Show help',
|
|
105
|
+
].join('\n'));
|
|
106
|
+
}
|
package/dist/esm/cli.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
|
+
// See LICENSE.txt for license information.
|
|
4
|
+
import { resolveConfig } from './agent/config.js';
|
|
5
|
+
import { parseArgs, resolveAutoConfig } from './cli/parse_args.js';
|
|
6
|
+
import { resolveDefaults } from './cli/defaults.js';
|
|
7
|
+
import { printUsage } from './cli/usage.js';
|
|
8
|
+
import { runLlmHealth } from './cli/commands/llm_health.js';
|
|
9
|
+
import { runAnalyzeCommand } from './cli/commands/analyze.js';
|
|
10
|
+
import { runFeedbackCommand } from './cli/commands/feedback.js';
|
|
11
|
+
import { runTraceabilityCaptureCommand, runTraceabilityIngestCommand } from './cli/commands/traceability.js';
|
|
12
|
+
import { runFinalizeCommand } from './cli/commands/finalize.js';
|
|
13
|
+
import { runHealCommand } from './cli/commands/heal.js';
|
|
14
|
+
import { runImpactCommand } from './cli/commands/impact.js';
|
|
15
|
+
import { runPlanCommand } from './cli/commands/plan.js';
|
|
16
|
+
import { runGenerateCommand } from './cli/commands/generate.js';
|
|
17
|
+
import { runInitCommand } from './cli/commands/init.js';
|
|
18
|
+
import { runTrainCommand } from './cli/commands/train.js';
|
|
19
|
+
import { runCrewCommand } from './cli/commands/crew.js';
|
|
20
|
+
import { runCostReportCommand } from './cli/commands/cost_report.js';
|
|
21
|
+
import { runGateCommand } from './cli/commands/gate.js';
|
|
22
|
+
import { runBootstrapCommand } from './cli/commands/bootstrap.js';
|
|
23
|
+
import { classifyError, EXIT_CODES } from './cli/errors.js';
|
|
24
|
+
// Commands that skip default resolution (they handle their own setup)
|
|
25
|
+
const SKIP_DEFAULTS_COMMANDS = new Set(['init', 'llm-health', 'cost-report', 'bootstrap']);
|
|
26
|
+
// Commands that need path/testsRoot/framework/since
|
|
27
|
+
const NEEDS_DEFAULTS_COMMANDS = new Set([
|
|
28
|
+
'impact', 'plan', 'suggest', 'crew', 'generate', 'heal', 'analyze', 'train',
|
|
29
|
+
'feedback', 'traceability-capture', 'traceability-ingest', 'finalize-generated-tests',
|
|
30
|
+
]);
|
|
31
|
+
async function main() {
|
|
32
|
+
const args = parseArgs(process.argv.slice(2));
|
|
33
|
+
const autoConfig = resolveAutoConfig(args);
|
|
34
|
+
// Auto-detect defaults for commands that need them (when no config file found)
|
|
35
|
+
if (args.command && NEEDS_DEFAULTS_COMMANDS.has(args.command) && !SKIP_DEFAULTS_COMMANDS.has(args.command)) {
|
|
36
|
+
const defaults = resolveDefaults({
|
|
37
|
+
path: args.path,
|
|
38
|
+
testsRoot: args.testsRoot,
|
|
39
|
+
framework: args.framework,
|
|
40
|
+
gitSince: args.gitSince,
|
|
41
|
+
});
|
|
42
|
+
args.path = args.path || defaults.path;
|
|
43
|
+
args.testsRoot = args.testsRoot || defaults.testsRoot;
|
|
44
|
+
args.framework = args.framework || defaults.framework;
|
|
45
|
+
args.gitSince = args.gitSince || defaults.since;
|
|
46
|
+
}
|
|
47
|
+
if (args.command === 'init') {
|
|
48
|
+
const hasYes = process.argv.includes('--yes') || process.argv.includes('-y');
|
|
49
|
+
await runInitCommand(hasYes);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (args.command === 'bootstrap') {
|
|
53
|
+
await runBootstrapCommand(args);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (args.command === 'train') {
|
|
57
|
+
await runTrainCommand(args, autoConfig);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (args.help) {
|
|
61
|
+
printUsage();
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
64
|
+
if (!args.command) {
|
|
65
|
+
printUsage();
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
if (args.command === 'llm-health') {
|
|
69
|
+
await runLlmHealth();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (args.command === 'analyze') {
|
|
73
|
+
await runAnalyzeCommand(args, autoConfig);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (args.command === 'feedback') {
|
|
77
|
+
runFeedbackCommand(args, autoConfig);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (args.command === 'traceability-capture') {
|
|
81
|
+
runTraceabilityCaptureCommand(args, autoConfig);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (args.command === 'traceability-ingest') {
|
|
85
|
+
runTraceabilityIngestCommand(args, autoConfig);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (args.command === 'finalize-generated-tests') {
|
|
89
|
+
runFinalizeCommand(args, autoConfig);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (args.command === 'heal') {
|
|
93
|
+
runHealCommand(args, autoConfig);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (args.command === 'crew') {
|
|
97
|
+
await runCrewCommand(args, autoConfig);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (args.command === 'cost-report') {
|
|
101
|
+
runCostReportCommand(args);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (args.command === 'gate') {
|
|
105
|
+
await runGateCommand(args, autoConfig);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (!args.path && !autoConfig) {
|
|
109
|
+
console.error('Error: --path is required (or provide a config file with path set)');
|
|
110
|
+
printUsage();
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
const { config } = resolveConfig(process.cwd(), autoConfig, {
|
|
114
|
+
path: args.path,
|
|
115
|
+
profile: args.profile,
|
|
116
|
+
testsRoot: args.testsRoot,
|
|
117
|
+
mode: 'impact',
|
|
118
|
+
framework: args.framework,
|
|
119
|
+
timeLimitMinutes: args.timeLimitMinutes,
|
|
120
|
+
budget: {
|
|
121
|
+
maxUSD: args.budgetUSD,
|
|
122
|
+
maxTokens: args.budgetTokens,
|
|
123
|
+
},
|
|
124
|
+
testPatterns: args.testPatterns,
|
|
125
|
+
flowPatterns: args.flowPatterns,
|
|
126
|
+
flowExclude: args.flowExclude,
|
|
127
|
+
flowCatalogPath: args.flowCatalogPath,
|
|
128
|
+
specPDF: args.specPDF,
|
|
129
|
+
gitSince: args.gitSince,
|
|
130
|
+
llmProvider: args.llmProvider,
|
|
131
|
+
pipeline: args.pipeline
|
|
132
|
+
? {
|
|
133
|
+
enabled: true,
|
|
134
|
+
scenarios: args.pipelineScenarios,
|
|
135
|
+
outputDir: args.pipelineOutput,
|
|
136
|
+
baseUrl: args.pipelineBaseUrl,
|
|
137
|
+
browser: args.pipelineBrowser,
|
|
138
|
+
headless: args.pipelineHeadless,
|
|
139
|
+
project: args.pipelineProject,
|
|
140
|
+
parallel: args.pipelineParallel,
|
|
141
|
+
dryRun: args.pipelineDryRun,
|
|
142
|
+
mcp: args.pipelineMcp,
|
|
143
|
+
mcpAllowFallback: args.pipelineMcpAllowFallback,
|
|
144
|
+
mcpOnly: args.pipelineMcpOnly,
|
|
145
|
+
mcpCommandTimeoutMs: args.pipelineMcpTimeoutMs,
|
|
146
|
+
mcpRetries: args.pipelineMcpRetries,
|
|
147
|
+
}
|
|
148
|
+
: undefined,
|
|
149
|
+
policy: args.policyMinConfidence !== undefined ||
|
|
150
|
+
args.policySafeMergeConfidence !== undefined ||
|
|
151
|
+
args.policyWarningsThreshold !== undefined ||
|
|
152
|
+
(args.policyRiskyPatterns && args.policyRiskyPatterns.length > 0) ||
|
|
153
|
+
args.policyEnforcementMode !== undefined ||
|
|
154
|
+
(args.policyBlockActions && args.policyBlockActions.length > 0)
|
|
155
|
+
? {
|
|
156
|
+
minConfidenceForTargeted: args.policyMinConfidence,
|
|
157
|
+
safeMergeMinConfidence: args.policySafeMergeConfidence,
|
|
158
|
+
forceFullOnWarningsAtOrAbove: args.policyWarningsThreshold,
|
|
159
|
+
riskyFilePatterns: args.policyRiskyPatterns,
|
|
160
|
+
enforcementMode: args.policyEnforcementMode,
|
|
161
|
+
blockOnActions: args.policyBlockActions,
|
|
162
|
+
}
|
|
163
|
+
: undefined,
|
|
164
|
+
});
|
|
165
|
+
if (args.command === 'impact') {
|
|
166
|
+
runImpactCommand(args, config);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (args.command === 'suggest' || args.command === 'plan') {
|
|
170
|
+
await runPlanCommand(args, autoConfig, config);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (args.command === 'generate') {
|
|
174
|
+
await runGenerateCommand(args, config);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
console.error(`Unknown command: ${args.command}`);
|
|
178
|
+
printUsage();
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
main().catch((error) => {
|
|
182
|
+
const exitCode = classifyError(error);
|
|
183
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
184
|
+
console.error(message);
|
|
185
|
+
if (exitCode === EXIT_CODES.BUDGET_EXCEEDED) {
|
|
186
|
+
console.error('Hint: Increase --budget or use --degraded-mode to skip AI features.');
|
|
187
|
+
}
|
|
188
|
+
else if (exitCode === EXIT_CODES.PROVIDER_UNAVAILABLE) {
|
|
189
|
+
console.error('Hint: Check API key or use --degraded-mode for deterministic analysis only.');
|
|
190
|
+
}
|
|
191
|
+
process.exit(exitCode);
|
|
192
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
+
// See LICENSE.txt for license information.
|
|
3
|
+
export function createEmptyUsageStats() {
|
|
4
|
+
const now = new Date();
|
|
5
|
+
return {
|
|
6
|
+
requestCount: 0,
|
|
7
|
+
totalInputTokens: 0,
|
|
8
|
+
totalOutputTokens: 0,
|
|
9
|
+
totalTokens: 0,
|
|
10
|
+
totalCost: 0,
|
|
11
|
+
averageResponseTimeMs: 0,
|
|
12
|
+
failedRequests: 0,
|
|
13
|
+
startTime: now,
|
|
14
|
+
lastUpdated: now,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function mergeUsageStats(target, source) {
|
|
18
|
+
const prevRequestCount = target.requestCount;
|
|
19
|
+
target.requestCount += source.requestCount;
|
|
20
|
+
target.totalInputTokens += source.totalInputTokens;
|
|
21
|
+
target.totalOutputTokens += source.totalOutputTokens;
|
|
22
|
+
target.totalTokens += source.totalTokens;
|
|
23
|
+
target.totalCost += source.totalCost;
|
|
24
|
+
target.failedRequests += source.failedRequests;
|
|
25
|
+
if (source.requestCount > 0 && target.requestCount > 0) {
|
|
26
|
+
const prevWeight = prevRequestCount / target.requestCount;
|
|
27
|
+
const newWeight = source.requestCount / target.requestCount;
|
|
28
|
+
target.averageResponseTimeMs =
|
|
29
|
+
target.averageResponseTimeMs * prevWeight + source.averageResponseTimeMs * newWeight;
|
|
30
|
+
}
|
|
31
|
+
target.lastUpdated = new Date();
|
|
32
|
+
}
|