@xanots/sdk 0.0.3 → 0.0.5

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 (93) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +38 -1
  3. package/dist/.build-fingerprint +1 -1
  4. package/dist/agent-file-refresh-IJ7GN2FJ.js +17 -0
  5. package/dist/bin.js +12 -153
  6. package/dist/{capture-HUV5BNTC.js → capture-7PO6SGB4.js} +2 -2
  7. package/dist/{chunk-CMZLPTGW.js → chunk-7SISR3CS.js} +2 -2
  8. package/dist/{chunk-XQ22GLYS.js → chunk-AAFBSOSD.js} +6 -6
  9. package/dist/{chunk-BT2CSEC5.js → chunk-APOR6TCV.js} +4 -4
  10. package/dist/{chunk-55VHDNW5.js → chunk-BPEEGJJA.js} +108 -3
  11. package/dist/{chunk-U3G2UW65.js → chunk-CYJ7R3AD.js} +3 -3
  12. package/dist/{agent-file-refresh-6M5M7T24.js → chunk-D6OGU2AI.js} +5 -6
  13. package/dist/chunk-ERQZFWIW.js +22 -0
  14. package/dist/{chunk-DYCLVQXW.js → chunk-F5T45NAM.js} +31 -2
  15. package/dist/{chunk-TQUO2OXY.js → chunk-FN4OQT2J.js} +4 -4
  16. package/dist/{chunk-6USV65XA.js → chunk-IVP6TS26.js} +2 -2
  17. package/dist/{chunk-HQ2CBRVI.js → chunk-KXCPZUUM.js} +10 -8
  18. package/dist/{chunk-7REDODS2.js → chunk-LLWK6H77.js} +20 -2
  19. package/dist/{chunk-HJPTWBLH.js → chunk-MFIHIS6B.js} +2 -2
  20. package/dist/{chunk-3NFUWXOC.js → chunk-MS3BRZAZ.js} +146 -45
  21. package/dist/{chunk-2V4YE6QC.js → chunk-OARSPAIE.js} +112 -21
  22. package/dist/{chunk-7DKX2SPN.js → chunk-OR43PDCW.js} +4 -4
  23. package/dist/chunk-PGBK64U5.js +59 -0
  24. package/dist/{chunk-F6JCFRKO.js → chunk-PXXLBXOP.js} +2 -2
  25. package/dist/{chunk-W2G2WPTB.js → chunk-QA5ICJ4M.js} +3 -3
  26. package/dist/{chunk-YZ4GU6F5.js → chunk-QUUB7HYK.js} +5 -838
  27. package/dist/{chunk-C56BC2FY.js → chunk-SG4UBJ47.js} +2 -2
  28. package/dist/{chunk-76QBEIGO.js → chunk-T4XPCJRF.js} +3 -2
  29. package/dist/{chunk-VTIL47DT.js → chunk-W5NOKYEG.js} +6 -2
  30. package/dist/chunk-WGDAOOXG.js +845 -0
  31. package/dist/{chunk-DGSF2Q5H.js → chunk-WJYB7DSI.js} +2 -2
  32. package/dist/{chunk-4YMD2OOZ.js → chunk-XHEXOES3.js} +1 -1
  33. package/dist/{chunk-4HT3BNZ7.js → chunk-YUBJLB6G.js} +10 -2
  34. package/dist/{chunk-5L4X5LS6.js → chunk-YUPQOLFX.js} +77 -2
  35. package/dist/chunk-ZGA5MUNC.js +173 -0
  36. package/dist/{chunk-P3TTMWUP.js → chunk-ZOYMZZ3S.js} +8 -1
  37. package/dist/chunk-ZSYZTGJH.js +81 -0
  38. package/dist/cli.d.ts +14 -1
  39. package/dist/cli.js +8 -8
  40. package/dist/codegen-command-BLOS3GR3.js +43 -0
  41. package/dist/{completion-BKAFCZBE.js → completion-GHP5RRLQ.js} +2 -2
  42. package/dist/{deploy-command-4R6BYC6G.js → deploy-command-XOH76USO.js} +27 -27
  43. package/dist/{env-target-XWS2ZZ2Y.js → env-target-POGJMD6Q.js} +7 -7
  44. package/dist/{ephemeral-command-JL4TPIRQ.js → ephemeral-command-46SL27GJ.js} +25 -25
  45. package/dist/index.d.ts +2 -2
  46. package/dist/index.js +13 -7
  47. package/dist/init-command-NCRPVFGE.js +30 -0
  48. package/dist/internal.d.ts +2 -2
  49. package/dist/internal.js +50 -5
  50. package/dist/{io-AMIKRLPC.js → io-7VIA5SON.js} +3 -3
  51. package/dist/{live-diff-RXSJCVJ7.js → live-diff-FP4SFNT4.js} +2 -2
  52. package/dist/{lock-3CVKALKT.js → lock-KXOJIGCG.js} +2 -2
  53. package/dist/{lock-commands-XOYS75YQ.js → lock-commands-6UONZW26.js} +9 -9
  54. package/dist/{login-command-ACJF6KWQ.js → login-command-SG7IWTHW.js} +140 -37
  55. package/dist/{logout-command-MX3MJS5U.js → logout-command-J2AG5NKC.js} +3 -3
  56. package/dist/{loop-SAWAOUFO.js → loop-7SAIGRCZ.js} +3 -3
  57. package/dist/{marketplace-command-UVV3XAOL.js → marketplace-command-NKTQ3VPS.js} +11 -25
  58. package/dist/meta-client-OW5WKWW7.js +1 -1
  59. package/dist/node.d.ts +2 -2
  60. package/dist/node.js +18 -12
  61. package/dist/onboard-command-EHOHKQQU.js +36 -0
  62. package/dist/{profile-command-SWJ3SPKR.js → profile-command-ZPC2DPFV.js} +6 -6
  63. package/dist/{release-command-HZUY2XZX.js → release-command-FKQ6E3TD.js} +25 -25
  64. package/dist/{sandbox-details-command-HJE5SPVG.js → sandbox-details-command-DMY2KGA2.js} +5 -5
  65. package/dist/{sandbox-export-command-QCJY4GMV.js → sandbox-export-command-R6QMEK3D.js} +8 -8
  66. package/dist/scaffold.js +4 -2
  67. package/dist/{store-g45zwB33.d.ts → store-BJONDJoZ.d.ts} +171 -2
  68. package/dist/{test-command-72Y5S22H.js → test-command-56IAEYHX.js} +11 -11
  69. package/dist/upgrade-command-M2DZ3ZPD.js +177 -0
  70. package/dist/{validate-command-KDGH537H.js → validate-command-CIBQJND7.js} +12 -12
  71. package/dist/{workspace-command-ICSI6PKO.js → workspace-command-HZS43PHJ.js} +28 -27
  72. package/dist/workspace-export-AJMGN3CQ.js +1 -1
  73. package/guides/README.md +30 -0
  74. package/guides/authoring.md +642 -0
  75. package/guides/cli.md +192 -0
  76. package/guides/codegen.md +83 -0
  77. package/guides/coverage.md +67 -0
  78. package/guides/deploying.md +358 -0
  79. package/guides/environment.md +132 -0
  80. package/guides/object-kinds.md +376 -0
  81. package/guides/project-structure.md +43 -0
  82. package/guides/scaffold.md +198 -0
  83. package/guides/typed-frontend.md +201 -0
  84. package/llms/kinds-knowledge.md +20 -0
  85. package/llms/object-kinds.md +1 -0
  86. package/llms-full.txt +25 -2
  87. package/llms.txt +3 -2
  88. package/manifest.json +31 -4
  89. package/package.json +5 -2
  90. package/dist/chunk-WUSKBXXD.js +0 -25
  91. package/dist/chunk-ZO3HJOCJ.js +0 -29
  92. package/dist/codegen-command-FIADGXRN.js +0 -42
  93. package/dist/init-command-LOK75W64.js +0 -29
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureGitignored
3
- } from "./chunk-7REDODS2.js";
3
+ } from "./chunk-LLWK6H77.js";
4
4
  import {
5
5
  atomicWrite
6
6
  } from "./chunk-GNPVYOPB.js";
@@ -57,4 +57,4 @@ export {
57
57
  setEnvironment,
58
58
  clearEnvironment
59
59
  };
60
- //# sourceMappingURL=chunk-DGSF2Q5H.js.map
60
+ //# sourceMappingURL=chunk-WJYB7DSI.js.map
@@ -20,4 +20,4 @@ export {
20
20
  defineFunction,
21
21
  fileUrl
22
22
  };
23
- //# sourceMappingURL=chunk-4YMD2OOZ.js.map
23
+ //# sourceMappingURL=chunk-XHEXOES3.js.map
@@ -236,7 +236,15 @@ var REFERENCEABLE_KIND_PAYLOAD_KEYS = {
236
236
  // only for kinds in `REFERENCEABLE_KINDS` — and the engine REFUSES to export a
237
237
  // workflow test that has none ("Missing workflow test guid."), a failure that
238
238
  // surfaces only against a live instance.
239
- workflow_test: "workflow_test"
239
+ workflow_test: "workflow_test",
240
+ // Knowledge is listed here for IDENTITY, not for referencing — nothing in a
241
+ // stack resolves a knowledge item. Membership is what stamps its guid in
242
+ // `Xano#encodeOne` and what makes `knowledge:<name>` a valid lock key, and
243
+ // BOTH are load-bearing: the engine re-mints guids on every replace import
244
+ // while a merge import upserts BY guid, so without a locked identity the
245
+ // second `xanots release` inserts `<name>_01` beside the item it should have
246
+ // updated. Measured, not theorised.
247
+ knowledge: "knowledge"
240
248
  };
241
249
  var REFERENCEABLE_KINDS = new Set(Object.keys(REFERENCEABLE_KIND_PAYLOAD_KEYS));
242
250
  var SEED_SEP = "|";
@@ -672,4 +680,4 @@ export {
672
680
  adoptFromBundle,
673
681
  mergeObserved
674
682
  };
675
- //# sourceMappingURL=chunk-4HT3BNZ7.js.map
683
+ //# sourceMappingURL=chunk-YUBJLB6G.js.map
@@ -19,7 +19,7 @@ import {
19
19
  lockKey,
20
20
  resolveRef,
21
21
  sha1Bytes
22
- } from "./chunk-4HT3BNZ7.js";
22
+ } from "./chunk-YUBJLB6G.js";
23
23
 
24
24
  // src/types/xdo.ts
25
25
  var TAGS = [
@@ -3261,6 +3261,66 @@ function resolveAuthRef(hostLabel, host, auth2) {
3261
3261
  return resolveRef("dbo", auth2);
3262
3262
  }
3263
3263
 
3264
+ // src/kinds/knowledge.ts
3265
+ var KNOWLEDGE_FILE = /* @__PURE__ */ Symbol.for("xanots.knowledge.file");
3266
+ var KNOWLEDGE_DIR = /* @__PURE__ */ Symbol.for("xanots.knowledge.dir");
3267
+ function knowledgeFile(path, base) {
3268
+ return { [KNOWLEDGE_FILE]: { path, base: typeof base === "string" ? base : base.href } };
3269
+ }
3270
+ function knowledgeDir(path, base) {
3271
+ return { [KNOWLEDGE_DIR]: { path, base: typeof base === "string" ? base : base.href } };
3272
+ }
3273
+ function isKnowledgeFileSource(v2) {
3274
+ return typeof v2 === "object" && v2 !== null && KNOWLEDGE_FILE in v2;
3275
+ }
3276
+ function isKnowledgeDirSource(v2) {
3277
+ return typeof v2 === "object" && v2 !== null && KNOWLEDGE_DIR in v2;
3278
+ }
3279
+ function encodeKnowledge(def) {
3280
+ if (!def.name) {
3281
+ throw new Error("knowledge kind: `name` is required.");
3282
+ }
3283
+ if (!isKnowledgeFileSource(def.body)) {
3284
+ throw new Error(
3285
+ `knowledge "${def.name}": \`body\` must be a knowledgeFile("./x.md", import.meta.url) marker. A knowledge body is authored as a markdown FILE, not a string.`
3286
+ );
3287
+ }
3288
+ if (def.refs !== void 0 && !isKnowledgeDirSource(def.refs)) {
3289
+ throw new Error(
3290
+ `knowledge "${def.name}": \`refs\` must be a knowledgeDir("./dir", import.meta.url) marker.`
3291
+ );
3292
+ }
3293
+ return {
3294
+ name: def.name,
3295
+ description: def.description ?? "",
3296
+ // Bodies are read in the compile path; see the module header.
3297
+ content: "",
3298
+ // Not authorable: a user-scoped item is private to one UI user and is
3299
+ // excluded from branch clone and merge, so it has no meaning in source.
3300
+ scope: "workspace",
3301
+ mode: def.mode ?? "auto",
3302
+ knowledge_type: def.type ?? "skill",
3303
+ enabled: def.enabled ?? true,
3304
+ // Instance-owned state, gated on a permission this SDK does not model.
3305
+ locked: false,
3306
+ // Derived by the platform from the stored reference files — never authored.
3307
+ references: [],
3308
+ // Deferred: linked refs never reach an agent's prompt, and the bulk
3309
+ // transport does not carry them.
3310
+ linked_refs: [],
3311
+ tag: encodeTags(def.tags)
3312
+ };
3313
+ }
3314
+ function knowledge(def) {
3315
+ return def;
3316
+ }
3317
+ var knowledgeKind = {
3318
+ name: "knowledge",
3319
+ payloadKey: "knowledge",
3320
+ encode: encodeKnowledge
3321
+ };
3322
+ registerKind(knowledgeKind);
3323
+
3264
3324
  // src/statements/lean-input.ts
3265
3325
  function leanInput(name, v2) {
3266
3326
  assertInputValue(name, v2);
@@ -3550,6 +3610,12 @@ var PAYLOAD_ARRAY_KEYS = [
3550
3610
  "tool",
3551
3611
  "toolset",
3552
3612
  "app",
3613
+ // Prose an agent reads, not an object anything resolves — it references
3614
+ // nothing and nothing references it, so its position is arbitrary.
3615
+ "knowledge",
3616
+ // A knowledge item's reference files. A CHILD section, not a kind of its own:
3617
+ // each row names its parent by guid, so knowledge must precede it.
3618
+ "knowledge_file",
3553
3619
  // Realtime, in dependency order: a channel resolves its server, and a message
3554
3620
  // resolves both. They sit after `app` so every object they can reference
3555
3621
  // (tables for auth, api groups) is already in place.
@@ -3968,6 +4034,15 @@ export {
3968
4034
  clear,
3969
4035
  stackReferencesAuth,
3970
4036
  resolveAuthRef,
4037
+ KNOWLEDGE_FILE,
4038
+ KNOWLEDGE_DIR,
4039
+ knowledgeFile,
4040
+ knowledgeDir,
4041
+ isKnowledgeFileSource,
4042
+ isKnowledgeDirSource,
4043
+ encodeKnowledge,
4044
+ knowledge,
4045
+ knowledgeKind,
3971
4046
  warnLiveDatasource,
3972
4047
  encodeTests,
3973
4048
  test,
@@ -3993,4 +4068,4 @@ export {
3993
4068
  serializeBundle,
3994
4069
  emitBundle
3995
4070
  };
3996
- //# sourceMappingURL=chunk-5L4X5LS6.js.map
4071
+ //# sourceMappingURL=chunk-YUPQOLFX.js.map
@@ -0,0 +1,173 @@
1
+ import {
2
+ readVersion
3
+ } from "./chunk-MS3BRZAZ.js";
4
+ import {
5
+ atomicWrite
6
+ } from "./chunk-GNPVYOPB.js";
7
+ import {
8
+ blank,
9
+ detail,
10
+ style,
11
+ warn
12
+ } from "./chunk-EZG76F7R.js";
13
+
14
+ // src/emit/update-check.ts
15
+ import { existsSync, readFileSync, mkdirSync } from "fs";
16
+ import { homedir } from "os";
17
+ import { dirname, join } from "path";
18
+ import { createRequire } from "module";
19
+ function registryUrl() {
20
+ return process.env.XANOTS_UPDATE_REGISTRY ?? "https://registry.npmjs.org/@xanots/sdk/latest";
21
+ }
22
+ function cachePath() {
23
+ return process.env.XANOTS_UPDATE_CACHE ?? join(homedir(), ".xanots", "update-check.json");
24
+ }
25
+ var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
26
+ var FETCH_TIMEOUT_MS = 2e3;
27
+ var CHECK_TIMEOUT_MS = 1e4;
28
+ function isNewer(candidate, current) {
29
+ const a = parseSemver(candidate);
30
+ const b = parseSemver(current);
31
+ if (!a || !b) return false;
32
+ for (let i = 0; i < 3; i++) {
33
+ if (a.nums[i] !== b.nums[i]) return a.nums[i] > b.nums[i];
34
+ }
35
+ if (a.pre.length === 0) return b.pre.length > 0;
36
+ if (b.pre.length === 0) return false;
37
+ return comparePre(a.pre, b.pre) > 0;
38
+ }
39
+ function parseSemver(v) {
40
+ const m = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(v.trim());
41
+ if (!m) return null;
42
+ return {
43
+ nums: [Number(m[1]), Number(m[2]), Number(m[3])],
44
+ pre: m[4] ? m[4].split(".") : []
45
+ };
46
+ }
47
+ function comparePre(a, b) {
48
+ const len = Math.max(a.length, b.length);
49
+ for (let i = 0; i < len; i++) {
50
+ if (i >= a.length) return -1;
51
+ if (i >= b.length) return 1;
52
+ const x = a[i];
53
+ const y = b[i];
54
+ const xn = /^\d+$/.test(x);
55
+ const yn = /^\d+$/.test(y);
56
+ if (xn && yn) {
57
+ if (Number(x) !== Number(y)) return Number(x) < Number(y) ? -1 : 1;
58
+ } else if (xn !== yn) {
59
+ return xn ? -1 : 1;
60
+ } else if (x !== y) {
61
+ return x < y ? -1 : 1;
62
+ }
63
+ }
64
+ return 0;
65
+ }
66
+ function readCache() {
67
+ const path = cachePath();
68
+ if (!existsSync(path)) return void 0;
69
+ try {
70
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
71
+ if (typeof parsed.latest === "string" && typeof parsed.checkedAt === "number") {
72
+ return { latest: parsed.latest, checkedAt: parsed.checkedAt };
73
+ }
74
+ } catch {
75
+ }
76
+ return void 0;
77
+ }
78
+ function writeCache(cache) {
79
+ try {
80
+ const path = cachePath();
81
+ mkdirSync(dirname(path), { recursive: true });
82
+ atomicWrite(path, JSON.stringify(cache, null, 2) + "\n");
83
+ } catch {
84
+ }
85
+ }
86
+ async function fetchLatest(timeoutMs = FETCH_TIMEOUT_MS) {
87
+ try {
88
+ const res = await fetch(registryUrl(), {
89
+ headers: { accept: "application/json" },
90
+ signal: AbortSignal.timeout(timeoutMs)
91
+ });
92
+ if (!res.ok) return null;
93
+ const data = await res.json();
94
+ return typeof data.version === "string" ? data.version : null;
95
+ } catch {
96
+ return null;
97
+ }
98
+ }
99
+ var noticeSuppressed = false;
100
+ function suppressUpdateNotice() {
101
+ noticeSuppressed = true;
102
+ }
103
+ function disabled() {
104
+ return Boolean(
105
+ noticeSuppressed || process.env.XANOTS_NO_UPDATE_CHECK || process.env.NO_UPDATE_NOTIFIER || process.env.CI
106
+ );
107
+ }
108
+ async function resolveUpdateNotice(opts) {
109
+ if (!opts?.force && disabled()) return null;
110
+ const current = opts?.current ?? readVersion();
111
+ if (current === "unknown") return null;
112
+ const cache = readCache();
113
+ let latest = cache?.latest;
114
+ const now = Date.now();
115
+ if (!cache || now - cache.checkedAt > CHECK_INTERVAL_MS) {
116
+ const fetched = await fetchLatest();
117
+ if (fetched) {
118
+ latest = fetched;
119
+ writeCache({ latest: fetched, checkedAt: now });
120
+ }
121
+ }
122
+ return latest && isNewer(latest, current) ? { current, latest } : null;
123
+ }
124
+ async function checkForUpgrade(opts) {
125
+ const current = opts?.current ?? readVersion();
126
+ if (current === "unknown") return { status: "unknown", reason: "local-version" };
127
+ const latest = await fetchLatest(CHECK_TIMEOUT_MS);
128
+ if (latest === null) return { status: "unknown", reason: "registry" };
129
+ writeCache({ latest, checkedAt: Date.now() });
130
+ return { status: isNewer(latest, current) ? "available" : "current", current, latest };
131
+ }
132
+ function detectInstallMode() {
133
+ const override = process.env.XANOTS_INSTALL_MODE;
134
+ if (override === "global" || override === "local") return override;
135
+ try {
136
+ const requireFromCwd = createRequire(join(process.cwd(), "package.json"));
137
+ requireFromCwd.resolve("@xanots/sdk/package.json");
138
+ return "local";
139
+ } catch {
140
+ return "global";
141
+ }
142
+ }
143
+ function upgradeCommand(mode) {
144
+ return mode === "global" ? "npm i -g @xanots/sdk@latest" : "npm i -D @xanots/sdk@latest";
145
+ }
146
+ function printUpdateNotice(notice) {
147
+ blank();
148
+ warn(
149
+ `A new @xanots/sdk is available: ${style.dim(notice.current)} \u2192 ${style.green(notice.latest)}`
150
+ );
151
+ detail(`update: ${upgradeCommand(detectInstallMode())}`);
152
+ }
153
+ function runExitedClean(code = process.exitCode) {
154
+ return code === void 0 || code === 0;
155
+ }
156
+ async function maybeNotifyUpdate() {
157
+ try {
158
+ if (disabled() || process.stderr.isTTY !== true || !runExitedClean()) return;
159
+ const notice = await resolveUpdateNotice();
160
+ if (notice) printUpdateNotice(notice);
161
+ } catch {
162
+ }
163
+ }
164
+
165
+ export {
166
+ registryUrl,
167
+ suppressUpdateNotice,
168
+ checkForUpgrade,
169
+ detectInstallMode,
170
+ upgradeCommand,
171
+ maybeNotifyUpdate
172
+ };
173
+ //# sourceMappingURL=chunk-ZGA5MUNC.js.map
@@ -17,6 +17,13 @@ var STRIP_KEYS = /* @__PURE__ */ new Set([
17
17
  "workspace",
18
18
  "branch",
19
19
  "market_item",
20
+ // The CREATOR of a knowledge item (`{id: 0}` for anything an import created).
21
+ // Server-assigned provenance, in the same family as the already-stripped
22
+ // `workspace`/`branch` bindings: the SDK never authors it, and a workspace
23
+ // synced by two different people would otherwise diff on who touched it last.
24
+ // Verified to be a knowledge-only key — no encoder in this SDK emits `user`
25
+ // anywhere in a compiled payload.
26
+ "user",
20
27
  // engine-stored source artifact (the raw XanoScript text), not authored data
21
28
  "xanoscript",
22
29
  // A workflow test's LAST RUN result — when it ran, how long it took, and the
@@ -969,4 +976,4 @@ export {
969
976
  filledContext,
970
977
  normalize
971
978
  };
972
- //# sourceMappingURL=chunk-P3TTMWUP.js.map
979
+ //# sourceMappingURL=chunk-ZOYMZZ3S.js.map
@@ -0,0 +1,81 @@
1
+ // src/emit/npm.ts
2
+ import { spawnSync } from "child_process";
3
+ import { existsSync } from "fs";
4
+ import { dirname, join } from "path";
5
+ function findNpmCli(nodeExecPath = process.execPath) {
6
+ const bin = dirname(nodeExecPath);
7
+ const tail = ["node_modules", "npm", "bin", "npm-cli.js"];
8
+ const candidates = [join(bin, ...tail), join(bin, "..", "lib", ...tail)];
9
+ return candidates.find((c) => existsSync(c));
10
+ }
11
+ function npmCommand(platform, args, nodeExecPath = process.execPath, resolveNpmCli = findNpmCli) {
12
+ if (platform !== "win32") return { file: "npm", args, shell: false };
13
+ const cli = resolveNpmCli(nodeExecPath);
14
+ if (cli !== void 0) return { file: nodeExecPath, args: [cli, ...args], shell: false };
15
+ return { file: "npm.cmd", args: args.map(quoteForCmd), shell: true };
16
+ }
17
+ function quoteForCmd(arg) {
18
+ if (arg !== "" && !/[\s"&|<>^()%!]/.test(arg)) return arg;
19
+ const escaped = arg.replace(/(\\*)"/g, '$1$1""').replace(/(\\*)$/, "$1$1");
20
+ return `"${escaped}"`;
21
+ }
22
+ function runNpm(args, cwd, opts) {
23
+ const stdout = opts?.stdout === "stderr" ? 2 : "inherit";
24
+ const npm = npmCommand(process.platform, args);
25
+ const res = spawnSync(npm.file, [...npm.args], {
26
+ cwd,
27
+ stdio: ["inherit", stdout, "inherit"],
28
+ shell: npm.shell
29
+ });
30
+ return res.status ?? 1;
31
+ }
32
+ function runNpmCapturingStderr(args, cwd) {
33
+ const npm = npmCommand(process.platform, args);
34
+ const res = spawnSync(npm.file, [...npm.args], {
35
+ cwd,
36
+ stdio: ["inherit", "inherit", "pipe"],
37
+ encoding: "utf8",
38
+ shell: npm.shell
39
+ });
40
+ const stderr = res.stderr ?? "";
41
+ if (stderr !== "") process.stderr.write(stderr);
42
+ return { status: res.status ?? 1, stderr };
43
+ }
44
+ function npmViewVersion(pkg) {
45
+ const npm = npmCommand(process.platform, ["view", pkg, "version"]);
46
+ const res = spawnSync(npm.file, [...npm.args], {
47
+ stdio: ["ignore", "pipe", "pipe"],
48
+ encoding: "utf8",
49
+ shell: npm.shell
50
+ });
51
+ const stderr = (res.stderr ?? "").trim();
52
+ const version = (res.stdout ?? "").trim();
53
+ if ((res.status ?? 1) !== 0 || version === "") {
54
+ return { ok: false, stderr: stderr !== "" ? stderr : describeSpawnFailure(npm.file, res.error) };
55
+ }
56
+ return { ok: true, version };
57
+ }
58
+ function describeSpawnFailure(file, error) {
59
+ if (error === void 0) return "npm exited without reporting a version.";
60
+ return `Could not run ${file}: ${error.message}`;
61
+ }
62
+ function condenseNpmError(stderr) {
63
+ const kept = [];
64
+ for (const line of stderr.split("\n")) {
65
+ const body = line.replace(/^npm (?:error|ERR!)\s?/, "");
66
+ if (body.trim() === "") continue;
67
+ if (/^\s*at\s/.test(body)) continue;
68
+ if (/^\s{2,}\S+:\s/.test(body)) continue;
69
+ if (/^\s*[{}],?\s*$/.test(body)) continue;
70
+ kept.push(/\{\s*$/.test(body) ? line.replace(/\s*\{\s*$/, "") : line);
71
+ }
72
+ return kept.join("\n").trim();
73
+ }
74
+
75
+ export {
76
+ runNpm,
77
+ runNpmCapturingStderr,
78
+ npmViewVersion,
79
+ condenseNpmError
80
+ };
81
+ //# sourceMappingURL=chunk-ZSYZTGJH.js.map
package/dist/cli.d.ts CHANGED
@@ -62,6 +62,12 @@ interface ParsedArgs {
62
62
  strict: boolean;
63
63
  /** `--yes`/`-y`: confirm destructive lock maintenance non-interactively. */
64
64
  yes: boolean;
65
+ /**
66
+ * `upgrade --check`: report whether a newer `@xanots/sdk` is published and
67
+ * exit non-zero when one is, instead of installing it. The reporting half of
68
+ * a command whose default is to act.
69
+ */
70
+ check: boolean;
65
71
  /** `push --bundle <path>`: upload an already-exported bundle instead of a file entry. */
66
72
  bundle: string | undefined;
67
73
  /** `--reset`: accepted but redundant — every deploy is a full replace now. */
@@ -135,8 +141,15 @@ interface ParsedArgs {
135
141
  urlOnly: boolean;
136
142
  /** `marketplace details --prompt`: print the add-on's agent prompt alone, for piping. */
137
143
  prompt: boolean;
138
- /** `login --port <n>`: fixed loopback callback port (default: an ephemeral port). */
144
+ /** `login --port <n>`: loopback callback port (default: `DEFAULT_PORT`, 47100). */
139
145
  port: number | undefined;
146
+ /**
147
+ * `login --paste`: skip the loopback callback server and read the redirect back
148
+ * from the user, for a host whose 127.0.0.1 the browser cannot reach (remote
149
+ * shell, container, Codespace). Distinct from `XANO_NO_BROWSER`, which only
150
+ * suppresses the browser launch and still needs the redirect to arrive.
151
+ */
152
+ paste: boolean;
140
153
  /** `login --scope "<space list>"`: OAuth scopes to request (default: the built-in xano-cli set). */
141
154
  scope: string | undefined;
142
155
  /** `validate --runtime`: after import + round-trip, run each deployed function and report. */
package/dist/cli.js CHANGED
@@ -8,17 +8,17 @@ import {
8
8
  resolveHelpRequest,
9
9
  resolveLockPath,
10
10
  run
11
- } from "./chunk-3NFUWXOC.js";
12
- import "./chunk-6USV65XA.js";
13
- import "./chunk-HJPTWBLH.js";
14
- import "./chunk-EZG76F7R.js";
11
+ } from "./chunk-MS3BRZAZ.js";
12
+ import "./chunk-IVP6TS26.js";
13
+ import "./chunk-MFIHIS6B.js";
15
14
  import "./chunk-GNPVYOPB.js";
16
- import "./chunk-55VHDNW5.js";
17
- import "./chunk-DYCLVQXW.js";
18
- import "./chunk-5L4X5LS6.js";
15
+ import "./chunk-EZG76F7R.js";
16
+ import "./chunk-BPEEGJJA.js";
17
+ import "./chunk-F5T45NAM.js";
18
+ import "./chunk-YUPQOLFX.js";
19
19
  import "./chunk-WHOJWOSV.js";
20
20
  import "./chunk-5XZ744TS.js";
21
- import "./chunk-4HT3BNZ7.js";
21
+ import "./chunk-YUBJLB6G.js";
22
22
  export {
23
23
  compileBundle,
24
24
  exportBundleJson,
@@ -0,0 +1,43 @@
1
+ import {
2
+ blameGeneratedFile,
3
+ fetchWorkspaceBundle,
4
+ isMissingDependencyError,
5
+ runCodegenCommand,
6
+ verifyCrashEntry
7
+ } from "./chunk-OARSPAIE.js";
8
+ import "./chunk-ZOYMZZ3S.js";
9
+ import "./chunk-SG4UBJ47.js";
10
+ import "./chunk-LLWK6H77.js";
11
+ import "./chunk-QTNO2WD6.js";
12
+ import "./chunk-ZUTSMMAG.js";
13
+ import "./chunk-X4DVXBFY.js";
14
+ import "./chunk-KXCPZUUM.js";
15
+ import "./chunk-7SISR3CS.js";
16
+ import "./chunk-ZSYZTGJH.js";
17
+ import "./chunk-3IGNIP6R.js";
18
+ import "./chunk-PXXLBXOP.js";
19
+ import "./chunk-LU7TRWMC.js";
20
+ import "./chunk-WGDAOOXG.js";
21
+ import "./chunk-QUUB7HYK.js";
22
+ import "./chunk-6DHJVLYP.js";
23
+ import "./chunk-4BXJGVZ3.js";
24
+ import "./chunk-CYJ7R3AD.js";
25
+ import "./chunk-MS3BRZAZ.js";
26
+ import "./chunk-IVP6TS26.js";
27
+ import "./chunk-MFIHIS6B.js";
28
+ import "./chunk-GNPVYOPB.js";
29
+ import "./chunk-EZG76F7R.js";
30
+ import "./chunk-BPEEGJJA.js";
31
+ import "./chunk-F5T45NAM.js";
32
+ import "./chunk-YUPQOLFX.js";
33
+ import "./chunk-WHOJWOSV.js";
34
+ import "./chunk-5XZ744TS.js";
35
+ import "./chunk-YUBJLB6G.js";
36
+ export {
37
+ blameGeneratedFile,
38
+ fetchWorkspaceBundle,
39
+ isMissingDependencyError,
40
+ runCodegenCommand,
41
+ verifyCrashEntry
42
+ };
43
+ //# sourceMappingURL=codegen-command-BLOS3GR3.js.map
@@ -5,7 +5,7 @@ import {
5
5
  getCommand,
6
6
  liveCommandNames,
7
7
  liveSubcommandNames
8
- } from "./chunk-DYCLVQXW.js";
8
+ } from "./chunk-F5T45NAM.js";
9
9
 
10
10
  // src/emit/completion.ts
11
11
  var COMPLETION_SHELLS = ["bash", "zsh", "fish"];
@@ -295,4 +295,4 @@ export {
295
295
  renderCompletion,
296
296
  runCompletionCommand
297
297
  };
298
- //# sourceMappingURL=completion-BKAFCZBE.js.map
298
+ //# sourceMappingURL=completion-GHP5RRLQ.js.map
@@ -1,10 +1,10 @@
1
- import {
2
- assertBundleInput,
3
- loadBundleText
4
- } from "./chunk-W2G2WPTB.js";
5
1
  import {
6
2
  importWorkspaceArchive
7
3
  } from "./chunk-5WGEURVI.js";
4
+ import {
5
+ assertBundleInput,
6
+ loadBundleText
7
+ } from "./chunk-QA5ICJ4M.js";
8
8
  import {
9
9
  createEphemeral,
10
10
  getEphemeral,
@@ -13,19 +13,27 @@ import {
13
13
  tenantBaseUrl,
14
14
  waitUntilReady
15
15
  } from "./chunk-6DHBYBTO.js";
16
- import {
17
- encodeWorkspaceArchive
18
- } from "./chunk-ZUTSMMAG.js";
19
16
  import {
20
17
  getEnvironment,
21
18
  readEphemeralState,
22
19
  setEnvironment
23
- } from "./chunk-DGSF2Q5H.js";
20
+ } from "./chunk-WJYB7DSI.js";
21
+ import {
22
+ openBrowser
23
+ } from "./chunk-W5NOKYEG.js";
24
24
  import {
25
25
  microserviceLine,
26
26
  readyRatio,
27
27
  waitForMicroservices
28
28
  } from "./chunk-NDZFBZHC.js";
29
+ import {
30
+ getAccessToken
31
+ } from "./chunk-SG4UBJ47.js";
32
+ import "./chunk-LLWK6H77.js";
33
+ import {
34
+ encodeWorkspaceArchive
35
+ } from "./chunk-ZUTSMMAG.js";
36
+ import "./chunk-X4DVXBFY.js";
29
37
  import {
30
38
  isMachineOutput,
31
39
  writeJson
@@ -34,19 +42,12 @@ import {
34
42
  fetchOrExplain,
35
43
  httpFailure
36
44
  } from "./chunk-3IGNIP6R.js";
37
- import {
38
- openBrowser
39
- } from "./chunk-VTIL47DT.js";
40
- import {
41
- getAccessToken
42
- } from "./chunk-C56BC2FY.js";
43
- import "./chunk-7REDODS2.js";
44
- import "./chunk-X4DVXBFY.js";
45
- import "./chunk-3NFUWXOC.js";
45
+ import "./chunk-MS3BRZAZ.js";
46
46
  import {
47
47
  assertWritableDest
48
- } from "./chunk-6USV65XA.js";
49
- import "./chunk-HJPTWBLH.js";
48
+ } from "./chunk-IVP6TS26.js";
49
+ import "./chunk-MFIHIS6B.js";
50
+ import "./chunk-GNPVYOPB.js";
50
51
  import {
51
52
  blank,
52
53
  detail,
@@ -61,13 +62,12 @@ import {
61
62
  warn,
62
63
  withSpinner
63
64
  } from "./chunk-EZG76F7R.js";
64
- import "./chunk-GNPVYOPB.js";
65
- import "./chunk-55VHDNW5.js";
66
- import "./chunk-DYCLVQXW.js";
67
- import "./chunk-5L4X5LS6.js";
65
+ import "./chunk-BPEEGJJA.js";
66
+ import "./chunk-F5T45NAM.js";
67
+ import "./chunk-YUPQOLFX.js";
68
68
  import "./chunk-WHOJWOSV.js";
69
69
  import "./chunk-5XZ744TS.js";
70
- import "./chunk-4HT3BNZ7.js";
70
+ import "./chunk-YUBJLB6G.js";
71
71
 
72
72
  // src/emit/deploy-command.ts
73
73
  import { basename } from "path";
@@ -158,7 +158,7 @@ async function runDeployedTests(auth, dest, summary, args) {
158
158
  }
159
159
  }
160
160
  async function runTestsOrThrow(auth, dest, summary, args) {
161
- const { runSuite, EXIT_TESTS_FAILED } = await import("./test-command-72Y5S22H.js");
161
+ const { runSuite, EXIT_TESTS_FAILED } = await import("./test-command-56IAEYHX.js");
162
162
  let target;
163
163
  if (dest === "ephemeral") {
164
164
  if (summary.url === void 0) {
@@ -168,7 +168,7 @@ async function runTestsOrThrow(auth, dest, summary, args) {
168
168
  const name = summary.ephemeral?.name;
169
169
  target = { base: summary.url, workspaceId: 1, label: name ? `ephemeral ${name}` : "the ephemeral", env: name };
170
170
  } else {
171
- const { resolveMetaTarget } = await import("./env-target-XWS2ZZ2Y.js");
171
+ const { resolveMetaTarget } = await import("./env-target-POGJMD6Q.js");
172
172
  target = await resolveMetaTarget(auth, { dest: "sandbox" });
173
173
  }
174
174
  const outcomes = await runSuite(auth, target, {
@@ -448,4 +448,4 @@ export {
448
448
  runDeployedTests,
449
449
  verifyMicroservices
450
450
  };
451
- //# sourceMappingURL=deploy-command-4R6BYC6G.js.map
451
+ //# sourceMappingURL=deploy-command-XOH76USO.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  resolveMetaTarget
3
- } from "./chunk-BT2CSEC5.js";
4
- import "./chunk-DGSF2Q5H.js";
5
- import "./chunk-7DKX2SPN.js";
3
+ } from "./chunk-APOR6TCV.js";
4
+ import "./chunk-WJYB7DSI.js";
5
+ import "./chunk-OR43PDCW.js";
6
6
  import "./chunk-NDZFBZHC.js";
7
+ import "./chunk-SG4UBJ47.js";
8
+ import "./chunk-LLWK6H77.js";
7
9
  import "./chunk-NUQCEOKA.js";
8
10
  import "./chunk-3IGNIP6R.js";
9
- import "./chunk-C56BC2FY.js";
10
- import "./chunk-7REDODS2.js";
11
- import "./chunk-EZG76F7R.js";
12
11
  import "./chunk-GNPVYOPB.js";
12
+ import "./chunk-EZG76F7R.js";
13
13
  export {
14
14
  resolveMetaTarget
15
15
  };
16
- //# sourceMappingURL=env-target-XWS2ZZ2Y.js.map
16
+ //# sourceMappingURL=env-target-POGJMD6Q.js.map