mirror of https://github.com/garrytan/gstack.git
Fix skill check for skipped Claude template
This commit is contained in:
parent
26bd9fc1fc
commit
fe86a35aab
|
|
@ -10,12 +10,14 @@
|
||||||
|
|
||||||
import { validateSkill } from '../test/helpers/skill-parser';
|
import { validateSkill } from '../test/helpers/skill-parser';
|
||||||
import { discoverTemplates, discoverSkillFiles } from './discover-skills';
|
import { discoverTemplates, discoverSkillFiles } from './discover-skills';
|
||||||
|
import { ALL_HOST_CONFIGS, getExternalHosts, getHostConfig } from '../hosts/index';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
|
|
||||||
const ROOT = path.resolve(import.meta.dir, '..');
|
const ROOT = path.resolve(import.meta.dir, '..');
|
||||||
const ROOT_REALPATH = fs.realpathSync(ROOT);
|
const ROOT_REALPATH = fs.realpathSync(ROOT);
|
||||||
|
const PRIMARY_HOST_CONFIG = getHostConfig('claude');
|
||||||
|
|
||||||
function isRepoRootSymlink(candidateDir: string): boolean {
|
function isRepoRootSymlink(candidateDir: string): boolean {
|
||||||
try {
|
try {
|
||||||
|
|
@ -25,6 +27,19 @@ function isRepoRootSymlink(candidateDir: string): boolean {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function skillDirForTemplateOutput(output: string): string | null {
|
||||||
|
const normalized = output.replace(/\\/g, '/');
|
||||||
|
const parts = normalized.split('/');
|
||||||
|
if (parts.length !== 2 || parts[1] !== 'SKILL.md') return null;
|
||||||
|
return parts[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSkippedForPrimaryHost(output: string): boolean {
|
||||||
|
const skillDir = skillDirForTemplateOutput(output);
|
||||||
|
if (!skillDir) return false;
|
||||||
|
return PRIMARY_HOST_CONFIG.generation.skipSkills?.includes(skillDir) ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
// Find all SKILL.md files (dynamic discovery — no hardcoded list)
|
// Find all SKILL.md files (dynamic discovery — no hardcoded list)
|
||||||
const SKILL_FILES = discoverSkillFiles(ROOT);
|
const SKILL_FILES = discoverSkillFiles(ROOT);
|
||||||
|
|
||||||
|
|
@ -73,6 +88,10 @@ for (const { tmpl, output } of TEMPLATES) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!fs.existsSync(outPath)) {
|
if (!fs.existsSync(outPath)) {
|
||||||
|
if (isSkippedForPrimaryHost(output)) {
|
||||||
|
console.log(` ⏭️ ${output.padEnd(30)} — intentionally skipped for ${PRIMARY_HOST_CONFIG.displayName}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
console.log(` \u274c ${output.padEnd(30)} — generated file missing! Run: bun run gen:skill-docs`);
|
console.log(` \u274c ${output.padEnd(30)} — generated file missing! Run: bun run gen:skill-docs`);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -90,8 +109,6 @@ for (const file of SKILL_FILES) {
|
||||||
|
|
||||||
// ─── External Host Skills (config-driven) ───────────────────
|
// ─── External Host Skills (config-driven) ───────────────────
|
||||||
|
|
||||||
import { getExternalHosts } from '../hosts/index';
|
|
||||||
|
|
||||||
for (const hostConfig of getExternalHosts()) {
|
for (const hostConfig of getExternalHosts()) {
|
||||||
const hostDir = path.join(ROOT, hostConfig.hostSubdir, 'skills');
|
const hostDir = path.join(ROOT, hostConfig.hostSubdir, 'skills');
|
||||||
if (fs.existsSync(hostDir)) {
|
if (fs.existsSync(hostDir)) {
|
||||||
|
|
@ -130,8 +147,6 @@ for (const hostConfig of getExternalHosts()) {
|
||||||
|
|
||||||
// ─── Freshness (config-driven) ──────────────────────────────
|
// ─── Freshness (config-driven) ──────────────────────────────
|
||||||
|
|
||||||
import { ALL_HOST_CONFIGS } from '../hosts/index';
|
|
||||||
|
|
||||||
for (const hostConfig of ALL_HOST_CONFIGS) {
|
for (const hostConfig of ALL_HOST_CONFIGS) {
|
||||||
const hostFlag = hostConfig.name === 'claude' ? '' : ` --host ${hostConfig.name}`;
|
const hostFlag = hostConfig.name === 'claude' ? '' : ` --host ${hostConfig.name}`;
|
||||||
console.log(`\n Freshness (${hostConfig.displayName}):`);
|
console.log(`\n Freshness (${hostConfig.displayName}):`);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { describe, expect, test } from 'bun:test';
|
||||||
|
import { spawnSync } from 'child_process';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
const ROOT = path.resolve(import.meta.dir, '..');
|
||||||
|
|
||||||
|
describe('skill:check', () => {
|
||||||
|
test('accepts template outputs intentionally skipped for the primary host', () => {
|
||||||
|
const result = spawnSync('bun', ['run', 'scripts/skill-check.ts'], {
|
||||||
|
cwd: ROOT,
|
||||||
|
encoding: 'utf8',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result.status).toBe(0);
|
||||||
|
expect(result.stdout).toContain('claude/SKILL.md');
|
||||||
|
expect(result.stdout).toContain('intentionally skipped for Claude Code');
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue