create-claude-code-visualizer 0.1.2 → 0.1.4
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 +33 -17
- package/package.json +1 -1
- package/templates/app/src/app/api/ai/title/route.ts +2 -22
package/index.js
CHANGED
|
@@ -43,11 +43,12 @@ function copyIfNotExists(src, dest) {
|
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
function copyDirAdditive(src, dest,
|
|
46
|
+
function copyDirAdditive(src, dest, skipPrefixes) {
|
|
47
47
|
fs.mkdirSync(dest, { recursive: true });
|
|
48
|
+
const prefixes = Array.isArray(skipPrefixes) ? skipPrefixes : skipPrefixes ? [skipPrefixes] : [];
|
|
48
49
|
let added = 0;
|
|
49
50
|
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
50
|
-
if (
|
|
51
|
+
if (prefixes.some((p) => entry.name.startsWith(p))) continue;
|
|
51
52
|
const srcPath = path.join(src, entry.name);
|
|
52
53
|
const destPath = path.join(dest, entry.name);
|
|
53
54
|
if (entry.isDirectory()) {
|
|
@@ -177,11 +178,12 @@ async function main() {
|
|
|
177
178
|
);
|
|
178
179
|
log(`Commands: added ${addedCommands} new`);
|
|
179
180
|
|
|
180
|
-
// Skills (skip gws-*
|
|
181
|
+
// Skills (skip gws-* and recipe-* — those are installed via gws generate-skills)
|
|
182
|
+
const GWS_PREFIXES = ["gws-", "recipe-"];
|
|
181
183
|
const addedSkills = copyDirAdditive(
|
|
182
184
|
path.join(srcClaude, "skills"),
|
|
183
185
|
path.join(dstClaude, "skills"),
|
|
184
|
-
|
|
186
|
+
GWS_PREFIXES
|
|
185
187
|
);
|
|
186
188
|
log(`Skills: added ${addedSkills} new`);
|
|
187
189
|
|
|
@@ -292,20 +294,34 @@ PROJECT_ROOT=${projectRoot}
|
|
|
292
294
|
if (setupGws) {
|
|
293
295
|
console.log("");
|
|
294
296
|
|
|
295
|
-
// Install
|
|
296
|
-
info("Installing Google Workspace
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
297
|
+
// Install the Google Workspace CLI
|
|
298
|
+
info("Installing Google Workspace CLI (@googleworkspace/cli)...");
|
|
299
|
+
run("npm install @googleworkspace/cli", { cwd: projectRoot });
|
|
300
|
+
log("Google Workspace CLI installed");
|
|
301
|
+
|
|
302
|
+
// Authenticate
|
|
303
|
+
console.log("");
|
|
304
|
+
const { gwsAuth } = await prompts({
|
|
305
|
+
type: "select",
|
|
306
|
+
name: "gwsAuth",
|
|
307
|
+
message: "Google Workspace authentication",
|
|
308
|
+
choices: [
|
|
309
|
+
{ title: "Login now (opens browser for OAuth)", value: "login" },
|
|
310
|
+
{ title: "Skip for now (run 'npx gws auth login' later)", value: "skip" },
|
|
311
|
+
],
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
if (gwsAuth === "login") {
|
|
315
|
+
run("npx gws auth login", { cwd: projectRoot });
|
|
316
|
+
} else {
|
|
317
|
+
info("Skipping auth. Run later: cd " + projectDir + " && npx gws auth login");
|
|
307
318
|
}
|
|
308
|
-
|
|
319
|
+
|
|
320
|
+
// Generate GWS skills (the CLI handles skill selection)
|
|
321
|
+
console.log("");
|
|
322
|
+
info("Generating Google Workspace skills...");
|
|
323
|
+
run("npx gws generate-skills", { cwd: projectRoot });
|
|
324
|
+
log("GWS skills installed");
|
|
309
325
|
|
|
310
326
|
// Add gws permission to settings
|
|
311
327
|
const settingsPath = path.join(dstClaude, "settings.local.json");
|
package/package.json
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from "next/server";
|
|
2
2
|
import { supabase } from "@/lib/supabase";
|
|
3
|
-
|
|
4
|
-
const GEMINI_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-lite-preview:generateContent";
|
|
3
|
+
import { callHaiku } from "@/lib/ai";
|
|
5
4
|
|
|
6
5
|
const SYSTEM_PROMPT =
|
|
7
6
|
"You name chat conversations. Given the user's first message, generate a very short chat title (2-5 words max). Start with a relevant emoji. Return ONLY the title, nothing else. Examples:\n🐛 Fix login bug\n📊 Sales dashboard layout\n🚀 Deploy to production\n✍️ Write blog post\n📧 Email template help";
|
|
8
7
|
|
|
9
8
|
async function generateTitle(message: string): Promise<string> {
|
|
10
|
-
const
|
|
11
|
-
if (!apiKey) throw new Error("GEMINI_API_KEY not set");
|
|
12
|
-
|
|
13
|
-
const res = await fetch(`${GEMINI_URL}?key=${apiKey}`, {
|
|
14
|
-
method: "POST",
|
|
15
|
-
headers: { "Content-Type": "application/json" },
|
|
16
|
-
body: JSON.stringify({
|
|
17
|
-
system_instruction: { parts: [{ text: SYSTEM_PROMPT }] },
|
|
18
|
-
contents: [{ parts: [{ text: message }] }],
|
|
19
|
-
generationConfig: { maxOutputTokens: 30, temperature: 0.7 },
|
|
20
|
-
}),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (!res.ok) {
|
|
24
|
-
const body = await res.text();
|
|
25
|
-
throw new Error(`Gemini API error ${res.status}: ${body}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const data = await res.json();
|
|
29
|
-
const text = data.candidates?.[0]?.content?.parts?.[0]?.text || "";
|
|
9
|
+
const text = await callHaiku(SYSTEM_PROMPT, [{ role: "user", content: message }], 30);
|
|
30
10
|
return text.trim().replace(/^["']|["']$/g, "");
|
|
31
11
|
}
|
|
32
12
|
|