@trazum/cli 1.61.1 → 1.61.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/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +1 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +1 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/types.d.ts +2 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/i18n/en.ts +2 -0
- package/src/i18n/es.ts +2 -0
- package/src/i18n/types.ts +2 -0
- package/src/index.ts +18 -1
package/dist/index.js
CHANGED
|
@@ -142,6 +142,14 @@ function parseArgs(argv, t) {
|
|
|
142
142
|
* `flags.has(name)` is the wrong test once negation exists: `--no-batch` stores
|
|
143
143
|
* the key with the value `false`, and `has` would report it as set.
|
|
144
144
|
*/
|
|
145
|
+
/** A numberFlag that is also a fraction: the config's own 0-to-1 rule. */
|
|
146
|
+
function fractionFlag(args, name, fallback, t) {
|
|
147
|
+
const value = numberFlag(args, name, fallback, t);
|
|
148
|
+
if (value > 1) {
|
|
149
|
+
throw new Error(t.errors.fractionFlag(name, String(args.flags.get(name))));
|
|
150
|
+
}
|
|
151
|
+
return value;
|
|
152
|
+
}
|
|
145
153
|
function boolFlag(args, name, fallback = false) {
|
|
146
154
|
const raw = args.flags.get(name);
|
|
147
155
|
return typeof raw === 'boolean' ? raw : fallback;
|
|
@@ -221,7 +229,15 @@ function usageFrom(args, config, t, detected) {
|
|
|
221
229
|
model,
|
|
222
230
|
callsPerMonth: numberFlag(args, 'calls', fromConfig.callsPerMonth ?? DEFAULT_USAGE.callsPerMonth, t),
|
|
223
231
|
avgOutputTokens: numberFlag(args, 'output-tokens', fromConfig.avgOutputTokens ?? DEFAULT_USAGE.avgOutputTokens, t),
|
|
224
|
-
|
|
232
|
+
/*
|
|
233
|
+
Bounded above as well as below, because the config already is.
|
|
234
|
+
|
|
235
|
+
`usage.cacheHitRate: 2` in trazum.config.json is refused as "a fraction
|
|
236
|
+
between 0 and 1"; `--cache-hit-rate 2` on the command line was accepted
|
|
237
|
+
and quietly skewed the caching advisory. Two doors to the same value
|
|
238
|
+
cannot disagree about what fits through.
|
|
239
|
+
*/
|
|
240
|
+
cacheHitRate: fractionFlag(args, 'cache-hit-rate', fromConfig.cacheHitRate ?? DEFAULT_USAGE.cacheHitRate, t),
|
|
225
241
|
batchEligible: boolFlag(args, 'batch', fromConfig.batchEligible ?? false),
|
|
226
242
|
};
|
|
227
243
|
}
|