@xanots/sdk 0.0.2 → 0.0.3-beta.0

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 (40) hide show
  1. package/README.md +10 -1
  2. package/dist/.build-fingerprint +1 -1
  3. package/dist/{agent-file-refresh-7XCACU34.js → agent-file-refresh-J3KY54E5.js} +3 -2
  4. package/dist/bin.js +7 -7
  5. package/dist/chunk-4HKZH6YK.js +307 -0
  6. package/dist/chunk-6DHJVLYP.js +2044 -0
  7. package/dist/{chunk-MUDLJG2O.js → chunk-CBL57QBQ.js} +25 -15
  8. package/dist/{chunk-5YTBTF25.js → chunk-EWFHDJY5.js} +2 -2
  9. package/dist/{chunk-IZW6MK3U.js → chunk-FY6LXRR6.js} +2 -2
  10. package/dist/{chunk-ZPEY5WE4.js → chunk-HKAX756N.js} +3 -3
  11. package/dist/{chunk-XLD4BUTF.js → chunk-MWLNBSTY.js} +2 -2
  12. package/dist/{chunk-YYRDLFSJ.js → chunk-QO4I5OYF.js} +40 -2
  13. package/dist/{chunk-UVLVQWWF.js → chunk-VVXPK6SE.js} +62 -20
  14. package/dist/{chunk-VKFQJEMW.js → chunk-WRYT2PAX.js} +14 -371
  15. package/dist/{chunk-ODNMVJ6H.js → chunk-YZ4GU6F5.js} +283 -252
  16. package/dist/cli.d.ts +22 -0
  17. package/dist/cli.js +5 -5
  18. package/dist/{codegen-command-RY2GWDLX.js → codegen-command-EXLKZ2ZI.js} +12 -10
  19. package/dist/{completion-TIPPZN7H.js → completion-2PVZK6YX.js} +2 -2
  20. package/dist/{deploy-command-DSISLUW5.js → deploy-command-SXX6RJWM.js} +13 -13
  21. package/dist/{env-target-7C2GKBCY.js → env-target-3EGIPR4D.js} +2 -2
  22. package/dist/{ephemeral-command-5K573ZSG.js → ephemeral-command-OGOYP7D6.js} +15 -15
  23. package/dist/{init-command-4AWL6CLW.js → init-command-6DGXEVZD.js} +10 -8
  24. package/dist/internal.js +1 -1
  25. package/dist/{lock-commands-7Q5LNZKL.js → lock-commands-R22J54XV.js} +9 -9
  26. package/dist/{marketplace-command-RATXTKXN.js → marketplace-command-XJIWL4YP.js} +6 -6
  27. package/dist/meta-client-OW5WKWW7.js +1 -1
  28. package/dist/node.js +8 -8
  29. package/dist/{release-command-QXLRJMY7.js → release-command-6PLMLGDK.js} +15 -15
  30. package/dist/sandbox-export-command-QCJY4GMV.js +1 -1
  31. package/dist/scaffold.d.ts +1896 -0
  32. package/dist/scaffold.js +101 -0
  33. package/dist/{test-command-BOLIU57E.js → test-command-LLPXKT35.js} +4 -4
  34. package/dist/{validate-command-SYCFEYZN.js → validate-command-WAT3ZJT3.js} +7 -7
  35. package/dist/{workspace-command-TOB2AJ6X.js → workspace-command-JKMI7RZ4.js} +13 -11
  36. package/dist/workspace-export-AJMGN3CQ.js +1 -1
  37. package/llms-full.txt +1 -1
  38. package/llms.txt +1 -1
  39. package/manifest.json +141 -1
  40. package/package.json +7 -1
@@ -1,6 +1,11 @@
1
1
  import {
2
2
  runNpm
3
3
  } from "./chunk-47WDWMBJ.js";
4
+ import {
5
+ defaultThemeChoice,
6
+ reactPreset,
7
+ themeGuidanceSection
8
+ } from "./chunk-6DHJVLYP.js";
4
9
  import {
5
10
  detail,
6
11
  step,
@@ -8,372 +13,6 @@ import {
8
13
  warn
9
14
  } from "./chunk-EZG76F7R.js";
10
15
 
11
- // src/emit/frontend-react.ts
12
- var CODE_CLASS = "bg-muted rounded px-1.5 py-0.5 font-mono text-sm";
13
- function jsxText(s) {
14
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
15
- }
16
- function renderNode(node) {
17
- return "code" in node ? `<code className="${CODE_CLASS}">${jsxText(node.code)}</code>` : jsxText(node.text);
18
- }
19
- function renderNodes(nodes) {
20
- return nodes.map(renderNode).join("");
21
- }
22
- function renderApp(landing) {
23
- const steps = landing.steps.map((step2) => ` <li>${renderNodes(step2)}</li>`).join("\n");
24
- return `import { ArrowRight } from "lucide-react";
25
-
26
- import { Button } from "@/components/ui/button";
27
- import {
28
- Card,
29
- CardContent,
30
- CardDescription,
31
- CardFooter,
32
- CardHeader,
33
- CardTitle,
34
- } from "@/components/ui/card";
35
-
36
- export default function App() {
37
- return (
38
- <main className="mx-auto flex min-h-screen max-w-2xl flex-col justify-center p-8">
39
- <Card>
40
- <CardHeader>
41
- <CardTitle className="text-3xl tracking-tight">${jsxText(landing.title)}</CardTitle>
42
- <CardDescription className="text-base">
43
- ${renderNodes(landing.lead)}
44
- </CardDescription>
45
- </CardHeader>
46
- <CardContent>
47
- <ol className="text-muted-foreground list-inside list-decimal space-y-2">
48
- ${steps}
49
- </ol>
50
- </CardContent>
51
- <CardFooter>
52
- {/* asChild renders the Button's styles onto the anchor. Components come
53
- from shadcn/ui \u2014 add more with \`npx shadcn@latest add <name>\`. */}
54
- <Button asChild>
55
- <a href="${landing.cta.href}" target="_blank" rel="noreferrer">
56
- ${jsxText(landing.cta.label)} <ArrowRight />
57
- </a>
58
- </Button>
59
- </CardFooter>
60
- </Card>
61
- </main>
62
- );
63
- }
64
- `;
65
- }
66
- function renderMainTsx() {
67
- return `import { StrictMode } from "react";
68
- import { createRoot } from "react-dom/client";
69
- import App from "./App.js";
70
- import "./index.css";
71
-
72
- createRoot(document.getElementById("root")!).render(
73
- <StrictMode>
74
- <App />
75
- </StrictMode>,
76
- );
77
- `;
78
- }
79
- function renderComponentsJson() {
80
- const config = {
81
- $schema: "https://ui.shadcn.com/schema.json",
82
- style: "new-york",
83
- rsc: false,
84
- tsx: true,
85
- tailwind: {
86
- // v4 has no config file; the theme lives in the stylesheet.
87
- config: "",
88
- css: "frontend/src/index.css",
89
- baseColor: "neutral",
90
- cssVariables: true,
91
- prefix: ""
92
- },
93
- aliases: {
94
- components: "@/components",
95
- utils: "@/lib/utils",
96
- ui: "@/components/ui",
97
- lib: "@/lib",
98
- hooks: "@/hooks"
99
- },
100
- iconLibrary: "lucide"
101
- };
102
- return JSON.stringify(config, null, 2) + "\n";
103
- }
104
- function renderButtonTsx() {
105
- return `import * as React from "react"
106
- import { cva, type VariantProps } from "class-variance-authority"
107
- import { Slot } from "radix-ui"
108
-
109
- import { cn } from "@/lib/utils"
110
-
111
- const buttonVariants = cva(
112
- "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
113
- {
114
- variants: {
115
- variant: {
116
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
117
- destructive:
118
- "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
119
- outline:
120
- "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
121
- secondary:
122
- "bg-secondary text-secondary-foreground hover:bg-secondary/80",
123
- ghost:
124
- "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
125
- link: "text-primary underline-offset-4 hover:underline",
126
- },
127
- size: {
128
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
129
- xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
130
- sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
131
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
132
- icon: "size-9",
133
- "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
134
- "icon-sm": "size-8",
135
- "icon-lg": "size-10",
136
- },
137
- },
138
- defaultVariants: {
139
- variant: "default",
140
- size: "default",
141
- },
142
- }
143
- )
144
-
145
- function Button({
146
- className,
147
- variant = "default",
148
- size = "default",
149
- asChild = false,
150
- ...props
151
- }: React.ComponentProps<"button"> &
152
- VariantProps<typeof buttonVariants> & {
153
- asChild?: boolean
154
- }) {
155
- const Comp = asChild ? Slot.Root : "button"
156
-
157
- return (
158
- <Comp
159
- data-slot="button"
160
- data-variant={variant}
161
- data-size={size}
162
- className={cn(buttonVariants({ variant, size, className }))}
163
- {...props}
164
- />
165
- )
166
- }
167
-
168
- export { Button, buttonVariants }
169
- `;
170
- }
171
- function renderCardTsx() {
172
- return `import * as React from "react"
173
-
174
- import { cn } from "@/lib/utils"
175
-
176
- function Card({ className, ...props }: React.ComponentProps<"div">) {
177
- return (
178
- <div
179
- data-slot="card"
180
- className={cn(
181
- "flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
182
- className
183
- )}
184
- {...props}
185
- />
186
- )
187
- }
188
-
189
- function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
190
- return (
191
- <div
192
- data-slot="card-header"
193
- className={cn(
194
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
195
- className
196
- )}
197
- {...props}
198
- />
199
- )
200
- }
201
-
202
- function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
203
- return (
204
- <div
205
- data-slot="card-title"
206
- className={cn("leading-none font-semibold", className)}
207
- {...props}
208
- />
209
- )
210
- }
211
-
212
- function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
213
- return (
214
- <div
215
- data-slot="card-description"
216
- className={cn("text-sm text-muted-foreground", className)}
217
- {...props}
218
- />
219
- )
220
- }
221
-
222
- function CardAction({ className, ...props }: React.ComponentProps<"div">) {
223
- return (
224
- <div
225
- data-slot="card-action"
226
- className={cn(
227
- "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
228
- className
229
- )}
230
- {...props}
231
- />
232
- )
233
- }
234
-
235
- function CardContent({ className, ...props }: React.ComponentProps<"div">) {
236
- return (
237
- <div
238
- data-slot="card-content"
239
- className={cn("px-6", className)}
240
- {...props}
241
- />
242
- )
243
- }
244
-
245
- function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
246
- return (
247
- <div
248
- data-slot="card-footer"
249
- className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
250
- {...props}
251
- />
252
- )
253
- }
254
-
255
- export {
256
- Card,
257
- CardHeader,
258
- CardFooter,
259
- CardTitle,
260
- CardAction,
261
- CardDescription,
262
- CardContent,
263
- }
264
- `;
265
- }
266
- var reactPreset = {
267
- id: "react",
268
- label: "React + Vite",
269
- dependencies: {
270
- // shadcn/ui's runtime surface. `radix-ui` is the unified primitives
271
- // package current components import (`Slot.Root` powers `asChild`) — not
272
- // the per-primitive `@radix-ui/react-*` packages, which it superseded.
273
- // cva types the variants, clsx + tailwind-merge back `cn()`, lucide is
274
- // the icon set. Pre-installed so `npx shadcn@latest add <component>`
275
- // works without a separate npm i.
276
- "class-variance-authority": "^0.7.1",
277
- clsx: "^2.1.1",
278
- "lucide-react": "^0.475.0",
279
- "radix-ui": "^1.6.7",
280
- react: "^19.1.0",
281
- "react-dom": "^19.1.0",
282
- "tailwind-merge": "^3.0.1"
283
- },
284
- devDependencies: {
285
- "@tailwindcss/vite": "^4.1.5",
286
- "@types/node": "^20.19.43",
287
- "@types/react": "^19.1.0",
288
- "@types/react-dom": "^19.1.0",
289
- // 6.x, which peer-requires vite ^8 — the same constraint the Svelte
290
- // preset's plugin has, which is why both presets share one Vite major.
291
- // Its `@rolldown/plugin-babel` and `babel-plugin-react-compiler` peers are
292
- // OPTIONAL (they back the React Compiler path, which this scaffold does
293
- // not enable), so neither is shipped: verified by a clean install with no
294
- // unmet-peer warnings.
295
- "@vitejs/plugin-react": "^6.0.5",
296
- tailwindcss: "^4.1.5",
297
- "tw-animate-css": "^1.2.4",
298
- tsx: "^4.19.2",
299
- // Kept in step with the Svelte preset — the major `sv create` pins. 7 is
300
- // out, but svelte-check's peer range stops at 6 and the two presets track
301
- // one TypeScript major so the shared tsconfig means the same thing in both.
302
- typescript: "^6.0.3",
303
- vite: "^8.0.16"
304
- },
305
- // `tsc` checks .tsx natively, so React needs nothing beyond it.
306
- checkCmd: "tsc --noEmit",
307
- aliasName: "@",
308
- aliasTarget: "frontend/src",
309
- // `./`-rooted: with no `baseUrl` (deprecated in TypeScript 6), a `paths`
310
- // target resolves against tsconfig.json's own directory.
311
- tsconfigPaths: { "@/*": ["./frontend/src/*"] },
312
- tsconfigOptions: { jsx: "react-jsx" },
313
- viteImports: [
314
- `import react from "@vitejs/plugin-react";`,
315
- `import tailwindcss from "@tailwindcss/vite";`
316
- ],
317
- vitePlugins: ["react()", "tailwindcss()"],
318
- entryScript: "/src/main.tsx",
319
- files(_vars, landing) {
320
- return [
321
- // The shadcn/ui CLI's config — lets `npx shadcn@latest add <component>`
322
- // work in a fresh scaffold without a separate `shadcn init`.
323
- { path: "components.json", content: renderComponentsJson() },
324
- { path: "frontend/src/main.tsx", content: renderMainTsx() },
325
- { path: "frontend/src/App.tsx", content: renderApp(landing) },
326
- // The two components the landing page uses. Every other shadcn component
327
- // is one `npx shadcn@latest add` away and lands beside these.
328
- { path: "frontend/src/components/ui/button.tsx", content: renderButtonTsx() },
329
- { path: "frontend/src/components/ui/card.tsx", content: renderCardTsx() }
330
- ];
331
- },
332
- readmeFrontendSection() {
333
- return `React + Vite, styled with [Tailwind CSS](https://tailwindcss.com) v4 and
334
- [shadcn/ui](https://ui.shadcn.com). shadcn is not a dependency \u2014 its components
335
- are copied into [\`frontend/src/components/ui/\`](frontend/src/components/ui/) and
336
- owned by this project, so edit them freely. \`Button\` and \`Card\` are already
337
- there; add more with:
338
-
339
- \`\`\`bash
340
- npx shadcn@latest add dialog input form
341
- \`\`\`
342
-
343
- [\`components.json\`](components.json) is pre-configured, so that works with no
344
- \`shadcn init\` step. Icons are [Lucide](https://lucide.dev/icons), installed as
345
- \`lucide-react\` and imported by name \u2014
346
- \`import { ArrowRight } from "lucide-react"\`, as
347
- [\`frontend/src/App.tsx\`](frontend/src/App.tsx) does.
348
-
349
- Components import through the \`@/\` alias
350
- (\`@/components/ui/button\`, \`@/lib/utils\`), which maps to \`frontend/src/\` in both
351
- \`tsconfig.json\` and \`vite.config.ts\` \u2014 change one and change the other.
352
-
353
- To rebrand, edit the color tokens at the top of
354
- [\`frontend/src/index.css\`](frontend/src/index.css). Tailwind v4 has no
355
- \`tailwind.config.js\`; the theme lives in that stylesheet.`;
356
- },
357
- agentGuidanceSection() {
358
- return `- \`frontend/src/\` \u2014 the React app. Tailwind v4 + shadcn/ui.
359
- - \`frontend/src/components/ui/\` \u2014 shadcn components, **copied in and owned by
360
- this project**. Edit them directly; there is no library to configure around.
361
- - Need one that isn't there? \`npx shadcn@latest add <name>\` \u2014 do not hand-roll
362
- it, and do not add a different component library.
363
- - Icons are [Lucide](https://lucide.dev/icons), already installed as
364
- \`lucide-react\`. Import them by name from the package root:
365
- \`import { ArrowRight } from "lucide-react";\` \u2014 \`frontend/src/App.tsx\` already
366
- does. Do not add another icon library and do not paste raw inline \`<svg>\`
367
- markup \u2014 search the set before concluding an icon is missing.
368
- - Import via the \`@/\` alias (\`@/components/ui/button\`, \`@/lib/utils\`), declared
369
- in both \`tsconfig.json\` and \`vite.config.ts\`.
370
- - Style with the semantic tokens (\`bg-primary\`, \`text-muted-foreground\`,
371
- \`border-input\`), never raw palette classes like \`bg-gray-100\` \u2014 the tokens are
372
- defined in \`frontend/src/index.css\`, which is also where you rebrand. Tailwind
373
- v4 has no \`tailwind.config.js\`.`;
374
- }
375
- };
376
-
377
16
  // src/emit/init-ai-presets.ts
378
17
  var AI_PRESETS = ["claude", "codex", "cursor"];
379
18
  var GUIDANCE_SENTINEL = "Learn the library from the library";
@@ -429,6 +68,10 @@ Run them with \`npm run xano:test\` after a deploy \u2014 it compiles nothing an
429
68
  what is deployed, so deploy first. A failing suite exits 5.
430
69
  \`npx xanots deploy ./xano/index.ts --test\` does both in one step. Read
431
70
  \`node_modules/@xanots/sdk/llms/tests.md\` before authoring either.`;
71
+ function frontendSection(frontend) {
72
+ return `${frontend.section}
73
+ ${themeGuidanceSection(frontend.theme ?? defaultThemeChoice())}`;
74
+ }
432
75
  var DEFAULT_FRONTEND_GUIDANCE = {
433
76
  label: reactPreset.label,
434
77
  section: reactPreset.agentGuidanceSection()
@@ -457,7 +100,7 @@ frontend types follow.
457
100
  groups, and endpoints. Pin each API group's canonical slug so public paths are
458
101
  stable and \`getPath()\` resolves in the browser bundle.
459
102
  - \`xano/EXAMPLE.md\` \u2014 the walkthrough for adding your first table + endpoint.
460
- ${frontend.section}
103
+ ${frontendSection(frontend)}
461
104
 
462
105
  ### Workflow
463
106
 
@@ -550,7 +193,7 @@ endpoint's verb and resolved path.
550
193
  - \`xano/index.ts\` \u2014 the barrel: default-exports the \`workspace()\` with every pulled object registered.
551
194
  - \`xano/_shared.ts\` \u2014 tables, and anything referenced from more than one file.
552
195
  - \`xano/README.md\` \u2014 the decode report for this pull.
553
- ${frontend.section}
196
+ ${frontendSection(frontend)}
554
197
 
555
198
  ### Workflow
556
199
 
@@ -774,7 +417,8 @@ async function scaffoldProject(opts) {
774
417
  version: opts.sdkVersion,
775
418
  frontend: {
776
419
  label: opts.frontend.label,
777
- section: opts.frontend.agentGuidanceSection()
420
+ section: opts.frontend.agentGuidanceSection(opts.theme?.icons),
421
+ theme: opts.theme
778
422
  }
779
423
  });
780
424
  const existing = existsSync(join(targetDir, path)) ? readFileSync(join(targetDir, path), "utf8") : null;
@@ -799,7 +443,6 @@ async function scaffoldProject(opts) {
799
443
  }
800
444
 
801
445
  export {
802
- reactPreset,
803
446
  AI_PRESETS,
804
447
  managedBlockVersion,
805
448
  upsertManagedBlock,
@@ -811,4 +454,4 @@ export {
811
454
  resolveAiPresets,
812
455
  scaffoldProject
813
456
  };
814
- //# sourceMappingURL=chunk-VKFQJEMW.js.map
457
+ //# sourceMappingURL=chunk-WRYT2PAX.js.map