@helloleo/plugins 0.2.6 → 0.2.7

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 CHANGED
@@ -24905,6 +24905,13 @@ var SCAFFOLD_TEMPLATES = {
24905
24905
  "tanstack-router": "tanstack-router-2026-06-15"
24906
24906
  };
24907
24907
  var SCAFFOLD_VERSION = SCAFFOLD_TEMPLATES["tanstack-start"];
24908
+ function resolveTemplateId() {
24909
+ const version3 = process.env.SCAFFOLD_VERSION;
24910
+ const known = Object.values(SCAFFOLD_TEMPLATES);
24911
+ if (version3 && known.includes(version3))
24912
+ return version3;
24913
+ return SCAFFOLD_TEMPLATES["tanstack-router"];
24914
+ }
24908
24915
  function projectUuidFromDir(dir) {
24909
24916
  return path3.basename(dir);
24910
24917
  }
@@ -24916,7 +24923,7 @@ function slugify(name) {
24916
24923
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "leo-project";
24917
24924
  }
24918
24925
  async function writeBaseScaffold({ name, description }, dir) {
24919
- const templateId = "tanstack-router";
24926
+ const templateId = resolveTemplateId();
24920
24927
  const created = await renderTemplate(templateId, {
24921
24928
  LEO_NAME: name,
24922
24929
  LEO_SLUG: slugify(name),
@@ -24935,14 +24942,25 @@ var scaffold = tool({
24935
24942
  description: scaffoldOptionsSchema.shape.description
24936
24943
  },
24937
24944
  async execute(args, context) {
24945
+ const isStart = resolveTemplateId() === SCAFFOLD_TEMPLATES["tanstack-start"];
24938
24946
  const created = await writeBaseScaffold(args, context.directory);
24939
24947
  const uiComponents = created.filter((f) => f.startsWith("src/components/ui/"));
24940
24948
  const rest = created.filter((f) => !f.startsWith("src/components/ui/"));
24941
- const typeNotes = [
24949
+ const typeNotes = isStart ? [
24950
+ "- This is a TanStack Start project. The server entry is src/server.ts. There is no index.html or client entrypoint.",
24951
+ "- For JSON/CRUD APIs, add server routes under src/routes/api/. Read src/routes/api/health.ts first, add routes as needed.",
24952
+ "- The database schema lives in src/db/schema.ts. Migrations run automatically."
24953
+ ] : [
24942
24954
  "- 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.",
24943
24955
  "- 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."
24944
24956
  ];
24945
- const nextSteps = ["Next: read src/routes/index.tsx and continue with the user's request."];
24957
+ const nextSteps = isStart ? [
24958
+ "Next: read src/routes/index.tsx and continue with the user's request.",
24959
+ "For authentication (password and/or OAuth), call setup_authentication.",
24960
+ "For NetSuite projects, call setup_netsuite."
24961
+ ] : [
24962
+ "Next: read src/routes/index.tsx and continue with the user's request."
24963
+ ];
24946
24964
  return [
24947
24965
  `Scaffolded ${created.length} files:`,
24948
24966
  ...rest.map((f) => ` - ${f}`),
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "{{LEO_NAME}}",
2
+ "name": "{{LEO_SLUG}}",
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "imports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helloleo/plugins",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "OpenCode plugins for HelloLeo",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "{{LEO_NAME}}",
2
+ "name": "{{LEO_SLUG}}",
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "imports": {
@@ -27,6 +27,19 @@ export type ScaffoldType = keyof typeof SCAFFOLD_TEMPLATES;
27
27
  /** Default template id, kept for callers that predate the `type` param. */
28
28
  export const SCAFFOLD_VERSION = SCAFFOLD_TEMPLATES["tanstack-start"];
29
29
 
30
+ /**
31
+ * The container can pin the template via SCAFFOLD_VERSION (a versioned
32
+ * template id, e.g. "tanstack-start-2026-06-18"). Unset or unknown values
33
+ * fall back to the tanstack-router template, so a stale env var can never
34
+ * reproduce the ENOENT-on-missing-template failure.
35
+ */
36
+ export function resolveTemplateId(): string {
37
+ const version = process.env.SCAFFOLD_VERSION;
38
+ const known: string[] = Object.values(SCAFFOLD_TEMPLATES);
39
+ if (version && known.includes(version)) return version;
40
+ return SCAFFOLD_TEMPLATES["tanstack-router"];
41
+ }
42
+
30
43
  /**
31
44
  * The project workspace directory is named after the project UUID -- the
32
45
  * webapp generates `<slugified-name>-<uuidv4>` (actions.ts createProject)
@@ -78,7 +91,7 @@ export async function writeBaseScaffold(
78
91
  { name, description }: z.infer<typeof scaffoldOptionsSchema>,
79
92
  dir: string,
80
93
  ): Promise<string[]> {
81
- const templateId = "tanstack-router";
94
+ const templateId = resolveTemplateId();
82
95
  const created = await renderTemplate(
83
96
  templateId,
84
97
  {
@@ -110,35 +123,34 @@ export const scaffold = tool({
110
123
  description: scaffoldOptionsSchema.shape.description,
111
124
  },
112
125
  async execute(args, context) {
113
- // const type: ScaffoldType = "tanstack-router";
126
+ const isStart =
127
+ resolveTemplateId() === SCAFFOLD_TEMPLATES["tanstack-start"];
114
128
  const created = await writeBaseScaffold(args, context.directory);
115
129
  const uiComponents = created.filter((f) =>
116
130
  f.startsWith("src/components/ui/"),
117
131
  );
118
132
  const rest = created.filter((f) => !f.startsWith("src/components/ui/"));
119
133
 
120
- const typeNotes =
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
+ const typeNotes = isStart
135
+ ? [
136
+ "- This is a TanStack Start project. The server entry is src/server.ts. There is no index.html or client entrypoint.",
137
+ "- For JSON/CRUD APIs, add server routes under src/routes/api/. Read src/routes/api/health.ts first, add routes as needed.",
138
+ "- The database schema lives in src/db/schema.ts. Migrations run automatically.",
139
+ ]
140
+ : [
141
+ "- 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.",
142
+ "- 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.",
143
+ ];
132
144
 
133
- const nextSteps =
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
+ const nextSteps = isStart
146
+ ? [
147
+ "Next: read src/routes/index.tsx and continue with the user's request.",
148
+ "For authentication (password and/or OAuth), call setup_authentication.",
149
+ "For NetSuite projects, call setup_netsuite.",
150
+ ]
151
+ : [
152
+ "Next: read src/routes/index.tsx and continue with the user's request.",
153
+ ];
142
154
 
143
155
  return [
144
156
  `Scaffolded ${created.length} files:`,
@@ -1,23 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query'
2
- import { createRouter as createTanStackRouter } from '@tanstack/react-router'
3
- import { routeTree } from './routeTree.gen'
4
-
5
- export function getRouter() {
6
- const queryClient = new QueryClient()
7
-
8
- const router = createTanStackRouter({
9
- routeTree,
10
- context: { queryClient },
11
- scrollRestoration: true,
12
- defaultPreload: 'intent',
13
- defaultPreloadStaleTime: 0,
14
- })
15
-
16
- return router
17
- }
18
-
19
- declare module '@tanstack/react-router' {
20
- interface Register {
21
- router: ReturnType<typeof getRouter>
22
- }
23
- }
@@ -1,23 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query'
2
- import { createRouter as createTanStackRouter } from '@tanstack/react-router'
3
- import { routeTree } from './routeTree.gen'
4
-
5
- export function getRouter() {
6
- const queryClient = new QueryClient()
7
-
8
- const router = createTanStackRouter({
9
- routeTree,
10
- context: { queryClient },
11
- scrollRestoration: true,
12
- defaultPreload: 'intent',
13
- defaultPreloadStaleTime: 0,
14
- })
15
-
16
- return router
17
- }
18
-
19
- declare module '@tanstack/react-router' {
20
- interface Register {
21
- router: ReturnType<typeof getRouter>
22
- }
23
- }