@xanots/sdk 0.0.1
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/LICENSE +21 -0
- package/README.md +384 -0
- package/dist/agent-file-refresh-7XCACU34.js +95 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +184 -0
- package/dist/capture-HUV5BNTC.js +32 -0
- package/dist/chunk-26CNBZE2.js +963 -0
- package/dist/chunk-33ND6LKO.js +78 -0
- package/dist/chunk-3DUAGYGP.js +1550 -0
- package/dist/chunk-3IGNIP6R.js +89 -0
- package/dist/chunk-47WDWMBJ.js +14 -0
- package/dist/chunk-4BXJGVZ3.js +318 -0
- package/dist/chunk-4HT3BNZ7.js +675 -0
- package/dist/chunk-4YMD2OOZ.js +23 -0
- package/dist/chunk-5WGEURVI.js +156 -0
- package/dist/chunk-5YTBTF25.js +29 -0
- package/dist/chunk-6DHBYBTO.js +166 -0
- package/dist/chunk-76QBEIGO.js +66 -0
- package/dist/chunk-7DKX2SPN.js +100 -0
- package/dist/chunk-7REDODS2.js +468 -0
- package/dist/chunk-C56BC2FY.js +254 -0
- package/dist/chunk-DGSF2Q5H.js +60 -0
- package/dist/chunk-EMCAWMHC.js +3982 -0
- package/dist/chunk-EZG76F7R.js +159 -0
- package/dist/chunk-FJ6ZS5KB.js +3607 -0
- package/dist/chunk-GNPVYOPB.js +17 -0
- package/dist/chunk-HJPTWBLH.js +38 -0
- package/dist/chunk-IZW6MK3U.js +248 -0
- package/dist/chunk-LH6Z6KFV.js +247 -0
- package/dist/chunk-MZUI3JNX.js +93 -0
- package/dist/chunk-NDZFBZHC.js +167 -0
- package/dist/chunk-NOO35BQ2.js +37 -0
- package/dist/chunk-NUQCEOKA.js +13 -0
- package/dist/chunk-QTNO2WD6.js +56 -0
- package/dist/chunk-RVB7ITKN.js +49 -0
- package/dist/chunk-TRU5OHQ5.js +6904 -0
- package/dist/chunk-VKFQJEMW.js +814 -0
- package/dist/chunk-VTIL47DT.js +125 -0
- package/dist/chunk-WHOJWOSV.js +112 -0
- package/dist/chunk-WKP4D5MO.js +1692 -0
- package/dist/chunk-X4DVXBFY.js +38 -0
- package/dist/chunk-XQ22GLYS.js +118 -0
- package/dist/chunk-YDZYMZBE.js +670 -0
- package/dist/chunk-YGPIY3WT.js +1146 -0
- package/dist/chunk-YYRDLFSJ.js +602 -0
- package/dist/chunk-ZUTSMMAG.js +46 -0
- package/dist/cli.d.ts +331 -0
- package/dist/cli.js +33 -0
- package/dist/codegen-command-OOKK6AZK.js +40 -0
- package/dist/codegen.d.ts +114 -0
- package/dist/codegen.js +71 -0
- package/dist/completion-TIPPZN7H.js +298 -0
- package/dist/config-NL33PN4D.js +84 -0
- package/dist/deploy-command-4EQ7XX5G.js +451 -0
- package/dist/env-target-IFJ5QDHC.js +16 -0
- package/dist/ephemeral-command-3X3I4ULC.js +242 -0
- package/dist/index.d.ts +4477 -0
- package/dist/index.js +300 -0
- package/dist/init-command-R6H7ZXW5.js +27 -0
- package/dist/internal.d.ts +74 -0
- package/dist/internal.js +2065 -0
- package/dist/io-AMIKRLPC.js +11 -0
- package/dist/live-diff-Y3AKETHE.js +196 -0
- package/dist/lock-3CVKALKT.js +37 -0
- package/dist/lock-commands-XTR2YKLY.js +232 -0
- package/dist/login-command-ACJF6KWQ.js +167 -0
- package/dist/logout-command-MX3MJS5U.js +68 -0
- package/dist/loop-OM3P2Z6O.js +93 -0
- package/dist/marketplace-command-RATXTKXN.js +379 -0
- package/dist/meta-client-OW5WKWW7.js +170 -0
- package/dist/node.d.ts +59 -0
- package/dist/node.js +442 -0
- package/dist/profile-command-SWJ3SPKR.js +77 -0
- package/dist/release-command-VV5UVZKL.js +427 -0
- package/dist/response-CVAE2kMj.d.ts +1915 -0
- package/dist/routes-manifest-SP3ZXLMR.js +244 -0
- package/dist/runtime-V4C3AC3A.js +13 -0
- package/dist/sandbox-details-command-HJE5SPVG.js +18 -0
- package/dist/sandbox-export-command-QCJY4GMV.js +24 -0
- package/dist/static-host-D6KS7X45.js +138 -0
- package/dist/store-BQ97nKIF.d.ts +7760 -0
- package/dist/test-command-TSPBQHBM.js +383 -0
- package/dist/validate-command-4ERHJSCO.js +122 -0
- package/dist/verify-rollout-FAVQ6EJY.js +40 -0
- package/dist/workspace-K72NP7SX.js +49 -0
- package/dist/workspace-command-OF23DPNI.js +156 -0
- package/dist/workspace-export-AJMGN3CQ.js +10 -0
- package/llms/fields.md +104 -0
- package/llms/filters.md +183 -0
- package/llms/kinds-agent-mcp.md +11 -0
- package/llms/kinds-core.md +68 -0
- package/llms/kinds-realtime.md +76 -0
- package/llms/lambda.md +111 -0
- package/llms/legacy.md +43 -0
- package/llms/object-kinds.md +31 -0
- package/llms/statements-calls.md +23 -0
- package/llms/statements-catalog.md +309 -0
- package/llms/statements-data.md +58 -0
- package/llms/statements-runtime.md +48 -0
- package/llms/tests.md +58 -0
- package/llms/triggers.md +22 -0
- package/llms/values.md +29 -0
- package/llms-full.txt +1672 -0
- package/llms.txt +483 -0
- package/manifest.json +9592 -0
- package/package.json +110 -0
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
// src/emit/commands.ts
|
|
2
|
+
function renderArgs(args) {
|
|
3
|
+
return (args ?? []).map((a) => a.required ? `<${a.name}>` : `[${a.name}]`).join(" ");
|
|
4
|
+
}
|
|
5
|
+
var HELP_GROUP_ORDER = [
|
|
6
|
+
"Author",
|
|
7
|
+
"Deploy",
|
|
8
|
+
"Pull",
|
|
9
|
+
"Environments",
|
|
10
|
+
"Account",
|
|
11
|
+
"Maintenance"
|
|
12
|
+
];
|
|
13
|
+
var FLAGS = {
|
|
14
|
+
out: { spec: "--out, -o <path>", summary: "Write the artifact to this path instead of stdout" },
|
|
15
|
+
lock: { spec: "--lock[=<path>]", summary: "Use (and create) xano.lock \u2014 default: beside the entry file" },
|
|
16
|
+
entry: {
|
|
17
|
+
spec: "--entry=<path>",
|
|
18
|
+
summary: "Workspace entry to resolve xano.lock beside (for lock subcommands that take no entry file)"
|
|
19
|
+
},
|
|
20
|
+
"frozen-lock": { spec: "--frozen-lock", summary: "CI guard: fail instead of changing the lock" },
|
|
21
|
+
strict: { spec: "--strict", summary: "Promote every export warning (data-losing shapes, unresolvable filters) to a hard failure" },
|
|
22
|
+
yes: { spec: "--yes, -y", summary: "Confirm a destructive action non-interactively" },
|
|
23
|
+
bundle: { spec: "--bundle <path>", summary: "Use an already-exported bundle instead of an entry file" },
|
|
24
|
+
reset: { spec: "--reset", summary: "Accepted but redundant \u2014 every deploy is a full replace" },
|
|
25
|
+
dest: {
|
|
26
|
+
spec: "--dest <ephemeral|sandbox>",
|
|
27
|
+
summary: "Which environment to import into (default: ephemeral)",
|
|
28
|
+
values: ["ephemeral", "sandbox"]
|
|
29
|
+
},
|
|
30
|
+
kind: {
|
|
31
|
+
spec: "--kind <unit|workflow>",
|
|
32
|
+
summary: "Only this test family (default: both)",
|
|
33
|
+
values: ["unit", "workflow"]
|
|
34
|
+
},
|
|
35
|
+
concurrency: {
|
|
36
|
+
spec: "--concurrency <n>",
|
|
37
|
+
summary: "Run this many tests at once (default: 1). Tests share the environment database, so raise it only when yours do not depend on shared state."
|
|
38
|
+
},
|
|
39
|
+
"expires-hours": { spec: "--expires-hours <n>", summary: "Ephemeral TTL at create time, 1\u201372 (default: 1)" },
|
|
40
|
+
static: { spec: "--static <dir>", summary: "Archive this built frontend and deploy it to the static host" },
|
|
41
|
+
"allow-seed-in-static": {
|
|
42
|
+
spec: "--allow-seed-in-static",
|
|
43
|
+
summary: "Publish the static build even if it contains non-public seed values"
|
|
44
|
+
},
|
|
45
|
+
"static-env": { spec: "--static-env KEY=VALUE", summary: "Public config baked in as window.<KEY> (repeatable; never secrets)" },
|
|
46
|
+
emit: {
|
|
47
|
+
spec: "--emit <path>",
|
|
48
|
+
summary: "Write a generated route + socket module there (plain data, no SDK import)"
|
|
49
|
+
},
|
|
50
|
+
"static-host": { spec: "--static-host <name>", summary: "Static-host name to deploy to (default: default)" },
|
|
51
|
+
"static-routing": {
|
|
52
|
+
spec: "--static-routing spa|multipage",
|
|
53
|
+
summary: "Override URL resolution (inferred from the bundle; rarely needed)"
|
|
54
|
+
},
|
|
55
|
+
test: {
|
|
56
|
+
spec: "--test",
|
|
57
|
+
summary: "After deploying, run the environment's tests; a failure exits 5 without retracting the deploy"
|
|
58
|
+
},
|
|
59
|
+
"no-verify": { spec: "--no-verify", summary: "Skip the post-deploy liveness checks (static host, microservices); on the codegen commands it skips the offline round-trip check instead" },
|
|
60
|
+
"require-microservices": {
|
|
61
|
+
spec: "--require-microservices",
|
|
62
|
+
summary: "Fail the deploy (exit 4) when a microservice is not ready by the end of the wait"
|
|
63
|
+
},
|
|
64
|
+
report: {
|
|
65
|
+
spec: "--report <grouped|full|json>",
|
|
66
|
+
summary: "Findings as grouped root causes (default), every site, or JSON",
|
|
67
|
+
values: ["grouped", "full", "json"]
|
|
68
|
+
},
|
|
69
|
+
origin: { spec: "--origin <origin>", summary: "Xano control-plane OAuth host (default: $XANO_ORIGIN)" },
|
|
70
|
+
config: { spec: "--config <path>", summary: "Explicit credential file (default: $XANO_CONFIG)" },
|
|
71
|
+
local: { spec: "--local", summary: "Use the project-local ./.xano/auth.json instead of the shared cache" },
|
|
72
|
+
"all-workspaces": { spec: "--all-workspaces", summary: "Enumerate across every workspace, not just the token's" },
|
|
73
|
+
guest: { spec: "--guest, -g", summary: "Mint a read-only guest session (browse only)" },
|
|
74
|
+
"url-only": { spec: "--url-only, -u", summary: "Print the dashboard URL instead of opening a browser" },
|
|
75
|
+
prompt: { spec: "--prompt", summary: "Print only the add-on wiring prompt, for piping to a coding agent" },
|
|
76
|
+
port: { spec: "--port <n>", summary: "Fixed loopback callback port (default: ephemeral)" },
|
|
77
|
+
scope: { spec: '--scope "<list>"', summary: "OAuth scopes to request (default: the built-in set)" },
|
|
78
|
+
runtime: { spec: "--runtime", summary: "After the round-trip, run each deployed function and report" },
|
|
79
|
+
capture: { spec: "--capture", summary: "Write each round-tripped function's fetched JSON" },
|
|
80
|
+
verbose: { spec: "--verbose", summary: "Print full diffs and raw engine detail" },
|
|
81
|
+
instance: { spec: "--instance <url>", summary: "Override XANO_VALIDATE_INSTANCE for this run" },
|
|
82
|
+
format: { spec: "--format <json|multidoc>", summary: "Which artifact to emit", values: ["json", "multidoc"] },
|
|
83
|
+
path: { spec: "--path <p>", summary: "Output location \u2014 `-` for stdout, a dir, or a file path" },
|
|
84
|
+
name: { spec: "--name <n>", summary: "Name for what this command produces" },
|
|
85
|
+
framework: {
|
|
86
|
+
spec: "--framework <id>",
|
|
87
|
+
summary: "Frontend framework to scaffold: react (default), svelte",
|
|
88
|
+
values: ["react", "svelte"]
|
|
89
|
+
},
|
|
90
|
+
ai: {
|
|
91
|
+
spec: "--ai <preset>",
|
|
92
|
+
summary: "AI instruction files to scaffold: claude, codex, cursor, none",
|
|
93
|
+
values: ["claude", "codex", "cursor", "none"]
|
|
94
|
+
},
|
|
95
|
+
force: { spec: "--force", summary: "Scaffold into a non-empty directory (overwriting our own files)" },
|
|
96
|
+
"no-install": { spec: "--no-install", summary: "Skip the post-scaffold npm install" },
|
|
97
|
+
"dry-run": { spec: "--dry-run", summary: "Print what would change and exit without sending it" },
|
|
98
|
+
prune: { spec: "--prune", summary: "Also delete workspace objects your project no longer defines" },
|
|
99
|
+
"reset-data": { spec: "--reset-data", summary: "Empty every table the bundle carries before importing" },
|
|
100
|
+
seed: { spec: "--seed", summary: "Write the bundle's table rows (off by default)" },
|
|
101
|
+
replace: { spec: "--replace", summary: "Wipe the workspace and import in its place, instead of merging" },
|
|
102
|
+
open: { spec: "--open", summary: "Open the deployed URL in your browser when it lands" },
|
|
103
|
+
// ── Global (accepted by every command; see GLOBAL_FLAGS) ───────────────
|
|
104
|
+
json: {
|
|
105
|
+
spec: "--json",
|
|
106
|
+
summary: "Force JSON on stdout (default: whenever stdout is not a terminal)"
|
|
107
|
+
},
|
|
108
|
+
help: { spec: "--help, -h", summary: "Show help for the command and exit" },
|
|
109
|
+
version: { spec: "--version, -v", summary: "Print the CLI version and exit" }
|
|
110
|
+
};
|
|
111
|
+
var GLOBAL_FLAGS = ["json", "help", "version"];
|
|
112
|
+
var AUTH = ["origin", "config", "local"];
|
|
113
|
+
var READ_DEST = {
|
|
114
|
+
key: "dest",
|
|
115
|
+
summary: "Which environment to read (default: ephemeral)",
|
|
116
|
+
values: ["ephemeral", "sandbox", "workspace"]
|
|
117
|
+
};
|
|
118
|
+
var TEST_ENV = {
|
|
119
|
+
key: "name",
|
|
120
|
+
summary: "Ephemeral env to target (default: the one this project last deployed to)"
|
|
121
|
+
};
|
|
122
|
+
var COMPILE = ["lock", "frozen-lock", "strict"];
|
|
123
|
+
var SCAFFOLD = [
|
|
124
|
+
{ key: "name", summary: "Project name (default: the target directory's basename)" },
|
|
125
|
+
"framework",
|
|
126
|
+
"ai",
|
|
127
|
+
"force",
|
|
128
|
+
"no-install"
|
|
129
|
+
];
|
|
130
|
+
var CODEGEN_NO_VERIFY = {
|
|
131
|
+
key: "no-verify",
|
|
132
|
+
summary: "Skip the offline round-trip check that the written tree re-exports (no network, no deploy)"
|
|
133
|
+
};
|
|
134
|
+
var COMMANDS = {
|
|
135
|
+
// ── Author ──────────────────────────────────────────────────────────────
|
|
136
|
+
compile: {
|
|
137
|
+
group: "Author",
|
|
138
|
+
display: "compile <file>",
|
|
139
|
+
// Says "single object def", not "workspace": this command takes ONE def and
|
|
140
|
+
// prints its JSON artifact. The old summary claimed a workspace and
|
|
141
|
+
// XanoScript, neither of which it does — and `compile` is the first command
|
|
142
|
+
// listed under Author, so it is the first thing tried on the scaffold entry
|
|
143
|
+
// (a workspace), which fails. `export` is the workspace command.
|
|
144
|
+
summary: "Type-check a single object def and print its JSON artifact",
|
|
145
|
+
args: [{ name: "file", required: true, path: true }],
|
|
146
|
+
flags: ["out", "lock"],
|
|
147
|
+
example: "xanots compile ./xano/query/public/health_GET.ts"
|
|
148
|
+
},
|
|
149
|
+
export: {
|
|
150
|
+
group: "Author",
|
|
151
|
+
display: "export <file>",
|
|
152
|
+
summary: "Compile and write the deployable JSON bundle",
|
|
153
|
+
args: [{ name: "file", required: true, path: true }],
|
|
154
|
+
flags: ["out", ...COMPILE],
|
|
155
|
+
example: "xanots export ./index.ts --out bundle.json"
|
|
156
|
+
},
|
|
157
|
+
paths: {
|
|
158
|
+
group: "Author",
|
|
159
|
+
display: "paths <file>",
|
|
160
|
+
summary: "List each query's verb + resolved api:<canonical>/<name>",
|
|
161
|
+
args: [{ name: "file", required: true, path: true }],
|
|
162
|
+
flags: ["lock", "emit", "strict"],
|
|
163
|
+
example: "xanots paths ./index.ts --emit xano/routes.gen.ts"
|
|
164
|
+
},
|
|
165
|
+
routes: {
|
|
166
|
+
group: "Author",
|
|
167
|
+
display: "routes <file>",
|
|
168
|
+
summary: "Alias for `paths`",
|
|
169
|
+
aliasOf: "paths",
|
|
170
|
+
args: [{ name: "file", required: true, path: true }],
|
|
171
|
+
flags: ["lock", "emit", "strict"]
|
|
172
|
+
},
|
|
173
|
+
init: {
|
|
174
|
+
group: "Author",
|
|
175
|
+
display: "init [dir]",
|
|
176
|
+
summary: "Scaffold a new XanoTS project",
|
|
177
|
+
args: [{ name: "dir", required: false, path: true }],
|
|
178
|
+
flags: [...SCAFFOLD],
|
|
179
|
+
example: "xanots init my-app --ai claude"
|
|
180
|
+
},
|
|
181
|
+
marketplace: {
|
|
182
|
+
group: "Author",
|
|
183
|
+
display: "marketplace <list|search|details|install>",
|
|
184
|
+
summary: "Find XanoTS add-on packages and add them to this project",
|
|
185
|
+
subcommands: {
|
|
186
|
+
// No apostrophes in any registry string: zsh completion single-quotes
|
|
187
|
+
// these, and the completion suite fails the whole script on an odd quote.
|
|
188
|
+
list: {
|
|
189
|
+
summary: "List every published add-on, newest first",
|
|
190
|
+
extraArgHint: "`list` prints the whole catalogue; `xanots marketplace search <string>` is the filter.",
|
|
191
|
+
example: "xanots marketplace list"
|
|
192
|
+
},
|
|
193
|
+
search: {
|
|
194
|
+
summary: "Search add-ons by keyword across name, tagline and description",
|
|
195
|
+
// Variadic: the handler joins every term into one phrase query, so
|
|
196
|
+
// `search ai agent` searches for "ai agent" rather than dropping "agent".
|
|
197
|
+
args: [{ name: "string", required: true, variadic: true }],
|
|
198
|
+
example: "xanots marketplace search auth"
|
|
199
|
+
},
|
|
200
|
+
details: {
|
|
201
|
+
summary: "Show what an add-on installs, what it needs, and how to register it",
|
|
202
|
+
args: [{ name: "package", required: true }],
|
|
203
|
+
flags: ["prompt"],
|
|
204
|
+
example: "xanots marketplace details @xanots/auth"
|
|
205
|
+
},
|
|
206
|
+
install: {
|
|
207
|
+
summary: "Install a package into the XanoTS project in the current directory",
|
|
208
|
+
args: [{ name: "package", required: true }],
|
|
209
|
+
example: "xanots marketplace install @xanots/auth"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
// ── Deploy ──────────────────────────────────────────────────────────────
|
|
214
|
+
deploy: {
|
|
215
|
+
group: "Deploy",
|
|
216
|
+
display: "deploy <file>",
|
|
217
|
+
summary: "Ship to a live ephemeral env (or --dest sandbox) \u2192 URL",
|
|
218
|
+
args: [{ name: "file", required: true, path: true, satisfiedBy: ["bundle"] }],
|
|
219
|
+
flags: [
|
|
220
|
+
"dest",
|
|
221
|
+
"expires-hours",
|
|
222
|
+
{ key: "name", summary: "Display name for the ephemeral env (default: the workspace name)" },
|
|
223
|
+
"bundle",
|
|
224
|
+
"static",
|
|
225
|
+
"static-host",
|
|
226
|
+
"static-routing",
|
|
227
|
+
"static-env",
|
|
228
|
+
"allow-seed-in-static",
|
|
229
|
+
"no-verify",
|
|
230
|
+
"require-microservices",
|
|
231
|
+
"test",
|
|
232
|
+
"open",
|
|
233
|
+
"reset",
|
|
234
|
+
...COMPILE,
|
|
235
|
+
...AUTH
|
|
236
|
+
],
|
|
237
|
+
example: "xanots deploy ./index.ts --test"
|
|
238
|
+
},
|
|
239
|
+
release: {
|
|
240
|
+
group: "Deploy",
|
|
241
|
+
display: "release <file>",
|
|
242
|
+
summary: "Promote to your instance workspace (merges; never wipes data)",
|
|
243
|
+
args: [{ name: "file", required: true, path: true, satisfiedBy: ["bundle"] }],
|
|
244
|
+
flags: [
|
|
245
|
+
"bundle",
|
|
246
|
+
"dry-run",
|
|
247
|
+
"prune",
|
|
248
|
+
"reset-data",
|
|
249
|
+
"seed",
|
|
250
|
+
"replace",
|
|
251
|
+
"yes",
|
|
252
|
+
{ key: "force", summary: "Skip the confirmation prompt (same as --yes)" },
|
|
253
|
+
"static",
|
|
254
|
+
"static-host",
|
|
255
|
+
"static-routing",
|
|
256
|
+
"static-env",
|
|
257
|
+
"allow-seed-in-static",
|
|
258
|
+
"no-verify",
|
|
259
|
+
...COMPILE,
|
|
260
|
+
...AUTH
|
|
261
|
+
],
|
|
262
|
+
example: "xanots release ./index.ts --dry-run"
|
|
263
|
+
},
|
|
264
|
+
validate: {
|
|
265
|
+
group: "Deploy",
|
|
266
|
+
display: "validate <file>",
|
|
267
|
+
summary: "Deploy to a throwaway tenant and verify the round-trip",
|
|
268
|
+
args: [{ name: "file", required: true, path: true, satisfiedBy: ["bundle"] }],
|
|
269
|
+
flags: ["bundle", "runtime", "capture", "verbose", "instance", "out", ...COMPILE],
|
|
270
|
+
example: "xanots validate ./index.ts --runtime"
|
|
271
|
+
},
|
|
272
|
+
// ── Pull ────────────────────────────────────────────────────────────────
|
|
273
|
+
codegen: {
|
|
274
|
+
group: "Pull",
|
|
275
|
+
display: "codegen <bundle> <path>",
|
|
276
|
+
summary: "A bundle JSON file \u2192 a runnable XanoTS project (offline)",
|
|
277
|
+
args: [
|
|
278
|
+
{ name: "bundle.json", required: true, path: true },
|
|
279
|
+
{ name: "path", required: true, path: true }
|
|
280
|
+
],
|
|
281
|
+
flags: [...SCAFFOLD, CODEGEN_NO_VERIFY],
|
|
282
|
+
example: "xanots codegen ./bundle.json ./app"
|
|
283
|
+
},
|
|
284
|
+
// ── Environments ────────────────────────────────────────────────────────
|
|
285
|
+
workspace: {
|
|
286
|
+
group: "Environments",
|
|
287
|
+
display: "workspace",
|
|
288
|
+
summary: "Read your real workspace \u2014 details, export, codegen",
|
|
289
|
+
subcommands: {
|
|
290
|
+
details: {
|
|
291
|
+
summary: "Which instance and workspace am I bound to?",
|
|
292
|
+
flags: [...AUTH],
|
|
293
|
+
example: "xanots workspace details"
|
|
294
|
+
},
|
|
295
|
+
export: {
|
|
296
|
+
summary: "Write its bundle JSON",
|
|
297
|
+
flags: ["path", { key: "name", summary: "Output basename (default: `workspace`)" }, ...AUTH],
|
|
298
|
+
example: "xanots workspace export --path -"
|
|
299
|
+
},
|
|
300
|
+
codegen: {
|
|
301
|
+
summary: "Decode it into a runnable XanoTS project",
|
|
302
|
+
args: [{ name: "path", required: true, path: true }],
|
|
303
|
+
flags: [...SCAFFOLD, CODEGEN_NO_VERIFY, "report", ...AUTH],
|
|
304
|
+
example: "xanots workspace codegen ./app",
|
|
305
|
+
group: "Pull",
|
|
306
|
+
display: "workspace codegen <path>",
|
|
307
|
+
groupSummary: "Your real workspace \u2192 a runnable XanoTS project"
|
|
308
|
+
},
|
|
309
|
+
deploy: {
|
|
310
|
+
summary: "Removed \u2014 XanoTS never writes back to your real workspace",
|
|
311
|
+
removed: "`xanots workspace deploy` does not exist \u2014 the only import path is a FULL REPLACE of the target workspace, so XanoTS never writes back to your real one. Use `xanots deploy` (`--dest ephemeral` by default, or `--dest sandbox`)."
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
ephemeral: {
|
|
316
|
+
group: "Environments",
|
|
317
|
+
display: "ephemeral",
|
|
318
|
+
summary: "Manage ephemeral envs \u2014 list, get, delete, export, codegen, impersonate",
|
|
319
|
+
subcommands: {
|
|
320
|
+
list: {
|
|
321
|
+
summary: "List the ephemeral envs under your workspace",
|
|
322
|
+
flags: ["all-workspaces", ...AUTH],
|
|
323
|
+
example: "xanots ephemeral list"
|
|
324
|
+
},
|
|
325
|
+
get: {
|
|
326
|
+
summary: "Show one env's URL, status, and expiry",
|
|
327
|
+
args: [{ name: "name", required: true }],
|
|
328
|
+
flags: [...AUTH]
|
|
329
|
+
},
|
|
330
|
+
delete: {
|
|
331
|
+
summary: "Tear an env down now instead of waiting for its TTL",
|
|
332
|
+
args: [{ name: "name", required: true }],
|
|
333
|
+
flags: ["yes", { key: "force", summary: "Skip the destroy-this-env confirmation (same as --yes)" }, ...AUTH]
|
|
334
|
+
},
|
|
335
|
+
export: {
|
|
336
|
+
summary: "Write an env's bundle JSON",
|
|
337
|
+
args: [{ name: "name", required: true }],
|
|
338
|
+
flags: ["format", "path", { key: "name", summary: "Output basename (default: the env name)" }, ...AUTH]
|
|
339
|
+
},
|
|
340
|
+
codegen: {
|
|
341
|
+
summary: "Decode an env into a runnable XanoTS project",
|
|
342
|
+
args: [
|
|
343
|
+
{ name: "name", required: true },
|
|
344
|
+
{ name: "path", required: true, path: true }
|
|
345
|
+
],
|
|
346
|
+
flags: [...SCAFFOLD, CODEGEN_NO_VERIFY, "report", ...AUTH],
|
|
347
|
+
example: "xanots ephemeral codegen my-env ./app",
|
|
348
|
+
group: "Pull",
|
|
349
|
+
display: "ephemeral codegen <env> <path>",
|
|
350
|
+
groupSummary: "An ephemeral env \u2192 a runnable XanoTS project"
|
|
351
|
+
},
|
|
352
|
+
impersonate: {
|
|
353
|
+
summary: "Open the env's dashboard as a scoped session",
|
|
354
|
+
args: [{ name: "name", required: true }],
|
|
355
|
+
flags: ["guest", "url-only", ...AUTH]
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
sandbox: {
|
|
360
|
+
group: "Environments",
|
|
361
|
+
display: "sandbox",
|
|
362
|
+
summary: "Export, inspect, or codegen your throwaway sandbox",
|
|
363
|
+
subcommands: {
|
|
364
|
+
details: {
|
|
365
|
+
summary: "Print the sandbox tenant, headlined by its URL",
|
|
366
|
+
flags: [...AUTH],
|
|
367
|
+
example: "xanots sandbox details"
|
|
368
|
+
},
|
|
369
|
+
export: {
|
|
370
|
+
summary: "Write the sandbox workspace as JSON or multidoc XanoScript",
|
|
371
|
+
extraArgHint: "`sandbox export` takes no input; it exports what is CURRENTLY DEPLOYED to your sandbox. To compile a local workspace, use `xanots export <file>`.",
|
|
372
|
+
flags: ["format", "path", { key: "name", summary: "Output basename (default: `sandbox`)" }, "bundle", ...COMPILE, ...AUTH],
|
|
373
|
+
example: "xanots sandbox export --format multidoc"
|
|
374
|
+
},
|
|
375
|
+
codegen: {
|
|
376
|
+
summary: "Decode the sandbox into a runnable XanoTS project",
|
|
377
|
+
args: [{ name: "path", required: true, path: true }],
|
|
378
|
+
flags: [...SCAFFOLD, CODEGEN_NO_VERIFY, "report", ...AUTH],
|
|
379
|
+
example: "xanots sandbox codegen ./app",
|
|
380
|
+
group: "Pull",
|
|
381
|
+
display: "sandbox codegen <path>",
|
|
382
|
+
groupSummary: "Your sandbox \u2192 a runnable XanoTS project"
|
|
383
|
+
},
|
|
384
|
+
deploy: {
|
|
385
|
+
summary: "Removed \u2014 unified under `xanots deploy --dest sandbox`",
|
|
386
|
+
removed: "`xanots sandbox deploy` was removed \u2014 use `xanots deploy --dest sandbox` (same behavior against the singleton sandbox, unified under `deploy`)."
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
test: {
|
|
391
|
+
group: "Environments",
|
|
392
|
+
display: "test",
|
|
393
|
+
summary: "Run the unit and workflow tests an environment carries",
|
|
394
|
+
subcommands: {
|
|
395
|
+
list: {
|
|
396
|
+
summary: "List the tests in an environment, without running any",
|
|
397
|
+
flags: [READ_DEST, TEST_ENV, "kind", ...AUTH],
|
|
398
|
+
example: "xanots test list --dest sandbox"
|
|
399
|
+
},
|
|
400
|
+
run: {
|
|
401
|
+
summary: "Run one test by name",
|
|
402
|
+
args: [{ name: "name", required: true }],
|
|
403
|
+
flags: [READ_DEST, TEST_ENV, ...AUTH],
|
|
404
|
+
example: 'xanots test run "happy path" --dest sandbox'
|
|
405
|
+
},
|
|
406
|
+
"run-all": {
|
|
407
|
+
summary: "Run every test in an environment and report pass/fail",
|
|
408
|
+
flags: [READ_DEST, TEST_ENV, "kind", "concurrency", ...AUTH],
|
|
409
|
+
example: "xanots test run-all --dest sandbox"
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
// ── Account ─────────────────────────────────────────────────────────────
|
|
414
|
+
login: {
|
|
415
|
+
group: "Account",
|
|
416
|
+
display: "login",
|
|
417
|
+
summary: "OAuth sign-in \u2014 shared cache, or --local per project",
|
|
418
|
+
flags: [
|
|
419
|
+
"local",
|
|
420
|
+
"port",
|
|
421
|
+
"scope",
|
|
422
|
+
"origin",
|
|
423
|
+
"config",
|
|
424
|
+
{ key: "force", summary: "Sign in again even when a credential is already cached" }
|
|
425
|
+
],
|
|
426
|
+
example: "xanots login --local"
|
|
427
|
+
},
|
|
428
|
+
logout: {
|
|
429
|
+
group: "Account",
|
|
430
|
+
display: "logout",
|
|
431
|
+
summary: "Revoke the refresh token and clear the cache",
|
|
432
|
+
flags: ["local", "origin", "config"]
|
|
433
|
+
},
|
|
434
|
+
profile: {
|
|
435
|
+
group: "Account",
|
|
436
|
+
display: "profile me",
|
|
437
|
+
summary: "Show the signed-in user and instance URL",
|
|
438
|
+
subcommands: {
|
|
439
|
+
me: {
|
|
440
|
+
summary: "Print the scoped user and the instance URL",
|
|
441
|
+
flags: [...AUTH],
|
|
442
|
+
example: "xanots profile me"
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
whoami: {
|
|
447
|
+
group: "Account",
|
|
448
|
+
display: "whoami",
|
|
449
|
+
summary: "Alias for `profile me`",
|
|
450
|
+
aliasOf: "profile me",
|
|
451
|
+
flags: [...AUTH],
|
|
452
|
+
example: "xanots whoami"
|
|
453
|
+
},
|
|
454
|
+
// ── Maintenance ─────────────────────────────────────────────────────────
|
|
455
|
+
lock: {
|
|
456
|
+
group: "Maintenance",
|
|
457
|
+
display: "lock",
|
|
458
|
+
summary: "Maintain xano.lock identities \u2014 rename, prune, adopt",
|
|
459
|
+
subcommands: {
|
|
460
|
+
rename: {
|
|
461
|
+
summary: "Move an entry keeping its identity, so the next export renames in place",
|
|
462
|
+
args: [
|
|
463
|
+
{ name: "kind", required: true },
|
|
464
|
+
{ name: "old", required: true },
|
|
465
|
+
{ name: "new", required: true }
|
|
466
|
+
],
|
|
467
|
+
flags: ["lock", "entry"],
|
|
468
|
+
example: "xanots lock rename --entry=xano/index.ts table users members"
|
|
469
|
+
},
|
|
470
|
+
prune: {
|
|
471
|
+
summary: "Drop orphaned entries (all, or just the named keys)",
|
|
472
|
+
args: [
|
|
473
|
+
{ name: "entry-file", required: true, path: true, satisfiedBy: ["no-verify"] },
|
|
474
|
+
{ name: "keys\u2026", required: false, variadic: true }
|
|
475
|
+
],
|
|
476
|
+
flags: [
|
|
477
|
+
"yes",
|
|
478
|
+
"lock",
|
|
479
|
+
"entry",
|
|
480
|
+
{
|
|
481
|
+
key: "no-verify",
|
|
482
|
+
summary: "Prune the named keys without evaluating the entry file (identity only)"
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
example: "xanots lock prune ./index.ts --yes"
|
|
486
|
+
},
|
|
487
|
+
adopt: {
|
|
488
|
+
summary: "Seed the lock from a live engine packageExport",
|
|
489
|
+
args: [{ name: "bundle.json", required: true, path: true }],
|
|
490
|
+
flags: ["yes", "lock", "entry"],
|
|
491
|
+
example: "xanots lock adopt ./packageExport.json --entry=xano/index.ts"
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
completion: {
|
|
496
|
+
group: "Maintenance",
|
|
497
|
+
display: "completion <shell>",
|
|
498
|
+
summary: "Print a shell completion script (bash, zsh, fish)",
|
|
499
|
+
args: [{ name: "shell", required: true, values: ["bash", "zsh", "fish"] }],
|
|
500
|
+
example: 'xanots completion zsh > "${fpath[1]}/_xanots"'
|
|
501
|
+
},
|
|
502
|
+
version: {
|
|
503
|
+
group: "Maintenance",
|
|
504
|
+
display: "version",
|
|
505
|
+
summary: "Print the CLI version"
|
|
506
|
+
},
|
|
507
|
+
help: {
|
|
508
|
+
group: "Maintenance",
|
|
509
|
+
display: "help",
|
|
510
|
+
summary: "Show this help",
|
|
511
|
+
// Variadic: a help target is a command PATH (`help workspace codegen`), and
|
|
512
|
+
// `resolveHelpRequest` reads it from the raw argv before any arity check.
|
|
513
|
+
args: [{ name: "command", required: false, variadic: true }],
|
|
514
|
+
example: "xanots help deploy"
|
|
515
|
+
},
|
|
516
|
+
// ── Removed (kept so the failure is explanatory, not a typo guess) ───────
|
|
517
|
+
push: {
|
|
518
|
+
group: "Deploy",
|
|
519
|
+
display: "push",
|
|
520
|
+
summary: "Removed \u2014 use `xanots deploy`",
|
|
521
|
+
removed: "`xanots push` was removed \u2014 use `xanots deploy` (`--dest ephemeral` by default, or `--dest sandbox`)."
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
function isCommand(name) {
|
|
525
|
+
return Object.hasOwn(COMMANDS, name);
|
|
526
|
+
}
|
|
527
|
+
function getCommand(name) {
|
|
528
|
+
return isCommand(name) ? COMMANDS[name] : void 0;
|
|
529
|
+
}
|
|
530
|
+
function getSubcommand(command, sub) {
|
|
531
|
+
const subs = getCommand(command)?.subcommands;
|
|
532
|
+
return subs && Object.hasOwn(subs, sub) ? subs[sub] : void 0;
|
|
533
|
+
}
|
|
534
|
+
function liveCommandNames() {
|
|
535
|
+
return Object.entries(COMMANDS).filter(([, spec]) => spec.removed === void 0 && spec.aliasOf === void 0).map(([name]) => name);
|
|
536
|
+
}
|
|
537
|
+
function flagNames() {
|
|
538
|
+
return Object.keys(FLAGS);
|
|
539
|
+
}
|
|
540
|
+
function flagKey(ref) {
|
|
541
|
+
return typeof ref === "string" ? ref : ref.key;
|
|
542
|
+
}
|
|
543
|
+
function flagSummary(ref) {
|
|
544
|
+
if (typeof ref !== "string") return ref.summary;
|
|
545
|
+
return FLAGS[ref].summary;
|
|
546
|
+
}
|
|
547
|
+
function flagValues(ref) {
|
|
548
|
+
if (typeof ref !== "string" && ref.values !== void 0) return ref.values;
|
|
549
|
+
return FLAGS[flagKey(ref)]?.values;
|
|
550
|
+
}
|
|
551
|
+
function liveSubcommandNames(command) {
|
|
552
|
+
const subs = getCommand(command)?.subcommands;
|
|
553
|
+
if (!subs) return [];
|
|
554
|
+
return Object.entries(subs).filter(([, spec]) => spec.removed === void 0).map(([name]) => name);
|
|
555
|
+
}
|
|
556
|
+
function distance(a, b) {
|
|
557
|
+
let row = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
558
|
+
for (let i = 1; i <= a.length; i++) {
|
|
559
|
+
const next = [i];
|
|
560
|
+
for (let j = 1; j <= b.length; j++) {
|
|
561
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
562
|
+
next[j] = Math.min(next[j - 1] + 1, row[j] + 1, row[j - 1] + cost);
|
|
563
|
+
}
|
|
564
|
+
row = next;
|
|
565
|
+
}
|
|
566
|
+
return row[b.length];
|
|
567
|
+
}
|
|
568
|
+
function suggest(input, candidates) {
|
|
569
|
+
if (input === "") return void 0;
|
|
570
|
+
const lower = input.toLowerCase();
|
|
571
|
+
const prefix = candidates.filter((c) => c.startsWith(lower));
|
|
572
|
+
if (prefix.length === 1) return prefix[0];
|
|
573
|
+
let best;
|
|
574
|
+
let bestDistance = 3;
|
|
575
|
+
for (const c of candidates) {
|
|
576
|
+
const d = distance(lower, c);
|
|
577
|
+
if (d < bestDistance) {
|
|
578
|
+
bestDistance = d;
|
|
579
|
+
best = c;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return best;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export {
|
|
586
|
+
renderArgs,
|
|
587
|
+
HELP_GROUP_ORDER,
|
|
588
|
+
FLAGS,
|
|
589
|
+
GLOBAL_FLAGS,
|
|
590
|
+
COMMANDS,
|
|
591
|
+
isCommand,
|
|
592
|
+
getCommand,
|
|
593
|
+
getSubcommand,
|
|
594
|
+
liveCommandNames,
|
|
595
|
+
flagNames,
|
|
596
|
+
flagKey,
|
|
597
|
+
flagSummary,
|
|
598
|
+
flagValues,
|
|
599
|
+
liveSubcommandNames,
|
|
600
|
+
suggest
|
|
601
|
+
};
|
|
602
|
+
//# sourceMappingURL=chunk-YYRDLFSJ.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
tarGz
|
|
3
|
+
} from "./chunk-X4DVXBFY.js";
|
|
4
|
+
|
|
5
|
+
// src/validate/archive.ts
|
|
6
|
+
import { gunzipSync } from "zlib";
|
|
7
|
+
function encodeWorkspaceArchive(workspaceJson, extra = []) {
|
|
8
|
+
return tarGz([
|
|
9
|
+
{ name: "workspace.json", data: Buffer.from(workspaceJson, "utf8") },
|
|
10
|
+
...extra.map((e) => ({ name: e.name, data: Buffer.from(e.content, "utf8") }))
|
|
11
|
+
]);
|
|
12
|
+
}
|
|
13
|
+
function decodeWorkspaceArchive(data) {
|
|
14
|
+
let buf = Buffer.from(data);
|
|
15
|
+
let guard = 0;
|
|
16
|
+
while (buf.length > 2 && buf[0] === 31 && buf[1] === 139 && guard++ < 8) {
|
|
17
|
+
buf = gunzipSync(buf);
|
|
18
|
+
}
|
|
19
|
+
const files = readTar(buf);
|
|
20
|
+
const key = Object.keys(files).find((k) => k.endsWith("workspace.json"));
|
|
21
|
+
if (key === void 0) {
|
|
22
|
+
const seen = Object.keys(files).join(", ") || "none";
|
|
23
|
+
throw new Error(`Workspace export archive has no workspace.json (entries: ${seen}).`);
|
|
24
|
+
}
|
|
25
|
+
return JSON.parse(files[key].toString("utf8"));
|
|
26
|
+
}
|
|
27
|
+
function readTar(buf) {
|
|
28
|
+
const files = {};
|
|
29
|
+
let off = 0;
|
|
30
|
+
while (off + 512 <= buf.length) {
|
|
31
|
+
const name = buf.toString("utf8", off, off + 100).replace(/\0.*$/, "");
|
|
32
|
+
if (name === "") break;
|
|
33
|
+
const sizeField = buf.toString("utf8", off + 124, off + 136).replace(/\0.*$/, "").trim();
|
|
34
|
+
const size = parseInt(sizeField || "0", 8);
|
|
35
|
+
const start = off + 512;
|
|
36
|
+
if (Number.isFinite(size) && size > 0) files[name] = buf.subarray(start, start + size);
|
|
37
|
+
off = start + Math.ceil(size / 512) * 512;
|
|
38
|
+
}
|
|
39
|
+
return files;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
encodeWorkspaceArchive,
|
|
44
|
+
decodeWorkspaceArchive
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=chunk-ZUTSMMAG.js.map
|