Files
jason.woltje a8d9eecf65 organization: move packages/business to packages/organization (rename r2 stage B1)
git mv packages/business -> packages/organization (@mosaic/organization). The
old package stays as one-line re-export shims of each moved module, with
src/business.mjs re-exporting src/organization-config.mjs and src/cli.mjs
forwarding to the moved executable. BusinessError is OrganizationConfigError
(one constructor, name kept BusinessError); OrganizationError stays distinct.
The bus adapter gains organization-context.mjs (busOrganization), with
business.mjs (busBusiness) as the same function.

Import consumers, manifests, the lockfile, scripts/mosaic, stack-copy.sh
COPY_PATHS (both roots), seat sandbox RUNNER_FILES and the copy closure
walker (organization-imports.mjs, both roots required) move to the new path.
v1 serialization, v1 writers and the stage A fixtures are unchanged; the stage
A contract tests stay where they were and pass as before.
2026-11-09 11:47:48 -06:00

23 lines
917 B
JavaScript

// Exit codes follow docs/TOOLS.md: 2 invalid data or refused, 4 usage or a
// missing file. Every refusal in this package is an OrganizationConfigError.
//
// Rename design r2 (module map): BusinessError is the same constructor under
// its old name, so instanceof, exitCode and the message hold for both. The
// name property stays "BusinessError": the bus matches refusals by it
// (packages/bus/src/broker.mjs) and an uncaught refusal prints it, so the
// legacy error output does not change. OrganizationError in organization.mjs
// is a different class and stays one.
export class OrganizationConfigError extends Error {
constructor(message, exitCode = 2) {
super(message);
this.name = "BusinessError";
this.exitCode = exitCode;
}
}
export const BusinessError = OrganizationConfigError;
export function refuse(message, exitCode = 2) {
throw new OrganizationConfigError(message, exitCode);
}