@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,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
|
+
// See LICENSE.txt for license information.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.ResponseCache = exports.TTL = void 0;
|
|
39
|
+
const fs = __importStar(require("node:fs"));
|
|
40
|
+
const path = __importStar(require("node:path"));
|
|
41
|
+
const crypto = __importStar(require("node:crypto"));
|
|
42
|
+
/**
|
|
43
|
+
* TTL presets for different cache entry types.
|
|
44
|
+
*/
|
|
45
|
+
exports.TTL = {
|
|
46
|
+
/** 24 hours - for analysis results that change infrequently */
|
|
47
|
+
ANALYSIS: 24 * 60 * 60 * 1000,
|
|
48
|
+
/** 1 hour - for generated content that may need fresher context */
|
|
49
|
+
GENERATION: 1 * 60 * 60 * 1000,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Cross-run LLM response cache backed by JSON files.
|
|
53
|
+
*
|
|
54
|
+
* Stores entries as `{cacheDir}/{sha256}.json` using a content-addressed key
|
|
55
|
+
* derived from (agentRole + familyName + sorted file hashes + model).
|
|
56
|
+
*/
|
|
57
|
+
class ResponseCache {
|
|
58
|
+
constructor(workspaceRoot) {
|
|
59
|
+
this.cacheDir = path.join(workspaceRoot, '.e2e-ai-agents', 'cache');
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Build a deterministic SHA-256 cache key from the provided parameters.
|
|
63
|
+
*/
|
|
64
|
+
static buildKey(params) {
|
|
65
|
+
const sorted = [...params.fileHashes].sort();
|
|
66
|
+
const payload = params.agent + params.family + JSON.stringify(sorted) + params.model;
|
|
67
|
+
return crypto.createHash('sha256').update(payload).digest('hex');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Retrieve a cached response if it exists and has not expired.
|
|
71
|
+
* Returns `null` on cache miss or expiry.
|
|
72
|
+
*/
|
|
73
|
+
get(agent, family, fileHashes, model) {
|
|
74
|
+
const key = ResponseCache.buildKey({ agent, family, fileHashes, model });
|
|
75
|
+
const filePath = path.join(this.cacheDir, `${key}.json`);
|
|
76
|
+
try {
|
|
77
|
+
if (!fs.existsSync(filePath)) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
81
|
+
const entry = JSON.parse(raw);
|
|
82
|
+
const age = Date.now() - new Date(entry.createdAt).getTime();
|
|
83
|
+
if (age > entry.ttlMs) {
|
|
84
|
+
// Expired - clean up eagerly
|
|
85
|
+
fs.unlinkSync(filePath);
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return entry;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Corrupted or unreadable - treat as miss
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Write a cache entry to disk.
|
|
97
|
+
* Creates the cache directory if it does not yet exist.
|
|
98
|
+
*/
|
|
99
|
+
set(entry) {
|
|
100
|
+
this.ensureCacheDir();
|
|
101
|
+
const filePath = path.join(this.cacheDir, `${entry.key}.json`);
|
|
102
|
+
fs.writeFileSync(filePath, JSON.stringify(entry, null, 2), 'utf-8');
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Remove all cache entries belonging to the given family.
|
|
106
|
+
*
|
|
107
|
+
* Because the cache key is a one-way SHA-256 hash, we scan each file and
|
|
108
|
+
* check its stored `family` field. The directory is scoped to a single
|
|
109
|
+
* workspace so the scan is bounded.
|
|
110
|
+
*/
|
|
111
|
+
invalidateFamily(familyName) {
|
|
112
|
+
if (!fs.existsSync(this.cacheDir)) {
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
let deleted = 0;
|
|
116
|
+
const files = fs.readdirSync(this.cacheDir).filter((f) => f.endsWith('.json'));
|
|
117
|
+
for (const file of files) {
|
|
118
|
+
const filePath = path.join(this.cacheDir, file);
|
|
119
|
+
try {
|
|
120
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
121
|
+
const entry = JSON.parse(raw);
|
|
122
|
+
if (entry.family === familyName) {
|
|
123
|
+
fs.unlinkSync(filePath);
|
|
124
|
+
deleted++;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Skip unreadable files
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return deleted;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Remove all expired entries from the cache directory.
|
|
135
|
+
* Returns the number of entries deleted.
|
|
136
|
+
*/
|
|
137
|
+
prune() {
|
|
138
|
+
if (!fs.existsSync(this.cacheDir)) {
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
let deleted = 0;
|
|
142
|
+
const now = Date.now();
|
|
143
|
+
const files = fs.readdirSync(this.cacheDir).filter((f) => f.endsWith('.json'));
|
|
144
|
+
for (const file of files) {
|
|
145
|
+
const filePath = path.join(this.cacheDir, file);
|
|
146
|
+
try {
|
|
147
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
148
|
+
const entry = JSON.parse(raw);
|
|
149
|
+
const age = now - new Date(entry.createdAt).getTime();
|
|
150
|
+
if (age > entry.ttlMs) {
|
|
151
|
+
fs.unlinkSync(filePath);
|
|
152
|
+
deleted++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// Corrupted file - remove it
|
|
157
|
+
try {
|
|
158
|
+
fs.unlinkSync(filePath);
|
|
159
|
+
deleted++;
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
// Ignore if removal also fails
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return deleted;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Ensure the cache directory exists on disk.
|
|
170
|
+
*/
|
|
171
|
+
ensureCacheDir() {
|
|
172
|
+
if (!fs.existsSync(this.cacheDir)) {
|
|
173
|
+
fs.mkdirSync(this.cacheDir, { recursive: true });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.ResponseCache = ResponseCache;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/analyze.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAE5C,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAyEvG"}
|
|
@@ -0,0 +1,77 @@
|
|
|
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.runAnalyzeCommand = runAnalyzeCommand;
|
|
6
|
+
const config_js_1 = require("../../agent/config.js");
|
|
7
|
+
const orchestrator_js_1 = require("../../pipeline/orchestrator.js");
|
|
8
|
+
async function runAnalyzeCommand(args, autoConfig) {
|
|
9
|
+
if (!args.path && !autoConfig) {
|
|
10
|
+
console.error('Error: --path is required for analyze command');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
const { config } = (0, config_js_1.resolveConfig)(process.cwd(), autoConfig, {
|
|
14
|
+
path: args.path,
|
|
15
|
+
profile: args.profile,
|
|
16
|
+
testsRoot: args.testsRoot,
|
|
17
|
+
mode: 'impact',
|
|
18
|
+
gitSince: args.gitSince,
|
|
19
|
+
llmProvider: args.llmProvider,
|
|
20
|
+
});
|
|
21
|
+
const testsRoot = config.testsRoot || config.path;
|
|
22
|
+
const analyzeStages = [
|
|
23
|
+
'preprocess', 'impact', 'coverage',
|
|
24
|
+
];
|
|
25
|
+
if (args.analyzeGenerate) {
|
|
26
|
+
analyzeStages.push('generation');
|
|
27
|
+
}
|
|
28
|
+
if (args.analyzeHeal || args.analyzeHealReport) {
|
|
29
|
+
analyzeStages.push('heal');
|
|
30
|
+
}
|
|
31
|
+
const result = await (0, orchestrator_js_1.runPipeline)({
|
|
32
|
+
appPath: config.path,
|
|
33
|
+
testsRoot,
|
|
34
|
+
gitSince: args.gitSince || config.git.since,
|
|
35
|
+
routeFamilies: config.routeFamilies,
|
|
36
|
+
apiSurface: config.apiSurface,
|
|
37
|
+
stages: analyzeStages,
|
|
38
|
+
generation: args.analyzeGenerate
|
|
39
|
+
? {
|
|
40
|
+
defaultOutputDir: args.analyzeGenerateOutputDir || 'specs/functional/ai-assisted',
|
|
41
|
+
dryRun: args.dryRun,
|
|
42
|
+
}
|
|
43
|
+
: undefined,
|
|
44
|
+
heal: (args.analyzeHeal || args.analyzeHealReport)
|
|
45
|
+
? {
|
|
46
|
+
mcp: args.pipelineMcp ?? true,
|
|
47
|
+
mcpAllowFallback: args.pipelineMcpAllowFallback ?? false,
|
|
48
|
+
mcpOnly: args.pipelineMcpOnly ?? false,
|
|
49
|
+
mcpCommandTimeoutMs: args.pipelineMcpTimeoutMs,
|
|
50
|
+
mcpRetries: args.pipelineMcpRetries ?? 1,
|
|
51
|
+
dryRun: args.dryRun,
|
|
52
|
+
}
|
|
53
|
+
: undefined,
|
|
54
|
+
playwrightReportPath: args.analyzeHealReport,
|
|
55
|
+
});
|
|
56
|
+
console.log(`Analyze report: ${result.reportPath}`);
|
|
57
|
+
console.log(`Analyze flows identified: ${result.report.summary.flowsIdentified}`);
|
|
58
|
+
console.log(`Analyze flows covered: ${result.report.summary.flowsCovered}`);
|
|
59
|
+
console.log(`Analyze flows uncovered: ${result.report.summary.flowsUncovered}`);
|
|
60
|
+
console.log(`Analyze overall confidence: ${result.report.summary.overallConfidence}`);
|
|
61
|
+
console.log(`Analyze route families: ${result.report.summary.routeFamiliesImpacted.join(', ') || 'none'}`);
|
|
62
|
+
if (result.generated && result.generated.length > 0) {
|
|
63
|
+
const written = result.generated.filter((g) => g.written).length;
|
|
64
|
+
console.log(`Analyze generated specs: ${result.generated.length} (written=${written})`);
|
|
65
|
+
for (const g of result.generated) {
|
|
66
|
+
console.log(` ${g.mode}: ${g.specPath}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (result.healResult) {
|
|
70
|
+
const healed = result.healResult.summary.results.filter((r) => r.healStatus === 'success').length;
|
|
71
|
+
const healFailed = result.healResult.summary.results.filter((r) => r.healStatus === 'failed').length;
|
|
72
|
+
console.log(`Analyze heal targets: ${result.healResult.targets.length} (healed=${healed}, failed=${healFailed})`);
|
|
73
|
+
}
|
|
74
|
+
if (result.warnings.length > 0) {
|
|
75
|
+
console.log(`Analyze warnings: ${result.warnings.join(' | ')}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/bootstrap.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAS5C,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAoGzE"}
|
|
@@ -0,0 +1,109 @@
|
|
|
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.runBootstrapCommand = runBootstrapCommand;
|
|
6
|
+
/**
|
|
7
|
+
* Bootstrap command — takes a project with an Understand-Anything knowledge graph
|
|
8
|
+
* and generates route-families.json + initial test stubs.
|
|
9
|
+
*/
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const logger_js_1 = require("../../logger.js");
|
|
13
|
+
const kg_bridge_js_1 = require("../../knowledge/kg_bridge.js");
|
|
14
|
+
const route_families_js_1 = require("../../knowledge/route_families.js");
|
|
15
|
+
const framework_adapter_js_1 = require("../../adapters/framework_adapter.js");
|
|
16
|
+
const generation_profile_js_1 = require("../../prompts/generation_profile.js");
|
|
17
|
+
class BootstrapError extends Error {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'BootstrapError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function runBootstrapCommand(args) {
|
|
24
|
+
const projectRoot = (0, path_1.resolve)(args.path || '.');
|
|
25
|
+
if (args.verbose)
|
|
26
|
+
logger_js_1.logger.setLevel(logger_js_1.LogLevel.DEBUG);
|
|
27
|
+
if (args.jsonOutput)
|
|
28
|
+
logger_js_1.logger.setJsonMode(true);
|
|
29
|
+
logger_js_1.logger.info('impact-gate bootstrap');
|
|
30
|
+
logger_js_1.logger.info('=======================');
|
|
31
|
+
// ---------- Step 1: Check for knowledge graph ----------
|
|
32
|
+
const kgPath = args.bootstrapKgPath
|
|
33
|
+
? (0, path_1.resolve)(args.bootstrapKgPath)
|
|
34
|
+
: (0, path_1.join)(projectRoot, '.understand-anything', 'knowledge-graph.json');
|
|
35
|
+
if (!(0, fs_1.existsSync)(kgPath)) {
|
|
36
|
+
throw new BootstrapError(`Knowledge graph not found at: ${kgPath}\n\n` +
|
|
37
|
+
'To bootstrap, first generate a knowledge graph for your project:\n' +
|
|
38
|
+
' 1. Install Understand-Anything: npm install -g understand-anything\n' +
|
|
39
|
+
' 2. Run: understand-anything analyze .\n' +
|
|
40
|
+
' 3. Then run: impact-gate bootstrap\n\n' +
|
|
41
|
+
'Or provide a path: impact-gate bootstrap --kg-path /path/to/knowledge-graph.json');
|
|
42
|
+
}
|
|
43
|
+
// ---------- Step 2: Load KG and classify ----------
|
|
44
|
+
logger_js_1.logger.info('Loading knowledge graph...');
|
|
45
|
+
const kg = (0, kg_bridge_js_1.loadKnowledgeGraph)(projectRoot, args.bootstrapKgPath ? kgPath : undefined);
|
|
46
|
+
if (!kg) {
|
|
47
|
+
throw new BootstrapError('Failed to load knowledge graph. Ensure it is valid JSON with nodes and edges arrays.');
|
|
48
|
+
}
|
|
49
|
+
const projectType = (0, kg_bridge_js_1.classifyProjectType)(kg);
|
|
50
|
+
logger_js_1.logger.info(`Project: ${kg.project.name || '(unnamed)'}`);
|
|
51
|
+
logger_js_1.logger.info(`Type: ${projectType}`);
|
|
52
|
+
logger_js_1.logger.info(`Frameworks: ${kg.project.frameworks.join(', ')}`);
|
|
53
|
+
logger_js_1.logger.info(`Languages: ${kg.project.languages.join(', ')}`);
|
|
54
|
+
logger_js_1.logger.info(`Nodes: ${kg.nodes.length}, Edges: ${kg.edges.length}`);
|
|
55
|
+
// ---------- Step 3: Transform KG to route families ----------
|
|
56
|
+
logger_js_1.logger.info('');
|
|
57
|
+
logger_js_1.logger.info('Generating route families from knowledge graph...');
|
|
58
|
+
const manifest = (0, kg_bridge_js_1.transformKGToFamilies)(kg);
|
|
59
|
+
const maxFamilies = args.bootstrapMaxFamilies || 50;
|
|
60
|
+
if (manifest.families.length > maxFamilies) {
|
|
61
|
+
logger_js_1.logger.info(`Limiting to top ${maxFamilies} families (of ${manifest.families.length} discovered). Use --max-families to adjust.`);
|
|
62
|
+
manifest.families = manifest.families.slice(0, maxFamilies);
|
|
63
|
+
}
|
|
64
|
+
const p0Count = manifest.families.filter((f) => f.priority === 'P0').length;
|
|
65
|
+
const p1Count = manifest.families.filter((f) => f.priority === 'P1').length;
|
|
66
|
+
const p2Count = manifest.families.filter((f) => f.priority === 'P2').length;
|
|
67
|
+
logger_js_1.logger.info(`Discovered ${manifest.families.length} families: ${p0Count} P0, ${p1Count} P1, ${p2Count} P2`);
|
|
68
|
+
// ---------- Step 4: Detect/scaffold test framework ----------
|
|
69
|
+
const framework = (0, framework_adapter_js_1.detectFramework)(projectRoot);
|
|
70
|
+
const testMode = args.bootstrapTestMode || (0, framework_adapter_js_1.detectTestMode)(projectRoot, kg);
|
|
71
|
+
const profile = (0, generation_profile_js_1.resolveGenerationProfile)({ profile: args.profile, testMode }, kg);
|
|
72
|
+
logger_js_1.logger.info(`Test framework: ${framework.name}`);
|
|
73
|
+
logger_js_1.logger.info(`Test mode: ${testMode}`);
|
|
74
|
+
logger_js_1.logger.info(`Generation profile: ${profile.projectName} (${profile.testFramework})`);
|
|
75
|
+
// ---------- Step 5: Write route-families.json ----------
|
|
76
|
+
const outputDir = (0, path_1.join)(projectRoot, '.e2e-ai-agents');
|
|
77
|
+
const outputPath = (0, path_1.join)(outputDir, 'route-families.json');
|
|
78
|
+
if (args.dryRun) {
|
|
79
|
+
logger_js_1.logger.info('');
|
|
80
|
+
logger_js_1.logger.info('Dry run — proposed manifest:');
|
|
81
|
+
console.log((0, route_families_js_1.serializeManifest)(manifest));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
if (!(0, fs_1.existsSync)(outputDir)) {
|
|
85
|
+
(0, fs_1.mkdirSync)(outputDir, { recursive: true });
|
|
86
|
+
}
|
|
87
|
+
(0, fs_1.writeFileSync)(outputPath, (0, route_families_js_1.serializeManifest)(manifest), 'utf-8');
|
|
88
|
+
logger_js_1.logger.info(`Wrote ${outputPath}`);
|
|
89
|
+
}
|
|
90
|
+
// ---------- Step 6: Summary and next steps ----------
|
|
91
|
+
logger_js_1.logger.info('');
|
|
92
|
+
logger_js_1.logger.info('Bootstrap complete!');
|
|
93
|
+
logger_js_1.logger.info('');
|
|
94
|
+
logger_js_1.logger.info('Route families summary:');
|
|
95
|
+
for (const family of manifest.families.slice(0, 15)) {
|
|
96
|
+
const endpoints = family.apiEndpoints?.length || 0;
|
|
97
|
+
const endpointSuffix = endpoints > 0 ? ` (${endpoints} API endpoints)` : '';
|
|
98
|
+
logger_js_1.logger.info(` ${family.priority || 'P2'} ${family.id}: ${family.routes.join(', ')}${endpointSuffix}`);
|
|
99
|
+
}
|
|
100
|
+
if (manifest.families.length > 15) {
|
|
101
|
+
logger_js_1.logger.info(` ... and ${manifest.families.length - 15} more`);
|
|
102
|
+
}
|
|
103
|
+
logger_js_1.logger.info('');
|
|
104
|
+
logger_js_1.logger.info('Next steps:');
|
|
105
|
+
logger_js_1.logger.info(' 1. Review and refine .e2e-ai-agents/route-families.json');
|
|
106
|
+
logger_js_1.logger.info(' 2. Run `impact-gate train --enrich` to add LLM-enriched metadata');
|
|
107
|
+
logger_js_1.logger.info(' 3. Run `impact-gate plan` to see what tests are needed');
|
|
108
|
+
logger_js_1.logger.info(' 4. Run `impact-gate generate` to create test stubs');
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost_report.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/cost_report.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AA8C5C,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAgE3D"}
|
|
@@ -0,0 +1,115 @@
|
|
|
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.runCostReportCommand = runCostReportCommand;
|
|
6
|
+
/**
|
|
7
|
+
* CLI command: cost-report — displays LLM cost breakdown from metrics.
|
|
8
|
+
*/
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
function parseMetricsFile(filePath) {
|
|
12
|
+
if (!(0, fs_1.existsSync)(filePath)) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
const lines = (0, fs_1.readFileSync)(filePath, 'utf-8').split('\n');
|
|
16
|
+
const events = [];
|
|
17
|
+
for (const line of lines) {
|
|
18
|
+
const trimmed = line.trim();
|
|
19
|
+
if (!trimmed)
|
|
20
|
+
continue;
|
|
21
|
+
try {
|
|
22
|
+
const parsed = JSON.parse(trimmed);
|
|
23
|
+
if (parsed.type === 'crew-run') {
|
|
24
|
+
events.push(parsed);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return events;
|
|
32
|
+
}
|
|
33
|
+
function filterByDays(events, days) {
|
|
34
|
+
const cutoff = Date.now() - days * 24 * 60 * 60 * 1000;
|
|
35
|
+
return events.filter((e) => new Date(e.timestamp).getTime() >= cutoff);
|
|
36
|
+
}
|
|
37
|
+
function runCostReportCommand(args) {
|
|
38
|
+
const reportRoot = args.path || args.testsRoot || process.cwd();
|
|
39
|
+
const metricsPath = (0, path_1.join)(reportRoot, '.e2e-ai-agents', 'metrics.jsonl');
|
|
40
|
+
const days = 30; // Default; could be added as a CLI flag later
|
|
41
|
+
const allEvents = parseMetricsFile(metricsPath);
|
|
42
|
+
const events = filterByDays(allEvents, days);
|
|
43
|
+
if (events.length === 0) {
|
|
44
|
+
console.log('No crew metrics found.');
|
|
45
|
+
if (!(0, fs_1.existsSync)(metricsPath)) {
|
|
46
|
+
console.log(`Metrics file not found at: ${metricsPath}`);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.log('Run `impact-gate crew` to generate cost data.');
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// JSON output
|
|
54
|
+
if (args.jsonOutput) {
|
|
55
|
+
const report = buildReport(events, days);
|
|
56
|
+
console.log(JSON.stringify(report, null, 2));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// Human-readable output
|
|
60
|
+
const totalCost = events.reduce((sum, e) => sum + e.totalCost, 0);
|
|
61
|
+
const totalRuns = events.length;
|
|
62
|
+
console.log(`Impact Gate Cost Report (last ${days} days)`);
|
|
63
|
+
console.log('='.repeat(45));
|
|
64
|
+
console.log(`\nTotal: $${totalCost.toFixed(2)} across ${totalRuns} runs\n`);
|
|
65
|
+
// By workflow
|
|
66
|
+
const byWorkflow = new Map();
|
|
67
|
+
for (const e of events) {
|
|
68
|
+
const entry = byWorkflow.get(e.workflow) || { runs: 0, cost: 0 };
|
|
69
|
+
entry.runs++;
|
|
70
|
+
entry.cost += e.totalCost;
|
|
71
|
+
byWorkflow.set(e.workflow, entry);
|
|
72
|
+
}
|
|
73
|
+
console.log('By workflow:');
|
|
74
|
+
for (const [workflow, data] of [...byWorkflow.entries()].sort((a, b) => b[1].cost - a[1].cost)) {
|
|
75
|
+
const avg = data.cost / data.runs;
|
|
76
|
+
console.log(` ${workflow.padEnd(14)} | ${String(data.runs).padStart(3)} runs | $${data.cost.toFixed(2).padStart(6)} | avg $${avg.toFixed(2)}/run`);
|
|
77
|
+
}
|
|
78
|
+
// By agent (top 5)
|
|
79
|
+
const byAgent = new Map();
|
|
80
|
+
for (const e of events) {
|
|
81
|
+
for (const au of e.agentUsage) {
|
|
82
|
+
byAgent.set(au.agent, (byAgent.get(au.agent) || 0) + au.cost);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const sortedAgents = [...byAgent.entries()].sort((a, b) => b[1] - a[1]).slice(0, 5);
|
|
86
|
+
if (sortedAgents.length > 0) {
|
|
87
|
+
console.log('\nBy agent (top 5):');
|
|
88
|
+
for (const [agent, cost] of sortedAgents) {
|
|
89
|
+
const pct = totalCost > 0 ? ((cost / totalCost) * 100).toFixed(0) : '0';
|
|
90
|
+
console.log(` ${agent.padEnd(20)} | $${cost.toFixed(2).padStart(6)} | ${pct.padStart(3)}%`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function buildReport(events, days) {
|
|
95
|
+
const totalCost = events.reduce((sum, e) => sum + e.totalCost, 0);
|
|
96
|
+
const byWorkflow = {};
|
|
97
|
+
const byAgent = {};
|
|
98
|
+
for (const e of events) {
|
|
99
|
+
if (!byWorkflow[e.workflow]) {
|
|
100
|
+
byWorkflow[e.workflow] = { runs: 0, cost: 0 };
|
|
101
|
+
}
|
|
102
|
+
byWorkflow[e.workflow].runs++;
|
|
103
|
+
byWorkflow[e.workflow].cost += e.totalCost;
|
|
104
|
+
for (const au of e.agentUsage) {
|
|
105
|
+
byAgent[au.agent] = (byAgent[au.agent] || 0) + au.cost;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
days,
|
|
110
|
+
totalRuns: events.length,
|
|
111
|
+
totalCost,
|
|
112
|
+
byWorkflow,
|
|
113
|
+
byAgent,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crew.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/crew.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAI5C,wBAAsB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CA+KpG"}
|