docs(config-audit): cache-telemetry recipe + --with-telemetry-recipe flag (v5 M7)

This commit is contained in:
Kjell Tore Guttormsen 2026-05-01 09:12:17 +02:00
commit df6e012903
4 changed files with 152 additions and 1 deletions

View file

@ -6,27 +6,34 @@
*
* Usage:
* node token-hotspots-cli.mjs [path] [--json] [--output-file <path>] [--global]
* [--with-telemetry-recipe]
*
* Exit codes: 0=ok, 3=unrecoverable error.
* Zero external dependencies.
*/
import { resolve } from 'node:path';
import { resolve, dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { writeFile, stat } from 'node:fs/promises';
import { discoverConfigFiles } from './lib/file-discovery.mjs';
import { resetCounter } from './lib/output.mjs';
import { scan } from './token-hotspots.mjs';
const __dirname = dirname(fileURLToPath(import.meta.url));
const TELEMETRY_RECIPE_PATH = resolve(__dirname, '..', 'knowledge', 'cache-telemetry-recipe.md');
async function main() {
const args = process.argv.slice(2);
let targetPath = '.';
let outputFile = null;
let jsonMode = false;
let includeGlobal = false;
let withTelemetryRecipe = false;
for (let i = 0; i < args.length; i++) {
if (args[i] === '--json') jsonMode = true;
else if (args[i] === '--global') includeGlobal = true;
else if (args[i] === '--with-telemetry-recipe') withTelemetryRecipe = true;
else if (args[i] === '--output-file' && args[i + 1]) outputFile = args[++i];
else if (!args[i].startsWith('-')) targetPath = args[i];
}
@ -58,6 +65,10 @@ async function main() {
counts: result.counts,
};
if (withTelemetryRecipe) {
payload.telemetry_recipe_path = TELEMETRY_RECIPE_PATH;
}
const json = JSON.stringify(payload, null, 2);
if (outputFile) {