{"record":{"id":"27d6b4b47b3cb2bd","repo":"santifer/career-ops","slug":"plugins-template-not-found","errorCode":null,"errorMessage":"plugins/_template/ not found","messagePattern":"plugins/_template/ not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugin-install.mjs","lineNumber":121,"sourceCode":" */\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":103,"sourceCodeEnd":134,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/plugin-install.mjs#L103-L134","documentation":"Thrown by scaffoldNew() when the source template directory plugins/_template/ does not exist. The scaffolder copies from this shipped template, so its absence means the repo install is incomplete or the working directory is wrong.","triggerScenarios":"Running scaffold from a checkout that lacks plugins/_template/ (partial clone, custom slimmed install); running from a cwd where the relative path plugins/_template doesn't resolve; the template was deleted/moved in a fork.","commonSituations":"Fresh clone interrupted before plugins/ fully populated; running the runner from a subdirectory; a fork removed the template directory.","solutions":["Confirm you are running from the repo root where plugins/ lives.","Restore plugins/_template/ from the upstream repo (git checkout origin/main -- plugins/_template).","Re-clone or re-install career-ops if the template is genuinely missing.","Verify with: ls plugins/_template/ before scaffolding."],"exampleFix":"// before: template dir missing -> throws\nscaffoldNew(root, 'x');\n// after: restore template then scaffold\ngit checkout origin/main -- plugins/_template\nscaffoldNew(root, 'x');","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nimport path from 'path';\nfunction templatePresent(root) {\n  return existsSync(path.join(root, 'plugins', '_template'));\n}\nif (!templatePresent(root)) {\n  // restore template from upstream before scaffolding\n}","typeGuard":"null","tryCatchPattern":"try {\n  scaffoldNew(root, name);\n} catch (e) {\n  if (/_template\\/ not found/.test(e.message)) {\n    // restore plugins/_template from upstream, retry\n  } else throw e;\n}","preventionTips":["Run scaffold from the repo root where plugins/ lives.","Keep plugins/_template/ present in forks; don't prune it.","Verify the template dir exists in CI/setup checks."],"tags":["plugins","scaffold","file-not-found","repo-integrity"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}