doccupine 0.0.145 → 0.0.147

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 (54) hide show
  1. package/README.md +11 -2
  2. package/dist/cli.d.ts +7 -0
  3. package/dist/cli.js +41 -0
  4. package/dist/generator/generated-page-publisher.d.ts +21 -0
  5. package/dist/generator/generated-page-publisher.js +124 -0
  6. package/dist/generator/generated-route-manager.d.ts +3 -0
  7. package/dist/generator/generated-route-manager.js +21 -8
  8. package/dist/generator/mdx-pass-builder.d.ts +31 -0
  9. package/dist/generator/mdx-pass-builder.js +45 -0
  10. package/dist/generator/mdx-reconciliation-coordinator.d.ts +83 -0
  11. package/dist/generator/mdx-reconciliation-coordinator.js +471 -0
  12. package/dist/generator/openapi-refresh-coordinator.d.ts +42 -0
  13. package/dist/generator/openapi-refresh-coordinator.js +211 -0
  14. package/dist/generator/page-renderer.js +18 -13
  15. package/dist/generator/section-index-generator.d.ts +10 -0
  16. package/dist/generator/section-index-generator.js +68 -0
  17. package/dist/generator/secure-source-fs.js +5 -4
  18. package/dist/generator/site-artifacts.js +2 -2
  19. package/dist/generator/watch-coordinator.d.ts +8 -0
  20. package/dist/generator/watch-coordinator.js +131 -53
  21. package/dist/index.js +8 -2
  22. package/dist/lib/layout.js +18 -10
  23. package/dist/lib/openapi-rendering.d.ts +17 -0
  24. package/dist/lib/openapi-rendering.js +193 -0
  25. package/dist/lib/openapi.d.ts +1 -7
  26. package/dist/lib/openapi.js +2 -192
  27. package/dist/lib/output-safety.js +10 -3
  28. package/dist/lib/structures.js +4 -0
  29. package/dist/lib/utils.d.ts +14 -0
  30. package/dist/lib/utils.js +30 -8
  31. package/dist/mdx-to-nextjs-generator.d.ts +7 -65
  32. package/dist/mdx-to-nextjs-generator.js +94 -783
  33. package/dist/templates/components/Chat.d.ts +1 -1
  34. package/dist/templates/components/Chat.js +20 -691
  35. package/dist/templates/components/ChatStyles.d.ts +1 -0
  36. package/dist/templates/components/ChatStyles.js +695 -0
  37. package/dist/templates/components/layout/ApiPlayground.d.ts +1 -1
  38. package/dist/templates/components/layout/ApiPlayground.js +14 -148
  39. package/dist/templates/mdx/platform/analytics.mdx.d.ts +1 -1
  40. package/dist/templates/mdx/platform/analytics.mdx.js +13 -0
  41. package/dist/templates/mdx/platform/fonts-settings.mdx.d.ts +1 -1
  42. package/dist/templates/mdx/platform/fonts-settings.mdx.js +16 -0
  43. package/dist/templates/mdx/platform/publishing.mdx.d.ts +1 -1
  44. package/dist/templates/mdx/platform/publishing.mdx.js +16 -1
  45. package/dist/templates/mdx/platform/self-updating-docs.mdx.d.ts +1 -1
  46. package/dist/templates/mdx/platform/self-updating-docs.mdx.js +17 -5
  47. package/dist/templates/package.js +3 -2
  48. package/dist/templates/prettierignore.d.ts +1 -1
  49. package/dist/templates/prettierignore.js +11 -0
  50. package/dist/templates/utils/apiPlayground.d.ts +1 -0
  51. package/dist/templates/utils/apiPlayground.js +149 -0
  52. package/dist/templates/utils/orderNavItems.d.ts +1 -1
  53. package/dist/templates/utils/orderNavItems.js +1 -1
  54. package/package.json +1 -1
@@ -6,6 +6,8 @@ import fs from "node:fs/promises";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import chalk from "chalk";
8
8
  import { bundle, dereference, parse } from "@readme/openapi-parser";
9
+ import { buildApiIndexBody, buildEndpointBody, firstLine, } from "./openapi-rendering.js";
10
+ export { buildEndpointDoc } from "./openapi-rendering.js";
9
11
  /* eslint-disable @typescript-eslint/no-explicit-any */
10
12
  /** Default base route segment for the generated API reference section. */
11
13
  export const DEFAULT_API_BASE_SLUG = "api-reference";
@@ -244,11 +246,6 @@ function resolveSecurity(requirements, schemes) {
244
246
  }
245
247
  return [...byName.values()];
246
248
  }
247
- function firstLine(text) {
248
- if (typeof text !== "string")
249
- return "";
250
- return text.split("\n")[0]?.trim() ?? "";
251
- }
252
249
  function isWithinDirectory(root, candidate) {
253
250
  const relative = path.relative(root, candidate);
254
251
  return (relative === "" ||
@@ -726,190 +723,3 @@ export class OpenApiRegistry {
726
723
  }
727
724
  }
728
725
  }
729
- /**
730
- * Builds the API-reference landing page as safe MDX. Endpoint metadata is
731
- * emitted through JSX string expressions, so arbitrary OpenAPI summaries,
732
- * paths, tags, and descriptions remain text rather than executable MDX.
733
- */
734
- function buildApiIndexBody(operations) {
735
- const bySpec = new Map();
736
- for (const operation of operations) {
737
- const tag = operation.tags[0] ?? "Endpoints";
738
- let byTag = bySpec.get(operation.specName);
739
- if (!byTag) {
740
- byTag = new Map();
741
- bySpec.set(operation.specName, byTag);
742
- }
743
- const endpoints = byTag.get(tag) ?? [];
744
- endpoints.push(operation);
745
- byTag.set(tag, endpoints);
746
- }
747
- const lines = [
748
- "# API Reference",
749
- "",
750
- `Browse all ${operations.length} API endpoint${operations.length === 1 ? "" : "s"}. Select an endpoint to view its parameters, responses, and live request playground.`,
751
- ];
752
- const multipleSpecs = bySpec.size > 1;
753
- for (const [specName, byTag] of bySpec) {
754
- if (multipleSpecs) {
755
- lines.push("", `<h2>{${JSON.stringify(specName)}}</h2>`);
756
- }
757
- for (const [tag, endpoints] of byTag) {
758
- const heading = multipleSpecs ? "h3" : "h2";
759
- lines.push("", `<${heading}>{${JSON.stringify(tag)}}</${heading}>`, "", "<Columns cols={2}>");
760
- for (const endpoint of endpoints) {
761
- const method = endpoint.method.toUpperCase();
762
- const title = endpoint.summary ?? `${method} ${endpoint.path}`;
763
- const description = firstLine(endpoint.description) ||
764
- `View the ${method} ${endpoint.path} endpoint.`;
765
- const badgeColor = endpoint.method === "get"
766
- ? "info"
767
- : endpoint.method === "post"
768
- ? "success"
769
- : endpoint.method === "put" || endpoint.method === "patch"
770
- ? "warning"
771
- : endpoint.method === "delete"
772
- ? "error"
773
- : "gray";
774
- lines.push("", `<Card title={${JSON.stringify(title)}} href={${JSON.stringify(`/${endpoint.slug}`)}}>`, ` <Badge color=${JSON.stringify(badgeColor)} size="sm">{${JSON.stringify(method)}}</Badge>`, ` <code>{${JSON.stringify(endpoint.path)}}</code>`, ` <p>{${JSON.stringify(description)}}</p>`, "</Card>");
775
- }
776
- lines.push("", "</Columns>");
777
- }
778
- }
779
- return lines.join("\n");
780
- }
781
- /** Minimal markdown body for an endpoint, used by the llms.txt aggregation. */
782
- function buildEndpointBody(title, methodUpper, pathKey, opRaw) {
783
- const lines = [`# ${title}`, "", `\`${methodUpper} ${pathKey}\``];
784
- if (opRaw.description && typeof opRaw.description === "string") {
785
- lines.push("", opRaw.description);
786
- }
787
- else if (opRaw.summary && opRaw.summary !== title) {
788
- lines.push("", opRaw.summary);
789
- }
790
- return lines.join("\n");
791
- }
792
- /** Human-readable type label for a (dereferenced) JSON schema. */
793
- function docSchemaType(schema) {
794
- if (!schema || typeof schema !== "object")
795
- return "any";
796
- if (Array.isArray(schema.type))
797
- return schema.type.join(" | ");
798
- if (schema.type === "array")
799
- return `array of ${docSchemaType(schema.items)}`;
800
- if (typeof schema.type === "string") {
801
- return schema.format ? `${schema.type} (${schema.format})` : schema.type;
802
- }
803
- if (schema.properties)
804
- return "object";
805
- if (Array.isArray(schema.enum))
806
- return "enum";
807
- return "any";
808
- }
809
- /** Collapses a description to a single inline line safe inside JSX children. */
810
- function inlineText(text) {
811
- if (typeof text !== "string")
812
- return "";
813
- return text.replace(/\s+/g, " ").trim();
814
- }
815
- /** Emits untrusted prose as a JSX string expression, never as executable MDX. */
816
- function jsxText(text) {
817
- return `{${JSON.stringify(text)}}`;
818
- }
819
- function jsonCode(value) {
820
- const serialized = JSON.stringify(value, null, 2) ?? "null";
821
- return `<Code language="json" code=${jsxText(serialized)} />`;
822
- }
823
- /** The object schema whose `properties` we can document (unwraps arrays). */
824
- function objectShape(schema) {
825
- if (!schema || typeof schema !== "object")
826
- return null;
827
- if (schema.type === "array")
828
- return objectShape(schema.items);
829
- if (schema.properties && typeof schema.properties === "object")
830
- return schema;
831
- return null;
832
- }
833
- /**
834
- * Renders one parameter/property as a `<Field>`, recursing into nested object
835
- * properties up to `MAX_FIELD_DEPTH` levels. Nested fields are emitted flush so
836
- * MDX does not treat the indentation as a code block.
837
- */
838
- const MAX_FIELD_DEPTH = 2;
839
- function renderDocField(name, schema, required, description, depth) {
840
- const type = docSchemaType(schema);
841
- const desc = inlineText(description ?? schema?.description);
842
- const lines = [
843
- `<Field value={${JSON.stringify(name)}} type={${JSON.stringify(type)}}${required ? " required" : ""}>`,
844
- ];
845
- if (desc)
846
- lines.push(jsxText(desc));
847
- const shape = depth < MAX_FIELD_DEPTH ? objectShape(schema) : null;
848
- if (shape) {
849
- const req = Array.isArray(shape.required) ? shape.required : [];
850
- for (const [propName, propSchema] of Object.entries(shape.properties)) {
851
- lines.push(renderDocField(propName, propSchema, req.includes(propName), undefined, depth + 1));
852
- }
853
- }
854
- lines.push(`</Field>`);
855
- return lines.join("\n");
856
- }
857
- const PARAM_LOCATION_TITLES = {
858
- path: "Path parameters",
859
- query: "Query parameters",
860
- header: "Header parameters",
861
- cookie: "Cookie parameters",
862
- };
863
- /**
864
- * Builds the MDX body for a generated endpoint page: the operation description,
865
- * followed by `<Field>` documentation for the parameters and request body, and
866
- * a schema/example code block per response. Spec-derived strings are emitted
867
- * only through serialized JSX expressions. Rendered above the playground.
868
- */
869
- export function buildEndpointDoc(op) {
870
- const out = [];
871
- if (op.description)
872
- out.push(jsxText(op.description));
873
- else if (op.summary)
874
- out.push(jsxText(op.summary));
875
- for (const location of ["path", "query", "header", "cookie"]) {
876
- const params = op.parameters.filter((p) => p.in === location);
877
- if (params.length === 0)
878
- continue;
879
- out.push(`## ${PARAM_LOCATION_TITLES[location]}`);
880
- for (const p of params) {
881
- out.push(renderDocField(p.name, p.schema, p.required, p.description, 0));
882
- }
883
- }
884
- const body = op.requestBody?.content.find((m) => m.contentType.includes("json")) ??
885
- op.requestBody?.content[0];
886
- if (body?.schema !== undefined) {
887
- out.push("## Request body");
888
- const shape = objectShape(body.schema);
889
- if (shape) {
890
- const req = Array.isArray(shape.required) ? shape.required : [];
891
- for (const [propName, propSchema] of Object.entries(shape.properties)) {
892
- out.push(renderDocField(propName, propSchema, req.includes(propName), undefined, 0));
893
- }
894
- }
895
- else {
896
- out.push(jsonCode(body.schema));
897
- }
898
- }
899
- if (op.responses.length > 0) {
900
- out.push("## Responses");
901
- for (const response of op.responses) {
902
- out.push(`<h3>{${JSON.stringify(response.status)}}</h3>`);
903
- if (response.description) {
904
- out.push(jsxText(inlineText(response.description)));
905
- }
906
- const media = response.content.find((m) => m.contentType.includes("json")) ??
907
- response.content[0];
908
- const payload = media?.example ?? media?.schema;
909
- if (payload !== undefined) {
910
- out.push(jsonCode(payload));
911
- }
912
- }
913
- }
914
- return out.join("\n\n");
915
- }
@@ -3,6 +3,7 @@ import { open } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  const MARKER_FILE = ".doccupine-generated.json";
5
5
  const SAFE_UNOWNED_FILES = new Set([".DS_Store", ".gitkeep", ".env"]);
6
+ const SAFE_UNOWNED_CACHE_DIRECTORIES = new Set([".next", "node_modules"]);
6
7
  const GENERATED_SUBTREES = new Set([
7
8
  "app",
8
9
  "components",
@@ -60,8 +61,13 @@ const LEGACY_FILE_FINGERPRINTS = [
60
61
  ],
61
62
  },
62
63
  ];
63
- function isSafeUnownedEntry(name) {
64
- return SAFE_UNOWNED_FILES.has(name) || name.startsWith(".env.");
64
+ async function isSafeUnownedEntry(outputDir, name) {
65
+ if (SAFE_UNOWNED_FILES.has(name) || name.startsWith(".env."))
66
+ return true;
67
+ if (!SAFE_UNOWNED_CACHE_DIRECTORIES.has(name))
68
+ return false;
69
+ const stat = await lstatIfPresent(path.join(outputDir, name));
70
+ return stat?.isDirectory() === true;
65
71
  }
66
72
  export function isPathInside(parent, candidate) {
67
73
  const relative = path.relative(path.resolve(parent), path.resolve(candidate));
@@ -409,7 +415,8 @@ export async function claimOutputDirectory(outputDir) {
409
415
  return;
410
416
  }
411
417
  const entries = await fs.readdir(realOutputDir);
412
- const canClaim = entries.every(isSafeUnownedEntry) ||
418
+ const safeUnownedEntries = await Promise.all(entries.map((name) => isSafeUnownedEntry(realOutputDir, name)));
419
+ const canClaim = safeUnownedEntries.every(Boolean) ||
413
420
  (await looksLikeLegacyGeneratedApp(realOutputDir));
414
421
  if (!canClaim) {
415
422
  throw new Error(`Refusing to overwrite non-empty directory ${outputDir}. Choose an empty outputDir or a Doccupine-generated directory.`);
@@ -14,6 +14,7 @@ import { searchRoutesTemplate } from "../templates/app/api/search/route.js";
14
14
  import { notFoundTemplate } from "../templates/app/not-found.js";
15
15
  import { themeTemplate } from "../templates/app/theme.js";
16
16
  import { chatTemplate } from "../templates/components/Chat.js";
17
+ import { chatStylesTemplate } from "../templates/components/ChatStyles.js";
17
18
  import { lockBodyScrollTemplate } from "../templates/components/LockBodyScroll.js";
18
19
  import { docsTemplate } from "../templates/components/Docs.js";
19
20
  import { docsSideBarTemplate } from "../templates/components/DocsSideBar.js";
@@ -93,6 +94,7 @@ import { configTemplate } from "../templates/utils/config.js";
93
94
  import { playgroundAllowlistTemplate } from "../templates/utils/playgroundAllowlist.js";
94
95
  import { ssrfGuardTemplate } from "../templates/utils/ssrfGuard.js";
95
96
  import { apiSnippetsTemplate } from "../templates/utils/apiSnippets.js";
97
+ import { apiPlaygroundUtilsTemplate } from "../templates/utils/apiPlayground.js";
96
98
  import { requestBodyTemplate } from "../templates/utils/requestBody.js";
97
99
  import { playgroundRoutesTemplate } from "../templates/app/api/playground/route.js";
98
100
  import { playgroundAllowlistStubTemplate } from "../templates/services/openapi/playgroundAllowlistStub.js";
@@ -207,8 +209,10 @@ export const appStructure = {
207
209
  "utils/playgroundAllowlist.ts": playgroundAllowlistTemplate,
208
210
  "utils/ssrfGuard.ts": ssrfGuardTemplate,
209
211
  "utils/apiSnippets.ts": apiSnippetsTemplate,
212
+ "utils/apiPlayground.ts": apiPlaygroundUtilsTemplate,
210
213
  "utils/requestBody.ts": requestBodyTemplate,
211
214
  "components/Chat.tsx": chatTemplate,
215
+ "components/ChatStyles.ts": chatStylesTemplate,
212
216
  "components/LockBodyScroll.ts": lockBodyScrollTemplate,
213
217
  "components/Docs.tsx": docsTemplate,
214
218
  "components/DocsSideBar.tsx": docsSideBarTemplate,
@@ -19,7 +19,21 @@ export declare function writeFileAtomic(filePath: string, content: string | Uint
19
19
  * the CLI.
20
20
  */
21
21
  export declare function resolvePackageManager(override?: string): ResolvedPackageManager;
22
+ /**
23
+ * Finds the first free port at or above `startPort`. Scanning stops at the
24
+ * last valid TCP port rather than recursing past it: `listen(65536)` is a
25
+ * RangeError, and surfacing that instead of an explanation tells the user
26
+ * nothing about what to do next.
27
+ */
22
28
  export declare function findAvailablePort(startPort: number): Promise<number>;
29
+ /**
30
+ * Whether a path names an MDX source document. Case-insensitive so a file
31
+ * saved as "Guide.MDX" is treated the same everywhere - source discovery, the
32
+ * watcher's filter, the restart fingerprint, and the llms body reader all
33
+ * route through here, and a split between them makes a file invisible to
34
+ * generation while still triggering work.
35
+ */
36
+ export declare function isMdxPath(filePath: string): boolean;
23
37
  export declare function generateSlug(filePath: string): string;
24
38
  export declare function getFullSlug(pageSlug: string, sectionSlug: string): string;
25
39
  export declare function escapeTemplateContent(content: string): string;
package/dist/lib/utils.js CHANGED
@@ -2,6 +2,7 @@ import fs from "fs-extra";
2
2
  import { randomBytes } from "node:crypto";
3
3
  import { constants } from "node:fs";
4
4
  import { open, unlink } from "node:fs/promises";
5
+ import net from "node:net";
5
6
  import path from "path";
6
7
  import { execSync } from "child_process";
7
8
  import chalk from "chalk";
@@ -149,24 +150,45 @@ export function resolvePackageManager(override) {
149
150
  return { name: "pnpm", bin };
150
151
  return { name: "npm", bin: "npm" };
151
152
  }
152
- export async function findAvailablePort(startPort) {
153
- const net = await import("net");
153
+ const MAX_PORT = 65535;
154
+ function isPortAvailable(port) {
154
155
  return new Promise((resolve) => {
155
156
  const server = net.createServer();
156
- server.listen(startPort, () => {
157
- server.close(() => resolve(startPort));
158
- });
159
- server.on("error", () => {
160
- resolve(findAvailablePort(startPort + 1));
157
+ server.listen(port, () => {
158
+ server.close(() => resolve(true));
161
159
  });
160
+ server.on("error", () => resolve(false));
162
161
  });
163
162
  }
163
+ /**
164
+ * Finds the first free port at or above `startPort`. Scanning stops at the
165
+ * last valid TCP port rather than recursing past it: `listen(65536)` is a
166
+ * RangeError, and surfacing that instead of an explanation tells the user
167
+ * nothing about what to do next.
168
+ */
169
+ export async function findAvailablePort(startPort) {
170
+ for (let port = startPort; port <= MAX_PORT; port += 1) {
171
+ if (await isPortAvailable(port))
172
+ return port;
173
+ }
174
+ throw new Error(`No free port available from ${startPort} to ${MAX_PORT}. Free a port or set a lower "port" in doccupine.json.`);
175
+ }
176
+ /**
177
+ * Whether a path names an MDX source document. Case-insensitive so a file
178
+ * saved as "Guide.MDX" is treated the same everywhere - source discovery, the
179
+ * watcher's filter, the restart fingerprint, and the llms body reader all
180
+ * route through here, and a split between them makes a file invisible to
181
+ * generation while still triggering work.
182
+ */
183
+ export function isMdxPath(filePath) {
184
+ return filePath.toLowerCase().endsWith(".mdx");
185
+ }
164
186
  export function generateSlug(filePath) {
165
187
  if (filePath === "index.mdx" || filePath === "./index.mdx") {
166
188
  return "";
167
189
  }
168
190
  const normalized = filePath
169
- .replace(/\.mdx$/, "")
191
+ .replace(/\.mdx$/i, "")
170
192
  .replace(/\\/g, "/")
171
193
  .replace(/[^a-zA-Z0-9\/\-_]/g, "-")
172
194
  .toLowerCase();
@@ -1,8 +1,6 @@
1
1
  import type { MDXFile, PageMeta, SectionConfig, FontConfig, AnalyticsConfig, NormalizedOpenApiSpec } from "./lib/types.js";
2
2
  import type { OperationDescriptor } from "./lib/openapi-types.js";
3
- interface GeneratedPageCommit {
4
- rollback(): Promise<void>;
5
- }
3
+ import { type GeneratedPageCommit } from "./generator/generated-page-publisher.js";
6
4
  export declare class MDXToNextJSGenerator {
7
5
  private watchDir;
8
6
  private outputDir;
@@ -23,16 +21,14 @@ export declare class MDXToNextJSGenerator {
23
21
  private sourceFs;
24
22
  private appScaffolder;
25
23
  private apiReferenceGenerator;
24
+ private generatedPagePublisher;
26
25
  private generatedRouteManager;
26
+ private mdxReconciliationCoordinator;
27
+ private openApiRefreshCoordinator;
28
+ private sectionIndexGenerator;
27
29
  private projectConfigRepository;
28
30
  private publicAssetManager;
29
31
  private watchCoordinator;
30
- private retainExistingMdxOutput;
31
- private mdxSnapshotInitialized;
32
- private successfulMdxPages;
33
- private successfulMdxContent;
34
- private successfulMdxSourcesBySlug;
35
- private collisionBlockedMdxSources;
36
32
  constructor(watchDir: string, outputDir: string, openApiSpecs?: NormalizedOpenApiSpec[], rootDir?: string);
37
33
  private outputPath;
38
34
  private readMdxSourceFile;
@@ -70,41 +66,10 @@ export declare class MDXToNextJSGenerator {
70
66
  handlePublicFileChange(filePath: string): Promise<void>;
71
67
  handlePublicFileDelete(filePath: string): Promise<void>;
72
68
  startWatching(): Promise<void>;
73
- private parseMDXFile;
74
- private captureMdxPass;
75
69
  private buildRealPagesMeta;
76
70
  private buildAllPagesMeta;
77
- private mergeAllPagesMeta;
78
- private successfulPagesInSourceOrder;
79
- private recordSuccessfulMdxPage;
80
- private removeSuccessfulMdxPage;
81
- private captureSuccessfulMdxState;
82
- private restoreSuccessfulMdxState;
83
- private rollbackPageCommits;
84
- private rollbackFailedMdxCommit;
85
- private rollbackCommittedMdxChange;
86
- private dropMissingMdxSnapshots;
87
- private commitMdxSnapshot;
88
- private refreshMdxDerivedOutput;
89
71
  private readAggregateMdxSource;
90
- private homepageSource;
91
72
  private removeOwnedRoute;
92
- private removeStaleMdxRoutes;
93
- /**
94
- * Writes the generated page(s) for a single MDX file: the doc page and, for a
95
- * section-index file, the section landing page. Deliberately does NOT run the
96
- * site-wide aggregations (pages index, layout, sitemap, llms, section
97
- * redirects) - the caller batches those so a bulk build runs them once at the
98
- * end instead of once per file (which is what made large builds O(n²)).
99
- */
100
- private writePageForFile;
101
- private retryMdxPages;
102
- /**
103
- * Regenerates every file that depends on the full set of pages (pages index,
104
- * root/site layout, sitemap, llms files, section redirects). Parses all MDX
105
- * exactly once and threads the result through each generator, so one refresh
106
- * is a single scan rather than one scan per generator.
107
- */
108
73
  private refreshSiteAggregates;
109
74
  handleFileChange(action: string, filePath: string): Promise<void>;
110
75
  handleFileDelete(filePath: string): Promise<void>;
@@ -113,20 +78,7 @@ export declare class MDXToNextJSGenerator {
113
78
  generateRootLayout(): Promise<string>;
114
79
  generateSiteLayout(pages?: PageMeta[]): Promise<string>;
115
80
  generateSectionIndexPages(pages?: PageMeta[], declaredSlugs?: Set<string>): Promise<void>;
116
- /**
117
- * Removes section index redirects written earlier in this session whose
118
- * section has since disappeared (e.g. the API Reference section after the
119
- * `openapi` config is removed mid-watch). Slugs now occupied by real pages
120
- * are preserved. Fresh processes start clean anyway - init() wipes app/ -
121
- * so in-session tracking is enough.
122
- */
123
- private cleanupStaleSectionIndexPages;
124
- /** Best-effort removal of now-empty directories up to (not incl.) stopDir. */
125
- private removeEmptyDirsUpTo;
126
- private generatedFileSegments;
127
- private readGeneratedFile;
128
- private restoreGeneratedFile;
129
- private commitRenderedPage;
81
+ private writeSectionIndexRedirect;
130
82
  generatePageFromMDX(mdxFile: MDXFile, options?: {
131
83
  apiOperation?: OperationDescriptor;
132
84
  }): Promise<GeneratedPageCommit>;
@@ -150,15 +102,6 @@ export declare class MDXToNextJSGenerator {
150
102
  * so specs added mid-session are watched without a restart.
151
103
  */
152
104
  private syncOpenApiSpecWatcher;
153
- private openApiSourceState;
154
- private loadStableOpenApiRegistry;
155
- private applyStableOpenApiRefresh;
156
- /**
157
- * Reparses the spec(s) and rewrites everything derived from them: the
158
- * endpoint pages and allowlist, the sections (the "API Reference" section
159
- * appears and disappears with the registry), and the site aggregates.
160
- */
161
- private applyOpenApiRefresh;
162
105
  /** Reparses the spec(s) and regenerates the API reference on a watch event. */
163
106
  handleOpenApiChange(): Promise<void>;
164
107
  /**
@@ -170,7 +113,7 @@ export declare class MDXToNextJSGenerator {
170
113
  * half-written editor save) keeps the current configuration.
171
114
  */
172
115
  handleDoccupineConfigChange(): Promise<void>;
173
- updatePagesIndex(): Promise<void>;
116
+ updatePagesIndex(pages?: readonly PageMeta[]): Promise<void>;
174
117
  updateSectionIndex(sectionSlug: string, frontmatter: Record<string, any>, mdxContent: string, sourcePath?: string): Promise<GeneratedPageCommit>;
175
118
  updateRootLayout(pages?: PageMeta[]): Promise<void>;
176
119
  loadSiteUrl(): Promise<string | null>;
@@ -179,4 +122,3 @@ export declare class MDXToNextJSGenerator {
179
122
  updateLlmsFiles(pages?: PageMeta[]): Promise<void>;
180
123
  stop(): Promise<void>;
181
124
  }
182
- export {};