@trazum/cli 1.56.2 → 1.60.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 +4 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +4 -1
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/types.d.ts +6 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.js +28 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/i18n/en.ts +5 -1
- package/src/i18n/es.ts +5 -1
- package/src/i18n/types.ts +6 -0
- package/src/index.ts +31 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trazum/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.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.60.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^26.2.0",
|
package/src/i18n/en.ts
CHANGED
|
@@ -718,7 +718,7 @@ ${bold('CONFIG FILE')}
|
|
|
718
718
|
${bold('trazum.config.json')}, found by walking up from the working directory and
|
|
719
719
|
stopping at the repository root. Every key is optional:
|
|
720
720
|
|
|
721
|
-
level, locale, disable, maxGrowth, extensions
|
|
721
|
+
level, locale, disable, maxGrowth, extensions, ignore
|
|
722
722
|
usage { model, callsPerMonth, avgOutputTokens, cacheHitRate, batchEligible }
|
|
723
723
|
budgets { "prompts/**": 2000, "prompts/system.txt": 4000 }
|
|
724
724
|
baseline { "path": "trazum.baseline.json", "maxGrowthTokens": 0, "maxGrowthPct": 5 }
|
|
@@ -927,6 +927,10 @@ ${bold('EXAMPLES')}
|
|
|
927
927
|
dictionaryUnreviewed: (languages) =>
|
|
928
928
|
` Of those, ${languages} carry entries nobody here reads: written by the same `
|
|
929
929
|
+ 'process that wrote the rules, never agreed by a speaker of the language.',
|
|
930
|
+
dictionaryAppliedUnreviewed: (language) =>
|
|
931
|
+
` These changes came from the ${language} dictionary, which nobody here reads. `
|
|
932
|
+
+ 'Its entries were written by the same process that wrote the rules and never '
|
|
933
|
+
+ 'agreed by a speaker — read the diff before trusting it.',
|
|
930
934
|
levelAggressive: () => '[aggressive]',
|
|
931
935
|
levelSafe: () => '[safe]',
|
|
932
936
|
ruleHits: (hits, tokensSaved) => `(${hits}×, ~${tokensSaved} tokens)`,
|
package/src/i18n/es.ts
CHANGED
|
@@ -740,7 +740,7 @@ ${bold('FICHERO DE CONFIGURACIÓN')}
|
|
|
740
740
|
${bold('trazum.config.json')}, que se busca subiendo desde el directorio de trabajo
|
|
741
741
|
y parando en la raíz del repositorio. Todas las claves son opcionales:
|
|
742
742
|
|
|
743
|
-
level, locale, disable, maxGrowth, extensions
|
|
743
|
+
level, locale, disable, maxGrowth, extensions, ignore
|
|
744
744
|
usage { model, callsPerMonth, avgOutputTokens, cacheHitRate, batchEligible }
|
|
745
745
|
budgets { "prompts/**": 2000, "prompts/system.txt": 4000 }
|
|
746
746
|
baseline { "path": "trazum.baseline.json", "maxGrowthTokens": 0, "maxGrowthPct": 5 }
|
|
@@ -947,6 +947,10 @@ ${bold('EJEMPLOS')}
|
|
|
947
947
|
` De esos, ${languages} llevan entradas que nadie aquí lee: escritas por el `
|
|
948
948
|
+ 'mismo proceso que escribió las reglas, nunca aprobadas por alguien que '
|
|
949
949
|
+ 'hable el idioma.',
|
|
950
|
+
dictionaryAppliedUnreviewed: (language) =>
|
|
951
|
+
` Estos cambios vienen del diccionario de ${language}, que nadie aquí lee. `
|
|
952
|
+
+ 'Sus entradas las escribió el mismo proceso que escribió las reglas y nunca '
|
|
953
|
+
+ 'las aprobó alguien que hable el idioma: revisa el diff antes de fiarte.',
|
|
950
954
|
levelAggressive: () => '[agresiva]',
|
|
951
955
|
levelSafe: () => '[segura]',
|
|
952
956
|
ruleHits: (hits, tokensSaved) => `(${hits}×, ~${tokensSaved} tokens)`,
|
package/src/i18n/types.ts
CHANGED
|
@@ -99,6 +99,12 @@ export interface CliMessages {
|
|
|
99
99
|
* the day somebody maintains all seven it is deleted rather than reworded.
|
|
100
100
|
*/
|
|
101
101
|
dictionaryUnreviewed(languages: string): string;
|
|
102
|
+
/**
|
|
103
|
+
* The prompt just changed, and the dictionary that changed it is one
|
|
104
|
+
* nobody here reads. Printed only when the prompt's own language is
|
|
105
|
+
* detected and unreviewed — never as a footer under every report.
|
|
106
|
+
*/
|
|
107
|
+
dictionaryAppliedUnreviewed(language: string): string;
|
|
102
108
|
levelAggressive(): string;
|
|
103
109
|
levelSafe(): string;
|
|
104
110
|
ruleHits(hits: number, tokensSaved: number): string;
|
package/src/index.ts
CHANGED
|
@@ -95,6 +95,8 @@ import {
|
|
|
95
95
|
optimize,
|
|
96
96
|
parseBaseline,
|
|
97
97
|
PHRASE_LANGUAGES,
|
|
98
|
+
detectTextLanguage,
|
|
99
|
+
dictionaryStanding,
|
|
98
100
|
languagesWithStanding,
|
|
99
101
|
plannedCalls,
|
|
100
102
|
PRICING_LAST_REVIEWED,
|
|
@@ -884,6 +886,27 @@ function printReport(
|
|
|
884
886
|
if (result.rules.length > 0) {
|
|
885
887
|
console.log();
|
|
886
888
|
console.log(c.bold(t.report.rulesApplied()));
|
|
889
|
+
/**
|
|
890
|
+
* Whose judgement just edited this prompt.
|
|
891
|
+
*
|
|
892
|
+
* Five of the seven dictionaries were written without anybody who reads the
|
|
893
|
+
* language agreeing to an entry, and the branch where that matters most is
|
|
894
|
+
* this one: the rules did not stay silent, they changed somebody's text.
|
|
895
|
+
* The coverage line under `nothingToTrim` cannot cover it — by then the
|
|
896
|
+
* prompt is untouched.
|
|
897
|
+
*
|
|
898
|
+
* Gated on the prompt's own detected language, so an English or Spanish
|
|
899
|
+
* prompt never sees it and it never becomes a footer. `detectTextLanguage`
|
|
900
|
+
* answers null on a short or mixed prompt, and this stays silent then:
|
|
901
|
+
* not-detected is not not-unreviewed, and guessing the language in order to
|
|
902
|
+
* warn about it would be the same overreach the detector exists to refuse.
|
|
903
|
+
*/
|
|
904
|
+
const promptLanguage = detectTextLanguage(result.original);
|
|
905
|
+
if (promptLanguage !== null && dictionaryStanding(promptLanguage)?.standing === 'unreviewed') {
|
|
906
|
+
console.log(
|
|
907
|
+
c.yellow(t.report.dictionaryAppliedUnreviewed(t.languages[promptLanguage] ?? promptLanguage)),
|
|
908
|
+
);
|
|
909
|
+
}
|
|
887
910
|
for (const rule of result.rules) {
|
|
888
911
|
const tag =
|
|
889
912
|
rule.level === 'aggressive'
|
|
@@ -1766,6 +1789,7 @@ async function commandInit(
|
|
|
1766
1789
|
const host = detectHost();
|
|
1767
1790
|
const prompts = await walkPrompts(root, {
|
|
1768
1791
|
extensions: config.extensions ?? DEFAULT_EXTENSIONS,
|
|
1792
|
+
ignore: config.ignore,
|
|
1769
1793
|
});
|
|
1770
1794
|
|
|
1771
1795
|
/**
|
|
@@ -1780,6 +1804,7 @@ async function commandInit(
|
|
|
1780
1804
|
const sourceWalk = await walkPrompts(root, {
|
|
1781
1805
|
extensions: SOURCE_EXTENSIONS,
|
|
1782
1806
|
maxFiles: INIT_MAX_SOURCE_FILES,
|
|
1807
|
+
ignore: config.ignore,
|
|
1783
1808
|
});
|
|
1784
1809
|
const sightings: ProviderSighting[] = [];
|
|
1785
1810
|
for (const relative of sourceWalk.files) {
|
|
@@ -3675,7 +3700,7 @@ async function commandRulesMeasure(
|
|
|
3675
3700
|
if (level !== 'safe' && level !== 'aggressive') throw new Error(t.errors.badLevel(level));
|
|
3676
3701
|
|
|
3677
3702
|
const extensions = config.extensions ?? [...DEFAULT_EXTENSIONS, ...SOURCE_EXTENSIONS];
|
|
3678
|
-
const { files, truncated } = await walkPrompts(root, { extensions });
|
|
3703
|
+
const { files, truncated } = await walkPrompts(root, { extensions, ignore: config.ignore });
|
|
3679
3704
|
if (files.length === 0) throw new Error(t.errors.noPromptsFound(root, extensions.join(' ')));
|
|
3680
3705
|
|
|
3681
3706
|
const prompts: string[] = [];
|
|
@@ -8533,7 +8558,7 @@ async function scanPrompts(
|
|
|
8533
8558
|
// to be fully implemented and completely undiscoverable; an unmarked source
|
|
8534
8559
|
// file costs one `includes()` and is dropped.
|
|
8535
8560
|
const extensions = config.extensions ?? [...DEFAULT_EXTENSIONS, ...SOURCE_EXTENSIONS];
|
|
8536
|
-
const { files, truncated } = await walkPrompts(root, { extensions });
|
|
8561
|
+
const { files, truncated } = await walkPrompts(root, { extensions, ignore: config.ignore });
|
|
8537
8562
|
|
|
8538
8563
|
if (files.length === 0) {
|
|
8539
8564
|
throw new Error(t.errors.noPromptsFound(root, extensions.join(' ')));
|
|
@@ -9590,7 +9615,7 @@ async function commandRank(
|
|
|
9590
9615
|
const usage = usageFrom(args, config, t);
|
|
9591
9616
|
|
|
9592
9617
|
const extensions = config.extensions ?? [...DEFAULT_EXTENSIONS, ...SOURCE_EXTENSIONS];
|
|
9593
|
-
const { files, truncated } = await walkPrompts(root, { extensions });
|
|
9618
|
+
const { files, truncated } = await walkPrompts(root, { extensions, ignore: config.ignore });
|
|
9594
9619
|
if (files.length === 0) {
|
|
9595
9620
|
throw new Error(t.errors.noPromptsFound(root, extensions.join(' ')));
|
|
9596
9621
|
}
|
|
@@ -10065,7 +10090,7 @@ async function commandDoctor(
|
|
|
10065
10090
|
const usage = usageFrom(args, config, t);
|
|
10066
10091
|
|
|
10067
10092
|
const extensions = config.extensions ?? [...DEFAULT_EXTENSIONS, ...SOURCE_EXTENSIONS];
|
|
10068
|
-
const { files, truncated } = await walkPrompts(root, { extensions });
|
|
10093
|
+
const { files, truncated } = await walkPrompts(root, { extensions, ignore: config.ignore });
|
|
10069
10094
|
if (files.length === 0) {
|
|
10070
10095
|
throw new Error(t.errors.noPromptsFound(root, extensions.join(' ')));
|
|
10071
10096
|
}
|
|
@@ -10364,8 +10389,8 @@ async function diffDirectories(
|
|
|
10364
10389
|
const extensions = config.extensions ?? [...DEFAULT_EXTENSIONS, ...SOURCE_EXTENSIONS];
|
|
10365
10390
|
|
|
10366
10391
|
const [beforeWalk, afterWalk] = await Promise.all([
|
|
10367
|
-
walkPrompts(beforeRoot, { extensions }),
|
|
10368
|
-
walkPrompts(afterRoot, { extensions }),
|
|
10392
|
+
walkPrompts(beforeRoot, { extensions, ignore: config.ignore }),
|
|
10393
|
+
walkPrompts(afterRoot, { extensions, ignore: config.ignore }),
|
|
10369
10394
|
]);
|
|
10370
10395
|
if (beforeWalk.files.length === 0 && afterWalk.files.length === 0) {
|
|
10371
10396
|
throw new Error(t.errors.noPromptsFound(`${beforeRoot}, ${afterRoot}`, extensions.join(' ')));
|