@xano/developer-mcp 1.0.63 → 1.0.64
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.
- package/README.md +7 -7
- package/dist/cli_docs/topics/workspace.js +1 -1
- package/dist/tools/index.test.js +1 -1
- package/dist/tools/validate_xanoscript.d.ts +3 -3
- package/dist/tools/validate_xanoscript.js +7 -7
- package/dist/tools/xanoscript_docs.d.ts +1 -1
- package/dist/tools/xanoscript_docs.js +3 -3
- package/dist/tools/xanoscript_docs.test.js +10 -10
- package/dist/xanoscript.test.js +29 -31
- package/dist/xanoscript_docs/README.md +37 -30
- package/dist/xanoscript_docs/addons.md +1 -1
- package/dist/xanoscript_docs/agents.md +2 -2
- package/dist/xanoscript_docs/database.md +1 -1
- package/dist/xanoscript_docs/docs_index.json +17 -17
- package/dist/xanoscript_docs/integrations/cloud-storage.md +1 -1
- package/dist/xanoscript_docs/integrations/external-apis.md +1 -1
- package/dist/xanoscript_docs/integrations/redis.md +1 -1
- package/dist/xanoscript_docs/integrations/search.md +1 -1
- package/dist/xanoscript_docs/integrations/utilities.md +1 -1
- package/dist/xanoscript_docs/integrations.md +1 -1
- package/dist/xanoscript_docs/mcp-servers.md +5 -5
- package/dist/xanoscript_docs/middleware.md +1 -1
- package/dist/xanoscript_docs/realtime.md +1 -1
- package/dist/xanoscript_docs/tables.md +1 -1
- package/dist/xanoscript_docs/tasks.md +1 -1
- package/dist/xanoscript_docs/tools.md +1 -1
- package/dist/xanoscript_docs/triggers.md +1 -1
- package/dist/xanoscript_docs/types.md +1 -1
- package/dist/xanoscript_docs/unit-testing.md +1 -1
- package/dist/xanoscript_docs/workspace.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -184,10 +184,10 @@ if (result.valid) {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// Validate a file
|
|
187
|
-
const fileResult = validateXanoscript({ file_path: './
|
|
187
|
+
const fileResult = validateXanoscript({ file_path: './function/utils.xs' });
|
|
188
188
|
|
|
189
189
|
// Batch validate a directory
|
|
190
|
-
const dirResult = validateXanoscript({ directory: './
|
|
190
|
+
const dirResult = validateXanoscript({ directory: './api', pattern: '**/*.xs' });
|
|
191
191
|
console.log(`${dirResult.valid_files}/${dirResult.total_files} files valid`);
|
|
192
192
|
```
|
|
193
193
|
|
|
@@ -315,16 +315,16 @@ Validates XanoScript code for syntax errors. Supports multiple input methods. Th
|
|
|
315
315
|
validate_xanoscript({ code: "var:result = 1 + 2" })
|
|
316
316
|
|
|
317
317
|
// Validate a single file
|
|
318
|
-
validate_xanoscript({ file_path: "
|
|
318
|
+
validate_xanoscript({ file_path: "function/utils/format.xs" })
|
|
319
319
|
|
|
320
320
|
// Validate multiple files
|
|
321
|
-
validate_xanoscript({ file_paths: ["
|
|
321
|
+
validate_xanoscript({ file_paths: ["api/users/get.xs", "api/users/create.xs"] })
|
|
322
322
|
|
|
323
323
|
// Validate all .xs files in a directory
|
|
324
|
-
validate_xanoscript({ directory: "
|
|
324
|
+
validate_xanoscript({ directory: "api/users" })
|
|
325
325
|
|
|
326
326
|
// Validate with a specific pattern
|
|
327
|
-
validate_xanoscript({ directory: "src", pattern: "
|
|
327
|
+
validate_xanoscript({ directory: "src", pattern: "api/**/*.xs" })
|
|
328
328
|
```
|
|
329
329
|
|
|
330
330
|
**Returns:** List of errors with line/column positions and helpful suggestions, or confirmation of validity.
|
|
@@ -697,7 +697,7 @@ Compiles TypeScript to JavaScript in the `dist/` directory.
|
|
|
697
697
|
- Markdown files for XanoScript language reference
|
|
698
698
|
- Configured in `src/xanoscript_docs/docs_index.json` with:
|
|
699
699
|
- **file**: The markdown file containing the documentation
|
|
700
|
-
- **applyTo**: Glob patterns for context-aware matching (e.g., `
|
|
700
|
+
- **applyTo**: Glob patterns for context-aware matching (e.g., `api/**/*.xs`)
|
|
701
701
|
- **description**: Human-readable description of the topic
|
|
702
702
|
- **aliases**: Alternative names for topic lookup
|
|
703
703
|
- **priority**: Ordering weight for file_path matching
|
package/dist/tools/index.test.js
CHANGED
|
@@ -24,7 +24,7 @@ describe("handleTool", () => {
|
|
|
24
24
|
expect(result.data).toContain("Documentation version:");
|
|
25
25
|
});
|
|
26
26
|
it("should handle xanoscript_docs with file_path and return multi-content", () => {
|
|
27
|
-
const result = handleTool("xanoscript_docs", { file_path: "
|
|
27
|
+
const result = handleTool("xanoscript_docs", { file_path: "api/users/create.xs" });
|
|
28
28
|
expect(result.success).toBe(true);
|
|
29
29
|
expect(Array.isArray(result.data)).toBe(true);
|
|
30
30
|
const data = result.data;
|
|
@@ -84,11 +84,11 @@ declare const RESERVED_VARIABLES: string[];
|
|
|
84
84
|
* const result = validateXanoscript({ code: 'return 1 + 1' });
|
|
85
85
|
*
|
|
86
86
|
* // Validate a single file
|
|
87
|
-
* const fileResult = validateXanoscript({ file_path: './
|
|
87
|
+
* const fileResult = validateXanoscript({ file_path: './function/utils.xs' });
|
|
88
88
|
*
|
|
89
89
|
* // Validate multiple files
|
|
90
90
|
* const batchResult = validateXanoscript({
|
|
91
|
-
* file_paths: ['./
|
|
91
|
+
* file_paths: ['./api/users/get.xs', './api/users/create.xs']
|
|
92
92
|
* });
|
|
93
93
|
*
|
|
94
94
|
* // Validate all .xs files in a directory
|
|
@@ -97,7 +97,7 @@ declare const RESERVED_VARIABLES: string[];
|
|
|
97
97
|
* // Validate with a specific pattern
|
|
98
98
|
* const patternResult = validateXanoscript({
|
|
99
99
|
* directory: './src',
|
|
100
|
-
* pattern: '
|
|
100
|
+
* pattern: 'api/**\/*.xs'
|
|
101
101
|
* });
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
@@ -245,11 +245,11 @@ function validateCode(code, filePath) {
|
|
|
245
245
|
* const result = validateXanoscript({ code: 'return 1 + 1' });
|
|
246
246
|
*
|
|
247
247
|
* // Validate a single file
|
|
248
|
-
* const fileResult = validateXanoscript({ file_path: './
|
|
248
|
+
* const fileResult = validateXanoscript({ file_path: './function/utils.xs' });
|
|
249
249
|
*
|
|
250
250
|
* // Validate multiple files
|
|
251
251
|
* const batchResult = validateXanoscript({
|
|
252
|
-
* file_paths: ['./
|
|
252
|
+
* file_paths: ['./api/users/get.xs', './api/users/create.xs']
|
|
253
253
|
* });
|
|
254
254
|
*
|
|
255
255
|
* // Validate all .xs files in a directory
|
|
@@ -258,7 +258,7 @@ function validateCode(code, filePath) {
|
|
|
258
258
|
* // Validate with a specific pattern
|
|
259
259
|
* const patternResult = validateXanoscript({
|
|
260
260
|
* directory: './src',
|
|
261
|
-
* pattern: '
|
|
261
|
+
* pattern: 'api/**\/*.xs'
|
|
262
262
|
* });
|
|
263
263
|
* ```
|
|
264
264
|
*/
|
|
@@ -415,23 +415,23 @@ export const validateXanoscriptToolDefinition = {
|
|
|
415
415
|
file_path: {
|
|
416
416
|
type: "string",
|
|
417
417
|
description: "Path to a single XanoScript file to validate. Easier than passing code directly - avoids escaping issues. " +
|
|
418
|
-
"Example: \"
|
|
418
|
+
"Example: \"function/format.xs\"",
|
|
419
419
|
},
|
|
420
420
|
file_paths: {
|
|
421
421
|
type: "array",
|
|
422
422
|
items: { type: "string" },
|
|
423
423
|
description: "Array of file paths for batch validation. Returns a summary with per-file results. " +
|
|
424
|
-
"Example: [\"
|
|
424
|
+
"Example: [\"api/users/get.xs\", \"api/users/create.xs\", \"function/format.xs\"]",
|
|
425
425
|
},
|
|
426
426
|
directory: {
|
|
427
427
|
type: "string",
|
|
428
428
|
description: "Directory path to validate. Validates all .xs files recursively. Use with 'pattern' to filter specific subdirectories or files. " +
|
|
429
|
-
"Example: \"
|
|
429
|
+
"Example: \"api/users\"",
|
|
430
430
|
},
|
|
431
431
|
pattern: {
|
|
432
432
|
type: "string",
|
|
433
433
|
description: "Glob pattern to filter files when using 'directory' (default: \"**/*.xs\"). " +
|
|
434
|
-
"Examples: \"
|
|
434
|
+
"Examples: \"api/**/*.xs\" to match only API files, \"**/create.xs\" to match all create files.",
|
|
435
435
|
},
|
|
436
436
|
},
|
|
437
437
|
required: [],
|
|
@@ -38,7 +38,7 @@ export declare function setXanoscriptDocsPath(path: string): void;
|
|
|
38
38
|
* const syntaxDocs = xanoscriptDocs({ topic: 'syntax' });
|
|
39
39
|
*
|
|
40
40
|
* // Get context-aware docs for a file
|
|
41
|
-
* const fileDocs = xanoscriptDocs({ file_path: '
|
|
41
|
+
* const fileDocs = xanoscriptDocs({ file_path: 'api/users/create.xs' });
|
|
42
42
|
*
|
|
43
43
|
* // Get quick reference only
|
|
44
44
|
* const quickRef = xanoscriptDocs({ topic: 'syntax', mode: 'quick_reference' });
|
|
@@ -66,7 +66,7 @@ export function setXanoscriptDocsPath(path) {
|
|
|
66
66
|
* const syntaxDocs = xanoscriptDocs({ topic: 'syntax' });
|
|
67
67
|
*
|
|
68
68
|
* // Get context-aware docs for a file
|
|
69
|
-
* const fileDocs = xanoscriptDocs({ file_path: '
|
|
69
|
+
* const fileDocs = xanoscriptDocs({ file_path: 'api/users/create.xs' });
|
|
70
70
|
*
|
|
71
71
|
* // Get quick reference only
|
|
72
72
|
* const quickRef = xanoscriptDocs({ topic: 'syntax', mode: 'quick_reference' });
|
|
@@ -173,8 +173,8 @@ export const xanoscriptDocsToolDefinition = {
|
|
|
173
173
|
type: "string",
|
|
174
174
|
description: "File path being edited. Returns all relevant docs automatically based on the file type and location. " +
|
|
175
175
|
"Uses applyTo pattern matching to select applicable topics. " +
|
|
176
|
-
"Example: '
|
|
177
|
-
"'
|
|
176
|
+
"Example: 'api/users/create.xs' returns API, database, and syntax docs. " +
|
|
177
|
+
"'function/format.xs' returns function and syntax docs.",
|
|
178
178
|
},
|
|
179
179
|
mode: {
|
|
180
180
|
type: "string",
|
|
@@ -50,7 +50,7 @@ describe("xanoscriptDocs", () => {
|
|
|
50
50
|
expect(result.documentation).toContain("Documentation version:");
|
|
51
51
|
});
|
|
52
52
|
it("should return context-aware docs for file_path", () => {
|
|
53
|
-
const result = xanoscriptDocs({ file_path: "
|
|
53
|
+
const result = xanoscriptDocs({ file_path: "api/users/create.xs" });
|
|
54
54
|
expect(result.documentation).toContain("XanoScript Documentation for:");
|
|
55
55
|
expect(result.documentation).toContain("Matched topics:");
|
|
56
56
|
});
|
|
@@ -94,12 +94,12 @@ describe("xanoscriptDocsTool", () => {
|
|
|
94
94
|
expect(result.error).toContain("Error retrieving XanoScript documentation");
|
|
95
95
|
});
|
|
96
96
|
it("should return multi-content array for file_path mode", () => {
|
|
97
|
-
const result = xanoscriptDocsTool({ file_path: "
|
|
97
|
+
const result = xanoscriptDocsTool({ file_path: "api/users/create.xs" });
|
|
98
98
|
expect(result.success).toBe(true);
|
|
99
99
|
expect(Array.isArray(result.data)).toBe(true);
|
|
100
100
|
const data = result.data;
|
|
101
101
|
// First element is the header
|
|
102
|
-
expect(data[0]).toContain("XanoScript Documentation for:
|
|
102
|
+
expect(data[0]).toContain("XanoScript Documentation for: api/users/create.xs");
|
|
103
103
|
expect(data[0]).toContain("Matched topics:");
|
|
104
104
|
expect(data[0]).toContain("Version:");
|
|
105
105
|
// Remaining elements are per-topic content
|
|
@@ -118,7 +118,7 @@ describe("xanoscriptDocsTool", () => {
|
|
|
118
118
|
expect(Array.isArray(result.data)).toBe(false);
|
|
119
119
|
});
|
|
120
120
|
it("should produce multiple MCP content blocks for file_path via toMcpResponse", () => {
|
|
121
|
-
const result = xanoscriptDocsTool({ file_path: "
|
|
121
|
+
const result = xanoscriptDocsTool({ file_path: "api/users/create.xs" });
|
|
122
122
|
const mcpResponse = toMcpResponse(result);
|
|
123
123
|
expect(mcpResponse.isError).toBeUndefined();
|
|
124
124
|
// Should have multiple content blocks (header + N topics)
|
|
@@ -136,10 +136,10 @@ describe("xanoscriptDocsTool", () => {
|
|
|
136
136
|
expect(mcpResponse.content[0].type).toBe("text");
|
|
137
137
|
});
|
|
138
138
|
it("should include structuredContent for file_path mode", () => {
|
|
139
|
-
const result = xanoscriptDocsTool({ file_path: "
|
|
139
|
+
const result = xanoscriptDocsTool({ file_path: "api/users/create.xs" });
|
|
140
140
|
expect(result.success).toBe(true);
|
|
141
141
|
expect(result.structuredContent).toBeDefined();
|
|
142
|
-
expect(result.structuredContent).toHaveProperty("file_path", "
|
|
142
|
+
expect(result.structuredContent).toHaveProperty("file_path", "api/users/create.xs");
|
|
143
143
|
expect(result.structuredContent).toHaveProperty("mode", "quick_reference");
|
|
144
144
|
expect(result.structuredContent).toHaveProperty("version");
|
|
145
145
|
expect(result.structuredContent).toHaveProperty("topics");
|
|
@@ -152,7 +152,7 @@ describe("xanoscriptDocsTool", () => {
|
|
|
152
152
|
expect(result.structuredContent).toHaveProperty("documentation");
|
|
153
153
|
});
|
|
154
154
|
it("should include structuredContent in MCP response", () => {
|
|
155
|
-
const result = xanoscriptDocsTool({ file_path: "
|
|
155
|
+
const result = xanoscriptDocsTool({ file_path: "api/users/create.xs" });
|
|
156
156
|
const mcpResponse = toMcpResponse(result);
|
|
157
157
|
expect(mcpResponse.structuredContent).toBeDefined();
|
|
158
158
|
expect(mcpResponse.structuredContent).toHaveProperty("file_path");
|
|
@@ -161,13 +161,13 @@ describe("xanoscriptDocsTool", () => {
|
|
|
161
161
|
});
|
|
162
162
|
describe("xanoscriptDocs structured output", () => {
|
|
163
163
|
it("should include topics array for file_path mode", () => {
|
|
164
|
-
const result = xanoscriptDocs({ file_path: "
|
|
164
|
+
const result = xanoscriptDocs({ file_path: "api/users/create.xs" });
|
|
165
165
|
expect(result.topics).toBeDefined();
|
|
166
166
|
expect(Array.isArray(result.topics)).toBe(true);
|
|
167
167
|
expect(result.topics.length).toBeGreaterThan(0);
|
|
168
168
|
});
|
|
169
169
|
it("should have topic and content fields in each TopicDoc", () => {
|
|
170
|
-
const result = xanoscriptDocs({ file_path: "
|
|
170
|
+
const result = xanoscriptDocs({ file_path: "api/users/create.xs" });
|
|
171
171
|
for (const doc of result.topics) {
|
|
172
172
|
expect(doc).toHaveProperty("topic");
|
|
173
173
|
expect(doc).toHaveProperty("content");
|
|
@@ -186,7 +186,7 @@ describe("xanoscriptDocs structured output", () => {
|
|
|
186
186
|
});
|
|
187
187
|
it("should respect exclude_topics in structured output", () => {
|
|
188
188
|
const result = xanoscriptDocs({
|
|
189
|
-
file_path: "
|
|
189
|
+
file_path: "api/users/create.xs",
|
|
190
190
|
exclude_topics: ["syntax", "essentials"],
|
|
191
191
|
});
|
|
192
192
|
expect(result.topics).toBeDefined();
|
package/dist/xanoscript.test.js
CHANGED
|
@@ -67,8 +67,8 @@ describe("xanoscript module", () => {
|
|
|
67
67
|
const result = getDocsForFilePath("test.xs");
|
|
68
68
|
expect(result).toContain("syntax");
|
|
69
69
|
});
|
|
70
|
-
it("should match
|
|
71
|
-
const result = getDocsForFilePath("
|
|
70
|
+
it("should match api files", () => {
|
|
71
|
+
const result = getDocsForFilePath("api/users/create.xs");
|
|
72
72
|
expect(result).toContain("syntax");
|
|
73
73
|
expect(result).toContain("apis");
|
|
74
74
|
expect(result).toContain("types");
|
|
@@ -77,12 +77,11 @@ describe("xanoscript module", () => {
|
|
|
77
77
|
// Niche topics should NOT be auto-included for apis
|
|
78
78
|
expect(result).not.toContain("addons");
|
|
79
79
|
expect(result).not.toContain("integrations");
|
|
80
|
-
expect(result).not.toContain("realtime");
|
|
81
80
|
expect(result).not.toContain("schema");
|
|
82
81
|
expect(result).not.toContain("streaming");
|
|
83
82
|
});
|
|
84
|
-
it("should match
|
|
85
|
-
const result = getDocsForFilePath("
|
|
83
|
+
it("should match function files", () => {
|
|
84
|
+
const result = getDocsForFilePath("function/format.xs");
|
|
86
85
|
expect(result).toContain("syntax");
|
|
87
86
|
expect(result).toContain("functions");
|
|
88
87
|
expect(result).toContain("types");
|
|
@@ -94,45 +93,44 @@ describe("xanoscript module", () => {
|
|
|
94
93
|
expect(result).not.toContain("schema");
|
|
95
94
|
expect(result).not.toContain("streaming");
|
|
96
95
|
});
|
|
97
|
-
it("should match
|
|
98
|
-
const result = getDocsForFilePath("
|
|
96
|
+
it("should match table files", () => {
|
|
97
|
+
const result = getDocsForFilePath("table/users.xs");
|
|
99
98
|
expect(result).toContain("syntax");
|
|
100
99
|
expect(result).toContain("tables");
|
|
101
100
|
});
|
|
102
|
-
it("should match
|
|
103
|
-
const result = getDocsForFilePath("
|
|
101
|
+
it("should match task files", () => {
|
|
102
|
+
const result = getDocsForFilePath("task/cleanup.xs");
|
|
104
103
|
expect(result).toContain("syntax");
|
|
105
104
|
expect(result).toContain("tasks");
|
|
106
105
|
expect(result).toContain("database");
|
|
107
106
|
// integrations is now topic-only (not auto-included)
|
|
108
107
|
expect(result).not.toContain("integrations");
|
|
109
108
|
});
|
|
110
|
-
it("should match
|
|
111
|
-
const result = getDocsForFilePath("
|
|
109
|
+
it("should match trigger files", () => {
|
|
110
|
+
const result = getDocsForFilePath("table/trigger/on_create.xs");
|
|
112
111
|
expect(result).toContain("syntax");
|
|
113
112
|
expect(result).toContain("triggers");
|
|
114
|
-
expect(result).toContain("realtime");
|
|
115
113
|
});
|
|
116
|
-
it("should match
|
|
117
|
-
const result = getDocsForFilePath("
|
|
114
|
+
it("should match ai/agent files", () => {
|
|
115
|
+
const result = getDocsForFilePath("ai/agent/support_bot.xs");
|
|
118
116
|
expect(result).toContain("syntax");
|
|
119
117
|
expect(result).toContain("agents");
|
|
120
118
|
expect(result).toContain("types");
|
|
121
119
|
});
|
|
122
|
-
it("should match
|
|
123
|
-
const result = getDocsForFilePath("
|
|
120
|
+
it("should match ai/tool files", () => {
|
|
121
|
+
const result = getDocsForFilePath("ai/tool/search_docs.xs");
|
|
124
122
|
expect(result).toContain("syntax");
|
|
125
123
|
expect(result).toContain("tools");
|
|
126
124
|
expect(result).toContain("types");
|
|
127
125
|
expect(result).toContain("database");
|
|
128
126
|
});
|
|
129
|
-
it("should match
|
|
130
|
-
const result = getDocsForFilePath("
|
|
127
|
+
it("should match ai/mcp_server files", () => {
|
|
128
|
+
const result = getDocsForFilePath("ai/mcp_server/my_server.xs");
|
|
131
129
|
expect(result).toContain("syntax");
|
|
132
130
|
expect(result).toContain("mcp-servers");
|
|
133
131
|
});
|
|
134
132
|
it("should match middleware files", () => {
|
|
135
|
-
const result = getDocsForFilePath("middleware/
|
|
133
|
+
const result = getDocsForFilePath("middleware/auth_check.xs");
|
|
136
134
|
expect(result).toContain("syntax");
|
|
137
135
|
expect(result).toContain("middleware");
|
|
138
136
|
});
|
|
@@ -156,7 +154,7 @@ describe("xanoscript module", () => {
|
|
|
156
154
|
expect(result).toContain("run");
|
|
157
155
|
});
|
|
158
156
|
it("should not include readme automatically", () => {
|
|
159
|
-
const result = getDocsForFilePath("
|
|
157
|
+
const result = getDocsForFilePath("api/test.xs");
|
|
160
158
|
expect(result).not.toContain("readme");
|
|
161
159
|
});
|
|
162
160
|
it("should include syntax and essentials for .xs files", () => {
|
|
@@ -257,9 +255,9 @@ Even more content.
|
|
|
257
255
|
});
|
|
258
256
|
it("should return context-aware docs for file_path", () => {
|
|
259
257
|
const result = readXanoscriptDocsV2(DOCS_PATH, {
|
|
260
|
-
file_path: "
|
|
258
|
+
file_path: "api/users/create.xs",
|
|
261
259
|
});
|
|
262
|
-
expect(result).toContain("XanoScript Documentation for:
|
|
260
|
+
expect(result).toContain("XanoScript Documentation for: api/users/create.xs");
|
|
263
261
|
expect(result).toContain("Matched topics:");
|
|
264
262
|
expect(result).toContain("Version:");
|
|
265
263
|
});
|
|
@@ -277,18 +275,18 @@ Even more content.
|
|
|
277
275
|
});
|
|
278
276
|
it("should support quick_reference mode for file_path", () => {
|
|
279
277
|
const fullResult = readXanoscriptDocsV2(DOCS_PATH, {
|
|
280
|
-
file_path: "
|
|
278
|
+
file_path: "api/test.xs",
|
|
281
279
|
mode: "full",
|
|
282
280
|
});
|
|
283
281
|
const quickResult = readXanoscriptDocsV2(DOCS_PATH, {
|
|
284
|
-
file_path: "
|
|
282
|
+
file_path: "api/test.xs",
|
|
285
283
|
mode: "quick_reference",
|
|
286
284
|
});
|
|
287
285
|
expect(quickResult).toContain("Mode: quick_reference");
|
|
288
286
|
});
|
|
289
287
|
it("should default to quick_reference mode for file_path", () => {
|
|
290
288
|
const result = readXanoscriptDocsV2(DOCS_PATH, {
|
|
291
|
-
file_path: "
|
|
289
|
+
file_path: "api/test.xs",
|
|
292
290
|
});
|
|
293
291
|
expect(result).toContain("Mode: quick_reference");
|
|
294
292
|
});
|
|
@@ -299,7 +297,7 @@ Even more content.
|
|
|
299
297
|
});
|
|
300
298
|
it("should support exclude_topics with file_path", () => {
|
|
301
299
|
const result = readXanoscriptDocsV2(DOCS_PATH, {
|
|
302
|
-
file_path: "
|
|
300
|
+
file_path: "api/users/create.xs",
|
|
303
301
|
exclude_topics: ["syntax", "essentials"],
|
|
304
302
|
});
|
|
305
303
|
expect(result).toContain("Matched topics:");
|
|
@@ -376,7 +374,7 @@ Even more content.
|
|
|
376
374
|
describe("readXanoscriptDocsStructured", () => {
|
|
377
375
|
it("should return array of TopicDoc objects", () => {
|
|
378
376
|
const result = readXanoscriptDocsStructured(DOCS_PATH, {
|
|
379
|
-
file_path: "
|
|
377
|
+
file_path: "api/users/create.xs",
|
|
380
378
|
});
|
|
381
379
|
expect(Array.isArray(result)).toBe(true);
|
|
382
380
|
expect(result.length).toBeGreaterThan(0);
|
|
@@ -388,7 +386,7 @@ Even more content.
|
|
|
388
386
|
}
|
|
389
387
|
});
|
|
390
388
|
it("should match the same topics as getDocsForFilePath", () => {
|
|
391
|
-
const filePath = "
|
|
389
|
+
const filePath = "api/users/create.xs";
|
|
392
390
|
const expected = getDocsForFilePath(filePath);
|
|
393
391
|
const result = readXanoscriptDocsStructured(DOCS_PATH, { file_path: filePath });
|
|
394
392
|
const resultTopics = result.map((d) => d.topic);
|
|
@@ -396,7 +394,7 @@ Even more content.
|
|
|
396
394
|
});
|
|
397
395
|
it("should respect exclude_topics", () => {
|
|
398
396
|
const result = readXanoscriptDocsStructured(DOCS_PATH, {
|
|
399
|
-
file_path: "
|
|
397
|
+
file_path: "api/users/create.xs",
|
|
400
398
|
exclude_topics: ["syntax", "essentials"],
|
|
401
399
|
});
|
|
402
400
|
const topics = result.map((d) => d.topic);
|
|
@@ -411,10 +409,10 @@ Even more content.
|
|
|
411
409
|
});
|
|
412
410
|
it("should use quick_reference mode by default", () => {
|
|
413
411
|
const quickResult = readXanoscriptDocsStructured(DOCS_PATH, {
|
|
414
|
-
file_path: "
|
|
412
|
+
file_path: "table/users.xs",
|
|
415
413
|
});
|
|
416
414
|
const fullResult = readXanoscriptDocsStructured(DOCS_PATH, {
|
|
417
|
-
file_path: "
|
|
415
|
+
file_path: "table/users.xs",
|
|
418
416
|
mode: "full",
|
|
419
417
|
});
|
|
420
418
|
// Quick reference content should be shorter than full
|
|
@@ -4,26 +4,27 @@ XanoScript is the declarative scripting language for [Xano](https://xano.com), a
|
|
|
4
4
|
|
|
5
5
|
## Quick Reference
|
|
6
6
|
|
|
7
|
-
| Construct | File Location
|
|
8
|
-
| ------------------- |
|
|
9
|
-
| `workspace` | `workspace/{name}.xs`
|
|
10
|
-
| `workspace_trigger` | `workspace/trigger/{name}.xs`
|
|
11
|
-
| `table` | `table/{name}.xs`
|
|
12
|
-
| `table_trigger` | `table/trigger/{name}.xs`
|
|
13
|
-
| `api_group` | `api/{group}/api_group.xs`
|
|
14
|
-
| `query` | `api/{group}/{endpoint}_{verb}.xs`
|
|
15
|
-
| `function` | `function/{name}.xs`
|
|
16
|
-
| `task` | `task/{name}.xs`
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
7
|
+
| Construct | File Location | Purpose |
|
|
8
|
+
| ------------------- | -------------------------------------- | ----------------------------- |
|
|
9
|
+
| `workspace` | `workspace/{name}.xs` | Workspace-level configuration |
|
|
10
|
+
| `workspace_trigger` | `workspace/trigger/{name}.xs` | Workspace event handlers |
|
|
11
|
+
| `table` | `table/{name}.xs` | Database schema definition |
|
|
12
|
+
| `table_trigger` | `table/trigger/{name}.xs` | Table event handlers |
|
|
13
|
+
| `api_group` | `api/{group}/api_group.xs` | API group definition |
|
|
14
|
+
| `query` | `api/{group}/{endpoint}_{verb}.xs` | HTTP API endpoints |
|
|
15
|
+
| `function` | `function/{path}/{name}.xs` | Reusable logic blocks |
|
|
16
|
+
| `task` | `task/{name}.xs` | Scheduled/cron jobs |
|
|
17
|
+
| `addon` | `addon/{name}.xs` | Subqueries for related data |
|
|
18
|
+
| `middleware` | `middleware/{name}.xs` | Request/response interceptors |
|
|
19
|
+
| `agent` | `ai/agent/{name}.xs` | AI-powered agents |
|
|
20
|
+
| `agent_trigger` | `ai/agent/trigger/{name}.xs` | Agent event handlers |
|
|
21
|
+
| `tool` | `ai/tool/{name}.xs` | Tools for AI agents |
|
|
22
|
+
| `mcp_server` | `ai/mcp_server/{name}.xs` | MCP server definitions |
|
|
23
|
+
| `mcp_server_trigger`| `ai/mcp_server/trigger/{name}.xs` | MCP server event handlers |
|
|
24
|
+
| `workflow_test` | `workflow_test/{name}.xs` | End-to-end workflow tests |
|
|
25
|
+
| `realtime_channel` | `realtime/channel/{name}.xs` | Realtime channel settings |
|
|
26
|
+
| `realtime_trigger` | `realtime/trigger/{name}.xs` | Realtime event handlers |
|
|
27
|
+
| `branch` | `branch.xs` | Branch-level configuration |
|
|
27
28
|
|
|
28
29
|
**Naming convention:** All folder and file names use `snake_case` (e.g., `user_profile.xs`, `get_all_users_get.xs`).
|
|
29
30
|
|
|
@@ -56,22 +57,28 @@ project/
|
|
|
56
57
|
│ ├── users.xs # Table schema
|
|
57
58
|
│ └── trigger/
|
|
58
59
|
│ └── on_user_create.xs # Table triggers
|
|
59
|
-
├──
|
|
60
|
-
│ ├──
|
|
61
|
-
│
|
|
62
|
-
│
|
|
63
|
-
|
|
64
|
-
│
|
|
65
|
-
|
|
66
|
-
│
|
|
67
|
-
│
|
|
68
|
-
│ └──
|
|
60
|
+
├── ai/
|
|
61
|
+
│ ├── agent/
|
|
62
|
+
│ │ ├── support_bot.xs # AI agents
|
|
63
|
+
│ │ └── trigger/
|
|
64
|
+
│ │ └── on_message.xs # Agent triggers
|
|
65
|
+
│ ├── tool/
|
|
66
|
+
│ │ └── search_docs.xs # AI tools
|
|
67
|
+
│ └── mcp_server/
|
|
68
|
+
│ ├── my_server.xs # MCP server definitions
|
|
69
|
+
│ └── trigger/
|
|
70
|
+
│ └── on_connect.xs # MCP server triggers
|
|
69
71
|
├── workflow_test/
|
|
70
72
|
│ └── checkout_flow.xs # End-to-end workflow tests
|
|
71
73
|
├── middleware/
|
|
72
74
|
│ └── auth_check.xs # Request/response interceptors
|
|
73
75
|
├── addon/
|
|
74
76
|
│ └── user_posts.xs # Query addons
|
|
77
|
+
├── realtime/
|
|
78
|
+
│ ├── channel/
|
|
79
|
+
│ │ └── chat_room.xs # Realtime channels
|
|
80
|
+
│ └── trigger/
|
|
81
|
+
│ └── on_message.xs # Realtime triggers
|
|
75
82
|
├── static/ # Frontend files (HTML, CSS, JS)
|
|
76
83
|
└── run/ # Job and service configurations
|
|
77
84
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
applyTo: "agent
|
|
2
|
+
applyTo: "ai/agent/*.xs"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Agents
|
|
@@ -190,7 +190,7 @@ agent "Classifier" {
|
|
|
190
190
|
|
|
191
191
|
## Tools
|
|
192
192
|
|
|
193
|
-
Reference tools by name from `tool/` directory:
|
|
193
|
+
Reference tools by name from `ai/tool/` directory:
|
|
194
194
|
|
|
195
195
|
```xs
|
|
196
196
|
tools = [
|
|
@@ -58,83 +58,83 @@
|
|
|
58
58
|
"types": {
|
|
59
59
|
"file": "types.md",
|
|
60
60
|
"description": "Data types, input blocks, and validation",
|
|
61
|
-
"applyTo": ["
|
|
61
|
+
"applyTo": ["function/**/*.xs", "api/**/*.xs", "ai/tool/*.xs", "ai/agent/*.xs"],
|
|
62
62
|
"priority": 4,
|
|
63
63
|
"aliases": ["validation", "input", "data-types"]
|
|
64
64
|
},
|
|
65
65
|
"tables": {
|
|
66
66
|
"file": "tables.md",
|
|
67
67
|
"description": "Database schema definitions with indexes and relationships",
|
|
68
|
-
"applyTo": ["
|
|
68
|
+
"applyTo": ["table/*.xs"],
|
|
69
69
|
"priority": 8,
|
|
70
70
|
"aliases": ["schema", "fields", "indexes"]
|
|
71
71
|
},
|
|
72
72
|
"functions": {
|
|
73
73
|
"file": "functions.md",
|
|
74
74
|
"description": "Reusable function stacks with inputs and responses",
|
|
75
|
-
"applyTo": ["
|
|
75
|
+
"applyTo": ["function/**/*.xs"],
|
|
76
76
|
"priority": 6,
|
|
77
77
|
"aliases": ["fn", "reusable", "stack"]
|
|
78
78
|
},
|
|
79
79
|
"apis": {
|
|
80
80
|
"file": "apis.md",
|
|
81
81
|
"description": "HTTP endpoint definitions with authentication and CRUD patterns",
|
|
82
|
-
"applyTo": ["
|
|
82
|
+
"applyTo": ["api/**/*.xs"],
|
|
83
83
|
"priority": 7,
|
|
84
84
|
"aliases": ["endpoints", "http", "rest", "query"]
|
|
85
85
|
},
|
|
86
86
|
"tasks": {
|
|
87
87
|
"file": "tasks.md",
|
|
88
88
|
"description": "Scheduled and cron jobs",
|
|
89
|
-
"applyTo": ["
|
|
89
|
+
"applyTo": ["task/*.xs"],
|
|
90
90
|
"priority": 10,
|
|
91
91
|
"aliases": ["scheduled", "jobs", "cron"]
|
|
92
92
|
},
|
|
93
93
|
"triggers": {
|
|
94
94
|
"file": "triggers.md",
|
|
95
95
|
"description": "Event-driven handlers (table, realtime, workspace, agent, MCP)",
|
|
96
|
-
"applyTo": ["
|
|
96
|
+
"applyTo": ["*/trigger/*.xs", "ai/*/trigger/*.xs", "realtime/trigger/*.xs"],
|
|
97
97
|
"priority": 10,
|
|
98
98
|
"aliases": ["events", "hooks", "handlers"]
|
|
99
99
|
},
|
|
100
100
|
"database": {
|
|
101
101
|
"file": "database.md",
|
|
102
102
|
"description": "All db.* operations: query, get, add, edit, patch, delete",
|
|
103
|
-
"applyTo": ["
|
|
103
|
+
"applyTo": ["function/**/*.xs", "api/**/*.xs", "task/*.xs", "ai/tool/*.xs"],
|
|
104
104
|
"priority": 5,
|
|
105
105
|
"aliases": ["db", "crud", "query", "sql"]
|
|
106
106
|
},
|
|
107
107
|
"agents": {
|
|
108
108
|
"file": "agents.md",
|
|
109
109
|
"description": "AI agent configuration with LLM providers and tools",
|
|
110
|
-
"applyTo": ["
|
|
110
|
+
"applyTo": ["ai/agent/*.xs"],
|
|
111
111
|
"priority": 12,
|
|
112
112
|
"aliases": ["ai", "llm", "chatbot"]
|
|
113
113
|
},
|
|
114
114
|
"tools": {
|
|
115
115
|
"file": "tools.md",
|
|
116
116
|
"description": "AI tools for agents and MCP servers",
|
|
117
|
-
"applyTo": ["
|
|
117
|
+
"applyTo": ["ai/tool/*.xs"],
|
|
118
118
|
"priority": 12,
|
|
119
119
|
"aliases": ["ai-tools", "agent-tools"]
|
|
120
120
|
},
|
|
121
121
|
"mcp-servers": {
|
|
122
122
|
"file": "mcp-servers.md",
|
|
123
123
|
"description": "MCP server definitions exposing tools",
|
|
124
|
-
"applyTo": ["
|
|
124
|
+
"applyTo": ["ai/mcp_server/*.xs"],
|
|
125
125
|
"priority": 15,
|
|
126
126
|
"aliases": ["mcp", "model-context-protocol"]
|
|
127
127
|
},
|
|
128
128
|
"unit-testing": {
|
|
129
129
|
"file": "unit-testing.md",
|
|
130
130
|
"description": "Unit tests, mocks, and assertions within functions, APIs, and middleware",
|
|
131
|
-
"applyTo": ["
|
|
131
|
+
"applyTo": ["function/**/*.xs", "api/**/*.xs", "middleware/*.xs"],
|
|
132
132
|
"aliases": ["tests", "unit-tests", "mocks", "assertions"]
|
|
133
133
|
},
|
|
134
134
|
"workflow-tests": {
|
|
135
135
|
"file": "workflow-tests.md",
|
|
136
136
|
"description": "End-to-end workflow tests with data source selection and tags",
|
|
137
|
-
"applyTo": ["workflow_test
|
|
137
|
+
"applyTo": ["workflow_test/*.xs"],
|
|
138
138
|
"aliases": ["e2e", "workflow", "integration-tests"]
|
|
139
139
|
},
|
|
140
140
|
"integrations": {
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
"addons": {
|
|
189
189
|
"file": "addons.md",
|
|
190
190
|
"description": "Reusable subqueries for fetching related data",
|
|
191
|
-
"applyTo": ["
|
|
191
|
+
"applyTo": ["addon/*.xs"],
|
|
192
192
|
"aliases": ["subqueries", "relations"]
|
|
193
193
|
},
|
|
194
194
|
"debugging": {
|
|
@@ -200,13 +200,13 @@
|
|
|
200
200
|
"performance": {
|
|
201
201
|
"file": "performance.md",
|
|
202
202
|
"description": "Performance optimization best practices",
|
|
203
|
-
"applyTo": ["
|
|
203
|
+
"applyTo": ["function/**/*.xs", "api/**/*.xs"],
|
|
204
204
|
"aliases": ["optimization", "speed", "caching"]
|
|
205
205
|
},
|
|
206
206
|
"realtime": {
|
|
207
207
|
"file": "realtime.md",
|
|
208
208
|
"description": "Real-time channels and events for push updates",
|
|
209
|
-
"applyTo": ["
|
|
209
|
+
"applyTo": ["realtime/channel/*.xs", "realtime/trigger/*.xs"],
|
|
210
210
|
"aliases": ["websocket", "channels", "pubsub"]
|
|
211
211
|
},
|
|
212
212
|
"schema": {
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
"security": {
|
|
219
219
|
"file": "security.md",
|
|
220
220
|
"description": "Security best practices for authentication and authorization",
|
|
221
|
-
"applyTo": ["
|
|
221
|
+
"applyTo": ["function/**/*.xs", "api/**/*.xs"],
|
|
222
222
|
"aliases": ["auth", "authorization", "permissions"]
|
|
223
223
|
},
|
|
224
224
|
"streaming": {
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
"middleware": {
|
|
231
231
|
"file": "middleware.md",
|
|
232
232
|
"description": "Request/response interceptors for functions, queries, tasks, and tools",
|
|
233
|
-
"applyTo": ["middleware
|
|
233
|
+
"applyTo": ["middleware/*.xs"],
|
|
234
234
|
"aliases": ["interceptors", "hooks"]
|
|
235
235
|
},
|
|
236
236
|
"branch": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
applyTo: "mcp_server
|
|
2
|
+
applyTo: "ai/mcp_server/*.xs"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# MCP Servers
|
|
@@ -52,7 +52,7 @@ mcp_server "Customer Support" {
|
|
|
52
52
|
|
|
53
53
|
## Tools Block
|
|
54
54
|
|
|
55
|
-
Reference tools from `tool/` directory by name:
|
|
55
|
+
Reference tools from `ai/tool/` directory by name:
|
|
56
56
|
|
|
57
57
|
```xs
|
|
58
58
|
tools = [
|
|
@@ -62,7 +62,7 @@ tools = [
|
|
|
62
62
|
]
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
Tool names must exactly match `.xs` file names in `tool/`.
|
|
65
|
+
Tool names must exactly match `.xs` file names in `ai/tool/`.
|
|
66
66
|
|
|
67
67
|
---
|
|
68
68
|
|
|
@@ -146,7 +146,7 @@ mcp_server "CRM" {
|
|
|
146
146
|
|
|
147
147
|
### By Domain
|
|
148
148
|
```
|
|
149
|
-
mcp_server/
|
|
149
|
+
ai/mcp_server/
|
|
150
150
|
├── support.xs # Customer support tools
|
|
151
151
|
├── ecommerce.xs # Store management
|
|
152
152
|
├── analytics.xs # Reporting and metrics
|
|
@@ -155,7 +155,7 @@ mcp_server/
|
|
|
155
155
|
|
|
156
156
|
### By Access Level
|
|
157
157
|
```
|
|
158
|
-
mcp_server/
|
|
158
|
+
ai/mcp_server/
|
|
159
159
|
├── public.xs # Public-facing tools
|
|
160
160
|
├── authenticated.xs # Requires auth
|
|
161
161
|
└── admin.xs # Admin-only tools
|
package/package.json
CHANGED