Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/thatdeveloperguy-website / scripts/verify-release.ts |
| Date | Not specified in source |
| Repository | Janady13/thatdeveloperguy-website |
| Revision | 2bea2ebdff0e34494bff597d4fa9c8422a0c3a94 |
| Branch | main |
| Path or archive member | scripts/verify-release.ts |
| Original SHA-256 | 6a633596db64a1ada9c2053f6a9a9eb611bf2a083ae3bb3f883f6d67d58a010d |
| Git blob SHA | bcb44563a7e1792f914cecb392c0f541cc142d92 |
| Reading-copy SHA-256 | 6a633596db64a1ada9c2053f6a9a9eb611bf2a083ae3bb3f883f6d67d58a010d |
Recovered source transcript
Download complete source text ↓37 lines · 2.4 KB
import { createHash } from 'node:crypto';
import { existsSync, readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { pages } from '../src/generated/index.ts';
import { llmsDocuments } from '../src/engines/seo/discovery/build-llms.ts';
import { PRODUCTION_ORIGIN } from '../src/engines/seo/urls/production-origin.ts';
const root = resolve(import.meta.dirname, '..');
const manifestPath = resolve(root, 'dist/deployment/build-manifest.json');
if (!existsSync(manifestPath)) throw new Error('No release manifest. Run npm run build or npm run build:demo first.');
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { kind: string; routes: string[]; files: number; checksums: Record<string, string> };
const failures: string[] = [];
const site = resolve(root, 'dist/site');
for (const [relativePath, expected] of Object.entries(manifest.checksums)) {
const path = resolve(site, relativePath);
if (!existsSync(path)) { failures.push(`missing ${relativePath}`); continue; }
const actual = createHash('sha256').update(readFileSync(path)).digest('hex');
if (actual !== expected) failures.push(`checksum mismatch ${relativePath}`);
}
if (Object.keys(manifest.checksums).length !== manifest.files) failures.push(`manifest file count ${manifest.files} does not match checksum count ${Object.keys(manifest.checksums).length}`);
const discovery = llmsDocuments(pages, manifest.kind === 'demo' ? 'demo' : 'production');
const rootDiscovery = discovery[0]!.content;
for (const document of discovery) {
const relativePath = document.path.replace(/^\/+/, '');
const path = resolve(site, relativePath);
if (!existsSync(path)) { failures.push(`missing discovery document ${document.path}`); continue; }
if (readFileSync(path, 'utf8') !== document.content) failures.push(`stale discovery document ${document.path}`);
if (document.path !== '/llms.txt') {
const url = new URL(document.path, PRODUCTION_ORIGIN).href;
if (!rootDiscovery.includes(`](${url})`)) failures.push(`root discovery index does not join ${document.path}`);
if (!document.content.includes(`](${PRODUCTION_ORIGIN}/llms.txt)`)) failures.push(`${document.path} does not link back to the root discovery index`);
}
}
if (failures.length) throw new Error(`Release verification failed:\n${failures.join('\n')}`);
console.log(`Verified ${manifest.files} ${manifest.kind} release files across ${manifest.routes.length} routes and ${discovery.length} discovery documents.`);