create-claude-code-visualizer 0.1.5 → 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 +55 -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
|
-
|
|
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
|
+
}
|
|
252
262
|
|
|
253
|
-
|
|
254
|
-
|
|
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(
|
|
@@ -316,10 +331,37 @@ PROJECT_ROOT=${projectRoot}
|
|
|
316
331
|
}
|
|
317
332
|
|
|
318
333
|
// Generate GWS skills (the CLI handles skill selection)
|
|
334
|
+
// gws writes to ./skills/ — we generate then move to .claude/skills/
|
|
319
335
|
console.log("");
|
|
320
336
|
info("Generating Google Workspace skills...");
|
|
321
337
|
run("npx gws generate-skills", { cwd: projectRoot });
|
|
322
|
-
|
|
338
|
+
|
|
339
|
+
// Move generated skills into .claude/skills/
|
|
340
|
+
const gwsOut = path.join(projectRoot, "skills");
|
|
341
|
+
if (fs.existsSync(gwsOut)) {
|
|
342
|
+
const gwsSkillsDst = path.join(dstClaude, "skills");
|
|
343
|
+
fs.mkdirSync(gwsSkillsDst, { recursive: true });
|
|
344
|
+
for (const entry of fs.readdirSync(gwsOut, { withFileTypes: true })) {
|
|
345
|
+
const src = path.join(gwsOut, entry.name);
|
|
346
|
+
const dest = path.join(gwsSkillsDst, entry.name);
|
|
347
|
+
if (!fs.existsSync(dest)) {
|
|
348
|
+
if (entry.isDirectory()) {
|
|
349
|
+
copyDir(src, dest);
|
|
350
|
+
} else {
|
|
351
|
+
fs.copyFileSync(src, dest);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
// Clean up the top-level skills/ directory
|
|
356
|
+
fs.rmSync(gwsOut, { recursive: true, force: true });
|
|
357
|
+
}
|
|
358
|
+
// Clean up docs/skills.md if generated
|
|
359
|
+
const gwsDocs = path.join(projectRoot, "docs");
|
|
360
|
+
if (fs.existsSync(path.join(gwsDocs, "skills.md"))) {
|
|
361
|
+
fs.rmSync(path.join(gwsDocs, "skills.md"), { force: true });
|
|
362
|
+
try { fs.rmdirSync(gwsDocs); } catch {} // remove if empty
|
|
363
|
+
}
|
|
364
|
+
log("GWS skills installed to .claude/skills/");
|
|
323
365
|
|
|
324
366
|
// Add gws permission to settings
|
|
325
367
|
const settingsPath = path.join(dstClaude, "settings.local.json");
|