@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,128 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { topics, getTopicNames, getTopicDescriptions, handleMetaApiDocs, metaApiDocsToolDefinition, } from "./index.js";
3
- describe("meta_api_docs/index", () => {
4
- describe("topics", () => {
5
- it("should have all expected topics", () => {
6
- const expectedTopics = [
7
- "start",
8
- "authentication",
9
- "workspace",
10
- "apigroup",
11
- "api",
12
- "table",
13
- "function",
14
- "task",
15
- "agent",
16
- "tool",
17
- "mcp_server",
18
- "middleware",
19
- "branch",
20
- "realtime",
21
- "file",
22
- "history",
23
- "workflows",
24
- ];
25
- expect(Object.keys(topics)).toEqual(expectedTopics);
26
- });
27
- it("should have valid TopicDoc structure for each topic", () => {
28
- for (const [key, doc] of Object.entries(topics)) {
29
- expect(doc).toHaveProperty("topic");
30
- expect(doc).toHaveProperty("title");
31
- expect(doc).toHaveProperty("description");
32
- expect(typeof doc.topic).toBe("string");
33
- expect(typeof doc.title).toBe("string");
34
- expect(typeof doc.description).toBe("string");
35
- expect(doc.topic).toBe(key);
36
- }
37
- });
38
- });
39
- describe("getTopicNames", () => {
40
- it("should return all topic names", () => {
41
- const names = getTopicNames();
42
- expect(names).toEqual(Object.keys(topics));
43
- });
44
- it("should return an array of strings", () => {
45
- const names = getTopicNames();
46
- expect(Array.isArray(names)).toBe(true);
47
- names.forEach((name) => {
48
- expect(typeof name).toBe("string");
49
- });
50
- });
51
- });
52
- describe("getTopicDescriptions", () => {
53
- it("should return formatted topic descriptions", () => {
54
- const descriptions = getTopicDescriptions();
55
- expect(typeof descriptions).toBe("string");
56
- expect(descriptions).toContain("- start:");
57
- expect(descriptions).toContain("- workspace:");
58
- expect(descriptions).toContain("- api:");
59
- });
60
- it("should include all topics", () => {
61
- const descriptions = getTopicDescriptions();
62
- for (const key of Object.keys(topics)) {
63
- expect(descriptions).toContain(`- ${key}:`);
64
- }
65
- });
66
- });
67
- describe("handleMetaApiDocs", () => {
68
- it("should return error for unknown topic", () => {
69
- const result = handleMetaApiDocs({ topic: "nonexistent" });
70
- expect(result).toContain('Error: Unknown topic "nonexistent"');
71
- expect(result).toContain("Available topics:");
72
- });
73
- it("should return documentation for valid topic", () => {
74
- const result = handleMetaApiDocs({ topic: "start" });
75
- expect(result).toContain("Xano Meta API - Getting Started");
76
- expect(result).not.toContain("Error:");
77
- });
78
- it("should use default detail_level of detailed", () => {
79
- const result = handleMetaApiDocs({ topic: "start" });
80
- expect(result).toContain("Examples");
81
- });
82
- it("should respect overview detail_level", () => {
83
- const result = handleMetaApiDocs({
84
- topic: "start",
85
- detail_level: "overview",
86
- });
87
- expect(result).toContain("Xano Meta API");
88
- });
89
- it("should respect examples detail_level", () => {
90
- const result = handleMetaApiDocs({
91
- topic: "start",
92
- detail_level: "examples",
93
- });
94
- expect(result).toContain("Examples");
95
- });
96
- it("should include schemas by default", () => {
97
- const result = handleMetaApiDocs({ topic: "workspace" });
98
- // Schemas may or may not be present depending on the topic
99
- expect(typeof result).toBe("string");
100
- });
101
- it("should respect include_schemas=false", () => {
102
- const result = handleMetaApiDocs({
103
- topic: "workspace",
104
- include_schemas: false,
105
- });
106
- expect(typeof result).toBe("string");
107
- });
108
- });
109
- describe("metaApiDocsToolDefinition", () => {
110
- it("should have required tool properties", () => {
111
- expect(metaApiDocsToolDefinition).toHaveProperty("name", "meta_api_docs");
112
- expect(metaApiDocsToolDefinition).toHaveProperty("description");
113
- expect(metaApiDocsToolDefinition).toHaveProperty("inputSchema");
114
- });
115
- it("should have valid inputSchema", () => {
116
- const schema = metaApiDocsToolDefinition.inputSchema;
117
- expect(schema.type).toBe("object");
118
- expect(schema.properties).toHaveProperty("topic");
119
- expect(schema.properties).toHaveProperty("detail_level");
120
- expect(schema.properties).toHaveProperty("include_schemas");
121
- expect(schema.required).toEqual(["topic"]);
122
- });
123
- it("should include all topic names in enum", () => {
124
- const topicEnum = metaApiDocsToolDefinition.inputSchema.properties.topic.enum;
125
- expect(topicEnum).toEqual(getTopicNames());
126
- });
127
- });
128
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,132 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- describe("meta_api_docs/types", () => {
3
- describe("type structures", () => {
4
- it("should allow valid HttpMethod values", () => {
5
- const methods = ["GET", "POST", "PUT", "PATCH", "DELETE"];
6
- expect(methods).toHaveLength(5);
7
- });
8
- it("should allow valid ParameterDoc structure", () => {
9
- const param = {
10
- name: "id",
11
- type: "integer",
12
- required: true,
13
- default: 1,
14
- description: "The ID",
15
- enum: ["a", "b"],
16
- in: "path",
17
- };
18
- expect(param.name).toBe("id");
19
- expect(param.in).toBe("path");
20
- });
21
- it("should allow minimal ParameterDoc", () => {
22
- const param = {
23
- name: "test",
24
- type: "string",
25
- description: "A test parameter",
26
- };
27
- expect(param.required).toBeUndefined();
28
- });
29
- it("should allow valid RequestBodyDoc structure", () => {
30
- const body = {
31
- type: "object",
32
- description: "Request body",
33
- properties: {
34
- name: { type: "string", required: true, description: "Name" },
35
- },
36
- example: { name: "test" },
37
- };
38
- expect(body.type).toBe("object");
39
- });
40
- it("should allow valid ResponseDoc structure", () => {
41
- const response = {
42
- type: "object",
43
- description: "Response",
44
- properties: { id: { type: "integer" } },
45
- };
46
- expect(response.type).toBe("object");
47
- });
48
- it("should allow valid RequestExampleDoc structure", () => {
49
- const example = {
50
- method: "POST",
51
- path: "/test",
52
- headers: { "Content-Type": "application/json" },
53
- body: { data: "test" },
54
- };
55
- expect(example.method).toBe("POST");
56
- });
57
- it("should allow valid EndpointDoc structure", () => {
58
- const endpoint = {
59
- method: "GET",
60
- path: "/test/{id}",
61
- tool_name: "get_test",
62
- description: "Get a test",
63
- tags: ["test", "example"],
64
- parameters: [
65
- { name: "id", type: "integer", description: "ID" },
66
- ],
67
- request_body: { type: "object" },
68
- response: { type: "object" },
69
- example: { method: "GET", path: "/test/1" },
70
- };
71
- expect(endpoint.method).toBe("GET");
72
- expect(endpoint.tags).toContain("test");
73
- });
74
- it("should allow valid ExampleDoc structure", () => {
75
- const example = {
76
- title: "Example Title",
77
- description: "Example description",
78
- request: {
79
- method: "GET",
80
- path: "/test",
81
- headers: { Authorization: "Bearer token" },
82
- body: undefined,
83
- },
84
- response: { success: true },
85
- };
86
- expect(example.title).toBe("Example Title");
87
- });
88
- it("should allow valid PatternDoc structure", () => {
89
- const pattern = {
90
- name: "Workflow Name",
91
- description: "Workflow description",
92
- steps: ["Step 1", "Step 2"],
93
- example: "example code",
94
- };
95
- expect(pattern.steps).toHaveLength(2);
96
- });
97
- it("should allow valid TopicDoc structure", () => {
98
- const topic = {
99
- topic: "test",
100
- title: "Test Topic",
101
- description: "Test description",
102
- endpoints: [],
103
- examples: [],
104
- related_topics: ["other"],
105
- schemas: { TestSchema: {} },
106
- patterns: [],
107
- ai_hints: "AI hints here",
108
- };
109
- expect(topic.topic).toBe("test");
110
- expect(topic.ai_hints).toBeDefined();
111
- });
112
- it("should allow valid DetailLevel values", () => {
113
- const levels = ["overview", "detailed", "examples"];
114
- expect(levels).toHaveLength(3);
115
- });
116
- it("should allow valid MetaApiDocsArgs structure", () => {
117
- const args = {
118
- topic: "start",
119
- detail_level: "detailed",
120
- include_schemas: true,
121
- };
122
- expect(args.topic).toBe("start");
123
- });
124
- it("should allow minimal MetaApiDocsArgs", () => {
125
- const args = {
126
- topic: "start",
127
- };
128
- expect(args.detail_level).toBeUndefined();
129
- expect(args.include_schemas).toBeUndefined();
130
- });
131
- });
132
- });
@@ -1,10 +0,0 @@
1
- /**
2
- * Template for init_workspace tool documentation
3
- * Edit this file to update the workspace initialization guide
4
- */
5
- export interface ObjectTypeConfig {
6
- type: string;
7
- path: string;
8
- endpoint: string;
9
- }
10
- export declare function generateInitWorkspaceTemplate(objectTypes: ObjectTypeConfig[]): string;
@@ -1,278 +0,0 @@
1
- /**
2
- * Template for init_workspace tool documentation
3
- * Edit this file to update the workspace initialization guide
4
- */
5
- export function generateInitWorkspaceTemplate(objectTypes) {
6
- const objectTypesTable = objectTypes
7
- .map(({ type, path, endpoint }) => `| \`${type}\` | \`${path}/\` | \`${endpoint}\` |`)
8
- .join("\n");
9
- return `# Xano Workspace Initialization Guide
10
-
11
- This guide explains how to set up a local development workspace that syncs with the Xano Headless API.
12
-
13
- ## Directory Structure
14
-
15
- Initialize your workspace with these directories:
16
-
17
- \`\`\`
18
- your-project/
19
- ├── .xano/
20
- │ └── registry.json # Tracks all objects and their sync state
21
- ├── functions/ # Custom reusable functions
22
- │ ├── calculate_total.xs
23
- │ └── validate_email.xs
24
- ├── tables/ # Database table schemas
25
- │ ├── user.xs
26
- │ └── order.xs
27
- ├── tasks/ # Scheduled background tasks
28
- │ └── cleanup_sessions.xs
29
- ├── apis/ # API groups and endpoints
30
- │ └── auth/ # API group directory
31
- │ ├── api_group.xs # Group definition
32
- │ ├── POST_login.xs # Endpoint: POST /auth/login
33
- │ └── GET_me.xs # Endpoint: GET /auth/me
34
- ├── tools/ # AI-callable tools
35
- ├── agents/ # AI agents
36
- ├── middlewares/ # Request/response middleware
37
- ├── addons/ # Query addons
38
- ├── mcp_servers/ # MCP servers
39
- └── realtime/ # Realtime channels
40
- \`\`\`
41
-
42
- ## Object Types
43
-
44
- | Type | Directory | API Endpoint |
45
- |------|-----------|--------------|
46
- ${objectTypesTable}
47
-
48
- ## File Naming Convention
49
-
50
- Files should follow snake_case naming with the \`.xs\` extension:
51
- - \`{name}.xs\` - Basic format (e.g., \`calculate_total.xs\`)
52
- - \`{id}_{name}.xs\` - With ID prefix for disambiguation (e.g., \`42_calculate_total.xs\`)
53
- - API endpoints: \`{VERB}_{path}.xs\` (e.g., \`POST_login.xs\`, \`GET_users_id.xs\`)
54
-
55
- ## Registry Format
56
-
57
- The \`.xano/registry.json\` file tracks the sync state between local files and the Xano API:
58
-
59
- \`\`\`json
60
- {
61
- "workspace_id": 12345,
62
- "workspace_name": "My Project",
63
- "branch": "",
64
- "base_url": "https://your-instance.xano.io/api:headless",
65
- "created_at": "2025-01-15T10:30:00Z",
66
- "updated_at": "2025-01-15T10:30:00Z",
67
- "objects": [
68
- {
69
- "id": 1,
70
- "type": "function",
71
- "name": "calculate_total",
72
- "path": "functions/calculate_total.xs",
73
- "sha256": "abc123...",
74
- "status": "unchanged",
75
- "original": "ZnVuY3Rpb24gY2FsY3VsYXRlX3RvdGFsIHsgLi4uIH0=",
76
- "updated_at": "2025-01-15T10:30:00Z"
77
- },
78
- {
79
- "id": 0,
80
- "type": "function",
81
- "name": "new_function",
82
- "path": "functions/new_function.xs",
83
- "status": "new"
84
- }
85
- ]
86
- }
87
- \`\`\`
88
-
89
- ### Registry Record Fields
90
-
91
- | Field | Description |
92
- |-------|-------------|
93
- | \`id\` | Xano object ID (0 = new, not yet synced) |
94
- | \`type\` | Object type (function, table, task, etc.) |
95
- | \`name\` | Object name extracted from XanoScript |
96
- | \`path\` | Relative file path from workspace root |
97
- | \`sha256\` | SHA256 hash of file content for change detection |
98
- | \`status\` | Sync status: "new", "unchanged", "changed", "deleted" |
99
- | \`original\` | Base64-encoded original content (for conflict detection) |
100
- | \`updated_at\` | Last sync timestamp |
101
-
102
- ### Status Values
103
-
104
- | Status | Description |
105
- |--------|-------------|
106
- | \`new\` | Created locally, not yet pushed to Xano |
107
- | \`unchanged\` | In sync with remote |
108
- | \`changed\` | Modified locally since last sync |
109
- | \`deleted\` | Marked for deletion (file removed locally) |
110
-
111
- ## Fetching Objects from the API
112
-
113
- Use the Headless API to fetch objects.
114
-
115
- ### List Objects
116
-
117
- \`\`\`
118
- GET /workspace/{workspace_id}/{type}
119
- Headers:
120
- Authorization: Bearer {token}
121
-
122
- Query Parameters:
123
- - branch: Branch label (empty = live branch)
124
- - page: Page number (default: 1)
125
- - per_page: Items per page (default: 50, max: 10000)
126
- - search: Text search filter
127
- - sort: Sort field (created_at, updated_at, name)
128
- - order: asc or desc
129
- \`\`\`
130
-
131
- ### Get Single Object with XanoScript
132
-
133
- \`\`\`
134
- GET /workspace/{workspace_id}/{type}/{id}
135
- Headers:
136
- Authorization: Bearer {token}
137
-
138
- Query Parameters:
139
- - branch: Branch label
140
- \`\`\`
141
-
142
- The response includes the \`xanoscript\` field with the code content:
143
- \`\`\`json
144
- {
145
- "id": 1,
146
- "name": "calculate_total",
147
- "xanoscript": {
148
- "status": "ok",
149
- "value": "function calculate_total { ... }"
150
- }
151
- }
152
- \`\`\`
153
-
154
- ### API Endpoints (Nested Under API Groups)
155
-
156
- **Important:** API endpoints are nested resources under API groups. You must first fetch API groups to obtain their IDs, then use those IDs to fetch the endpoints within each group.
157
-
158
- \`\`\`
159
- # 1. First, list API groups
160
- GET /workspace/{workspace_id}/apigroup
161
-
162
- # 2. Then, list endpoints for each group using the apigroup_id
163
- GET /workspace/{workspace_id}/apigroup/{apigroup_id}/api
164
-
165
- # 3. Get a single endpoint
166
- GET /workspace/{workspace_id}/apigroup/{apigroup_id}/api/{api_id}
167
- \`\`\`
168
-
169
- This hierarchical structure is reflected in the local directory layout:
170
- \`\`\`
171
- apis/
172
- └── auth/ # API group (apigroup_id required)
173
- ├── api_group.xs # Group definition
174
- ├── POST_login.xs # Endpoint within this group
175
- └── GET_me.xs # Another endpoint
176
- \`\`\`
177
-
178
- API groups contain endpoints that share common configuration.
179
-
180
- ## Pull Workflow
181
-
182
- 1. **Fetch object list** from API (paginated)
183
- 2. **For each object**, get the full definition including XanoScript
184
- 3. **Generate file path** based on type and name
185
- 4. **Write file** to the appropriate directory
186
- 5. **Update registry** with object metadata and SHA256 hash
187
-
188
- ### Example Pull Request Sequence
189
-
190
- \`\`\`javascript
191
- // 1. List all functions
192
- const response = await fetch(
193
- \`\${baseUrl}/workspace/\${workspaceId}/function?branch=\${branch}&per_page=100\`,
194
- { headers: { Authorization: \`Bearer \${token}\` } }
195
- );
196
- const { items, nextPage } = await response.json();
197
-
198
- // 2. For each function, save to file
199
- for (const func of items) {
200
- const xanoscript = func.xanoscript?.value || '';
201
- const fileName = \`\${snakeCase(func.name)}.xs\`;
202
- const filePath = \`functions/\${fileName}\`;
203
-
204
- // Write file
205
- await writeFile(filePath, xanoscript);
206
-
207
- // Add to registry
208
- registry.objects.push({
209
- id: func.id,
210
- type: 'function',
211
- name: func.name,
212
- path: filePath,
213
- sha256: sha256(xanoscript),
214
- status: 'unchanged',
215
- original: btoa(xanoscript),
216
- updated_at: func.updated_at
217
- });
218
- }
219
- \`\`\`
220
-
221
- ## Push Workflow
222
-
223
- 1. **Read registry** to find changed/new objects
224
- 2. **For each changed file**, read content and detect changes
225
- 3. **Create or update** via API with XanoScript content
226
- 4. **Update registry** with new IDs and hashes
227
-
228
- ### Example Push Request
229
-
230
- \`\`\`javascript
231
- // Create new function
232
- const response = await fetch(
233
- \`\${baseUrl}/workspace/\${workspaceId}/function?branch=\${branch}\`,
234
- {
235
- method: 'POST',
236
- headers: {
237
- 'Authorization': \`Bearer \${token}\`,
238
- 'Content-Type': 'text/x-xanoscript'
239
- },
240
- body: xanoscriptContent
241
- }
242
- );
243
-
244
- // Update existing function
245
- const response = await fetch(
246
- \`\${baseUrl}/workspace/\${workspaceId}/function/\${functionId}?publish=true\`,
247
- {
248
- method: 'PUT',
249
- headers: {
250
- 'Authorization': \`Bearer \${token}\`,
251
- 'Content-Type': 'text/x-xanoscript'
252
- },
253
- body: xanoscriptContent
254
- }
255
- );
256
- \`\`\`
257
-
258
- ## XanoScript Documentation References
259
-
260
- For writing XanoScript code, use:
261
-
262
- - \`xanoscript_docs()\` - Full documentation index
263
- - \`xanoscript_docs({ topic: "functions" })\` - Function syntax
264
- - \`xanoscript_docs({ topic: "tables" })\` - Table schema syntax
265
- - \`xanoscript_docs({ topic: "apis" })\` - API endpoint syntax
266
- - \`xanoscript_docs({ topic: "syntax" })\` - Language reference
267
-
268
- ## Validating XanoScript
269
-
270
- Before pushing changes, validate the XanoScript syntax:
271
-
272
- \`\`\`
273
- validate_xanoscript({ code: "function foo { ... }" })
274
- \`\`\`
275
-
276
- This will check for syntax errors and return line/column positions for any issues.
277
- `;
278
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Template for xanoscript_docs index documentation
3
- * Edit this file to update the XanoScript documentation index
4
- *
5
- * NOTE: This template is currently unused. The actual documentation is served
6
- * directly from the XANOSCRIPT_DOCS_V2 config in index.ts.
7
- */
8
- export interface XanoscriptIndexParams {
9
- version: string;
10
- }
11
- export declare function generateXanoscriptIndexTemplate(params: XanoscriptIndexParams): string;
@@ -1,72 +0,0 @@
1
- /**
2
- * Template for xanoscript_docs index documentation
3
- * Edit this file to update the XanoScript documentation index
4
- *
5
- * NOTE: This template is currently unused. The actual documentation is served
6
- * directly from the XANOSCRIPT_DOCS_V2 config in index.ts.
7
- */
8
- export function generateXanoscriptIndexTemplate(params) {
9
- const { version } = params;
10
- return `# XanoScript Documentation Index
11
- Version: ${version}
12
-
13
- Use \`xanoscript_docs({ topic: "<topic>" })\` to retrieve documentation.
14
-
15
- ## Core Language
16
- | Topic | Description |
17
- |-------|-------------|
18
- | \`syntax\` | Expressions, operators, filters, system variables |
19
- | \`types\` | Data types, validation, input blocks |
20
- | \`functions\` | Reusable function stacks, async, loops |
21
- | \`schema\` | Runtime schema parsing and validation |
22
-
23
- ## Data
24
- | Topic | Description |
25
- |-------|-------------|
26
- | \`tables\` | Database schema definitions with indexes and relationships |
27
- | \`database\` | All db.* operations: query, get, add, edit, patch, delete |
28
- | \`addons\` | Reusable subqueries for fetching related data |
29
- | \`streaming\` | Streaming data from files, requests, and responses |
30
-
31
- ## APIs & Endpoints
32
- | Topic | Description |
33
- |-------|-------------|
34
- | \`apis\` | HTTP endpoint definitions with authentication and CRUD patterns |
35
- | \`tasks\` | Scheduled and cron jobs |
36
- | \`triggers\` | Event-driven handlers (table, realtime, workspace, agent, MCP) |
37
- | \`realtime\` | Real-time channels and events for push updates |
38
-
39
- ## AI & Agents
40
- | Topic | Description |
41
- |-------|-------------|
42
- | \`agents\` | AI agent configuration with LLM providers and tools |
43
- | \`tools\` | AI tools for agents and MCP servers |
44
- | \`mcp-servers\` | MCP server definitions exposing tools |
45
-
46
- ## Integrations
47
- | Topic | Description |
48
- |-------|-------------|
49
- | \`integrations\` | Cloud storage, Redis, security, and external APIs |
50
-
51
- ## Configuration
52
- | Topic | Description |
53
- |-------|-------------|
54
- | \`workspace\` | Workspace-level settings: environment variables, preferences, realtime |
55
- | \`branch\` | Branch-level settings: middleware, history retention, visual styling |
56
- | \`middleware\` | Request/response interceptors for functions, queries, tasks, and tools |
57
-
58
- ## Development
59
- | Topic | Description |
60
- |-------|-------------|
61
- | \`testing\` | Unit tests, mocks, and assertions |
62
- | \`debugging\` | Logging, inspecting, and debugging XanoScript execution |
63
- | \`frontend\` | Static frontend development and deployment |
64
- | \`run\` | Run job and service configurations for the Xano Job Runner |
65
-
66
- ## Best Practices
67
- | Topic | Description |
68
- |-------|-------------|
69
- | \`performance\` | Performance optimization best practices |
70
- | \`security\` | Security best practices for authentication and authorization |
71
- `;
72
- }
@@ -1 +0,0 @@
1
- export {};