@trazum/cli 1.64.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/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +5 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +5 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/types.d.ts +5 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/i18n/en.ts +7 -0
- package/src/i18n/es.ts +7 -0
- package/src/i18n/types.ts +6 -0
- package/src/index.ts +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trazum/cli",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
40
|
+
"@trazum/core": "1.65.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^26.2.0",
|
package/src/i18n/en.ts
CHANGED
|
@@ -56,6 +56,7 @@ ${bold('USAGE')}
|
|
|
56
56
|
trazum prune <file> --cases <file> --yes
|
|
57
57
|
trazum where [file]
|
|
58
58
|
trazum conform <file|-> [--contract <name>]
|
|
59
|
+
trazum schema <contract>
|
|
59
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]
|
|
@@ -1608,6 +1609,12 @@ ${bold('EXAMPLES')}
|
|
|
1608
1609
|
written: (path) => `HTML report written to ${path}.`,
|
|
1609
1610
|
},
|
|
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
|
+
|
|
1611
1618
|
bench: {
|
|
1612
1619
|
heading: () => 'This machine, measured',
|
|
1613
1620
|
machine: (node, platform, cpuCount, cpuModel) =>
|
package/src/i18n/es.ts
CHANGED
|
@@ -43,6 +43,7 @@ ${bold('USO')}
|
|
|
43
43
|
trazum prune <fichero> --cases <fichero> --yes
|
|
44
44
|
trazum where [fichero]
|
|
45
45
|
trazum conform <fichero|-> [--contract <nombre>]
|
|
46
|
+
trazum schema <contrato>
|
|
46
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]
|
|
@@ -1620,6 +1621,12 @@ ${bold('EJEMPLOS')}
|
|
|
1620
1621
|
written: (path) => `Informe HTML escrito en ${path}.`,
|
|
1621
1622
|
},
|
|
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
|
+
|
|
1623
1630
|
bench: {
|
|
1624
1631
|
heading: () => 'Esta máquina, medida',
|
|
1625
1632
|
machine: (node, platform, cpuCount, cpuModel) =>
|
package/src/i18n/types.ts
CHANGED
|
@@ -551,6 +551,12 @@ export interface CliMessages {
|
|
|
551
551
|
written(path: string): string;
|
|
552
552
|
};
|
|
553
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
|
+
|
|
554
560
|
bench: {
|
|
555
561
|
heading(): string;
|
|
556
562
|
machine(node: string, platform: string, cpuCount: number, cpuModel: string | null): string;
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { gunzipSync } from 'node:zlib';
|
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
CONTRACT_NAMES,
|
|
12
|
+
contractSchema,
|
|
12
13
|
applyRewrites,
|
|
13
14
|
BASELINE_FILENAME,
|
|
14
15
|
BASELINE_VERSION,
|
|
@@ -635,6 +636,7 @@ const COMMAND_FLAGS: Record<string, string[]> = {
|
|
|
635
636
|
rank: ['level', 'model', 'calls', 'output-tokens', 'batch', 'disable', 'prompt', 'markdown-out'],
|
|
636
637
|
init: ['dry-run', 'yes', 'json', 'pricing', 'pricing-live'],
|
|
637
638
|
conform: ['contract', 'json'],
|
|
639
|
+
schema: [],
|
|
638
640
|
rollup: ['json', 'html-out'],
|
|
639
641
|
pulse: ['json', 'max-stale-hours'],
|
|
640
642
|
bench: ['workload', 'json', 'record', 'against', 'max-ratio'],
|
|
@@ -2889,6 +2891,26 @@ async function readBenchBaseline(path: string, t: CliMessages): Promise<BenchBas
|
|
|
2889
2891
|
return candidate;
|
|
2890
2892
|
}
|
|
2891
2893
|
|
|
2894
|
+
|
|
2895
|
+
/**
|
|
2896
|
+
* `trazum schema <contract>` — the format, portable.
|
|
2897
|
+
*
|
|
2898
|
+
* Prints the JSON Schema for a named contract, so a document can be checked
|
|
2899
|
+
* by any off-the-shelf validator with no Trazum installed. The output is the
|
|
2900
|
+
* schema and nothing else — pipeable by construction, like `--json`
|
|
2901
|
+
* everywhere — and the refusal with no or an unknown name lists every
|
|
2902
|
+
* contract, derived from the same list `--contract` accepts, the way the
|
|
2903
|
+
* gateway names its providers.
|
|
2904
|
+
*/
|
|
2905
|
+
function commandSchema(args: Args, t: CliMessages): void {
|
|
2906
|
+
const name = args.positional[0];
|
|
2907
|
+
if (name === undefined) throw new Error(t.schema.noTarget(CONTRACT_NAMES.join(', ')));
|
|
2908
|
+
if (!(CONTRACT_NAMES as readonly string[]).includes(name)) {
|
|
2909
|
+
throw new Error(t.schema.unknown(name, CONTRACT_NAMES.join(', ')));
|
|
2910
|
+
}
|
|
2911
|
+
console.log(JSON.stringify(contractSchema(name as (typeof CONTRACT_NAMES)[number]), null, 2));
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2892
2914
|
async function commandBench(args: Args, t: CliMessages): Promise<void> {
|
|
2893
2915
|
const asJson = boolFlag(args, 'json');
|
|
2894
2916
|
const chosen = stringFlag(args, 'workload');
|
|
@@ -10644,6 +10666,9 @@ async function main(): Promise<void> {
|
|
|
10644
10666
|
case 'conform':
|
|
10645
10667
|
await commandConform(args, t);
|
|
10646
10668
|
break;
|
|
10669
|
+
case 'schema':
|
|
10670
|
+
commandSchema(args, t);
|
|
10671
|
+
break;
|
|
10647
10672
|
case 'rollup':
|
|
10648
10673
|
await commandRollup(args, t);
|
|
10649
10674
|
break;
|