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

33 lines
1.8 KiB
JavaScript

import { test } from 'node:test';
import assert from 'node:assert/strict';
import * as service from '../src/org-service.mjs';
const { templateRender, validateOrg } = service;
test('installed modules supply presets and report availability without credentials', async () => {
const presets = await service.orgPresets({ env: { PATH: '/usr/bin:/bin' } });
const fixture = presets.find(p => p.name === 'fixture');
const claude = presets.find(p => p.name === 'claude-code');
assert.equal(fixture.available.ok, true);
assert.equal(claude.available.ok, false);
assert.ok(claude.available.reason);
assert.deepEqual(claude.thinking.levels, ['low', 'medium', 'high', 'xhigh', 'max']);
});
test('preset overlays produce valid documents and the legacy alias remains identical', async () => {
const doc = await templateRender('alpha', { preset: 'fixture' });
assert.deepEqual(doc, await templateRender('alpha', { fixture: 'local' }));
assert.deepEqual(await validateOrg(doc), { ok: true, errors: [] });
assert.equal(doc.vars['bus.tester'], true);
const claude = await templateRender('alpha', { preset: 'claude-code', thinking: 'medium' });
assert.deepEqual(claude.roles.assistant.vars, { harness: 'claude-code', model: 'opus', thinking: 'medium' });
assert.equal(claude.launch.models.opus.model, 'claude-opus-5-5');
assert.equal(claude.vars, undefined);
assert.deepEqual(await validateOrg(claude), { ok: true, errors: [] });
});
test('unknown presets and thinking levels refuse', async () => {
await assert.rejects(templateRender('alpha', { preset: 'no-such-preset' }), /unknown preset/);
await assert.rejects(templateRender('alpha', { preset: 'claude-code', thinking: 'off' }), /thinking/);
await assert.rejects(templateRender('alpha', { thinking: 'low' }), /thinking/);
});