@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
@@ -9,11 +9,11 @@ import {
9
9
  unknownFlag,
10
10
  unknownHelpTopic,
11
11
  unknownSubcommand
12
- } from "./chunk-6USV65XA.js";
12
+ } from "./chunk-IVP6TS26.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-F5T45NAM.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;
@@ -314,6 +395,7 @@ function parseArgs(argv) {
314
395
  let authHost;
315
396
  let authFile;
316
397
  let useLocal = false;
398
+ let paste = false;
317
399
  let allWorkspaces = false;
318
400
  let guest = false;
319
401
  let urlOnly = false;
@@ -377,6 +459,8 @@ function parseArgs(argv) {
377
459
  strict = true;
378
460
  } else if (arg === "--yes" || arg === "-y") {
379
461
  yes = true;
462
+ } else if (arg === "--check") {
463
+ check = true;
380
464
  } else if (arg === "--bundle") {
381
465
  bundle = rest[++i];
382
466
  } else if (arg.startsWith("--bundle=")) {
@@ -432,6 +516,8 @@ function parseArgs(argv) {
432
516
  authFile = arg.slice("--config=".length);
433
517
  } else if (arg === "--local") {
434
518
  useLocal = true;
519
+ } else if (arg === "--paste") {
520
+ paste = true;
435
521
  } else if (arg === "--all-workspaces") {
436
522
  allWorkspaces = true;
437
523
  } else if (arg === "--guest" || arg === "-g") {
@@ -588,6 +674,7 @@ function parseArgs(argv) {
588
674
  frozenLock,
589
675
  strict,
590
676
  yes,
677
+ check,
591
678
  bundle,
592
679
  reset,
593
680
  dest,
@@ -602,6 +689,7 @@ function parseArgs(argv) {
602
689
  authHost,
603
690
  authFile,
604
691
  local: useLocal,
692
+ paste,
605
693
  allWorkspaces,
606
694
  guest,
607
695
  urlOnly,
@@ -681,9 +769,9 @@ function parseExpiresHours(raw) {
681
769
  }
682
770
  async function importTsxApi(file) {
683
771
  try {
684
- const requireFromEntry = createRequire(pathToFileURL2(resolve(file)));
772
+ const requireFromEntry = createRequire(pathToFileURL3(resolve(file)));
685
773
  const apiPath = requireFromEntry.resolve("tsx/esm/api");
686
- return await import(pathToFileURL2(apiPath).href);
774
+ return await import(pathToFileURL3(apiPath).href);
687
775
  } catch {
688
776
  return await import("tsx/esm/api");
689
777
  }
@@ -701,10 +789,10 @@ function entryIsCommonJs(file) {
701
789
  if (/\.cts$/.test(path)) return true;
702
790
  let dir = dirname(path);
703
791
  for (; ; ) {
704
- const manifest = join(dir, "package.json");
792
+ const manifest = join2(dir, "package.json");
705
793
  if (existsSync(manifest)) {
706
794
  try {
707
- const pkg = JSON.parse(readFileSync2(manifest, "utf8"));
795
+ const pkg = JSON.parse(readFileSync3(manifest, "utf8"));
708
796
  return pkg.type !== "module";
709
797
  } catch {
710
798
  return false;
@@ -723,7 +811,7 @@ function commonJsEntryError(file, cause) {
723
811
  }
724
812
  function suggestSiblingFile(path) {
725
813
  try {
726
- return suggest(basename(path), readdirSync(dirname(path)));
814
+ return suggest(basename(path), readdirSync2(dirname(path)));
727
815
  } catch {
728
816
  return void 0;
729
817
  }
@@ -735,7 +823,7 @@ async function loadDefault(file) {
735
823
  suggestion: suggestSiblingFile(path)
736
824
  });
737
825
  }
738
- const url = pathToFileURL2(path).href;
826
+ const url = pathToFileURL3(path).href;
739
827
  const isTypeScript = /\.[mc]?ts$/.test(file);
740
828
  if (isTypeScript) {
741
829
  if (entryIsCommonJs(file)) throw commonJsEntryError(file);
@@ -769,12 +857,12 @@ async function loadDefault(file) {
769
857
  }
770
858
  }
771
859
  function readVersion() {
772
- let dir = dirname(fileURLToPath2(import.meta.url));
860
+ let dir = dirname(fileURLToPath3(import.meta.url));
773
861
  for (let i = 0; i < 6; i++) {
774
- const p = join(dir, "package.json");
862
+ const p = join2(dir, "package.json");
775
863
  if (existsSync(p)) {
776
864
  try {
777
- const pkg = JSON.parse(readFileSync2(p, "utf8"));
865
+ const pkg = JSON.parse(readFileSync3(p, "utf8"));
778
866
  if (pkg.name === "@xanots/sdk" && typeof pkg.version === "string") return pkg.version;
779
867
  } catch {
780
868
  }
@@ -799,9 +887,9 @@ function warnOrphans(orphans, dropped, cededCanonicals, previous, observed) {
799
887
  );
800
888
  continue;
801
889
  }
802
- const sep = key.indexOf(":");
803
- const payloadKey = key.slice(0, sep);
804
- const name = key.slice(sep + 1);
890
+ const sep2 = key.indexOf(":");
891
+ const payloadKey = key.slice(0, sep2);
892
+ const name = key.slice(sep2 + 1);
805
893
  const newcomers = Object.keys(observed).filter((k) => k.startsWith(`${payloadKey}:`) && !(k in previous.objects)).map((k) => k.slice(payloadKey.length + 1));
806
894
  const hint = newcomers.length > 0 ? ` (new ${payloadKey} names this export: ${newcomers.join(", ")})` : "";
807
895
  warn(
@@ -822,6 +910,10 @@ function warnOrphans(orphans, dropped, cededCanonicals, previous, observed) {
822
910
  }
823
911
  }
824
912
  async function run(argv) {
913
+ if (argv[0] === "onboard") {
914
+ const { runOnboardCommand } = await import("./onboard-command-EHOHKQQU.js");
915
+ return runOnboardCommand(argv.slice(1));
916
+ }
825
917
  const helpRequest = resolveHelpRequest(argv);
826
918
  if (helpRequest) {
827
919
  if (helpRequest.unknownTopic !== void 0) throw unknownHelpTopic(helpRequest.unknownTopic);
@@ -840,11 +932,11 @@ async function run(argv) {
840
932
  return;
841
933
  }
842
934
  if (command === "init") {
843
- const { runInitCommand } = await import("./init-command-LOK75W64.js");
935
+ const { runInitCommand } = await import("./init-command-NCRPVFGE.js");
844
936
  return runInitCommand(args);
845
937
  }
846
938
  if (command === "completion") {
847
- const { isCompletionShell, runCompletionCommand, COMPLETION_SHELLS } = await import("./completion-BKAFCZBE.js");
939
+ const { isCompletionShell, runCompletionCommand, COMPLETION_SHELLS } = await import("./completion-GHP5RRLQ.js");
848
940
  const shell = args.positionals[0];
849
941
  if (shell === void 0 || !isCompletionShell(shell)) {
850
942
  throw new UsageError(
@@ -854,28 +946,32 @@ async function run(argv) {
854
946
  }
855
947
  return runCompletionCommand(shell);
856
948
  }
949
+ if (command === "upgrade") {
950
+ const { runUpgradeCommand } = await import("./upgrade-command-M2DZ3ZPD.js");
951
+ return runUpgradeCommand(args);
952
+ }
857
953
  if (command === "lock") {
858
- const { runLockCommand } = await import("./lock-commands-XOYS75YQ.js");
954
+ const { runLockCommand } = await import("./lock-commands-6UONZW26.js");
859
955
  return runLockCommand(args);
860
956
  }
861
957
  if (command === "login") {
862
- const { runLoginCommand } = await import("./login-command-ACJF6KWQ.js");
958
+ const { runLoginCommand } = await import("./login-command-SG7IWTHW.js");
863
959
  return runLoginCommand(args);
864
960
  }
865
961
  if (command === "logout") {
866
- const { runLogoutCommand } = await import("./logout-command-MX3MJS5U.js");
962
+ const { runLogoutCommand } = await import("./logout-command-J2AG5NKC.js");
867
963
  return runLogoutCommand(args);
868
964
  }
869
965
  if (command === "deploy") {
870
- const { runDeployCommand } = await import("./deploy-command-4R6BYC6G.js");
966
+ const { runDeployCommand } = await import("./deploy-command-XOH76USO.js");
871
967
  return runDeployCommand(args);
872
968
  }
873
969
  if (command === "ephemeral") {
874
- const { runEphemeralCommand } = await import("./ephemeral-command-JL4TPIRQ.js");
970
+ const { runEphemeralCommand } = await import("./ephemeral-command-46SL27GJ.js");
875
971
  return runEphemeralCommand(args);
876
972
  }
877
973
  if (command === "release") {
878
- const { runReleaseCommand } = await import("./release-command-HZUY2XZX.js");
974
+ const { runReleaseCommand } = await import("./release-command-FKQ6E3TD.js");
879
975
  return runReleaseCommand(args);
880
976
  }
881
977
  if (command === "sandbox") {
@@ -883,47 +979,47 @@ async function run(argv) {
883
979
  throw removedSubcommand("sandbox", "deploy");
884
980
  }
885
981
  if (args.subcommand === "details") {
886
- const { runSandboxDetailsCommand } = await import("./sandbox-details-command-HJE5SPVG.js");
982
+ const { runSandboxDetailsCommand } = await import("./sandbox-details-command-DMY2KGA2.js");
887
983
  return runSandboxDetailsCommand(args);
888
984
  }
889
985
  if (args.subcommand === "export") {
890
- const { runSandboxExportCommand } = await import("./sandbox-export-command-QCJY4GMV.js");
986
+ const { runSandboxExportCommand } = await import("./sandbox-export-command-R6QMEK3D.js");
891
987
  return runSandboxExportCommand(args);
892
988
  }
893
989
  if (args.subcommand === "codegen") {
894
- const { runCodegenCommand } = await import("./codegen-command-FIADGXRN.js");
990
+ const { runCodegenCommand } = await import("./codegen-command-BLOS3GR3.js");
895
991
  return runCodegenCommand(args, { kind: "sandbox" });
896
992
  }
897
993
  throw unknownSubcommand("sandbox", args.subcommand);
898
994
  }
899
995
  if (command === "test") {
900
- const { runTestCommand } = await import("./test-command-72Y5S22H.js");
996
+ const { runTestCommand } = await import("./test-command-56IAEYHX.js");
901
997
  return runTestCommand(args);
902
998
  }
903
999
  if (command === "workspace") {
904
- const { runWorkspaceCommand } = await import("./workspace-command-ICSI6PKO.js");
1000
+ const { runWorkspaceCommand } = await import("./workspace-command-HZS43PHJ.js");
905
1001
  return runWorkspaceCommand(args);
906
1002
  }
907
1003
  if (command === "codegen") {
908
- const { runCodegenCommand } = await import("./codegen-command-FIADGXRN.js");
1004
+ const { runCodegenCommand } = await import("./codegen-command-BLOS3GR3.js");
909
1005
  return runCodegenCommand(args, { kind: "file" });
910
1006
  }
911
1007
  if (command === "profile") {
912
1008
  if (args.subcommand !== "me") {
913
1009
  throw unknownSubcommand("profile", args.subcommand);
914
1010
  }
915
- const { runProfileCommand } = await import("./profile-command-SWJ3SPKR.js");
1011
+ const { runProfileCommand } = await import("./profile-command-ZPC2DPFV.js");
916
1012
  return runProfileCommand(args);
917
1013
  }
918
1014
  if (command === "whoami") {
919
- const { runProfileCommand } = await import("./profile-command-SWJ3SPKR.js");
1015
+ const { runProfileCommand } = await import("./profile-command-ZPC2DPFV.js");
920
1016
  return runProfileCommand(args);
921
1017
  }
922
1018
  if (command === "marketplace") {
923
1019
  if (!["list", "search", "details", "install"].includes(args.subcommand ?? "")) {
924
1020
  throw unknownSubcommand("marketplace", args.subcommand);
925
1021
  }
926
- const marketplace = await import("./marketplace-command-UVV3XAOL.js");
1022
+ const marketplace = await import("./marketplace-command-NKTQ3VPS.js");
927
1023
  if (args.subcommand === "list") return marketplace.runMarketplaceListCommand(args);
928
1024
  if (args.subcommand === "search") return marketplace.runMarketplaceSearchCommand(args);
929
1025
  if (args.subcommand === "details") return marketplace.runMarketplaceDetailsCommand(args);
@@ -933,7 +1029,7 @@ async function run(argv) {
933
1029
  throw unknownCommand("push");
934
1030
  }
935
1031
  if (command === "validate") {
936
- const { runValidateCommand } = await import("./validate-command-KDGH537H.js");
1032
+ const { runValidateCommand } = await import("./validate-command-CIBQJND7.js");
937
1033
  return runValidateCommand(args);
938
1034
  }
939
1035
  if (command !== "compile" && command !== "export" && command !== "paths" && command !== "routes") {
@@ -965,7 +1061,7 @@ async function run(argv) {
965
1061
  }
966
1062
  async function refreshAgentGuidance() {
967
1063
  try {
968
- const { refreshAgentFiles } = await import("./agent-file-refresh-6M5M7T24.js");
1064
+ const { refreshAgentFiles } = await import("./agent-file-refresh-IJ7GN2FJ.js");
969
1065
  const refreshed = refreshAgentFiles({
970
1066
  projectDir: process.cwd(),
971
1067
  sdkVersion: readVersion()
@@ -978,7 +1074,7 @@ async function refreshAgentGuidance() {
978
1074
  }
979
1075
  }
980
1076
  function resolveLockPath(args, file) {
981
- return args.lockPath !== void 0 ? resolve(args.lockPath) : join(dirname(resolve(file)), "xano.lock");
1077
+ return args.lockPath !== void 0 ? resolve(args.lockPath) : join2(dirname(resolve(file)), "xano.lock");
982
1078
  }
983
1079
  function describeDefaultExport(def) {
984
1080
  if (def === void 0) return "no default export";
@@ -1090,7 +1186,7 @@ async function runPaths(args) {
1090
1186
  const channelCount = channelRows.length === 1 ? "1 channel" : `${channelRows.length} channels`;
1091
1187
  const count = describableServers.length > 0 ? `${routeCount}, ${channelCount}` : routeCount;
1092
1188
  if (args.strict) {
1093
- const current = existsSync(args.emit) ? readFileSync2(args.emit, "utf8") : void 0;
1189
+ const current = existsSync(args.emit) ? readFileSync3(args.emit, "utf8") : void 0;
1094
1190
  if (current !== source) {
1095
1191
  throw new Error(
1096
1192
  `--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 +1238,12 @@ async function compileBundle(args, opts = {}) {
1142
1238
  if (!Xano.isXano(def)) {
1143
1239
  throw new Error(`Module "${file}" must default-export a Xano registry for \`export\`.`);
1144
1240
  }
1145
- const bundle = def.export({ ...lockCtx ? { lock: lockCtx } : {}, strict: args.strict });
1241
+ const resolvedKnowledge = resolveKnowledge(def.knowledge());
1242
+ const bundle = def.export({
1243
+ ...lockCtx ? { lock: lockCtx } : {},
1244
+ strict: args.strict,
1245
+ knowledge: resolvedKnowledge
1246
+ });
1146
1247
  if (lockCtx) {
1147
1248
  const { lock: merged, orphans, dropped, cededCanonicals } = mergeObserved(
1148
1249
  lockCtx.lock,
@@ -1156,7 +1257,7 @@ async function compileBundle(args, opts = {}) {
1156
1257
  );
1157
1258
  }
1158
1259
  writeLockFile(lockPath, merged);
1159
- if (!lockExists) info(`Wrote ${relative(process.cwd(), lockPath) || lockPath} (commit this).`);
1260
+ if (!lockExists) info(`Wrote ${relative2(process.cwd(), lockPath) || lockPath} (commit this).`);
1160
1261
  warnOrphans(orphans, dropped, cededCanonicals, lockCtx.lock, lockCtx.observed);
1161
1262
  }
1162
1263
  checkFilterNames(bundle, args.strict);
@@ -1193,4 +1294,4 @@ export {
1193
1294
  exportBundleJson,
1194
1295
  compileBundle
1195
1296
  };
1196
- //# sourceMappingURL=chunk-3NFUWXOC.js.map
1297
+ //# sourceMappingURL=chunk-MS3BRZAZ.js.map
@@ -15,7 +15,10 @@ import {
15
15
  normalize,
16
16
  retiredInputSuccessor,
17
17
  retiredInputs
18
- } from "./chunk-P3TTMWUP.js";
18
+ } from "./chunk-ZOYMZZ3S.js";
19
+ import {
20
+ getAccessToken
21
+ } from "./chunk-SG4UBJ47.js";
19
22
  import {
20
23
  exportWorkspaceBundle
21
24
  } from "./chunk-QTNO2WD6.js";
@@ -24,18 +27,15 @@ import {
24
27
  resolveFrontendPreset,
25
28
  resolveThemeChoice,
26
29
  sanitizeAppName
27
- } from "./chunk-HQ2CBRVI.js";
30
+ } from "./chunk-KXCPZUUM.js";
28
31
  import {
29
32
  XANO_DIR,
30
33
  resolveAiPresets,
31
34
  scaffoldProject
32
- } from "./chunk-CMZLPTGW.js";
33
- import {
34
- getAccessToken
35
- } from "./chunk-C56BC2FY.js";
35
+ } from "./chunk-7SISR3CS.js";
36
36
  import {
37
37
  TEST_EXPECT_TYPES
38
- } from "./chunk-F6JCFRKO.js";
38
+ } from "./chunk-PXXLBXOP.js";
39
39
  import {
40
40
  raw
41
41
  } from "./chunk-LU7TRWMC.js";
@@ -44,7 +44,7 @@ import {
44
44
  describeOrigin,
45
45
  renderCodegenMarker,
46
46
  renderCodegenReadme
47
- } from "./chunk-YZ4GU6F5.js";
47
+ } from "./chunk-QUUB7HYK.js";
48
48
  import {
49
49
  FIELD_METHODS,
50
50
  STATEMENT_SURFACES,
@@ -67,14 +67,14 @@ import {
67
67
  searchConstrainsRows,
68
68
  tableTrigger,
69
69
  workspaceTrigger
70
- } from "./chunk-U3G2UW65.js";
70
+ } from "./chunk-CYJ7R3AD.js";
71
71
  import {
72
72
  loadDefault,
73
73
  readVersion
74
- } from "./chunk-3NFUWXOC.js";
74
+ } from "./chunk-MS3BRZAZ.js";
75
75
  import {
76
76
  UsageError
77
- } from "./chunk-6USV65XA.js";
77
+ } from "./chunk-IVP6TS26.js";
78
78
  import {
79
79
  blank,
80
80
  detail,
@@ -115,7 +115,7 @@ import {
115
115
  sys,
116
116
  toolset,
117
117
  withFilters
118
- } from "./chunk-5L4X5LS6.js";
118
+ } from "./chunk-YUPQOLFX.js";
119
119
  import {
120
120
  parsePathParams,
121
121
  unboundPathParams
@@ -130,7 +130,7 @@ import {
130
130
  } from "./chunk-5XZ744TS.js";
131
131
  import {
132
132
  REFERENCEABLE_KIND_PAYLOAD_KEYS
133
- } from "./chunk-4HT3BNZ7.js";
133
+ } from "./chunk-YUBJLB6G.js";
134
134
 
135
135
  // src/emit/codegen-command.ts
136
136
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -886,6 +886,37 @@ function resolveReference(ctx, index, guid, options = {}) {
886
886
  ]);
887
887
  }
888
888
 
889
+ // src/kinds/knowledge-paths.ts
890
+ function knowledgePathSegment(name) {
891
+ const slug = name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
892
+ return slug === "" ? "item" : slug;
893
+ }
894
+ function knowledgeItemDir(type, name) {
895
+ const seg = knowledgePathSegment(name);
896
+ switch (type) {
897
+ case "agents.md":
898
+ return null;
899
+ case "skill":
900
+ return `skills/${seg}`;
901
+ case "doc":
902
+ return `docs/${seg}`;
903
+ }
904
+ }
905
+ function knowledgeBodyPath(type, name) {
906
+ switch (type) {
907
+ case "agents.md":
908
+ return "agents.md";
909
+ case "skill":
910
+ return `${knowledgeItemDir(type, name)}/SKILL.md`;
911
+ case "doc":
912
+ return `${knowledgeItemDir(type, name)}.md`;
913
+ }
914
+ }
915
+ function knowledgeRefsDir(type, name) {
916
+ const dir = knowledgeItemDir(type, name);
917
+ return dir === null ? null : `${dir}/refs`;
918
+ }
919
+
889
920
  // src/codegen/obj-expr.ts
890
921
  var IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
891
922
  var REFERENCE = /^\$(input|var|auth|db)((?:\.[A-Za-z0-9_$]+)*)$/;
@@ -4320,10 +4351,6 @@ function omissionSeverity(reason) {
4320
4351
  }
4321
4352
  var UNSUPPORTED_SECTIONS = {
4322
4353
  vault: { reason: "secret", detail: "vault entries are instance secrets and are never emitted as source" },
4323
- knowledge: {
4324
- reason: "unmodeled",
4325
- detail: "knowledge objects are not authored in TypeScript by this SDK"
4326
- },
4327
4354
  // These three were tagged `unmodeled`, which their own detail lines contradict:
4328
4355
  // none of them is an object type the SDK failed to model. They are records of
4329
4356
  // what was done to the workspace, owned by the instance that did it.
@@ -4509,6 +4536,19 @@ function decodeExample(a) {
4509
4536
  }
4510
4537
 
4511
4538
  // src/codegen/kinds/index.ts
4539
+ function knowledgeFileRows(payload, parentGuid) {
4540
+ const rows = Array.isArray(payload.knowledge_file) ? payload.knowledge_file : [];
4541
+ const out2 = [];
4542
+ for (const raw2 of rows) {
4543
+ const row = raw2;
4544
+ if (row.knowledge?.id !== parentGuid) continue;
4545
+ const stored = typeof row.path === "string" ? row.path : "";
4546
+ if (stored === "") continue;
4547
+ const rel = stored.replace(/^knowledge-refs\/[^/]+\//, "");
4548
+ out2.push({ path: rel, content: String(row.content ?? "") });
4549
+ }
4550
+ return out2;
4551
+ }
4512
4552
  function plain(stored, storedKey, fallback, defKey = storedKey) {
4513
4553
  const value = stored[storedKey];
4514
4554
  if (value === void 0 || deepEqual2(value, fallback)) return null;
@@ -4834,6 +4874,50 @@ var DEFAULT_CACHE = {
4834
4874
  env: []
4835
4875
  };
4836
4876
  var KIND_DECODERS = [
4877
+ {
4878
+ name: "knowledge",
4879
+ payloadKey: "knowledge",
4880
+ dir: "knowledge",
4881
+ register: "registerKnowledge",
4882
+ defType: "KnowledgeDef",
4883
+ factory: "knowledge",
4884
+ decode: (a) => {
4885
+ const type = a.stored.knowledge_type ?? "skill";
4886
+ const name = String(a.stored.name ?? "");
4887
+ a.ctx.imports.use(SDK_MODULE, "knowledgeFile");
4888
+ const refsDir = knowledgeRefsDir(type, name);
4889
+ const hasRefs = refsDir !== null && knowledgeFileRows(a.payload, a.stored.guid).length > 0;
4890
+ if (hasRefs) a.ctx.imports.use(SDK_MODULE, "knowledgeDir");
4891
+ return compact([
4892
+ ...identity(a),
4893
+ plain(a.stored, "description", ""),
4894
+ plain(a.stored, "knowledge_type", "skill", "type"),
4895
+ plain(a.stored, "mode", "auto"),
4896
+ plain(a.stored, "enabled", true),
4897
+ [
4898
+ "body",
4899
+ call("knowledgeFile", lit(`./${knowledgeBodyPath(type, name)}`), id("import.meta.url"))
4900
+ ],
4901
+ hasRefs ? [
4902
+ "refs",
4903
+ call("knowledgeDir", lit(`./${refsDir}`), id("import.meta.url"))
4904
+ ] : null,
4905
+ tags(a.stored)
4906
+ ]);
4907
+ },
4908
+ companions: ({ stored, payload }) => {
4909
+ const type = stored.knowledge_type ?? "skill";
4910
+ const name = String(stored.name ?? "");
4911
+ const refsDir = knowledgeRefsDir(type, name);
4912
+ return [
4913
+ { path: knowledgeBodyPath(type, name), contents: String(stored.content ?? "") },
4914
+ ...refsDir === null ? [] : knowledgeFileRows(payload, stored.guid).map((f2) => ({
4915
+ path: `${refsDir}/${f2.path}`,
4916
+ contents: f2.content
4917
+ }))
4918
+ ];
4919
+ }
4920
+ },
4837
4921
  {
4838
4922
  name: "table",
4839
4923
  payloadKey: "dbo",
@@ -6248,6 +6332,7 @@ function assembleProject(ctx, refs, payload) {
6248
6332
  ctx,
6249
6333
  refs,
6250
6334
  stored: placement.stored,
6335
+ payload,
6251
6336
  resolve: {
6252
6337
  symbolFor: (target) => {
6253
6338
  const found = byGuid.get(target.guid);
@@ -6291,6 +6376,12 @@ function assembleProject(ctx, refs, payload) {
6291
6376
  );
6292
6377
  }
6293
6378
  const out2 = [];
6379
+ for (const placement of placements) {
6380
+ const decoder = KIND_DECODERS_BY_NAME.get(placement.object.kind);
6381
+ for (const companion of decoder.companions?.({ stored: placement.stored, payload }) ?? []) {
6382
+ out2.push({ path: `${decoder.dir}/${companion.path}`, contents: companion.contents });
6383
+ }
6384
+ }
6294
6385
  for (const [path, file] of files) {
6295
6386
  out2.push({
6296
6387
  path,
@@ -6320,7 +6411,7 @@ function workspaceFile(ctx, refs, payload) {
6320
6411
  const decoder = KIND_DECODERS_BY_NAME.get("workspace");
6321
6412
  const { expr, factory } = ctx.inObject(
6322
6413
  "workspace",
6323
- () => decodeObject(decoder, { ctx, refs, stored, resolve: {} })
6414
+ () => decodeObject(decoder, { ctx, refs, stored, payload, resolve: {} })
6324
6415
  );
6325
6416
  if (factory) imports.use(SDK_MODULE, factory);
6326
6417
  else imports.useType(SDK_MODULE, decoder.defType);
@@ -6640,7 +6731,7 @@ async function fetchBundle(args, source) {
6640
6731
  if (source.kind === "sandbox") {
6641
6732
  const auth3 = await getAccessToken(args);
6642
6733
  step("Reading the sandbox workspace");
6643
- const { fetchSandboxBundle } = await import("./sandbox-export-command-QCJY4GMV.js");
6734
+ const { fetchSandboxBundle } = await import("./sandbox-export-command-R6QMEK3D.js");
6644
6735
  return {
6645
6736
  bundle: await fetchSandboxBundle(auth3),
6646
6737
  origin: { source: "sandbox", origin: auth3.instance }
@@ -6654,7 +6745,7 @@ async function fetchBundle(args, source) {
6654
6745
  );
6655
6746
  }
6656
6747
  const auth3 = await getAccessToken(args);
6657
- const { resolveLive, fetchEphemeralBundle } = await import("./ephemeral-command-JL4TPIRQ.js");
6748
+ const { resolveLive, fetchEphemeralBundle } = await import("./ephemeral-command-46SL27GJ.js");
6658
6749
  const summary = await resolveLive(auth3, auth3.workspaceId, name);
6659
6750
  step(`Reading ephemeral "${name}"`);
6660
6751
  return {
@@ -6923,4 +7014,4 @@ export {
6923
7014
  verifyCrashEntry,
6924
7015
  blameGeneratedFile
6925
7016
  };
6926
- //# sourceMappingURL=chunk-2V4YE6QC.js.map
7017
+ //# sourceMappingURL=chunk-OARSPAIE.js.map