@trazum/cli 2.4.0 → 2.4.2

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/dist/pdf.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { ProfileMarkdownInput } from './markdown.js';
2
+ export interface ProfilePdfOptions {
3
+ /** Written into the file's metadata only when given, so tests can compare bytes. */
4
+ createdAt?: Date;
5
+ }
6
+ /** The profile as one PDF. Same input as the HTML and Markdown doors. */
7
+ export declare function renderProfilePdf(input: ProfileMarkdownInput, options?: ProfilePdfOptions): Uint8Array;
8
+ //# sourceMappingURL=pdf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAyC1D,MAAM,WAAW,iBAAiB;IAChC,oFAAoF;IACpF,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CA2QzG"}
package/dist/pdf.js ADDED
@@ -0,0 +1,261 @@
1
+ import { PdfDocument, UNLABELLED, formatUsd, pdfFit, pdfWrap, sharesOf } from '@trazum/core';
2
+ import { dayOf, spanDays } from './time.js';
3
+ /**
4
+ * The profile as a PDF, for the person who signs the bill off.
5
+ *
6
+ * The same input object the HTML and Markdown doors take, and the same
7
+ * sentences from the same message catalogue, so the three files are one
8
+ * report in three envelopes: a figure that differed between them would be a
9
+ * second computation, and there is none. The rules the HTML door applies are
10
+ * applied here, for the same reasons:
11
+ *
12
+ * - **The caveats are furniture.** What the report cannot say renders in a
13
+ * bordered block ahead of every table, at the weight of the totals it
14
+ * qualifies. A PDF is the format most likely to be forwarded without the
15
+ * terminal it came from, which makes it the one where a caveat that can be
16
+ * cropped out matters most.
17
+ * - **Every page carries the footer** that says where the figures came from,
18
+ * because a printed page gets separated from its first one.
19
+ *
20
+ * Written with core's `PdfDocument`: no dependency, no embedded font, the
21
+ * same bytes for the same report.
22
+ */
23
+ const INK = '#1f2328';
24
+ const MUTED = '#59606a';
25
+ const RULE = '#d9d5cc';
26
+ const ZEBRA = '#f7f6f3';
27
+ const CAVEAT_EDGE = '#8a6d1a';
28
+ const CAVEAT_FILL = '#fbf6e9';
29
+ const CAVEAT_INK = '#6d5510';
30
+ const FAIL_EDGE = '#b42318';
31
+ const FAIL_FILL = '#fdf1f0';
32
+ const FAIL_INK = '#7a1a12';
33
+ const PASS_INK = '#365f37';
34
+ const MARGIN = 48;
35
+ const TOP = 56;
36
+ /** Below this the footer lives; content that would cross it starts a page. */
37
+ const FOOTER_SPACE = 70;
38
+ /** The profile as one PDF. Same input as the HTML and Markdown doors. */
39
+ export function renderProfilePdf(input, options = {}) {
40
+ const { report, levers, cache, t, gates, window, stalePricing } = input;
41
+ const n = (value) => value.toLocaleString(t.numberLocale);
42
+ const pct = (share) => `${(share * 100).toFixed(1)}%`;
43
+ const showLabel = (label) => (label === UNLABELLED ? t.profile.unlabelled() : label);
44
+ const doc = new PdfDocument();
45
+ const width = doc.width - MARGIN * 2;
46
+ const bottom = doc.height - FOOTER_SPACE;
47
+ let y = TOP;
48
+ const need = (height) => {
49
+ if (y + height <= bottom)
50
+ return false;
51
+ doc.addPage();
52
+ y = TOP;
53
+ return true;
54
+ };
55
+ /** A wrapped paragraph; returns nothing, moves the cursor. */
56
+ const paragraph = (text, font, size, color, after = 4) => {
57
+ const leading = size * 1.35;
58
+ for (const line of pdfWrap(text, font, size, width)) {
59
+ need(leading);
60
+ doc.text(MARGIN, y + size, line, { font, size, color });
61
+ y += leading;
62
+ }
63
+ y += after;
64
+ };
65
+ const heading = (text) => {
66
+ need(40);
67
+ y += 14;
68
+ doc.text(MARGIN, y + 11, text, { font: 'bold', size: 11.5, color: INK });
69
+ y += 17;
70
+ doc.line(MARGIN, y, MARGIN + width, y, { color: RULE, width: 0.75 });
71
+ y += 8;
72
+ };
73
+ /**
74
+ * A box of sentences: the caveats and the gate verdict. Measured before it
75
+ * is drawn so the border fits what is inside it, and moved whole to the
76
+ * next page rather than split, because half a caveat is a different claim.
77
+ */
78
+ const box = (title, lines, colors, bullet) => {
79
+ const size = 9;
80
+ const leading = size * 1.4;
81
+ const pad = 10;
82
+ const indent = bullet ? 10 : 0;
83
+ const wrapped = lines.map((line) => pdfWrap(line, bullet ? 'regular' : 'bold', size, width - pad * 2 - indent));
84
+ const titleHeight = title === null ? 0 : 18;
85
+ const height = pad * 2 + titleHeight + wrapped.reduce((sum, w) => sum + w.length * leading + 2, 0);
86
+ need(height + 8);
87
+ doc.rect(MARGIN, y, width, height, { fill: colors.fill, stroke: colors.edge, lineWidth: 1.5 });
88
+ let inner = y + pad;
89
+ if (title !== null) {
90
+ doc.text(MARGIN + pad, inner + 10, title, { font: 'bold', size: 10.5, color: colors.ink });
91
+ inner += titleHeight;
92
+ }
93
+ for (const lineSet of wrapped) {
94
+ lineSet.forEach((line, i) => {
95
+ if (bullet && i === 0)
96
+ doc.text(MARGIN + pad, inner + size, '•', { size, color: colors.ink });
97
+ doc.text(MARGIN + pad + indent, inner + size, line, { font: bullet ? 'regular' : 'bold', size, color: colors.ink });
98
+ inner += leading;
99
+ });
100
+ inner += 2;
101
+ }
102
+ y += height + 10;
103
+ };
104
+ /** The breakdown table, its header repeated on every page it crosses. */
105
+ const table = (rows, nameHeading) => {
106
+ const size = 7.5;
107
+ const rowHeight = 13;
108
+ const figureColumns = [
109
+ t.html.colCalls(),
110
+ t.html.colInput(),
111
+ t.html.colCacheRead(),
112
+ t.html.colCacheWrite(),
113
+ t.html.colOutput(),
114
+ 'USD',
115
+ '%',
116
+ ];
117
+ const figureWidth = 54;
118
+ const nameWidth = width - figureWidth * figureColumns.length;
119
+ const right = (column) => MARGIN + nameWidth + figureWidth * (column + 1) - 4;
120
+ /* A heading wraps to two lines rather than being cut: "lecturas de
121
+ caché" cut to "lecturas de…" no longer says which column it is. */
122
+ const headings = figureColumns.map((column) => pdfWrap(column, 'bold', size, figureWidth - 6).slice(0, 2));
123
+ const headerLines = Math.max(1, ...headings.map((lines) => lines.length));
124
+ const header = () => {
125
+ const base = y + 9 + (headerLines - 1) * (size + 1.5);
126
+ doc.text(MARGIN + 4, base, pdfFit(nameHeading, 'bold', size, nameWidth - 8), { font: 'bold', size, color: INK });
127
+ headings.forEach((lines, i) => {
128
+ lines.forEach((line, j) => {
129
+ const lineY = base - (lines.length - 1 - j) * (size + 1.5);
130
+ doc.textRight(right(i), lineY, pdfFit(line, 'bold', size, figureWidth - 6), { font: 'bold', size, color: INK });
131
+ });
132
+ });
133
+ y += rowHeight + (headerLines - 1) * (size + 1.5);
134
+ doc.line(MARGIN, y, MARGIN + width, y, { color: RULE, width: 1.25 });
135
+ y += 2;
136
+ };
137
+ need(rowHeight * 3);
138
+ header();
139
+ rows.forEach(({ name, breakdown: b, unpriced }, index) => {
140
+ if (need(rowHeight))
141
+ header();
142
+ if (index % 2 === 1)
143
+ doc.rect(MARGIN, y, width, rowHeight, { fill: ZEBRA });
144
+ const share = report.total.totalUsd > 0 && !unpriced ? pct(b.totalUsd / report.total.totalUsd) : '—';
145
+ const cells = [
146
+ n(b.calls),
147
+ n(b.inputTokens),
148
+ n(b.cacheReadTokens),
149
+ n(b.cacheWriteTokens),
150
+ n(b.outputTokens),
151
+ unpriced ? '—' : formatUsd(b.totalUsd),
152
+ share,
153
+ ];
154
+ doc.text(MARGIN + 4, y + 9, pdfFit(name, 'regular', size, nameWidth - 8), { size, color: INK });
155
+ cells.forEach((cell, i) => {
156
+ doc.textRight(right(i), y + 9, pdfFit(cell, 'regular', size, figureWidth - 6), { size, color: INK });
157
+ });
158
+ y += rowHeight;
159
+ });
160
+ y += 6;
161
+ };
162
+ // The masthead: what this is and the one figure a reader came for.
163
+ doc.text(MARGIN, y + 9, 'trazum', { font: 'bold', size: 9, color: MUTED });
164
+ y += 16;
165
+ doc.line(MARGIN, y, MARGIN + width, y, { color: RULE, width: 0.75 });
166
+ y += 14;
167
+ paragraph(t.profile.heading(), 'bold', 19, INK, 2);
168
+ paragraph(t.profile.spent(t.profile.calls(report.total.calls), formatUsd(report.total.totalUsd)), 'bold', 14, INK, 4);
169
+ if (report.span !== null) {
170
+ paragraph(t.profile.spanLine(dayOf(report.span.fromMs), dayOf(report.span.toMs), spanDays(report.span.fromMs, report.span.toMs)), 'regular', 9.5, MUTED, 0);
171
+ }
172
+ if (window !== undefined)
173
+ paragraph(t.profile.windowLine(window.since, window.until), 'regular', 9.5, MUTED, 0);
174
+ y += 8;
175
+ if (gates !== undefined && gates.lines.length > 0) {
176
+ if (gates.failed) {
177
+ box(null, gates.lines, { edge: FAIL_EDGE, fill: FAIL_FILL, ink: FAIL_INK }, false);
178
+ }
179
+ else {
180
+ for (const line of gates.lines)
181
+ paragraph(line, 'regular', 9.5, PASS_INK, 0);
182
+ y += 6;
183
+ }
184
+ }
185
+ // The caveats, ahead of every table, as in the HTML door.
186
+ const caveats = [];
187
+ if (report.unpricedModels.length > 0) {
188
+ caveats.push(t.profile.unpriced(report.unpricedModels.join(', '), report.unpriced.calls));
189
+ }
190
+ if (report.skippedLines.length > 0) {
191
+ const shown = report.skippedLines.slice(0, 5).join(', ');
192
+ caveats.push(t.profile.skipped(report.skippedLines.length, report.skippedLines.length > 5 ? `${shown}…` : shown));
193
+ }
194
+ if (report.span === null)
195
+ caveats.push(t.html.noClock());
196
+ if (!report.hasSessions)
197
+ caveats.push(t.html.noSessions());
198
+ if (report.total.assumedWriteTtlCalls > 0) {
199
+ caveats.push(t.profile.cacheTtlUnsettled(report.total.assumedWriteTtlCalls, formatUsd(-cache.deltaUsd), formatUsd(cache.worstCaseDeltaUsd)));
200
+ }
201
+ if (stalePricing !== undefined)
202
+ caveats.push(t.profile.pricesStale(stalePricing.date, stalePricing.days));
203
+ if (caveats.length > 0) {
204
+ box(t.html.caveatsHeading(), caveats, { edge: CAVEAT_EDGE, fill: CAVEAT_FILL, ink: CAVEAT_INK }, true);
205
+ }
206
+ heading(t.html.byLabelHeading());
207
+ table(report.byLabel.map((row) => ({ name: showLabel(row.label), breakdown: row.breakdown })), t.html.colLabel());
208
+ heading(t.html.byModelHeading());
209
+ table(report.byModel.map((row) => ({
210
+ name: row.model,
211
+ breakdown: row.breakdown,
212
+ unpriced: report.unpricedModels.includes(row.model),
213
+ })), t.html.colModel());
214
+ // The findings, as the sentences the terminal says.
215
+ const findings = [];
216
+ for (const lever of levers.slices.slice(0, 5)) {
217
+ findings.push(t.profile.leverSlice(showLabel(lever.label), lever.modelName, formatUsd(lever.combinedUsd), pct(lever.shareOfBill)));
218
+ }
219
+ if (report.total.cacheReadTokens + report.total.cacheWriteTokens > 0) {
220
+ findings.push(cache.deltaUsd > 0
221
+ ? t.profile.cacheLost(formatUsd(cache.deltaUsd), n(report.total.cacheWriteTokens), n(report.total.cacheReadTokens))
222
+ : t.profile.cachePaidOff(formatUsd(-cache.deltaUsd)));
223
+ }
224
+ if (findings.length > 0) {
225
+ heading(t.html.findingsHeading());
226
+ const size = 9.5;
227
+ const leading = size * 1.4;
228
+ for (const finding of findings) {
229
+ const lines = pdfWrap(finding, 'regular', size, width - 12);
230
+ need(lines.length * leading);
231
+ doc.text(MARGIN, y + size, '•', { size, color: INK });
232
+ for (const line of lines) {
233
+ doc.text(MARGIN + 12, y + size, line, { size, color: INK });
234
+ y += leading;
235
+ }
236
+ y += 3;
237
+ }
238
+ }
239
+ const shares = sharesOf(report.total);
240
+ y += 6;
241
+ paragraph(t.html.sharesLine(pct(shares.input), pct(shares.cacheRead), pct(shares.cacheWrite), pct(shares.output)), 'regular', 9, MUTED);
242
+ // The footer on every page, now that the page count is known.
243
+ const footerSize = 7.5;
244
+ const pageLabelWidth = 70;
245
+ const footerLines = pdfWrap(t.html.footer(), 'regular', footerSize, width - pageLabelWidth);
246
+ for (let page = 0; page < doc.pageCount; page += 1) {
247
+ doc.setPage(page);
248
+ const top = doc.height - FOOTER_SPACE + 22;
249
+ doc.line(MARGIN, top, MARGIN + width, top, { color: RULE, width: 0.75 });
250
+ footerLines.forEach((line, i) => {
251
+ doc.text(MARGIN, top + 11 + i * footerSize * 1.35, line, { size: footerSize, color: MUTED });
252
+ });
253
+ doc.textRight(MARGIN + width, top + 11, t.pdf.page(page + 1, doc.pageCount), { size: footerSize, color: MUTED });
254
+ }
255
+ return doc.toBytes({
256
+ title: t.profile.heading(),
257
+ subject: t.profile.spent(t.profile.calls(report.total.calls), formatUsd(report.total.totalUsd)),
258
+ ...(options.createdAt !== undefined ? { createdAt: options.createdAt } : {}),
259
+ });
260
+ }
261
+ //# sourceMappingURL=pdf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf.js","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7F,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,GAAG,GAAa,SAAS,CAAC;AAChC,MAAM,KAAK,GAAa,SAAS,CAAC;AAClC,MAAM,IAAI,GAAa,SAAS,CAAC;AACjC,MAAM,KAAK,GAAa,SAAS,CAAC;AAClC,MAAM,WAAW,GAAa,SAAS,CAAC;AACxC,MAAM,WAAW,GAAa,SAAS,CAAC;AACxC,MAAM,UAAU,GAAa,SAAS,CAAC;AACvC,MAAM,SAAS,GAAa,SAAS,CAAC;AACtC,MAAM,SAAS,GAAa,SAAS,CAAC;AACtC,MAAM,QAAQ,GAAa,SAAS,CAAC;AACrC,MAAM,QAAQ,GAAa,SAAS,CAAC;AAErC,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,GAAG,GAAG,EAAE,CAAC;AACf,8EAA8E;AAC9E,MAAM,YAAY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,6 @@
1
1
  {
2
2
  "name": "@trazum/cli",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
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",
@@ -41,10 +41,10 @@
41
41
  "prepublishOnly": "npm run build && npm test"
42
42
  },
43
43
  "dependencies": {
44
- "@trazum/core": "2.4.0"
44
+ "@trazum/core": "2.4.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node": "^26.4.0",
47
+ "@types/node": "^26.6.3",
48
48
  "typescript": "^7.0.2"
49
49
  },
50
50
  "engines": {
package/src/html.ts CHANGED
@@ -72,14 +72,22 @@ const STYLE = `
72
72
  interface Row {
73
73
  name: string;
74
74
  breakdown: UsageBreakdown;
75
+ /**
76
+ * The catalogue could not price this row. Its money cell is a dash, never
77
+ * `$0`: zero is a claim that the calls were free, the same claim the CSV
78
+ * door refuses with an empty cell, and the caveat block above already says
79
+ * which models these are and why.
80
+ */
81
+ unpriced?: boolean;
75
82
  }
76
83
 
77
84
  function breakdownTable(rows: Row[], totalUsd: number, t: ProfileMarkdownInput['t'], nameHeading: string): string {
78
85
  const n = (value: number): string => value.toLocaleString(t.numberLocale);
79
86
  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>`;
87
+ .map(({ name, breakdown: b, unpriced }) => {
88
+ const share = totalUsd > 0 && !unpriced ? `${((b.totalUsd / totalUsd) * 100).toFixed(1)}%` : '—';
89
+ const usd = unpriced ? '—' : formatUsd(b.totalUsd);
90
+ 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(usd)}</td><td class="n">${share}</td></tr>`;
83
91
  })
84
92
  .join('\n');
85
93
  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>`;
@@ -163,7 +171,11 @@ export function renderProfileHtml(input: ProfileMarkdownInput): string {
163
171
  parts.push(`<h2>${esc(t.html.byModelHeading())}</h2>`);
164
172
  parts.push(
165
173
  breakdownTable(
166
- report.byModel.map((row) => ({ name: row.model, breakdown: row.breakdown })),
174
+ report.byModel.map((row) => ({
175
+ name: row.model,
176
+ breakdown: row.breakdown,
177
+ unpriced: report.unpricedModels.includes(row.model),
178
+ })),
167
179
  report.total.totalUsd,
168
180
  t,
169
181
  t.html.colModel(),
package/src/i18n/en.ts CHANGED
@@ -60,7 +60,8 @@ ${bold('USAGE')}
60
60
  trazum rollup <document...|dir> [--json] [--html-out <file>]
61
61
  trazum position <usage.jsonl>
62
62
  trazum receipt <usage.jsonl|dir> [--stamp] [-o <file>]
63
- trazum bill <file|dir> [--label <name>] [--stamp] [-o <file>]
63
+ trazum bill <file|dir>... [--label <name>] [--stamp] [-o <file>]
64
+ [--pdf-out|--html-out|--markdown-out|--csv-out <file>]
64
65
  trazum from-claude-code <file|dir> [--label <name>] [-o <file>]
65
66
  trazum from-otel <file|dir> [--label-from-service] [-o <file>]
66
67
  trazum from-litellm <file|dir> [-o <file>]
@@ -747,6 +748,11 @@ ${bold('OPTIONS FOR profile')}
747
748
  file, the one to email to whoever pays the bill.
748
749
  Same figures as --json, caveats rendered as
749
750
  prominently as the totals they qualify.
751
+ --pdf-out <file> Also write the report as a PDF, for whoever
752
+ signs off the bill and reads attachments rather
753
+ than terminals. The HTML report's figures and
754
+ caveats, a footer on every page, no font
755
+ embedded, a few kilobytes. bill takes it too.
750
756
  --csv-shape <shape> Which table --csv-out writes: slice (default),
751
757
  day, hour, or model-day (one row per day and
752
758
  model, charts the mix moving). One row shape
@@ -1195,6 +1201,10 @@ ${bold('EXAMPLES')}
1195
1201
  `Unknown option --${name}. This command accepts: ${allowed}.`,
1196
1202
  unknownFlagDidYouMean: (name, suggestion) =>
1197
1203
  `Unknown option --${name}. Did you mean --${suggestion}?`,
1204
+ extraPositional: (command, limit, given, first) =>
1205
+ `${command} reads ${limit === 1 ? 'one path' : `${limit} paths`} and was given ${given}, so ${first} and`
1206
+ + ' anything after it would be ignored. A shell glob expands to many paths: pass the directory'
1207
+ + ` instead (trazum ${command} logs/), or run once per file.`,
1198
1208
  diffNeedsTwoFiles: () => 'trazum diff needs two files: trazum diff <before> <after>.',
1199
1209
  cannotNegate: (name) => `--no-${name} makes no sense: --${name} takes a value.`,
1200
1210
  noPromptsFound: (directory, extensions) =>
@@ -1347,6 +1357,7 @@ ${bold('EXAMPLES')}
1347
1357
  diffTooLarge: (lines, max) =>
1348
1358
  ` Diff skipped: ${lines} lines is past the ${max}-line limit, and aligning them would cost more memory than the answer is worth.`,
1349
1359
  wroteTo: (path) => `Optimised prompt written to ${path}`,
1360
+ reportWritten: (path) => `Report written to ${path}.`,
1350
1361
  },
1351
1362
 
1352
1363
  init: {
@@ -1989,7 +2000,7 @@ ${bold('EXAMPLES')}
1989
2000
  bill: {
1990
2001
  noPath: () => 'bill needs a file or a directory to read: trazum bill ~/.claude/projects',
1991
2002
  notFound: (path) => `${path}: not found`,
1992
- noFiles: (path) => `${path}: no .json, .jsonl or .ndjson files under it.`,
2003
+ noFiles: (path) => `${path}: no .json, .jsonl, .ndjson or .log files under it, plain or gzipped.`,
1993
2004
  file: (path, shape, records, leftOut) =>
1994
2005
  `${path}: ${shape}${records === null ? ', read as it is' : `, ${records} record(s)`}${leftOut > 0 ? `, ${leftOut} row(s) left out. Run trazum from-${shape} on it for the reasons.` : '.'}`,
1995
2006
  unknown: (path) =>
@@ -2000,6 +2011,8 @@ ${bold('EXAMPLES')}
2000
2011
  `${path}: a provider's cost report, which is a bill rather than usage. Set it beside a receipt with trazum reconcile.`,
2001
2012
  nothingRead: () => 'Nothing here was a usage source this tool reads, so there is nothing to bill.',
2002
2013
  sources: (read, seen) => `${read} of ${seen} file(s) read as usage.`,
2014
+ pricingLiveHint: (count) =>
2015
+ `${count} unpriced model id(s) are OpenRouter slugs, which the bundled catalogue does not carry. Run again with --pricing-live to price them from OpenRouter's own list.`,
2003
2016
  written: (file) => `Wrote ${file}.`,
2004
2017
  },
2005
2018
 
@@ -2205,6 +2218,11 @@ ${bold('EXAMPLES')}
2205
2218
  written: (path) => `HTML report written to ${path}.`,
2206
2219
  },
2207
2220
 
2221
+ pdf: {
2222
+ page: (current, total) => `page ${current} of ${total}`,
2223
+ written: (path) => `PDF report written to ${path}.`,
2224
+ },
2225
+
2208
2226
  schema: {
2209
2227
  noTarget: (known) =>
2210
2228
  `Name a contract to print its JSON Schema. Known: ${known}. The schema validates with any draft 2020-12 validator, no Trazum required.`,
package/src/i18n/es.ts CHANGED
@@ -47,7 +47,8 @@ ${bold('USO')}
47
47
  trazum rollup <documento...|dir> [--json] [--html-out <fichero>]
48
48
  trazum position <uso.jsonl>
49
49
  trazum receipt <uso.jsonl|dir> [--stamp] [-o <fichero>]
50
- trazum bill <fichero|dir> [--label <nombre>] [--stamp] [-o <fichero>]
50
+ trazum bill <fichero|dir>... [--label <nombre>] [--stamp] [-o <fichero>]
51
+ [--pdf-out|--html-out|--markdown-out|--csv-out <fichero>]
51
52
  trazum from-claude-code <fichero|dir> [--label <nombre>] [-o <fichero>]
52
53
  trazum from-otel <fichero|dir> [--label-from-service] [-o <fichero>]
53
54
  trazum from-litellm <fichero|dir> [-o <fichero>]
@@ -772,6 +773,12 @@ ${bold('OPCIONES DE profile')}
772
773
  quien paga la factura. Las mismas cifras que
773
774
  --json, con las salvedades tan visibles como
774
775
  los totales a los que acompañan.
776
+ --pdf-out <fichero> Escribe además el informe como PDF, para quien
777
+ aprueba la factura y lee adjuntos, no
778
+ terminales. Las cifras y salvedades del informe
779
+ HTML, un pie en cada página, sin fuentes
780
+ incrustadas, unos pocos kilobytes. bill también
781
+ lo acepta.
775
782
  --csv-shape <forma> Qué tabla escribe --csv-out: slice (por defecto),
776
783
  day, hour o model-day (una fila por día y
777
784
  modelo: dibuja la mezcla moviéndose). Una sola
@@ -1234,6 +1241,10 @@ ${bold('EJEMPLOS')}
1234
1241
  `Opción desconocida --${name}. Este comando acepta: ${allowed}.`,
1235
1242
  unknownFlagDidYouMean: (name, suggestion) =>
1236
1243
  `Opción desconocida --${name}. ¿Querías decir --${suggestion}?`,
1244
+ extraPositional: (command, limit, given, first) =>
1245
+ `${command} lee ${limit === 1 ? 'una ruta' : `${limit} rutas`} y ha recibido ${given}, así que ${first} y`
1246
+ + ' todo lo que va detrás se ignoraría. Un comodín del shell se expande en muchas rutas: pasa la'
1247
+ + ` carpeta (trazum ${command} logs/) o ejecútalo una vez por fichero.`,
1237
1248
  diffNeedsTwoFiles: () =>
1238
1249
  'trazum diff necesita dos ficheros: trazum diff <antes> <después>.',
1239
1250
  cannotNegate: (name) => `--no-${name} no tiene sentido: --${name} lleva un valor.`,
@@ -1397,6 +1408,7 @@ ${bold('EJEMPLOS')}
1397
1408
  diffTooLarge: (lines, max) =>
1398
1409
  ` Diff omitido: ${lines} líneas supera el límite de ${max}, y alinearlas costaría más memoria de lo que vale la respuesta.`,
1399
1410
  wroteTo: (path) => `Prompt optimizado escrito en ${path}`,
1411
+ reportWritten: (path) => `Informe escrito en ${path}.`,
1400
1412
  },
1401
1413
 
1402
1414
  init: {
@@ -2016,7 +2028,7 @@ ${bold('EJEMPLOS')}
2016
2028
  bill: {
2017
2029
  noPath: () => 'bill necesita un archivo o un directorio que leer: trazum bill ~/.claude/projects',
2018
2030
  notFound: (path) => `${path}: no encontrado`,
2019
- noFiles: (path) => `${path}: no hay archivos .json, .jsonl ni .ndjson dentro.`,
2031
+ noFiles: (path) => `${path}: no hay archivos .json, .jsonl, .ndjson ni .log dentro, ni sin comprimir ni en .gz.`,
2020
2032
  file: (path, shape, records, leftOut) =>
2021
2033
  `${path}: ${shape}${records === null ? ', leido tal cual' : `, ${records} registro(s)`}${leftOut > 0 ? `, ${leftOut} fila(s) fuera. Ejecuta trazum from-${shape} sobre el para ver por que.` : '.'}`,
2022
2034
  unknown: (path) =>
@@ -2027,6 +2039,8 @@ ${bold('EJEMPLOS')}
2027
2039
  `${path}: un informe de costes de proveedor, que es una factura y no uso. Ponlo junto a un recibo con trazum reconcile.`,
2028
2040
  nothingRead: () => 'Nada de esto era una fuente de uso que esta herramienta lea, asi que no hay nada que facturar.',
2029
2041
  sources: (read, seen) => `${read} de ${seen} archivo(s) leido(s) como uso.`,
2042
+ pricingLiveHint: (count) =>
2043
+ `${count} id(s) de modelo sin precio son slugs de OpenRouter, que el catalogo incluido no trae. Vuelve a ejecutar con --pricing-live para cobrarlos desde la propia lista de OpenRouter.`,
2030
2044
  written: (file) => `Escrito ${file}.`,
2031
2045
  },
2032
2046
 
@@ -2233,6 +2247,11 @@ ${bold('EJEMPLOS')}
2233
2247
  written: (path) => `Informe HTML escrito en ${path}.`,
2234
2248
  },
2235
2249
 
2250
+ pdf: {
2251
+ page: (current, total) => `página ${current} de ${total}`,
2252
+ written: (path) => `Informe PDF escrito en ${path}.`,
2253
+ },
2254
+
2236
2255
  schema: {
2237
2256
  noTarget: (known) =>
2238
2257
  `Nombra un contrato para imprimir su JSON Schema. Conocidos: ${known}. El esquema valida con cualquier validador draft 2020-12, sin Trazum.`,
package/src/i18n/types.ts CHANGED
@@ -115,6 +115,8 @@ export interface CliMessages {
115
115
  unknownCommand(command: string): string;
116
116
  unknownFlag(name: string, allowed: string): string;
117
117
  unknownFlagDidYouMean(name: string, suggestion: string): string;
118
+ /** More positional arguments than the command reads; `first` is the first one it would have ignored. */
119
+ extraPositional(command: string, limit: number, given: number, first: string): string;
118
120
  missingInputFile(): string;
119
121
  llmNotConfigured(): string;
120
122
  applyNeedsSuggest(): string;
@@ -299,6 +301,8 @@ export interface CliMessages {
299
301
  suggestHowToApply(): string;
300
302
  pricingOverlaid(models: string, lastReviewed: string): string;
301
303
  wroteTo(path: string): string;
304
+ /** A report file written by `profile` or `bill`, which is not an optimised prompt. */
305
+ reportWritten(path: string): string;
302
306
  };
303
307
 
304
308
  /**
@@ -733,6 +737,8 @@ export interface CliMessages {
733
737
  costReport(path: string): string;
734
738
  nothingRead(): string;
735
739
  sources(read: number, seen: number): string;
740
+ /** An unpriced slug with a slash is OpenRouter's, and --pricing-live prices it. */
741
+ pricingLiveHint(count: number): string;
736
742
  written(file: string): string;
737
743
  };
738
744
 
@@ -895,6 +901,13 @@ export interface CliMessages {
895
901
  written(path: string): string;
896
902
  };
897
903
 
904
+ /** The PDF door: the HTML report's sentences, plus what only paper needs. */
905
+ pdf: {
906
+ /** The footer's page counter, on every page, because printed pages get separated. */
907
+ page(current: number, total: number): string;
908
+ written(path: string): string;
909
+ };
910
+
898
911
  /** The portable format: a JSON Schema per contract, for validators that are not Trazum. */
899
912
  schema: {
900
913
  noTarget(known: string): string;