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

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 +8885 -5214
  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 +320 -0
  77. package/builtin-skills/alan-environment-setup/references/android.md +118 -0
  78. package/builtin-skills/alan-environment-setup/references/troubleshooting.md +33 -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
+ });
@@ -0,0 +1,320 @@
1
+ ---
2
+ name: alan-environment-setup
3
+ version: 7.1.0
4
+ description: Bootstrap, maintain or verify a repository's development environment (system packages, OS libraries, toolchains and runtime services) through the team's Cloud environment build setup. Use for /alan-environment-setup or explicit repository setup. Team Cloud environment creation and saved secrets use Alan MCP tools, not repository setup.
5
+ ---
6
+
7
+ # Environment setup and maintenance
8
+
9
+ Make the authorized development workflow reproducible in future Alan sessions.
10
+ Setup lives only in Alan, as a versioned YAML **build setup** plus a **startup**
11
+ setting. Nothing is committed to the customer's repository and no pull request
12
+ is needed: saving a revision is the change. Follow the mode below; verification
13
+ without changes needs no revision.
14
+
15
+ ## Choose the mode and scope
16
+
17
+ If the request is to create or reuse the team's Cloud environment, add saved
18
+ secrets, or configure an env file, do not inspect local files or start a computer.
19
+ First call `get_cloud_environment_status` with the requested secret names. If
20
+ there is no environment and creation was requested, call `create_cloud_environment`.
21
+ For missing secrets or env files, call `request` op `environment_setup_actions` and
22
+ end the turn; pass names only and direct env-file setup to Cloud settings. After
23
+ Save, Continue or Skip, recheck status. Do not re-request skipped actions unless
24
+ the user asks. Use the modes below only for repository setup work.
25
+
26
+ | Request or discovery | Mode | Work and completion criteria |
27
+ | --- | --- | --- |
28
+ | Set up / bootstrap an environment | Initial setup | Inspect selected repositories, draft the build setup and startup, pass a draft test build, save the revision, build the image and validate the product. |
29
+ | A task needs a system package, OS library, toolchain or runtime service the image does not provide | Maintenance | Change only the affected step, test the draft, save on the current revision and validate the affected feature. A package added to a manifest and lockfile is not maintenance when `maintenance` already installs from it. |
30
+ | Is this environment running / usable? | Verification | Read the build setup, inspect current startup state and exercise the product. No revision or build is required when nothing changes. |
31
+ | Explicitly verify a clean image build | Build verification | Run `test_environment_build` with the saved build setup and report it separately from startup and product evidence. |
32
+
33
+ Use `<alan_agent_context>` and updates for the selected repositories, configured
34
+ branches, working directories, environment binding and startup state. Do not set
35
+ up every attached repository during a scoped task. Read-only tasks remain
36
+ read-only; report needed changes rather than saving them.
37
+
38
+ An existing setup is whatever `read_build_setup` returns. Revision 1
39
+ is imported from the last built image's recipe or from saved commands, so an
40
+ older environment already has a build setup. Verify it works before deciding to
41
+ skip a repository; repair a broken one as maintenance.
42
+
43
+ Keep a short plan appropriate to the mode. Resume it after build-result messages;
44
+ do not restart setup because a build result arrived.
45
+
46
+ ## Shared execution contract
47
+
48
+ **The image is not a copy of this sandbox.** A build runs the build setup in a
49
+ clean builder: tools installed by hand or files left in this session never reach
50
+ it. Inspect the live tools before relying on this model in an older environment.
51
+
52
+ - Use this Alan cloud sandbox for development and validation. Verify the target
53
+ application's origin before touching data. Do not substitute another machine
54
+ or bypass a platform tool's authorization through shell, HTTP or browser calls.
55
+ - Tool descriptions and schemas define the supported operations in this session.
56
+ Never pass an unsupported argument.
57
+ - If a tool or environment binding is unavailable, continue independent work and
58
+ name the exact unverified requirement. Building the image replaces the
59
+ environment's image for every later session; request it only when authorized.
60
+ - Keep toolchains pinned to the repository's versions. Prefer distribution
61
+ packages; refresh apt in the same command as installation. Do not replace tools
62
+ already supplied by the base image. Take third-party repository codenames from
63
+ `/etc/os-release`.
64
+ - Use `/home/alan/workspace` and the actual repository paths from context.
65
+ The cloud user's HOME is `/home/alan`; use `~/.local/bin` for user-installed
66
+ executables. Never substitute `/home/user` or `/home/daytona`. Inspect
67
+ `/etc/os-release` and, when available, `/etc/alan/image.json` for actual
68
+ OS/tool versions instead of assuming a fixed inventory.
69
+ - Build steps run without a Docker daemon; session startup has rootless Docker.
70
+ Containers and long-lived services belong in startup, not in the build setup.
71
+
72
+ ### Secrets
73
+
74
+ Never print, bake into an image, put in the build setup, or request secret values
75
+ in chat. A literal credential in a build setup is refused. Check saved variable
76
+ names and verify a credential through the narrow command that needs it.
77
+
78
+ Credentials belong in the environment's saved variables or env files. Every
79
+ environment variable is available to every build step and every session, so a
80
+ step reads `$REGISTRY_TOKEN` directly. Use the token for the command that needs
81
+ it and delete any auth file the command writes; never leave tokens, login state
82
+ or credential helpers in the image.
83
+
84
+ For a missing or expired secret or provider connection, use
85
+ `request` op `environment_setup_actions` with names only and precise instructions;
86
+ never borrow another environment's credentials. Continue work that does not
87
+ require it. A missing variable blocks the step that reads it, not unrelated work.
88
+ After delivery, verify without echoing values and repeat the blocked check.
89
+
90
+ ## The build setup
91
+
92
+ `read_build_setup` returns the revision, the environment build setup,
93
+ each repository's build setup by clone path, and the startup. Build setups are YAML
94
+ with these keys.
95
+
96
+ - `initialize`: tools and system packages. Runs on full builds.
97
+ - `maintenance`: dependencies that follow the lockfiles. Runs every build and is
98
+ shown to the agent so it can rerun it after a pull.
99
+ - `knowledge`: `name` and `contents` notes (how to test, lint, seed). Shown to
100
+ the agent, never run.
101
+ - Environment only: `runs-on` (`default` or `linux`), `shell` (`default` or
102
+ `bash`) and `post-build` checks that run after every repository; nonzero fails
103
+ the build.
104
+ - Repository only: `clone` with `ref` and `submodules`. `path`, `depth`, `tags`
105
+ and `lfs` are not supported yet. `includes` is not supported yet.
106
+ - A step is a command string or a list of `{name, run, env}`. `uses` steps are
107
+ not supported yet: write the command with `run`.
108
+
109
+ Order: the environment's `initialize` and `maintenance` run from `~` before any
110
+ repository; then each repository is copied in and its `initialize` and
111
+ `maintenance` run in its directory; then `post-build`.
112
+
113
+ Each step is a fresh bash shell. To pass a variable to later steps and to
114
+ sessions, append a line to `$ENVRC`:
115
+
116
+ ```bash
117
+ echo "PATH='$HOME/.local/bin:$PATH'" >> "$ENVRC"
118
+ echo "ANDROID_HOME='/opt/android-sdk'" >> "$ENVRC"
119
+ ```
120
+
121
+ Example environment build setup:
122
+
123
+ ```yaml
124
+ initialize:
125
+ - name: System packages
126
+ run: sudo apt-get update && sudo apt-get install -y --no-install-recommends postgresql redis-server
127
+ post-build:
128
+ - name: Tools resolve
129
+ run: psql --version && redis-server --version
130
+ ```
131
+
132
+ Example repository build setup:
133
+
134
+ ```yaml
135
+ initialize:
136
+ - name: Node tooling
137
+ run: corepack enable
138
+ maintenance:
139
+ - name: Dependencies
140
+ run: pnpm install --frozen-lockfile
141
+ knowledge:
142
+ - name: test
143
+ contents: pnpm test --filter api
144
+ ```
145
+
146
+ ## Startup
147
+
148
+ Startup is saved with `update_build_setup` as `startup`, beside the
149
+ build setup and never in it. It replaces the saved startup, so send the full set.
150
+
151
+ - `tasks` run to exit 0 before new agent runs start. `detach: true` launches the
152
+ command in the background and does not wait, like the old start command.
153
+ - `services` stay up and must pass a `ready` probe: `{kind: http, url}`,
154
+ `{kind: tcp, port}` or `{kind: exec, run}`. Always give a service a probe.
155
+ - Each has a `name` (lowercase letters, digits, hyphens), `repositoryId` or
156
+ `null`, `run`, optional `timeoutSeconds` and `optional`.
157
+
158
+ Startup must tolerate reruns, preserve data, skip healthy services and surface
159
+ bootstrap failures. Run migrations and idempotent seeding as tasks before the
160
+ services that need them.
161
+
162
+ `run_startup` (optional `node`) runs the saved startup, or one task or service,
163
+ in this session's live sandbox and returns each node's status with the redacted
164
+ tail of `~/.alan/start-commands.log`. If startup is already running it returns
165
+ that state; call it again to watch it settle.
166
+
167
+ - Context says `Startup <node> failed with exit code N`: call `read_build_setup`,
168
+ fix that node with `update_build_setup`, call `run_startup` with that `node`,
169
+ read the log it returns, then run it without `node` once it passes.
170
+ - Context says the saved build setup is invalid: startup never ran. Fix the cited
171
+ field with `update_build_setup`, then call `run_startup`.
172
+ - A context line saying the latest image build failed carries its code and
173
+ message; `get_cloud_machine` has the full failure. UI-started and nightly builds
174
+ send no message, so this line is how you learn their result.
175
+
176
+ ## Initial setup
177
+
178
+ 1. Inspect README, AGENTS.md, package manifests/lockfiles, tool-version files,
179
+ CI, existing scripts and service definitions. Identify canonical install,
180
+ generation, migration, start and seed commands and reuse them. Identify
181
+ required services, secrets and documented test identities.
182
+ 2. Get the smallest required stack running in this sandbox. Fix the first
183
+ concrete failing layer: system tools, project install/generation, local
184
+ configuration, then services. Read the current startup log when context says
185
+ startup failed; compare timestamps before treating an old failure as current.
186
+ 3. Run **Product validation** below. Make its data/auth path repeatable with
187
+ startup tasks. Never bake a generated PAT or session into the image. If the
188
+ repo has no authorized test identity, report the authenticated path as
189
+ unverified rather than inventing credentials.
190
+ 4. Draft the build setup and startup, then follow **Draft, test, save, build**.
191
+
192
+ ## Maintenance
193
+
194
+ 1. Read the build setup and inspect the affected manifest, lockfile and startup.
195
+ Identify what future sessions need beyond this sandbox's state.
196
+ 2. Persist project packages in manifests and lockfiles. If `maintenance` already
197
+ installs from that lockfile, change nothing in the build setup and run the
198
+ affected install and feature checks. A system package, OS library, toolchain
199
+ or runtime service is environment work: change the smallest step.
200
+ 3. Follow **Draft, test, save, build** for the change and the task's feature
201
+ validation for affected runtime flows.
202
+
203
+ ## Verification
204
+
205
+ Read the build setup, inspect the context's current startup result and its log. A
206
+ detached task may have exited successfully while a service later failed; inspect
207
+ live processes and readiness. Run **Product validation** for the requested scope.
208
+
209
+ When nothing needs to change, report the observed result without saving or
210
+ building. Never infer a verified new-session boot from manual startup or an
211
+ image build alone.
212
+
213
+ ## Draft, test, save, build
214
+
215
+ 1. **Read.** Call `read_build_setup`; note `revision`.
216
+ 2. **Draft the smallest change.** Tools and system packages go in `initialize`;
217
+ dependencies that follow lockfiles in `maintenance`; test, lint and seed notes
218
+ in `knowledge`; long-running processes in `startup` services with a probe.
219
+ Environment-wide tools go in the environment build setup; repository work goes
220
+ in that repository's build setup, keyed by clone path. Use existing scripts in
221
+ the repository rather than copying their contents. Do not add a setup script to
222
+ the repository.
223
+ 3. **Test.** Call `test_environment_build` with the draft (`environmentSetup`
224
+ and `repositories`). It renders the same Dockerfile as an image build and
225
+ builds it on this sandbox's Docker, with the environment's variables, over
226
+ each repository's working tree as a checkout sees it, uncommitted edits
227
+ included. It returns at once with the `log` path; **end your turn**: the
228
+ result arrives as a message in this conversation, so never poll or write an
229
+ until-loop. This is a local builder test, not a hosted build or a new-session
230
+ boot.
231
+ 4. **Fix and retest** the first concrete failure until the test passes: read the
232
+ end of the `log` the failure message names. Read
233
+ [troubleshooting](references/troubleshooting.md).
234
+ 5. **Save.** Call `update_build_setup` with `expectedRevision` from the
235
+ read, the passing scopes and the `startup`. Scopes you leave out keep their
236
+ text. A stale revision is refused: read again, reapply, retest. Fix any
237
+ validation error it returns and save again. Saving builds nothing. Pass
238
+ `optionalRepositories` (clone paths) for repositories a build may leave out
239
+ when Alan cannot read them; it replaces the saved list, `[]` makes every
240
+ repository required, and leaving it out keeps the list.
241
+ 6. **Push, then build.** A hosted build does not see this sandbox: it pins each
242
+ repository's **pushed branch head**, so commit and push the branch first;
243
+ unpushed work is not in the image. Then call `build_environment_image` so new
244
+ sessions boot from the change. It replaces the environment's image when it
245
+ succeeds, and reuses the existing image at once if nothing changed. Request it
246
+ only when authorized. After it is accepted, **end your turn**: the result
247
+ arrives as a message; do not poll or sleep. On the result, check it matches
248
+ the revision you saved. To retry a failed build whose setup did not change,
249
+ call it with `full: true`; with `branch` (and `repository`) it builds that
250
+ pushed branch of one repository.
251
+
252
+ ## Results, refusals and attempts
253
+
254
+ Both tools and both results are structured so you act on them without guessing.
255
+
256
+ - A refusal is `{code, message, nextStep, admissions?}`. Do what `nextStep`
257
+ says; do not retry the same call unchanged. `admissions` lists every
258
+ repository's verdict (`clonePath`, `branch`, `outcome`, `included`, `code`,
259
+ `nextStep`). Codes: `repository_credential_missing` and `access_denied`
260
+ (`request` op `github_connection` for GitHub, `integration_connection` for
261
+ another host, then end the turn), `build_secret_missing` (`request` op
262
+ `environment_setup_actions` with the names), `branch_not_found` and
263
+ `repository_empty` (fix the branch with `update_environment_repository`, or
264
+ push), `provider_error` (retry once, then report), `unknown_repository`
265
+ (`list_repositories`) and `build_setup_revision_conflict` (read again,
266
+ reapply, save). A GitHub 404 cannot tell a missing branch from an empty or
267
+ invisible repository, so `branch_not_found` there may be either.
268
+ - `read_build_setup` also returns each repository's `optional` flag and its
269
+ `lastAdmission` (what the newest build request decided for it) and
270
+ `lastBuildRequest`, so you see which repositories a build would skip or
271
+ refuse before you build.
272
+ - `test_environment_build`, `build_environment_image` and their refusals carry
273
+ `attempt` (failed test and image builds in this conversation, plus one),
274
+ `failedBuilds` and `repeatedStep` (`{step, times}` when the same step failed
275
+ again, else null). **Stop and report** when `failedBuilds` reaches 5 or
276
+ `repeatedStep.times` reaches 3: give the error, the attempts and the action
277
+ needed. Do not count builds yourself.
278
+
279
+ For maintenance, a passing `test_environment_build` plus a saved revision
280
+ satisfies clean-build validation; build the image when later sessions must pick
281
+ the change up.
282
+
283
+ For the native Android emulator toolchain, which `/alan-test-android` reports
284
+ when it is missing, follow [android](references/android.md): it checks the two
285
+ requirements a build setup cannot provide (KVM and machine size) before adding
286
+ the SDK.
287
+
288
+ ## Product validation
289
+
290
+ Check service readiness first, then one bounded representative journey on the
291
+ actual primary surface. For UI flows, use `alan-test-feature` when installed and
292
+ the repository's testing overlay: reach a protected page through documented test
293
+ auth, perform one safe test-data change, verify it after refresh or an API read,
294
+ and inspect browser errors. Record the route, auth method and evidence/report.
295
+ For an API/CLI, perform a meaningful authorized operation and verify its result;
296
+ a static site needs its main page and any available navigation/interaction.
297
+
298
+ When test data is required, confirm the documented seed/fixture command works
299
+ and can be repeated safely. Distinguish existing-data reruns from fresh-data
300
+ initialization: use an authorized disposable database/fixture target when
301
+ available. Never reset the current database or rotate another session's
302
+ credentials for this check. If fresh initialization cannot be exercised, report
303
+ it unverified. An HTTP 200, login form or screenshot of an empty shell is
304
+ service evidence, not product validation. Do not change application behavior to
305
+ hide setup failures or run broad suites as a substitute for this journey.
306
+
307
+ ## Outcome
308
+
309
+ - Initial setup: a saved revision, a build ID and result, startup and product
310
+ evidence, per repository **set up now**, **already set up** or **blocked**.
311
+ - Maintenance: the revision saved, the test result and the affected feature check.
312
+ - Verification: observed state only; report any repair needed separately.
313
+
314
+ Report mode and scope, the revision saved, startup changes, readiness, product
315
+ journey and repeatable auth/seed path, build ID and result if requested, and
316
+ remaining gaps with next actions. Use **complete** only when all requested
317
+ checks have passed; **partially verified** when some evidence is missing;
318
+ **blocked** when a required next action cannot proceed. Name secrets only.
319
+ Distinguish draft test builds, hosted builds, observed startup and actual
320
+ new-session boot evidence.