Files
gstack/test/openclaw-native-skills.test.ts
T
dfeae47a17 docs(openclaw): stop advising a per-spawn env for spawned sessions
OpenClaw's sessions_spawn has no env argument (openclaw/openclaw#51654
was closed without adding one), so the documented
env: { OPENCLAW_SESSION: "1" } silently did nothing. Point users at the
ACP harness or Gateway environment instead and guard the old advice.
Adopts #2749.

Co-authored-by: DanCanadian <211164803+DanCanadian@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-08 06:15:45 +00:00

41 lines
1.6 KiB
TypeScript

import { describe, test, expect } from 'bun:test';
import * as fs from 'fs';
import * as path from 'path';
const ROOT = path.resolve(import.meta.dir, '..');
const OPENCLAW_NATIVE_SKILLS = [
'openclaw/skills/gstack-openclaw-investigate/SKILL.md',
'openclaw/skills/gstack-openclaw-office-hours/SKILL.md',
'openclaw/skills/gstack-openclaw-ceo-review/SKILL.md',
'openclaw/skills/gstack-openclaw-retro/SKILL.md',
];
function extractFrontmatter(content: string): string {
expect(content.startsWith('---\n')).toBe(true);
const fmEnd = content.indexOf('\n---', 4);
expect(fmEnd).toBeGreaterThan(0);
return content.slice(4, fmEnd);
}
describe('OpenClaw native skills', () => {
test('frontmatter parses as YAML and keeps only name + description', () => {
for (const skill of OPENCLAW_NATIVE_SKILLS) {
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
const frontmatter = extractFrontmatter(content);
const parsed = Bun.YAML.parse(frontmatter) as Record<string, unknown>;
expect(Object.keys(parsed).sort()).toEqual(['description', 'name']);
expect(typeof parsed.name).toBe('string');
expect(typeof parsed.description).toBe('string');
expect((parsed.name as string).length).toBeGreaterThan(0);
expect((parsed.description as string).length).toBeGreaterThan(0);
}
});
test('integration docs do not advertise an unsupported per-spawn env', () => {
const content = fs.readFileSync(path.join(ROOT, 'docs/OPENCLAW.md'), 'utf-8');
expect(content).not.toContain('env: { OPENCLAW_SESSION');
});
});