perf(coding-agent): optimized documentation indexing via compressed blob

- Replaced raw TypeScript documentation map with a lazily-inflated gzip blob.
- Reduced bundled binary/npm package size by approximately 0.9MB.
- Encapsulated index logic into `docs-index.ts` to separate header metadata from content.
- Added `postpack` and robust `try/finally` patterns in build scripts to ensure clean artifacts.
- Implemented disk-based fallback during development to maintain existing developer experience.
This commit is contained in:
can1357
2026-06-18 18:57:13 +02:00
parent f5ebab2b83
commit 831b664a4c
10 changed files with 212 additions and 51 deletions
@@ -38,8 +38,11 @@ async function runCommand(
}
async function main(): Promise<void> {
await runCommand(["bun", "--cwd=../stats", "scripts/generate-client-bundle.ts", "--generate"]);
// Generate inside the try so the finally always restores the empty checked-in
// placeholders (stats client archive, docs index) even on failure.
try {
await runCommand(["bun", "--cwd=../stats", "scripts/generate-client-bundle.ts", "--generate"]);
await runCommand(["bun", "scripts/generate-docs-index.ts", "--generate"]);
await runCommand(["bun", "--cwd=../natives", "run", "embed:native"]);
try {
const buildEnv = shouldAdhocSignDarwinBinary() ? { ...Bun.env, BUN_NO_CODESIGN_MACHO_BINARY: "1" } : Bun.env;
@@ -98,6 +101,7 @@ async function main(): Promise<void> {
}
} finally {
await runCommand(["bun", "--cwd=../stats", "scripts/generate-client-bundle.ts", "--reset"]);
await runCommand(["bun", "scripts/generate-docs-index.ts", "--reset"]);
}
}