@helloleo/plugins 0.2.9 → 0.2.10

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
@@ -24915,6 +24915,10 @@ function resolveTemplateId() {
24915
24915
  function projectUuidFromDir(dir) {
24916
24916
  return path3.basename(dir);
24917
24917
  }
24918
+ function integrationProxyUrl(projectUuid) {
24919
+ const base = (process.env.PLUGINS_INTEGRATION_PROXY_URL || "https://api.app.helloleo.dev").replace(/\/+$/, "");
24920
+ return `${base}/api/integration-proxy/${projectUuid}`;
24921
+ }
24918
24922
  var scaffoldOptionsSchema = exports_external2.object({
24919
24923
  name: exports_external2.string().describe("Human-readable name for SEO, e.g. 'Shipping Platform'"),
24920
24924
  description: exports_external2.string().describe("One sentence describing the app. Used as the meta description.")
@@ -24924,11 +24928,13 @@ function slugify(name) {
24924
24928
  }
24925
24929
  async function writeBaseScaffold({ name, description }, dir) {
24926
24930
  const templateId = resolveTemplateId();
24931
+ const projectUuid = projectUuidFromDir(dir);
24927
24932
  const created = await renderTemplate(templateId, {
24928
24933
  LEO_NAME: name,
24929
24934
  LEO_SLUG: slugify(name),
24930
24935
  LEO_DESCRIPTION: description,
24931
- LEO_PROJECT_UUID: projectUuidFromDir(dir)
24936
+ LEO_PROJECT_UUID: projectUuid,
24937
+ LEO_INTEGRATION_PROXY_URL: integrationProxyUrl(projectUuid)
24932
24938
  }, dir);
24933
24939
  await mkdir(path3.join(dir, ".leo"), { recursive: true });
24934
24940
  const leoPath = path3.join(".leo", "project.json");
@@ -39,8 +39,10 @@
39
39
  * from a Worker. Never embed secrets in frontend code.
40
40
  */
41
41
 
42
- export const INTEGRATION_PROXY_URL =
43
- 'https://api.app.helloleo.dev/api/integration-proxy/{{LEO_PROJECT_UUID}}';
42
+
43
+ export const INTEGRATION_PROXY_URL = '{{LEO_INTEGRATION_PROXY_URL}}';
44
+
45
+ export const BACKEND_URL = (import.meta.env.VITE_WORKER_URL as string | undefined) ?? '';
44
46
 
45
47
  export interface ProxyRequest {
46
48
  integration: string;
@@ -39,8 +39,7 @@
39
39
  * from a Worker. Never embed secrets in frontend code.
40
40
  */
41
41
 
42
- export const INTEGRATION_PROXY_URL =
43
- 'https://api.app.helloleo.dev/api/integration-proxy/{{LEO_PROJECT_UUID}}';
42
+ export const INTEGRATION_PROXY_URL = '{{LEO_INTEGRATION_PROXY_URL}}';
44
43
 
45
44
  export interface ProxyRequest {
46
45
  integration: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helloleo/plugins",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "OpenCode plugins for HelloLeo",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -39,8 +39,10 @@
39
39
  * from a Worker. Never embed secrets in frontend code.
40
40
  */
41
41
 
42
- export const INTEGRATION_PROXY_URL =
43
- 'https://api.app.helloleo.dev/api/integration-proxy/{{LEO_PROJECT_UUID}}';
42
+
43
+ export const INTEGRATION_PROXY_URL = '{{LEO_INTEGRATION_PROXY_URL}}';
44
+
45
+ export const BACKEND_URL = (import.meta.env.VITE_WORKER_URL as string | undefined) ?? '';
44
46
 
45
47
  export interface ProxyRequest {
46
48
  integration: string;
@@ -39,8 +39,7 @@
39
39
  * from a Worker. Never embed secrets in frontend code.
40
40
  */
41
41
 
42
- export const INTEGRATION_PROXY_URL =
43
- 'https://api.app.helloleo.dev/api/integration-proxy/{{LEO_PROJECT_UUID}}';
42
+ export const INTEGRATION_PROXY_URL = '{{LEO_INTEGRATION_PROXY_URL}}';
44
43
 
45
44
  export interface ProxyRequest {
46
45
  integration: string;
@@ -51,6 +51,21 @@ export function projectUuidFromDir(dir: string): string {
51
51
  return path.basename(dir);
52
52
  }
53
53
 
54
+ /**
55
+ * Integration-proxy base URL, provided by the opencode container via
56
+ * PLUGINS_INTEGRATION_PROXY_URL (like SCAFFOLD_VERSION) so each deployment
57
+ * (dev | preprod | prod) bakes its own proxy host into proxy.ts at scaffold
58
+ * time -- previews and published apps use the same value. Unset falls back
59
+ * to prod so a missing env var can never break production scaffolds.
60
+ */
61
+ export function integrationProxyUrl(projectUuid: string): string {
62
+ const base = (
63
+ process.env.PLUGINS_INTEGRATION_PROXY_URL || "https://api.app.helloleo.dev"
64
+ ).replace(/\/+$/, "");
65
+
66
+ return `${base}/api/integration-proxy/${projectUuid}`;
67
+ }
68
+
54
69
  const scaffoldOptionsSchema = z.object({
55
70
  name: z
56
71
  .string()
@@ -92,13 +107,15 @@ export async function writeBaseScaffold(
92
107
  dir: string,
93
108
  ): Promise<string[]> {
94
109
  const templateId = resolveTemplateId();
110
+ const projectUuid = projectUuidFromDir(dir);
95
111
  const created = await renderTemplate(
96
112
  templateId,
97
113
  {
98
114
  LEO_NAME: name,
99
115
  LEO_SLUG: slugify(name),
100
116
  LEO_DESCRIPTION: description,
101
- LEO_PROJECT_UUID: projectUuidFromDir(dir),
117
+ LEO_PROJECT_UUID: projectUuid,
118
+ LEO_INTEGRATION_PROXY_URL: integrationProxyUrl(projectUuid),
102
119
  },
103
120
  dir,
104
121
  );