Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified archify.zip
Binary file not shown.
21 changes: 10 additions & 11 deletions archify/assets/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@
} catch (_) {}
})();
</script>
<!-- Async font load: a blackholed network must not block first paint.
The body font stack falls back to system monospace until it lands. -->
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap"
rel="stylesheet" media="print" onload="this.media='all'">
<noscript>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
</noscript>
<style>
/* Offline-first typography: prefer a locally installed JetBrains Mono and
fall through to the system monospace stack. Delivered HTML must not
request third-party font hosts. */
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Rebuild the distributed artifacts after changing the template

Changing the authoritative template without regenerating the checked-in examples and archify.zip leaves this commit unable to pass its repository gates: archify/test/golden.mjs rejects all five stale example renders, while the CI zip-freshness job rebuilds and byte-compares the archive. The archive in this commit also still embeds the removed Google Fonts links, so users installing the documented ZIP distribution do not receive the fix; regenerate the golden examples and then rebuild archify.zip.

Useful? React with 👍 / 👎.

@font-face { font-family: 'JetBrains Mono'; font-weight: 500; src: local('JetBrains Mono Medium'), local('JetBrainsMono-Medium'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; src: local('JetBrains Mono SemiBold'), local('JetBrainsMono-SemiBold'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; src: local('JetBrains Mono Bold'), local('JetBrainsMono-Bold'); }
/* ==========================================================
THEME VARIABLES — switch by toggling [data-theme] on <html>
========================================================== */
Expand Down Expand Up @@ -6104,9 +6103,9 @@ <h3>Card Title 3</h3>
// Prepend a local()-only @font-face block for each weight so that the
// sandboxed image-rendering context used during PNG/JPEG/WebP export
// can find JetBrains Mono if the user has it installed locally, and
// falls through cleanly to the monospace stack otherwise. The usual
// Google-Fonts <link> in the host document is unreachable from the
// serialized SVG, so url()-sourced faces would just hang.
// falls through cleanly to the monospace stack otherwise. Remote font
// hosts are unreachable from the serialized SVG, so url()-sourced
// faces would just hang.
var fontFallback = [400, 500, 600, 700].map(function (w) {
return "@font-face { font-family: 'JetBrains Mono'; font-weight: " + w +
"; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }";
Expand Down
21 changes: 10 additions & 11 deletions archify/examples/dataflow-product-analytics.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions archify/examples/lifecycle-agent-run.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions archify/examples/sequence-cache-miss-request.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions archify/examples/web-app-rendered.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions archify/examples/workflow-agent-tool-call-rendered.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions archify/test/offline-typography.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const skillRoot = path.resolve(__dirname, '..');
const cli = path.join(skillRoot, 'bin/archify.mjs');
const template = fs.readFileSync(path.join(skillRoot, 'assets/template.html'), 'utf8');

const FONT_HOST_PATTERNS = [
/fonts\.googleapis\.com/i,
/fonts\.gstatic\.com/i,
];

function assertNoFontHosts(label, html) {
for (const pattern of FONT_HOST_PATTERNS) {
assert.doesNotMatch(html, pattern, `${label} must not request ${pattern}`);
}
}

test('delivered HTML template does not request Google Fonts', () => {
assertNoFontHosts('archify/assets/template.html', template);
assert.match(template, /@font-face\s*\{[^}]*local\('JetBrains Mono'\)/);
});

test('deliver output does not request Google Fonts', () => {
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-offline-fonts-'));
const input = path.join(skillRoot, 'examples/web-app.architecture.json');
const out = path.join(tmp, 'delivered.html');
const result = spawnSync(process.execPath, [cli, 'deliver', 'architecture', input, out, '--json'], {
cwd: skillRoot,
encoding: 'utf8',
});
assert.equal(result.status, 0, result.stderr || result.stdout);
assertNoFontHosts('deliver output', fs.readFileSync(out, 'utf8'));
});
Binary file modified docs/assets/archify-live-proof.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions docs/assets/archify-live-proof.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"fps": 10,
"frameCount": 54,
"durationSeconds": 5.4,
"bytes": 1542193,
"sha256": "e0fe704e5d230c0478bc5a48b7668815b5790eed496da87ce7a5f8e5b2416c28",
"bytes": 1572525,
"sha256": "483ad28ad27bb3d3357b0c9b83e9732bd5d72b4d87092280b64b4e7630411cbf",
"scenes": [
{
"id": "signal-flow",
"artifact": "docs/gallery/artifacts/agent-tool-call.workflow.html",
"artifactSha256": "e083cfe2d35701472374910e922ebdf8b30fdd3d5547d0e2cabd05094d033c66",
"artifactSha256": "33401041cb805843001b521954dc4e02462aab92f0f6577e962024b6ecaa57c2",
"view": "happy-path",
"eyebrow": "WORKFLOW · SIGNAL FLOW",
"title": "Agent Tool Call",
Expand All @@ -22,7 +22,7 @@
{
"id": "blueprint",
"artifact": "docs/gallery/artifacts/production-deployment.architecture.html",
"artifactSha256": "dbf6d1b3cffa610f2e538cca3b9aa1c65eb45f580154f316d97c157d90916faa",
"artifactSha256": "d981bcd804091b90ec38e5e8e4ed3d14347a1bfd1909cbea0306b29df365734b",
"view": "request-boundary",
"eyebrow": "ARCHITECTURE · BLUEPRINT",
"title": "Production Deployment",
Expand All @@ -31,7 +31,7 @@
{
"id": "classic",
"artifact": "docs/gallery/artifacts/cache-miss.sequence.html",
"artifactSha256": "6bf688c8577049973ace979ac73292eda0cc8f349934c6ba4452720853ced84c",
"artifactSha256": "a925f2ad9219812d65e8eb9b2be157e9d57a4757cb57fe423a65951bb715af4b",
"view": "cache-fallback",
"eyebrow": "SEQUENCE · CLASSIC",
"title": "Cache Miss Request",
Expand Down
Loading