mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-09 06:45:46 +02:00
Merge remote-tracking branch 'origin/main' into garrytan/slim-gstack-skills
# Conflicts: # test/brain-sync.test.ts # test/skill-validation.test.ts
This commit is contained in:
@@ -85,6 +85,9 @@ const ALL_SKILLS = (() => {
|
||||
return skills;
|
||||
})();
|
||||
|
||||
const CLAUDE_SKIPPED_SKILL_DIRS = new Set(['claude']);
|
||||
const CLAUDE_GENERATED_SKILLS = ALL_SKILLS.filter(skill => !CLAUDE_SKIPPED_SKILL_DIRS.has(skill.dir));
|
||||
|
||||
describe('gen-skill-docs', () => {
|
||||
test('generated SKILL.md contains all command categories', () => {
|
||||
const content = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');
|
||||
@@ -143,7 +146,7 @@ describe('gen-skill-docs', () => {
|
||||
});
|
||||
|
||||
test('every skill has a generated SKILL.md with auto-generated header', () => {
|
||||
for (const skill of ALL_SKILLS) {
|
||||
for (const skill of CLAUDE_GENERATED_SKILLS) {
|
||||
const mdPath = path.join(ROOT, skill.dir, 'SKILL.md');
|
||||
expect(fs.existsSync(mdPath)).toBe(true);
|
||||
const content = fs.readFileSync(mdPath, 'utf-8');
|
||||
@@ -153,7 +156,7 @@ describe('gen-skill-docs', () => {
|
||||
});
|
||||
|
||||
test('every generated SKILL.md has valid YAML frontmatter', () => {
|
||||
for (const skill of ALL_SKILLS) {
|
||||
for (const skill of CLAUDE_GENERATED_SKILLS) {
|
||||
const content = fs.readFileSync(path.join(ROOT, skill.dir, 'SKILL.md'), 'utf-8');
|
||||
expect(content.startsWith('---\n')).toBe(true);
|
||||
expect(content).toContain('name:');
|
||||
@@ -162,13 +165,18 @@ describe('gen-skill-docs', () => {
|
||||
});
|
||||
|
||||
test(`every generated SKILL.md description stays within ${MAX_SKILL_DESCRIPTION_LENGTH} chars`, () => {
|
||||
for (const skill of ALL_SKILLS) {
|
||||
for (const skill of CLAUDE_GENERATED_SKILLS) {
|
||||
const content = fs.readFileSync(path.join(ROOT, skill.dir, 'SKILL.md'), 'utf-8');
|
||||
const description = extractDescription(content);
|
||||
expect(description.length).toBeLessThanOrEqual(MAX_SKILL_DESCRIPTION_LENGTH);
|
||||
}
|
||||
});
|
||||
|
||||
test('Claude outside-voice skill is not generated for Claude host', () => {
|
||||
expect(fs.existsSync(path.join(ROOT, 'claude', 'SKILL.md.tmpl'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(ROOT, 'claude', 'SKILL.md'))).toBe(false);
|
||||
});
|
||||
|
||||
test(`every Codex SKILL.md description stays within ${MAX_SKILL_DESCRIPTION_LENGTH} chars`, () => {
|
||||
const agentsDir = path.join(ROOT, '.agents', 'skills');
|
||||
if (!fs.existsSync(agentsDir)) return; // skip if not generated
|
||||
@@ -215,7 +223,7 @@ describe('gen-skill-docs', () => {
|
||||
expect(result.exitCode).toBe(0);
|
||||
const output = result.stdout.toString();
|
||||
// Every skill should be FRESH
|
||||
for (const skill of ALL_SKILLS) {
|
||||
for (const skill of CLAUDE_GENERATED_SKILLS) {
|
||||
const file = skill.dir === '.' ? 'SKILL.md' : `${skill.dir}/SKILL.md`;
|
||||
expect(output).toContain(`FRESH: ${file}`);
|
||||
}
|
||||
@@ -223,7 +231,7 @@ describe('gen-skill-docs', () => {
|
||||
});
|
||||
|
||||
test('no generated SKILL.md contains unresolved placeholders', () => {
|
||||
for (const skill of ALL_SKILLS) {
|
||||
for (const skill of CLAUDE_GENERATED_SKILLS) {
|
||||
const content = fs.readFileSync(path.join(ROOT, skill.dir, 'SKILL.md'), 'utf-8');
|
||||
const unresolved = content.match(/\{\{[A-Z_]+\}\}/g);
|
||||
expect(unresolved).toBeNull();
|
||||
@@ -337,7 +345,7 @@ describe('gen-skill-docs', () => {
|
||||
});
|
||||
|
||||
test('preamble .pending-* glob is zsh-safe (uses find, not shell glob)', () => {
|
||||
for (const skill of ALL_SKILLS) {
|
||||
for (const skill of CLAUDE_GENERATED_SKILLS) {
|
||||
const content = fs.readFileSync(path.join(ROOT, skill.dir, 'SKILL.md'), 'utf-8');
|
||||
if (!content.includes('.pending-')) continue;
|
||||
// Must NOT have a bare shell glob ".pending-*" outside of find's -name argument
|
||||
@@ -348,7 +356,7 @@ describe('gen-skill-docs', () => {
|
||||
});
|
||||
|
||||
test('bash blocks with shell globs are zsh-safe (setopt guard or find)', () => {
|
||||
for (const skill of ALL_SKILLS) {
|
||||
for (const skill of CLAUDE_GENERATED_SKILLS) {
|
||||
const content = fs.readFileSync(path.join(ROOT, skill.dir, 'SKILL.md'), 'utf-8');
|
||||
const bashBlocks = [...content.matchAll(/```bash\n([\s\S]*?)```/g)].map(m => m[1]);
|
||||
|
||||
@@ -1676,6 +1684,20 @@ describe('Codex generation (--host codex)', () => {
|
||||
expect(fs.existsSync(path.join(AGENTS_DIR, 'gstack-codex'))).toBe(false);
|
||||
});
|
||||
|
||||
test('Codex output includes Claude outside-voice skill with read-only boundary', () => {
|
||||
const content = fs.readFileSync(path.join(AGENTS_DIR, 'gstack-claude', 'SKILL.md'), 'utf-8');
|
||||
expect(content).toContain('claude -p');
|
||||
expect(content).toContain('mktemp /tmp/gstack-claude-prompt-');
|
||||
expect(content).toContain('mktemp /tmp/gstack-claude-diff-');
|
||||
expect(content).not.toContain('/tmp/gstack-claude-diff-$$');
|
||||
expect(content).toContain('cat "$PROMPT_FILE" | claude -p');
|
||||
expect(content).toContain('--disable-slash-commands');
|
||||
expect(content).toContain('--tools ""');
|
||||
expect(content).toContain('--allowedTools Read,Grep,Glob');
|
||||
expect(content).toContain('--disallowedTools Bash,Edit,Write');
|
||||
expect(content).toContain('is_error');
|
||||
});
|
||||
|
||||
test('Codex review step stripped from Codex-host ship and review', () => {
|
||||
const shipContent = fs.readFileSync(path.join(AGENTS_DIR, 'gstack-ship', 'SKILL.md'), 'utf-8');
|
||||
expect(shipContent).not.toContain('codex review --base');
|
||||
@@ -1846,7 +1868,7 @@ describe('Codex generation (--host codex)', () => {
|
||||
});
|
||||
|
||||
test('Claude output unchanged: all Claude skills have zero Codex paths', () => {
|
||||
for (const skill of ALL_SKILLS) {
|
||||
for (const skill of CLAUDE_GENERATED_SKILLS) {
|
||||
const content = fs.readFileSync(path.join(ROOT, skill.dir, 'SKILL.md'), 'utf-8');
|
||||
// pair-agent legitimately documents how Codex agents store credentials.
|
||||
// codex + autoplan document the Codex CLI auth file (~/.codex/auth.json)
|
||||
@@ -2069,6 +2091,16 @@ describe('Parameterized host smoke tests', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('generates Claude outside-voice skill for external hosts', () => {
|
||||
const skillMd = path.join(hostDir, 'gstack-claude', 'SKILL.md');
|
||||
expect(fs.existsSync(skillMd)).toBe(true);
|
||||
const content = fs.readFileSync(skillMd, 'utf-8');
|
||||
expect(content).toContain('claude -p');
|
||||
expect(content).toContain('--disable-slash-commands');
|
||||
expect(content).toContain('--allowedTools Read,Grep,Glob');
|
||||
expect(content).toContain('--disallowedTools Bash,Edit,Write');
|
||||
});
|
||||
|
||||
test('--dry-run freshness check passes', () => {
|
||||
const result = Bun.spawnSync(
|
||||
['bun', 'run', 'scripts/gen-skill-docs.ts', '--host', hostConfig.name, '--dry-run'],
|
||||
|
||||
Reference in New Issue
Block a user