@xano/developer-mcp 2.2.2-beta.1 → 2.2.2-beta.6
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/dist/cli_docs/topics/workspace.js +2 -2
- package/dist/tools/index.d.ts +33 -2
- package/dist/tools/index.js +19 -2
- package/dist/tools/xano_knowledge.d.ts +65 -0
- package/dist/tools/xano_knowledge.js +162 -0
- package/dist/xanoscript_docs/docs_index.json +2 -2
- package/dist/xanoscript_docs/essentials.md +6 -0
- package/dist/xanoscript_docs/frontend.md +69 -141
- package/dist/xanoscript_docs/tables.md +1 -0
- package/package.json +1 -1
|
@@ -218,13 +218,13 @@ For lighter-weight iterative development without pulling the whole workspace, se
|
|
|
218
218
|
},
|
|
219
219
|
{
|
|
220
220
|
name: "workspace push",
|
|
221
|
-
description: "Upload local XanoScript files to a workspace. Default mode is partial (only changed files). Use --sync for a full push. The source directory is the -d/--directory flag (default: current directory), not a positional argument.",
|
|
221
|
+
description: "Upload local XanoScript files to a workspace. Default mode is partial (only changed files). Use --sync for a full push. The source directory is the -d/--directory flag (default: current directory), not a positional argument. A partial push is additive, not declarative: it adds and updates but makes no destructive changes (it won't drop a removed column or relax a constraint), so local files and the live workspace can diverge. Use --sync for destructive changes; --dry-run to preview.",
|
|
222
222
|
usage: "xano workspace push [options]",
|
|
223
223
|
flags: [
|
|
224
224
|
{ name: "directory", short: "d", type: "string", required: false, default: ".", description: "Directory containing documents to push (defaults to current directory)" },
|
|
225
225
|
{ name: "workspace", short: "w", type: "string", required: false, description: "Workspace ID (uses profile default if not set)" },
|
|
226
226
|
{ name: "branch", short: "b", type: "string", required: false, description: "Branch label to push to (defaults to live branch or profile branch)" },
|
|
227
|
-
{ name: "sync", type: "boolean", required: false, default: "false", description: "Full push (default is partial/changed-only). Required for --delete." },
|
|
227
|
+
{ name: "sync", type: "boolean", required: false, default: "false", description: "Full push (default is partial/changed-only). Required for --delete and for destructive schema changes (a partial push never drops or relaxes anything)." },
|
|
228
228
|
{ name: "delete", type: "boolean", required: false, default: "false", description: "Delete remote objects not present in local files (requires --sync)" },
|
|
229
229
|
{ name: "dry-run", type: "boolean", required: false, default: "false", description: "Preview changes without applying" },
|
|
230
230
|
{ name: "force", type: "boolean", required: false, default: "false", description: "Skip preview and confirmation prompt (for CI/CD)" },
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -12,11 +12,12 @@ import { xanoscriptDocs, xanoscriptDocsTool, getXanoscriptDocsPath, setXanoscrip
|
|
|
12
12
|
import { mcpVersion, mcpVersionTool, getServerVersion, setServerVersion, type McpVersionResult } from "./mcp_version.js";
|
|
13
13
|
import { metaApiDocs, metaApiDocsTool, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult } from "./meta_api_docs.js";
|
|
14
14
|
import { cliDocs, cliDocsTool, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult } from "./cli_docs.js";
|
|
15
|
+
import { xanoKnowledgeList, xanoKnowledgeListTool, xanoKnowledgeGet, xanoKnowledgeGetTool, type XanoKnowledgeListArgs, type XanoKnowledgeListResult, type XanoKnowledgeGetArgs, type XanoKnowledgeGetResult } from "./xano_knowledge.js";
|
|
15
16
|
import { type ToolResult, toMcpResponse } from "./types.js";
|
|
16
17
|
import { z } from "zod";
|
|
17
18
|
import type { BuiltTool } from "./define_tool.js";
|
|
18
|
-
export { validateXanoscript, TYPE_ALIASES, RESERVED_VARIABLES, type ValidateXanoscriptArgs, type ValidationResult, type BatchValidationResult, type SingleFileValidationResult, type ParserDiagnostic, xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, type TopicDoc, mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, type ToolResult, toMcpResponse, };
|
|
19
|
-
export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, };
|
|
19
|
+
export { validateXanoscript, TYPE_ALIASES, RESERVED_VARIABLES, type ValidateXanoscriptArgs, type ValidationResult, type BatchValidationResult, type SingleFileValidationResult, type ParserDiagnostic, xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, type TopicDoc, mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, xanoKnowledgeList, xanoKnowledgeGet, type XanoKnowledgeListArgs, type XanoKnowledgeListResult, type XanoKnowledgeGetArgs, type XanoKnowledgeGetResult, type ToolResult, toMcpResponse, };
|
|
20
|
+
export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, xanoKnowledgeListTool, xanoKnowledgeGetTool, };
|
|
20
21
|
/**
|
|
21
22
|
* Full tool specs (Zod shapes + derived JSON Schema). Use these to register
|
|
22
23
|
* tools with `McpServer.registerTool` — descriptions live in the shapes and
|
|
@@ -84,6 +85,36 @@ export declare const toolSpecs: {
|
|
|
84
85
|
}, {
|
|
85
86
|
documentation: z.ZodString;
|
|
86
87
|
}>;
|
|
88
|
+
readonly xano_knowledge_list: BuiltTool<{
|
|
89
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
90
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
91
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
"agents.md": "agents.md";
|
|
93
|
+
doc: "doc";
|
|
94
|
+
skill: "skill";
|
|
95
|
+
}>>;
|
|
96
|
+
enabled_only: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
+
output: z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
json: "json";
|
|
99
|
+
markdown: "markdown";
|
|
100
|
+
}>>;
|
|
101
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, {
|
|
103
|
+
command: z.ZodString;
|
|
104
|
+
}>;
|
|
105
|
+
readonly xano_knowledge_get: BuiltTool<{
|
|
106
|
+
name: z.ZodString;
|
|
107
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
108
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
109
|
+
file: z.ZodOptional<z.ZodString>;
|
|
110
|
+
output: z.ZodOptional<z.ZodEnum<{
|
|
111
|
+
json: "json";
|
|
112
|
+
text: "text";
|
|
113
|
+
}>>;
|
|
114
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, {
|
|
116
|
+
command: z.ZodString;
|
|
117
|
+
}>;
|
|
87
118
|
};
|
|
88
119
|
export type ToolName = keyof typeof toolSpecs;
|
|
89
120
|
/**
|
package/dist/tools/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { xanoscriptDocs, xanoscriptDocsTool, xanoscriptDocsToolSpec, getXanoscri
|
|
|
12
12
|
import { mcpVersion, mcpVersionTool, mcpVersionToolSpec, getServerVersion, setServerVersion, } from "./mcp_version.js";
|
|
13
13
|
import { metaApiDocs, metaApiDocsTool, metaApiDocsToolSpec, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, } from "./meta_api_docs.js";
|
|
14
14
|
import { cliDocs, cliDocsTool, cliDocsToolSpec, cliTopics, getCliTopicNames, getCliTopicDescriptions, } from "./cli_docs.js";
|
|
15
|
+
import { xanoKnowledgeList, xanoKnowledgeListTool, xanoKnowledgeListToolSpec, xanoKnowledgeGet, xanoKnowledgeGetTool, xanoKnowledgeGetToolSpec, } from "./xano_knowledge.js";
|
|
15
16
|
import { toMcpResponse } from "./types.js";
|
|
16
17
|
// =============================================================================
|
|
17
18
|
// Standalone Tool Functions (for library usage)
|
|
@@ -26,11 +27,13 @@ mcpVersion, getServerVersion, setServerVersion,
|
|
|
26
27
|
// Meta API Documentation
|
|
27
28
|
metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions,
|
|
28
29
|
// CLI Documentation
|
|
29
|
-
cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions,
|
|
30
|
+
cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions,
|
|
31
|
+
// Workspace Knowledge
|
|
32
|
+
xanoKnowledgeList, xanoKnowledgeGet, toMcpResponse, };
|
|
30
33
|
// =============================================================================
|
|
31
34
|
// Tool Result Functions (for internal MCP usage)
|
|
32
35
|
// =============================================================================
|
|
33
|
-
export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, };
|
|
36
|
+
export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, xanoKnowledgeListTool, xanoKnowledgeGetTool, };
|
|
34
37
|
// =============================================================================
|
|
35
38
|
// Tool Registry — single source of truth
|
|
36
39
|
// =============================================================================
|
|
@@ -45,6 +48,8 @@ export const toolSpecs = {
|
|
|
45
48
|
xano_version: mcpVersionToolSpec,
|
|
46
49
|
xano_meta_api_docs: metaApiDocsToolSpec,
|
|
47
50
|
xano_cli_docs: cliDocsToolSpec,
|
|
51
|
+
xano_knowledge_list: xanoKnowledgeListToolSpec,
|
|
52
|
+
xano_knowledge_get: xanoKnowledgeGetToolSpec,
|
|
48
53
|
};
|
|
49
54
|
/**
|
|
50
55
|
* Tool definitions array (derived from toolSpecs). Kept for callers that
|
|
@@ -104,6 +109,18 @@ const dispatch = {
|
|
|
104
109
|
return parsed.error;
|
|
105
110
|
return cliDocsTool(parsed.data);
|
|
106
111
|
},
|
|
112
|
+
async xano_knowledge_list(args) {
|
|
113
|
+
const parsed = parseWithSpec(xanoKnowledgeListToolSpec, args);
|
|
114
|
+
if (!parsed.ok)
|
|
115
|
+
return parsed.error;
|
|
116
|
+
return xanoKnowledgeListTool(parsed.data);
|
|
117
|
+
},
|
|
118
|
+
async xano_knowledge_get(args) {
|
|
119
|
+
const parsed = parseWithSpec(xanoKnowledgeGetToolSpec, args);
|
|
120
|
+
if (!parsed.ok)
|
|
121
|
+
return parsed.error;
|
|
122
|
+
return xanoKnowledgeGetTool(parsed.data);
|
|
123
|
+
},
|
|
107
124
|
};
|
|
108
125
|
function isToolName(name) {
|
|
109
126
|
return name in dispatch;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xano Workspace Knowledge Tools
|
|
3
|
+
*
|
|
4
|
+
* This MCP server has no shell access, so these tools don't run the CLI
|
|
5
|
+
* themselves — they return the exact `xano knowledge list` / `xano knowledge
|
|
6
|
+
* get` command to run, along with a short pointer on what it does.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import type { ToolResult } from "./types.js";
|
|
10
|
+
export interface XanoKnowledgeListArgs {
|
|
11
|
+
workspace?: string;
|
|
12
|
+
branch?: string;
|
|
13
|
+
type?: "skill" | "doc" | "agents.md";
|
|
14
|
+
enabled_only?: boolean;
|
|
15
|
+
output?: "markdown" | "json";
|
|
16
|
+
profile?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface XanoKnowledgeGetArgs {
|
|
19
|
+
name: string;
|
|
20
|
+
workspace?: string;
|
|
21
|
+
branch?: string;
|
|
22
|
+
file?: string;
|
|
23
|
+
output?: "text" | "json";
|
|
24
|
+
profile?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface XanoKnowledgeListResult {
|
|
27
|
+
command: string;
|
|
28
|
+
}
|
|
29
|
+
export interface XanoKnowledgeGetResult {
|
|
30
|
+
command: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function xanoKnowledgeList(args: XanoKnowledgeListArgs): XanoKnowledgeListResult;
|
|
33
|
+
export declare function xanoKnowledgeGet(args: XanoKnowledgeGetArgs): XanoKnowledgeGetResult;
|
|
34
|
+
export declare function xanoKnowledgeListTool(args: XanoKnowledgeListArgs): ToolResult;
|
|
35
|
+
export declare function xanoKnowledgeGetTool(args: XanoKnowledgeGetArgs): ToolResult;
|
|
36
|
+
export declare const xanoKnowledgeListToolSpec: import("./define_tool.js").BuiltTool<{
|
|
37
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
38
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
39
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
"agents.md": "agents.md";
|
|
41
|
+
doc: "doc";
|
|
42
|
+
skill: "skill";
|
|
43
|
+
}>>;
|
|
44
|
+
enabled_only: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
output: z.ZodOptional<z.ZodEnum<{
|
|
46
|
+
json: "json";
|
|
47
|
+
markdown: "markdown";
|
|
48
|
+
}>>;
|
|
49
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, {
|
|
51
|
+
command: z.ZodString;
|
|
52
|
+
}>;
|
|
53
|
+
export declare const xanoKnowledgeGetToolSpec: import("./define_tool.js").BuiltTool<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
56
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
57
|
+
file: z.ZodOptional<z.ZodString>;
|
|
58
|
+
output: z.ZodOptional<z.ZodEnum<{
|
|
59
|
+
json: "json";
|
|
60
|
+
text: "text";
|
|
61
|
+
}>>;
|
|
62
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, {
|
|
64
|
+
command: z.ZodString;
|
|
65
|
+
}>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xano Workspace Knowledge Tools
|
|
3
|
+
*
|
|
4
|
+
* This MCP server has no shell access, so these tools don't run the CLI
|
|
5
|
+
* themselves — they return the exact `xano knowledge list` / `xano knowledge
|
|
6
|
+
* get` command to run, along with a short pointer on what it does.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { defineTool } from "./define_tool.js";
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Command building
|
|
12
|
+
// =============================================================================
|
|
13
|
+
/** Quote an argv entry for display in a copy-pasteable shell command. */
|
|
14
|
+
function shellQuote(value) {
|
|
15
|
+
return /[^\w./-]/.test(value) ? `"${value.replace(/(["\\$`])/g, "\\$1")}"` : value;
|
|
16
|
+
}
|
|
17
|
+
function formatCommand(args) {
|
|
18
|
+
return args.map(shellQuote).join(" ");
|
|
19
|
+
}
|
|
20
|
+
export function xanoKnowledgeList(args) {
|
|
21
|
+
const cliArgs = ["xano", "knowledge", "list"];
|
|
22
|
+
if (args.workspace)
|
|
23
|
+
cliArgs.push("-w", args.workspace);
|
|
24
|
+
if (args.branch)
|
|
25
|
+
cliArgs.push("-b", args.branch);
|
|
26
|
+
if (args.type)
|
|
27
|
+
cliArgs.push("-t", args.type);
|
|
28
|
+
if (args.enabled_only === false)
|
|
29
|
+
cliArgs.push("--no-enabled-only");
|
|
30
|
+
cliArgs.push("-o", args.output ?? "markdown");
|
|
31
|
+
if (args.profile)
|
|
32
|
+
cliArgs.push("-p", args.profile);
|
|
33
|
+
return { command: formatCommand(cliArgs) };
|
|
34
|
+
}
|
|
35
|
+
export function xanoKnowledgeGet(args) {
|
|
36
|
+
const cliArgs = ["xano", "knowledge", "get", args.name];
|
|
37
|
+
if (args.workspace)
|
|
38
|
+
cliArgs.push("-w", args.workspace);
|
|
39
|
+
if (args.branch)
|
|
40
|
+
cliArgs.push("-b", args.branch);
|
|
41
|
+
if (args.file)
|
|
42
|
+
cliArgs.push("-f", args.file);
|
|
43
|
+
cliArgs.push("-o", args.output ?? "text");
|
|
44
|
+
if (args.profile)
|
|
45
|
+
cliArgs.push("-p", args.profile);
|
|
46
|
+
return { command: formatCommand(cliArgs) };
|
|
47
|
+
}
|
|
48
|
+
// =============================================================================
|
|
49
|
+
// Tool Result Functions (for internal MCP usage)
|
|
50
|
+
// =============================================================================
|
|
51
|
+
export function xanoKnowledgeListTool(args) {
|
|
52
|
+
const { command } = xanoKnowledgeList(args);
|
|
53
|
+
return {
|
|
54
|
+
success: true,
|
|
55
|
+
data: `Run this command to list the workspace's knowledge base (skills, docs, agents.md):\n\n${command}`,
|
|
56
|
+
structuredContent: { command },
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function xanoKnowledgeGetTool(args) {
|
|
60
|
+
if (!args?.name) {
|
|
61
|
+
return {
|
|
62
|
+
success: false,
|
|
63
|
+
error: "Error: 'name' parameter is required.",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const { command } = xanoKnowledgeGet(args);
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
data: `Run this command to fetch the knowledge item's content:\n\n${command}`,
|
|
70
|
+
structuredContent: { command },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// =============================================================================
|
|
74
|
+
// Tool Definitions (Zod shapes -> JSON Schema)
|
|
75
|
+
// =============================================================================
|
|
76
|
+
export const xanoKnowledgeListToolSpec = defineTool({
|
|
77
|
+
name: "xano_knowledge_list",
|
|
78
|
+
description: `Get the CLI command to list a Xano workspace's knowledge base: skills, docs, and the agents.md file. This tool does not run the command itself — it returns the exact \`xano knowledge list\` command to run in a shell, so you can invoke it and read its output.
|
|
79
|
+
|
|
80
|
+
Use this to get an overview of what knowledge/skills exist before answering questions about workspace conventions, or before deciding whether a new skill/doc needs to be created (to avoid duplicating existing ones).
|
|
81
|
+
|
|
82
|
+
Always-on items (mode=always) are returned by the command with full content; on-demand items are returned with just name+description — use xano_knowledge_get to get the command for fetching an on-demand item's full content when it becomes relevant.`,
|
|
83
|
+
annotations: {
|
|
84
|
+
readOnlyHint: true,
|
|
85
|
+
destructiveHint: false,
|
|
86
|
+
idempotentHint: true,
|
|
87
|
+
openWorldHint: false,
|
|
88
|
+
},
|
|
89
|
+
inputShape: {
|
|
90
|
+
workspace: z
|
|
91
|
+
.string()
|
|
92
|
+
.optional()
|
|
93
|
+
.describe("Workspace ID. Optional if the active profile has a default workspace configured."),
|
|
94
|
+
branch: z
|
|
95
|
+
.string()
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("Branch ID to read knowledge from. Optional; defaults to the workspace's live branch."),
|
|
98
|
+
type: z
|
|
99
|
+
.enum(["skill", "doc", "agents.md"])
|
|
100
|
+
.optional()
|
|
101
|
+
.describe("Filter to a single knowledge type. Omit to list all types."),
|
|
102
|
+
enabled_only: z
|
|
103
|
+
.boolean()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe("When true (default), only enabled items are returned. Set to false to include disabled items too."),
|
|
106
|
+
output: z
|
|
107
|
+
.enum(["markdown", "json"])
|
|
108
|
+
.optional()
|
|
109
|
+
.describe("markdown is human-readable (always-on items inline, on-demand items as a name+description index). " +
|
|
110
|
+
"json returns the full raw item array — prefer json when you need structured fields " +
|
|
111
|
+
"(id, guid, mode, references, etc.) for further processing. Default: markdown."),
|
|
112
|
+
profile: z
|
|
113
|
+
.string()
|
|
114
|
+
.optional()
|
|
115
|
+
.describe("CLI credential profile to use. Optional; falls back to XANO_PROFILE env var or the credentials file default."),
|
|
116
|
+
},
|
|
117
|
+
outputShape: {
|
|
118
|
+
command: z.string().describe("The `xano knowledge list` command to run to get the workspace's knowledge base."),
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
export const xanoKnowledgeGetToolSpec = defineTool({
|
|
122
|
+
name: "xano_knowledge_get",
|
|
123
|
+
description: `Get the CLI command to fetch the full content of one named knowledge item (a skill, doc, or agents.md), or one of a skill's attached reference files. This tool does not run the command itself — it returns the exact \`xano knowledge get\` command to run in a shell, so you can invoke it and read its output.
|
|
124
|
+
|
|
125
|
+
Use this after xano_knowledge_list has identified an on-demand item whose full content is now needed, or when a skill's step tells you to consult a specific reference file (via @filename syntax in the skill content).`,
|
|
126
|
+
annotations: {
|
|
127
|
+
readOnlyHint: true,
|
|
128
|
+
destructiveHint: false,
|
|
129
|
+
idempotentHint: true,
|
|
130
|
+
openWorldHint: false,
|
|
131
|
+
},
|
|
132
|
+
inputShape: {
|
|
133
|
+
name: z
|
|
134
|
+
.string()
|
|
135
|
+
.describe("The knowledge item's name (case-insensitive exact match). Required."),
|
|
136
|
+
workspace: z
|
|
137
|
+
.string()
|
|
138
|
+
.optional()
|
|
139
|
+
.describe("Workspace ID. Optional if the active profile has a default workspace configured."),
|
|
140
|
+
branch: z
|
|
141
|
+
.string()
|
|
142
|
+
.optional()
|
|
143
|
+
.describe("Branch ID. Optional; defaults to the workspace's live branch."),
|
|
144
|
+
file: z
|
|
145
|
+
.string()
|
|
146
|
+
.optional()
|
|
147
|
+
.describe("Path of a reference file attached to the item (as listed in that item's `references` array from " +
|
|
148
|
+
"xano_knowledge_list), fetched instead of the item's own content."),
|
|
149
|
+
output: z
|
|
150
|
+
.enum(["text", "json"])
|
|
151
|
+
.optional()
|
|
152
|
+
.describe("text returns the raw markdown content. json wraps it with metadata (item: full object; " +
|
|
153
|
+
"file: {content, name, path}). Default: text."),
|
|
154
|
+
profile: z
|
|
155
|
+
.string()
|
|
156
|
+
.optional()
|
|
157
|
+
.describe("CLI credential profile to use."),
|
|
158
|
+
},
|
|
159
|
+
outputShape: {
|
|
160
|
+
command: z.string().describe("The `xano knowledge get` command to run to fetch the knowledge item's content."),
|
|
161
|
+
},
|
|
162
|
+
});
|
|
@@ -184,10 +184,10 @@
|
|
|
184
184
|
},
|
|
185
185
|
"frontend": {
|
|
186
186
|
"file": "frontend.md",
|
|
187
|
-
"description": "Static frontend development and deployment",
|
|
187
|
+
"description": "Static frontend development and deployment (static hosting)",
|
|
188
188
|
"applyTo": ["static/**/*"],
|
|
189
189
|
"priority": 3,
|
|
190
|
-
"aliases": ["static", "html", "css", "web"]
|
|
190
|
+
"aliases": ["static", "html", "css", "web", "spa", "hosting", "static-host", "deploy"]
|
|
191
191
|
},
|
|
192
192
|
"addons": {
|
|
193
193
|
"file": "addons.md",
|
|
@@ -668,6 +668,12 @@ See `xano_xanoscript_docs({ topic: "file-uploads" })` for the full pattern.
|
|
|
668
668
|
|
|
669
669
|
---
|
|
670
670
|
|
|
671
|
+
## Validation is syntax-only
|
|
672
|
+
|
|
673
|
+
`xano_validate_xanoscript` checks syntax, not runtime behavior. A `valid` result means the code parses — it can still fail at execution (often a 500). Validation is necessary but not sufficient: after it passes, `push` and run the endpoint once (`validate → push → run`) before trusting the code.
|
|
674
|
+
|
|
675
|
+
---
|
|
676
|
+
|
|
671
677
|
## Related Topics
|
|
672
678
|
|
|
673
679
|
Explore more with `xano_xanoscript_docs({ topic: "<topic>" })`:
|
|
@@ -4,158 +4,86 @@ applyTo: "static/**/*"
|
|
|
4
4
|
|
|
5
5
|
# Frontend
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## API Client
|
|
52
|
-
|
|
53
|
-
### Basic Setup (api.js)
|
|
54
|
-
```javascript
|
|
55
|
-
const API_BASE = 'https://your-instance.xano.io/api:group';
|
|
56
|
-
|
|
57
|
-
async function apiCall(endpoint, options = {}) {
|
|
58
|
-
const token = localStorage.getItem('auth_token');
|
|
59
|
-
const headers = {
|
|
60
|
-
'Content-Type': 'application/json',
|
|
61
|
-
...(token && { 'Authorization': `Bearer ${token}` })
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const response = await fetch(`${API_BASE}${endpoint}`, {
|
|
65
|
-
...options,
|
|
66
|
-
headers: { ...headers, ...options.headers }
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
if (!response.ok) {
|
|
70
|
-
throw new Error(`API Error: ${response.status}`);
|
|
7
|
+
Build a static frontend (any framework that emits static output, or plain
|
|
8
|
+
HTML/CSS/JS) that calls your Xano APIs directly, then deploy it to **Xano static
|
|
9
|
+
hosting** (paid plans). There's no server tier — only static files; all dynamic
|
|
10
|
+
data comes from your APIs.
|
|
11
|
+
|
|
12
|
+
Keep frontend source in a **`static/`** directory at the project root, beside the
|
|
13
|
+
backend code.
|
|
14
|
+
|
|
15
|
+
## Get the API spec first
|
|
16
|
+
|
|
17
|
+
Before wiring calls, get the OpenAPI/Swagger spec for the API group you'll
|
|
18
|
+
consume: the `xano_get_openapi_spec` tool (if exposed), the Meta API `/openapi`
|
|
19
|
+
endpoint (see `xano_meta_api_docs`), or the API group's `…/swagger.json` URL.
|
|
20
|
+
It also drives typed-client codegen in the starter below.
|
|
21
|
+
|
|
22
|
+
## Two starting points
|
|
23
|
+
|
|
24
|
+
- **Opinionated starter (recommended for apps)** — clone
|
|
25
|
+
[`xano-inc/static_template`](https://github.com/xano-inc/static_template) into
|
|
26
|
+
`static/`: a Vite + React + TS SPA with auth and typed API hooks (generated from
|
|
27
|
+
your Swagger) already wired. Point it at your instance (`VITE_XANO_API_BASE` +
|
|
28
|
+
`VITE_XANO_SWAGGER_URL`) and build. It ships its own docs — follow those.
|
|
29
|
+
|
|
30
|
+
- **Plain static (no build)** — hand-write files into `static/`. Centralize calls
|
|
31
|
+
in one client module that prefixes a base URL and attaches the auth token:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
const API_BASE = "https://your-instance.xano.io/api:group";
|
|
35
|
+
|
|
36
|
+
async function apiCall(endpoint, options = {}) {
|
|
37
|
+
const token = localStorage.getItem("auth_token");
|
|
38
|
+
const res = await fetch(`${API_BASE}${endpoint}`, {
|
|
39
|
+
...options,
|
|
40
|
+
headers: {
|
|
41
|
+
"Content-Type": "application/json",
|
|
42
|
+
...(token && { Authorization: `Bearer ${token}` }),
|
|
43
|
+
...options.headers,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
if (!res.ok) throw new Error(`API Error: ${res.status}`);
|
|
47
|
+
return res.json();
|
|
71
48
|
}
|
|
49
|
+
```
|
|
72
50
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// CRUD helpers
|
|
77
|
-
const api = {
|
|
78
|
-
get: (endpoint) => apiCall(endpoint),
|
|
79
|
-
post: (endpoint, data) => apiCall(endpoint, {
|
|
80
|
-
method: 'POST',
|
|
81
|
-
body: JSON.stringify(data)
|
|
82
|
-
}),
|
|
83
|
-
patch: (endpoint, data) => apiCall(endpoint, {
|
|
84
|
-
method: 'PATCH',
|
|
85
|
-
body: JSON.stringify(data)
|
|
86
|
-
}),
|
|
87
|
-
delete: (endpoint) => apiCall(endpoint, { method: 'DELETE' })
|
|
88
|
-
};
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
---
|
|
51
|
+
Auth follows the same pattern: `POST /auth/login` (or `/auth/signup`) returns an
|
|
52
|
+
`authToken`; store it in `localStorage`, send it as `Authorization: Bearer`, and
|
|
53
|
+
remove it to log out.
|
|
92
54
|
|
|
93
|
-
##
|
|
55
|
+
## Deploy
|
|
94
56
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const { authToken } = await api.post('/auth/login', { email, password });
|
|
99
|
-
localStorage.setItem('auth_token', authToken);
|
|
100
|
-
return authToken;
|
|
101
|
-
}
|
|
102
|
-
```
|
|
57
|
+
Deploy with the **`xano` CLI** (`npm i -g @xano/cli`, then `xano auth`). A
|
|
58
|
+
**build** is an uploaded snapshot; a **deploy** points an environment (`dev` or
|
|
59
|
+
`prod`, each its own URL) at a build.
|
|
103
60
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
email, password, name
|
|
109
|
-
});
|
|
110
|
-
localStorage.setItem('auth_token', authToken);
|
|
111
|
-
return authToken;
|
|
112
|
-
}
|
|
61
|
+
```bash
|
|
62
|
+
xano static_host create my-app # one-time
|
|
63
|
+
xano static_host build push my-app -d ./static -n "v1.0.0" # push snapshot
|
|
64
|
+
xano static_host deploy my-app --build_id <id> --env dev # then --env prod
|
|
113
65
|
```
|
|
114
66
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
window.location.href = '/login.html';
|
|
120
|
-
}
|
|
121
|
-
```
|
|
67
|
+
When `static/` has a `package.json`, **Xano runs your `build` script
|
|
68
|
+
server-side** on push. Changes aren't auto-synced — push a new build to publish.
|
|
69
|
+
Full reference (flags, `build pull`, rollback, git integration):
|
|
70
|
+
`xano_cli_docs(topic='static_host')`.
|
|
122
71
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
```
|
|
72
|
+
**After deploy:** the environment URL can 404 briefly until the build
|
|
73
|
+
propagates — allow a few seconds before treating a deploy as failed. Assets are
|
|
74
|
+
cached by filename, so redeploys can serve stale files to returning visitors;
|
|
75
|
+
version asset URLs (e.g. `app.js?v=2`) when an update must take effect immediately.
|
|
129
76
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
## Deployment
|
|
77
|
+
## Best practices
|
|
133
78
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
invoke upload_static_files_to_xano
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
The tool will:
|
|
141
|
-
1. Bundle files from `static/`
|
|
142
|
-
2. Upload to Xano CDN
|
|
143
|
-
3. Return hosted URL
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## Best Practices
|
|
148
|
-
|
|
149
|
-
1. **Get API specs first** - Use `get_xano_api_specifications` before coding
|
|
150
|
-
2. **Centralize API calls** - Single `api.js` file
|
|
151
|
-
3. **Store tokens securely** - localStorage for web, secure storage for mobile
|
|
152
|
-
|
|
153
|
-
---
|
|
79
|
+
- **Never ship secrets** — the bundle is world-readable. The only credential is
|
|
80
|
+
the user's own auth token in `localStorage`. No API keys or DB credentials in
|
|
81
|
+
client code, including any `VITE_*` variable (inlined into the bundle).
|
|
154
82
|
|
|
155
83
|
## Related Topics
|
|
156
84
|
|
|
157
|
-
| Topic
|
|
158
|
-
|
|
159
|
-
| `apis`
|
|
85
|
+
| Topic | Description |
|
|
86
|
+
| ----------- | ----------------------- |
|
|
87
|
+
| `apis` | Backend API endpoints |
|
|
160
88
|
| `workspace` | Workspace configuration |
|
|
161
|
-
| `security`
|
|
89
|
+
| `security` | CORS and authentication |
|
|
@@ -323,6 +323,7 @@ table "order" {
|
|
|
323
323
|
2. **Use `auth = true`** only for the authentication table (typically just `user`)
|
|
324
324
|
3. **Add indexes** for fields used in `db.query` WHERE clauses and JOINs to avoid full table scans
|
|
325
325
|
4. **Add new fields to the bottom of the schema** - When adding new fields to an existing table, append them to the end of the schema block rather than inserting them in the middle. This preserves column ordering consistency and avoids unexpected side effects
|
|
326
|
+
5. **`workspace push` is additive, not declarative** - A partial push (the default) adds and updates schema but makes no destructive changes — it won't drop a column you removed or relax an existing constraint, so local files and the live table can diverge. Use `xano workspace push --sync` for destructive schema changes.
|
|
326
327
|
|
|
327
328
|
---
|
|
328
329
|
|
package/package.json
CHANGED