mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 11:45:20 +02:00
00a7a65026
Six new gate-tier test files: - test/writing-style-resolver.test.ts — asserts Writing Style section is injected into tier-≥2 preamble, all 6 rules present, jargon list inlined, terse-mode gate condition present, Codex output uses \$GSTACK_BIN (not ~/.claude/), tier-1 does NOT get the section, migration-prompt block present. - test/explain-level-config.test.ts — gstack-config set/get round-trip for default + terse, unknown-value warns + defaults to default, header documents the key, round-trip across set→set→get. - test/jargon-list.test.ts — shape + ~50 terms + no duplicates (case-insensitive) + includes canonical high-signal terms. - test/v0-dormancy.test.ts — 5D dimension names + archetype names forbidden in default-mode tier-≥2 SKILL.md output, except for plan-tune and office-hours where they're load-bearing. - test/readme-throughput.test.ts — script replaces anchor with number on happy path, writes PENDING marker when JSON missing, CI gate asserts committed README contains no PENDING string. - test/upgrade-migration-v1.test.ts — fresh run writes pending flag, idempotent after user-answered, pre-existing explain_level counts as answered. All 95 V1 test-expect() calls pass. Full suite: 0 failures. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
91 lines
3.2 KiB
TypeScript
91 lines
3.2 KiB
TypeScript
/**
|
|
* V0 dormancy — negative tests.
|
|
*
|
|
* V1 keeps V0's psychographic machinery (5D dimensions + 8 archetypes + signal map)
|
|
* in code but explicitly does not surface it in default-mode skill output. This test
|
|
* enforces the maintenance boundary: if these strings ever appear in a generated
|
|
* tier-≥2 SKILL.md's normal (default-mode) content, V0 machinery has leaked.
|
|
*
|
|
* Exceptions (explicitly allowed): SKILL.md files for skills that legitimately discuss
|
|
* V0 machinery:
|
|
* - plan-tune/ — the conversational inspection skill for /plan-tune
|
|
* - office-hours/ — sets the declared profile
|
|
* For these, V0 vocabulary is load-bearing and must appear.
|
|
*
|
|
* All other tier-≥2 skills: 5D dim names + archetype names must NOT appear.
|
|
*/
|
|
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 FORBIDDEN_5D_DIMS = [
|
|
'scope_appetite',
|
|
'risk_tolerance',
|
|
'detail_preference',
|
|
'architecture_care',
|
|
// `autonomy` is too common a word to forbid in arbitrary skill output.
|
|
];
|
|
|
|
const FORBIDDEN_ARCHETYPE_NAMES = [
|
|
'Cathedral Builder',
|
|
'Ship-It Pragmatist',
|
|
'Deep Craft',
|
|
'Taste Maker',
|
|
'Solo Operator',
|
|
// `Consultant`, `Wedge Hunter`, `Builder-Coach` — some may appear in prose
|
|
// naturally; check the strictly-V0-unique phrases first.
|
|
];
|
|
|
|
// Skills that legitimately reference V0 psychographic vocabulary.
|
|
const ALLOWED_SKILLS_WITH_V0_VOCAB = new Set([
|
|
'plan-tune',
|
|
'office-hours',
|
|
]);
|
|
|
|
function discoverTier2PlusSkillMds(): Array<{ skillName: string; mdPath: string }> {
|
|
const entries = fs.readdirSync(ROOT, { withFileTypes: true });
|
|
const results: Array<{ skillName: string; mdPath: string }> = [];
|
|
for (const e of entries) {
|
|
if (!e.isDirectory()) continue;
|
|
if (e.name.startsWith('.') || e.name === 'node_modules' || e.name === 'test') continue;
|
|
const mdPath = path.join(ROOT, e.name, 'SKILL.md');
|
|
const tmplPath = path.join(ROOT, e.name, 'SKILL.md.tmpl');
|
|
if (!fs.existsSync(mdPath) || !fs.existsSync(tmplPath)) continue;
|
|
// Check tier via frontmatter
|
|
const tmpl = fs.readFileSync(tmplPath, 'utf-8');
|
|
const tierMatch = tmpl.match(/preamble-tier:\s*(\d+)/);
|
|
const tier = tierMatch ? parseInt(tierMatch[1], 10) : 4;
|
|
if (tier < 2) continue;
|
|
results.push({ skillName: e.name, mdPath });
|
|
}
|
|
return results;
|
|
}
|
|
|
|
describe('V0 dormancy in default-mode skill output', () => {
|
|
const skills = discoverTier2PlusSkillMds();
|
|
|
|
for (const { skillName, mdPath } of skills) {
|
|
if (ALLOWED_SKILLS_WITH_V0_VOCAB.has(skillName)) continue;
|
|
|
|
test(`${skillName}/SKILL.md contains no V0 psychographic dimension names`, () => {
|
|
const content = fs.readFileSync(mdPath, 'utf-8');
|
|
for (const dim of FORBIDDEN_5D_DIMS) {
|
|
expect(content).not.toContain(dim);
|
|
}
|
|
});
|
|
|
|
test(`${skillName}/SKILL.md contains no V0 archetype names`, () => {
|
|
const content = fs.readFileSync(mdPath, 'utf-8');
|
|
for (const archetype of FORBIDDEN_ARCHETYPE_NAMES) {
|
|
expect(content).not.toContain(archetype);
|
|
}
|
|
});
|
|
}
|
|
|
|
test('at least 5 tier-≥2 skills were checked (sanity)', () => {
|
|
expect(skills.length).toBeGreaterThanOrEqual(5);
|
|
});
|
|
});
|