{"record":{"id":"f4c2d626832d4d90","repo":"garrytan/gstack","slug":"unknown-catalog-mode-val-use-trim-default","errorCode":null,"errorMessage":"Unknown catalog mode: ${val}. Use 'trim' (default) or 'full'.","messagePattern":"Unknown catalog mode: (.+?)\\. Use 'trim' \\(default\\) or 'full'\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/gen-skill-docs.ts","lineNumber":125,"sourceCode":"  if (!resolved) {\n    throw new Error(`Unknown model: ${val}. Use ${ALL_MODEL_NAMES.join(', ')}, or a family variant (e.g., claude-opus-4-7, gpt-5.4-mini, o3).`);\n  }\n  return resolved;\n})();\n\n// ─── Catalog Mode (v1.45.0.0 T4) ────────────────────────────\n// 'trim' (default): shorten frontmatter description to lead sentence,\n// move routing/voice prose into a \"## When to invoke\" body section, and\n// emit scripts/proactive-suggestions.json (single file across all skills).\n// 'full': legacy v1.44 behavior — full description stays in frontmatter.\nconst CATALOG_MODE_ARG = process.argv.find(a => a.startsWith('--catalog-mode'));\nconst CATALOG_MODE: 'trim' | 'full' = (() => {\n  if (!CATALOG_MODE_ARG) return 'trim';\n  const val = CATALOG_MODE_ARG.includes('=')\n    ? CATALOG_MODE_ARG.split('=')[1]\n    : process.argv[process.argv.indexOf(CATALOG_MODE_ARG) + 1];\n  if (val !== 'trim' && val !== 'full') {\n    throw new Error(`Unknown catalog mode: ${val}. Use 'trim' (default) or 'full'.`);\n  }\n  return val;\n})();\n\n// ─── Explain-level Overlay ──────────────────────────────────\n// --explain-level=terse compresses preamble prose (writing-style, completeness,\n// confusion-protocol, context-health) to a single pointer line at gen time.\n// Default keeps the runtime-conditional behavior (sections render unconditionally,\n// the model skips them when EXPLAIN_LEVEL: terse appears in the preamble echo).\n// Opt-in via the build flag so most users get the runtime-flexible default.\nconst EXPLAIN_LEVEL_ARG = process.argv.find(a => a.startsWith('--explain-level'));\nconst EXPLAIN_LEVEL: 'default' | 'terse' = (() => {\n  if (!EXPLAIN_LEVEL_ARG) return 'default';\n  const val = EXPLAIN_LEVEL_ARG.includes('=')\n    ? EXPLAIN_LEVEL_ARG.split('=')[1]\n    : process.argv[process.argv.indexOf(EXPLAIN_LEVEL_ARG) + 1];\n  if (val !== 'default' && val !== 'terse') {\n    throw new Error(`Unknown explain level: ${val}. Use 'default' or 'terse'.`);","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/scripts/gen-skill-docs.ts#L107-L143","documentation":"The CATALOG_MODE IIFE in scripts/gen-skill-docs.ts:125 only accepts 'trim' (v1.45 default, shortens frontmatter descriptions and emits proactive-suggestions.json) or 'full' (legacy v1.44 behavior). Any other value, including typos and the old default, throws at startup.","triggerScenarios":"Passing `--catalog-mode=default`, `--catalog-mode legacy`, or a typo like `trım` with non-ASCII characters. CI script still passing `full` after an upgrade without intending legacy behavior.","commonSituations":"Upgrading gstack and forgetting the default flipped to 'trim'. Copying an old build script that used a different value. Editor autocorrect changing characters.","solutions":["Omit --catalog-mode entirely to use the 'trim' default","Pass `--catalog-mode=full` only if you intentionally need v1.44 legacy behavior","Spell the value exactly: only lowercase 'trim' or 'full'"],"exampleFix":"// before\nbun run gen:skill-docs -- --catalog-mode=default\n// after\nbun run gen:skill-docs -- --catalog-mode=trim","handlingStrategy":"type-guard","validationCode":"const VALID_CATALOG = new Set(['trim', 'full']);\nconst arg = process.argv.find(a => a.startsWith('--catalog-mode'));\nconst val = arg?.includes('=') ? arg.split('=')[1] : process.argv[process.argv.indexOf(arg!) + 1];\nif (val != null && !VALID_CATALOG.has(val)) {\n  console.error('--catalog-mode must be one of: trim, full');\n  process.exit(2);\n}","typeGuard":"const isCatalogMode = (v: string): v is 'trim' | 'full' => v === 'trim' || v === 'full';","tryCatchPattern":null,"preventionTips":["Prefer omitting the flag to take the 'trim' default","Pin the value in CI to avoid drift across gstack upgrades","Spell exactly: only lowercase 'trim' or 'full'"],"tags":["cli","argument-validation","build","catalog"],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}