Files
oh-my-pi/packages/coding-agent/scripts/generate-docs-index.ts
T
julia 85219821ff feat(oauth): Enabled manual OAuth callbacks via slash command input
- Introduced OAuthManualInputManager and routed callback-server logins to await pasted redirect URLs with a visible tip.
- Extended /login slash command to submit redirect URLs, block overlapping logins, and covered manual callbacks in tests.
- Propagated onManualCodeInput through OAuth provider login helpers with a default authorization prompt.
- Resolved docs index generation paths using path.resolve relative to the script directory.
2026-02-23 06:21:32 +00:00

41 lines
1.2 KiB
TypeScript

#!/usr/bin/env bun
import { Glob } from "bun";
import * as path from "node:path";
const docsDir = path.resolve(import.meta.dir, "../../../docs");
const outputPath = path.resolve(import.meta.dir, "../src/internal-urls/docs-index.generated.ts");
const glob = new Glob("**/*.md");
const entries: string[] = [];
for await (const relativePath of glob.scan(docsDir)) {
entries.push(relativePath.split(path.sep).join("/"));
}
entries.sort();
const docsWithContent = await Promise.all(
entries.map(async (relativePath) => ({
relativePath,
content: await Bun.file(path.join(docsDir, relativePath)).text(),
}))
);
const filenamesLiteral = JSON.stringify(entries);
const mapEntries = docsWithContent
.map(({ relativePath, content }) => `\t${JSON.stringify(relativePath)}: ${JSON.stringify(content)},`)
.join("\n");
const output = [
"// Auto-generated by scripts/generate-docs-index.ts - DO NOT EDIT",
"",
`export const EMBEDDED_DOC_FILENAMES: readonly string[] = ${filenamesLiteral};`,
"",
`export const EMBEDDED_DOCS: Readonly<Record<string, string>> = {`,
`${mapEntries}`,
`};`,
"",
].join("\n");
await Bun.write(outputPath, output);
console.log(`Generated ${path.relative(process.cwd(), outputPath)} (${entries.length} docs)`);