mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
unreferencedPlates: an explicit artifact joins the source corpus instead of replacing it
Greptile's follow-up P1 on #599: with --artifact set, only that HTML file was read, so a plate referenced exclusively from a linked stylesheet still read as unused. The bounded source walk now runs either way. AI-assisted (Claude Code).
This commit is contained in:
@@ -341,7 +341,10 @@ function sourceFiles(root = '.', limit = 400) {
|
||||
export function unreferencedPlates(spec, artifact = null) {
|
||||
const plates = (spec?.regions || []).filter((r) => r.medium === 'raster' && r.plate);
|
||||
if (!plates.length) return [];
|
||||
const files = artifact && fs.existsSync(artifact) ? [artifact] : sourceFiles();
|
||||
// The artifact narrows nothing: a plate may be referenced only from a
|
||||
// stylesheet the artifact links (assets/hero.css), so the source walk runs
|
||||
// either way and the artifact is simply guaranteed a seat in the corpus.
|
||||
const files = [...new Set([...(artifact && fs.existsSync(artifact) ? [artifact] : []), ...sourceFiles()])];
|
||||
let corpus = '';
|
||||
for (const f of files) { try { corpus += fs.readFileSync(f, 'utf8') + '\n'; } catch { /* skip */ } }
|
||||
const missing = [];
|
||||
|
||||
Reference in New Issue
Block a user