{"record":{"id":"26118ae7763a3b94","repo":"bmad-code-org/BMAD-METHOD","slug":"shared-scripts-source-directory-not-found-srcsc","errorCode":null,"errorMessage":"Shared scripts source directory not found: ${srcScriptsDir}","messagePattern":"Shared scripts source directory not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"tools/installer/core/installer.js","lineNumber":671,"sourceCode":"        await fs.copy(modifiedFile.path, tempBackupPath, { overwrite: true });\n      }\n    }\n\n    return { tempBackupDir, tempModifiedBackupDir };\n  }\n\n  /**\n   * Sync src/scripts/* → _bmad/scripts/ so shared Python scripts\n   * (e.g. resolve_customization.py) are available at install time.\n   * Excludes dev-only tests and Python caches so they don't ship to users.\n   * Wipes the destination first so files removed or renamed in source\n   * don't linger and get recorded as installed. Also seeds\n   * gitignore files for personal overrides and generated render snapshots.\n   */\n  async _installSharedScripts(paths) {\n    const srcScriptsDir = path.join(paths.srcDir, 'src', 'scripts');\n    if (!(await fs.pathExists(srcScriptsDir))) {\n      throw new Error(`Shared scripts source directory not found: ${srcScriptsDir}`);\n    }\n\n    await fs.remove(paths.scriptsDir);\n    await fs.ensureDir(paths.scriptsDir);\n    // Ship only the runtime scripts — dev-only tests and Python caches must not land in user projects.\n    const isInstallable = (srcPath) => {\n      const base = path.basename(srcPath);\n      return base !== 'tests' && base !== '__pycache__' && base !== '.pytest_cache' && !base.endsWith('.pyc');\n    };\n    await fs.copy(srcScriptsDir, paths.scriptsDir, { overwrite: true, filter: isInstallable });\n    await this._trackFilesRecursive(paths.scriptsDir);\n\n    const customGitignore = path.join(paths.customDir, '.gitignore');\n    if (!(await fs.pathExists(customGitignore))) {\n      await fs.writeFile(customGitignore, '*.user.toml\\n', 'utf8');\n      this.installedFiles.add(customGitignore);\n    }\n","sourceCodeStart":653,"sourceCodeEnd":689,"githubUrl":"https://github.com/bmad-code-org/BMAD-METHOD/blob/b70486b9bdcb0a404d329e2a763b57964e7f1360/tools/installer/core/installer.js#L653-L689","documentation":"Thrown by Installer._installSharedScripts when `<srcDir>/src/scripts` does not exist (fs.pathExists is false). The installer expects to sync shared runtime Python scripts (e.g. resolve_customization.py) from source into _bmad/scripts/; a missing source dir means the package is incomplete or the wrong source root was resolved.","triggerScenarios":"During install/update, _installSharedScripts runs with paths.srcDir that lacks a `src/scripts` subdirectory.","commonSituations":"A trimmed/packaged BMAD distribution that omitted src/scripts, running the installer from a partial clone, or a custom project-root override that points elsewhere.","solutions":["Verify src/scripts exists in the BMAD source: `ls <srcDir>/src/scripts`.","Reinstall or re-clone the BMAD package from a complete source.","Ensure getProjectRoot() resolves to the directory that contains both package.json and src/."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const srcScriptsDir = path.join(paths.srcDir, 'src', 'scripts');\nif (!(await fs.pathExists(srcScriptsDir))) {\n  throw new Error('BMAD source is incomplete: src/scripts missing. Reinstall BMAD.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await installer._installSharedScripts(paths);\n} catch (error) {\n  if (error.message.startsWith('Shared scripts source directory not found')) { /* reinstall package */ }\n  throw error;\n}","preventionTips":["Install BMAD from a complete, official source archive.","Keep getProjectRoot() pointed at the real package root."],"tags":["filesystem","installer","packaging","precondition"],"backgroundTag":null,"analyzedSha":"b70486b9bdcb0a404d329e2a763b57964e7f1360","analyzedAt":"2026-08-13T01:21:12.247Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}