@helloleo/plugins 0.2.6 → 0.2.8

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.
@@ -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.8",
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:`,