@xanots/sdk 0.0.3 → 0.0.4

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 (87) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +34 -1
  3. package/dist/agent-file-refresh-IJ7GN2FJ.js +17 -0
  4. package/dist/bin.js +12 -153
  5. package/dist/{capture-HUV5BNTC.js → capture-7PO6SGB4.js} +2 -2
  6. package/dist/{chunk-CMZLPTGW.js → chunk-7SISR3CS.js} +2 -2
  7. package/dist/{chunk-7DKX2SPN.js → chunk-ACQCK4DT.js} +4 -4
  8. package/dist/{chunk-XQ22GLYS.js → chunk-AJ7JQ4OU.js} +5 -5
  9. package/dist/{chunk-ZO3HJOCJ.js → chunk-ALNQCWAW.js} +2 -2
  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-3NFUWXOC.js → chunk-DUC3PXDG.js} +142 -45
  14. package/dist/{chunk-HQ2CBRVI.js → chunk-EAIR6VUL.js} +10 -8
  15. package/dist/chunk-ERQZFWIW.js +22 -0
  16. package/dist/{chunk-TQUO2OXY.js → chunk-FN4OQT2J.js} +4 -4
  17. package/dist/{chunk-6USV65XA.js → chunk-KGNJM4LN.js} +2 -2
  18. package/dist/{chunk-HJPTWBLH.js → chunk-MFIHIS6B.js} +2 -2
  19. package/dist/{chunk-F6JCFRKO.js → chunk-PXXLBXOP.js} +2 -2
  20. package/dist/{chunk-YZ4GU6F5.js → chunk-QUUB7HYK.js} +5 -838
  21. package/dist/{chunk-W2G2WPTB.js → chunk-SWIXWJIY.js} +3 -3
  22. package/dist/{chunk-76QBEIGO.js → chunk-T4XPCJRF.js} +3 -2
  23. package/dist/chunk-T6N3VMMO.js +173 -0
  24. package/dist/{chunk-2V4YE6QC.js → chunk-VKD3EBKG.js} +112 -21
  25. package/dist/{chunk-BT2CSEC5.js → chunk-VWGJQTNA.js} +3 -3
  26. package/dist/chunk-WGDAOOXG.js +845 -0
  27. package/dist/{chunk-4YMD2OOZ.js → chunk-XHEXOES3.js} +1 -1
  28. package/dist/{chunk-4HT3BNZ7.js → chunk-YUBJLB6G.js} +10 -2
  29. package/dist/{chunk-5L4X5LS6.js → chunk-YUPQOLFX.js} +77 -2
  30. package/dist/{chunk-DYCLVQXW.js → chunk-YYSJAAJM.js} +25 -1
  31. package/dist/{chunk-P3TTMWUP.js → chunk-ZOYMZZ3S.js} +8 -1
  32. package/dist/chunk-ZSYZTGJH.js +81 -0
  33. package/dist/cli.d.ts +6 -0
  34. package/dist/cli.js +8 -8
  35. package/dist/{codegen-command-FIADGXRN.js → codegen-command-Z7WQMOJ7.js} +21 -20
  36. package/dist/{completion-BKAFCZBE.js → completion-4GYN752B.js} +2 -2
  37. package/dist/{deploy-command-4R6BYC6G.js → deploy-command-M2S4HHLC.js} +26 -26
  38. package/dist/{env-target-XWS2ZZ2Y.js → env-target-GSFCYHKZ.js} +6 -6
  39. package/dist/{ephemeral-command-JL4TPIRQ.js → ephemeral-command-6WJW7LP6.js} +24 -24
  40. package/dist/index.d.ts +2 -2
  41. package/dist/index.js +13 -7
  42. package/dist/init-command-GJUPWTKA.js +30 -0
  43. package/dist/internal.d.ts +2 -2
  44. package/dist/internal.js +50 -5
  45. package/dist/{io-AMIKRLPC.js → io-7VIA5SON.js} +3 -3
  46. package/dist/{live-diff-RXSJCVJ7.js → live-diff-FP4SFNT4.js} +2 -2
  47. package/dist/{lock-3CVKALKT.js → lock-KXOJIGCG.js} +2 -2
  48. package/dist/{lock-commands-XOYS75YQ.js → lock-commands-7IH7RSSP.js} +9 -9
  49. package/dist/{login-command-ACJF6KWQ.js → login-command-QM5SBBI2.js} +2 -2
  50. package/dist/{logout-command-MX3MJS5U.js → logout-command-THPASOHM.js} +2 -2
  51. package/dist/{loop-SAWAOUFO.js → loop-7SAIGRCZ.js} +3 -3
  52. package/dist/{marketplace-command-UVV3XAOL.js → marketplace-command-463DT7O7.js} +11 -25
  53. package/dist/meta-client-OW5WKWW7.js +1 -1
  54. package/dist/node.d.ts +2 -2
  55. package/dist/node.js +18 -12
  56. package/dist/onboard-command-EHOHKQQU.js +36 -0
  57. package/dist/{profile-command-SWJ3SPKR.js → profile-command-EUWPVWED.js} +6 -6
  58. package/dist/{release-command-HZUY2XZX.js → release-command-M4CVNTWL.js} +25 -25
  59. package/dist/{sandbox-details-command-HJE5SPVG.js → sandbox-details-command-BRII3QHG.js} +5 -5
  60. package/dist/{sandbox-export-command-QCJY4GMV.js → sandbox-export-command-PCZ5FL4U.js} +8 -8
  61. package/dist/scaffold.js +4 -2
  62. package/dist/{store-g45zwB33.d.ts → store-BJONDJoZ.d.ts} +171 -2
  63. package/dist/{test-command-72Y5S22H.js → test-command-U4G5Y3UM.js} +10 -10
  64. package/dist/upgrade-command-CKJ4BS2P.js +177 -0
  65. package/dist/{validate-command-KDGH537H.js → validate-command-S5N37JRP.js} +12 -12
  66. package/dist/{workspace-command-ICSI6PKO.js → workspace-command-RALSEJSW.js} +28 -27
  67. package/dist/workspace-export-AJMGN3CQ.js +1 -1
  68. package/guides/README.md +30 -0
  69. package/guides/authoring.md +642 -0
  70. package/guides/cli.md +191 -0
  71. package/guides/codegen.md +83 -0
  72. package/guides/coverage.md +67 -0
  73. package/guides/deploying.md +340 -0
  74. package/guides/environment.md +132 -0
  75. package/guides/object-kinds.md +376 -0
  76. package/guides/project-structure.md +43 -0
  77. package/guides/scaffold.md +198 -0
  78. package/guides/typed-frontend.md +201 -0
  79. package/llms/kinds-knowledge.md +20 -0
  80. package/llms/object-kinds.md +1 -0
  81. package/llms-full.txt +25 -2
  82. package/llms.txt +3 -2
  83. package/manifest.json +26 -3
  84. package/package.json +5 -2
  85. package/dist/.build-fingerprint +0 -1
  86. package/dist/chunk-WUSKBXXD.js +0 -25
  87. package/dist/init-command-LOK75W64.js +0 -29
@@ -9,11 +9,11 @@ import {
9
9
  unknownFlag,
10
10
  unknownHelpTopic,
11
11
  unknownSubcommand
12
- } from "./chunk-6USV65XA.js";
12
+ } from "./chunk-KGNJM4LN.js";
13
13
  import {
14
14
  readLockFile,
15
15
  writeLockFile
16
- } from "./chunk-HJPTWBLH.js";
16
+ } from "./chunk-MFIHIS6B.js";
17
17
  import {
18
18
  detail,
19
19
  info,
@@ -24,15 +24,17 @@ import {
24
24
  Xano,
25
25
  assertSeedIds,
26
26
  coerceSeedRowValues
27
- } from "./chunk-55VHDNW5.js";
27
+ } from "./chunk-BPEEGJJA.js";
28
28
  import {
29
29
  getCommand,
30
30
  getSubcommand,
31
31
  isCommand,
32
32
  suggest
33
- } from "./chunk-DYCLVQXW.js";
33
+ } from "./chunk-YYSJAAJM.js";
34
34
  import {
35
35
  FILTER_NAMES,
36
+ KNOWLEDGE_DIR,
37
+ KNOWLEDGE_FILE,
36
38
  SEED_FILE,
37
39
  buildContentEnvelope,
38
40
  emit,
@@ -42,7 +44,7 @@ import {
42
44
  pathSegment,
43
45
  serializeBundle,
44
46
  tableColumns
45
- } from "./chunk-5L4X5LS6.js";
47
+ } from "./chunk-YUPQOLFX.js";
46
48
  import {
47
49
  WORKSPACE_KEY,
48
50
  createLockContext,
@@ -54,12 +56,12 @@ import {
54
56
  seedLockOverrides,
55
57
  serializeLock,
56
58
  validateLockModel
57
- } from "./chunk-4HT3BNZ7.js";
59
+ } from "./chunk-YUBJLB6G.js";
58
60
 
59
61
  // src/emit/cli.ts
60
- import { pathToFileURL as pathToFileURL2, fileURLToPath as fileURLToPath2 } from "url";
61
- import { existsSync, readdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
62
- import { basename, dirname, join, relative, resolve } from "path";
62
+ import { pathToFileURL as pathToFileURL3, fileURLToPath as fileURLToPath3 } from "url";
63
+ import { existsSync, readdirSync as readdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
64
+ import { basename, dirname, join as join2, relative as relative2, resolve } from "path";
63
65
  import { createRequire } from "module";
64
66
 
65
67
  // src/workspace/seed.ts
@@ -250,6 +252,84 @@ function findUnresolvableFilters(bundle) {
250
252
  return findings;
251
253
  }
252
254
 
255
+ // src/workspace/knowledge.ts
256
+ import { readFileSync as readFileSync2, readdirSync, statSync } from "fs";
257
+ import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
258
+ import { join, relative, sep } from "path";
259
+ var MAX_KNOWLEDGE_FILE_BYTES = 1024 * 1024;
260
+ function resolveMarker(ref) {
261
+ const base = /^[a-z][a-z0-9+.-]*:/i.test(ref.base) ? ref.base : pathToFileURL2(ref.base).href;
262
+ return fileURLToPath2(new URL(ref.path, base));
263
+ }
264
+ function collectRefFiles(dir, itemName) {
265
+ const out = [];
266
+ const walk = (cur) => {
267
+ for (const entry of readdirSync(cur, { withFileTypes: true })) {
268
+ const full = join(cur, entry.name);
269
+ if (entry.isDirectory()) {
270
+ walk(full);
271
+ continue;
272
+ }
273
+ if (!entry.isFile()) continue;
274
+ const content = readFileSync2(full, "utf8");
275
+ const size = Buffer.byteLength(content, "utf8");
276
+ const rel = relative(dir, full).split(sep).join("/");
277
+ if (size > MAX_KNOWLEDGE_FILE_BYTES) {
278
+ throw new Error(
279
+ `knowledge "${itemName}": reference file "${rel}" is ${size} bytes, over the ${MAX_KNOWLEDGE_FILE_BYTES}-byte limit the engine accepts. Split it, or move the bulk of it somewhere the agent fetches at run time.`
280
+ );
281
+ }
282
+ out.push({ path: rel, content, size });
283
+ }
284
+ };
285
+ walk(dir);
286
+ out.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
287
+ return out;
288
+ }
289
+ function resolveKnowledge(defs) {
290
+ const resolved = [];
291
+ for (const def of defs) {
292
+ const bodyRef = def.body[KNOWLEDGE_FILE];
293
+ const where = `knowledgeFile("${bodyRef.path}")`;
294
+ let content;
295
+ try {
296
+ const abs = resolveMarker(bodyRef);
297
+ if (statSync(abs).isDirectory()) {
298
+ throw new Error(
299
+ `knowledge "${def.name}": ${where} points at a DIRECTORY. A body is one markdown file; use \`refs: knowledgeDir(...)\` for a folder of reference files.`
300
+ );
301
+ }
302
+ content = readFileSync2(abs, "utf8");
303
+ } catch (err) {
304
+ if (err instanceof Error && /points at a DIRECTORY/.test(err.message)) throw err;
305
+ throw new Error(
306
+ `knowledge "${def.name}": cannot read ${where} \u2014 ${err.message}. The path resolves relative to the module that declares the item (its \`import.meta.url\`).`
307
+ );
308
+ }
309
+ let files = [];
310
+ if (def.refs !== void 0) {
311
+ const refsRef = def.refs[KNOWLEDGE_DIR];
312
+ const refsWhere = `knowledgeDir("${refsRef.path}")`;
313
+ const abs = resolveMarker(refsRef);
314
+ try {
315
+ if (!statSync(abs).isDirectory()) {
316
+ throw new Error(
317
+ `knowledge "${def.name}": ${refsWhere} is not a directory. Reference files are a FOLDER the agent searches; a single file belongs in the body.`
318
+ );
319
+ }
320
+ } catch (err) {
321
+ if (err instanceof Error && /is not a directory/.test(err.message)) throw err;
322
+ throw new Error(
323
+ `knowledge "${def.name}": cannot read ${refsWhere} \u2014 ${err.message}.`
324
+ );
325
+ }
326
+ files = collectRefFiles(abs, def.name);
327
+ }
328
+ resolved.push({ name: def.name, content, files });
329
+ }
330
+ return resolved;
331
+ }
332
+
253
333
  // src/emit/cli.ts
254
334
  function parsePort(raw) {
255
335
  const n = Number(raw);
@@ -300,6 +380,7 @@ function parseArgs(argv) {
300
380
  let frozenLock = false;
301
381
  let strict = false;
302
382
  let yes = false;
383
+ let check = false;
303
384
  let bundle;
304
385
  let reset = false;
305
386
  let dest;
@@ -377,6 +458,8 @@ function parseArgs(argv) {
377
458
  strict = true;
378
459
  } else if (arg === "--yes" || arg === "-y") {
379
460
  yes = true;
461
+ } else if (arg === "--check") {
462
+ check = true;
380
463
  } else if (arg === "--bundle") {
381
464
  bundle = rest[++i];
382
465
  } else if (arg.startsWith("--bundle=")) {
@@ -588,6 +671,7 @@ function parseArgs(argv) {
588
671
  frozenLock,
589
672
  strict,
590
673
  yes,
674
+ check,
591
675
  bundle,
592
676
  reset,
593
677
  dest,
@@ -681,9 +765,9 @@ function parseExpiresHours(raw) {
681
765
  }
682
766
  async function importTsxApi(file) {
683
767
  try {
684
- const requireFromEntry = createRequire(pathToFileURL2(resolve(file)));
768
+ const requireFromEntry = createRequire(pathToFileURL3(resolve(file)));
685
769
  const apiPath = requireFromEntry.resolve("tsx/esm/api");
686
- return await import(pathToFileURL2(apiPath).href);
770
+ return await import(pathToFileURL3(apiPath).href);
687
771
  } catch {
688
772
  return await import("tsx/esm/api");
689
773
  }
@@ -701,10 +785,10 @@ function entryIsCommonJs(file) {
701
785
  if (/\.cts$/.test(path)) return true;
702
786
  let dir = dirname(path);
703
787
  for (; ; ) {
704
- const manifest = join(dir, "package.json");
788
+ const manifest = join2(dir, "package.json");
705
789
  if (existsSync(manifest)) {
706
790
  try {
707
- const pkg = JSON.parse(readFileSync2(manifest, "utf8"));
791
+ const pkg = JSON.parse(readFileSync3(manifest, "utf8"));
708
792
  return pkg.type !== "module";
709
793
  } catch {
710
794
  return false;
@@ -723,7 +807,7 @@ function commonJsEntryError(file, cause) {
723
807
  }
724
808
  function suggestSiblingFile(path) {
725
809
  try {
726
- return suggest(basename(path), readdirSync(dirname(path)));
810
+ return suggest(basename(path), readdirSync2(dirname(path)));
727
811
  } catch {
728
812
  return void 0;
729
813
  }
@@ -735,7 +819,7 @@ async function loadDefault(file) {
735
819
  suggestion: suggestSiblingFile(path)
736
820
  });
737
821
  }
738
- const url = pathToFileURL2(path).href;
822
+ const url = pathToFileURL3(path).href;
739
823
  const isTypeScript = /\.[mc]?ts$/.test(file);
740
824
  if (isTypeScript) {
741
825
  if (entryIsCommonJs(file)) throw commonJsEntryError(file);
@@ -769,12 +853,12 @@ async function loadDefault(file) {
769
853
  }
770
854
  }
771
855
  function readVersion() {
772
- let dir = dirname(fileURLToPath2(import.meta.url));
856
+ let dir = dirname(fileURLToPath3(import.meta.url));
773
857
  for (let i = 0; i < 6; i++) {
774
- const p = join(dir, "package.json");
858
+ const p = join2(dir, "package.json");
775
859
  if (existsSync(p)) {
776
860
  try {
777
- const pkg = JSON.parse(readFileSync2(p, "utf8"));
861
+ const pkg = JSON.parse(readFileSync3(p, "utf8"));
778
862
  if (pkg.name === "@xanots/sdk" && typeof pkg.version === "string") return pkg.version;
779
863
  } catch {
780
864
  }
@@ -799,9 +883,9 @@ function warnOrphans(orphans, dropped, cededCanonicals, previous, observed) {
799
883
  );
800
884
  continue;
801
885
  }
802
- const sep = key.indexOf(":");
803
- const payloadKey = key.slice(0, sep);
804
- const name = key.slice(sep + 1);
886
+ const sep2 = key.indexOf(":");
887
+ const payloadKey = key.slice(0, sep2);
888
+ const name = key.slice(sep2 + 1);
805
889
  const newcomers = Object.keys(observed).filter((k) => k.startsWith(`${payloadKey}:`) && !(k in previous.objects)).map((k) => k.slice(payloadKey.length + 1));
806
890
  const hint = newcomers.length > 0 ? ` (new ${payloadKey} names this export: ${newcomers.join(", ")})` : "";
807
891
  warn(
@@ -822,6 +906,10 @@ function warnOrphans(orphans, dropped, cededCanonicals, previous, observed) {
822
906
  }
823
907
  }
824
908
  async function run(argv) {
909
+ if (argv[0] === "onboard") {
910
+ const { runOnboardCommand } = await import("./onboard-command-EHOHKQQU.js");
911
+ return runOnboardCommand(argv.slice(1));
912
+ }
825
913
  const helpRequest = resolveHelpRequest(argv);
826
914
  if (helpRequest) {
827
915
  if (helpRequest.unknownTopic !== void 0) throw unknownHelpTopic(helpRequest.unknownTopic);
@@ -840,11 +928,11 @@ async function run(argv) {
840
928
  return;
841
929
  }
842
930
  if (command === "init") {
843
- const { runInitCommand } = await import("./init-command-LOK75W64.js");
931
+ const { runInitCommand } = await import("./init-command-GJUPWTKA.js");
844
932
  return runInitCommand(args);
845
933
  }
846
934
  if (command === "completion") {
847
- const { isCompletionShell, runCompletionCommand, COMPLETION_SHELLS } = await import("./completion-BKAFCZBE.js");
935
+ const { isCompletionShell, runCompletionCommand, COMPLETION_SHELLS } = await import("./completion-4GYN752B.js");
848
936
  const shell = args.positionals[0];
849
937
  if (shell === void 0 || !isCompletionShell(shell)) {
850
938
  throw new UsageError(
@@ -854,28 +942,32 @@ async function run(argv) {
854
942
  }
855
943
  return runCompletionCommand(shell);
856
944
  }
945
+ if (command === "upgrade") {
946
+ const { runUpgradeCommand } = await import("./upgrade-command-CKJ4BS2P.js");
947
+ return runUpgradeCommand(args);
948
+ }
857
949
  if (command === "lock") {
858
- const { runLockCommand } = await import("./lock-commands-XOYS75YQ.js");
950
+ const { runLockCommand } = await import("./lock-commands-7IH7RSSP.js");
859
951
  return runLockCommand(args);
860
952
  }
861
953
  if (command === "login") {
862
- const { runLoginCommand } = await import("./login-command-ACJF6KWQ.js");
954
+ const { runLoginCommand } = await import("./login-command-QM5SBBI2.js");
863
955
  return runLoginCommand(args);
864
956
  }
865
957
  if (command === "logout") {
866
- const { runLogoutCommand } = await import("./logout-command-MX3MJS5U.js");
958
+ const { runLogoutCommand } = await import("./logout-command-THPASOHM.js");
867
959
  return runLogoutCommand(args);
868
960
  }
869
961
  if (command === "deploy") {
870
- const { runDeployCommand } = await import("./deploy-command-4R6BYC6G.js");
962
+ const { runDeployCommand } = await import("./deploy-command-M2S4HHLC.js");
871
963
  return runDeployCommand(args);
872
964
  }
873
965
  if (command === "ephemeral") {
874
- const { runEphemeralCommand } = await import("./ephemeral-command-JL4TPIRQ.js");
966
+ const { runEphemeralCommand } = await import("./ephemeral-command-6WJW7LP6.js");
875
967
  return runEphemeralCommand(args);
876
968
  }
877
969
  if (command === "release") {
878
- const { runReleaseCommand } = await import("./release-command-HZUY2XZX.js");
970
+ const { runReleaseCommand } = await import("./release-command-M4CVNTWL.js");
879
971
  return runReleaseCommand(args);
880
972
  }
881
973
  if (command === "sandbox") {
@@ -883,47 +975,47 @@ async function run(argv) {
883
975
  throw removedSubcommand("sandbox", "deploy");
884
976
  }
885
977
  if (args.subcommand === "details") {
886
- const { runSandboxDetailsCommand } = await import("./sandbox-details-command-HJE5SPVG.js");
978
+ const { runSandboxDetailsCommand } = await import("./sandbox-details-command-BRII3QHG.js");
887
979
  return runSandboxDetailsCommand(args);
888
980
  }
889
981
  if (args.subcommand === "export") {
890
- const { runSandboxExportCommand } = await import("./sandbox-export-command-QCJY4GMV.js");
982
+ const { runSandboxExportCommand } = await import("./sandbox-export-command-PCZ5FL4U.js");
891
983
  return runSandboxExportCommand(args);
892
984
  }
893
985
  if (args.subcommand === "codegen") {
894
- const { runCodegenCommand } = await import("./codegen-command-FIADGXRN.js");
986
+ const { runCodegenCommand } = await import("./codegen-command-Z7WQMOJ7.js");
895
987
  return runCodegenCommand(args, { kind: "sandbox" });
896
988
  }
897
989
  throw unknownSubcommand("sandbox", args.subcommand);
898
990
  }
899
991
  if (command === "test") {
900
- const { runTestCommand } = await import("./test-command-72Y5S22H.js");
992
+ const { runTestCommand } = await import("./test-command-U4G5Y3UM.js");
901
993
  return runTestCommand(args);
902
994
  }
903
995
  if (command === "workspace") {
904
- const { runWorkspaceCommand } = await import("./workspace-command-ICSI6PKO.js");
996
+ const { runWorkspaceCommand } = await import("./workspace-command-RALSEJSW.js");
905
997
  return runWorkspaceCommand(args);
906
998
  }
907
999
  if (command === "codegen") {
908
- const { runCodegenCommand } = await import("./codegen-command-FIADGXRN.js");
1000
+ const { runCodegenCommand } = await import("./codegen-command-Z7WQMOJ7.js");
909
1001
  return runCodegenCommand(args, { kind: "file" });
910
1002
  }
911
1003
  if (command === "profile") {
912
1004
  if (args.subcommand !== "me") {
913
1005
  throw unknownSubcommand("profile", args.subcommand);
914
1006
  }
915
- const { runProfileCommand } = await import("./profile-command-SWJ3SPKR.js");
1007
+ const { runProfileCommand } = await import("./profile-command-EUWPVWED.js");
916
1008
  return runProfileCommand(args);
917
1009
  }
918
1010
  if (command === "whoami") {
919
- const { runProfileCommand } = await import("./profile-command-SWJ3SPKR.js");
1011
+ const { runProfileCommand } = await import("./profile-command-EUWPVWED.js");
920
1012
  return runProfileCommand(args);
921
1013
  }
922
1014
  if (command === "marketplace") {
923
1015
  if (!["list", "search", "details", "install"].includes(args.subcommand ?? "")) {
924
1016
  throw unknownSubcommand("marketplace", args.subcommand);
925
1017
  }
926
- const marketplace = await import("./marketplace-command-UVV3XAOL.js");
1018
+ const marketplace = await import("./marketplace-command-463DT7O7.js");
927
1019
  if (args.subcommand === "list") return marketplace.runMarketplaceListCommand(args);
928
1020
  if (args.subcommand === "search") return marketplace.runMarketplaceSearchCommand(args);
929
1021
  if (args.subcommand === "details") return marketplace.runMarketplaceDetailsCommand(args);
@@ -933,7 +1025,7 @@ async function run(argv) {
933
1025
  throw unknownCommand("push");
934
1026
  }
935
1027
  if (command === "validate") {
936
- const { runValidateCommand } = await import("./validate-command-KDGH537H.js");
1028
+ const { runValidateCommand } = await import("./validate-command-S5N37JRP.js");
937
1029
  return runValidateCommand(args);
938
1030
  }
939
1031
  if (command !== "compile" && command !== "export" && command !== "paths" && command !== "routes") {
@@ -965,7 +1057,7 @@ async function run(argv) {
965
1057
  }
966
1058
  async function refreshAgentGuidance() {
967
1059
  try {
968
- const { refreshAgentFiles } = await import("./agent-file-refresh-6M5M7T24.js");
1060
+ const { refreshAgentFiles } = await import("./agent-file-refresh-IJ7GN2FJ.js");
969
1061
  const refreshed = refreshAgentFiles({
970
1062
  projectDir: process.cwd(),
971
1063
  sdkVersion: readVersion()
@@ -978,7 +1070,7 @@ async function refreshAgentGuidance() {
978
1070
  }
979
1071
  }
980
1072
  function resolveLockPath(args, file) {
981
- return args.lockPath !== void 0 ? resolve(args.lockPath) : join(dirname(resolve(file)), "xano.lock");
1073
+ return args.lockPath !== void 0 ? resolve(args.lockPath) : join2(dirname(resolve(file)), "xano.lock");
982
1074
  }
983
1075
  function describeDefaultExport(def) {
984
1076
  if (def === void 0) return "no default export";
@@ -1090,7 +1182,7 @@ async function runPaths(args) {
1090
1182
  const channelCount = channelRows.length === 1 ? "1 channel" : `${channelRows.length} channels`;
1091
1183
  const count = describableServers.length > 0 ? `${routeCount}, ${channelCount}` : routeCount;
1092
1184
  if (args.strict) {
1093
- const current = existsSync(args.emit) ? readFileSync2(args.emit, "utf8") : void 0;
1185
+ const current = existsSync(args.emit) ? readFileSync3(args.emit, "utf8") : void 0;
1094
1186
  if (current !== source) {
1095
1187
  throw new Error(
1096
1188
  `--strict: ${args.emit} is ${current === void 0 ? "missing" : "out of date"}. Run \`xanots paths <entry> --emit ${args.emit}\` and commit the result \u2014 a stale route manifest keeps compiling while the endpoints have moved.`
@@ -1142,7 +1234,12 @@ async function compileBundle(args, opts = {}) {
1142
1234
  if (!Xano.isXano(def)) {
1143
1235
  throw new Error(`Module "${file}" must default-export a Xano registry for \`export\`.`);
1144
1236
  }
1145
- const bundle = def.export({ ...lockCtx ? { lock: lockCtx } : {}, strict: args.strict });
1237
+ const resolvedKnowledge = resolveKnowledge(def.knowledge());
1238
+ const bundle = def.export({
1239
+ ...lockCtx ? { lock: lockCtx } : {},
1240
+ strict: args.strict,
1241
+ knowledge: resolvedKnowledge
1242
+ });
1146
1243
  if (lockCtx) {
1147
1244
  const { lock: merged, orphans, dropped, cededCanonicals } = mergeObserved(
1148
1245
  lockCtx.lock,
@@ -1156,7 +1253,7 @@ async function compileBundle(args, opts = {}) {
1156
1253
  );
1157
1254
  }
1158
1255
  writeLockFile(lockPath, merged);
1159
- if (!lockExists) info(`Wrote ${relative(process.cwd(), lockPath) || lockPath} (commit this).`);
1256
+ if (!lockExists) info(`Wrote ${relative2(process.cwd(), lockPath) || lockPath} (commit this).`);
1160
1257
  warnOrphans(orphans, dropped, cededCanonicals, lockCtx.lock, lockCtx.observed);
1161
1258
  }
1162
1259
  checkFilterNames(bundle, args.strict);
@@ -1193,4 +1290,4 @@ export {
1193
1290
  exportBundleJson,
1194
1291
  compileBundle
1195
1292
  };
1196
- //# sourceMappingURL=chunk-3NFUWXOC.js.map
1293
+ //# sourceMappingURL=chunk-DUC3PXDG.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-DUC3PXDG.js";
46
48
  import {
47
49
  UsageError
48
- } from "./chunk-6USV65XA.js";
50
+ } from "./chunk-KGNJM4LN.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-EAIR6VUL.js.map
@@ -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
@@ -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-YYSJAAJM.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-KGNJM4LN.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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  c,
3
3
  resp
4
- } from "./chunk-5L4X5LS6.js";
4
+ } from "./chunk-YUPQOLFX.js";
5
5
 
6
6
  // src/values/expect.ts
7
7
  var TEST_EXPECT_TYPES = [
@@ -90,4 +90,4 @@ export {
90
90
  TEST_EXPECT_TYPES,
91
91
  expect
92
92
  };
93
- //# sourceMappingURL=chunk-F6JCFRKO.js.map
93
+ //# sourceMappingURL=chunk-PXXLBXOP.js.map