1import { describe, expect, test } from 'bun:test';
2import fs from 'fs';
3import path from 'path';
4import { readSourceFiles } from '../../scripts/lib/utils.js';
5
6const ROOT = process.cwd();
7
8describe('skill detector bundle', () => {
9 test('adds the detector wrapper and engine files to skill scripts', () => {
10 const { skills } = readSourceFiles(ROOT);
11 const skill = skills.find(s => s.name === 'impeccable');
12 const scriptNames = new Set(skill.scripts.map(s => s.name));
13
14 expect(scriptNames.has('detect.mjs')).toBe(true);
15 expect(scriptNames.has('detector/detect-antipatterns.mjs')).toBe(true);
16 expect(scriptNames.has('detector/detect-antipatterns-browser.js')).toBe(true);
17 expect(scriptNames.has('detector/cli/main.mjs')).toBe(true);
18 expect(scriptNames.has('detector/engines/static-html/detect-html.mjs')).toBe(true);
19 });
20
21 test('critique references the bundled detector command', () => {
22 const critique = fs.readFileSync(path.join(ROOT, 'skill/reference/critique.md'), 'utf-8');
23
24 expect(critique).toContain('node {{scripts_path}}/detect.mjs --json [--fast] [target]');
25 expect(critique).not.toContain('npx impeccable detect');
26 });
27});