Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(cli): reject intermediate viewport theme mismatches
tt-a1i1c1965b6e02e
diff --git a/archify.zip b/archify.zipindex a81631ec..d189cee5 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/bin/finalize.mjs b/archify/bin/finalize.mjsindex 582c11da..ca346cdd 100644--- a/archify/bin/finalize.mjs+++ b/archify/bin/finalize.mjs@@ -14,7 +14,6 @@ import {CAPTURE_VIEWPORTS,ChromeVisualBrowser,findChrome,- THEMES,VISUAL_CHECK_VIEWPORTS,} from './visual-check.mjs';@@ -153,7 +152,8 @@ function validBrowserEvidence(receipt) {entry.theme === 'light' && entry.ok === true && entry.viewerChromeOk === true))&& exactViewportCoverage(receipt.themeStates?.viewports,- CAPTURE_VIEWPORTS.flatMap(({ width, height }) => THEMES.map((theme) => ({ width, height, theme }))),+ [...VISUAL_CHECK_VIEWPORTS.map((viewport) => ({ ...viewport, theme: 'light' })),+ ...CAPTURE_VIEWPORTS.map((viewport) => ({ ...viewport, theme: 'dark' }))],(entry, expected) => entry.ok === true&& entry.requestedTheme === expected.theme&& entry.resolvedTheme === expected.theme);diff --git a/archify/bin/visual-check.mjs b/archify/bin/visual-check.mjsindex c5666652..a6391602 100644--- a/archify/bin/visual-check.mjs+++ b/archify/bin/visual-check.mjs@@ -2487,9 +2487,12 @@ async function runBrowserEvidence({file: path.basename(entry.path),}));const allObservations = [...observations.values()];- receipt.themeStates.viewports = CAPTURE_VIEWPORTS.flatMap(({ width, height }) => THEMES.map(theme => {- const entry = observations.get(screenshotKey(width, height, theme));- return { width, height, requestedTheme: theme, resolvedTheme: entry.resolvedTheme, ok: entry.resolvedTheme === theme };+ receipt.themeStates.viewports = allObservations.map((entry) => ({+ width: entry.width,+ height: entry.height,+ requestedTheme: entry.theme,+ resolvedTheme: entry.resolvedTheme,+ ok: entry.resolvedTheme === entry.theme,}));const themeStatePass = receipt.themeStates.viewports.every(entry => entry.ok);const containmentPass = allObservations.every((entry) => entry.ok);diff --git a/archify/references/delivery-contract.md b/archify/references/delivery-contract.mdindex 322181f9..7e7f3549 100644--- a/archify/references/delivery-contract.md+++ b/archify/references/delivery-contract.md@@ -357,9 +357,9 @@ node bin/archify.mjs browser-check <output.html> --json --require-provenanceThe zero-dependency command uses Chrome/Chromium through the DevTools pipe. Itmeasures light-theme containment at 1440×900, 1600×1000, 1920×1080, and-2048×1320, and verifies the endpoint light/dark theme plus READ/Still runtime-states. A requested theme that resolves to a different theme fails with measured-evidence. It creates one+2048×1320, and verifies the requested light theme at all four viewports, the dark+theme at both endpoints, and READ/Still runtime states. A requested theme that+resolves to a different theme fails with measured evidence. It creates one`<output-stem>.browser-check.json` receipt and no screenshots or contact sheet.Pass `--out-dir <dir>` to place the receipt in a separate evidence directory.The receipt binds the artifact SHA-256 and byte count, identifiesdiff --git a/archify/references/repository-authoring.md b/archify/references/repository-authoring.mdindex 79ccd10b..72048bdb 100644--- a/archify/references/repository-authoring.md+++ b/archify/references/repository-authoring.md@@ -8,11 +8,16 @@ fact has supporting source evidence.## Explore on demand1. **Freeze identity.** From the target repository, record `git rev-parse- HEAD`, `git remote get-url origin`, and `git status --short`. Pin the URL and+ HEAD`, `git remote get-url origin`, and `git status --short`. Remove HTTP(S)+ userinfo (including usernames, passwords, and tokens) before recording the+ origin or placing it in the candidate. Pin the credential-free URL andforty-character revision in `meta.repository`; use `link_mode: "local-only"`- for a local fixture whose HTTPS URL is only a credential-free identity. If- the worktree is dirty, record the changed paths and treat them as part of- the inspected source only when the task explicitly includes them.+ for a local fixture whose HTTPS URL is only a repository identity. If the+ worktree is dirty, record the changed paths. Repository evidence is verified+ against committed bytes at the pinned revision, not working-tree edits:+ inspect a clean checkout at that revision for any cited changed path. Do not+ present uncommitted bytes as evidence for `HEAD`; `local-only` does not record+ a verifiable snapshot of those bytes.2. **Map the slice.** Use project instructions, manifests, entry points,registrations, and deployment configuration to locate candidate runtimediff --git a/archify/test/finalize-browser-lifecycle.test.mjs b/archify/test/finalize-browser-lifecycle.test.mjsindex 9e0fbd1c..30c3b69f 100644--- a/archify/test/finalize-browser-lifecycle.test.mjs+++ b/archify/test/finalize-browser-lifecycle.test.mjs@@ -6,7 +6,7 @@ import os from 'node:os';import path from 'node:path';import { runFinalize } from '../bin/finalize.mjs';-import { CAPTURE_VIEWPORTS, THEMES, VISUAL_CHECK_VIEWPORTS } from '../bin/visual-check.mjs';+import { CAPTURE_VIEWPORTS, VISUAL_CHECK_VIEWPORTS } from '../bin/visual-check.mjs';function workspace(t) {const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-finalize-browser-'));@@ -96,9 +96,10 @@ function browserReceipt(output, delivered, outDir) {},themeStates: {status: 'pass',- viewports: CAPTURE_VIEWPORTS.flatMap(({ width, height }) => THEMES.map((theme) => ({- width, height, requestedTheme: theme, resolvedTheme: theme, ok: true,- }))),+ viewports: [+ ...VISUAL_CHECK_VIEWPORTS.map((viewport) => ({ ...viewport, requestedTheme: 'light', resolvedTheme: 'light', ok: true })),+ ...CAPTURE_VIEWPORTS.map((viewport) => ({ ...viewport, requestedTheme: 'dark', resolvedTheme: 'dark', ok: true })),+ ],},readability: {status: 'pass',diff --git a/archify/test/finalize-browser.test.mjs b/archify/test/finalize-browser.test.mjsindex 0feef198..14c4f307 100644--- a/archify/test/finalize-browser.test.mjs+++ b/archify/test/finalize-browser.test.mjs@@ -32,7 +32,7 @@ test('finalize proves all four gates in real Chrome with bounded mixed-case sideconst browser = JSON.parse(fs.readFileSync(receipt.evidence.browserCheckReceipt));assert.equal(browser.command, 'browser-check');assert.equal(browser.containment.viewports.length, 4);- assert.equal(browser.themeStates.viewports.length, 4);+ assert.equal(browser.themeStates.viewports.length, 6);assert.equal(browser.captures.status, 'not-requested');assert.deepEqual(browser.captures.screenshots, []);assert.equal(browser.deliveryReceiptId, JSON.parse(fs.readFileSync(evidence.receipt)).stages.deliver.receipt.receiptId);diff --git a/archify/test/finalize.test.mjs b/archify/test/finalize.test.mjsindex 98fb451b..bf5163fc 100644--- a/archify/test/finalize.test.mjs+++ b/archify/test/finalize.test.mjs@@ -12,7 +12,7 @@ import {defaultFinalizeSummaryPath,runFinalize,} from '../bin/finalize.mjs';-import { CAPTURE_VIEWPORTS, THEMES, VISUAL_CHECK_VIEWPORTS } from '../bin/visual-check.mjs';+import { CAPTURE_VIEWPORTS, VISUAL_CHECK_VIEWPORTS } from '../bin/visual-check.mjs';function workspace(t) {const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-finalize-'));@@ -107,9 +107,10 @@ function passingBrowserCheck({ output, artifact, deliveryReceiptId, outDir }) {},themeStates: {status: 'pass',- viewports: CAPTURE_VIEWPORTS.flatMap(({ width, height }) => THEMES.map((theme) => ({- width, height, requestedTheme: theme, resolvedTheme: theme, ok: true,- }))),+ viewports: [+ ...VISUAL_CHECK_VIEWPORTS.map((viewport) => ({ ...viewport, requestedTheme: 'light', resolvedTheme: 'light', ok: true })),+ ...CAPTURE_VIEWPORTS.map((viewport) => ({ ...viewport, requestedTheme: 'dark', resolvedTheme: 'dark', ok: true })),+ ],},readability: {status: 'pass',@@ -741,6 +742,18 @@ test('finalize requires complete passing browser evidence coverage', async t =>name: 'incomplete theme coverage',mutate: (receipt) => { receipt.themeStates.viewports.pop(); },},+ {+ name: 'missing intermediate light-theme coverage',+ mutate: (receipt) => {+ receipt.themeStates.viewports = receipt.themeStates.viewports.filter(({ width }) => width !== 1600);+ },+ },+ {+ name: 'mismatched intermediate light theme despite passing parent status',+ mutate: (receipt) => {+ receipt.themeStates.viewports.find(({ width }) => width === 1920).resolvedTheme = 'dark';+ },+ },];for (const scenario of cases) {diff --git a/archify/test/visual-check.test.mjs b/archify/test/visual-check.test.mjsindex c30d9926..d5a9f323 100644--- a/archify/test/visual-check.test.mjs+++ b/archify/test/visual-check.test.mjs@@ -84,7 +84,7 @@ function fakeBrowser({innerHeight: height,scrollWidth: width + (overflow ? 1 : 0),scrollHeight: height + (readableScroll ? 240 : 0) + (tall ? 300 : 0),- resolvedTheme: resolvedThemeAt?.({ theme }) ?? theme,+ resolvedTheme: resolvedThemeAt?.({ width, height, theme }) ?? theme,...(tall ? {pageComposition: {bodyPaddingPx: 12, headerPx: 40, guidedViewsPx: 60, diagramChromePx: 76,@@ -3070,7 +3070,7 @@ test('browser-check proves rendered behavior without creating screenshots or reqassert.equal(result.receipt.status, 'pass');assert.equal(result.receipt.visualReview, 'not-requested');assert.equal(result.receipt.themeStates.status, 'pass');- assert.equal(result.receipt.themeStates.viewports.length, 4);+ assert.equal(result.receipt.themeStates.viewports.length, 6);assert.equal(result.receipt.captures.status, 'not-requested');assert.deepEqual(result.receipt.captures.screenshots, []);assert.equal(result.receipt.captures.contactSheet, null);@@ -3101,3 +3101,29 @@ test('browser-check fails when an endpoint theme does not resolve without needinassert.equal(result.receipt.diagnostics.filter(({ code }) => code === 'viewer/theme-state').length, 2);assert.equal(result.receipt.captures.status, 'not-requested');});++for (const [command, run] of [['browser-check', runBrowserCheck], ['visual-check', runVisualCheck]]) {+ for (const width of [1600, 1920]) {+ test(`${command} rejects a mismatched light theme at the ${width}px intermediate viewport`, async () => {+ const input = artifact(`${command}-intermediate-theme-${width}.html`);+ const browser = fakeBrowser({+ resolvedThemeAt: (entry) => entry.width === width ? 'dark' : entry.theme,+ });+ const result = await run({+ artifactPath: input,+ chromePath: '/fake/chrome',+ browserFactory: async () => browser,+ });++ assert.equal(result.exitCode, 1);+ assert.equal(result.receipt.ok, false);+ assert.equal(result.receipt.status, 'fail');+ assert.equal(result.receipt.themeStates.status, 'fail');+ assert.deepEqual(result.receipt.themeStates.viewports.filter(({ ok }) => !ok), [{+ width, height: width === 1600 ? 1000 : 1080,+ requestedTheme: 'light', resolvedTheme: 'dark', ok: false,+ }]);+ assert.equal(result.receipt.diagnostics.filter(({ code }) => code === 'viewer/theme-state').length, 1);+ });+ }+}