@takazudo/zudo-doc 13.0.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/bin/zudo-doc.mjs +32 -0
  3. package/dist/config.d.ts +10 -27
  4. package/dist/doc-content-header/index.js +1 -1
  5. package/dist/doc-page-renderer/index.js +3 -1
  6. package/dist/doc-sources/types.d.ts +65 -0
  7. package/dist/doc-sources/types.js +0 -0
  8. package/dist/docs-schema/index.d.ts +3 -0
  9. package/dist/docs-schema/index.js +4 -0
  10. package/dist/frontmatter-preview-defaults/index.js +3 -0
  11. package/dist/i18n-defaults/index.js +36 -50
  12. package/dist/plugins/{codex-resources.d.ts → doc-sources.d.ts} +0 -1
  13. package/dist/plugins/doc-sources.js +40 -0
  14. package/dist/plugins/internal/doc-sources/discover.d.ts +33 -0
  15. package/dist/plugins/internal/doc-sources/discover.js +176 -0
  16. package/dist/plugins/internal/doc-sources/glob.d.ts +8 -0
  17. package/dist/plugins/internal/doc-sources/glob.js +80 -0
  18. package/dist/plugins/internal/doc-sources/labels.d.ts +8 -0
  19. package/dist/plugins/internal/doc-sources/labels.js +7 -0
  20. package/dist/plugins/internal/doc-sources/locale-routes.d.ts +6 -0
  21. package/dist/plugins/internal/doc-sources/locale-routes.js +8 -0
  22. package/dist/plugins/internal/doc-sources/model.d.ts +64 -0
  23. package/dist/plugins/internal/doc-sources/model.js +0 -0
  24. package/dist/plugins/internal/doc-sources/normalize.d.ts +20 -0
  25. package/dist/plugins/internal/doc-sources/normalize.js +192 -0
  26. package/dist/plugins/internal/doc-sources/plan.d.ts +28 -0
  27. package/dist/plugins/internal/doc-sources/plan.js +350 -0
  28. package/dist/plugins/internal/doc-sources/presets.d.ts +12 -0
  29. package/dist/plugins/internal/doc-sources/presets.js +182 -0
  30. package/dist/plugins/internal/doc-sources/reconcile.d.ts +20 -0
  31. package/dist/plugins/internal/doc-sources/reconcile.js +182 -0
  32. package/dist/plugins/internal/doc-sources/render/codex-agent.d.ts +2 -0
  33. package/dist/plugins/internal/doc-sources/render/codex-agent.js +45 -0
  34. package/dist/plugins/internal/doc-sources/render/codex-config.d.ts +2 -0
  35. package/dist/plugins/internal/doc-sources/render/codex-config.js +45 -0
  36. package/dist/plugins/internal/doc-sources/render/codex-hooks.d.ts +2 -0
  37. package/dist/plugins/internal/doc-sources/render/codex-hooks.js +66 -0
  38. package/dist/plugins/internal/doc-sources/render/codex-rules.d.ts +2 -0
  39. package/dist/plugins/internal/{codex-resources/rules.js → doc-sources/render/codex-rules.js} +16 -89
  40. package/dist/plugins/internal/{resource-docs-shared → doc-sources/render}/escape-for-mdx.js +1 -1
  41. package/dist/plugins/internal/doc-sources/render/frontmatter.d.ts +9 -0
  42. package/dist/plugins/internal/doc-sources/render/frontmatter.js +38 -0
  43. package/dist/plugins/internal/doc-sources/render/links.d.ts +25 -0
  44. package/dist/plugins/internal/doc-sources/render/links.js +109 -0
  45. package/dist/plugins/internal/{resource-docs-shared → doc-sources/render}/markdown-structure.d.ts +4 -0
  46. package/dist/plugins/internal/{resource-docs-shared → doc-sources/render}/markdown-structure.js +37 -1
  47. package/dist/plugins/internal/doc-sources/render/skill.d.ts +10 -0
  48. package/dist/plugins/internal/doc-sources/render/skill.js +97 -0
  49. package/dist/plugins/internal/doc-sources/render/types.d.ts +7 -0
  50. package/dist/plugins/internal/doc-sources/render/types.js +6 -0
  51. package/dist/plugins/internal/doc-sources/run.d.ts +53 -0
  52. package/dist/plugins/internal/doc-sources/run.js +110 -0
  53. package/dist/plugins/internal/doc-sources/watch.d.ts +33 -0
  54. package/dist/plugins/internal/doc-sources/watch.js +187 -0
  55. package/dist/plugins/routes.js +1 -1
  56. package/dist/preset.d.ts +3 -19
  57. package/dist/preset.js +23 -30
  58. package/dist/route-context-payload/index.js +4 -1
  59. package/dist/settings-defaults.js +1 -2
  60. package/dist/settings.d.ts +4 -10
  61. package/package.json +15 -19
  62. package/dist/plugins/claude-resources.d.ts +0 -4
  63. package/dist/plugins/claude-resources.js +0 -45
  64. package/dist/plugins/codex-resources.js +0 -45
  65. package/dist/plugins/internal/claude-resources/generate.d.ts +0 -31
  66. package/dist/plugins/internal/claude-resources/generate.js +0 -375
  67. package/dist/plugins/internal/claude-resources/index.d.ts +0 -54
  68. package/dist/plugins/internal/claude-resources/index.js +0 -33
  69. package/dist/plugins/internal/codex-resources/agents-md.d.ts +0 -6
  70. package/dist/plugins/internal/codex-resources/agents-md.js +0 -83
  71. package/dist/plugins/internal/codex-resources/agents.d.ts +0 -7
  72. package/dist/plugins/internal/codex-resources/agents.js +0 -117
  73. package/dist/plugins/internal/codex-resources/config.d.ts +0 -6
  74. package/dist/plugins/internal/codex-resources/config.js +0 -124
  75. package/dist/plugins/internal/codex-resources/generate.d.ts +0 -29
  76. package/dist/plugins/internal/codex-resources/generate.js +0 -46
  77. package/dist/plugins/internal/codex-resources/hooks.d.ts +0 -6
  78. package/dist/plugins/internal/codex-resources/hooks.js +0 -187
  79. package/dist/plugins/internal/codex-resources/index.d.ts +0 -33
  80. package/dist/plugins/internal/codex-resources/index.js +0 -33
  81. package/dist/plugins/internal/codex-resources/overview.d.ts +0 -10
  82. package/dist/plugins/internal/codex-resources/overview.js +0 -163
  83. package/dist/plugins/internal/codex-resources/rules.d.ts +0 -6
  84. package/dist/plugins/internal/codex-resources/skills.d.ts +0 -2
  85. package/dist/plugins/internal/codex-resources/skills.js +0 -97
  86. package/dist/plugins/internal/codex-resources/utils.d.ts +0 -14
  87. package/dist/plugins/internal/codex-resources/utils.js +0 -80
  88. package/dist/plugins/internal/resource-docs-shared/fs.d.ts +0 -36
  89. package/dist/plugins/internal/resource-docs-shared/fs.js +0 -101
  90. package/dist/plugins/internal/resource-docs-shared/index.d.ts +0 -9
  91. package/dist/plugins/internal/resource-docs-shared/index.js +0 -69
  92. package/dist/plugins/internal/resource-docs-shared/labels.d.ts +0 -24
  93. package/dist/plugins/internal/resource-docs-shared/labels.js +0 -14
  94. package/dist/plugins/internal/resource-docs-shared/links.d.ts +0 -27
  95. package/dist/plugins/internal/resource-docs-shared/links.js +0 -62
  96. package/dist/plugins/internal/resource-docs-shared/locale-routes.d.ts +0 -16
  97. package/dist/plugins/internal/resource-docs-shared/locale-routes.js +0 -14
  98. package/dist/plugins/internal/resource-docs-shared/mdx.d.ts +0 -28
  99. package/dist/plugins/internal/resource-docs-shared/mdx.js +0 -64
  100. package/dist/plugins/internal/resource-docs-shared/skills.d.ts +0 -37
  101. package/dist/plugins/internal/resource-docs-shared/skills.js +0 -340
  102. package/dist/plugins/internal/resource-docs-shared/walk.d.ts +0 -20
  103. package/dist/plugins/internal/resource-docs-shared/walk.js +0 -41
  104. /package/dist/plugins/internal/{resource-docs-shared → doc-sources/render}/escape-for-mdx.d.ts +0 -0
@@ -1,54 +0,0 @@
1
- import { generateClaudeResourcesDocs, type ClaudeResourcesConfig } from "./generate.js";
2
- import { type ResourceLocaleConfig, type ResourceTranslations } from "../resource-docs-shared/index.js";
3
- /** Options accepted by the plugin's generator runner. */
4
- export interface ClaudeResourcesPluginOptions {
5
- /**
6
- * Path to the project's `.claude/` directory holding `commands/`,
7
- * `skills/`, `agents/`. Resolved against `projectRoot` when relative.
8
- */
9
- claudeDir: string;
10
- /**
11
- * Anchor for resolving the relative `claudeDir`, `docsDir`, and `scanRoot`
12
- * paths, and the default value of `scanRoot`. Defaults to `process.cwd()`.
13
- *
14
- * Note: this does NOT itself decide where `CLAUDE.md` discovery walks — that
15
- * is `scanRoot` (which defaults to this). Set `scanRoot` to widen discovery
16
- * (e.g. a subdirectory doc site scanning its repo root) without moving the
17
- * output base, which stays anchored here.
18
- */
19
- projectRoot?: string;
20
- /**
21
- * Root for `CLAUDE.md` discovery and the base for the generated pages'
22
- * relative-path titles/slugs. Defaults to `projectRoot`. Resolved against
23
- * `projectRoot` when relative (absolute allowed).
24
- *
25
- * Scope: governs `CLAUDE.md` discovery ONLY. Commands, skills, and agents
26
- * always come from `claudeDir` and are unaffected by `scanRoot`. Decoupling
27
- * this from `projectRoot` lets a doc site in a repo subdirectory scan
28
- * repo-wide `CLAUDE.md` files while still writing generated pages into its
29
- * own content collection (see #2558).
30
- */
31
- scanRoot?: string;
32
- /**
33
- * Output directory for generated MDX pages, resolved against
34
- * `projectRoot` when relative. Defaults to `src/content/docs` to
35
- * match the existing Astro integration's behaviour.
36
- */
37
- docsDir?: string;
38
- /** Additional locale content roots, keyed by locale code. */
39
- locales?: Record<string, ResourceLocaleConfig>;
40
- /** Default locale code (the unprefixed docs directory). */
41
- defaultLocale?: string;
42
- /** UI-string translation table used by localized generated indexes. */
43
- translations?: ResourceTranslations;
44
- /** Route prefixes that must not receive non-default-locale indexes. */
45
- defaultLocaleOnlyPrefixes?: string[];
46
- }
47
- /**
48
- * Imperative pre-step runner. Resolves relative paths against
49
- * `projectRoot` (defaults to `process.cwd()`) and invokes the underlying
50
- * generator. Output is byte-equivalent to the Astro integration when
51
- * given the same inputs.
52
- */
53
- export declare function runClaudeResourcesPreStep(options: ClaudeResourcesPluginOptions): ReturnType<typeof generateClaudeResourcesDocs>;
54
- export { generateClaudeResourcesDocs, type ClaudeResourcesConfig, };
@@ -1,33 +0,0 @@
1
- import path from "node:path";
2
- import {
3
- generateClaudeResourcesDocs
4
- } from "./generate.js";
5
- import {
6
- resolveLocaleDirs
7
- } from "../resource-docs-shared/index.js";
8
- function runClaudeResourcesPreStep(options) {
9
- const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
10
- const claudeDir = path.isAbsolute(options.claudeDir) ? options.claudeDir : path.resolve(projectRoot, options.claudeDir);
11
- const scanRoot = options.scanRoot === void 0 ? projectRoot : path.isAbsolute(options.scanRoot) ? options.scanRoot : path.resolve(projectRoot, options.scanRoot);
12
- const docsDirInput = options.docsDir ?? "src/content/docs";
13
- const docsDir = path.isAbsolute(docsDirInput) ? docsDirInput : path.resolve(projectRoot, docsDirInput);
14
- const locales = resolveLocaleDirs({
15
- projectRoot,
16
- docsDir,
17
- locales: options.locales
18
- });
19
- return generateClaudeResourcesDocs({
20
- claudeDir,
21
- projectRoot,
22
- scanRoot,
23
- docsDir,
24
- locales,
25
- defaultLocale: options.defaultLocale,
26
- translations: options.translations,
27
- defaultLocaleOnlyPrefixes: options.defaultLocaleOnlyPrefixes
28
- });
29
- }
30
- export {
31
- generateClaudeResourcesDocs,
32
- runClaudeResourcesPreStep
33
- };
@@ -1,6 +0,0 @@
1
- import type { CodexResourcesConfig } from "./generate.js";
2
- export interface AgentsMdItem {
3
- relPath: string;
4
- slug: string;
5
- }
6
- export declare function generateAgentsMdCategory(config: CodexResourcesConfig): AgentsMdItem[];
@@ -1,83 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import {
4
- formatFrontmatterString,
5
- cleanDir,
6
- downgradeRepoRelativeLinks,
7
- ensureDir,
8
- escapeForMdx,
9
- escapeMarkdownTableCell,
10
- findNamedFiles,
11
- resolveResourceLabel,
12
- writeCategoryIndex
13
- } from "../resource-docs-shared/index.js";
14
- import { assertUniqueSlug, writeGeneratedPage } from "./utils.js";
15
- function generateAgentsMdCategory(config) {
16
- const projectRoot = config.projectRoot ?? config.codexDir;
17
- const scanRoot = config.scanRoot ?? projectRoot;
18
- const outputDir = path.join(config.docsDir, "codex-agents-md");
19
- cleanDir(outputDir);
20
- const excludeDirs = [
21
- path.join(scanRoot, "e2e", "fixtures"),
22
- path.join(projectRoot, "e2e", "fixtures"),
23
- config.docsDir
24
- ];
25
- const files = findNamedFiles(scanRoot, excludeDirs, [
26
- "AGENTS.md",
27
- "AGENTS.override.md"
28
- ]);
29
- if (files.length === 0) return [];
30
- const items = files.map((absPath) => {
31
- const relPath = path.relative(scanRoot, absPath);
32
- const dirPart = path.dirname(relPath);
33
- const baseSlug = dirPart === "." ? "root" : dirPart.split(path.sep).join("--");
34
- const slug = path.basename(absPath) === "AGENTS.override.md" ? `${baseSlug}--override` : baseSlug;
35
- return { absPath, relPath, slug };
36
- });
37
- items.sort((a, b) => {
38
- if (a.slug === "root") return -1;
39
- if (b.slug === "root") return 1;
40
- return a.relPath.localeCompare(b.relPath);
41
- });
42
- ensureDir(outputDir);
43
- const emitted = /* @__PURE__ */ new Map();
44
- items.forEach((item, index) => {
45
- assertUniqueSlug("AGENTS.md", item.slug, item.relPath, emitted);
46
- const content = fs.readFileSync(item.absPath, "utf8");
47
- writeGeneratedPage({
48
- outputPath: path.join(outputDir, `${item.slug}.mdx`),
49
- title: `/${item.relPath}`,
50
- description: `Codex instructions at /${item.relPath}`,
51
- sidebarPosition: index + 1,
52
- sidebarLabel: item.relPath,
53
- body: `**Path:** ${escapeMarkdownTableCell(item.relPath)}
54
-
55
- ${escapeForMdx(
56
- downgradeRepoRelativeLinks(content.trim())
57
- )}`
58
- });
59
- });
60
- writeCategoryIndex(
61
- outputDir,
62
- resolveResourceLabel({
63
- translations: config.translations,
64
- locale: config.defaultLocale ?? "en",
65
- defaultLocale: config.defaultLocale,
66
- key: "resource.codexAgentsMd.label",
67
- fallbackLiteral: "AGENTS.md"
68
- }),
69
- 905,
70
- resolveResourceLabel({
71
- translations: config.translations,
72
- locale: config.defaultLocale ?? "en",
73
- defaultLocale: config.defaultLocale,
74
- key: "resource.codexAgentsMd.description",
75
- fallbackLiteral: "Project instructions for Codex"
76
- }),
77
- formatFrontmatterString
78
- );
79
- return items.map(({ relPath, slug }) => ({ relPath, slug }));
80
- }
81
- export {
82
- generateAgentsMdCategory
83
- };
@@ -1,7 +0,0 @@
1
- import type { CodexResourcesConfig } from "./generate.js";
2
- export interface AgentItem {
3
- filename: string;
4
- slug: string;
5
- name: string;
6
- }
7
- export declare function generateAgentsCategory(config: CodexResourcesConfig): AgentItem[];
@@ -1,117 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { parse } from "smol-toml";
4
- import {
5
- formatFrontmatterString,
6
- cleanDir,
7
- ensureDir,
8
- escapeForMdx,
9
- escapeMarkdownTableCell,
10
- renderCodeFence,
11
- resolveResourceLabel,
12
- writeCategoryIndex
13
- } from "../resource-docs-shared/index.js";
14
- import {
15
- assertUniqueSlug,
16
- filenameSlug,
17
- isRecord,
18
- warn,
19
- writeGeneratedPage
20
- } from "./utils.js";
21
- function optionalString(record, field, filePath) {
22
- const value = record[field];
23
- if (value === void 0) return void 0;
24
- if (typeof value === "string") return value;
25
- warn(filePath, `${field} must be a string; omitting it`);
26
- return void 0;
27
- }
28
- function generateAgentsCategory(config) {
29
- const agentsDir = path.join(config.codexDir, "agents");
30
- const outputDir = path.join(config.docsDir, "codex-agents");
31
- cleanDir(outputDir);
32
- if (!fs.existsSync(agentsDir)) return [];
33
- let files;
34
- try {
35
- files = fs.readdirSync(agentsDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".toml")).map((entry) => entry.name).sort();
36
- } catch (error) {
37
- warn(agentsDir, `unable to read agents directory: ${String(error)}`);
38
- return [];
39
- }
40
- if (files.length === 0) return [];
41
- ensureDir(outputDir);
42
- const items = [];
43
- const emitted = /* @__PURE__ */ new Map();
44
- for (const filename of files) {
45
- const filePath = path.join(agentsDir, filename);
46
- let source;
47
- let parsed;
48
- try {
49
- source = fs.readFileSync(filePath, "utf8");
50
- parsed = parse(source);
51
- } catch (error) {
52
- warn(filePath, `unable to parse TOML, skipping file: ${String(error)}`);
53
- continue;
54
- }
55
- if (!isRecord(parsed)) {
56
- warn(filePath, "parsed TOML root was not an object, skipping file");
57
- continue;
58
- }
59
- const slug = filenameSlug(filename.replace(/\.toml$/, ""));
60
- assertUniqueSlug("agent", slug, filename, emitted);
61
- const name = optionalString(parsed, "name", filePath) ?? slug;
62
- const description = optionalString(parsed, "description", filePath) ?? "";
63
- const model = optionalString(parsed, "model", filePath);
64
- const reasoning = optionalString(parsed, "model_reasoning_effort", filePath);
65
- const sandbox = optionalString(parsed, "sandbox_mode", filePath);
66
- const instructions = optionalString(parsed, "developer_instructions", filePath);
67
- const badges = [
68
- model ? `**Model:** ${escapeMarkdownTableCell(model)}` : "",
69
- reasoning ? `**Reasoning effort:** ${escapeMarkdownTableCell(reasoning)}` : "",
70
- sandbox ? `**Sandbox:** ${escapeMarkdownTableCell(sandbox)}` : ""
71
- ].filter(Boolean);
72
- const sections = [badges.join("\n")];
73
- if (instructions !== void 0) {
74
- sections.push(
75
- `## Developer instructions
76
-
77
- ${escapeForMdx(instructions.trim())}`
78
- );
79
- }
80
- sections.push(`## Source
81
-
82
- ${renderCodeFence(source, "toml")}`);
83
- writeGeneratedPage({
84
- outputPath: path.join(outputDir, `${slug}.mdx`),
85
- title: name,
86
- description,
87
- sidebarLabel: name,
88
- body: sections.filter(Boolean).join("\n\n")
89
- });
90
- items.push({ filename, slug, name });
91
- }
92
- if (items.length > 0) {
93
- writeCategoryIndex(
94
- outputDir,
95
- resolveResourceLabel({
96
- translations: config.translations,
97
- locale: config.defaultLocale ?? "en",
98
- defaultLocale: config.defaultLocale,
99
- key: "resource.codexAgents.label",
100
- fallbackLiteral: "Agents"
101
- }),
102
- 907,
103
- resolveResourceLabel({
104
- translations: config.translations,
105
- locale: config.defaultLocale ?? "en",
106
- defaultLocale: config.defaultLocale,
107
- key: "resource.codexAgents.description",
108
- fallbackLiteral: "Custom subagents"
109
- }),
110
- formatFrontmatterString
111
- );
112
- }
113
- return items;
114
- }
115
- export {
116
- generateAgentsCategory
117
- };
@@ -1,6 +0,0 @@
1
- import type { CodexResourcesConfig } from "./generate.js";
2
- export interface ConfigItem {
3
- filename: string;
4
- slug: string;
5
- }
6
- export declare function generateConfigCategory(config: CodexResourcesConfig): ConfigItem[];
@@ -1,124 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { parse, TomlDate } from "smol-toml";
4
- import {
5
- formatFrontmatterString,
6
- cleanDir,
7
- ensureDir,
8
- escapeMarkdownTableCell,
9
- renderCodeFence,
10
- resolveResourceLabel,
11
- writeCategoryIndex
12
- } from "../resource-docs-shared/index.js";
13
- import {
14
- assertUniqueSlug,
15
- filenameSlug,
16
- isRecord,
17
- renderTableRow,
18
- warn,
19
- writeGeneratedPage
20
- } from "./utils.js";
21
- function configFiles(codexDir) {
22
- try {
23
- return fs.readdirSync(codexDir, { withFileTypes: true }).filter(
24
- (entry) => entry.isFile() && (entry.name === "config.toml" || entry.name === "config.toml.example" || entry.name.endsWith(".config.toml"))
25
- ).map((entry) => entry.name).sort((a, b) => {
26
- if (a === "config.toml") return -1;
27
- if (b === "config.toml") return 1;
28
- return a.localeCompare(b);
29
- });
30
- } catch (error) {
31
- warn(codexDir, `unable to read config files: ${String(error)}`);
32
- return [];
33
- }
34
- }
35
- function renderValue(value) {
36
- if (typeof value === "string") return value;
37
- if (typeof value === "number" || typeof value === "boolean") {
38
- return String(value);
39
- }
40
- if (Array.isArray(value)) return JSON.stringify(value);
41
- if (value instanceof TomlDate) return value.toISOString();
42
- return String(value);
43
- }
44
- function generateConfigCategory(config) {
45
- const outputDir = path.join(config.docsDir, "codex-config");
46
- cleanDir(outputDir);
47
- if (!fs.existsSync(config.codexDir)) return [];
48
- const files = configFiles(config.codexDir);
49
- if (files.length === 0) return [];
50
- ensureDir(outputDir);
51
- const items = [];
52
- const emitted = /* @__PURE__ */ new Map();
53
- for (const filename of files) {
54
- const filePath = path.join(config.codexDir, filename);
55
- let source;
56
- let parsed;
57
- try {
58
- source = fs.readFileSync(filePath, "utf8");
59
- parsed = parse(source);
60
- } catch (error) {
61
- warn(filePath, `unable to parse TOML, skipping file: ${String(error)}`);
62
- continue;
63
- }
64
- if (!isRecord(parsed)) {
65
- warn(filePath, "parsed TOML root was not an object, skipping file");
66
- continue;
67
- }
68
- const slug = filenameSlug(filename);
69
- assertUniqueSlug("config", slug, filename, emitted);
70
- const settings = Object.entries(parsed).filter(([, value]) => !isRecord(value) || value instanceof TomlDate).map(([key, value]) => renderTableRow([key, renderValue(value)]));
71
- const sections = source.match(/^\s*\[\[?[^\]]+\]\]?/gm) ?? [];
72
- const sectionList = sections.length === 0 ? "\u2014" : sections.map(
73
- (section) => `- ${escapeMarkdownTableCell(section.trim())}`
74
- ).join("\n");
75
- const body = [
76
- "## Settings",
77
- "",
78
- "| Key | Value |",
79
- "| --- | --- |",
80
- ...settings.length > 0 ? settings : [renderTableRow([void 0, void 0])],
81
- "",
82
- "## Sections",
83
- "",
84
- sectionList,
85
- "",
86
- "## Source",
87
- "",
88
- renderCodeFence(source, "toml")
89
- ].join("\n");
90
- writeGeneratedPage({
91
- outputPath: path.join(outputDir, `${slug}.mdx`),
92
- title: filename,
93
- description: `Codex configuration from ${filename}`,
94
- sidebarLabel: filename,
95
- body
96
- });
97
- items.push({ filename, slug });
98
- }
99
- if (items.length > 0) {
100
- writeCategoryIndex(
101
- outputDir,
102
- resolveResourceLabel({
103
- translations: config.translations,
104
- locale: config.defaultLocale ?? "en",
105
- defaultLocale: config.defaultLocale,
106
- key: "resource.codexConfig.label",
107
- fallbackLiteral: "Config"
108
- }),
109
- 906,
110
- resolveResourceLabel({
111
- translations: config.translations,
112
- locale: config.defaultLocale ?? "en",
113
- defaultLocale: config.defaultLocale,
114
- key: "resource.codexConfig.description",
115
- fallbackLiteral: "config.toml and profiles"
116
- }),
117
- formatFrontmatterString
118
- );
119
- }
120
- return items;
121
- }
122
- export {
123
- generateConfigCategory
124
- };
@@ -1,29 +0,0 @@
1
- import { type ResourceLocaleConfig, type ResourceTranslations } from "../resource-docs-shared/index.js";
2
- export interface CodexResourcesConfig {
3
- codexDir: string;
4
- /** The doc site's own root and the default value of `scanRoot`. */
5
- projectRoot?: string;
6
- /**
7
- * Repo-wide discovery root for both the AGENTS.md walk and the repo-level
8
- * `.agents/skills/` root. Also serves as the relative-path base for the
9
- * generated AGENTS.md titles and slugs. Defaults to `projectRoot`.
10
- */
11
- scanRoot?: string;
12
- docsDir: string;
13
- /** Additional locale content roots, resolved by the runner when possible. */
14
- locales?: Record<string, ResourceLocaleConfig>;
15
- /** Default locale code (the unprefixed docs directory). */
16
- defaultLocale?: string;
17
- /** UI-string translation table used by localized generated indexes. */
18
- translations?: ResourceTranslations;
19
- /** Route prefixes that must not receive non-default-locale indexes. */
20
- defaultLocaleOnlyPrefixes?: string[];
21
- }
22
- export declare function generateCodexResourcesDocs(config: CodexResourcesConfig): {
23
- agentsMd: number;
24
- config: number;
25
- agents: number;
26
- hooks: number;
27
- rules: number;
28
- skills: number;
29
- };
@@ -1,46 +0,0 @@
1
- import path from "node:path";
2
- import { generateAgentsMdCategory } from "./agents-md.js";
3
- import { generateAgentsCategory } from "./agents.js";
4
- import { generateConfigCategory } from "./config.js";
5
- import { generateHooksCategory } from "./hooks.js";
6
- import { generateOverview } from "./overview.js";
7
- import { generateRulesCategory } from "./rules.js";
8
- import { generateSkillsCategoryDocs } from "./skills.js";
9
- import {
10
- resolveLocaleDirs
11
- } from "../resource-docs-shared/index.js";
12
- function generateCodexResourcesDocs(config) {
13
- const normalizedConfig = config.locales === void 0 ? config : {
14
- ...config,
15
- locales: resolveLocaleDirs({
16
- projectRoot: path.resolve(config.projectRoot ?? config.codexDir),
17
- docsDir: config.docsDir,
18
- locales: config.locales
19
- })
20
- };
21
- const agentsMd = generateAgentsMdCategory(normalizedConfig);
22
- const configItems = generateConfigCategory(normalizedConfig);
23
- const agents = generateAgentsCategory(normalizedConfig);
24
- const hooks = generateHooksCategory(normalizedConfig);
25
- const rules = generateRulesCategory(normalizedConfig);
26
- const skills = generateSkillsCategoryDocs(normalizedConfig);
27
- generateOverview(normalizedConfig, {
28
- agentsMd: agentsMd.length > 0,
29
- config: configItems.length > 0,
30
- agents: agents.length > 0,
31
- hooks: hooks.length > 0,
32
- rules: rules.length > 0,
33
- skills: skills.length > 0
34
- });
35
- return {
36
- agentsMd: agentsMd.length,
37
- config: configItems.length,
38
- agents: agents.length,
39
- hooks: hooks.length,
40
- rules: rules.length,
41
- skills: skills.length
42
- };
43
- }
44
- export {
45
- generateCodexResourcesDocs
46
- };
@@ -1,6 +0,0 @@
1
- import type { CodexResourcesConfig } from "./generate.js";
2
- export interface HookItem {
3
- filename: string;
4
- slug: string;
5
- }
6
- export declare function generateHooksCategory(config: CodexResourcesConfig): HookItem[];