fix(eval,ci): isolate interview eval and harden skill lint and design gate

- Run eval sessions in a temp dir outside the repo so Codex no longer reads the root AGENTS.md; empty streams, timeouts and crashes judge as ERROR instead of PASS
- Close interview-gate lint gaps: softening phrases hidden on allowed lines, reordered phrasing, sibling-anchor bypass
- design-gate: bold threshold 700, axe incomplete reported as manual checks, follow @import with query strings, report unverified color literals; keep site copy in sync via test
- publish-npm.sh fails without NPM_TOKEN; CI requires Node 22.6+; ignore outputs/
This commit is contained in:
Yun Chan 2026-10-09 18:18:41 +09:00
parent bc914eafc5
commit 97f2c241e4
19 changed files with 767 additions and 139 deletions

View file

@ -30,7 +30,7 @@ const HELP = `design-gate — 디자인 QA 게이트
--no-report 리포트 파일을 쓰지 않는다(결과는 표준 출력으로만)
--strict 미검증이 하나라도 있으면 exit 3
--static-only 브라우저를 띄우지 않고 L0 정적 검사만 돈다(브라우저 계층은 미검증으로 보고)
--update-baseline 시각 기준 화면 갱신(검증된 배포 후에만)
--update-baseline 시각 기준 화면 갱신(검증된 배포 후에만). checks.visual 이 켜져 있어야 하고, 꺼져 있으면 exit 2
--force --init 이 기존 설정을 덮어쓰게 한다
--help, -h 이 도움말
@ -47,7 +47,7 @@ const HELP = `design-gate — 디자인 QA 게이트
선택 도구 — 실행한 디렉터리(cwd)의 node_modules → 이 스크립트 위치 순으로 찾는다
puppeteer-core 브라우저 계층 전체. 없으면 브라우저 계층이 미검증이다
axe-core checks.axe. 없으면 axe 미검증
axe-core checks.axe. 없으면 axe 미검증. 판정하지 못한 항목(incomplete)은 위반이 아니라 "수동 확인 n건"으로 덧붙인다
pixelmatch·pngjs checks.visual playwright checks.webkit
stylelint·html-validate checks.static(cwd 쪽만 찾는다)
브라우저 — CHROME_PATH → 설정 chromePath → Chrome·Chromium·Edge 기본 설치 경로 → PATH 순으로 찾는다
@ -179,6 +179,15 @@ if (!Array.isArray(CFG.widths) || !CFG.widths.length || CFG.widths.some((w) => !
process.exit(2);
}
if (!Array.isArray(CFG.fontScales) || !CFG.fontScales.length || CFG.fontScales.some((x) => !Number.isFinite(x) || x <= 0)) {
console.error("gate.config 오류: fontScales 는 양수 배율의 비어 있지 않은 목록이어야 한다.");
process.exit(2);
}
if (opt.flags.has("--update-baseline") && !CFG.checks.visual) {
console.error("design-gate: --update-baseline 은 checks.visual 이 켜져 있어야 동작한다 — 지금은 꺼져 있어 아무것도 갱신하지 않는다. 설정에서 checks.visual 을 true 로 한다.");
process.exit(2);
}
const UPDATE = opt.flags.has("--update-baseline");
const STRICT = opt.flags.has("--strict") || CFG.strict === true;
const STATIC_ONLY = opt.flags.has("--static-only");
@ -340,12 +349,15 @@ const cssFilesOf = (p) => {
if (fs.existsSync(f)) out.push(f);
}
}
// @import 로 딸려오는 로컬 파일(토큰 등)까지 따라간다
for (const f of [...out]) {
// @import 로 딸려오는 로컬 파일(토큰 등)을 끝까지 따라간다. out 이 곧 방문 집합이라 순환 import 는 한 번만 읽는다.
// 주석을 먼저 지운 뒤 찾는다 — 주석 처리된 @import 를 읽으면 쓰지 않는 파일이 검사 대상에 들어온다.
for (let i = 0; i < out.length; i++) {
const f = out[i];
try {
for (const im of fs.readFileSync(f, "utf8").matchAll(/@import\s+(?:url\()?["']?([^"')]+)["']?\)?/g)) {
if (!/^https?:/.test(im[1])) {
const g = path.resolve(path.dirname(f), im[1]);
const text = fs.readFileSync(f, "utf8").replace(/\/\*[\s\S]*?\*\//g, "");
for (const im of text.matchAll(/@import\s+(?:url\(\s*)?["']?([^"')\s;]+)/g)) {
if (!/^(?:https?:|data:|\/\/)/.test(im[1])) {
const g = path.resolve(path.dirname(f), im[1].split(/[?#]/)[0]);
if (fs.existsSync(g) && !out.includes(g)) out.push(g);
}
}
@ -478,6 +490,8 @@ if (CFG.checks.cssHygiene) {
}
bad.length
? fail(`${p.name} 토큰 위생`, bad.join(" · ") + (colors.length ? " — 예: " + colors.slice(0, 4).join(" ") : ""))
: colorLimit === null
? unverified(`${p.name} 토큰 위생`, `색 리터럴은 검사하지 않았다(${colors.length}건 발견) — 토큰 파일을 못 찾았다. 파일명에 tokens 가 든 CSS 를 두거나 staticContract.tokenFiles·budgets.colorLiterals 로 지정한다. radius ${radii.size}종은 통과`)
: pass(`${p.name} 토큰 위생`, `색 ${colors.length}${colorLimit === null ? "" : `/${colorLimit}`}건(${colorKinds.size}종)·radius ${radii.size}${radiusLimit === null ? "" : `/${radiusLimit}`}종·토큰 ${tokenFiles.length}파일/${tokenNames.size}개`);
}
} else off("토큰 위생", "checks.cssHygiene=false");
@ -914,7 +928,7 @@ const auditPage = async (page, p, axeSource) => {
const l1 = lum(fgFinal), l2 = lum(bgFinal);
const ratio = +(((Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05))).toFixed(2);
const size = parseFloat(cs.fontSize) || 0; const w = +cs.fontWeight || 400;
const need = size >= 24 || (size >= 18.66 && w >= 600) ? cl : cn;
const need = size >= 24 || (size >= 18.66 && w >= 700) ? cl : cn; // bold = 700 이상. 600(semibold)은 4.5:1
checked++;
if (ratio < need) {
const k = cs.color + Math.round(size) + Math.round(ratio * 10);
@ -1096,11 +1110,18 @@ const auditPage = async (page, p, axeSource) => {
await page.addScriptTag({ content: axeSource });
const report = await page.evaluate(async () => {
const r = await window.axe.run(document, { runOnly: { type: "tag", values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"] } });
return r.violations.map((v) => ({ id: v.id, impact: v.impact, count: v.nodes.length }));
return {
violations: r.violations.map((v) => ({ id: v.id, impact: v.impact, count: v.nodes.length })),
// incomplete 는 axe 가 판정하지 못한 항목(이미지·그라디언트 위 대비 등)이다. 위반이 아니라 수동 확인 대상이다.
incomplete: (r.incomplete || []).map((v) => ({ id: v.id, count: v.nodes.length })),
};
});
report.length
? fail(`${p.name}/${v} axe`, report.map((r) => `${r.id}(${r.impact}) ${r.count}건`).join(" · "))
: pass(`${p.name}/${v} axe`, "WCAG 2.x AA 위반 0건");
const manual = report.incomplete.length
? ` · 수동 확인 ${report.incomplete.reduce((n, r) => n + r.count, 0)}건(${report.incomplete.map((r) => r.id).join(", ")})`
: "";
report.violations.length
? fail(`${p.name}/${v} axe`, report.violations.map((r) => `${r.id}(${r.impact}) ${r.count}건`).join(" · ") + manual)
: pass(`${p.name}/${v} axe`, "WCAG 2.x AA 위반 0건" + manual);
}
}
@ -1157,6 +1178,8 @@ const visualLayer = async (browser) => {
const pixelmatch = exportOf(await loadOptional("pixelmatch"), (m) => typeof m === "function");
const PNG = exportOf(await loadOptional("pngjs"), (m) => typeof m.PNG === "function")?.PNG;
if (!pixelmatch || !PNG) return unverified("L3 시각 회귀", "pixelmatch·pngjs 를 찾지 못했다");
// --url 만 준 실행은 프로젝트에 아무것도 남기지 않는 읽기 전용이다. 기준 화면을 cwd 에 쓰지 않는다.
if (URL_MODE && !opt.outDir) return unverified("L3 시각 회귀", "--url 만 준 실행은 기준 화면을 저장하지 않는다 — --out-dir 을 함께 준다");
const BASE = path.join(OUT_DIR, "__gate__/baseline");
fs.mkdirSync(BASE, { recursive: true });
const page = await browser.newPage();