@trazum/cli 1.63.0 → 1.65.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trazum/cli",
3
- "version": "1.63.0",
3
+ "version": "1.65.0",
4
4
  "description": "Trazum CLI: find where your LLM bill goes, price every finding per month, and enforce token budgets in CI.",
5
5
  "license": "MIT",
6
6
  "author": "David Mu\u00f1oz Rey",
@@ -37,7 +37,7 @@
37
37
  "prepublishOnly": "npm run build && npm test"
38
38
  },
39
39
  "dependencies": {
40
- "@trazum/core": "1.63.0"
40
+ "@trazum/core": "1.65.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^26.2.0",
package/src/html.ts ADDED
@@ -0,0 +1,343 @@
1
+ import { UNLABELLED, formatUsd, sharesOf } from '@trazum/core';
2
+ import type { RollupDocument, UsageBreakdown } from '@trazum/core';
3
+ import type { CliMessages } from './i18n/index.js';
4
+ import type { ProfileMarkdownInput } from './markdown.js';
5
+ import { dayOf, spanDays } from './time.js';
6
+
7
+ /**
8
+ * HTML for the person who does not run CLIs.
9
+ *
10
+ * One self-contained file: inline CSS, no scripts, no external assets — a
11
+ * mail client, a wiki upload and a double-click all render it the same. It
12
+ * is a **projection of the document `--json` prints**, taking the exact same
13
+ * input object as the Markdown renderer: no second computation exists to
14
+ * disagree with the first, and the parity guard in the suite walks every
15
+ * figure here back to that document.
16
+ *
17
+ * The design rule this repository applies to its terminal output is applied
18
+ * here where a designer would be tempted to grey it out: **the caveats are
19
+ * furniture, not footnotes.** Unpriced models, skipped lines and the absent
20
+ * fields render inside a bordered block ahead of the detail tables, at the
21
+ * same visual weight as the totals they qualify — a forwarded report whose
22
+ * limits can be cropped out is a lie by omission wearing this tool's name.
23
+ *
24
+ * Escaping is not optional politeness: labels, model ids and file paths come
25
+ * from somebody's log, and a label is exactly where `<script>` would arrive.
26
+ * Everything interpolated goes through `esc()`, tested with hostile labels.
27
+ */
28
+
29
+ export function esc(value: string): string {
30
+ return value
31
+ .replaceAll('&', '&amp;')
32
+ .replaceAll('<', '&lt;')
33
+ .replaceAll('>', '&gt;')
34
+ .replaceAll('"', '&quot;')
35
+ .replaceAll("'", '&#39;');
36
+ }
37
+
38
+ /**
39
+ * A single committed look, print-first: explicit colours on everything, a
40
+ * caveat block that a printer and a dark-mode mail client both keep legible.
41
+ * No media-query theming — this file's job is to look the same everywhere,
42
+ * including on paper.
43
+ */
44
+ const STYLE = `
45
+ :root { color-scheme: light; }
46
+ body { margin: 0; padding: 2.5rem 1.25rem; background: #f7f6f3; color: #1f2328;
47
+ font: 16px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
48
+ main { max-width: 860px; margin: 0 auto; background: #ffffff; border: 1px solid #d9d5cc;
49
+ border-radius: 6px; padding: 2.25rem 2.5rem; }
50
+ h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
51
+ h2 { font-size: 1.05rem; margin: 2rem 0 .5rem; border-bottom: 1px solid #e4e0d8; padding-bottom: .3rem; }
52
+ .headline { font-size: 1.8rem; font-weight: 700; margin: .75rem 0 .1rem; font-variant-numeric: tabular-nums; }
53
+ .muted { color: #59606a; }
54
+ .gate-fail { border: 2px solid #b42318; background: #fdf1f0; color: #7a1a12;
55
+ padding: .7rem 1rem; border-radius: 6px; margin: 1rem 0; font-weight: 600; }
56
+ .gate-pass { color: #365f37; margin: 1rem 0; }
57
+ .caveats { border: 2px solid #8a6d1a; background: #fbf6e9; border-radius: 6px;
58
+ padding: 1rem 1.25rem; margin: 1.5rem 0; }
59
+ .caveats h2 { margin: 0 0 .5rem; border: 0; padding: 0; font-size: 1.05rem; color: #6d5510; }
60
+ .caveats ul { margin: 0; padding-left: 1.2rem; }
61
+ .caveats li { margin: .3rem 0; }
62
+ table { border-collapse: collapse; width: 100%; margin: .5rem 0 1rem; font-variant-numeric: tabular-nums; }
63
+ th { text-align: left; font-weight: 600; border-bottom: 2px solid #d9d5cc; padding: .35rem .6rem .35rem 0; }
64
+ td { border-bottom: 1px solid #ece9e2; padding: .35rem .6rem .35rem 0; }
65
+ td.n, th.n { text-align: right; }
66
+ ul.findings { padding-left: 1.2rem; } ul.findings li { margin: .35rem 0; }
67
+ footer { margin-top: 2rem; padding-top: .75rem; border-top: 1px solid #e4e0d8;
68
+ font-size: .85rem; color: #59606a; }
69
+ @media print { body { background: #ffffff; padding: 0; } main { border: 0; padding: 0; } }
70
+ `;
71
+
72
+ interface Row {
73
+ name: string;
74
+ breakdown: UsageBreakdown;
75
+ }
76
+
77
+ function breakdownTable(rows: Row[], totalUsd: number, t: ProfileMarkdownInput['t'], nameHeading: string): string {
78
+ const n = (value: number): string => value.toLocaleString(t.numberLocale);
79
+ const body = rows
80
+ .map(({ name, breakdown: b }) => {
81
+ const share = totalUsd > 0 ? `${((b.totalUsd / totalUsd) * 100).toFixed(1)}%` : '—';
82
+ return `<tr><td>${esc(name)}</td><td class="n">${n(b.calls)}</td><td class="n">${n(b.inputTokens)}</td><td class="n">${n(b.cacheReadTokens)}</td><td class="n">${n(b.cacheWriteTokens)}</td><td class="n">${n(b.outputTokens)}</td><td class="n">${esc(formatUsd(b.totalUsd))}</td><td class="n">${share}</td></tr>`;
83
+ })
84
+ .join('\n');
85
+ return `<table><thead><tr><th>${esc(nameHeading)}</th><th class="n">${esc(t.html.colCalls())}</th><th class="n">${esc(t.html.colInput())}</th><th class="n">${esc(t.html.colCacheRead())}</th><th class="n">${esc(t.html.colCacheWrite())}</th><th class="n">${esc(t.html.colOutput())}</th><th class="n">USD</th><th class="n">%</th></tr></thead><tbody>\n${body}\n</tbody></table>`;
86
+ }
87
+
88
+ /** The profile as one self-contained page. Same input as the Markdown door. */
89
+ export function renderProfileHtml(input: ProfileMarkdownInput): string {
90
+ const { report, levers, cache, t, gates, window, stalePricing } = input;
91
+ const n = (value: number): string => value.toLocaleString(t.numberLocale);
92
+ const pct = (share: number): string => `${(share * 100).toFixed(1)}%`;
93
+ const showLabel = (label: string): string => (label === UNLABELLED ? t.profile.unlabelled() : label);
94
+ const shares = sharesOf(report.total);
95
+ const parts: string[] = [];
96
+
97
+ parts.push(`<h1>${esc(t.profile.heading())}</h1>`);
98
+ parts.push(
99
+ `<p class="headline">${esc(t.profile.spent(t.profile.calls(report.total.calls), formatUsd(report.total.totalUsd)))}</p>`,
100
+ );
101
+ if (report.span !== null) {
102
+ parts.push(
103
+ `<p class="muted">${esc(t.profile.spanLine(dayOf(report.span.fromMs), dayOf(report.span.toMs), spanDays(report.span.fromMs, report.span.toMs)))}</p>`,
104
+ );
105
+ }
106
+ if (window !== undefined) {
107
+ parts.push(`<p class="muted">${esc(t.profile.windowLine(window.since, window.until))}</p>`);
108
+ }
109
+
110
+ if (gates !== undefined && gates.lines.length > 0) {
111
+ const box = gates.failed ? 'gate-fail' : 'gate-pass';
112
+ parts.push(`<div class="${box}">${gates.lines.map((line) => esc(line)).join('<br>')}</div>`);
113
+ }
114
+
115
+ /**
116
+ * The caveats, ahead of every detail table. What this report cannot say is
117
+ * part of what it says, and it renders before the part a skimmer stops at.
118
+ */
119
+ const caveats: string[] = [];
120
+ if (report.unpricedModels.length > 0) {
121
+ caveats.push(esc(t.profile.unpriced(report.unpricedModels.join(', '), report.unpriced.calls)));
122
+ }
123
+ if (report.skippedLines.length > 0) {
124
+ const shown = report.skippedLines.slice(0, 5).join(', ');
125
+ caveats.push(
126
+ esc(t.profile.skipped(report.skippedLines.length, report.skippedLines.length > 5 ? `${shown}…` : shown)),
127
+ );
128
+ }
129
+ if (report.span === null) caveats.push(esc(t.html.noClock()));
130
+ if (!report.hasSessions) caveats.push(esc(t.html.noSessions()));
131
+ if (report.total.assumedWriteTtlCalls > 0) {
132
+ caveats.push(
133
+ esc(
134
+ t.profile.cacheTtlUnsettled(
135
+ report.total.assumedWriteTtlCalls,
136
+ formatUsd(-cache.deltaUsd),
137
+ formatUsd(cache.worstCaseDeltaUsd),
138
+ ),
139
+ ),
140
+ );
141
+ }
142
+ if (stalePricing !== undefined) {
143
+ caveats.push(esc(t.profile.pricesStale(stalePricing.date, stalePricing.days)));
144
+ }
145
+ if (caveats.length > 0) {
146
+ parts.push(
147
+ `<div class="caveats"><h2>${esc(t.html.caveatsHeading())}</h2><ul>${caveats
148
+ .map((caveat) => `<li>${caveat}</li>`)
149
+ .join('')}</ul></div>`,
150
+ );
151
+ }
152
+
153
+ parts.push(`<h2>${esc(t.html.byLabelHeading())}</h2>`);
154
+ parts.push(
155
+ breakdownTable(
156
+ report.byLabel.map((row) => ({ name: showLabel(row.label), breakdown: row.breakdown })),
157
+ report.total.totalUsd,
158
+ t,
159
+ t.html.colLabel(),
160
+ ),
161
+ );
162
+
163
+ parts.push(`<h2>${esc(t.html.byModelHeading())}</h2>`);
164
+ parts.push(
165
+ breakdownTable(
166
+ report.byModel.map((row) => ({ name: row.model, breakdown: row.breakdown })),
167
+ report.total.totalUsd,
168
+ t,
169
+ t.html.colModel(),
170
+ ),
171
+ );
172
+
173
+ // The findings, as the sentences the terminal already says — the copy is
174
+ // the product's, not this file's, so the two surfaces cannot drift apart.
175
+ const findings: string[] = [];
176
+ for (const lever of levers.slices.slice(0, 5)) {
177
+ findings.push(
178
+ esc(t.profile.leverSlice(showLabel(lever.label), lever.modelName, formatUsd(lever.combinedUsd), pct(lever.shareOfBill))),
179
+ );
180
+ }
181
+ if (report.total.cacheReadTokens + report.total.cacheWriteTokens > 0) {
182
+ if (cache.deltaUsd > 0) {
183
+ findings.push(
184
+ esc(t.profile.cacheLost(formatUsd(cache.deltaUsd), n(report.total.cacheWriteTokens), n(report.total.cacheReadTokens))),
185
+ );
186
+ } else {
187
+ findings.push(esc(t.profile.cachePaidOff(formatUsd(-cache.deltaUsd))));
188
+ }
189
+ }
190
+ if (findings.length > 0) {
191
+ parts.push(`<h2>${esc(t.html.findingsHeading())}</h2>`);
192
+ parts.push(`<ul class="findings">${findings.map((finding) => `<li>${finding}</li>`).join('')}</ul>`);
193
+ }
194
+
195
+ parts.push(
196
+ `<p class="muted">${esc(t.html.sharesLine(pct(shares.input), pct(shares.cacheRead), pct(shares.cacheWrite), pct(shares.output)))}</p>`,
197
+ );
198
+
199
+ parts.push(`<footer>${esc(t.html.footer())}</footer>`);
200
+
201
+ return page(t.profile.heading(), t.locale, parts);
202
+ }
203
+
204
+ /** The shared skeleton: both documents are the same file to a mail client. */
205
+ function page(title: string, locale: string, parts: string[]): string {
206
+ return [
207
+ '<!doctype html>',
208
+ `<html lang="${esc(locale)}">`,
209
+ '<head>',
210
+ '<meta charset="utf-8">',
211
+ '<meta name="viewport" content="width=device-width, initial-scale=1">',
212
+ `<title>${esc(title)}</title>`,
213
+ `<style>${STYLE}</style>`,
214
+ '</head>',
215
+ '<body>',
216
+ '<main>',
217
+ ...parts,
218
+ '</main>',
219
+ '</body>',
220
+ '</html>',
221
+ '',
222
+ ].join('\n');
223
+ }
224
+
225
+ /**
226
+ * The roll-up as one self-contained page — the team-facing document, for
227
+ * exactly the person who does not run CLIs.
228
+ *
229
+ * The same discipline as the profile door: the input is the roll-up document
230
+ * itself, the one `--json` prints and `conform` checks, so the page cannot
231
+ * disagree with the data. Two things this page refuses to soften, because
232
+ * they are the roll-up's whole honesty: **each contributor's gaps stay under
233
+ * that contributor** — summing them away is the averaging this command
234
+ * exists to refuse — and **the `cannotSay` caveats render in the caveat
235
+ * block**, overlap-invisible included, so the one thing no merge can measure
236
+ * cannot be cropped out of the forwarded copy.
237
+ */
238
+ export function renderRollupHtml(document: RollupDocument, t: CliMessages): string {
239
+ const n = (value: number): string => value.toLocaleString(t.numberLocale);
240
+ const parts: string[] = [];
241
+
242
+ parts.push(`<h1>${esc(t.rollup.heading(document.contributors.length, formatUsd(document.total.totalUsd), document.total.calls))}</h1>`);
243
+ parts.push(`<p class="headline">${esc(formatUsd(document.total.totalUsd))}</p>`);
244
+ if (document.span !== null) {
245
+ parts.push(`<p class="muted">${esc(t.rollup.span(dayOf(document.span.fromMs), dayOf(document.span.toMs)))}</p>`);
246
+ } else {
247
+ parts.push(`<p class="muted">${esc(t.rollup.noSpan())}</p>`);
248
+ }
249
+
250
+ // The caveat block, ahead of every table: what the merge cannot say, what
251
+ // was rejected by name, and which contributions arrived twice.
252
+ const caveats: string[] = [];
253
+ for (const code of document.cannotSay) caveats.push(esc(t.rollup.caveat(code)));
254
+ for (const rejection of document.rejected) {
255
+ caveats.push(
256
+ esc(
257
+ rejection.via === null
258
+ ? t.rollup.rejected(rejection.name, rejection.because)
259
+ : t.rollup.rejectedVia(rejection.name, rejection.via, rejection.because),
260
+ ),
261
+ );
262
+ }
263
+ if (document.repeatedContributors.length > 0) {
264
+ caveats.push(esc(t.rollup.repeated(document.repeatedContributors.join(', '))));
265
+ }
266
+ for (const group of document.identicalContributions.groups) {
267
+ caveats.push(esc(t.rollup.identical(group.join(', '))));
268
+ }
269
+ if (document.identicalContributions.usd > 0) {
270
+ caveats.push(esc(t.rollup.identicalUsd(formatUsd(document.identicalContributions.usd))));
271
+ }
272
+ if (document.unpricedModels.length > 0) {
273
+ caveats.push(esc(t.profile.unpriced(document.unpricedModels.join(', '), document.unpriced.calls)));
274
+ }
275
+ if (caveats.length > 0) {
276
+ parts.push(
277
+ `<div class="caveats"><h2>${esc(t.rollup.cannotSayHeading())}</h2><ul>${caveats
278
+ .map((caveat) => `<li>${caveat}</li>`)
279
+ .join('')}</ul></div>`,
280
+ );
281
+ }
282
+
283
+ // One contributor, one row — and that contributor's own gaps directly
284
+ // beneath its name, never pooled.
285
+ parts.push(`<h2>${esc(t.rollup.contributorsHeading())}</h2>`);
286
+ const contributorRows = document.contributors
287
+ .map((contributor) => {
288
+ const gapItems = contributor.gaps
289
+ .map((gap) => `<li>${esc(gap.detail)}${gap.usd !== null ? ` — ${esc(formatUsd(gap.usd))}` : ''}</li>`)
290
+ .join('');
291
+ const gaps = gapItems === '' ? '' : `<ul class="findings">${gapItems}</ul>`;
292
+ return `<tr><td>${esc(contributor.name)}</td><td class="n">${n(contributor.calls)}</td><td class="n">${esc(formatUsd(contributor.totalUsd))}</td><td class="n">${contributor.spanDays === null ? '—' : n(contributor.spanDays)}</td></tr>${
293
+ gaps === '' ? '' : `<tr><td colspan="4">${gaps}</td></tr>`
294
+ }`;
295
+ })
296
+ .join('\n');
297
+ parts.push(
298
+ `<table><thead><tr><th>${esc(t.html.colContributor())}</th><th class="n">${esc(t.html.colCalls())}</th><th class="n">USD</th><th class="n">${esc(t.html.colSpanDays())}</th></tr></thead><tbody>\n${contributorRows}\n</tbody></table>`,
299
+ );
300
+
301
+ parts.push(`<h2>${esc(t.rollup.byLabelHeading())}</h2>`);
302
+ parts.push(
303
+ breakdownTable(
304
+ document.byLabel.map((row) => ({
305
+ name: row.label === UNLABELLED ? t.profile.unlabelled() : row.label,
306
+ breakdown: row.breakdown,
307
+ })),
308
+ document.total.totalUsd,
309
+ t,
310
+ t.html.colLabel(),
311
+ ),
312
+ );
313
+ parts.push(`<h2>${esc(t.html.byModelHeading())}</h2>`);
314
+ parts.push(
315
+ breakdownTable(
316
+ document.byModel.map((row) => ({ name: row.model, breakdown: row.breakdown })),
317
+ document.total.totalUsd,
318
+ t,
319
+ t.html.colModel(),
320
+ ),
321
+ );
322
+
323
+ // Findings that did not merge are named with the contributors that have
324
+ // them — reported as prose, exactly as the terminal says it.
325
+ if (document.notMerged.length > 0) {
326
+ parts.push(`<h2>${esc(t.rollup.notMergedHeading())}</h2>`);
327
+ parts.push(
328
+ `<ul class="findings">${document.notMerged
329
+ .map(
330
+ (entry) =>
331
+ `<li>${esc(t.rollup.notMerged(entry.finding, entry.because))} ${esc(t.rollup.presentIn(entry.presentIn.join(', ')))}</li>`,
332
+ )
333
+ .join('')}</ul>`,
334
+ );
335
+ }
336
+
337
+ parts.push(`<footer>${esc(t.html.footer())}</footer>`);
338
+ return page(
339
+ t.rollup.heading(document.contributors.length, formatUsd(document.total.totalUsd), document.total.calls),
340
+ t.locale,
341
+ parts,
342
+ );
343
+ }
package/src/i18n/en.ts CHANGED
@@ -56,7 +56,8 @@ ${bold('USAGE')}
56
56
  trazum prune <file> --cases <file> --yes
57
57
  trazum where [file]
58
58
  trazum conform <file|-> [--contract <name>]
59
- trazum rollup <document...|dir> [--json]
59
+ trazum schema <contract>
60
+ trazum rollup <document...|dir> [--json] [--html-out <file>]
60
61
  trazum pulse [--max-stale-hours <n>]
61
62
  trazum bench [--workload <id>] [--record <file>] [--against <file> --max-ratio <n>] [--json]
62
63
  trazum write [--answers <file>] [--json] [-o <file>]
@@ -104,6 +105,11 @@ ${bold('OPTIONS FOR conform')}
104
105
 
105
106
  ${bold('OPTIONS FOR rollup')}
106
107
  --json The roll-up document as data. See docs/format.md.
108
+ --html-out <file> Also write the roll-up as one self-contained HTML
109
+ file — the team-facing report, for whoever pays
110
+ the bill. Each contributor's gaps stay under that
111
+ contributor, and what no merge can measure is in
112
+ the caveat block, impossible to crop.
107
113
 
108
114
  Several people's bills, one roll-up. Each contributor runs
109
115
  \`trazum profile --json\` where their traffic already is; this merges the
@@ -516,6 +522,10 @@ ${bold('OPTIONS FOR profile')}
516
522
  are named as impossible, not priced as cheap.
517
523
  --markdown-out <file> Also write the report as Markdown, for a CI job
518
524
  summary or a pull request comment.
525
+ --html-out <file> Also write the report as one self-contained HTML
526
+ file — the one to email to whoever pays the bill.
527
+ Same figures as --json, caveats rendered as
528
+ prominently as the totals they qualify.
519
529
  --csv-shape <shape> Which table --csv-out writes: slice (default),
520
530
  day, hour, or model-day (one row per day and
521
531
  model — charts the mix moving). One row shape
@@ -1576,6 +1586,35 @@ ${bold('EXAMPLES')}
1576
1586
  'This command runs nothing and hosts nothing. Something has to notice, and the something is your CI: a step that runs this on the schedule you already have turns a dead cron into a red build, without Trazum holding anybody\'s metrics. How far the measurements reach is reported and never judged — that is a provider reporting on its own schedule, not a job that failed.',
1577
1587
  },
1578
1588
 
1589
+ html: {
1590
+ caveatsHeading: () => 'What this report cannot say',
1591
+ noClock: () => 'No record carried a timestamp, so days, rates and drift are not in this report — a total is still a total.',
1592
+ noSessions: () => 'No record carried a session, so conversation growth and per-conversation costs are not in this report.',
1593
+ byLabelHeading: () => 'By workload',
1594
+ byModelHeading: () => 'By model',
1595
+ findingsHeading: () => 'What would move this bill',
1596
+ colLabel: () => 'workload',
1597
+ colModel: () => 'model',
1598
+ colContributor: () => 'contributor',
1599
+ colSpanDays: () => 'days',
1600
+ colCalls: () => 'calls',
1601
+ colInput: () => 'input',
1602
+ colCacheRead: () => 'cache reads',
1603
+ colCacheWrite: () => 'cache writes',
1604
+ colOutput: () => 'output',
1605
+ sharesLine: (input, cacheRead, cacheWrite, output) =>
1606
+ `Where the money goes: ${input} plain input, ${cacheRead} cache reads, ${cacheWrite} cache writes, ${output} output.`,
1607
+ footer: () =>
1608
+ 'Generated by trazum from a usage log, offline. Every figure derives from that log and the pricing table the run named; nothing here was sent anywhere to be computed.',
1609
+ written: (path) => `HTML report written to ${path}.`,
1610
+ },
1611
+
1612
+ schema: {
1613
+ noTarget: (known) =>
1614
+ `Name a contract to print its JSON Schema. Known: ${known}. The schema validates with any draft 2020-12 validator — no Trazum required.`,
1615
+ unknown: (name, known) => `"${name}" is not a contract. Known: ${known}.`,
1616
+ },
1617
+
1579
1618
  bench: {
1580
1619
  heading: () => 'This machine, measured',
1581
1620
  machine: (node, platform, cpuCount, cpuModel) =>
package/src/i18n/es.ts CHANGED
@@ -43,7 +43,8 @@ ${bold('USO')}
43
43
  trazum prune <fichero> --cases <fichero> --yes
44
44
  trazum where [fichero]
45
45
  trazum conform <fichero|-> [--contract <nombre>]
46
- trazum rollup <documento...|dir> [--json]
46
+ trazum schema <contrato>
47
+ trazum rollup <documento...|dir> [--json] [--html-out <fichero>]
47
48
  trazum pulse [--max-stale-hours <n>]
48
49
  trazum bench [--workload <id>] [--record <fichero>] [--against <fichero> --max-ratio <n>] [--json]
49
50
  trazum write [--answers <fichero>] [--json] [-o <fichero>]
@@ -92,6 +93,12 @@ ${bold('OPCIONES DE conform')}
92
93
  ${bold('OPCIONES DE rollup')}
93
94
  --json El documento de agregación como datos. Ver
94
95
  docs/format.md.
96
+ --html-out <fichero> Escribe además el roll-up como un único HTML
97
+ autocontenido — el informe de equipo, para quien
98
+ paga la factura. Los huecos de cada contribuyente
99
+ se quedan bajo ese contribuyente, y lo que ninguna
100
+ fusión puede medir va en la caja de salvedades,
101
+ imposible de recortar.
95
102
 
96
103
  Las facturas de varias personas, una sola agregación. Cada contribuyente
97
104
  ejecuta \`trazum profile --json\` donde ya está su tráfico; esto fusiona los
@@ -523,6 +530,11 @@ ${bold('OPCIONES DE profile')}
523
530
  imposibles, no se cobran como baratas.
524
531
  --markdown-out <fichero> Escribe además el informe en Markdown, para el
525
532
  resumen de un job de CI o un comentario de PR.
533
+ --html-out <fichero> Escribe además el informe como un único HTML
534
+ autocontenido — el que se envía por correo a
535
+ quien paga la factura. Las mismas cifras que
536
+ --json, con las salvedades tan visibles como
537
+ los totales a los que acompañan.
526
538
  --csv-shape <forma> Qué tabla escribe --csv-out: slice (por defecto),
527
539
  day, hour o model-day (una fila por día y
528
540
  modelo — dibuja la mezcla moviéndose). Una sola
@@ -1586,6 +1598,35 @@ ${bold('EJEMPLOS')}
1586
1598
  'Este comando no ejecuta nada y no aloja nada. Algo tiene que darse cuenta, y ese algo es tu CI: un paso que ejecute esto con el horario que ya tienes convierte un cron muerto en una build roja, sin que Trazum guarde las métricas de nadie. Hasta dónde llegan las mediciones se informa y nunca se juzga — eso es un proveedor informando a su ritmo, no un trabajo que falló.',
1587
1599
  },
1588
1600
 
1601
+ html: {
1602
+ caveatsHeading: () => 'Lo que este informe no puede decir',
1603
+ noClock: () => 'Ningún registro traía marca de tiempo, así que días, ritmos y deriva no están en este informe — un total sigue siendo un total.',
1604
+ noSessions: () => 'Ningún registro traía sesión, así que el crecimiento de conversación y los costes por conversación no están en este informe.',
1605
+ byLabelHeading: () => 'Por carga de trabajo',
1606
+ byModelHeading: () => 'Por modelo',
1607
+ findingsHeading: () => 'Qué movería esta factura',
1608
+ colLabel: () => 'carga',
1609
+ colModel: () => 'modelo',
1610
+ colContributor: () => 'contribuyente',
1611
+ colSpanDays: () => 'días',
1612
+ colCalls: () => 'llamadas',
1613
+ colInput: () => 'entrada',
1614
+ colCacheRead: () => 'lecturas de caché',
1615
+ colCacheWrite: () => 'escrituras de caché',
1616
+ colOutput: () => 'salida',
1617
+ sharesLine: (input, cacheRead, cacheWrite, output) =>
1618
+ `A dónde va el dinero: ${input} entrada normal, ${cacheRead} lecturas de caché, ${cacheWrite} escrituras de caché, ${output} salida.`,
1619
+ footer: () =>
1620
+ 'Generado por trazum a partir de un log de uso, sin conexión. Cada cifra deriva de ese log y de la tabla de precios que la ejecución nombró; nada de esto se envió a ninguna parte para calcularse.',
1621
+ written: (path) => `Informe HTML escrito en ${path}.`,
1622
+ },
1623
+
1624
+ schema: {
1625
+ noTarget: (known) =>
1626
+ `Nombra un contrato para imprimir su JSON Schema. Conocidos: ${known}. El esquema valida con cualquier validador draft 2020-12 — sin Trazum.`,
1627
+ unknown: (name, known) => `"${name}" no es un contrato. Conocidos: ${known}.`,
1628
+ },
1629
+
1589
1630
  bench: {
1590
1631
  heading: () => 'Esta máquina, medida',
1591
1632
  machine: (node, platform, cpuCount, cpuModel) =>
package/src/i18n/types.ts CHANGED
@@ -529,6 +529,34 @@ export interface CliMessages {
529
529
  notAService(): string;
530
530
  };
531
531
 
532
+ /** The HTML report: the one surface for a reader with an inbox, not a terminal. */
533
+ html: {
534
+ caveatsHeading(): string;
535
+ noClock(): string;
536
+ noSessions(): string;
537
+ byLabelHeading(): string;
538
+ byModelHeading(): string;
539
+ findingsHeading(): string;
540
+ colLabel(): string;
541
+ colModel(): string;
542
+ colContributor(): string;
543
+ colSpanDays(): string;
544
+ colCalls(): string;
545
+ colInput(): string;
546
+ colCacheRead(): string;
547
+ colCacheWrite(): string;
548
+ colOutput(): string;
549
+ sharesLine(input: string, cacheRead: string, cacheWrite: string, output: string): string;
550
+ footer(): string;
551
+ written(path: string): string;
552
+ };
553
+
554
+ /** The portable format: a JSON Schema per contract, for validators that are not Trazum. */
555
+ schema: {
556
+ noTarget(known: string): string;
557
+ unknown(name: string, known: string): string;
558
+ };
559
+
532
560
  bench: {
533
561
  heading(): string;
534
562
  machine(node: string, platform: string, cpuCount: number, cpuModel: string | null): string;