automagik-forge 0.3.7 → 0.3.9

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/bin/cli.js CHANGED
@@ -116,9 +116,31 @@ if (isMcpMode) {
116
116
  console.log(`📦 Extracting automagik-forge...`);
117
117
  extractAndRun("automagik-forge", (bin) => {
118
118
  console.log(`🚀 Launching automagik-forge...`);
119
+ // Load .env from current working directory (best-effort), then set defaults
120
+ const env = { ...process.env };
121
+ try {
122
+ const dotenvPath = path.join(process.cwd(), ".env");
123
+ if (fs.existsSync(dotenvPath)) {
124
+ const raw = fs.readFileSync(dotenvPath, "utf8");
125
+ for (const line of raw.split(/\r?\n/)) {
126
+ if (!line || /^\s*#/.test(line)) continue;
127
+ const m = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/);
128
+ if (!m) continue;
129
+ const key = m[1];
130
+ let val = m[2];
131
+ if ((val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'"))) {
132
+ val = val.slice(1, -1);
133
+ }
134
+ // Only set if not already provided in the process environment
135
+ if (env[key] === undefined) env[key] = val;
136
+ }
137
+ console.log(`🔧 Loaded environment from .env in ${process.cwd()}`);
138
+ }
139
+ } catch (e) {
140
+ console.warn(`⚠️ Failed to load .env: ${e.message}`);
141
+ }
119
142
 
120
143
  // Set default environment variables if not already set
121
- const env = { ...process.env };
122
144
  if (!env.BACKEND_PORT && !env.PORT) {
123
145
  env.BACKEND_PORT = "8887";
124
146
  }
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "automagik-forge",
3
3
  "private": false,
4
- "version": "0.3.7",
4
+ "version": "0.3.9",
5
5
  "main": "index.js",
6
6
  "bin": {
7
7
  "automagik-forge": "bin/cli.js"