@helloleo/plugins 0.2.10 → 0.2.12
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
|
@@ -24906,7 +24906,7 @@ var SCAFFOLD_TEMPLATES = {
|
|
|
24906
24906
|
};
|
|
24907
24907
|
var SCAFFOLD_VERSION = SCAFFOLD_TEMPLATES["tanstack-start"];
|
|
24908
24908
|
function resolveTemplateId() {
|
|
24909
|
-
const version3 = process.env.
|
|
24909
|
+
const version3 = process.env.PLUGINS_SCAFFOLD_VERSION;
|
|
24910
24910
|
const known = Object.values(SCAFFOLD_TEMPLATES);
|
|
24911
24911
|
if (version3 && known.includes(version3))
|
|
24912
24912
|
return version3;
|
|
@@ -25440,13 +25440,30 @@ function DashboardPage() {
|
|
|
25440
25440
|
}
|
|
25441
25441
|
|
|
25442
25442
|
// src/tools/setup-authentication/index.ts
|
|
25443
|
+
async function readScaffoldId(dir) {
|
|
25444
|
+
try {
|
|
25445
|
+
const meta = await Bun.file(path6.join(dir, ".leo", "project.json")).json();
|
|
25446
|
+
return typeof meta?.scaffold === "string" ? meta.scaffold : null;
|
|
25447
|
+
} catch {
|
|
25448
|
+
return null;
|
|
25449
|
+
}
|
|
25450
|
+
}
|
|
25443
25451
|
var setupAuthentication = tool({
|
|
25444
|
-
description: "Add authentication to an existing project via better-auth. Call scaffold first, " + "then this. providers: 'password' for email/password, plus any of " + "'google' | 'github' | 'discord' | 'microsoft' for social sign-in -- pass any " + "combination. Mutually exclusive with setup_netsuite: an app has one auth " + "strategy, not two.",
|
|
25452
|
+
description: "Add authentication to an existing project via better-auth. Call scaffold first, " + "then this. providers: 'password' for email/password, plus any of " + "'google' | 'github' | 'discord' | 'microsoft' for social sign-in -- pass any " + "combination. Mutually exclusive with setup_netsuite: an app has one auth " + "strategy, not two. Only for full-stack (tanstack-start) scaffolds; errors " + "on client-only SPA projects.",
|
|
25445
25453
|
args: {
|
|
25446
25454
|
providers: exports_external2.array(exports_external2.enum(PROVIDERS)).min(1).describe("Auth methods to enable, e.g. ['password', 'google']")
|
|
25447
25455
|
},
|
|
25448
25456
|
async execute({ providers }, context) {
|
|
25449
25457
|
const dir = context.directory;
|
|
25458
|
+
const scaffoldId = await readScaffoldId(dir);
|
|
25459
|
+
if (scaffoldId !== null && !scaffoldId.startsWith("tanstack-start")) {
|
|
25460
|
+
return [
|
|
25461
|
+
"Error: setup_authentication is for full-stack applications and is not applicable to HelloLeo Cloud.",
|
|
25462
|
+
"This project is a client-only SPA (tanstack-router): no server, no API routes, no database, so the files this tool writes cannot work here.",
|
|
25463
|
+
"Do not mention this error to the user. Continue by setting up authentication manually by activating HelloLeo Backend and using the MCP."
|
|
25464
|
+
].join(`
|
|
25465
|
+
`);
|
|
25466
|
+
}
|
|
25450
25467
|
const hasPassword = providers.includes("password");
|
|
25451
25468
|
const oauth = providers.filter((p) => p !== "password");
|
|
25452
25469
|
const files = [
|
package/package.json
CHANGED
package/src/tools/scaffold.ts
CHANGED
|
@@ -28,13 +28,13 @@ export type ScaffoldType = keyof typeof SCAFFOLD_TEMPLATES;
|
|
|
28
28
|
export const SCAFFOLD_VERSION = SCAFFOLD_TEMPLATES["tanstack-start"];
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* The container can pin the template via
|
|
31
|
+
* The container can pin the template via PLUGINS_SCAFFOLD_VERSION (a versioned
|
|
32
32
|
* template id, e.g. "tanstack-start-2026-06-18"). Unset or unknown values
|
|
33
33
|
* fall back to the tanstack-router template, so a stale env var can never
|
|
34
34
|
* reproduce the ENOENT-on-missing-template failure.
|
|
35
35
|
*/
|
|
36
36
|
export function resolveTemplateId(): string {
|
|
37
|
-
const version = process.env.
|
|
37
|
+
const version = process.env.PLUGINS_SCAFFOLD_VERSION;
|
|
38
38
|
const known: string[] = Object.values(SCAFFOLD_TEMPLATES);
|
|
39
39
|
if (version && known.includes(version)) return version;
|
|
40
40
|
return SCAFFOLD_TEMPLATES["tanstack-router"];
|
|
@@ -53,7 +53,7 @@ export function projectUuidFromDir(dir: string): string {
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Integration-proxy base URL, provided by the opencode container via
|
|
56
|
-
* PLUGINS_INTEGRATION_PROXY_URL (like
|
|
56
|
+
* PLUGINS_INTEGRATION_PROXY_URL (like PLUGINS_SCAFFOLD_VERSION) so each deployment
|
|
57
57
|
* (dev | preprod | prod) bakes its own proxy host into proxy.ts at scaffold
|
|
58
58
|
* time -- previews and published apps use the same value. Unset falls back
|
|
59
59
|
* to prod so a missing env var can never break production scaffolds.
|
|
@@ -29,14 +29,32 @@ import {
|
|
|
29
29
|
*
|
|
30
30
|
* Mutually exclusive with setup_netsuite: both own src/routes/login.tsx and
|
|
31
31
|
* the app's one auth strategy. Called AFTER `scaffold`, never instead of it.
|
|
32
|
+
*
|
|
33
|
+
* Only applies to full-stack (tanstack-start) scaffolds: the files it writes
|
|
34
|
+
* assume a server (API routes, drizzle schema). On a tanstack-router SPA it
|
|
35
|
+
* returns an error instead of writing broken server code.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Scaffold id recorded by the scaffold tool in .leo/project.json, or null if
|
|
40
|
+
* the file is missing/unreadable (pre-project.json workspaces: don't block).
|
|
32
41
|
*/
|
|
42
|
+
async function readScaffoldId(dir: string): Promise<string | null> {
|
|
43
|
+
try {
|
|
44
|
+
const meta = await Bun.file(path.join(dir, ".leo", "project.json")).json();
|
|
45
|
+
return typeof meta?.scaffold === "string" ? meta.scaffold : null;
|
|
46
|
+
} catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
33
50
|
export const setupAuthentication = tool({
|
|
34
51
|
description:
|
|
35
52
|
"Add authentication to an existing project via better-auth. Call scaffold first, " +
|
|
36
53
|
"then this. providers: 'password' for email/password, plus any of " +
|
|
37
54
|
"'google' | 'github' | 'discord' | 'microsoft' for social sign-in -- pass any " +
|
|
38
55
|
"combination. Mutually exclusive with setup_netsuite: an app has one auth " +
|
|
39
|
-
"strategy, not two."
|
|
56
|
+
"strategy, not two. Only for full-stack (tanstack-start) scaffolds; errors " +
|
|
57
|
+
"on client-only SPA projects.",
|
|
40
58
|
args: {
|
|
41
59
|
providers: z
|
|
42
60
|
.array(z.enum(PROVIDERS))
|
|
@@ -45,6 +63,16 @@ export const setupAuthentication = tool({
|
|
|
45
63
|
},
|
|
46
64
|
async execute({ providers }, context) {
|
|
47
65
|
const dir = context.directory;
|
|
66
|
+
|
|
67
|
+
const scaffoldId = await readScaffoldId(dir);
|
|
68
|
+
if (scaffoldId !== null && !scaffoldId.startsWith("tanstack-start")) {
|
|
69
|
+
return [
|
|
70
|
+
"Error: setup_authentication is for full-stack applications and is not applicable to HelloLeo Cloud.",
|
|
71
|
+
"This project is a client-only SPA (tanstack-router): no server, no API routes, no database, so the files this tool writes cannot work here.",
|
|
72
|
+
"Do not mention this error to the user. Continue by setting up authentication manually by activating HelloLeo Backend and using the MCP.",
|
|
73
|
+
].join("\n");
|
|
74
|
+
}
|
|
75
|
+
|
|
48
76
|
const hasPassword = providers.includes("password");
|
|
49
77
|
const oauth = providers.filter((p): p is OAuthProvider => p !== "password");
|
|
50
78
|
|