great-cto 2.8.2 → 2.8.4
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/report.js +27 -6
- package/package.json +1 -1
package/dist/report.js
CHANGED
|
@@ -391,15 +391,36 @@ export function parseReportArgs(rawArgv, cwd) {
|
|
|
391
391
|
const idx = rawArgv.indexOf("report");
|
|
392
392
|
if (idx === -1)
|
|
393
393
|
return null;
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
394
|
+
// Accept both: positional `great-cto report cost`
|
|
395
|
+
// flag form `great-cto report --type cost`
|
|
396
|
+
// flag eq `great-cto report --type=cost`
|
|
397
|
+
// BH-26 (2026-05-15): previously only positional worked; --type=X failed
|
|
398
|
+
// with a misleading "got: --type=cost" error.
|
|
399
399
|
const flag = (n, def) => {
|
|
400
|
+
// --name=value form
|
|
401
|
+
const eq = rawArgv.find((a) => a.startsWith(`--${n}=`));
|
|
402
|
+
if (eq)
|
|
403
|
+
return eq.slice(`--${n}=`.length);
|
|
404
|
+
// --name value form
|
|
400
405
|
const i = rawArgv.indexOf(`--${n}`);
|
|
401
|
-
|
|
406
|
+
if (i >= 0 && i < rawArgv.length - 1 && !rawArgv[i + 1].startsWith("-")) {
|
|
407
|
+
return rawArgv[i + 1];
|
|
408
|
+
}
|
|
409
|
+
return def;
|
|
402
410
|
};
|
|
411
|
+
// Prefer --type flag if provided, else positional arg after `report`.
|
|
412
|
+
let type = flag("type");
|
|
413
|
+
if (!type) {
|
|
414
|
+
const positional = rawArgv[idx + 1];
|
|
415
|
+
if (positional && !positional.startsWith("-"))
|
|
416
|
+
type = positional;
|
|
417
|
+
}
|
|
418
|
+
if (!type || !["cost", "agents", "compliance"].includes(type)) {
|
|
419
|
+
console.error(`great-cto report: type must be cost|agents|compliance (got: ${type ?? "<missing>"})\n` +
|
|
420
|
+
`Usage: great-cto report <type> [--format html|json|md] [--period 30d] [--archetype X]\n` +
|
|
421
|
+
` great-cto report --type <type>`);
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
403
424
|
return {
|
|
404
425
|
type,
|
|
405
426
|
format: flag("format", "html"),
|
package/package.json
CHANGED