{"record":{"id":"69611350a625eed2","repo":"pbakaus/impeccable","slug":"concept-seed-scope-must-be-direction-or-surface","errorCode":null,"errorMessage":"concept-seed: --scope must be direction or surface","messagePattern":"concept-seed: --scope must be direction or surface","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/skills/impeccable/scripts/concept-seed.mjs","lineNumber":307,"sourceCode":"  };\n}\n\nconst SEED_MODES = new Set(['persuade', 'operate', 'read', 'experience']);\n\nexport function renderConceptSeed({\n  scope = 'surface',\n  key = process.env.IMPECCABLE_CONCEPT_SEED || crypto.randomBytes(4).toString('hex'),\n  reroll = 0,\n  register = null,\n  mode = null,\n  grain = null,\n  platform = null,\n  candidateCount = 7,\n  catalogDir = CATALOG_DIR,\n  _resolvedData = undefined,\n} = {}) {\n  if (scope !== 'surface' && scope !== 'direction') {\n    throw new Error('concept-seed: --scope must be direction or surface');\n  }\n  if (!Number.isInteger(reroll) || reroll < 0) {\n    throw new Error('concept-seed: --reroll must be a non-negative integer');\n  }\n  if (register !== null && register !== 'safer' && register !== 'bolder') {\n    throw new Error('concept-seed: --register must be safer or bolder');\n  }\n  if (register !== null && reroll < 1) {\n    throw new Error('concept-seed: --register steers a re-roll round; pass --reroll <n> with it');\n  }\n  if (register !== null && scope !== 'direction') {\n    throw new Error('concept-seed: --register applies to direction rounds only');\n  }\n  if (mode !== null && !SEED_MODES.has(mode)) {\n    throw new Error('concept-seed: --mode must be persuade, operate, read, or experience');\n  }\n  // Grain needs no mode: how much of the product is in play is independent of\n  // which register of work it is.","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/plugin/skills/impeccable/scripts/concept-seed.mjs#L289-L325","documentation":"Thrown by the concept-seed main entry when --scope is neither 'surface' nor 'direction'. These are the only two scopes the seeder supports: 'direction' seeds whole-product creative directions; 'surface' seeds structures for a screen/region.","triggerScenarios":"Calling concept-seed.mjs (or its exported function) with scope set to anything other than 'surface' or 'direction' — e.g. a typo like 'surfaces', 'dir', or an unsupported value like 'page'.","commonSituations":"CLI typo; a wrapper script passing a free-text scope; an outdated caller using a scope name from a previous API version.","solutions":["Pass --scope surface or --scope direction.","If calling the exported function, set the scope parameter to one of those two exact strings."],"exampleFix":"# before\n$ node concept-seed.mjs --scope page ...\n\n# after\n$ node concept-seed.mjs --scope surface ...","handlingStrategy":"validation","validationCode":"const SCOPES = new Set(['surface', 'direction']);\nif (!SCOPES.has(scope)) {\n  throw new Error(`--scope must be one of: ${[...SCOPES].join(', ')}`);\n}","typeGuard":"function isValidScope(value) {\n  return value === 'surface' || value === 'direction';\n}","tryCatchPattern":"try {\n  await seedConcepts({ scope });\n} catch (err) {\n  if (/--scope must be/.test(err.message)) {\n    console.error('Use --scope surface or --scope direction.');\n  } else throw err;\n}","preventionTips":["Validate scope at the CLI boundary with an enum set before calling the seeder.","Document the two scopes in --help.","Share an isValidScope helper between CLI parsing and the seeder."],"tags":["concept-seed","validation","cli-args","scope"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}