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.
18 lines
1.0 KiB
JavaScript
18 lines
1.0 KiB
JavaScript
// The organization selector for the CLI's own parsers (rename design r2, "Selector scopes and
|
|
// parser matrix"): --org and --business in one parser's scope, under packages/organization/src/
|
|
// selector.mjs. An id outside the organization grammar refuses as resolveOrg does, OrgError
|
|
// org-invalid with exit 3, but while parsing, so no verb reads stdin, prompts for a key or reads a
|
|
// business file first. Every other refusal is the parser's own usage error.
|
|
import { ID_PATTERN } from '../../organization/src/vocabulary.mjs';
|
|
import { OrgError } from '../../organization/src/org-registry.mjs';
|
|
import { selectorScope } from '../../organization/src/selector.mjs';
|
|
|
|
// usageError(message) returns the parser's usage error for a missing, flag-shaped, repeated or
|
|
// conflicting selector.
|
|
export function orgSelector(usageError) {
|
|
return selectorScope({
|
|
valid: id => ID_PATTERN.test(id),
|
|
refuse: (kind, why) => { throw kind === 'invalid' ? new OrgError('org-invalid', 'invalid organization id') : usageError(why); },
|
|
});
|
|
}
|