@peakinfer/cli 1.0.133
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/.claude/settings.local.json +8 -0
- package/.env.example +6 -0
- package/.github/workflows/peakinfer.yml +64 -0
- package/CHANGELOG.md +31 -0
- package/LICENSE +190 -0
- package/README.md +335 -0
- package/data/inferencemax.json +274 -0
- package/dist/agent-analyzer.d.ts +45 -0
- package/dist/agent-analyzer.d.ts.map +1 -0
- package/dist/agent-analyzer.js +374 -0
- package/dist/agent-analyzer.js.map +1 -0
- package/dist/agent.d.ts +76 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +965 -0
- package/dist/agent.js.map +1 -0
- package/dist/agents/correlation-analyzer.d.ts +34 -0
- package/dist/agents/correlation-analyzer.d.ts.map +1 -0
- package/dist/agents/correlation-analyzer.js +261 -0
- package/dist/agents/correlation-analyzer.js.map +1 -0
- package/dist/agents/index.d.ts +91 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +111 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/runtime-analyzer.d.ts +38 -0
- package/dist/agents/runtime-analyzer.d.ts.map +1 -0
- package/dist/agents/runtime-analyzer.js +244 -0
- package/dist/agents/runtime-analyzer.js.map +1 -0
- package/dist/analysis-types.d.ts +500 -0
- package/dist/analysis-types.d.ts.map +1 -0
- package/dist/analysis-types.js +11 -0
- package/dist/analysis-types.js.map +1 -0
- package/dist/analytics.d.ts +25 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +94 -0
- package/dist/analytics.js.map +1 -0
- package/dist/analyzer.d.ts +48 -0
- package/dist/analyzer.d.ts.map +1 -0
- package/dist/analyzer.js +547 -0
- package/dist/analyzer.js.map +1 -0
- package/dist/artifacts.d.ts +44 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +165 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/benchmarks/index.d.ts +88 -0
- package/dist/benchmarks/index.d.ts.map +1 -0
- package/dist/benchmarks/index.js +205 -0
- package/dist/benchmarks/index.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +427 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/ci.d.ts +19 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +253 -0
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/config.d.ts +16 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +249 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/demo.d.ts +15 -0
- package/dist/commands/demo.d.ts.map +1 -0
- package/dist/commands/demo.js +106 -0
- package/dist/commands/demo.js.map +1 -0
- package/dist/commands/export.d.ts +14 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +209 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/history.d.ts +15 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +389 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/template.d.ts +14 -0
- package/dist/commands/template.d.ts.map +1 -0
- package/dist/commands/template.js +341 -0
- package/dist/commands/template.js.map +1 -0
- package/dist/commands/validate-map.d.ts +12 -0
- package/dist/commands/validate-map.d.ts.map +1 -0
- package/dist/commands/validate-map.js +274 -0
- package/dist/commands/validate-map.js.map +1 -0
- package/dist/commands/whatif.d.ts +17 -0
- package/dist/commands/whatif.d.ts.map +1 -0
- package/dist/commands/whatif.js +206 -0
- package/dist/commands/whatif.js.map +1 -0
- package/dist/comparison.d.ts +38 -0
- package/dist/comparison.d.ts.map +1 -0
- package/dist/comparison.js +223 -0
- package/dist/comparison.js.map +1 -0
- package/dist/config.d.ts +42 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +158 -0
- package/dist/config.js.map +1 -0
- package/dist/connectors/helicone.d.ts +9 -0
- package/dist/connectors/helicone.d.ts.map +1 -0
- package/dist/connectors/helicone.js +106 -0
- package/dist/connectors/helicone.js.map +1 -0
- package/dist/connectors/index.d.ts +37 -0
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/index.js +65 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors/langsmith.d.ts +9 -0
- package/dist/connectors/langsmith.d.ts.map +1 -0
- package/dist/connectors/langsmith.js +122 -0
- package/dist/connectors/langsmith.js.map +1 -0
- package/dist/connectors/types.d.ts +83 -0
- package/dist/connectors/types.d.ts.map +1 -0
- package/dist/connectors/types.js +98 -0
- package/dist/connectors/types.js.map +1 -0
- package/dist/cost-estimator.d.ts +46 -0
- package/dist/cost-estimator.d.ts.map +1 -0
- package/dist/cost-estimator.js +104 -0
- package/dist/cost-estimator.js.map +1 -0
- package/dist/costs.d.ts +57 -0
- package/dist/costs.d.ts.map +1 -0
- package/dist/costs.js +251 -0
- package/dist/costs.js.map +1 -0
- package/dist/counterfactuals.d.ts +29 -0
- package/dist/counterfactuals.d.ts.map +1 -0
- package/dist/counterfactuals.js +448 -0
- package/dist/counterfactuals.js.map +1 -0
- package/dist/enhancement-prompts.d.ts +41 -0
- package/dist/enhancement-prompts.d.ts.map +1 -0
- package/dist/enhancement-prompts.js +88 -0
- package/dist/enhancement-prompts.js.map +1 -0
- package/dist/envelopes.d.ts +20 -0
- package/dist/envelopes.d.ts.map +1 -0
- package/dist/envelopes.js +790 -0
- package/dist/envelopes.js.map +1 -0
- package/dist/format-normalizer.d.ts +71 -0
- package/dist/format-normalizer.d.ts.map +1 -0
- package/dist/format-normalizer.js +1331 -0
- package/dist/format-normalizer.js.map +1 -0
- package/dist/history.d.ts +79 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +313 -0
- package/dist/history.js.map +1 -0
- package/dist/html.d.ts +11 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +463 -0
- package/dist/html.js.map +1 -0
- package/dist/impact.d.ts +42 -0
- package/dist/impact.d.ts.map +1 -0
- package/dist/impact.js +443 -0
- package/dist/impact.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/insights.d.ts +5 -0
- package/dist/insights.d.ts.map +1 -0
- package/dist/insights.js +271 -0
- package/dist/insights.js.map +1 -0
- package/dist/joiner.d.ts +9 -0
- package/dist/joiner.d.ts.map +1 -0
- package/dist/joiner.js +247 -0
- package/dist/joiner.js.map +1 -0
- package/dist/orchestrator.d.ts +34 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +827 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/pdf.d.ts +26 -0
- package/dist/pdf.d.ts.map +1 -0
- package/dist/pdf.js +84 -0
- package/dist/pdf.js.map +1 -0
- package/dist/prediction.d.ts +33 -0
- package/dist/prediction.d.ts.map +1 -0
- package/dist/prediction.js +316 -0
- package/dist/prediction.js.map +1 -0
- package/dist/prompts/loader.d.ts +38 -0
- package/dist/prompts/loader.d.ts.map +1 -0
- package/dist/prompts/loader.js +60 -0
- package/dist/prompts/loader.js.map +1 -0
- package/dist/renderer.d.ts +64 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +923 -0
- package/dist/renderer.js.map +1 -0
- package/dist/runid.d.ts +57 -0
- package/dist/runid.d.ts.map +1 -0
- package/dist/runid.js +199 -0
- package/dist/runid.js.map +1 -0
- package/dist/runtime.d.ts +29 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +366 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scanner.d.ts +11 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +426 -0
- package/dist/scanner.js.map +1 -0
- package/dist/templates.d.ts +120 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +429 -0
- package/dist/templates.js.map +1 -0
- package/dist/tools/index.d.ts +153 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +177 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +3647 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +703 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +23 -0
- package/dist/version.js.map +1 -0
- package/docs/demo-guide.md +423 -0
- package/docs/events-format.md +295 -0
- package/docs/inferencemap-spec.md +344 -0
- package/docs/migration-v2.md +293 -0
- package/fixtures/demo/precomputed.json +142 -0
- package/fixtures/demo-project/README.md +52 -0
- package/fixtures/demo-project/ai-service.ts +65 -0
- package/fixtures/demo-project/sample-events.jsonl +15 -0
- package/fixtures/demo-project/src/ai-service.ts +128 -0
- package/fixtures/demo-project/src/llm-client.ts +155 -0
- package/package.json +65 -0
- package/prompts/agent-analyzer.yaml +47 -0
- package/prompts/ci-gate.yaml +98 -0
- package/prompts/correlation-analyzer.yaml +178 -0
- package/prompts/format-normalizer.yaml +46 -0
- package/prompts/peak-performance.yaml +180 -0
- package/prompts/pr-comment.yaml +111 -0
- package/prompts/runtime-analyzer.yaml +189 -0
- package/prompts/unified-analyzer.yaml +241 -0
- package/schemas/inference-map.v0.1.json +215 -0
- package/scripts/benchmark.ts +394 -0
- package/scripts/demo-v1.5.sh +158 -0
- package/scripts/sync-from-site.sh +197 -0
- package/scripts/validate-sync.sh +178 -0
- package/src/agent-analyzer.ts +481 -0
- package/src/agent.ts +1232 -0
- package/src/agents/correlation-analyzer.ts +353 -0
- package/src/agents/index.ts +235 -0
- package/src/agents/runtime-analyzer.ts +343 -0
- package/src/analysis-types.ts +558 -0
- package/src/analytics.ts +100 -0
- package/src/analyzer.ts +692 -0
- package/src/artifacts.ts +218 -0
- package/src/benchmarks/index.ts +309 -0
- package/src/cli.ts +503 -0
- package/src/commands/ci.ts +336 -0
- package/src/commands/config.ts +288 -0
- package/src/commands/demo.ts +175 -0
- package/src/commands/export.ts +297 -0
- package/src/commands/history.ts +425 -0
- package/src/commands/template.ts +385 -0
- package/src/commands/validate-map.ts +324 -0
- package/src/commands/whatif.ts +272 -0
- package/src/comparison.ts +283 -0
- package/src/config.ts +188 -0
- package/src/connectors/helicone.ts +164 -0
- package/src/connectors/index.ts +93 -0
- package/src/connectors/langsmith.ts +179 -0
- package/src/connectors/types.ts +180 -0
- package/src/cost-estimator.ts +146 -0
- package/src/costs.ts +347 -0
- package/src/counterfactuals.ts +516 -0
- package/src/enhancement-prompts.ts +118 -0
- package/src/envelopes.ts +814 -0
- package/src/format-normalizer.ts +1486 -0
- package/src/history.ts +400 -0
- package/src/html.ts +512 -0
- package/src/impact.ts +522 -0
- package/src/index.ts +83 -0
- package/src/insights.ts +341 -0
- package/src/joiner.ts +289 -0
- package/src/orchestrator.ts +1015 -0
- package/src/pdf.ts +110 -0
- package/src/prediction.ts +392 -0
- package/src/prompts/loader.ts +88 -0
- package/src/renderer.ts +1045 -0
- package/src/runid.ts +261 -0
- package/src/runtime.ts +450 -0
- package/src/scanner.ts +508 -0
- package/src/templates.ts +561 -0
- package/src/tools/index.ts +214 -0
- package/src/types.ts +873 -0
- package/src/version.ts +24 -0
- package/templates/context-accumulation.yaml +23 -0
- package/templates/cost-concentration.yaml +20 -0
- package/templates/dead-code.yaml +20 -0
- package/templates/latency-explainer.yaml +23 -0
- package/templates/optimizations/ab-testing-framework.yaml +74 -0
- package/templates/optimizations/api-gateway-optimization.yaml +81 -0
- package/templates/optimizations/api-model-routing-strategy.yaml +126 -0
- package/templates/optimizations/auto-scaling-optimization.yaml +85 -0
- package/templates/optimizations/batch-utilization-diagnostic.yaml +142 -0
- package/templates/optimizations/comprehensive-apm.yaml +76 -0
- package/templates/optimizations/context-window-optimization.yaml +91 -0
- package/templates/optimizations/cost-sensitive-batch-processing.yaml +77 -0
- package/templates/optimizations/distributed-training-optimization.yaml +77 -0
- package/templates/optimizations/document-analysis-edge.yaml +77 -0
- package/templates/optimizations/document-pipeline-optimization.yaml +78 -0
- package/templates/optimizations/domain-specific-distillation.yaml +78 -0
- package/templates/optimizations/error-handling-optimization.yaml +76 -0
- package/templates/optimizations/gptq-4bit-quantization.yaml +96 -0
- package/templates/optimizations/long-context-memory-management.yaml +78 -0
- package/templates/optimizations/max-tokens-optimization.yaml +76 -0
- package/templates/optimizations/memory-bandwidth-optimization.yaml +73 -0
- package/templates/optimizations/multi-framework-resilience.yaml +75 -0
- package/templates/optimizations/multi-tenant-optimization.yaml +75 -0
- package/templates/optimizations/prompt-caching-optimization.yaml +143 -0
- package/templates/optimizations/pytorch-to-onnx-migration.yaml +109 -0
- package/templates/optimizations/quality-monitoring.yaml +74 -0
- package/templates/optimizations/realtime-budget-controls.yaml +74 -0
- package/templates/optimizations/realtime-latency-optimization.yaml +74 -0
- package/templates/optimizations/sglang-concurrency-optimization.yaml +78 -0
- package/templates/optimizations/smart-model-routing.yaml +96 -0
- package/templates/optimizations/streaming-batch-selection.yaml +167 -0
- package/templates/optimizations/system-prompt-optimization.yaml +75 -0
- package/templates/optimizations/tensorrt-llm-performance.yaml +77 -0
- package/templates/optimizations/vllm-high-throughput-optimization.yaml +93 -0
- package/templates/optimizations/vllm-migration-memory-bound.yaml +78 -0
- package/templates/overpowered-extraction.yaml +32 -0
- package/templates/overpowered-model.yaml +31 -0
- package/templates/prompt-bloat.yaml +24 -0
- package/templates/retry-explosion.yaml +28 -0
- package/templates/schema/insight.schema.json +113 -0
- package/templates/schema/optimization.schema.json +180 -0
- package/templates/streaming-drift.yaml +30 -0
- package/templates/throughput-gap.yaml +21 -0
- package/templates/token-underutilization.yaml +28 -0
- package/templates/untested-fallback.yaml +21 -0
- package/tests/accuracy/drift-detection.test.ts +184 -0
- package/tests/accuracy/false-positives.test.ts +166 -0
- package/tests/accuracy/templates.test.ts +205 -0
- package/tests/action/commands.test.ts +125 -0
- package/tests/action/comments.test.ts +347 -0
- package/tests/cli.test.ts +203 -0
- package/tests/comparison.test.ts +309 -0
- package/tests/correlation-analyzer.test.ts +534 -0
- package/tests/counterfactuals.test.ts +347 -0
- package/tests/fixtures/events/missing-id.jsonl +1 -0
- package/tests/fixtures/events/missing-input.jsonl +1 -0
- package/tests/fixtures/events/missing-latency.jsonl +1 -0
- package/tests/fixtures/events/missing-model.jsonl +1 -0
- package/tests/fixtures/events/missing-output.jsonl +1 -0
- package/tests/fixtures/events/missing-provider.jsonl +1 -0
- package/tests/fixtures/events/missing-ts.jsonl +1 -0
- package/tests/fixtures/events/valid.csv +3 -0
- package/tests/fixtures/events/valid.json +1 -0
- package/tests/fixtures/events/valid.jsonl +2 -0
- package/tests/fixtures/events/with-callsite.jsonl +1 -0
- package/tests/fixtures/events/with-intent.jsonl +1 -0
- package/tests/fixtures/events/wrong-type.jsonl +1 -0
- package/tests/fixtures/repos/empty/.gitkeep +0 -0
- package/tests/fixtures/repos/hybrid-router/router.py +35 -0
- package/tests/fixtures/repos/saas-anthropic/agent.ts +27 -0
- package/tests/fixtures/repos/saas-openai/assistant.js +33 -0
- package/tests/fixtures/repos/saas-openai/client.py +26 -0
- package/tests/fixtures/repos/self-hosted-vllm/inference.py +22 -0
- package/tests/github-action.test.ts +292 -0
- package/tests/insights.test.ts +878 -0
- package/tests/joiner.test.ts +168 -0
- package/tests/performance/action-latency.test.ts +132 -0
- package/tests/performance/benchmark.test.ts +189 -0
- package/tests/performance/cli-latency.test.ts +102 -0
- package/tests/pr-comment.test.ts +313 -0
- package/tests/prediction.test.ts +296 -0
- package/tests/runtime-analyzer.test.ts +375 -0
- package/tests/runtime.test.ts +205 -0
- package/tests/scanner.test.ts +122 -0
- package/tests/template-conformance.test.ts +526 -0
- package/tests/unit/cost-calculator.test.ts +303 -0
- package/tests/unit/credits.test.ts +180 -0
- package/tests/unit/inference-map.test.ts +276 -0
- package/tests/unit/schema.test.ts +300 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +14 -0
package/dist/html.js
ADDED
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { generateImpactSummary } from './impact.js';
|
|
2
|
+
import { VERSION } from './version.js';
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// STYLES
|
|
5
|
+
// =============================================================================
|
|
6
|
+
const STYLES = `
|
|
7
|
+
:root {
|
|
8
|
+
--critical: #dc2626;
|
|
9
|
+
--warning: #d97706;
|
|
10
|
+
--info: #2563eb;
|
|
11
|
+
--bg: #fafafa;
|
|
12
|
+
--text: #1a1a1a;
|
|
13
|
+
--muted: #6b7280;
|
|
14
|
+
--border: #e5e7eb;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
18
|
+
|
|
19
|
+
body {
|
|
20
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
21
|
+
max-width: 1200px;
|
|
22
|
+
margin: 0 auto;
|
|
23
|
+
padding: 2rem;
|
|
24
|
+
background: var(--bg);
|
|
25
|
+
color: var(--text);
|
|
26
|
+
line-height: 1.6;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
header {
|
|
30
|
+
margin-bottom: 2rem;
|
|
31
|
+
padding-bottom: 1rem;
|
|
32
|
+
border-bottom: 1px solid var(--border);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
h1 { font-size: 1.5rem; font-weight: 600; }
|
|
36
|
+
h2 { font-size: 1.25rem; font-weight: 600; margin: 1.5rem 0 1rem; }
|
|
37
|
+
h3 { font-size: 1rem; font-weight: 600; margin: 1rem 0 0.5rem; }
|
|
38
|
+
|
|
39
|
+
.meta { color: var(--muted); font-size: 0.875rem; margin-top: 0.5rem; }
|
|
40
|
+
.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin-top: 0.75rem; }
|
|
41
|
+
.meta-label { color: var(--muted); font-size: 0.8rem; }
|
|
42
|
+
.meta-value { font-family: ui-monospace, monospace; font-size: 0.8rem; word-break: break-all; }
|
|
43
|
+
.project-name { font-size: 1.1rem; font-weight: 500; margin-top: 0.5rem; color: var(--text); }
|
|
44
|
+
|
|
45
|
+
section { margin-bottom: 2rem; }
|
|
46
|
+
|
|
47
|
+
.finding {
|
|
48
|
+
border-left: 4px solid;
|
|
49
|
+
padding: 1rem;
|
|
50
|
+
margin: 1rem 0;
|
|
51
|
+
background: white;
|
|
52
|
+
border-radius: 0 4px 4px 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.finding.critical { border-color: var(--critical); }
|
|
56
|
+
.finding.warning { border-color: var(--warning); }
|
|
57
|
+
.finding.info { border-color: var(--info); }
|
|
58
|
+
|
|
59
|
+
.finding h3 { margin: 0 0 0.5rem; }
|
|
60
|
+
.finding p { color: var(--muted); margin: 0; }
|
|
61
|
+
.finding code {
|
|
62
|
+
display: block;
|
|
63
|
+
margin-top: 0.5rem;
|
|
64
|
+
font-size: 0.875rem;
|
|
65
|
+
color: var(--muted);
|
|
66
|
+
font-family: ui-monospace, monospace;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.stats {
|
|
70
|
+
display: grid;
|
|
71
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
72
|
+
gap: 1rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.stat {
|
|
76
|
+
background: white;
|
|
77
|
+
padding: 1rem;
|
|
78
|
+
border-radius: 4px;
|
|
79
|
+
border: 1px solid var(--border);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.stat-label { font-size: 0.875rem; color: var(--muted); }
|
|
83
|
+
.stat-value { font-size: 1.5rem; font-weight: 600; }
|
|
84
|
+
|
|
85
|
+
table {
|
|
86
|
+
width: 100%;
|
|
87
|
+
border-collapse: collapse;
|
|
88
|
+
font-size: 0.875rem;
|
|
89
|
+
background: white;
|
|
90
|
+
border-radius: 4px;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
th, td {
|
|
95
|
+
text-align: left;
|
|
96
|
+
padding: 0.75rem;
|
|
97
|
+
border-bottom: 1px solid var(--border);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
th { background: var(--bg); font-weight: 600; }
|
|
101
|
+
tr:last-child td { border-bottom: none; }
|
|
102
|
+
|
|
103
|
+
details { margin: 1rem 0; }
|
|
104
|
+
summary { cursor: pointer; font-weight: 500; }
|
|
105
|
+
|
|
106
|
+
footer {
|
|
107
|
+
margin-top: 3rem;
|
|
108
|
+
padding-top: 1rem;
|
|
109
|
+
border-top: 1px solid var(--border);
|
|
110
|
+
color: var(--muted);
|
|
111
|
+
font-size: 0.875rem;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
footer a { color: var(--info); text-decoration: none; }
|
|
115
|
+
footer a:hover { text-decoration: underline; }
|
|
116
|
+
|
|
117
|
+
.badge {
|
|
118
|
+
display: inline-block;
|
|
119
|
+
padding: 0.125rem 0.5rem;
|
|
120
|
+
border-radius: 9999px;
|
|
121
|
+
font-size: 0.75rem;
|
|
122
|
+
font-weight: 500;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.badge.streaming { background: #dbeafe; color: #1d4ed8; }
|
|
126
|
+
.badge.batching { background: #dcfce7; color: #15803d; }
|
|
127
|
+
.badge.retries { background: #fef3c7; color: #b45309; }
|
|
128
|
+
.badge.caching { background: #f3e8ff; color: #7e22ce; }
|
|
129
|
+
.badge.fallback { background: #fee2e2; color: #dc2626; }
|
|
130
|
+
|
|
131
|
+
.summary-line { font-size: 1.25rem; margin: 0.5rem 0; }
|
|
132
|
+
.potential { font-size: 1.5rem; margin: 1rem 0; }
|
|
133
|
+
.potential strong { color: #15803d; }
|
|
134
|
+
|
|
135
|
+
.layer-table { max-width: 500px; margin: 1rem 0; }
|
|
136
|
+
.layer-table td:first-child { width: 40px; }
|
|
137
|
+
|
|
138
|
+
.quick-wins { margin: 1rem 0; padding-left: 1.5rem; }
|
|
139
|
+
.quick-wins li { margin: 0.5rem 0; }
|
|
140
|
+
|
|
141
|
+
.impact-tag {
|
|
142
|
+
font-size: 0.75rem;
|
|
143
|
+
color: var(--muted);
|
|
144
|
+
font-weight: normal;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.location-list {
|
|
148
|
+
margin: 0.5rem 0;
|
|
149
|
+
padding-left: 1.5rem;
|
|
150
|
+
font-size: 0.8rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.location-list li {
|
|
154
|
+
margin: 0.25rem 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.location-list code {
|
|
158
|
+
display: inline;
|
|
159
|
+
margin: 0;
|
|
160
|
+
color: var(--text);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.finding details {
|
|
164
|
+
margin-top: 0.5rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.finding details summary {
|
|
168
|
+
font-size: 0.875rem;
|
|
169
|
+
color: var(--muted);
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.finding p {
|
|
174
|
+
font-size: 0.875rem;
|
|
175
|
+
}
|
|
176
|
+
`;
|
|
177
|
+
// =============================================================================
|
|
178
|
+
// HELPERS
|
|
179
|
+
// =============================================================================
|
|
180
|
+
function escapeHtml(str) {
|
|
181
|
+
return str
|
|
182
|
+
.replace(/&/g, '&')
|
|
183
|
+
.replace(/</g, '<')
|
|
184
|
+
.replace(/>/g, '>')
|
|
185
|
+
.replace(/"/g, '"');
|
|
186
|
+
}
|
|
187
|
+
function formatNumber(n) {
|
|
188
|
+
if (n >= 1_000_000)
|
|
189
|
+
return `${(n / 1_000_000).toFixed(1)}M`;
|
|
190
|
+
if (n >= 1_000)
|
|
191
|
+
return `${(n / 1_000).toFixed(1)}K`;
|
|
192
|
+
return n.toLocaleString();
|
|
193
|
+
}
|
|
194
|
+
function renderPatterns(patterns) {
|
|
195
|
+
return Object.entries(patterns)
|
|
196
|
+
.filter(([_, v]) => v)
|
|
197
|
+
.map(([k]) => `<span class="badge ${k}">${k}</span>`)
|
|
198
|
+
.join(' ');
|
|
199
|
+
}
|
|
200
|
+
// =============================================================================
|
|
201
|
+
// SECTIONS
|
|
202
|
+
// =============================================================================
|
|
203
|
+
function renderSummary(insights, callsiteCount) {
|
|
204
|
+
const summary = generateImpactSummary(insights);
|
|
205
|
+
const { costReductionPercent, latencyReductionPercent, throughputGainPercent } = summary.totalPotentialImpact;
|
|
206
|
+
const potentialParts = [];
|
|
207
|
+
if (costReductionPercent > 0)
|
|
208
|
+
potentialParts.push(`<strong>-${costReductionPercent}%</strong> cost`);
|
|
209
|
+
if (latencyReductionPercent > 0)
|
|
210
|
+
potentialParts.push(`<strong>-${latencyReductionPercent}%</strong> latency`);
|
|
211
|
+
if (throughputGainPercent > 0)
|
|
212
|
+
potentialParts.push(`<strong>+${throughputGainPercent}%</strong> throughput`);
|
|
213
|
+
const layerRows = summary.stackRanking.map((rank, i) => {
|
|
214
|
+
const avgImpact = Math.round(rank.totalImpactPercent / rank.insightCount);
|
|
215
|
+
return `<tr><td>${i + 1}</td><td>${rank.layer}</td><td>~${avgImpact}%</td><td>${rank.insightCount}</td></tr>`;
|
|
216
|
+
}).join('');
|
|
217
|
+
// Deduplicate quick wins by templateId+model combination, show unique recommendations
|
|
218
|
+
const seen = new Set();
|
|
219
|
+
const uniqueQuickWins = summary.quickWins.filter(insight => {
|
|
220
|
+
const key = `${insight.templateId || ''}:${insight.headline}`;
|
|
221
|
+
if (seen.has(key))
|
|
222
|
+
return false;
|
|
223
|
+
seen.add(key);
|
|
224
|
+
return true;
|
|
225
|
+
}).slice(0, 3);
|
|
226
|
+
const quickWins = uniqueQuickWins.map(insight => {
|
|
227
|
+
const pct = insight.impact?.estimatedImpactPercent || 0;
|
|
228
|
+
const type = insight.impact?.impactType || '';
|
|
229
|
+
const typeLabel = type === 'cost' ? 'cost reduction' : type === 'latency' ? 'latency reduction' : type;
|
|
230
|
+
// Use assumptions if available (more actionable), otherwise headline
|
|
231
|
+
const recommendation = insight.impact?.assumptions || insight.headline;
|
|
232
|
+
return `<li><strong>${escapeHtml(recommendation)}</strong> <span class="impact-tag">(${pct}% ${typeLabel})</span></li>`;
|
|
233
|
+
}).join('');
|
|
234
|
+
return `
|
|
235
|
+
<section id="summary">
|
|
236
|
+
<h2>Potential Performance Improvement</h2>
|
|
237
|
+
<p class="summary-line">${insights.length} findings across ${callsiteCount} inference points</p>
|
|
238
|
+
${potentialParts.length > 0 ? `<p class="potential">${potentialParts.join(' | ')}</p>` : ''}
|
|
239
|
+
|
|
240
|
+
${summary.stackRanking.length > 0 ? `
|
|
241
|
+
<h3>By Layer</h3>
|
|
242
|
+
<table class="layer-table">
|
|
243
|
+
<thead><tr><th>#</th><th>Layer</th><th>Avg Impact</th><th>Items</th></tr></thead>
|
|
244
|
+
<tbody>${layerRows}</tbody>
|
|
245
|
+
</table>
|
|
246
|
+
` : ''}
|
|
247
|
+
|
|
248
|
+
${summary.quickWins.length > 0 ? `
|
|
249
|
+
<h3>Quick Wins</h3>
|
|
250
|
+
<ul class="quick-wins">${quickWins}</ul>
|
|
251
|
+
` : ''}
|
|
252
|
+
</section>
|
|
253
|
+
`;
|
|
254
|
+
}
|
|
255
|
+
function renderFindings(insights) {
|
|
256
|
+
if (insights.length === 0) {
|
|
257
|
+
return `
|
|
258
|
+
<section id="findings">
|
|
259
|
+
<h2>Findings</h2>
|
|
260
|
+
<p>No issues detected. Your inference setup looks good.</p>
|
|
261
|
+
</section>
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
// Group insights by recommendation (assumptions or headline)
|
|
265
|
+
// Julie Zhou: "Progress should be phase-based (not noisy per-file spam)"
|
|
266
|
+
const grouped = new Map();
|
|
267
|
+
for (const insight of insights) {
|
|
268
|
+
const recommendation = insight.impact?.assumptions || insight.headline;
|
|
269
|
+
const key = recommendation;
|
|
270
|
+
if (!grouped.has(key)) {
|
|
271
|
+
grouped.set(key, {
|
|
272
|
+
recommendation,
|
|
273
|
+
severity: insight.severity,
|
|
274
|
+
layer: insight.impact?.layer || '',
|
|
275
|
+
impactType: insight.impact?.impactType || 'improvement',
|
|
276
|
+
impactPercent: insight.impact?.estimatedImpactPercent || 0,
|
|
277
|
+
locations: [],
|
|
278
|
+
evidence: insight.evidence,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if (insight.location) {
|
|
282
|
+
grouped.get(key).locations.push(insight.location);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// Sort by impact (highest first)
|
|
286
|
+
const sortedGroups = Array.from(grouped.values()).sort((a, b) => b.impactPercent - a.impactPercent);
|
|
287
|
+
const items = sortedGroups.map(group => {
|
|
288
|
+
const typeLabel = group.impactType === 'cost' ? 'cost reduction'
|
|
289
|
+
: group.impactType === 'latency' ? 'latency reduction'
|
|
290
|
+
: group.impactType;
|
|
291
|
+
const impactTag = group.layer
|
|
292
|
+
? `<span class="impact-tag">[${group.layer}] ${group.impactPercent}% ${typeLabel}</span>`
|
|
293
|
+
: '';
|
|
294
|
+
const locationCount = group.locations.length;
|
|
295
|
+
const locationList = group.locations.map(loc => `<li><code>${escapeHtml(loc)}</code></li>`).join('');
|
|
296
|
+
return `
|
|
297
|
+
<div class="finding ${group.severity}">
|
|
298
|
+
<h3>${escapeHtml(group.recommendation)} ${impactTag}</h3>
|
|
299
|
+
<p>${locationCount} inference point${locationCount !== 1 ? 's' : ''}</p>
|
|
300
|
+
${locationCount > 0 ? `
|
|
301
|
+
<details>
|
|
302
|
+
<summary>Show locations</summary>
|
|
303
|
+
<ul class="location-list">${locationList}</ul>
|
|
304
|
+
</details>
|
|
305
|
+
` : ''}
|
|
306
|
+
</div>
|
|
307
|
+
`;
|
|
308
|
+
}).join('');
|
|
309
|
+
return `
|
|
310
|
+
<section id="findings">
|
|
311
|
+
<h2>Findings</h2>
|
|
312
|
+
${items}
|
|
313
|
+
</section>
|
|
314
|
+
`;
|
|
315
|
+
}
|
|
316
|
+
function renderInferenceMap(map) {
|
|
317
|
+
const rows = map.callsites.map(cs => `
|
|
318
|
+
<tr>
|
|
319
|
+
<td>${escapeHtml(cs.file)}</td>
|
|
320
|
+
<td>${cs.line}</td>
|
|
321
|
+
<td>${cs.provider || '-'}</td>
|
|
322
|
+
<td>${cs.model || '-'}</td>
|
|
323
|
+
<td>${renderPatterns(cs.patterns)}</td>
|
|
324
|
+
</tr>
|
|
325
|
+
`).join('');
|
|
326
|
+
return `
|
|
327
|
+
<section id="inferencemap">
|
|
328
|
+
<h2>InferenceMap</h2>
|
|
329
|
+
<details>
|
|
330
|
+
<summary>${map.summary.totalCallsites} inference points</summary>
|
|
331
|
+
<table>
|
|
332
|
+
<thead>
|
|
333
|
+
<tr>
|
|
334
|
+
<th>File</th>
|
|
335
|
+
<th>Line</th>
|
|
336
|
+
<th>Provider</th>
|
|
337
|
+
<th>Model</th>
|
|
338
|
+
<th>Patterns</th>
|
|
339
|
+
</tr>
|
|
340
|
+
</thead>
|
|
341
|
+
<tbody>
|
|
342
|
+
${rows}
|
|
343
|
+
</tbody>
|
|
344
|
+
</table>
|
|
345
|
+
</details>
|
|
346
|
+
</section>
|
|
347
|
+
`;
|
|
348
|
+
}
|
|
349
|
+
function renderRuntime(runtime) {
|
|
350
|
+
return `
|
|
351
|
+
<section id="runtime">
|
|
352
|
+
<h2>Runtime</h2>
|
|
353
|
+
<div class="stats">
|
|
354
|
+
<div class="stat">
|
|
355
|
+
<div class="stat-label">Total Events</div>
|
|
356
|
+
<div class="stat-value">${formatNumber(runtime.totalEvents)}</div>
|
|
357
|
+
</div>
|
|
358
|
+
<div class="stat">
|
|
359
|
+
<div class="stat-label">Latency p50</div>
|
|
360
|
+
<div class="stat-value">${runtime.global.p50}ms</div>
|
|
361
|
+
</div>
|
|
362
|
+
<div class="stat">
|
|
363
|
+
<div class="stat-label">Latency p95</div>
|
|
364
|
+
<div class="stat-value">${runtime.global.p95}ms</div>
|
|
365
|
+
</div>
|
|
366
|
+
<div class="stat">
|
|
367
|
+
<div class="stat-label">Latency p99</div>
|
|
368
|
+
<div class="stat-value">${runtime.global.p99}ms</div>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
</section>
|
|
372
|
+
`;
|
|
373
|
+
}
|
|
374
|
+
function renderDrift(joined) {
|
|
375
|
+
if (joined.drift.length === 0)
|
|
376
|
+
return '';
|
|
377
|
+
const codeOnlyItems = joined.codeOnly.map(cs => `<li>${escapeHtml(cs.file)}:${cs.line} — ${cs.provider || '?'}/${cs.model || '?'}</li>`).join('');
|
|
378
|
+
const runtimeByKey = new Map();
|
|
379
|
+
for (const evt of joined.runtimeOnly) {
|
|
380
|
+
const key = `${evt.provider}/${evt.model}`;
|
|
381
|
+
runtimeByKey.set(key, (runtimeByKey.get(key) || 0) + 1);
|
|
382
|
+
}
|
|
383
|
+
const runtimeOnlyItems = Array.from(runtimeByKey.entries())
|
|
384
|
+
.map(([key, count]) => `<li>${escapeHtml(key)} — ${count} events</li>`)
|
|
385
|
+
.join('');
|
|
386
|
+
return `
|
|
387
|
+
<section id="drift">
|
|
388
|
+
<h2>Drift</h2>
|
|
389
|
+
${joined.codeOnly.length > 0 ? `
|
|
390
|
+
<h3>Code-only (${joined.codeOnly.length})</h3>
|
|
391
|
+
<ul>${codeOnlyItems}</ul>
|
|
392
|
+
` : ''}
|
|
393
|
+
${joined.runtimeOnly.length > 0 ? `
|
|
394
|
+
<h3>Runtime-only (${runtimeByKey.size})</h3>
|
|
395
|
+
<ul>${runtimeOnlyItems}</ul>
|
|
396
|
+
` : ''}
|
|
397
|
+
</section>
|
|
398
|
+
`;
|
|
399
|
+
}
|
|
400
|
+
// =============================================================================
|
|
401
|
+
// PUBLIC API
|
|
402
|
+
// =============================================================================
|
|
403
|
+
export function generateHTML(data) {
|
|
404
|
+
const { inferenceMap, insights, joined, runtime } = data;
|
|
405
|
+
const now = new Date();
|
|
406
|
+
const timestamp = now.toISOString().replace('T', ' ').substring(0, 19) + ' UTC';
|
|
407
|
+
const callsiteCount = inferenceMap.summary.totalCallsites;
|
|
408
|
+
// Use absolute path if available, otherwise fall back to root
|
|
409
|
+
const absolutePath = inferenceMap.metadata?.absolutePath || inferenceMap.root;
|
|
410
|
+
const projectName = absolutePath.split('/').filter(Boolean).pop() || 'Unknown Project';
|
|
411
|
+
// Build project overview
|
|
412
|
+
const providers = inferenceMap.summary.providers;
|
|
413
|
+
const models = inferenceMap.summary.models;
|
|
414
|
+
const patterns = Object.entries(inferenceMap.summary.patterns)
|
|
415
|
+
.filter(([_, count]) => count > 0)
|
|
416
|
+
.map(([name, count]) => `${name} (${count})`)
|
|
417
|
+
.join(', ') || 'none detected';
|
|
418
|
+
return `<!DOCTYPE html>
|
|
419
|
+
<html lang="en">
|
|
420
|
+
<head>
|
|
421
|
+
<meta charset="UTF-8">
|
|
422
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
423
|
+
<title>PeakInfer Report — ${escapeHtml(projectName)}</title>
|
|
424
|
+
<style>${STYLES}</style>
|
|
425
|
+
</head>
|
|
426
|
+
<body>
|
|
427
|
+
<header>
|
|
428
|
+
<h1>PeakInfer Report</h1>
|
|
429
|
+
<p class="project-name">${escapeHtml(projectName)}</p>
|
|
430
|
+
<div class="meta-grid">
|
|
431
|
+
<span class="meta-label">Path</span>
|
|
432
|
+
<span class="meta-value">${escapeHtml(absolutePath)}</span>
|
|
433
|
+
<span class="meta-label">Generated</span>
|
|
434
|
+
<span class="meta-value">${timestamp}</span>
|
|
435
|
+
</div>
|
|
436
|
+
</header>
|
|
437
|
+
|
|
438
|
+
<section id="overview">
|
|
439
|
+
<h2>Project Overview</h2>
|
|
440
|
+
<p><strong>${callsiteCount}</strong> inference points found across <strong>${providers.length}</strong> providers and <strong>${models.length}</strong> models.</p>
|
|
441
|
+
<div class="meta-grid" style="margin-top: 1rem;">
|
|
442
|
+
<span class="meta-label">Providers</span>
|
|
443
|
+
<span class="meta-value">${escapeHtml(providers.join(', '))}</span>
|
|
444
|
+
<span class="meta-label">Models</span>
|
|
445
|
+
<span class="meta-value">${escapeHtml(models.slice(0, 5).join(', '))}${models.length > 5 ? ` +${models.length - 5} more` : ''}</span>
|
|
446
|
+
<span class="meta-label">Patterns</span>
|
|
447
|
+
<span class="meta-value">${escapeHtml(patterns)}</span>
|
|
448
|
+
</div>
|
|
449
|
+
</section>
|
|
450
|
+
|
|
451
|
+
${renderSummary(insights, callsiteCount)}
|
|
452
|
+
${renderFindings(insights)}
|
|
453
|
+
${renderInferenceMap(inferenceMap)}
|
|
454
|
+
${runtime ? renderRuntime(runtime) : ''}
|
|
455
|
+
${joined ? renderDrift(joined) : ''}
|
|
456
|
+
|
|
457
|
+
<footer>
|
|
458
|
+
<p>Generated by PeakInfer v${VERSION} | <a href="https://github.com/Kalmantic/peakinfer">GitHub</a></p>
|
|
459
|
+
</footer>
|
|
460
|
+
</body>
|
|
461
|
+
</html>`;
|
|
462
|
+
}
|
|
463
|
+
//# sourceMappingURL=html.js.map
|
package/dist/html.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAsB,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAcvC,gFAAgF;AAChF,SAAS;AACT,gFAAgF;AAEhF,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Kd,CAAC;AAEF,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,GAAG;SACP,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,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,mDAAmD,SAAS,CAAC,MAAM,mCAAmC,MAAM,CAAC,MAAM;;;iCAGhH,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;iCAEhC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;;iCAElG,UAAU,CAAC,QAAQ,CAAC;;;;IAIjD,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC;IACtC,cAAc,CAAC,QAAQ,CAAC;IACxB,kBAAkB,CAAC,YAAY,CAAC;IAChC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;IACrC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;;;iCAGJ,OAAO;;;QAGhC,CAAC;AACT,CAAC"}
|
package/dist/impact.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Insight, ImpactEstimate, StackLayer, EffortLevel } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Estimate impact for a single insight
|
|
4
|
+
*/
|
|
5
|
+
export declare function estimateImpact(insight: Insight): ImpactEstimate | null;
|
|
6
|
+
/**
|
|
7
|
+
* Add impact estimates to all insights
|
|
8
|
+
*/
|
|
9
|
+
export declare function enrichInsightsWithImpact(insights: Insight[]): Insight[];
|
|
10
|
+
/**
|
|
11
|
+
* Stack ranking summary
|
|
12
|
+
*/
|
|
13
|
+
export interface StackRanking {
|
|
14
|
+
layer: StackLayer;
|
|
15
|
+
totalImpactPercent: number;
|
|
16
|
+
insightCount: number;
|
|
17
|
+
avgEffort: EffortLevel;
|
|
18
|
+
topInsights: Insight[];
|
|
19
|
+
}
|
|
20
|
+
export interface ImpactSummary {
|
|
21
|
+
totalPotentialImpact: {
|
|
22
|
+
costReductionPercent: number;
|
|
23
|
+
latencyReductionPercent: number;
|
|
24
|
+
throughputGainPercent: number;
|
|
25
|
+
};
|
|
26
|
+
stackRanking: StackRanking[];
|
|
27
|
+
quickWins: Insight[];
|
|
28
|
+
strategicChanges: Insight[];
|
|
29
|
+
prioritizedList: Insight[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate comprehensive impact summary with stack ranking
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateImpactSummary(insights: Insight[]): ImpactSummary;
|
|
35
|
+
/**
|
|
36
|
+
* Format impact summary as text for CLI output
|
|
37
|
+
* Julie Zhou design: "Headroom" terminology, intuitive metrics
|
|
38
|
+
*
|
|
39
|
+
* Key principle: Output should be understandable without narration
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatImpactSummary(summary: ImpactSummary): string;
|
|
42
|
+
//# sourceMappingURL=impact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact.d.ts","sourceRoot":"","sources":["../src/impact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAc,WAAW,EAAE,MAAM,YAAY,CAAC;AAqR/F;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAkBtE;AA0BD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAOvE;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,UAAU,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,WAAW,CAAC;IACvB,WAAW,EAAE,OAAO,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,oBAAoB,EAAE;QACpB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,uBAAuB,EAAE,MAAM,CAAC;QAChC,qBAAqB,EAAE,MAAM,CAAC;KAC/B,CAAC;IACF,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,gBAAgB,EAAE,OAAO,EAAE,CAAC;IAC5B,eAAe,EAAE,OAAO,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,aAAa,CAyFxE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CA8DlE"}
|