- apply-recoder-branding.js generates a Recoder electron-builder config (appId/ productName/updater) leaving package.json untouched; recoder.branding.json scaffold. - analyticsManager: policy kill-switch disables PostHog unless RECODER_ENABLE_TELEMETRY. - NimbalystInstallDialog: suppressed by policy. - recoderBridge: feature-flagged RunEvent emitter (session lifecycle -> Recoder /internal/agent-os/events), grounded in packages/agent-os event contract. - convergence panel MVP: convergenceManager + ipc + ConvergencePanel emit an approval_requested RunEvent (N->1 proposal); backend stays source of truth.
76 lines
2.8 KiB
JavaScript
76 lines
2.8 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* apply-recoder-branding.js
|
|
*
|
|
* Phase 1 of ../CRYSTAL-INTEGRATION.md. Reads the inert rebrand scaffold
|
|
* (recoder.branding.json) and emits an electron-builder config
|
|
* (electron-builder.recoder.json) with the Crystal -> Recoder overrides applied.
|
|
*
|
|
* This keeps Crystal's own package.json > build block UNTOUCHED (diff-clean):
|
|
* build the Recoder-branded desktop app with
|
|
*
|
|
* node scripts/apply-recoder-branding.js
|
|
* electron-builder --config electron-builder.recoder.json --publish never
|
|
*
|
|
* Additive + reversible: it only generates one gitignore-able config file.
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const brandingPath = path.join(root, 'recoder.branding.json');
|
|
const pkgPath = path.join(root, 'package.json');
|
|
const outPath = path.join(root, 'electron-builder.recoder.json');
|
|
|
|
function readJson(p) {
|
|
return JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
}
|
|
|
|
const branding = readJson(brandingPath);
|
|
const pkg = readJson(pkgPath);
|
|
const build = pkg.build;
|
|
|
|
if (!build || typeof build !== 'object') {
|
|
console.error('ERROR: package.json has no "build" (electron-builder) block to extend.');
|
|
process.exit(1);
|
|
}
|
|
|
|
// Start from Crystal's upstream build config so we inherit files/asar/mac/linux/win
|
|
// targets verbatim, then override only the identity + publish surfaces.
|
|
const config = { ...build };
|
|
|
|
const { product, updater } = branding;
|
|
|
|
config.appId = product.targetAppId; // com.stravu.crystal -> xyz.recoder.desktop
|
|
config.productName = product.targetProductName; // Crystal -> Recoder
|
|
|
|
// Publish/updater target: point the auto-updater at the Recoder repo, not stravu/crystal.
|
|
config.publish = [
|
|
{
|
|
provider: updater.to.provider,
|
|
owner: updater.to.owner,
|
|
repo: updater.to.repo,
|
|
},
|
|
];
|
|
|
|
// Linux desktop-entry / WM class + shortcut naming, when the upstream targets exist.
|
|
if (config.linux && typeof config.linux === 'object') {
|
|
config.linux = { ...config.linux };
|
|
if (config.linux.executableName) config.linux.executableName = product.linuxStartupWMClass;
|
|
}
|
|
if (config.win && typeof config.win === 'object') {
|
|
config.win = { ...config.win };
|
|
}
|
|
if (config.nsis && typeof config.nsis === 'object') {
|
|
config.nsis = { ...config.nsis, shortcutName: product.shortcutName };
|
|
}
|
|
|
|
fs.writeFileSync(outPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
|
|
console.log('Recoder branding config written ->', path.relative(root, outPath));
|
|
console.log(' appId :', build.appId, '->', config.appId);
|
|
console.log(' productName :', build.productName, '->', config.productName);
|
|
console.log(' publish :', `${updater.from.owner}/${updater.from.repo}`, '->', `${updater.to.owner}/${updater.to.repo}`);
|
|
console.log('\nBuild with: electron-builder --config electron-builder.recoder.json --publish never');
|