import assert from 'node:assert/strict'; import { spawnSync } from 'node:child_process'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import test from 'node:test'; import { fileURLToPath } from 'node:url'; import { computeSkillContentFingerprint, inspectSkillPack, } from './skill-pack-manifest.mjs'; test('bundled skill pack manifest is synchronized', () => { const result = inspectSkillPack(); assert.deepEqual(result.mismatches, []); }); test('skill content fingerprint canonicalizes CRLF', () => { const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agc-skill-pack-')); try { fs.mkdirSync(path.join(root, 'demo'), { recursive: true }); const entry = { name: 'demo', files: ['SKILL.md'], }; fs.writeFileSync(path.join(root, 'demo', 'SKILL.md'), 'line 1\nline 2\n'); const lf = computeSkillContentFingerprint(root, entry); fs.writeFileSync( path.join(root, 'demo', 'SKILL.md'), 'line 1\r\nline 2\r\n', ); assert.equal(computeSkillContentFingerprint(root, entry), lf); } finally { fs.rmSync(root, { recursive: true, force: true }); } }); test('check command without arguments remains read-only', () => { const scriptPath = path.join( path.dirname(fileURLToPath(import.meta.url)), 'check-skill-pack.mjs', ); const result = spawnSync(process.execPath, [scriptPath], { encoding: 'utf8', }); assert.equal(result.status, 0, result.stderr); assert.match(result.stdout, /\[skill-pack\] OK/u); });