Lines 1309-1349javascript
1310 syncFilteredManifest(args.lang);
1313 // IMPORTANT: npm install must run FIRST, then injectLocalWorkspacePackages
1314 // overwrites @principles/core with the local monorepo version.
1316 // Why: @principles/core on npm (v1.164.0-1.174.0, from a different publish
1317 // line) is semantically "^1.74.1"-compatible but its exports field does NOT
1318 // include ./principle-tree-ledger that pd-cli/health.js requires. The npm
1319 // registry version must never be used — only the local monorepo build has
1320 // the correct exports. Injecting BEFORE npm install is useless because npm
1321 // overwrites the injected copy. The authoritative source is always the
1322 // local monorepo, applied AFTER npm install.
1323 installTargetDependencies();
1324 injectLocalWorkspacePackages();
1325 verifyInjectedWorkspaceDeps();
1328 console.log('\n🔍 Verifying installed plugin can load native dependencies...');
1330 execSync(`node -e "require('better-sqlite3')"`, { cwd: INSTALL_DIR, stdio: 'pipe' });
1331 console.log('✅ Native dependencies verified');
HighCopied Package Dependency Bridge
Package metadata claims a different repository identity while copied source loads a runtime dependency bridge.
scripts/sync-plugin.mjsView on unpkg · L1329 1333 console.warn('\n⚠️ Native module better-sqlite3 failed to load. Attempting automatic rebuild...');
1335 execSync('npm rebuild better-sqlite3', { cwd: INSTALL_DIR, stdio: 'inherit' });
1336 execSync(`node -e "require('better-sqlite3')"`, { cwd: INSTALL_DIR, stdio: 'pipe' });
1337 console.log('✅ Rebuild successful!');
1338 } catch (rebuildErr) {
1339 console.error('\n❌ CRITICAL: better-sqlite3 rebuild failed!');
1344 const bootstrapScript = join(SOURCE_DIR, 'scripts', 'bootstrap-rules.mjs');
1345 if (existsSync(bootstrapScript)) {
1346 console.log('\n🧠 Synchronizing principles to active rules (Bootstrap)...');
1348 const workspaceDir = getConfiguredWorkspaceDir();
1349 const targetStateDir = join(workspaceDir, '.state');