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(browser): discover Windows Edge after Chrome and Chromium
tt-a1i24b48b109309
diff --git a/archify.zip b/archify.zipindex 4fecec0e..f5d74dcd 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/bin/visual-check.mjs b/archify/bin/visual-check.mjsindex b2b8ef17..1a9727bc 100644--- a/archify/bin/visual-check.mjs+++ b/archify/bin/visual-check.mjs@@ -1312,6 +1312,11 @@ export function findChrome({platform = process.platform,resolveExecutable = executable,} = {}) {+ // Windows environment names are case-insensitive, including when callers+ // provide a plain object instead of the special process.env object.+ if (platform === 'win32') {+ env = Object.fromEntries(Object.entries(env).map(([name, value]) => [name.toUpperCase(), value]));+ }if (Object.prototype.hasOwnProperty.call(env, 'ARCHIFY_CHROME')) {return resolveExecutable(env.ARCHIFY_CHROME, platform);}@@ -1344,6 +1349,16 @@ export function findChrome({const resolved = findOnPath(command, env, platform, resolveExecutable);if (resolved) return resolved;}+ // Preserve every Chrome/Chromium candidate's priority, including portable+ // PATH installations, before falling back to Windows' bundled browser.+ if (platform === 'win32') {+ for (const root of [env['PROGRAMFILES(X86)'], env.PROGRAMFILES, env.LOCALAPPDATA].filter(Boolean)) {+ const candidate = path.win32.join(root, 'Microsoft', 'Edge', 'Application', 'msedge.exe');+ const resolved = resolveExecutable(candidate, platform);+ if (resolved) return resolved;+ }+ return findOnPath('msedge', env, platform, resolveExecutable);+ }return null;}@@ -2489,14 +2504,14 @@ async function runBrowserEvidence({receipt.viewerChrome.status = 'skipped';receipt.themeStates.status = 'skipped';if (capture) receipt.captures.status = 'skipped';- receipt.error = 'Chrome or Chromium is unavailable. Set ARCHIFY_CHROME to its executable path.';+ receipt.error = 'No supported browser found. Install Chrome/Chromium (or Microsoft Edge on Windows), or set ARCHIFY_CHROME to its executable path.';receipt.diagnostics = [failureDiagnostic({code: 'viewer/chrome-unavailable',severity: 'warning',message: receipt.error,subject: { artifact },evidence: { executable: null },- supportedFixes: [`set ARCHIFY_CHROME to a Chrome or Chromium executable and rerun ${command}`],+ supportedFixes: [`set ARCHIFY_CHROME to a Chrome/Chromium executable (or Microsoft Edge on Windows) and rerun ${command}`],})];const publication = publishReceiptOnly(artifact, outputs, receipt, ownership);if (publication.ok) publishedBrowserEvidenceReceipts.add(receipt);diff --git a/archify/references/delivery-contract.md b/archify/references/delivery-contract.mdindex 71aacba7..f9ec6b33 100644--- a/archify/references/delivery-contract.md+++ b/archify/references/delivery-contract.md@@ -423,7 +423,12 @@ command is:node bin/archify.mjs browser-check <output.html> --json --require-provenance```-The zero-dependency command uses Chrome/Chromium through the DevTools pipe. It+The zero-dependency command uses Chrome/Chromium (or Microsoft Edge on Windows)+through the DevTools pipe. `ARCHIFY_CHROME` is authoritative when set, including+an invalid path: Archify does not silently fall back to another browser. Automatic+Windows discovery checks every Chrome/Chromium install location and PATH command+first, then Edge under `%ProgramFiles(x86)%`, `%ProgramFiles%`, and `%LocalAppData%`,+followed by `msedge` on PATH. Non-Windows automatic discovery is unchanged. Itmeasures light-theme containment at 1440×900, 1600×1000, 1920×1080, and2048×1320, and verifies the requested light theme at all four viewports, the darktheme at both endpoints, and READ/Still runtime states. A requested theme that@@ -455,7 +460,7 @@ command:- `passed` maps from exit 0 and receipt `status: "pass"` after every required measurement completes and passes.- `failed` maps from exit 1 and receipt `status: "fail"` when the inspection finds a defect, the command fails, or a runtime error leaves the evidence incomplete.-- `skipped` maps only from exit 2 and receipt `status: "skipped"` when Chrome/Chromium is unavailable and the inspection does not run.+- `skipped` maps only from exit 2 and receipt `status: "skipped"` when no supported browser is available and the inspection does not run.Runtime failures leave incomplete evidence and must not be normalized to`skipped`. They do not invalidate an already successful deterministic delivery.diff --git a/scripts/run-browser-tests.mjs b/scripts/run-browser-tests.mjsindex d033958e..3b1f06b7 100644--- a/scripts/run-browser-tests.mjs+++ b/scripts/run-browser-tests.mjs@@ -29,7 +29,7 @@ if (options.list) {const chrome = findChrome();if (!chrome) {- console.error('Browser tests require an executable Chrome/Chromium. Set ARCHIFY_CHROME to its path; this gate cannot skip browser coverage.');+ console.error('Browser tests require an executable Chrome/Chromium (or Microsoft Edge on Windows). Set ARCHIFY_CHROME to its path; this gate cannot skip browser coverage.');process.exit(1);}diff --git a/test/visual-check.test.mjs b/test/visual-check.test.mjsindex ae4ff563..6bd7f6d4 100644--- a/test/visual-check.test.mjs+++ b/test/visual-check.test.mjs@@ -243,6 +243,99 @@ test('findChrome checks Chromium command names on a Windows PATH', () => {]);});+test('findChrome discovers Edge in each standard Windows installation root', () => {+ for (const [name, root] of [+ ['ProgramFiles(x86)', String.raw`C:\Program Files (x86)`],+ ['ProgramFiles', String.raw`D:\Program Files`],+ ['LocalAppData', String.raw`C:\Users\tester\AppData\Local`],+ ]) {+ const expected = path.win32.join(root, 'Microsoft', 'Edge', 'Application', 'msedge.exe');+ assert.equal(findChrome({+ platform: 'win32', env: { [name]: root },+ resolveExecutable: (candidate) => candidate === expected ? candidate : null,+ }), expected, name);+ }+});++test('findChrome finds a real Windows filesystem Edge entry with mixed-case environment names', {+ skip: process.platform !== 'win32',+}, () => {+ const root = fs.mkdtempSync(path.join(tmp, 'Edge Install '));+ const installed = path.join(root, 'Microsoft', 'Edge', 'Application', 'msedge.exe');+ fs.mkdirSync(path.dirname(installed), { recursive: true });+ fs.writeFileSync(installed, 'discovery fixture only; not a browser');+ try {+ assert.equal(findChrome({ env: { 'ProgramFiles(x86)': root } }), installed);+ assert.equal(findChrome({ env: { Path: path.dirname(installed), PathExt: '.EXE' } }).toLowerCase(), installed.toLowerCase());+ } finally {+ fs.rmSync(root, { recursive: true, force: true });+ }+});++test('findChrome keeps explicit browser overrides authoritative even when invalid', () => {+ const edge = String.raw`D:\Portable Edge\msedge.exe`;+ for (const override of [edge, '', String.raw`D:\missing.exe`]) {+ const checked = [];+ const resolved = findChrome({+ platform: 'win32',+ env: { ARCHIFY_CHROME: override, PROGRAMFILES: String.raw`C:\Program Files` },+ resolveExecutable(candidate) {+ checked.push(candidate);+ return candidate === edge ? candidate : null;+ },+ });+ assert.equal(resolved, override === edge ? edge : null);+ assert.deepEqual(checked, [override], 'an invalid explicit path must not silently use another browser');+ }+});++test('findChrome prefers every Chrome/Chromium PATH candidate over installed Edge', () => {+ const edge = String.raw`C:\Program Files\Microsoft\Edge\Application\msedge.exe`;+ for (const command of ['chrome', 'google-chrome', 'google-chrome-stable', 'chromium', 'chromium-browser']) {+ const preferred = String.raw`D:\Browser Bin` + `\\${command}.EXE`;+ assert.equal(findChrome({+ platform: 'win32',+ env: { PROGRAMFILES: String.raw`C:\Program Files`, PATH: String.raw`D:\Browser Bin`, PATHEXT: '.EXE' },+ resolveExecutable: (candidate) => [preferred, edge].includes(candidate) ? candidate : null,+ }), preferred, command);+ }+});++test('findChrome checks installed Edge before its Windows PATH fallback', () => {+ const installed = String.raw`C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe`;+ const portable = String.raw`D:\Browser Bin\msedge.EXE`;+ const env = {+ 'ProgramFiles(x86)': String.raw`C:\Program Files (x86)`,+ Path: String.raw`C:\Tools;D:\Browser Bin`,+ PathExt: '.EXE;.CMD',+ };+ for (const found of [[installed, portable], [portable]]) {+ const checked = [];+ const resolved = findChrome({+ platform: 'win32', env,+ resolveExecutable(candidate) {+ checked.push(candidate);+ return found.includes(candidate) ? candidate : null;+ },+ });+ assert.equal(resolved, found[0]);+ assert.ok(checked.includes(installed));+ if (found.length === 1) assert.ok(checked.indexOf(installed) < checked.indexOf(portable));+ else assert.equal(checked.includes(portable), false);+ }+});++test('findChrome leaves non-Windows discovery unchanged and returns null when nothing is found', () => {+ for (const platform of ['win32', 'darwin', 'linux']) {+ const checked = [];+ assert.equal(findChrome({+ platform, env: { PATH: '/usr/bin', PROGRAMFILES: String.raw`C:\Program Files` },+ resolveExecutable(candidate) { checked.push(candidate); return null; },+ }), null);+ if (platform !== 'win32') assert.equal(checked.some((candidate) => /edge/i.test(candidate)), false);+ }+});+test('visual-check disables the Chrome sandbox only for root or an explicit environment opt-in', () => {const profileRoot = path.join(tmp, 'chrome-profile');const ordinary = chromeVisualBrowserArgs(profileRoot, { env: {}, getuid: () => 1001 });@@ -3140,7 +3233,8 @@ test('visual-check returns 2 with a truthful skipped receipt when Chrome is unavassert.equal(result.receipt.captures.status, 'skipped');assert.equal(result.receipt.visualReview, 'pending');assert.equal(result.receipt.diagnostics[0]?.code, 'viewer/chrome-unavailable');- assert.ok(result.receipt.diagnostics[0]?.supportedFixes.some((fix) => fix.includes('ARCHIFY_CHROME')));+ assert.match(result.receipt.error, /Microsoft Edge/);+ assert.ok(result.receipt.diagnostics[0]?.supportedFixes.some((fix) => fix.includes('ARCHIFY_CHROME') && fix.includes('Microsoft Edge')));assert.equal(fs.existsSync(sidecarPaths(input).receipt), true);});