@alan-ai-hq/agent-manager-linux-arm64 0.1.199 → 0.1.201

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 (96) hide show
  1. package/alan-agent.cjs +8928 -5241
  2. package/alan-holder.cjs +5364 -3401
  3. package/alan-lease.cjs +808 -200
  4. package/builtin-skills/agent-desktop/SKILL.md +94 -0
  5. package/builtin-skills/alan-artifact/SKILL.md +128 -0
  6. package/builtin-skills/alan-artifact/examples/interactive-diagram.md +50 -0
  7. package/builtin-skills/alan-artifact/examples/prototype.md +53 -0
  8. package/builtin-skills/alan-artifact/examples/test-report.md +55 -0
  9. package/builtin-skills/alan-artifact/references/design.md +39 -0
  10. package/builtin-skills/alan-artifact/references/diagrams.md +20 -0
  11. package/builtin-skills/alan-deck/SKILL.md +189 -0
  12. package/builtin-skills/alan-diagrams/SKILL.md +105 -0
  13. package/builtin-skills/alan-diagrams/references/diagram-catalogue.md +847 -0
  14. package/builtin-skills/alan-docs/SKILL.md +143 -0
  15. package/builtin-skills/alan-docs/references/administration/members-and-teams.md +48 -0
  16. package/builtin-skills/alan-docs/references/administration/org-dashboard.md +19 -0
  17. package/builtin-skills/alan-docs/references/administration/organisation-settings.md +41 -0
  18. package/builtin-skills/alan-docs/references/agents-and-sessions/code-context.md +60 -0
  19. package/builtin-skills/alan-docs/references/agents-and-sessions/coding-agents-and-models.md +78 -0
  20. package/builtin-skills/alan-docs/references/agents-and-sessions/session-lifecycle.md +62 -0
  21. package/builtin-skills/alan-docs/references/agents-and-sessions/start-a-session.md +110 -0
  22. package/builtin-skills/alan-docs/references/automations/automation-runs.md +69 -0
  23. package/builtin-skills/alan-docs/references/automations/create-an-automation.md +143 -0
  24. package/builtin-skills/alan-docs/references/automations/overview.md +77 -0
  25. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-images.md +64 -0
  26. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-sessions-and-execution.md +89 -0
  27. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-setup.md +128 -0
  28. package/builtin-skills/alan-docs/references/cloud-and-local/codex-cli-connector.md +92 -0
  29. package/builtin-skills/alan-docs/references/cloud-and-local/local-execution.md +213 -0
  30. package/builtin-skills/alan-docs/references/cloud-and-local/runtime-recovery.md +60 -0
  31. package/builtin-skills/alan-docs/references/cloud-and-local/sandboxes.md +74 -0
  32. package/builtin-skills/alan-docs/references/cloud-and-local/troubleshooting-and-faq.md +102 -0
  33. package/builtin-skills/alan-docs/references/get-started/connect-azure-devops.md +89 -0
  34. package/builtin-skills/alan-docs/references/get-started/connect-bitbucket.md +86 -0
  35. package/builtin-skills/alan-docs/references/get-started/connect-github.md +114 -0
  36. package/builtin-skills/alan-docs/references/get-started/join-a-team.md +114 -0
  37. package/builtin-skills/alan-docs/references/get-started/product-map.md +96 -0
  38. package/builtin-skills/alan-docs/references/get-started/quickstart.md +158 -0
  39. package/builtin-skills/alan-docs/references/get-started/set-up-your-team.md +200 -0
  40. package/builtin-skills/alan-docs/references/get-started/sign-in.md +104 -0
  41. package/builtin-skills/alan-docs/references/get-started/welcome.md +39 -0
  42. package/builtin-skills/alan-docs/references/integrations/connect-microsoft-teams.md +116 -0
  43. package/builtin-skills/alan-docs/references/integrations/connect-slack.md +164 -0
  44. package/builtin-skills/alan-docs/references/integrations/import-from-linear.md +172 -0
  45. package/builtin-skills/alan-docs/references/plans-and-billing/plans-and-limits.md +115 -0
  46. package/builtin-skills/alan-docs/references/plans-and-billing/usage-and-credits.md +47 -0
  47. package/builtin-skills/alan-docs/references/reference/documents-and-artifacts.md +52 -0
  48. package/builtin-skills/alan-docs/references/reference/faq.md +89 -0
  49. package/builtin-skills/alan-docs/references/reference/feature-catalog.md +89 -0
  50. package/builtin-skills/alan-docs/references/reference/glossary.md +96 -0
  51. package/builtin-skills/alan-docs/references/reference/links-and-ids.md +80 -0
  52. package/builtin-skills/alan-docs/references/reference/roles-and-permissions.md +64 -0
  53. package/builtin-skills/alan-docs/references/reference/statuses.md +86 -0
  54. package/builtin-skills/alan-docs/references/reviews-testing-deploys/deployments.md +28 -0
  55. package/builtin-skills/alan-docs/references/reviews-testing-deploys/pull-requests.md +85 -0
  56. package/builtin-skills/alan-docs/references/reviews-testing-deploys/review-work.md +55 -0
  57. package/builtin-skills/alan-docs/references/reviews-testing-deploys/testing-evidence.md +52 -0
  58. package/builtin-skills/alan-docs/references/skills/plugins-and-mcp.md +24 -0
  59. package/builtin-skills/alan-docs/references/skills/skills.md +103 -0
  60. package/builtin-skills/alan-docs/references/tasks/complete-a-task.md +79 -0
  61. package/builtin-skills/alan-docs/references/tasks/create-a-task.md +67 -0
  62. package/builtin-skills/alan-docs/references/tasks/subtasks-and-status.md +55 -0
  63. package/builtin-skills/alan-docs/references/tasks/task-artifacts.md +56 -0
  64. package/builtin-skills/alan-docs/references/tasks/task-detail.md +65 -0
  65. package/builtin-skills/alan-docs/references/teams-and-planning/cycles.md +93 -0
  66. package/builtin-skills/alan-docs/references/teams-and-planning/documents.md +66 -0
  67. package/builtin-skills/alan-docs/references/teams-and-planning/epics.md +95 -0
  68. package/builtin-skills/alan-docs/references/teams-and-planning/whiteboard.md +52 -0
  69. package/builtin-skills/alan-docs/references/troubleshooting/agent-blocked.md +38 -0
  70. package/builtin-skills/alan-docs/references/troubleshooting/common-problems.md +118 -0
  71. package/builtin-skills/alan-docs/references/troubleshooting/github-access.md +41 -0
  72. package/builtin-skills/alan-docs/references/troubleshooting/missing-artifact.md +47 -0
  73. package/builtin-skills/alan-docs/references/troubleshooting/report-an-issue.md +74 -0
  74. package/builtin-skills/alan-docs/references/troubleshooting/runtime-unavailable.md +49 -0
  75. package/builtin-skills/alan-docs/scripts/generate-references.mjs +363 -0
  76. package/builtin-skills/alan-environment-setup/SKILL.md +368 -0
  77. package/builtin-skills/alan-environment-setup/references/android.md +118 -0
  78. package/builtin-skills/alan-environment-setup/references/troubleshooting.md +38 -0
  79. package/builtin-skills/alan-skill-authoring/SKILL.md +83 -0
  80. package/builtin-skills/alan-tasks/SKILL.md +195 -0
  81. package/builtin-skills/alan-test-android/SKILL.md +224 -0
  82. package/builtin-skills/alan-test-android/scripts/android-up.sh +227 -0
  83. package/builtin-skills/alan-test-android/scripts/install-launch.sh +38 -0
  84. package/builtin-skills/alan-test-android/scripts/record.sh +64 -0
  85. package/builtin-skills/alan-test-android/scripts/ui.py +367 -0
  86. package/builtin-skills/alan-test-desktop/SKILL.md +107 -0
  87. package/builtin-skills/alan-test-desktop/references/linux-recording.md +31 -0
  88. package/builtin-skills/alan-test-feature/SKILL.md +243 -0
  89. package/builtin-skills/alan-test-mobile/SKILL.md +65 -0
  90. package/builtin-skills/alan-test-web/SKILL.md +113 -0
  91. package/builtin-skills/alan-walkthrough/SKILL.md +152 -0
  92. package/builtin-skills/alan-walkthrough/scripts/mark-changes.js +419 -0
  93. package/builtin-skills/alan-walkthrough/scripts/publish-capture.mjs +288 -0
  94. package/builtin-skills/alan-workflows/SKILL.md +235 -0
  95. package/builtin-skills/manifest.json +19 -0
  96. package/package.json +3 -2
@@ -0,0 +1,363 @@
1
+ #!/usr/bin/env node
2
+ // Generates the alan-docs Skill's reference pages from Alan's own docs source.
3
+ //
4
+ // The product documentation lives in this repository under
5
+ // `apps/docs/content/docs/**.mdx` (a Fumadocs/Next site). This script converts
6
+ // every page outside the changelog into a plain-Markdown reference file under
7
+ // `references/`, rewriting internal `/docs/...` links to the local files, image
8
+ // and video sources to their public URLs, and Fumadocs components to Markdown
9
+ // equivalents. Each generated page opens with the page's public docs.tryalan.ai
10
+ // URL so an agent can give a person the canonical link.
11
+ //
12
+ // Run from anywhere: `node scripts/generate-references.mjs`.
13
+ // Override the docs source root with `ALAN_DOCS_SOURCE=/abs/path`.
14
+
15
+ import { existsSync } from "node:fs";
16
+ import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
17
+ import { dirname, join, posix, resolve } from "node:path";
18
+ import { fileURLToPath } from "node:url";
19
+
20
+ const SCRIPT_DIRECTORY = dirname(fileURLToPath(import.meta.url));
21
+ const PACKAGE_ROOT = resolve(SCRIPT_DIRECTORY, "..");
22
+ const OUTPUT_ROOT = join(PACKAGE_ROOT, "references");
23
+ const DOCS_ORIGIN = "https://docs.tryalan.ai";
24
+ const CHANGELOG_MARKER = "(changelog)";
25
+
26
+ // Sections in the order the docs sidebar presents them, then the standalone
27
+ // reference and troubleshooting roots.
28
+ const SECTION_ORDER = [
29
+ "get-started",
30
+ "integrations",
31
+ "teams-and-planning",
32
+ "tasks",
33
+ "agents-and-sessions",
34
+ "skills",
35
+ "cloud-and-local",
36
+ "automations",
37
+ "reviews-testing-deploys",
38
+ "plans-and-billing",
39
+ "administration",
40
+ "troubleshooting",
41
+ "reference",
42
+ ];
43
+
44
+ function findDocsSource() {
45
+ const override = process.env.ALAN_DOCS_SOURCE;
46
+ if (override) return resolve(override);
47
+ let current = SCRIPT_DIRECTORY;
48
+ for (let depth = 0; depth < 12; depth += 1) {
49
+ const candidate = join(current, "apps", "docs", "content", "docs");
50
+ if (existsSync(candidate)) return candidate;
51
+ const parent = dirname(current);
52
+ if (parent === current) break;
53
+ current = parent;
54
+ }
55
+ throw new Error(
56
+ "Could not locate apps/docs/content/docs. Set ALAN_DOCS_SOURCE to the docs content root."
57
+ );
58
+ }
59
+
60
+ async function walkMdx(root) {
61
+ const found = [];
62
+ async function visit(directory) {
63
+ for (const entry of await readdir(directory, { withFileTypes: true })) {
64
+ const absolute = join(directory, entry.name);
65
+ if (entry.isDirectory()) {
66
+ if (entry.name === CHANGELOG_MARKER) continue;
67
+ await visit(absolute);
68
+ continue;
69
+ }
70
+ if (entry.name.endsWith(".mdx")) found.push(absolute);
71
+ }
72
+ }
73
+ await visit(root);
74
+ return found;
75
+ }
76
+
77
+ /**
78
+ * `(guides)/get-started/welcome.mdx` -> `{ group: "get-started", slug: "welcome", docsSlug: "get-started/welcome" }`.
79
+ * Route groups such as `(guides)` are stripped the way Fumadocs strips them from the public URL.
80
+ */
81
+ function describePath(absolute, sourceRoot) {
82
+ const relative = absolute.slice(sourceRoot.length + 1).replace(/\\/g, "/");
83
+ const withoutExtension = relative.replace(/\.mdx$/, "");
84
+ const segments = withoutExtension.split("/").filter((segment) => !/^\(.*\)$/.test(segment));
85
+ const [group, ...rest] = segments;
86
+ return { group, slug: rest.join("/"), docsSlug: segments.join("/") };
87
+ }
88
+
89
+ function parseFrontmatter(markdown) {
90
+ const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(markdown);
91
+ if (!match) return { attributes: {}, body: markdown };
92
+ const attributes = {};
93
+ for (const line of match[1].split(/\r?\n/)) {
94
+ const field = /^([A-Za-z0-9_-]+):\s*(.*)$/.exec(line);
95
+ if (!field) continue;
96
+ let value = field[2].trim();
97
+ if (value.startsWith('"') && value.endsWith('"')) {
98
+ value = value.slice(1, -1).replace(/\\"/g, '"');
99
+ } else if (value.startsWith("'") && value.endsWith("'")) {
100
+ value = value.slice(1, -1);
101
+ }
102
+ attributes[field[1]] = value;
103
+ }
104
+ return { attributes, body: markdown.slice(match[0].length) };
105
+ }
106
+
107
+ function dedent(text) {
108
+ const lines = text.replace(/\t/g, " ").split("\n");
109
+ while (lines.length && lines[0].trim() === "") lines.shift();
110
+ while (lines.length && lines[lines.length - 1].trim() === "") lines.pop();
111
+ const indents = lines
112
+ .filter((line) => line.trim() !== "")
113
+ .map((line) => /^ */.exec(line)[0].length);
114
+ const min = indents.length ? Math.min(...indents) : 0;
115
+ return lines.map((line) => line.slice(min)).join("\n");
116
+ }
117
+
118
+ function attribute(tag, name) {
119
+ const match = new RegExp(`${name}\\s*=\\s*"([^"]*)"`).exec(tag);
120
+ return match ? match[1] : null;
121
+ }
122
+
123
+ /** Absolute public URL for an asset path like `/images/screenshots/x.webp`. */
124
+ function assetUrl(source) {
125
+ if (!source) return null;
126
+ if (/^https?:\/\//.test(source)) return source;
127
+ return `${DOCS_ORIGIN}${source.startsWith("/") ? "" : "/"}${source}`;
128
+ }
129
+
130
+ function quoteBlock(label, body) {
131
+ const inner = dedent(body);
132
+ if (!inner) return "";
133
+ const prefix = label ? `**${label}:** ` : "";
134
+ const lines = inner.split("\n");
135
+ return lines
136
+ .map((line, index) => (index === 0 ? `> ${prefix}${line}` : line ? `> ${line}` : ">"))
137
+ .join("\n");
138
+ }
139
+
140
+ function transform(body) {
141
+ const fences = [];
142
+ let text = body.replace(/```[\s\S]*?```/g, (match) => {
143
+ fences.push(match);
144
+ return `\uE000FENCE${fences.length - 1}\uE000`;
145
+ });
146
+
147
+ // Diagrams keep their Mermaid source verbatim. The fence is parked with the
148
+ // other code blocks so later passes never strip `<br/>`/`<small>` from a label.
149
+ text = text.replace(
150
+ /<PeleDiagram\b[\s\S]*?chart=\{`([\s\S]*?)`\}[\s\S]*?\/>/g,
151
+ (_match, chart) => {
152
+ fences.push(`\`\`\`mermaid\n${dedent(chart)}\n\`\`\``);
153
+ return `\n\n\uE000FENCE${fences.length - 1}\uE000\n\n`;
154
+ }
155
+ );
156
+
157
+ // Videos become a link to the recording, images become Markdown images.
158
+ text = text.replace(/<Video\b[^>]*\/>/g, (tag) => {
159
+ const url = assetUrl(attribute(tag, "src"));
160
+ return url ? `\n\n_Video: ${url}_\n\n` : "\n\n_Video_\n\n";
161
+ });
162
+ text = text.replace(/<img\b[^>]*\/?>/g, (tag) => {
163
+ const alt = attribute(tag, "alt") ?? "";
164
+ const url = assetUrl(attribute(tag, "src"));
165
+ return url ? `![${alt}](${url})` : alt;
166
+ });
167
+
168
+ // Fumadocs layout wrappers.
169
+ text = text.replace(/<Frame(\s[^>]*)?>\s*([\s\S]*?)\s*<\/Frame>/g, (_match, attrs, inner) => {
170
+ const caption = attribute(attrs ?? "", "caption");
171
+ const content = dedent(inner);
172
+ return caption ? `\n\n${content}\n\n*${caption}*\n\n` : `\n\n${content}\n\n`;
173
+ });
174
+
175
+ const renderCard = (attrs, inner) => {
176
+ const title = attribute(attrs, "title") ?? "";
177
+ const href = attribute(attrs, "href");
178
+ const content = dedent(inner)
179
+ .replace(/\s*\n\s*/g, " ")
180
+ .trim();
181
+ const heading = href ? `[${title}](${href})` : `**${title}**`;
182
+ return content ? `- ${heading} — ${content}` : `- ${heading}`;
183
+ };
184
+ text = text.replace(/<CardGroup[^>]*>\s*([\s\S]*?)\s*<\/CardGroup>/g, (_match, inner) => {
185
+ const cards = [...inner.matchAll(/<Card\b([^>]*)>\s*([\s\S]*?)\s*<\/Card>/g)].map((card) =>
186
+ renderCard(card[1] ?? "", card[2] ?? "")
187
+ );
188
+ return `\n\n${cards.join("\n")}\n\n`;
189
+ });
190
+ text = text.replace(
191
+ /<Card\b([^>]*)>\s*([\s\S]*?)\s*<\/Card>/g,
192
+ (_match, attrs, inner) => `\n\n${renderCard(attrs ?? "", inner)}\n\n`
193
+ );
194
+
195
+ text = text.replace(/<Steps>\s*([\s\S]*?)\s*<\/Steps>/g, (_match, inner) => {
196
+ let step = 0;
197
+ const numbered = inner.replace(
198
+ /\s*<Step\s+title="([^"]*)">\s*([\s\S]*?)\s*<\/Step>/g,
199
+ (_stepMatch, title, stepBody) => {
200
+ step += 1;
201
+ return `\n\n**${step}. ${title}**\n\n${dedent(stepBody)}\n`;
202
+ }
203
+ );
204
+ return `\n\n${dedent(numbered)}\n\n`;
205
+ });
206
+
207
+ text = text.replace(/<Tabs[^>]*>\s*([\s\S]*?)\s*<\/Tabs>/g, (_match, inner) => {
208
+ const sections = inner.replace(
209
+ /<Tab\s+title="([^"]*)">\s*([\s\S]*?)\s*<\/Tab>/g,
210
+ (_tabMatch, title, tabBody) => `**${title}**\n\n${dedent(tabBody)}\n\n`
211
+ );
212
+ return `\n\n${dedent(sections)}\n\n`;
213
+ });
214
+
215
+ text = text.replace(/<AccordionGroup[^>]*>\s*([\s\S]*?)\s*<\/AccordionGroup>/g, "$1");
216
+ text = text.replace(
217
+ /<Accordion\s+title="([^"]*)">\s*([\s\S]*?)\s*<\/Accordion>/g,
218
+ (_match, title, inner) => `\n\n**${title}**\n\n${dedent(inner)}\n\n`
219
+ );
220
+
221
+ text = text.replace(/<(Info|Tip|Warning)>\s*([\s\S]*?)\s*<\/\1>/g, (_match, kind, inner) => {
222
+ const label = kind === "Tip" ? "Tip" : kind === "Warning" ? "Warning" : "Note";
223
+ return `\n\n${quoteBlock(label, inner)}\n\n`;
224
+ });
225
+
226
+ // Inline HTML that is not a layout component.
227
+ text = text.replace(
228
+ /<a\b[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/g,
229
+ (_match, href, label) => `[${label.trim()}](${href})`
230
+ );
231
+ text = text.replace(/<br\s*\/?>/g, " \n");
232
+
233
+ // Any remaining component tag is dropped; its inner text is kept.
234
+ text = text.replace(/<\/?[A-Za-z][A-Za-z0-9]*(\s[^>]*)?\/?>/g, "");
235
+
236
+ text = text.replace(/\uE000FENCE(\d+)\uE000/g, (_match, index) => fences[Number(index)]);
237
+ return collapseBlankLines(text).trim();
238
+ }
239
+
240
+ function collapseBlankLines(text) {
241
+ return text.replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n");
242
+ }
243
+
244
+ function rewriteLinks(markdown, context) {
245
+ return markdown.replace(/\]\(([^)\s]+)\)/g, (match, target) => {
246
+ if (/^(https?:|mailto:|tel:)/.test(target) || target.startsWith("#")) return match;
247
+ const hashIndex = target.indexOf("#");
248
+ const hash = hashIndex >= 0 ? target.slice(hashIndex) : "";
249
+ const path = hashIndex >= 0 ? target.slice(0, hashIndex) : target;
250
+ if (path === "" || path === "/") {
251
+ return `](${DOCS_ORIGIN}/${hash})`;
252
+ }
253
+ const docsMatch = /^\/docs\/(.+)$/.exec(path);
254
+ if (docsMatch) {
255
+ const slug = docsMatch[1].replace(/\/$/, "");
256
+ const targetOutput = context.bundled.get(slug);
257
+ if (targetOutput) {
258
+ const relative = posix.relative(posix.dirname(context.outputPath), targetOutput);
259
+ return `](${relative}${hash})`;
260
+ }
261
+ return `](${DOCS_ORIGIN}/docs/${slug}${hash})`;
262
+ }
263
+ return `](${DOCS_ORIGIN}${path}${hash})`;
264
+ });
265
+ }
266
+
267
+ async function readMetaOrder(groupDirectory) {
268
+ const metaPath = join(groupDirectory, "meta.json");
269
+ if (!existsSync(metaPath)) return [];
270
+ try {
271
+ const meta = JSON.parse(await readFile(metaPath, "utf8"));
272
+ return Array.isArray(meta.pages) ? meta.pages : [];
273
+ } catch {
274
+ return [];
275
+ }
276
+ }
277
+
278
+ function renderPage({ attributes, body, url, context }) {
279
+ const title = attributes.title ?? "";
280
+ const transformed = rewriteLinks(transform(body), context);
281
+ const parts = [];
282
+ parts.push(`> Source: [${url}](${url})`);
283
+ parts.push("");
284
+ if (title) {
285
+ parts.push(`# ${title}`);
286
+ parts.push("");
287
+ }
288
+ parts.push(transformed);
289
+ parts.push("");
290
+ return `${parts
291
+ .join("\n")
292
+ .replace(/\n{3,}/g, "\n\n")
293
+ .trim()}\n`;
294
+ }
295
+
296
+ async function main() {
297
+ const sourceRoot = findDocsSource();
298
+ const files = await walkMdx(sourceRoot);
299
+
300
+ const pages = [];
301
+ for (const absolute of files) {
302
+ const { group, slug, docsSlug } = describePath(absolute, sourceRoot);
303
+ const raw = await readFile(absolute, "utf8");
304
+ const { attributes, body } = parseFrontmatter(raw);
305
+ pages.push({
306
+ absolute,
307
+ group,
308
+ slug,
309
+ docsSlug,
310
+ outputPath: posix.join(group, `${slug}.md`),
311
+ url: `${DOCS_ORIGIN}/docs/${docsSlug}`,
312
+ attributes,
313
+ body,
314
+ });
315
+ }
316
+
317
+ const bundled = new Map(pages.map((page) => [page.docsSlug, page.outputPath]));
318
+ const printIndex = process.argv.includes("--print-index");
319
+
320
+ await mkdir(OUTPUT_ROOT, { recursive: true });
321
+ for (const page of pages) {
322
+ const context = { bundled, outputPath: page.outputPath };
323
+ const rendered = renderPage({ ...page, context });
324
+ const destination = join(OUTPUT_ROOT, page.outputPath);
325
+ await mkdir(dirname(destination), { recursive: true });
326
+ await writeFile(destination, rendered, "utf8");
327
+ }
328
+
329
+ if (printIndex) {
330
+ const groups = new Map();
331
+ for (const page of pages) {
332
+ if (!groups.has(page.group)) groups.set(page.group, []);
333
+ groups.get(page.group).push(page);
334
+ }
335
+ const orderedGroups = [...groups.keys()].sort(
336
+ (a, b) => SECTION_ORDER.indexOf(a) - SECTION_ORDER.indexOf(b)
337
+ );
338
+ for (const group of orderedGroups) {
339
+ const groupDirectory = dirname(pages.find((page) => page.group === group).absolute);
340
+ const order = await readMetaOrder(groupDirectory);
341
+ const rank = (page) => {
342
+ const position = order.indexOf(page.slug.split("/")[0]);
343
+ return position >= 0 ? position : Number.MAX_SAFE_INTEGER;
344
+ };
345
+ const sorted = [...groups.get(group)].sort(
346
+ (a, b) => rank(a) - rank(b) || a.slug.localeCompare(b.slug)
347
+ );
348
+ process.stdout.write(`\n### ${group}\n`);
349
+ for (const page of sorted) {
350
+ process.stdout.write(
351
+ `- [${page.attributes.title}](${page.outputPath}) — ${page.attributes.description ?? ""}\n`
352
+ );
353
+ }
354
+ }
355
+ }
356
+
357
+ process.stdout.write(`\nGenerated ${pages.length} reference pages under ${OUTPUT_ROOT}\n`);
358
+ }
359
+
360
+ main().catch((error) => {
361
+ process.stderr.write(`${error instanceof Error ? error.stack : String(error)}\n`);
362
+ process.exitCode = 1;
363
+ });