// 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); }