feat(cli): extract Obelisk runtime into npm package
Add @obelisk-apps/cli with the existing build, search, query, and attune contract plus official skill installation. Separate the docs-only skill artifact, bootstrap installer, release layout, cross-platform CI, and package-level regression coverage.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { dirname, join, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
const artifact = join(repoRoot, 'dist', 'obelisk-skill');
|
||||
|
||||
test('build:skill produces a docs-only skill that delegates execution to the CLI', () => {
|
||||
execFileSync(npmCommand, ['run', 'build:skill'], {
|
||||
cwd: repoRoot,
|
||||
encoding: 'utf8',
|
||||
stdio: 'pipe',
|
||||
});
|
||||
|
||||
assert.equal(existsSync(join(artifact, 'SKILL.md')), true);
|
||||
assert.equal(existsSync(join(artifact, 'references', 'api-reference.md')), true);
|
||||
assert.equal(existsSync(join(artifact, 'package.json')), true);
|
||||
assert.equal(existsSync(join(artifact, 'scripts')), false, 'skill must not ship a second runtime');
|
||||
|
||||
const skill = readFileSync(join(artifact, 'SKILL.md'), 'utf8');
|
||||
const schema = readFileSync(join(artifact, 'references', 'schema.md'), 'utf8');
|
||||
assert.match(skill, /Bash\(obelisk:\*\)/);
|
||||
assert.match(skill, /obelisk --query \/tmp\/q\.mjs/);
|
||||
assert.match(skill, /obelisk --attune \/tmp\/register-memory\.mjs/);
|
||||
assert.doesNotMatch(skill, /\$SKILL_DIR\/scripts\/runtime\.js/);
|
||||
assert.doesNotMatch(`${skill}\n${schema}`, /scripts\//);
|
||||
});
|
||||
Reference in New Issue
Block a user