{"record":{"id":"914b347149ddf4ef","repo":"santifer/career-ops","slug":"plugin-name-must-match-a-z0-9-got-name","errorCode":null,"errorMessage":"plugin name must match [a-z0-9-] (got \"${name}\")","messagePattern":"plugin name must match \\[a-z0-9-\\] \\(got \"(.+?)\"\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugin-install.mjs","lineNumber":119,"sourceCode":" * audit is static. Returns problems (empty = clean).\n * @returns {string[]}\n */\nexport function auditRegistryEntry(url, sha, expectId) {\n  let parsed;\n  try { parsed = parseRepoArg(url); } catch (e) { return [e.message]; }\n  if (expectId && parsed.id !== expectId) return [`repo \"${url}\" → id \"${parsed.id}\" but registry id is \"${expectId}\"`];\n  let dir;\n  try { dir = safeClone(parsed.url, sha); } catch (e) { return [e.message]; }\n  let result;\n  try { result = validateInstall(dir, parsed.id); }\n  catch (e) { rmSync(dir, { recursive: true, force: true }); return [e.message]; }\n  try { rmSync(result.dir || dir, { recursive: true, force: true }); } catch { /* best-effort */ }\n  return result.ok ? [] : result.problems;\n}\n\n/** Scaffold a new local plugin from plugins/_template/. */\nexport function scaffoldNew(root, name) {\n  if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new Error(`plugin name must match [a-z0-9-] (got \"${name}\")`);\n  const tpl = path.join(root, 'plugins', '_template');\n  if (!existsSync(tpl)) throw new Error('plugins/_template/ not found');\n  const dest = path.join(root, 'plugins.local', name);\n  if (existsSync(dest)) throw new Error(`plugins.local/${name} already exists`);\n  mkdirSync(path.join(root, 'plugins.local'), { recursive: true });\n  cpSync(tpl, dest, { recursive: true });\n  // Substitute {{NAME}} placeholders in shipped text files.\n  const sub = (p) => { if (existsSync(p)) writeFileSync(p, readFileSync(p, 'utf8').replaceAll('{{NAME}}', name), 'utf8'); };\n  for (const f of readdirSync(dest, { withFileTypes: true })) {\n    if (f.isFile()) sub(path.join(dest, f.name));\n  }\n  if (existsSync(path.join(dest, 'test'))) for (const f of readdirSync(path.join(dest, 'test'))) sub(path.join(dest, 'test', f));\n  return dest;\n}\n","sourceCodeStart":101,"sourceCodeEnd":134,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/plugin-install.mjs#L101-L134","documentation":"Thrown by scaffoldNew() in plugin-install.mjs when the requested plugin name does not match ^[a-z0-9][a-z0-9-]*$ (lowercase alphanumeric and hyphens, starting alphanumerically). Names become directory names and id tokens, so they must be filesystem- and slug-safe.","triggerScenarios":"Passing a name with underscores, spaces, uppercase letters, a leading hyphen, or special characters; passing an empty string; using CamelCase or a name starting with a digit-only segment like '-x'.","commonSituations":"User typed My Plugin, my_plugin, or -plugin; copied a name with a leading hyphen; used a reserved-looking or mixed-case id.","solutions":["Use only lowercase letters, digits, and hyphens; start with a letter or digit.","Pick a concise slug like 'greenhouse-export' or 'notion-sync'.","Avoid underscores, spaces, and uppercase.","Re-run `node plugins.mjs scaffold <slug>`."],"exampleFix":"// before\nscaffoldNew(root, 'My_Cool Plugin');\n// after\nscaffoldNew(root, 'my-cool-plugin');","handlingStrategy":"validation","validationCode":"const NAME_RE = /^[a-z0-9][a-z0-9-]*$/;\nfunction isValidPluginName(name) {\n  return NAME_RE.test(name || '');\n}","typeGuard":"/** Narrows a string to a valid plugin slug (lowercase alnum + hyphens). */\nfunction isValidPluginName(name) {\n  return typeof name === 'string' && /^[a-z0-9][a-z0-9-]*$/.test(name);\n}","tryCatchPattern":null,"preventionTips":["Always use lowercase slugs (letters, digits, hyphens) for plugin names.","Validate the name at the CLI boundary before calling scaffoldNew.","Avoid underscores, spaces, and uppercase in ids."],"tags":["plugins","naming-convention","validation","scaffold"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}