Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

chore(desktop): add env files for dev/production and update dev scripts

yusheneb07f12c49eb
diff --git a/.gitignore b/.gitignore
index f08a724862..bc6af42b20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,8 @@ release
# env
.env*
!.env.example
+!apps/desktop/.env.production
+!apps/desktop/.env.development
# platform specific
*.dmg
diff --git a/apps/desktop/.env.development b/apps/desktop/.env.development
new file mode 100644
index 0000000000..1baa4dd6b4
--- /dev/null
+++ b/apps/desktop/.env.development
@@ -0,0 +1,10 @@
+# Gateway WebSocket URL (dev)
+MAIN_VITE_GATEWAY_URL=https://multica-dev.copilothub.ai
+# Web URL for OAuth login (dev)
+MAIN_VITE_WEB_URL=http://localhost:3000
+# API URL for main process bridge (dev)
+MAIN_VITE_API_URL=https://api-dev.copilothub.ai
+# API URL for renderer (dev)
+RENDERER_VITE_API_URL=https://api-dev.copilothub.ai
+# API URL for core/tools (dev)
+MULTICA_API_URL=https://api-dev.copilothub.ai
diff --git a/apps/desktop/.env.example b/apps/desktop/.env.example
index d6547f7e61..b2d236e4c4 100644
--- a/apps/desktop/.env.example
+++ b/apps/desktop/.env.example
@@ -46,10 +46,16 @@
# Required:
# MAIN_VITE_GATEWAY_URL - WebSocket Gateway URL for remote connections
# MAIN_VITE_WEB_URL - Web App URL for OAuth login flow
+# MAIN_VITE_API_URL - API URL bridged to process.env for core package
+# RENDERER_VITE_API_URL - API URL for renderer process (UI requests)
+# MULTICA_API_URL - API URL for core/tools (web-search, finance)
#
# Example .env.production:
# MAIN_VITE_GATEWAY_URL=https://gateway.multica.ai
# MAIN_VITE_WEB_URL=https://www.multica.ai
+# MAIN_VITE_API_URL=https://api.multica.ai
+# RENDERER_VITE_API_URL=https://api.multica.ai
+# MULTICA_API_URL=https://api.multica.ai
#
# =============================================================================
# Variable Naming Convention
@@ -58,6 +64,7 @@
# MAIN_VITE_* - Main process only (Node.js, full system access)
# RENDERER_VITE_* - Renderer process only (browser context)
# VITE_* - All processes
+# MULTICA_* - Core/CLI/Gateway (read via process.env at runtime)
#
# =============================================================================
# Environment Variables
@@ -72,3 +79,21 @@ MAIN_VITE_GATEWAY_URL=http://localhost:3000
# Web App URL - Desktop opens this URL for user login (OAuth flow)
# Production example: https://www.multica.ai
MAIN_VITE_WEB_URL=http://localhost:3000
+
+# MAIN_VITE_API_URL
+# API URL for main process - Bridged to process.env.MULTICA_API_URL at startup
+# so that the externalized @multica/core package can read the correct API URL
+# in packaged builds (where .env files are not bundled).
+# Production example: https://api.multica.ai
+MAIN_VITE_API_URL=http://localhost:8080
+
+# RENDERER_VITE_API_URL
+# API URL for renderer process - Used by the React UI for login, user info, etc.
+# Production example: https://api.multica.ai
+RENDERER_VITE_API_URL=http://localhost:8080
+
+# MULTICA_API_URL
+# API URL for core/tools - Used by agent engine tools (web-search, finance)
+# Read by core package via process.env.MULTICA_API_URL at runtime
+# Production example: https://api.multica.ai
+MULTICA_API_URL=http://localhost:8080
diff --git a/apps/desktop/.env.production b/apps/desktop/.env.production
new file mode 100644
index 0000000000..4ed1968166
--- /dev/null
+++ b/apps/desktop/.env.production
@@ -0,0 +1,11 @@
+# Gateway WebSocket URL
+MAIN_VITE_GATEWAY_URL=https://gateway.multica.ai
+# Web URL for OAuth login
+MAIN_VITE_WEB_URL=https://www.multica.ai
+# API URL for main process bridge → core package
+MAIN_VITE_API_URL=https://api.multica.ai
+# API URL for renderer (UI requests)
+RENDERER_VITE_API_URL=https://api.multica.ai
+# API URL for core/tools — fallback already hardcoded in code; this documents the expected value
+# In packaged builds, MAIN_VITE_API_URL bridges this via process.env
+MULTICA_API_URL=https://api.multica.ai
diff --git a/package.json b/package.json
index 345fe5ac4a..22b3a617fe 100644
--- a/package.json
+++ b/package.json
@@ -11,8 +11,8 @@
"scripts": {
"multica": "pnpm --filter @multica/cli dev",
"mu": "pnpm --filter @multica/cli dev",
- "dev": "turbo build --filter=@multica/types --filter=@multica/utils --filter=@multica/core && concurrently -n types,utils,core,desktop -c blue,green,yellow,cyan \"pnpm --filter @multica/types dev\" \"pnpm --filter @multica/utils dev\" \"pnpm --filter @multica/core dev\" \"GATEWAY_URL=https://multica-dev.copilothub.ai/ pnpm --filter @multica/desktop dev\"",
- "dev:desktop": "GATEWAY_URL=https://multica-dev.copilothub.ai/ pnpm --filter @multica/desktop dev",
+ "dev": "turbo build --filter=@multica/types --filter=@multica/utils --filter=@multica/core && concurrently -n types,utils,core,desktop -c blue,green,yellow,cyan \"pnpm --filter @multica/types dev\" \"pnpm --filter @multica/utils dev\" \"pnpm --filter @multica/core dev\" \"pnpm --filter @multica/desktop dev\"",
+ "dev:desktop": "pnpm --filter @multica/desktop dev",
"dev:desktop:reset": "rm -rf ~/.super-multica && echo '✓ Deleted ~/.super-multica - Fresh install state restored'",
"dev:desktop:fresh": "pnpm dev:desktop:reset && pnpm dev:desktop",
"dev:desktop:onboarding": "pnpm --filter @multica/desktop dev:onboarding",