create-claude-code-visualizer 0.1.6 → 0.1.7
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/index.js +28 -13
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -237,21 +237,36 @@ async function main() {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
// -----------------------------------------------------------------
|
|
240
|
-
// Write .env.local
|
|
240
|
+
// Write .env.local (merge with existing if present)
|
|
241
241
|
// -----------------------------------------------------------------
|
|
242
242
|
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
243
|
+
const envPath = path.join(appDir, ".env.local");
|
|
244
|
+
const newVars = {
|
|
245
|
+
ANTHROPIC_API_KEY: creds.anthropicKey,
|
|
246
|
+
NEXT_PUBLIC_SUPABASE_URL: creds.supabaseUrl,
|
|
247
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY: creds.supabaseAnonKey,
|
|
248
|
+
SUPABASE_URL: creds.supabaseUrl,
|
|
249
|
+
SUPABASE_ANON_KEY: creds.supabaseAnonKey,
|
|
250
|
+
REDIS_URL: "redis://localhost:6379",
|
|
251
|
+
PROJECT_ROOT: projectRoot,
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// Parse existing .env.local if it exists — preserve user's extra vars
|
|
255
|
+
const existingVars = {};
|
|
256
|
+
if (fs.existsSync(envPath)) {
|
|
257
|
+
for (const line of fs.readFileSync(envPath, "utf8").split("\n")) {
|
|
258
|
+
const match = line.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);
|
|
259
|
+
if (match) existingVars[match[1]] = match[2];
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Merge: new values override for keys we manage, but keep user's extras
|
|
264
|
+
const merged = { ...existingVars, ...newVars };
|
|
265
|
+
const envContent = `# Generated by create-claude-code-visualizer — ${new Date().toISOString()}\n` +
|
|
266
|
+
Object.entries(merged).map(([k, v]) => `${k}=${v}`).join("\n") + "\n";
|
|
267
|
+
|
|
268
|
+
fs.writeFileSync(envPath, envContent, { mode: 0o600 });
|
|
269
|
+
log(Object.keys(existingVars).length ? ".env.local updated (existing vars preserved)" : ".env.local created");
|
|
255
270
|
|
|
256
271
|
// Add Supabase MCP server if we have a URL
|
|
257
272
|
const supabaseMatch = (creds.supabaseUrl || "").match(
|