mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-02 15:04:37 +01:00
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.
29 lines
1.5 KiB
TypeScript
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}/\``);
|
|
});
|
|
}
|
|
});
|