@helloleo/plugins 0.2.5 → 0.2.6
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.
- package/dist/index.js +7 -20
- package/package.json +1 -1
- package/src/tools/scaffold.ts +36 -39
package/dist/index.js
CHANGED
|
@@ -24910,14 +24910,13 @@ function projectUuidFromDir(dir) {
|
|
|
24910
24910
|
}
|
|
24911
24911
|
var scaffoldOptionsSchema = exports_external2.object({
|
|
24912
24912
|
name: exports_external2.string().describe("Human-readable name for SEO, e.g. 'Shipping Platform'"),
|
|
24913
|
-
description: exports_external2.string().describe("One sentence describing the app. Used as the meta description.")
|
|
24914
|
-
type: exports_external2.enum(["tanstack-start", "tanstack-router"]).optional().describe("Project type. 'tanstack-router': " + "client-only SPA with no server and no database \u2014 use it only for " + "pure frontends that talk to external APIs." + "'tanstack-start': SSR app with API routes and a " + "database, KV and bucket \u2014 use it whenever the app " + "needs to persist data or run server-side code (experimental, " + "use only if the user expresses a really complexe application idea).")
|
|
24913
|
+
description: exports_external2.string().describe("One sentence describing the app. Used as the meta description.")
|
|
24915
24914
|
});
|
|
24916
24915
|
function slugify(name) {
|
|
24917
24916
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "leo-project";
|
|
24918
24917
|
}
|
|
24919
|
-
async function writeBaseScaffold({ name, description
|
|
24920
|
-
const templateId =
|
|
24918
|
+
async function writeBaseScaffold({ name, description }, dir) {
|
|
24919
|
+
const templateId = "tanstack-router";
|
|
24921
24920
|
const created = await renderTemplate(templateId, {
|
|
24922
24921
|
LEO_NAME: name,
|
|
24923
24922
|
LEO_SLUG: slugify(name),
|
|
@@ -24930,32 +24929,20 @@ async function writeBaseScaffold({ name, description, type }, dir) {
|
|
|
24930
24929
|
return [...created, leoPath];
|
|
24931
24930
|
}
|
|
24932
24931
|
var scaffold = tool({
|
|
24933
|
-
description: "Scaffold a new project with React 19, file-based routing (TanStack), " + "Tailwind v4, shadcn/ui, and react-query.
|
|
24932
|
+
description: "Scaffold a new project with React 19, file-based routing (TanStack), " + "Tailwind v4, shadcn/ui, and react-query. Call this first for any new" + " project, before writing routes or components.",
|
|
24934
24933
|
args: {
|
|
24935
24934
|
name: scaffoldOptionsSchema.shape.name,
|
|
24936
|
-
description: scaffoldOptionsSchema.shape.description
|
|
24937
|
-
type: scaffoldOptionsSchema.shape.type
|
|
24935
|
+
description: scaffoldOptionsSchema.shape.description
|
|
24938
24936
|
},
|
|
24939
24937
|
async execute(args, context) {
|
|
24940
|
-
const type = args.type ?? "tanstack-start";
|
|
24941
24938
|
const created = await writeBaseScaffold(args, context.directory);
|
|
24942
24939
|
const uiComponents = created.filter((f) => f.startsWith("src/components/ui/"));
|
|
24943
24940
|
const rest = created.filter((f) => !f.startsWith("src/components/ui/"));
|
|
24944
|
-
const typeNotes =
|
|
24945
|
-
"- This is a TanStack Start project. The server entry is src/server.ts. There is no index.html or client entrypoint.",
|
|
24946
|
-
"- For JSON/CRUD APIs, add server routes under src/routes/api/. Read src/routes/api/health.ts first, add routes as needed.",
|
|
24947
|
-
"- The database schema lives in src/db/schema.ts. Migrations run automatically."
|
|
24948
|
-
] : [
|
|
24941
|
+
const typeNotes = [
|
|
24949
24942
|
"- This is a TanStack Router SPA. The client entry is index.html -> src/main.tsx. There is no server: no API routes, no server functions, no database.",
|
|
24950
24943
|
"- Fetch data from external APIs only. If the app needs its own persistence or server-side code, it should have been scaffolded as tanstack-start."
|
|
24951
24944
|
];
|
|
24952
|
-
const nextSteps =
|
|
24953
|
-
"Next: read src/routes/index.tsx and continue with the user's request.",
|
|
24954
|
-
"For authentication (password and/or OAuth), call setup_authentication.",
|
|
24955
|
-
"For NetSuite projects, call setup_netsuite."
|
|
24956
|
-
] : [
|
|
24957
|
-
"Next: read src/routes/index.tsx and continue with the user's request."
|
|
24958
|
-
];
|
|
24945
|
+
const nextSteps = ["Next: read src/routes/index.tsx and continue with the user's request."];
|
|
24959
24946
|
return [
|
|
24960
24947
|
`Scaffolded ${created.length} files:`,
|
|
24961
24948
|
...rest.map((f) => ` - ${f}`),
|
package/package.json
CHANGED
package/src/tools/scaffold.ts
CHANGED
|
@@ -45,18 +45,18 @@ const scaffoldOptionsSchema = z.object({
|
|
|
45
45
|
description: z
|
|
46
46
|
.string()
|
|
47
47
|
.describe("One sentence describing the app. Used as the meta description."),
|
|
48
|
-
type: z
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
// type: z
|
|
49
|
+
// .enum(["tanstack-start", "tanstack-router"])
|
|
50
|
+
// .optional()
|
|
51
|
+
// .describe(
|
|
52
|
+
// "Project type. 'tanstack-router': " +
|
|
53
|
+
// "client-only SPA with no server and no database — use it only for " +
|
|
54
|
+
// "pure frontends that talk to external APIs." +
|
|
55
|
+
// "'tanstack-start': SSR app with API routes and a " +
|
|
56
|
+
// "database, KV and bucket — use it whenever the app " +
|
|
57
|
+
// "needs to persist data or run server-side code (experimental, " +
|
|
58
|
+
// "use only if the user expresses a really complexe application idea).",
|
|
59
|
+
// ),
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
/** Kebab-case slug of the product name, for package.json. */
|
|
@@ -75,10 +75,10 @@ function slugify(name: string): string {
|
|
|
75
75
|
* not part of the template tree). Returns the relative paths written.
|
|
76
76
|
*/
|
|
77
77
|
export async function writeBaseScaffold(
|
|
78
|
-
{ name, description
|
|
78
|
+
{ name, description }: z.infer<typeof scaffoldOptionsSchema>,
|
|
79
79
|
dir: string,
|
|
80
80
|
): Promise<string[]> {
|
|
81
|
-
const templateId =
|
|
81
|
+
const templateId = "tanstack-router";
|
|
82
82
|
const created = await renderTemplate(
|
|
83
83
|
templateId,
|
|
84
84
|
{
|
|
@@ -103,17 +103,14 @@ export async function writeBaseScaffold(
|
|
|
103
103
|
export const scaffold = tool({
|
|
104
104
|
description:
|
|
105
105
|
"Scaffold a new project with React 19, file-based routing (TanStack), " +
|
|
106
|
-
"Tailwind v4, shadcn/ui, and react-query.
|
|
107
|
-
"
|
|
108
|
-
"or 'tanstack-router' (client-only SPA, no server, no database). Call " +
|
|
109
|
-
"this first for any new project, before writing routes or components.",
|
|
106
|
+
"Tailwind v4, shadcn/ui, and react-query. Call this first for any new" +
|
|
107
|
+
" project, before writing routes or components.",
|
|
110
108
|
args: {
|
|
111
109
|
name: scaffoldOptionsSchema.shape.name,
|
|
112
110
|
description: scaffoldOptionsSchema.shape.description,
|
|
113
|
-
type: scaffoldOptionsSchema.shape.type,
|
|
114
111
|
},
|
|
115
112
|
async execute(args, context) {
|
|
116
|
-
const type: ScaffoldType =
|
|
113
|
+
// const type: ScaffoldType = "tanstack-router";
|
|
117
114
|
const created = await writeBaseScaffold(args, context.directory);
|
|
118
115
|
const uiComponents = created.filter((f) =>
|
|
119
116
|
f.startsWith("src/components/ui/"),
|
|
@@ -121,27 +118,27 @@ export const scaffold = tool({
|
|
|
121
118
|
const rest = created.filter((f) => !f.startsWith("src/components/ui/"));
|
|
122
119
|
|
|
123
120
|
const typeNotes =
|
|
124
|
-
type === "tanstack-start"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
// type === "tanstack-start"
|
|
122
|
+
// ? [
|
|
123
|
+
// "- This is a TanStack Start project. The server entry is src/server.ts. There is no index.html or client entrypoint.",
|
|
124
|
+
// "- For JSON/CRUD APIs, add server routes under src/routes/api/. Read src/routes/api/health.ts first, add routes as needed.",
|
|
125
|
+
// "- The database schema lives in src/db/schema.ts. Migrations run automatically.",
|
|
126
|
+
// ]
|
|
127
|
+
// :
|
|
128
|
+
[
|
|
129
|
+
"- This is a TanStack Router SPA. The client entry is index.html -> src/main.tsx. There is no server: no API routes, no server functions, no database.",
|
|
130
|
+
"- Fetch data from external APIs only. If the app needs its own persistence or server-side code, it should have been scaffolded as tanstack-start.",
|
|
131
|
+
];
|
|
134
132
|
|
|
135
133
|
const nextSteps =
|
|
136
|
-
type === "tanstack-start"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
];
|
|
134
|
+
// type === "tanstack-start"
|
|
135
|
+
// ? [
|
|
136
|
+
// "Next: read src/routes/index.tsx and continue with the user's request.",
|
|
137
|
+
// "For authentication (password and/or OAuth), call setup_authentication.",
|
|
138
|
+
// "For NetSuite projects, call setup_netsuite.",
|
|
139
|
+
// ]
|
|
140
|
+
// :
|
|
141
|
+
["Next: read src/routes/index.tsx and continue with the user's request."];
|
|
145
142
|
|
|
146
143
|
return [
|
|
147
144
|
`Scaffolded ${created.length} files:`,
|