Files
gstack/test/skillify-host-paths.test.ts
T
garrytan 424214ace7 C1: skillify finds the browse SDK under its own host's install root
The template hardcoded ~/.claude/skills/gstack for the canonical
browse-client.ts, so external hosts read another host's install or nothing.
A new INSTALLED_ROOT resolver (sibling of INSTALLED_BIN_DIR) names the host's
global root, or the per-install root when setup renders for one.
2026-10-03 21:48:59 +00:00

29 lines
1.5 KiB
TypeScript

/**
* /skillify resolved the browse SDK at ~/.claude/skills/gstack on every host,
* so on Codex and the other external hosts it read another host's install (or
* nothing). The install root now comes from the host config (INSTALLED_ROOT).
*/
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { ALL_HOST_CONFIGS } from '../hosts';
import { runGeneration } from '../scripts/gen-skill-docs';
const out = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-skillify-paths-'));
beforeAll(async () => { expect((await runGeneration({ host: 'all', outputRoot: out })).exitCode).toBe(0); });
afterAll(() => fs.rmSync(out, { recursive: true, force: true }));
describe('skillify resolves the browse SDK from its own host install', () => {
for (const host of ALL_HOST_CONFIGS) {
test(host.name, () => {
const file = host.name === 'claude' ? path.join(out, 'skillify/SKILL.md') : path.join(out, host.hostSubdir, 'skills/gstack-skillify/SKILL.md');
if (!fs.existsSync(file)) return;
const text = fs.readFileSync(file, 'utf8');
const sdk = text.split('\n').filter(l => l.includes('browse-client.ts') && /homedir|replace/.test(l));
expect(sdk).toEqual([` '~/${host.globalRoot}/browse/src/browse-client.ts'.replace(/^~(?=\\/)/, os.homedir()),`]);
expect(text).toContain(`The active gstack skills install at \`~/${host.globalRoot}/\``);
});
}
});