Files
jason.woltje 6e7c23d7d9 sage: Darkwing's Window A and B scratch --plan and load checks, cited in both plans (#1558)
Darkwing's queue-162 packet for sage-1004/1006/1008: the two scratch
--plan runs on blob 4b16e848 and the load checks of the usage-source
file under 5fa9cc8f2 and 8e7ea89a1 (mos-0845 D3, mos-0847). Secrets
scan clean.

Both plans cite the files. W3 notes that the scratch store line reads
the pointer, since the scratch root has no store.
2026-10-19 12:55:51 -05:00

19 lines
1.1 KiB
JavaScript

// business-check-style load (repin-de352dfaf/business-check.mjs) of a scratch business file under COPY's own
// loader and roles. usage: node load-check.mjs COPY_DIR CONFIG_DIR. Prints counts, plug-in kinds, HOLDS lines, LOAD_OK or REFUSED.
const [copy, dir] = process.argv.slice(2);
const { loadBusiness } = await import(`${copy}/packages/business/src/business.mjs`);
const { resolveInstance } = await import(`${copy}/packages/business/src/resolve.mjs`);
try {
const b = loadBusiness('mosaic-stack', { dir, rolesDir: `${copy}/roles` });
const count = (o) => Object.keys(o ?? {}).length;
console.log(`copy ${copy.split('/').pop().slice(0, 9)}: roles ${count(b.roles)}, projects ${count(b.projects)}, arbiters ${count(b.arbiters)}, plugins ${JSON.stringify(b.plugins)}`);
for (const instance of ['chief', 'pm']) {
const { limits: { authority: a } } = resolveInstance({ system: {}, business: b, instance });
console.log(`HOLDS ${instance} instance.name ${[...a.withinRole, ...a.crossRole].includes('instance.name') ? 'yes' : 'no'}`);
}
console.log('LOAD_OK');
} catch (e) {
console.log(`REFUSED ${e.message}`);
process.exit(1);
}