@xano/developer-mcp 1.0.74 → 2.0.0-beta.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 (129) hide show
  1. package/README.md +104 -37
  2. package/dist/cli_docs/index.d.ts +13 -37
  3. package/dist/cli_docs/index.js +28 -39
  4. package/dist/cli_docs/topics/integration.js +1 -1
  5. package/dist/cli_docs/topics/workspace.js +1 -1
  6. package/dist/index.js +58 -55
  7. package/dist/lib.d.ts +3 -1
  8. package/dist/lib.js +1 -1
  9. package/dist/meta_api_docs/format.js +1 -1
  10. package/dist/meta_api_docs/index.d.ts +14 -42
  11. package/dist/meta_api_docs/index.js +34 -46
  12. package/dist/tools/cli_docs.d.ts +2 -3
  13. package/dist/tools/cli_docs.js +3 -5
  14. package/dist/tools/define_tool.d.ts +47 -0
  15. package/dist/tools/define_tool.js +36 -0
  16. package/dist/tools/index.d.ts +88 -221
  17. package/dist/tools/index.js +80 -109
  18. package/dist/tools/mcp_version.d.ts +4 -25
  19. package/dist/tools/mcp_version.js +12 -19
  20. package/dist/tools/meta_api_docs.d.ts +2 -3
  21. package/dist/tools/meta_api_docs.js +3 -5
  22. package/dist/tools/validate_xanoscript.d.ts +18 -65
  23. package/dist/tools/validate_xanoscript.js +56 -54
  24. package/dist/tools/xanoscript_docs.d.ts +25 -74
  25. package/dist/tools/xanoscript_docs.js +86 -83
  26. package/dist/xanoscript_docs/README.md +5 -5
  27. package/dist/xanoscript_docs/addons.md +1 -3
  28. package/dist/xanoscript_docs/apis.md +2 -2
  29. package/dist/xanoscript_docs/database.md +1 -1
  30. package/dist/xanoscript_docs/essentials.md +6 -6
  31. package/dist/xanoscript_docs/functions.md +3 -3
  32. package/dist/xanoscript_docs/integrations.md +5 -5
  33. package/dist/xanoscript_docs/middleware.md +1 -1
  34. package/dist/xanoscript_docs/performance.md +4 -4
  35. package/dist/xanoscript_docs/realtime.md +2 -2
  36. package/dist/xanoscript_docs/security.md +3 -6
  37. package/dist/xanoscript_docs/survival.md +1 -1
  38. package/dist/xanoscript_docs/syntax/string-filters.md +1 -1
  39. package/dist/xanoscript_docs/syntax.md +10 -12
  40. package/dist/xanoscript_docs/tasks.md +1 -2
  41. package/dist/xanoscript_docs/tools.md +3 -5
  42. package/dist/xanoscript_docs/types.md +2 -2
  43. package/dist/xanoscript_docs/unit-testing.md +1 -1
  44. package/dist/xanoscript_docs/workflow-tests.md +1 -1
  45. package/dist/xanoscript_docs/working.md +4 -4
  46. package/package.json +5 -4
  47. package/dist/api_docs/format.d.ts +0 -5
  48. package/dist/api_docs/format.js +0 -171
  49. package/dist/api_docs/index.d.ts +0 -52
  50. package/dist/api_docs/index.js +0 -111
  51. package/dist/api_docs/topics/agent.d.ts +0 -2
  52. package/dist/api_docs/topics/agent.js +0 -142
  53. package/dist/api_docs/topics/api.d.ts +0 -2
  54. package/dist/api_docs/topics/api.js +0 -176
  55. package/dist/api_docs/topics/apigroup.d.ts +0 -2
  56. package/dist/api_docs/topics/apigroup.js +0 -124
  57. package/dist/api_docs/topics/authentication.d.ts +0 -2
  58. package/dist/api_docs/topics/authentication.js +0 -61
  59. package/dist/api_docs/topics/branch.d.ts +0 -2
  60. package/dist/api_docs/topics/branch.js +0 -73
  61. package/dist/api_docs/topics/file.d.ts +0 -2
  62. package/dist/api_docs/topics/file.js +0 -70
  63. package/dist/api_docs/topics/function.d.ts +0 -2
  64. package/dist/api_docs/topics/function.js +0 -164
  65. package/dist/api_docs/topics/history.d.ts +0 -2
  66. package/dist/api_docs/topics/history.js +0 -149
  67. package/dist/api_docs/topics/mcp_server.d.ts +0 -2
  68. package/dist/api_docs/topics/mcp_server.js +0 -139
  69. package/dist/api_docs/topics/middleware.d.ts +0 -2
  70. package/dist/api_docs/topics/middleware.js +0 -156
  71. package/dist/api_docs/topics/realtime.d.ts +0 -2
  72. package/dist/api_docs/topics/realtime.js +0 -112
  73. package/dist/api_docs/topics/start.d.ts +0 -2
  74. package/dist/api_docs/topics/start.js +0 -107
  75. package/dist/api_docs/topics/table.d.ts +0 -2
  76. package/dist/api_docs/topics/table.js +0 -195
  77. package/dist/api_docs/topics/task.d.ts +0 -2
  78. package/dist/api_docs/topics/task.js +0 -165
  79. package/dist/api_docs/topics/tool.d.ts +0 -2
  80. package/dist/api_docs/topics/tool.js +0 -150
  81. package/dist/api_docs/topics/workflows.d.ts +0 -2
  82. package/dist/api_docs/topics/workflows.js +0 -131
  83. package/dist/api_docs/topics/workspace.d.ts +0 -2
  84. package/dist/api_docs/topics/workspace.js +0 -153
  85. package/dist/api_docs/types.d.ts +0 -79
  86. package/dist/api_docs/types.js +0 -4
  87. package/dist/cli_docs/topics/run.d.ts +0 -2
  88. package/dist/cli_docs/topics/run.js +0 -248
  89. package/dist/meta_api_docs/format.test.d.ts +0 -1
  90. package/dist/meta_api_docs/format.test.js +0 -272
  91. package/dist/meta_api_docs/index.test.d.ts +0 -1
  92. package/dist/meta_api_docs/index.test.js +0 -128
  93. package/dist/meta_api_docs/types.test.d.ts +0 -1
  94. package/dist/meta_api_docs/types.test.js +0 -132
  95. package/dist/templates/init-workspace.d.ts +0 -10
  96. package/dist/templates/init-workspace.js +0 -278
  97. package/dist/templates/xanoscript-index.d.ts +0 -11
  98. package/dist/templates/xanoscript-index.js +0 -72
  99. package/dist/tools/index.test.d.ts +0 -1
  100. package/dist/tools/index.test.js +0 -179
  101. package/dist/tools/xanoscript_docs.test.d.ts +0 -1
  102. package/dist/tools/xanoscript_docs.test.js +0 -197
  103. package/dist/xanoscript.test.d.ts +0 -1
  104. package/dist/xanoscript.test.js +0 -421
  105. package/dist/xanoscript_docs/cheatsheet.md +0 -287
  106. package/dist/xanoscript_docs/ephemeral.md +0 -330
  107. package/dist/xanoscript_docs/quickstart.md +0 -692
  108. package/dist/xanoscript_docs/run.md +0 -196
  109. package/dist/xanoscript_docs/schema.md +0 -300
  110. package/dist/xanoscript_docs_auto/README.md +0 -119
  111. package/dist/xanoscript_docs_auto/agents.md +0 -446
  112. package/dist/xanoscript_docs_auto/apis.md +0 -517
  113. package/dist/xanoscript_docs_auto/control-flow.md +0 -543
  114. package/dist/xanoscript_docs_auto/database.md +0 -551
  115. package/dist/xanoscript_docs_auto/debugging.md +0 -527
  116. package/dist/xanoscript_docs_auto/filters.md +0 -464
  117. package/dist/xanoscript_docs_auto/functions.md +0 -431
  118. package/dist/xanoscript_docs_auto/integrations.md +0 -657
  119. package/dist/xanoscript_docs_auto/mcp-servers.md +0 -408
  120. package/dist/xanoscript_docs_auto/operators.md +0 -368
  121. package/dist/xanoscript_docs_auto/syntax.md +0 -287
  122. package/dist/xanoscript_docs_auto/tables.md +0 -447
  123. package/dist/xanoscript_docs_auto/tasks.md +0 -479
  124. package/dist/xanoscript_docs_auto/testing.md +0 -574
  125. package/dist/xanoscript_docs_auto/tools.md +0 -485
  126. package/dist/xanoscript_docs_auto/triggers.md +0 -595
  127. package/dist/xanoscript_docs_auto/types.md +0 -323
  128. package/dist/xanoscript_docs_auto/variables.md +0 -462
  129. package/dist/xanoscript_docs_auto/version.json +0 -5
@@ -1,421 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { join, dirname } from "path";
3
- import { fileURLToPath } from "url";
4
- import { XANOSCRIPT_DOCS_V2, getDocsForFilePath, extractQuickReference, getXanoscriptDocsVersion, readXanoscriptDocsV2, readXanoscriptDocsStructured, getTopicNames, getTopicDescriptions, } from "./xanoscript.js";
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
- const DOCS_PATH = join(__dirname, "xanoscript_docs");
8
- describe("xanoscript module", () => {
9
- describe("XANOSCRIPT_DOCS_V2", () => {
10
- it("should have all expected topics", () => {
11
- const expectedTopics = [
12
- "survival",
13
- "working",
14
- "readme",
15
- "essentials",
16
- "syntax",
17
- "syntax/string-filters",
18
- "syntax/array-filters",
19
- "syntax/functions",
20
- "types",
21
- "tables",
22
- "functions",
23
- "apis",
24
- "tasks",
25
- "triggers",
26
- "database",
27
- "agents",
28
- "tools",
29
- "mcp-servers",
30
- "unit-testing",
31
- "workflow-tests",
32
- "integrations",
33
- "integrations/cloud-storage",
34
- "integrations/search",
35
- "integrations/redis",
36
- "integrations/external-apis",
37
- "integrations/utilities",
38
- "frontend",
39
- "addons",
40
- "debugging",
41
- "performance",
42
- "realtime",
43
- "security",
44
- "streaming",
45
- "middleware",
46
- "branch",
47
- "workspace",
48
- ];
49
- expect(Object.keys(XANOSCRIPT_DOCS_V2)).toEqual(expectedTopics);
50
- });
51
- it("should have valid DocConfig structure for each topic", () => {
52
- for (const [key, config] of Object.entries(XANOSCRIPT_DOCS_V2)) {
53
- expect(config).toHaveProperty("file");
54
- expect(config).toHaveProperty("applyTo");
55
- expect(config).toHaveProperty("description");
56
- expect(typeof config.file).toBe("string");
57
- expect(Array.isArray(config.applyTo)).toBe(true);
58
- expect(typeof config.description).toBe("string");
59
- expect(config.file).toMatch(/\.md$/);
60
- }
61
- });
62
- });
63
- describe("getDocsForFilePath", () => {
64
- it("should always include syntax for .xs files", () => {
65
- const result = getDocsForFilePath("test.xs");
66
- expect(result).toContain("syntax");
67
- });
68
- it("should match api files", () => {
69
- const result = getDocsForFilePath("api/users/create.xs");
70
- expect(result).toContain("syntax");
71
- expect(result).toContain("apis");
72
- expect(result).toContain("types");
73
- expect(result).toContain("database");
74
- expect(result).toContain("unit-testing");
75
- // Niche topics should NOT be auto-included for apis
76
- expect(result).not.toContain("addons");
77
- expect(result).not.toContain("integrations");
78
- expect(result).not.toContain("schema");
79
- expect(result).not.toContain("streaming");
80
- });
81
- it("should match function files", () => {
82
- const result = getDocsForFilePath("function/format.xs");
83
- expect(result).toContain("syntax");
84
- expect(result).toContain("functions");
85
- expect(result).toContain("types");
86
- expect(result).toContain("database");
87
- // Niche topics should NOT be auto-included for functions
88
- expect(result).not.toContain("addons");
89
- expect(result).not.toContain("integrations");
90
- expect(result).not.toContain("realtime");
91
- expect(result).not.toContain("schema");
92
- expect(result).not.toContain("streaming");
93
- });
94
- it("should match table files", () => {
95
- const result = getDocsForFilePath("table/users.xs");
96
- expect(result).toContain("syntax");
97
- expect(result).toContain("tables");
98
- });
99
- it("should match task files", () => {
100
- const result = getDocsForFilePath("task/cleanup.xs");
101
- expect(result).toContain("syntax");
102
- expect(result).toContain("tasks");
103
- expect(result).toContain("database");
104
- // integrations is now topic-only (not auto-included)
105
- expect(result).not.toContain("integrations");
106
- });
107
- it("should match trigger files", () => {
108
- const result = getDocsForFilePath("table/trigger/on_create.xs");
109
- expect(result).toContain("syntax");
110
- expect(result).toContain("triggers");
111
- });
112
- it("should match ai/agent files", () => {
113
- const result = getDocsForFilePath("ai/agent/support_bot.xs");
114
- expect(result).toContain("syntax");
115
- expect(result).toContain("agents");
116
- expect(result).toContain("types");
117
- });
118
- it("should match ai/tool files", () => {
119
- const result = getDocsForFilePath("ai/tool/search_docs.xs");
120
- expect(result).toContain("syntax");
121
- expect(result).toContain("tools");
122
- expect(result).toContain("types");
123
- expect(result).toContain("database");
124
- });
125
- it("should match ai/mcp_server files", () => {
126
- const result = getDocsForFilePath("ai/mcp_server/my_server.xs");
127
- expect(result).toContain("syntax");
128
- expect(result).toContain("mcp-servers");
129
- });
130
- it("should match middleware files", () => {
131
- const result = getDocsForFilePath("middleware/auth_check.xs");
132
- expect(result).toContain("syntax");
133
- expect(result).toContain("middleware");
134
- });
135
- it("should match branch.xs", () => {
136
- const result = getDocsForFilePath("branch.xs");
137
- expect(result).toContain("syntax");
138
- expect(result).toContain("branch");
139
- });
140
- it("should match workspace.xs", () => {
141
- const result = getDocsForFilePath("workspace/workspace.xs");
142
- expect(result).toContain("syntax");
143
- expect(result).toContain("workspace");
144
- });
145
- it("should match static frontend files", () => {
146
- const result = getDocsForFilePath("static/index.html");
147
- expect(result).toContain("frontend");
148
- });
149
- it("should match run files", () => {
150
- const result = getDocsForFilePath("run/job/main.xs");
151
- expect(result).toContain("syntax");
152
- });
153
- it("should not include readme automatically", () => {
154
- const result = getDocsForFilePath("api/test.xs");
155
- expect(result).not.toContain("readme");
156
- });
157
- it("should include syntax and essentials for .xs files", () => {
158
- const result = getDocsForFilePath("some/random/file.xs");
159
- expect(result).toContain("syntax");
160
- expect(result).toContain("essentials");
161
- });
162
- });
163
- describe("extractQuickReference", () => {
164
- it("should extract Quick Reference section when present", () => {
165
- const content = `# Title
166
-
167
- Some intro text.
168
-
169
- ## Quick Reference
170
-
171
- Quick reference content here.
172
-
173
- More quick reference.
174
-
175
- ## Next Section
176
-
177
- Other content.
178
- `;
179
- const result = extractQuickReference(content, "test");
180
- expect(result).toContain("# test");
181
- expect(result).toContain("## Quick Reference");
182
- expect(result).toContain("Quick reference content here.");
183
- expect(result).not.toContain("## Next Section");
184
- expect(result).not.toContain("Other content.");
185
- });
186
- it("should return fallback when no Quick Reference section", () => {
187
- const content = `# Title
188
-
189
- Some intro text.
190
-
191
- ## First Section
192
-
193
- Section content.
194
-
195
- ## Second Section
196
-
197
- More content.
198
- `;
199
- const result = extractQuickReference(content, "test");
200
- expect(result).toContain("# Title");
201
- expect(result).toContain("Some intro text.");
202
- expect(result).not.toContain("## First Section");
203
- });
204
- it("should return up to 50 lines if no sections found", () => {
205
- const lines = Array(100).fill("Line content").join("\n");
206
- const result = extractQuickReference(lines, "test");
207
- const resultLines = result.split("\n");
208
- expect(resultLines.length).toBeLessThanOrEqual(50);
209
- });
210
- it("should include Quick Reference to end if no following section", () => {
211
- const content = `# Title
212
-
213
- ## Quick Reference
214
-
215
- Quick reference content.
216
- More content.
217
- Even more content.
218
- `;
219
- const result = extractQuickReference(content, "test");
220
- expect(result).toContain("Quick reference content.");
221
- expect(result).toContain("More content.");
222
- expect(result).toContain("Even more content.");
223
- });
224
- });
225
- describe("getXanoscriptDocsVersion", () => {
226
- it("should return version from valid docs path", () => {
227
- const version = getXanoscriptDocsVersion(DOCS_PATH);
228
- expect(typeof version).toBe("string");
229
- // Version should be a semver-like string or "unknown"
230
- expect(version).toMatch(/^(\d+\.\d+\.\d+|unknown)$/);
231
- });
232
- it("should return unknown for invalid path", () => {
233
- const version = getXanoscriptDocsVersion("/nonexistent/path");
234
- expect(version).toBe("unknown");
235
- });
236
- });
237
- describe("readXanoscriptDocsV2", () => {
238
- it("should return README when no args provided", () => {
239
- const result = readXanoscriptDocsV2(DOCS_PATH);
240
- expect(result).toContain("Documentation version:");
241
- });
242
- it("should return README when empty args provided", () => {
243
- const result = readXanoscriptDocsV2(DOCS_PATH, {});
244
- expect(result).toContain("Documentation version:");
245
- });
246
- it("should return specific topic documentation", () => {
247
- const result = readXanoscriptDocsV2(DOCS_PATH, { topic: "syntax" });
248
- expect(result).toContain("Documentation version:");
249
- });
250
- it("should throw for unknown topic", () => {
251
- expect(() => readXanoscriptDocsV2(DOCS_PATH, { topic: "nonexistent" })).toThrow('Unknown topic "nonexistent"');
252
- });
253
- it("should return context-aware docs for file_path", () => {
254
- const result = readXanoscriptDocsV2(DOCS_PATH, {
255
- file_path: "api/users/create.xs",
256
- });
257
- expect(result).toContain("XanoScript Documentation for: api/users/create.xs");
258
- expect(result).toContain("Matched topics:");
259
- expect(result).toContain("Version:");
260
- });
261
- it("should support quick_reference mode for topic", () => {
262
- const fullResult = readXanoscriptDocsV2(DOCS_PATH, {
263
- topic: "syntax",
264
- mode: "full",
265
- });
266
- const quickResult = readXanoscriptDocsV2(DOCS_PATH, {
267
- topic: "syntax",
268
- mode: "quick_reference",
269
- });
270
- // Quick reference should be shorter
271
- expect(quickResult.length).toBeLessThanOrEqual(fullResult.length);
272
- });
273
- it("should support quick_reference mode for file_path", () => {
274
- const fullResult = readXanoscriptDocsV2(DOCS_PATH, {
275
- file_path: "api/test.xs",
276
- mode: "full",
277
- });
278
- const quickResult = readXanoscriptDocsV2(DOCS_PATH, {
279
- file_path: "api/test.xs",
280
- mode: "quick_reference",
281
- });
282
- expect(quickResult).toContain("Mode: quick_reference");
283
- });
284
- it("should default to quick_reference mode for file_path", () => {
285
- const result = readXanoscriptDocsV2(DOCS_PATH, {
286
- file_path: "api/test.xs",
287
- });
288
- expect(result).toContain("Mode: quick_reference");
289
- });
290
- it("should default to full mode for topic", () => {
291
- const result = readXanoscriptDocsV2(DOCS_PATH, { topic: "syntax" });
292
- // Full mode returns the complete doc content, not quick_reference
293
- expect(result).not.toContain("Mode: quick_reference");
294
- });
295
- it("should support exclude_topics with file_path", () => {
296
- const result = readXanoscriptDocsV2(DOCS_PATH, {
297
- file_path: "api/users/create.xs",
298
- exclude_topics: ["syntax", "essentials"],
299
- });
300
- expect(result).toContain("Matched topics:");
301
- expect(result).not.toContain("Matched topics: syntax");
302
- // Verify excluded topics are not in the matched list
303
- const matchLine = result.split("\n").find((l) => l.startsWith("Matched topics:"));
304
- expect(matchLine).not.toContain("syntax");
305
- expect(matchLine).not.toContain("essentials");
306
- });
307
- it("should throw when all topics are excluded via exclude_topics", () => {
308
- expect(() => readXanoscriptDocsV2(DOCS_PATH, {
309
- file_path: "branch.xs",
310
- exclude_topics: ["syntax", "essentials", "debugging", "branch", "survival", "working"],
311
- })).toThrow("No documentation found");
312
- });
313
- it("should throw for invalid docs path", () => {
314
- expect(() => readXanoscriptDocsV2("/nonexistent/path", { topic: "syntax" })).toThrow();
315
- });
316
- it("should return compact index with mode: index", () => {
317
- const result = readXanoscriptDocsV2(DOCS_PATH, { mode: "index" });
318
- expect(result).toContain("# XanoScript Documentation Index");
319
- expect(result).toContain("Version:");
320
- expect(result).toContain("Topics:");
321
- expect(result).toContain("| Topic | Description | Size | Est. Tokens |");
322
- // Should contain some known topics
323
- expect(result).toContain("| syntax |");
324
- expect(result).toContain("| essentials |");
325
- expect(result).toContain("| database |");
326
- // Should contain KB size indicators
327
- expect(result).toContain("KB |");
328
- });
329
- it("should return index mode without requiring topic or file_path", () => {
330
- const result = readXanoscriptDocsV2(DOCS_PATH, { mode: "index" });
331
- // Index mode ignores topic/file_path — just returns the listing
332
- expect(result).toContain("# XanoScript Documentation Index");
333
- });
334
- it("should return index that is significantly smaller than full docs", () => {
335
- const index = readXanoscriptDocsV2(DOCS_PATH, { mode: "index" });
336
- const full = readXanoscriptDocsV2(DOCS_PATH, { topic: "syntax", mode: "full" });
337
- // Index should be compact — smaller than even a single full topic
338
- expect(index.length).toBeLessThan(full.length);
339
- });
340
- });
341
- describe("getTopicNames", () => {
342
- it("should return all topic names", () => {
343
- const names = getTopicNames();
344
- expect(names).toEqual(Object.keys(XANOSCRIPT_DOCS_V2));
345
- });
346
- it("should return an array of strings", () => {
347
- const names = getTopicNames();
348
- expect(Array.isArray(names)).toBe(true);
349
- names.forEach((name) => {
350
- expect(typeof name).toBe("string");
351
- });
352
- });
353
- });
354
- describe("getTopicDescriptions", () => {
355
- it("should return formatted descriptions string", () => {
356
- const descriptions = getTopicDescriptions();
357
- expect(typeof descriptions).toBe("string");
358
- });
359
- it("should include all topics", () => {
360
- const descriptions = getTopicDescriptions();
361
- for (const key of Object.keys(XANOSCRIPT_DOCS_V2)) {
362
- expect(descriptions).toContain(key);
363
- }
364
- });
365
- it("should include topic descriptions", () => {
366
- const descriptions = getTopicDescriptions();
367
- expect(descriptions).toContain("XanoScript overview");
368
- expect(descriptions).toContain("Expressions, operators");
369
- });
370
- });
371
- describe("readXanoscriptDocsStructured", () => {
372
- it("should return array of TopicDoc objects", () => {
373
- const result = readXanoscriptDocsStructured(DOCS_PATH, {
374
- file_path: "api/users/create.xs",
375
- });
376
- expect(Array.isArray(result)).toBe(true);
377
- expect(result.length).toBeGreaterThan(0);
378
- for (const doc of result) {
379
- expect(doc).toHaveProperty("topic");
380
- expect(doc).toHaveProperty("content");
381
- expect(typeof doc.topic).toBe("string");
382
- expect(typeof doc.content).toBe("string");
383
- }
384
- });
385
- it("should match the same topics as getDocsForFilePath", () => {
386
- const filePath = "api/users/create.xs";
387
- const expected = getDocsForFilePath(filePath);
388
- const result = readXanoscriptDocsStructured(DOCS_PATH, { file_path: filePath });
389
- const resultTopics = result.map((d) => d.topic);
390
- expect(resultTopics).toEqual(expected);
391
- });
392
- it("should respect exclude_topics", () => {
393
- const result = readXanoscriptDocsStructured(DOCS_PATH, {
394
- file_path: "api/users/create.xs",
395
- exclude_topics: ["syntax", "essentials"],
396
- });
397
- const topics = result.map((d) => d.topic);
398
- expect(topics).not.toContain("syntax");
399
- expect(topics).not.toContain("essentials");
400
- });
401
- it("should throw when all topics are excluded", () => {
402
- expect(() => readXanoscriptDocsStructured(DOCS_PATH, {
403
- file_path: "branch.xs",
404
- exclude_topics: ["syntax", "essentials", "debugging", "branch", "survival", "working"],
405
- })).toThrow("No documentation found");
406
- });
407
- it("should use quick_reference mode by default", () => {
408
- const quickResult = readXanoscriptDocsStructured(DOCS_PATH, {
409
- file_path: "table/users.xs",
410
- });
411
- const fullResult = readXanoscriptDocsStructured(DOCS_PATH, {
412
- file_path: "table/users.xs",
413
- mode: "full",
414
- });
415
- // Quick reference content should be shorter than full
416
- const quickTotal = quickResult.reduce((sum, d) => sum + d.content.length, 0);
417
- const fullTotal = fullResult.reduce((sum, d) => sum + d.content.length, 0);
418
- expect(quickTotal).toBeLessThanOrEqual(fullTotal);
419
- });
420
- });
421
- });