@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
@@ -0,0 +1,22 @@
1
+ // src/emit/project-dir.ts
2
+ import { existsSync, readFileSync } from "fs";
3
+ import { join } from "path";
4
+ function assertProjectDir(dir, ctx) {
5
+ const manifest = join(dir, "package.json");
6
+ if (!existsSync(manifest)) {
7
+ throw new Error(`No package.json in ${dir} \u2014 ${ctx.what}.
8
+ ${ctx.remedy}`);
9
+ }
10
+ try {
11
+ JSON.parse(readFileSync(manifest, "utf8"));
12
+ } catch (err) {
13
+ throw new Error(
14
+ `${manifest} is not valid JSON, so npm cannot install into it \u2014 fix it and re-run. (${err instanceof Error ? err.message : String(err)})`
15
+ );
16
+ }
17
+ }
18
+
19
+ export {
20
+ assertProjectDir
21
+ };
22
+ //# sourceMappingURL=chunk-ERQZFWIW.js.map
@@ -73,7 +73,11 @@ var FLAGS = {
73
73
  guest: { spec: "--guest, -g", summary: "Mint a read-only guest session (browse only)" },
74
74
  "url-only": { spec: "--url-only, -u", summary: "Print the dashboard URL instead of opening a browser" },
75
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)" },
76
+ port: { spec: "--port <n>", summary: "Loopback callback port (default: 47100)" },
77
+ paste: {
78
+ spec: "--paste",
79
+ summary: "Sign in without the loopback callback: open the printed URL in any browser and paste the redirect back. For a host whose 127.0.0.1 the browser cannot reach \u2014 remote shell, container, Codespace. Needs a terminal."
80
+ },
77
81
  scope: { spec: '--scope "<list>"', summary: "OAuth scopes to request (default: the built-in set)" },
78
82
  runtime: { spec: "--runtime", summary: "After the round-trip, run each deployed function and report" },
79
83
  capture: { spec: "--capture", summary: "Write each round-tripped function's fetched JSON" },
@@ -127,6 +131,10 @@ var FLAGS = {
127
131
  spec: "--marketplace <pkgs>",
128
132
  summary: "Add-on packages to install and register, comma-separated"
129
133
  },
134
+ check: {
135
+ spec: "--check",
136
+ summary: "Report whether an upgrade is available and exit 7, without installing it"
137
+ },
130
138
  force: { spec: "--force", summary: "Scaffold into a non-empty directory (overwriting our own files)" },
131
139
  "no-install": { spec: "--no-install", summary: "Skip the post-scaffold npm install" },
132
140
  "dry-run": { spec: "--dry-run", summary: "Print what would change and exit without sending it" },
@@ -225,6 +233,19 @@ var COMMANDS = {
225
233
  // rather than every flag it accepts.
226
234
  example: "xanots init my-app --theme zinc-blue --ai claude --marketplace @xanots/auth"
227
235
  },
236
+ onboard: {
237
+ group: "Author",
238
+ display: "onboard [dir]",
239
+ summary: "Pick a framework, theme and add-ons in a browser, then scaffold",
240
+ // Variadic, and deliberately flagless. This command does not PARSE its
241
+ // arguments — it forwards them to a package it launches (see
242
+ // onboard-command.ts), so the arity check must budget for a tail it cannot
243
+ // describe. Declaring the configurator's flags here would freeze them: a
244
+ // flag added there would be rejected here until the SDK released, which is
245
+ // the coupling launching-instead-of-depending exists to avoid.
246
+ args: [{ name: "dir", required: false, path: true, variadic: true }],
247
+ example: "xanots onboard my-app"
248
+ },
228
249
  marketplace: {
229
250
  group: "Author",
230
251
  display: "marketplace <list|search|details|install>",
@@ -464,6 +485,7 @@ var COMMANDS = {
464
485
  summary: "OAuth sign-in \u2014 shared cache, or --local per project",
465
486
  flags: [
466
487
  "local",
488
+ "paste",
467
489
  "port",
468
490
  "scope",
469
491
  "origin",
@@ -551,6 +573,13 @@ var COMMANDS = {
551
573
  display: "version",
552
574
  summary: "Print the CLI version"
553
575
  },
576
+ upgrade: {
577
+ group: "Maintenance",
578
+ display: "upgrade",
579
+ summary: "Install the latest @xanots/sdk, or report an available upgrade with --check",
580
+ flags: ["check"],
581
+ example: "xanots upgrade --check"
582
+ },
554
583
  help: {
555
584
  group: "Maintenance",
556
585
  display: "help",
@@ -646,4 +675,4 @@ export {
646
675
  liveSubcommandNames,
647
676
  suggest
648
677
  };
649
- //# sourceMappingURL=chunk-DYCLVQXW.js.map
678
+ //# sourceMappingURL=chunk-F5T45NAM.js.map
@@ -6,7 +6,7 @@ import {
6
6
  realtimeChannelGuid,
7
7
  realtimeServerRefName,
8
8
  resolveRealtimeServerRef
9
- } from "./chunk-U3G2UW65.js";
9
+ } from "./chunk-CYJ7R3AD.js";
10
10
  import {
11
11
  assertCanonical,
12
12
  assertOneOf,
@@ -25,7 +25,7 @@ import {
25
25
  resolveAuthRef,
26
26
  resolveMockKeys,
27
27
  warnLiveDatasource
28
- } from "./chunk-5L4X5LS6.js";
28
+ } from "./chunk-YUPQOLFX.js";
29
29
  import {
30
30
  encodeStatement
31
31
  } from "./chunk-5XZ744TS.js";
@@ -35,7 +35,7 @@ import {
35
35
  lockKey,
36
36
  realtimeMessageSeedName,
37
37
  resolveRef
38
- } from "./chunk-4HT3BNZ7.js";
38
+ } from "./chunk-YUBJLB6G.js";
39
39
 
40
40
  // src/kinds/canonical.ts
41
41
  function resolveCanonicalToken(label, payloadKey, accessor, def, override) {
@@ -667,4 +667,4 @@ export {
667
667
  addonKind,
668
668
  addon
669
669
  };
670
- //# sourceMappingURL=chunk-TQUO2OXY.js.map
670
+ //# sourceMappingURL=chunk-FN4OQT2J.js.map
@@ -19,7 +19,7 @@ import {
19
19
  liveSubcommandNames,
20
20
  renderArgs,
21
21
  suggest
22
- } from "./chunk-DYCLVQXW.js";
22
+ } from "./chunk-F5T45NAM.js";
23
23
 
24
24
  // src/emit/help.ts
25
25
  function table(rows, s, indent = " ", fixedWidth) {
@@ -245,4 +245,4 @@ export {
245
245
  reportFailure,
246
246
  exitCodeOf
247
247
  };
248
- //# sourceMappingURL=chunk-6USV65XA.js.map
248
+ //# sourceMappingURL=chunk-IVP6TS26.js.map
@@ -2,14 +2,17 @@ import {
2
2
  presetFilePath,
3
3
  resolveAiPresets,
4
4
  scaffoldProject
5
- } from "./chunk-CMZLPTGW.js";
5
+ } from "./chunk-7SISR3CS.js";
6
6
  import {
7
7
  runNpmCapturingStderr
8
- } from "./chunk-WUSKBXXD.js";
8
+ } from "./chunk-ZSYZTGJH.js";
9
9
  import {
10
10
  DEFAULT_FRAMEWORK,
11
11
  allFrontendPresets,
12
12
  findFrontendPreset,
13
+ resolveFrameworkFlag
14
+ } from "./chunk-WGDAOOXG.js";
15
+ import {
13
16
  initLanding,
14
17
  renderApiTs,
15
18
  renderCnUtil,
@@ -23,9 +26,8 @@ import {
23
26
  renderTsconfig,
24
27
  renderViteConfig,
25
28
  renderXanoExampleMd,
26
- renderXanoIndex,
27
- resolveFrameworkFlag
28
- } from "./chunk-YZ4GU6F5.js";
29
+ renderXanoIndex
30
+ } from "./chunk-QUUB7HYK.js";
29
31
  import {
30
32
  DEFAULT_DARK_MODE,
31
33
  curatedThemes,
@@ -42,10 +44,10 @@ import {
42
44
  } from "./chunk-6DHJVLYP.js";
43
45
  import {
44
46
  readVersion
45
- } from "./chunk-3NFUWXOC.js";
47
+ } from "./chunk-MS3BRZAZ.js";
46
48
  import {
47
49
  UsageError
48
- } from "./chunk-6USV65XA.js";
50
+ } from "./chunk-IVP6TS26.js";
49
51
  import {
50
52
  blank,
51
53
  detail,
@@ -527,4 +529,4 @@ export {
527
529
  projectShellFiles,
528
530
  runInitCommand
529
531
  };
530
- //# sourceMappingURL=chunk-HQ2CBRVI.js.map
532
+ //# sourceMappingURL=chunk-KXCPZUUM.js.map
@@ -130,6 +130,8 @@ var OpenIdProvider = class {
130
130
  configPromise;
131
131
  /** The client_id the resolved config uses — set once `build()` completes. */
132
132
  resolvedClientId;
133
+ /** The issuer the resolved config discovered — set once `build()` completes. */
134
+ resolvedIssuer;
133
135
  redirectUri() {
134
136
  if (!this.opts.redirectUri) {
135
137
  throw new Error("OpenIdProvider: redirectUri is required for the authorize/exchange flow.");
@@ -147,6 +149,19 @@ var OpenIdProvider = class {
147
149
  }
148
150
  return this.resolvedClientId;
149
151
  }
152
+ /**
153
+ * The authorization server's issuer, as resolved by discovery. Only the paste
154
+ * login mode needs it: a pasted BARE code carries no `iss`, and the AS
155
+ * advertises issuer support, so one has to be supplied for the response to
156
+ * validate at all. Same lifecycle guard as `clientId()` — valid once the
157
+ * configuration has resolved.
158
+ */
159
+ issuer() {
160
+ if (!this.resolvedIssuer) {
161
+ throw new Error("OpenIdProvider.issuer() called before the configuration was resolved.");
162
+ }
163
+ return this.resolvedIssuer;
164
+ }
150
165
  async build() {
151
166
  const server = new URL(this.opts.authHost);
152
167
  const options = server.protocol === "http:" ? { execute: [client.allowInsecureRequests] } : void 0;
@@ -166,13 +181,15 @@ var OpenIdProvider = class {
166
181
  });
167
182
  }
168
183
  this.resolvedClientId = clientId;
169
- return client.discovery(
184
+ const config = await client.discovery(
170
185
  server,
171
186
  clientId,
172
187
  { token_endpoint_auth_method: "none" },
173
188
  client.None(),
174
189
  options
175
190
  );
191
+ this.resolvedIssuer = config.serverMetadata().issuer;
192
+ return config;
176
193
  }
177
194
  config() {
178
195
  return this.configPromise ??= this.build();
@@ -180,6 +197,7 @@ var OpenIdProvider = class {
180
197
  async reset() {
181
198
  this.configPromise = void 0;
182
199
  this.resolvedClientId = void 0;
200
+ this.resolvedIssuer = void 0;
183
201
  if (this.opts.redirectUri) {
184
202
  clearClient({ authHost: this.opts.authHost, redirectUri: this.opts.redirectUri });
185
203
  }
@@ -465,4 +483,4 @@ export {
465
483
  resolveScope,
466
484
  assertHttpsOrigin
467
485
  };
468
- //# sourceMappingURL=chunk-7REDODS2.js.map
486
+ //# sourceMappingURL=chunk-LLWK6H77.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  parseLock,
6
6
  serializeLock
7
- } from "./chunk-4HT3BNZ7.js";
7
+ } from "./chunk-YUBJLB6G.js";
8
8
 
9
9
  // src/lock/io.ts
10
10
  import { readFileSync, existsSync } from "fs";
@@ -35,4 +35,4 @@ export {
35
35
  readLockFile,
36
36
  writeLockFile
37
37
  };
38
- //# sourceMappingURL=chunk-HJPTWBLH.js.map
38
+ //# sourceMappingURL=chunk-MFIHIS6B.js.map