Fix: fail CI when the vendored HTML parser bundle is stale.

Greptile caught that editing the bundle entry did not refresh the committed vendor file, and neither build nor the detector suite would notice. --check compares a fresh rebuild, bun run build runs that check, and the detector suite now triggers on the entry.

AI-assisted.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Abdul Wahab
2026-09-03 08:24:16 -07:00
committed by Paul Bakaus
co-authored by Cursor
parent f4f16e3802
commit 894b95b988
4 changed files with 70 additions and 22 deletions
+26
View File
@@ -1,4 +1,5 @@
import { describe, expect, test } from 'bun:test';
import { spawnSync } from 'node:child_process';
import fs from 'fs';
import path from 'path';
import { readSourceFiles } from '../../scripts/lib/utils.js';
@@ -19,6 +20,31 @@ describe('skill detector bundle', () => {
expect(scriptNames.has('detector/vendor/static-html-parsers.mjs')).toBe(true);
});
test('static HTML parser vendor bundle matches a fresh rebuild', () => {
const result = spawnSync(
process.execPath,
[path.join(ROOT, 'scripts/build-static-html-parsers.js'), '--check'],
{ cwd: ROOT, encoding: 'utf8' },
);
expect(result.status).toBe(0);
});
test('static HTML parser --check fails when the vendor bundle is stale', () => {
const vendor = path.join(ROOT, 'cli/engine/vendor/static-html-parsers.mjs');
const original = fs.readFileSync(vendor, 'utf8');
try {
fs.writeFileSync(vendor, original.replace('htmlparser2', 'htmlparser2-stale'));
const result = spawnSync(
process.execPath,
[path.join(ROOT, 'scripts/build-static-html-parsers.js'), '--check'],
{ cwd: ROOT, encoding: 'utf8' },
);
expect(result.status).toBe(1);
} finally {
fs.writeFileSync(vendor, original);
}
});
test('critique references the bundled detector command', () => {
const critique = fs.readFileSync(path.join(ROOT, 'skill/reference/critique.md'), 'utf-8');