@trazum/cli 1.74.0 → 1.75.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/README.md +4 -0
- package/dist/index.js +69 -79
- package/dist/index.js.map +1 -1
- package/dist/style.d.ts +68 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +88 -0
- package/dist/style.js.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +72 -86
- package/src/style.ts +108 -0
package/README.md
CHANGED
|
@@ -36,6 +36,10 @@ npm install -g @trazum/cli
|
|
|
36
36
|
| `trazum diff <before> <after>` | somebody edited this; did it get worse? |
|
|
37
37
|
| `trazum blame <file>` | who made this prompt expensive, and when |
|
|
38
38
|
| `trazum eval <file> --cases <file>` | does the shorter prompt still work |
|
|
39
|
+
| `trazum from-claude-code <dir>` | what my Claude Code sessions cost — reads the transcripts already on disk, the numbers only and never the words |
|
|
40
|
+
| `trazum from-otel <file>` | what the LLM calls in my OpenTelemetry export cost — the GenAI spans any exporter already emits, counts only |
|
|
41
|
+
| `trazum switch <log> --to <model>` | should we move this traffic, and when does moving pay — measured saving, declared migration cost, break-even as division on the past |
|
|
42
|
+
| `trazum ownrate` | what my self-hosted model costs per million tokens — your GPU rate over your measured throughput, derived rather than guessed |
|
|
39
43
|
| `trazum where [file]` | which prompts hide in my source files, and which model they call |
|
|
40
44
|
| `trazum models` · `trazum rules` | prices; what each rule does |
|
|
41
45
|
|
package/dist/index.js
CHANGED
|
@@ -25,15 +25,11 @@ import { renderPositionHtml, renderProfileHtml, renderRollupHtml } from './html.
|
|
|
25
25
|
// --------------------------------------------------------------------------
|
|
26
26
|
// Presentation
|
|
27
27
|
// --------------------------------------------------------------------------
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
red: (s) => (useColor ? `\u001b[31m${s}\u001b[39m` : s),
|
|
34
|
-
yellow: (s) => (useColor ? `\u001b[33m${s}\u001b[39m` : s),
|
|
35
|
-
cyan: (s) => (useColor ? `\u001b[36m${s}\u001b[39m` : s),
|
|
36
|
-
};
|
|
28
|
+
// The painters, the ANSI-aware measurer, the one table renderer, the
|
|
29
|
+
// proportion bar and the heading rule — the 1.75 style module. The guard in
|
|
30
|
+
// style.test.js holds the contract: stripped colour output is byte-identical
|
|
31
|
+
// to plain output, and a pipe stays plain.
|
|
32
|
+
import { bar, c, sectionHeading, table } from './style.js';
|
|
37
33
|
const VALUE_FLAGS = new Set([
|
|
38
34
|
'answers',
|
|
39
35
|
'calls',
|
|
@@ -597,7 +593,7 @@ measured = null) {
|
|
|
597
593
|
// above already told them nothing changed.
|
|
598
594
|
if (reorder !== null && (reorder.moved.length > 0 || reorder.declined.length > 0)) {
|
|
599
595
|
console.log();
|
|
600
|
-
console.log(
|
|
596
|
+
console.log(sectionHeading(t.report.reorderHeading()));
|
|
601
597
|
if (reorder.moved.length === 0) {
|
|
602
598
|
console.log(` ${c.dim(t.report.reorderNothing())}`);
|
|
603
599
|
}
|
|
@@ -832,7 +828,7 @@ namedScenario = false) {
|
|
|
832
828
|
const model = getModel(result.usage.model);
|
|
833
829
|
const saved = result.tokensBefore - result.tokensAfter;
|
|
834
830
|
console.log();
|
|
835
|
-
console.log(
|
|
831
|
+
console.log(sectionHeading(t.report.tokensOnlyHeading(host.displayName)));
|
|
836
832
|
// Only claim the host bills by subscription when it does. Forced with the
|
|
837
833
|
// flag on GitHub Actions, the first version said "GitHub Actions bills by
|
|
838
834
|
// subscription", which is simply false.
|
|
@@ -1216,7 +1212,7 @@ function renderInit(proposal, ctx) {
|
|
|
1216
1212
|
const { t } = ctx;
|
|
1217
1213
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
1218
1214
|
console.log();
|
|
1219
|
-
console.log(
|
|
1215
|
+
console.log(sectionHeading(t.init.heading()));
|
|
1220
1216
|
console.log();
|
|
1221
1217
|
// 1. Where this is running.
|
|
1222
1218
|
console.log(` ${t.init.host(ctx.host.displayName)}`);
|
|
@@ -1241,7 +1237,7 @@ function renderInit(proposal, ctx) {
|
|
|
1241
1237
|
}
|
|
1242
1238
|
console.log();
|
|
1243
1239
|
// 4. What the config would say, and what it will not.
|
|
1244
|
-
console.log(
|
|
1240
|
+
console.log(sectionHeading(t.init.configHeading()));
|
|
1245
1241
|
if (proposal.justified.length === 0) {
|
|
1246
1242
|
console.log(` ${c.dim(t.init.nothingJustified())}`);
|
|
1247
1243
|
}
|
|
@@ -1257,7 +1253,7 @@ function renderInit(proposal, ctx) {
|
|
|
1257
1253
|
}
|
|
1258
1254
|
console.log();
|
|
1259
1255
|
// 5. The single most valuable thing found — arithmetic first.
|
|
1260
|
-
console.log(
|
|
1256
|
+
console.log(sectionHeading(t.init.findingHeading()));
|
|
1261
1257
|
if (proposal.headline === null) {
|
|
1262
1258
|
console.log(` ${c.dim(t.init.noFinding(proposal.noHeadline ?? 'nothing-measured'))}`);
|
|
1263
1259
|
console.log();
|
|
@@ -1612,7 +1608,7 @@ async function commandConform(args, t) {
|
|
|
1612
1608
|
}
|
|
1613
1609
|
if (report.unavailable.length > 0) {
|
|
1614
1610
|
console.log();
|
|
1615
|
-
console.log(
|
|
1611
|
+
console.log(sectionHeading(t.conform.unavailableHeading()));
|
|
1616
1612
|
for (const gap of report.unavailable) {
|
|
1617
1613
|
console.log(` ${c.dim(wrap(t.conform.unavailable(gap.finding, gap.because, gap.unlockedBy), 74, ' '))}`);
|
|
1618
1614
|
}
|
|
@@ -1726,7 +1722,7 @@ async function commandRollup(args, t) {
|
|
|
1726
1722
|
console.log(` ${c.dim(wrap(t.rollup.claimedSpan(day(document.claimedSpan.fromMs), day(document.claimedSpan.toMs - 1), document.claimedSpan.contributors), 72, ' '))}`);
|
|
1727
1723
|
}
|
|
1728
1724
|
console.log();
|
|
1729
|
-
console.log(
|
|
1725
|
+
console.log(sectionHeading(t.rollup.contributorsHeading()));
|
|
1730
1726
|
for (const contributor of document.contributors) {
|
|
1731
1727
|
console.log(` ${t.rollup.contributor(contributor.name, formatUsd(contributor.totalUsd), contributor.calls, contributor.spanDays === null ? null : Math.round(contributor.spanDays))}${contributor.via === null ? '' : ` ${c.dim(t.rollup.via(contributor.via))}`}`);
|
|
1732
1728
|
/**
|
|
@@ -1766,7 +1762,7 @@ async function commandRollup(args, t) {
|
|
|
1766
1762
|
}
|
|
1767
1763
|
if (document.rejected.length > 0) {
|
|
1768
1764
|
console.log();
|
|
1769
|
-
console.log(
|
|
1765
|
+
console.log(sectionHeading(t.rollup.rejectedHeading()));
|
|
1770
1766
|
for (const rejection of document.rejected) {
|
|
1771
1767
|
// The roll-up it arrived through, when it came through one: a rejection
|
|
1772
1768
|
// whose origin got lost is a machine nobody knows to go and fix.
|
|
@@ -1790,14 +1786,14 @@ async function commandRollup(args, t) {
|
|
|
1790
1786
|
}
|
|
1791
1787
|
if (document.byLabel.length > 0) {
|
|
1792
1788
|
console.log();
|
|
1793
|
-
console.log(
|
|
1789
|
+
console.log(sectionHeading(t.rollup.byLabelHeading()));
|
|
1794
1790
|
for (const row of document.byLabel.slice(0, 8)) {
|
|
1795
1791
|
console.log(` ${t.rollup.labelRow(row.label, formatUsd(row.breakdown.totalUsd), row.breakdown.calls)}`);
|
|
1796
1792
|
}
|
|
1797
1793
|
}
|
|
1798
1794
|
if (document.notMerged.length > 0) {
|
|
1799
1795
|
console.log();
|
|
1800
|
-
console.log(
|
|
1796
|
+
console.log(sectionHeading(t.rollup.notMergedHeading()));
|
|
1801
1797
|
for (const finding of document.notMerged) {
|
|
1802
1798
|
console.log(` ${wrap(t.rollup.notMerged(finding.finding, finding.because), 72, ' ')}`);
|
|
1803
1799
|
if (finding.presentIn.length > 0) {
|
|
@@ -1807,7 +1803,7 @@ async function commandRollup(args, t) {
|
|
|
1807
1803
|
}
|
|
1808
1804
|
if (document.cannotSay.length > 0) {
|
|
1809
1805
|
console.log();
|
|
1810
|
-
console.log(
|
|
1806
|
+
console.log(sectionHeading(t.rollup.cannotSayHeading()));
|
|
1811
1807
|
for (const caveat of document.cannotSay) {
|
|
1812
1808
|
console.log(` ${c.dim(wrap(t.rollup.caveat(caveat), 72, ' '))}`);
|
|
1813
1809
|
}
|
|
@@ -2126,7 +2122,7 @@ async function commandSwitch(args, pricing, t) {
|
|
|
2126
2122
|
throw new Error(t.switchCmd.unknownModel(target));
|
|
2127
2123
|
const { reprice, savingUsd, measuredDays, breakEven, evalCost } = analysis;
|
|
2128
2124
|
console.log();
|
|
2129
|
-
console.log(
|
|
2125
|
+
console.log(sectionHeading(t.switchCmd.heading(reprice.target.displayName)));
|
|
2130
2126
|
if (reprice.slices.length === 0) {
|
|
2131
2127
|
console.log(` ${wrap(t.switchCmd.nothingMovable(), 74, ' ')}`);
|
|
2132
2128
|
}
|
|
@@ -2320,7 +2316,7 @@ async function commandPosition(args, config, pricing, t) {
|
|
|
2320
2316
|
? t.position.scopeDay()
|
|
2321
2317
|
: t.position.scopeLabel(position.label ?? '');
|
|
2322
2318
|
console.log();
|
|
2323
|
-
console.log(
|
|
2319
|
+
console.log(sectionHeading(t.position.heading(document.month.id)));
|
|
2324
2320
|
for (const position of document.positions) {
|
|
2325
2321
|
const name = scopeName(position);
|
|
2326
2322
|
if (position.verdict === 'cannot-tell') {
|
|
@@ -2389,7 +2385,7 @@ async function commandPulse(args, t) {
|
|
|
2389
2385
|
}
|
|
2390
2386
|
const when = (ms) => new Date(ms).toISOString().replace('T', ' ').slice(0, 16);
|
|
2391
2387
|
console.log();
|
|
2392
|
-
console.log(
|
|
2388
|
+
console.log(sectionHeading(t.pulse.heading()));
|
|
2393
2389
|
for (const heartbeat of report.beats) {
|
|
2394
2390
|
const name = t.pulse.kind(heartbeat.kind);
|
|
2395
2391
|
if (heartbeat.lastMs === null) {
|
|
@@ -2643,7 +2639,7 @@ function printBenchTable(measurements, t, machine) {
|
|
|
2643
2639
|
const mb = (bytes) => `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
2644
2640
|
const idWidth = Math.max(...measurements.map((m) => m.id.length), t.bench.colWorkload().length);
|
|
2645
2641
|
console.log();
|
|
2646
|
-
console.log(
|
|
2642
|
+
console.log(sectionHeading(t.bench.heading()));
|
|
2647
2643
|
if (machine !== undefined) {
|
|
2648
2644
|
console.log(` ${c.dim(t.bench.machine(machine.node, machine.platform, machine.cpus, machine.cpuModel))}`);
|
|
2649
2645
|
}
|
|
@@ -2836,10 +2832,10 @@ function commandFeedback(t) {
|
|
|
2836
2832
|
].join('\n');
|
|
2837
2833
|
const url = `${FEEDBACK_REPO}/issues/new?body=${encodeURIComponent(body)}`;
|
|
2838
2834
|
console.log();
|
|
2839
|
-
console.log(
|
|
2835
|
+
console.log(sectionHeading(t.feedback.heading()));
|
|
2840
2836
|
console.log(` ${c.dim(wrap(t.feedback.sendsNothing(), 74, ' '))}`);
|
|
2841
2837
|
console.log();
|
|
2842
|
-
console.log(
|
|
2838
|
+
console.log(sectionHeading(t.feedback.whereHeading()));
|
|
2843
2839
|
console.log(` ${t.feedback.wrongOptimisation()}`);
|
|
2844
2840
|
console.log(` ${c.dim(`${FEEDBACK_REPO}/issues/new?template=wrong_optimisation.yml`)}`);
|
|
2845
2841
|
console.log(` ${t.feedback.bug()}`);
|
|
@@ -2849,12 +2845,12 @@ function commandFeedback(t) {
|
|
|
2849
2845
|
console.log(` ${t.feedback.security()}`);
|
|
2850
2846
|
console.log(` ${c.dim(`${FEEDBACK_REPO}/security/advisories/new`)}`);
|
|
2851
2847
|
console.log();
|
|
2852
|
-
console.log(
|
|
2848
|
+
console.log(sectionHeading(t.feedback.environmentHeading()));
|
|
2853
2849
|
for (const line of environment)
|
|
2854
2850
|
console.log(` ${line}`);
|
|
2855
2851
|
console.log(` ${c.dim(wrap(t.feedback.environmentOnly(), 74, ' '))}`);
|
|
2856
2852
|
console.log();
|
|
2857
|
-
console.log(
|
|
2853
|
+
console.log(sectionHeading(t.feedback.linkHeading()));
|
|
2858
2854
|
console.log(` ${url}`);
|
|
2859
2855
|
console.log();
|
|
2860
2856
|
}
|
|
@@ -3015,7 +3011,7 @@ async function commandLadder(args, config, pricing, t) {
|
|
|
3015
3011
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3016
3012
|
const pct = (value) => `${(value * 100).toFixed(1)}%`;
|
|
3017
3013
|
console.log();
|
|
3018
|
-
console.log(
|
|
3014
|
+
console.log(sectionHeading(t.ladder.heading()));
|
|
3019
3015
|
if (Object.keys(ladders).length === 0) {
|
|
3020
3016
|
console.log(` ${c.dim(wrap(t.ladder.noLadders(), 74, ' '))}`);
|
|
3021
3017
|
console.log();
|
|
@@ -3135,7 +3131,7 @@ async function commandExperiment(args, config, pricing, t) {
|
|
|
3135
3131
|
};
|
|
3136
3132
|
const result = runExperiment({ arms: [aName, bName], minOutcomesPerArm }, { a: armOf(aName), b: armOf(bName) }, config.outcomes ?? null);
|
|
3137
3133
|
console.log();
|
|
3138
|
-
console.log(
|
|
3134
|
+
console.log(sectionHeading(t.experiment.heading(aName, bName)));
|
|
3139
3135
|
console.log();
|
|
3140
3136
|
for (const side of [result.a, result.b]) {
|
|
3141
3137
|
console.log(` ${t.experiment.arm(side.name, side.rate === null ? '—' : pct(side.rate), n(side.successes), n(side.recorded), side.interval === null ? '—' : `[${pct(side.interval.low)}, ${pct(side.interval.high)}]`)}`);
|
|
@@ -3232,7 +3228,7 @@ async function commandQuality(args, config, pricing, t) {
|
|
|
3232
3228
|
const pct = (value) => `${(value * 100).toFixed(1)}%`;
|
|
3233
3229
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3234
3230
|
console.log();
|
|
3235
|
-
console.log(
|
|
3231
|
+
console.log(sectionHeading(t.quality.heading(label)));
|
|
3236
3232
|
console.log(` ${c.dim(wrap(t.quality.notRandomised(), 74, ' '))}`);
|
|
3237
3233
|
console.log();
|
|
3238
3234
|
console.log(` ${t.quality.sides(result.before.rate === null ? '—' : pct(result.before.rate), result.after.rate === null ? '—' : pct(result.after.rate), n(result.outcomes.before), n(result.outcomes.after))}`);
|
|
@@ -3308,7 +3304,7 @@ async function commandSemantic(args, config, pricing, t) {
|
|
|
3308
3304
|
const cost = semanticPassCost(prompt, rates);
|
|
3309
3305
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3310
3306
|
console.log();
|
|
3311
|
-
console.log(
|
|
3307
|
+
console.log(sectionHeading(t.semantic.heading(args.positional[0] ?? '-')));
|
|
3312
3308
|
console.log();
|
|
3313
3309
|
console.log(` ${wrap(t.semantic.willCost(formatUsd(cost.usd), n(cost.inputTokens), n(cost.outputTokens), model.displayName), 74, ' ')}`);
|
|
3314
3310
|
if (!boolFlag(args, 'yes')) {
|
|
@@ -3394,7 +3390,7 @@ async function commandOwners(args, config, pricing, t) {
|
|
|
3394
3390
|
if (path === undefined)
|
|
3395
3391
|
throw new Error(t.errors.missingInputFile());
|
|
3396
3392
|
console.log();
|
|
3397
|
-
console.log(
|
|
3393
|
+
console.log(sectionHeading(t.owners.heading()));
|
|
3398
3394
|
if (config.owners === undefined) {
|
|
3399
3395
|
console.log(` ${c.dim(wrap(t.owners.noOwners(), 74, ' '))}`);
|
|
3400
3396
|
console.log();
|
|
@@ -3550,7 +3546,7 @@ async function commandCommitment(args, config, pricing, t) {
|
|
|
3550
3546
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3551
3547
|
const pct = (value) => `${(value * 100).toFixed(0)}%`;
|
|
3552
3548
|
console.log();
|
|
3553
|
-
console.log(
|
|
3549
|
+
console.log(sectionHeading(t.commitment.heading(formatUsd(floor), pct(discount), n(months))));
|
|
3554
3550
|
console.log(` ${c.dim(wrap(t.commitment.asIf(), 74, ' '))}`);
|
|
3555
3551
|
console.log();
|
|
3556
3552
|
if (replay.unknown !== null) {
|
|
@@ -3684,7 +3680,7 @@ async function commandReport(args, config, pricing, t) {
|
|
|
3684
3680
|
}
|
|
3685
3681
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3686
3682
|
console.log();
|
|
3687
|
-
console.log(
|
|
3683
|
+
console.log(sectionHeading(t.annual.heading(year)));
|
|
3688
3684
|
console.log();
|
|
3689
3685
|
console.log(` ${t.annual.spent(formatUsd(record.totalUsd), n(record.totalCalls), n(record.months.length))}`);
|
|
3690
3686
|
if (record.missingMonths.length > 0) {
|
|
@@ -3724,7 +3720,7 @@ function commandModels(t, pricing) {
|
|
|
3724
3720
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3725
3721
|
const col = t.models.columns;
|
|
3726
3722
|
console.log();
|
|
3727
|
-
console.log(
|
|
3723
|
+
console.log(sectionHeading(`${t.models.title()}${t.models.unit()}`));
|
|
3728
3724
|
console.log(c.dim(t.models.reviewedOn(pricing.lastReviewed, reviewAgeDays(pricing.lastReviewed, new Date()))));
|
|
3729
3725
|
console.log();
|
|
3730
3726
|
const rows = pricing.models.map((m) => ({
|
|
@@ -3736,20 +3732,14 @@ function commandModels(t, pricing) {
|
|
|
3736
3732
|
// "caches from the first token" — and it is the wrong one.
|
|
3737
3733
|
cache: m.cacheMinTokens === null ? '—' : n(m.cacheMinTokens),
|
|
3738
3734
|
}));
|
|
3739
|
-
const
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
`${col.output.padStart(widths.output)} ${col.context.padStart(widths.context)} ` +
|
|
3748
|
-
`${col.cacheMin.padStart(widths.cache)}`));
|
|
3749
|
-
for (const row of rows) {
|
|
3750
|
-
console.log(` ${row.id.padEnd(widths.id)} ${row.input.padStart(widths.input)} ` +
|
|
3751
|
-
`${row.output.padStart(widths.output)} ${row.context.padStart(widths.context)} ` +
|
|
3752
|
-
`${row.cache.padStart(widths.cache)}`);
|
|
3735
|
+
for (const line of table([
|
|
3736
|
+
{ header: col.model, align: 'left' },
|
|
3737
|
+
{ header: col.input, align: 'right' },
|
|
3738
|
+
{ header: col.output, align: 'right' },
|
|
3739
|
+
{ header: col.context, align: 'right' },
|
|
3740
|
+
{ header: col.cacheMin, align: 'right' },
|
|
3741
|
+
], rows.map((row) => [row.id, row.input, row.output, row.context, row.cache]))) {
|
|
3742
|
+
console.log(line);
|
|
3753
3743
|
}
|
|
3754
3744
|
console.log();
|
|
3755
3745
|
console.log(c.dim(t.models.promoNote()));
|
|
@@ -3762,7 +3752,7 @@ function commandRules(t, locale) {
|
|
|
3762
3752
|
// never drift apart.
|
|
3763
3753
|
const copy = getMessages(locale).rules;
|
|
3764
3754
|
console.log();
|
|
3765
|
-
console.log(
|
|
3755
|
+
console.log(sectionHeading(t.rules.title()));
|
|
3766
3756
|
console.log(c.dim(t.rules.disableHint()));
|
|
3767
3757
|
console.log();
|
|
3768
3758
|
for (const rule of RULES) {
|
|
@@ -3831,7 +3821,7 @@ async function commandRulesMeasure(args, config, pricing, t) {
|
|
|
3831
3821
|
}
|
|
3832
3822
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3833
3823
|
console.log();
|
|
3834
|
-
console.log(
|
|
3824
|
+
console.log(sectionHeading(t.rules.measureHeading(root, report.prompts, level)));
|
|
3835
3825
|
console.log(` ${c.dim(t.rules.measureTotals(n(report.tokensBefore), n(report.tokensSaved), n(report.floor)))}`);
|
|
3836
3826
|
console.log();
|
|
3837
3827
|
for (const rule of report.rules) {
|
|
@@ -3961,7 +3951,7 @@ async function commandOptimize(args, config, pricing, t, locale) {
|
|
|
3961
3951
|
}
|
|
3962
3952
|
rows.sort((a, b) => b.savingUsd - a.savingUsd);
|
|
3963
3953
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3964
|
-
console.log(
|
|
3954
|
+
console.log(sectionHeading(t.report.allLabelsHeading(n(rows.length))));
|
|
3965
3955
|
for (const row of rows) {
|
|
3966
3956
|
const saving = row.periodOnly
|
|
3967
3957
|
? t.report.allLabelsRowPeriod(formatUsd(row.savingUsd))
|
|
@@ -4486,7 +4476,7 @@ async function checkEmbedded(path, extraction, budget, args, counter, level, t,
|
|
|
4486
4476
|
return;
|
|
4487
4477
|
}
|
|
4488
4478
|
console.log();
|
|
4489
|
-
console.log(
|
|
4479
|
+
console.log(sectionHeading(t.check.embeddedHeading(path, extraction.prompts.length)));
|
|
4490
4480
|
for (const verdict of verdicts) {
|
|
4491
4481
|
const over = isOverBudget(verdict);
|
|
4492
4482
|
const label = over ? c.red(t.check.failedLabel()) : c.green(t.check.okLabel());
|
|
@@ -4923,7 +4913,7 @@ function renderBudget(report, t, n) {
|
|
|
4923
4913
|
return;
|
|
4924
4914
|
}
|
|
4925
4915
|
console.log();
|
|
4926
|
-
console.log(
|
|
4916
|
+
console.log(sectionHeading(t.store.budgetHeading(standing.period.id)));
|
|
4927
4917
|
if (standing.coverage === 'none') {
|
|
4928
4918
|
// Nothing measured is never rendered as nothing spent. A dead store and a
|
|
4929
4919
|
// quiet month produce the same zero, and only one of them is good news.
|
|
@@ -5552,7 +5542,7 @@ async function commandPlan(args, pricing, t) {
|
|
|
5552
5542
|
console.log(JSON.stringify(stamped, null, 2));
|
|
5553
5543
|
return;
|
|
5554
5544
|
}
|
|
5555
|
-
console.log(
|
|
5545
|
+
console.log(sectionHeading(t.plan.heading(n(actions.length), formatUsd(plan.totalUsd))));
|
|
5556
5546
|
console.log(` ${wrap(t.plan.totals(formatUsd(stamped.projectedSavingUsd), formatUsd(stamped.measuredStakeUsd)), 74, ' ')}`);
|
|
5557
5547
|
if (plan.span === null) {
|
|
5558
5548
|
console.log(` ${c.dim(wrap(t.plan.noClock(), 74, ' '))}`);
|
|
@@ -5774,7 +5764,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
5774
5764
|
}, (key, value) => (value instanceof Map ? undefined : value), 2));
|
|
5775
5765
|
}
|
|
5776
5766
|
else {
|
|
5777
|
-
console.log(
|
|
5767
|
+
console.log(sectionHeading(t.profile.fleetHeading(n(rollup.sources.length), formatUsd(rollup.totalUsd), t.profile.calls(rollup.calls))));
|
|
5778
5768
|
for (const row of rollup.sources) {
|
|
5779
5769
|
const span = row.spanDays === null ? t.profile.fleetNoClock() : t.profile.fleetSpan(row.spanDays.toFixed(1));
|
|
5780
5770
|
console.log(` ${t.profile.fleetRow(row.name, formatUsd(row.usd), pct(row.share), t.profile.calls(row.calls), span)}`);
|
|
@@ -5841,7 +5831,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
5841
5831
|
}
|
|
5842
5832
|
const cov = report.fieldCoverage;
|
|
5843
5833
|
const parsed = cov.parsed;
|
|
5844
|
-
console.log(
|
|
5834
|
+
console.log(sectionHeading(t.profile.dryRunHeading()));
|
|
5845
5835
|
console.log(` ${wrap(t.profile.dryRunParsed(n(parsed), n(report.skippedLines.length)), 74, ' ')}`);
|
|
5846
5836
|
if (report.unpricedModels.length > 0) {
|
|
5847
5837
|
console.log(` ${c.yellow('!')} ${wrap(t.profile.dryRunUnpriced(report.unpricedModels.join(', ')), 74, ' ')}`);
|
|
@@ -6557,7 +6547,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
6557
6547
|
[t.profile.partOutput(), report.total.outputUsd, shares.output, report.total.outputTokens],
|
|
6558
6548
|
];
|
|
6559
6549
|
console.log();
|
|
6560
|
-
console.log(
|
|
6550
|
+
console.log(sectionHeading(t.profile.heading()));
|
|
6561
6551
|
console.log(` ${t.profile.spent(t.profile.calls(report.total.calls), formatUsd(report.total.totalUsd))}`);
|
|
6562
6552
|
/**
|
|
6563
6553
|
* The period, when the log carries a clock — stated, never extrapolated. A
|
|
@@ -6612,7 +6602,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
6612
6602
|
// Every part, including the zero ones. A row missing because it was zero reads
|
|
6613
6603
|
// as a row somebody forgot, and "you are not caching at all" is a finding.
|
|
6614
6604
|
for (const [name, usd, share, tokens] of parts) {
|
|
6615
|
-
console.log(` ${
|
|
6605
|
+
console.log(` ${bar(share)} ${t.profile.part(name, formatUsd(usd), pct(share), n(tokens))}`);
|
|
6616
6606
|
}
|
|
6617
6607
|
/**
|
|
6618
6608
|
* The line the command exists for: which part of the bill to argue with.
|
|
@@ -7017,7 +7007,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7017
7007
|
*/
|
|
7018
7008
|
const levers = billLevers(report, { catalogue: pricing });
|
|
7019
7009
|
console.log();
|
|
7020
|
-
console.log(
|
|
7010
|
+
console.log(sectionHeading(t.profile.leversHeading()));
|
|
7021
7011
|
/**
|
|
7022
7012
|
* Every lever below describes a mixture when nothing carries a label.
|
|
7023
7013
|
*
|
|
@@ -7080,7 +7070,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7080
7070
|
*/
|
|
7081
7071
|
if (whatIf !== null) {
|
|
7082
7072
|
console.log();
|
|
7083
|
-
console.log(
|
|
7073
|
+
console.log(sectionHeading(t.profile.whatIfHeading(whatIf.target.displayName)));
|
|
7084
7074
|
console.log(` ${c.dim(wrap(t.profile.whatIfAssumption(), 74, ' '))}`);
|
|
7085
7075
|
console.log();
|
|
7086
7076
|
if (whatIf.slices.length === 0) {
|
|
@@ -7149,7 +7139,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7149
7139
|
*/
|
|
7150
7140
|
if (report.conversations.length > 0) {
|
|
7151
7141
|
console.log();
|
|
7152
|
-
console.log(
|
|
7142
|
+
console.log(sectionHeading(t.profile.historyHeading()));
|
|
7153
7143
|
for (const growth of report.conversations.slice(0, 3)) {
|
|
7154
7144
|
const label = growth.label === UNLABELLED ? t.profile.unlabelled() : growth.label;
|
|
7155
7145
|
console.log();
|
|
@@ -7164,7 +7154,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7164
7154
|
* on the line most likely to be the biggest.
|
|
7165
7155
|
*/
|
|
7166
7156
|
console.log();
|
|
7167
|
-
console.log(
|
|
7157
|
+
console.log(sectionHeading(t.profile.historyHeading()));
|
|
7168
7158
|
console.log(` ${c.dim(wrap(t.profile.historyNoSessions(), 74, ' '))}`);
|
|
7169
7159
|
}
|
|
7170
7160
|
/**
|
|
@@ -7181,7 +7171,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7181
7171
|
*/
|
|
7182
7172
|
if (report.outputShapes.length > 0) {
|
|
7183
7173
|
console.log();
|
|
7184
|
-
console.log(
|
|
7174
|
+
console.log(sectionHeading(t.profile.outputShapeHeading()));
|
|
7185
7175
|
for (const shape of report.outputShapes.slice(0, 3)) {
|
|
7186
7176
|
const label = shape.label === UNLABELLED ? t.profile.unlabelled() : shape.label;
|
|
7187
7177
|
const isTail = shape.heavyCallShare < 0.25;
|
|
@@ -7221,7 +7211,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7221
7211
|
*/
|
|
7222
7212
|
if (report.inputShapes.length > 0) {
|
|
7223
7213
|
console.log();
|
|
7224
|
-
console.log(
|
|
7214
|
+
console.log(sectionHeading(t.profile.inputShapeHeading()));
|
|
7225
7215
|
for (const shape of report.inputShapes.slice(0, 3)) {
|
|
7226
7216
|
const label = shape.label === UNLABELLED ? t.profile.unlabelled() : shape.label;
|
|
7227
7217
|
console.log();
|
|
@@ -7268,7 +7258,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7268
7258
|
{
|
|
7269
7259
|
if (pressures.length > 0) {
|
|
7270
7260
|
console.log();
|
|
7271
|
-
console.log(
|
|
7261
|
+
console.log(sectionHeading(t.profile.pressureHeading()));
|
|
7272
7262
|
for (const row of pressures.slice(0, 3)) {
|
|
7273
7263
|
const label = row.label === UNLABELLED ? t.profile.unlabelled() : row.label;
|
|
7274
7264
|
const line = t.profile.pressureLine(label, row.modelName, n(row.maxCallInputTokens), n(row.contextWindow), pct(row.share));
|
|
@@ -7292,7 +7282,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7292
7282
|
const moved = report.modelMixDrift.models.filter((m) => Math.abs(m.lastShare - m.firstShare) >= 0.15);
|
|
7293
7283
|
if (moved.length > 0) {
|
|
7294
7284
|
console.log();
|
|
7295
|
-
console.log(
|
|
7285
|
+
console.log(sectionHeading(t.profile.mixDriftHeading()));
|
|
7296
7286
|
for (const m of moved.slice(0, 3)) {
|
|
7297
7287
|
console.log();
|
|
7298
7288
|
console.log(` ${c.yellow('!')} ${c.bold(wrap(t.profile.mixDriftLine(m.model, pct(m.firstShare), pct(m.lastShare), n(report.modelMixDrift.firstDays), n(report.modelMixDrift.lastDays), formatUsd(m.lastUsd)), 74, ' '))}`);
|
|
@@ -7312,7 +7302,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7312
7302
|
*/
|
|
7313
7303
|
if (report.repeatedTurns.length > 0) {
|
|
7314
7304
|
console.log();
|
|
7315
|
-
console.log(
|
|
7305
|
+
console.log(sectionHeading(t.profile.repeatsHeading()));
|
|
7316
7306
|
for (const row of report.repeatedTurns.slice(0, 3)) {
|
|
7317
7307
|
const label = row.label === UNLABELLED ? t.profile.unlabelled() : row.label;
|
|
7318
7308
|
console.log();
|
|
@@ -7395,7 +7385,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7395
7385
|
*/
|
|
7396
7386
|
if (previous !== null) {
|
|
7397
7387
|
console.log();
|
|
7398
|
-
console.log(
|
|
7388
|
+
console.log(sectionHeading(t.profile.againstHeading()));
|
|
7399
7389
|
if (previous.total.calls === 0) {
|
|
7400
7390
|
console.log(` ${c.dim(wrap(t.profile.againstNothingPriced(), 74, ' '))}`);
|
|
7401
7391
|
}
|
|
@@ -7488,10 +7478,10 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7488
7478
|
if (rows.length <= 1)
|
|
7489
7479
|
continue; // One row is the total again, said twice.
|
|
7490
7480
|
console.log();
|
|
7491
|
-
console.log(
|
|
7481
|
+
console.log(sectionHeading(heading));
|
|
7492
7482
|
for (const [name, breakdown] of rows) {
|
|
7493
7483
|
const share = report.total.totalUsd > 0 ? breakdown.totalUsd / report.total.totalUsd : 0;
|
|
7494
|
-
console.log(` ${t.profile.row(name, formatUsd(breakdown.totalUsd), pct(share), t.profile.calls(breakdown.calls))}`);
|
|
7484
|
+
console.log(` ${bar(share)} ${t.profile.row(name, formatUsd(breakdown.totalUsd), pct(share), t.profile.calls(breakdown.calls))}`);
|
|
7495
7485
|
}
|
|
7496
7486
|
}
|
|
7497
7487
|
/**
|
|
@@ -7523,7 +7513,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7523
7513
|
const outcomes = outcomeReport(report.outcomeTally, config.outcomes ?? null);
|
|
7524
7514
|
if (outcomes.coverage.recorded > 0) {
|
|
7525
7515
|
console.log();
|
|
7526
|
-
console.log(
|
|
7516
|
+
console.log(sectionHeading(t.profile.outcomeHeading()));
|
|
7527
7517
|
const col = t.profile.outcomeColumns;
|
|
7528
7518
|
const rows = [...outcomes.slices, ...outcomes.undeclared].map((slice) => ({
|
|
7529
7519
|
value: slice.value,
|
|
@@ -7580,7 +7570,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7580
7570
|
})), config.outcomes ?? null);
|
|
7581
7571
|
if (ranking.byCall.length > 0) {
|
|
7582
7572
|
console.log();
|
|
7583
|
-
console.log(
|
|
7573
|
+
console.log(sectionHeading(t.profile.perOutcomeHeading()));
|
|
7584
7574
|
const pcol = t.profile.perOutcomeColumns;
|
|
7585
7575
|
const prows = ranking.byCall.map((slice) => ({
|
|
7586
7576
|
key: slice.key,
|
|
@@ -7647,7 +7637,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7647
7637
|
}
|
|
7648
7638
|
if (missing.length > 0) {
|
|
7649
7639
|
console.log();
|
|
7650
|
-
console.log(
|
|
7640
|
+
console.log(sectionHeading(t.profile.coverageHeading()));
|
|
7651
7641
|
for (const line of missing)
|
|
7652
7642
|
console.log(` ${c.dim(wrap(line, 74, ' '))}`);
|
|
7653
7643
|
}
|
|
@@ -8126,7 +8116,7 @@ async function checkDirectory(root, args, flagBudget, config, counter, level, t,
|
|
|
8126
8116
|
const tokenWidth = Math.max(...verdicts.map((v) => n(v.tokens).length));
|
|
8127
8117
|
const budgetWidth = Math.max(0, ...verdicts.map((v) => (v.maxTokens === null ? 0 : n(v.maxTokens).length)));
|
|
8128
8118
|
console.log();
|
|
8129
|
-
console.log(
|
|
8119
|
+
console.log(sectionHeading(t.check.directoryHeading(root, verdicts.length)));
|
|
8130
8120
|
console.log();
|
|
8131
8121
|
for (const verdict of verdicts) {
|
|
8132
8122
|
const tokens = n(verdict.tokens).padStart(tokenWidth);
|
|
@@ -8248,7 +8238,7 @@ async function commandPrune(args, t) {
|
|
|
8248
8238
|
}
|
|
8249
8239
|
const pct = (value) => `${(value * 100).toFixed(0)}%`;
|
|
8250
8240
|
console.log();
|
|
8251
|
-
console.log(
|
|
8241
|
+
console.log(sectionHeading(t.prune.heading(provider.model)));
|
|
8252
8242
|
console.log(` ${c.dim(t.prune.selfAgreement(pct(report.selfAgreement)))}`);
|
|
8253
8243
|
console.log();
|
|
8254
8244
|
for (const contribution of report.contributions) {
|
|
@@ -8323,7 +8313,7 @@ async function commandEval(args, config, t, locale) {
|
|
|
8323
8313
|
}
|
|
8324
8314
|
const pct = (value) => `${(value * 100).toFixed(0)}%`;
|
|
8325
8315
|
console.log();
|
|
8326
|
-
console.log(
|
|
8316
|
+
console.log(sectionHeading(t.eval.heading()));
|
|
8327
8317
|
console.log(` ${t.eval.selfAgreement(pct(report.selfAgreement))}`);
|
|
8328
8318
|
console.log(` ${t.eval.crossAgreement(pct(report.crossAgreement))}`);
|
|
8329
8319
|
console.log();
|
|
@@ -8479,7 +8469,7 @@ function printComparison(comparison, beforePath, afterPath, optimized, t) {
|
|
|
8479
8469
|
const paint = grew ? c.red : comparison.tokenDelta < 0 ? c.green : c.dim;
|
|
8480
8470
|
const signed = (value) => `${value > 0 ? '+' : ''}${n(value)}`;
|
|
8481
8471
|
console.log();
|
|
8482
|
-
console.log(
|
|
8472
|
+
console.log(sectionHeading(t.diff.heading(beforePath, afterPath)));
|
|
8483
8473
|
if (optimized)
|
|
8484
8474
|
console.log(c.dim(` ${t.diff.measuringOptimised()}`));
|
|
8485
8475
|
console.log();
|