MCPcopy Create free account
hub / github.com/SethGammon/Citadel / generateDelegate

Function generateDelegate

hooks_src/init-project.js:103–115  ·  view source on GitHub ↗

* Generate a thin delegate wrapper that forwards execution to the real script * in the Citadel install. This avoids copying scripts that import from * ../core/ and ../runtimes/ — paths that only exist inside the Citadel repo.

(scriptName)

Source from the content-addressed store, hash-verified

101 return Object.entries(PLANNING_DIRS_BY_BUNDLE)
102 .filter(([bundle]) => selected.has(bundle))
103 .flatMap(([, directories]) => directories);
104}
105
106function shouldSyncScripts() {
107 try {
108 const pkgPath = path.join(PLUGIN_ROOT, 'package.json');
109 if (!fs.existsSync(pkgPath)) return true; // can't determine — sync to be safe
110 const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
111 const pluginVersion = pkg.version || '0.0.0';
112
113 const versionFile = path.join(PROJECT_ROOT, '.citadel', 'version.txt');
114 if (!fs.existsSync(versionFile)) return true;
115
116 const installedVersion = fs.readFileSync(versionFile, 'utf8').trim();
117 if (installedVersion !== pluginVersion) return true;
118

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected