mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-07 07:55:13 +02:00
73 lines
3.9 KiB
JavaScript
73 lines
3.9 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
import { describe, it } from 'node:test';
|
|
|
|
async function readText(relativePath) {
|
|
return readFile(new URL(`../${relativePath}`, import.meta.url), 'utf8');
|
|
}
|
|
|
|
describe('Conductor workspace scripts', () => {
|
|
it('registers setup and run scripts in nonconcurrent mode', async () => {
|
|
const manifest = JSON.parse(await readText('conductor.json'));
|
|
|
|
assert.deepEqual(manifest.scripts, {
|
|
setup: 'bash scripts/conductor-setup.sh',
|
|
run: 'bash scripts/conductor-run.sh',
|
|
});
|
|
assert.equal(manifest.runScriptMode, 'nonconcurrent');
|
|
});
|
|
|
|
it('orchestrates setup through focused step scripts', async () => {
|
|
const setupScript = await readText('scripts/conductor-setup.sh');
|
|
|
|
assert.match(setupScript, /sh scripts\/conductor\/link-agent-overlays\.sh/);
|
|
assert.match(setupScript, /sh scripts\/conductor\/link-root-env-file\.sh/);
|
|
assert.match(setupScript, /source scripts\/conductor\/activate-workspace-uv\.sh/);
|
|
assert.match(setupScript, /sh scripts\/conductor\/install-python-dependencies\.sh/);
|
|
assert.match(setupScript, /sh scripts\/conductor\/install-js-dependencies\.sh/);
|
|
assert.match(setupScript, /sh scripts\/conductor\/rebuild-native-dependencies\.sh/);
|
|
assert.match(setupScript, /sh scripts\/conductor\/build-workspace\.sh/);
|
|
assert.match(setupScript, /sh scripts\/conductor\/run-setup-doctor\.sh/);
|
|
assert.doesNotMatch(setupScript, /read_required_uv_version\(\)/);
|
|
assert.doesNotMatch(setupScript, /uv sync --all-packages --all-groups/);
|
|
assert.doesNotMatch(setupScript, /pnpm install --frozen-lockfile --prefer-offline/);
|
|
assert.doesNotMatch(setupScript, /packages\/cli\/dist\/bin\.js dev doctor setup --no-input/);
|
|
});
|
|
|
|
it('keeps concrete setup commands in step scripts', async () => {
|
|
const resolveUvScript = await readText('scripts/conductor/resolve-uv.sh');
|
|
const activateUvScript = await readText('scripts/conductor/activate-workspace-uv.sh');
|
|
const pythonScript = await readText('scripts/conductor/install-python-dependencies.sh');
|
|
const jsScript = await readText('scripts/conductor/install-js-dependencies.sh');
|
|
const nativeScript = await readText('scripts/conductor/rebuild-native-dependencies.sh');
|
|
const buildScript = await readText('scripts/conductor/build-workspace.sh');
|
|
const doctorScript = await readText('scripts/conductor/run-setup-doctor.sh');
|
|
|
|
assert.match(resolveUvScript, /read_required_uv_version\(\)/);
|
|
assert.match(resolveUvScript, /\.context\/bin\/uv-\$required_version/);
|
|
assert.match(activateUvScript, /bash scripts\/conductor\/resolve-uv\.sh pyproject\.toml/);
|
|
assert.match(activateUvScript, /export PATH="\$\(dirname "\$KTX_UV_BIN"\):\$PATH"/);
|
|
assert.match(pythonScript, /uv sync --all-packages --all-groups/);
|
|
assert.match(jsScript, /pnpm install --frozen-lockfile --prefer-offline/);
|
|
assert.match(nativeScript, /pnpm run native:rebuild/);
|
|
assert.match(buildScript, /pnpm run build/);
|
|
assert.match(doctorScript, /packages\/cli\/dist\/bin\.js dev doctor setup --no-input/);
|
|
});
|
|
|
|
it('links private agent overlays when KAELIO_SKILLS_ROOT is set', async () => {
|
|
const workspaceScript = await readText('scripts/conductor/link-agent-overlays.sh');
|
|
|
|
assert.match(workspaceScript, /KAELIO_SKILLS_ROOT/);
|
|
assert.match(workspaceScript, /agents_source="\$\{KAELIO_SKILLS_ROOT\}\/\.agents"/);
|
|
assert.match(workspaceScript, /ln -s "\$\{agents_source\}" \.agents/);
|
|
});
|
|
|
|
it('runs the KTX daemon on the documented fixed local port', async () => {
|
|
const runScript = await readText('scripts/conductor-run.sh');
|
|
|
|
assert.match(runScript, /pnpm run build/);
|
|
assert.match(runScript, /source \.venv\/bin\/activate/);
|
|
assert.match(runScript, /uv run ktx-daemon serve-http --host 127\.0\.0\.1 --port 8765/);
|
|
assert.doesNotMatch(runScript, /\bnpx\b/);
|
|
});
|
|
});
|