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.
Files changed (2) hide show
  1. package/index.js +28 -13
  2. 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 envContent = `# Generated by create-personalai — ${new Date().toISOString()}
244
- ANTHROPIC_API_KEY=${creds.anthropicKey}
245
- NEXT_PUBLIC_SUPABASE_URL=${creds.supabaseUrl}
246
- NEXT_PUBLIC_SUPABASE_ANON_KEY=${creds.supabaseAnonKey}
247
- SUPABASE_URL=${creds.supabaseUrl}
248
- SUPABASE_ANON_KEY=${creds.supabaseAnonKey}
249
- REDIS_URL=redis://localhost:6379
250
- PROJECT_ROOT=${projectRoot}
251
- `;
252
-
253
- fs.writeFileSync(path.join(appDir, ".env.local"), envContent, { mode: 0o600 });
254
- log(".env.local created");
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(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-claude-code-visualizer",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Run and manage Claude Code agents through a web UI",
5
5
  "license": "MIT",
6
6
  "bin": {