Files
Yaowei Zheng 45bfae6e94 Initialize repository with harness code and assets
Initial import of all source code, config, and README assets: the
packages workspace (cli, core, server, web, docs, landing, skills),
build scripts, tooling config, and CI workflows.

Includes the data-layout revision made on this branch: the local data
root defaults to ~/.penguin/data (PENGUIN_HOME still overrides; the
installer keeps its binaries in ~/.penguin), and every Agent lives
under <project>/agents/<agent>/ — path helpers, the three
agent-enumeration scans, the system prompt, built-in Skills, tests
and docs all follow the new layout.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ihk8iQuo3kv2aPjAYEPuR
2026-07-19 14:06:53 +08:00

26 lines
1.0 KiB
JavaScript

/**
* Post-build step: GitHub Pages serves static files only, so every doc route gets a
* copy of the SPA shell at dist/<slug>/index.html — deep links (…/docs/omni-message)
* then load without relying on a 404 fallback (the site-root 404.html belongs to the
* landing page, which would swallow /docs/* misses). Slugs are derived from the
* content/ filenames (<slug>.<lang>.md), the same source the router reads.
*/
import { copyFileSync, mkdirSync, readdirSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const pkg = join(dirname(fileURLToPath(import.meta.url)), "..");
const dist = join(pkg, "dist");
const slugs = new Set(
readdirSync(join(pkg, "content"))
.map((file) => /^(.+)\.(zh|en)\.md$/.exec(file)?.[1])
.filter((slug) => slug !== undefined),
);
for (const slug of slugs) {
mkdirSync(join(dist, slug), { recursive: true });
copyFileSync(join(dist, "index.html"), join(dist, slug, "index.html"));
}
console.log(`[postbuild] wrote ${slugs.size} route shells under dist/`);