start-vibing 3.0.4 → 3.0.5
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/dist/cli.js +47 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -311,7 +311,7 @@ function getUpdateCommand() {
|
|
|
311
311
|
|
|
312
312
|
// src/claude.ts
|
|
313
313
|
import { spawn, execSync as execSync2, spawnSync } from "child_process";
|
|
314
|
-
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
314
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
315
315
|
import { join as join3 } from "path";
|
|
316
316
|
import { homedir } from "os";
|
|
317
317
|
function isClaudeInstalled() {
|
|
@@ -418,14 +418,41 @@ async function installClaudeUnix() {
|
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
+
function encodeProjectPath(absolutePath) {
|
|
422
|
+
return absolutePath.replace(/\\/g, "/").replace(/\//g, "-");
|
|
423
|
+
}
|
|
424
|
+
function hasExistingSession(projectDir) {
|
|
425
|
+
const encodedPath = encodeProjectPath(projectDir);
|
|
426
|
+
const sessionDir = join3(homedir(), ".claude", "projects", encodedPath);
|
|
427
|
+
const indexFile = join3(sessionDir, "sessions-index.json");
|
|
428
|
+
if (existsSync3(indexFile)) {
|
|
429
|
+
try {
|
|
430
|
+
const raw = readFileSync3(indexFile, "utf-8");
|
|
431
|
+
const index = JSON.parse(raw);
|
|
432
|
+
if (Array.isArray(index.entries)) {
|
|
433
|
+
const mainSessions = index.entries.filter((e) => !e.isSidechain);
|
|
434
|
+
if (mainSessions.length > 0)
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
} catch {
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (existsSync3(sessionDir)) {
|
|
441
|
+
try {
|
|
442
|
+
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.jsonl$/;
|
|
443
|
+
return readdirSync2(sessionDir).some((f) => uuidPattern.test(f));
|
|
444
|
+
} catch {
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
421
449
|
function launchClaude(cwd, options = {}) {
|
|
422
450
|
const { isWindows } = getPlatformInfo();
|
|
423
|
-
const
|
|
451
|
+
const canResume = !options.newSession && hasExistingSession(cwd);
|
|
424
452
|
const args = ["--dangerously-skip-permissions"];
|
|
425
|
-
if (
|
|
453
|
+
if (canResume) {
|
|
426
454
|
args.unshift("-c");
|
|
427
455
|
}
|
|
428
|
-
const startTime = Date.now();
|
|
429
456
|
const claude = spawn("claude", args, {
|
|
430
457
|
cwd,
|
|
431
458
|
stdio: "inherit",
|
|
@@ -447,13 +474,6 @@ function launchClaude(cwd, options = {}) {
|
|
|
447
474
|
process.exit(1);
|
|
448
475
|
});
|
|
449
476
|
claude.on("exit", (code) => {
|
|
450
|
-
if (code !== 0 && resumeSession && Date.now() - startTime < 5000) {
|
|
451
|
-
console.log("");
|
|
452
|
-
console.log(" No conversation found to continue. Starting new session...");
|
|
453
|
-
console.log("");
|
|
454
|
-
launchClaude(cwd, { newSession: true });
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
477
|
process.exit(code || 0);
|
|
458
478
|
});
|
|
459
479
|
}
|
|
@@ -529,6 +549,18 @@ var CORE_MCPS = [
|
|
|
529
549
|
description: "issue tracking",
|
|
530
550
|
command: "npx",
|
|
531
551
|
args: ["-y", "@aashari/mcp-server-atlassian-jira"]
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
name: "git",
|
|
555
|
+
description: "git operations",
|
|
556
|
+
command: "uvx",
|
|
557
|
+
args: ["mcp-server-git"]
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
name: "fetch",
|
|
561
|
+
description: "web page reading",
|
|
562
|
+
command: "uvx",
|
|
563
|
+
args: ["mcp-server-fetch"]
|
|
532
564
|
}
|
|
533
565
|
];
|
|
534
566
|
function isClaudeMcpReady() {
|
|
@@ -1042,12 +1074,14 @@ async function main() {
|
|
|
1042
1074
|
const spinner4 = createSpinner(phaseHeader(4, TOTAL_PHASES, "Installing plugins..."));
|
|
1043
1075
|
spinner4.succeed(phaseHeader(4, TOTAL_PHASES, `Plugins ${c.dim}${"\xB7".repeat(21)}${c.reset} ${c.dim}deferred (will auto-prompt)${c.reset}`));
|
|
1044
1076
|
}
|
|
1045
|
-
const
|
|
1077
|
+
const sessionExists = hasExistingSession(targetDir);
|
|
1078
|
+
const willResume = !newSession && sessionExists;
|
|
1079
|
+
const launchMode = newSession ? "new session" : willResume ? "resuming last session" : "new session";
|
|
1046
1080
|
console.log(` ${c.green}\u2713${c.reset} ${phaseHeader(5, TOTAL_PHASES, `Launching Claude Code ${c.dim}${"\xB7".repeat(7)}${c.reset} ${launchMode}`)}`);
|
|
1047
1081
|
printOptionalMcps();
|
|
1048
1082
|
console.log("");
|
|
1049
1083
|
console.log(` ${c.green}Setup complete${c.reset} in ${formatElapsed(globalStart)}`);
|
|
1050
1084
|
console.log("");
|
|
1051
|
-
launchClaude(targetDir, { newSession });
|
|
1085
|
+
launchClaude(targetDir, { newSession: newSession || !sessionExists });
|
|
1052
1086
|
}
|
|
1053
1087
|
main();
|
package/package.json
CHANGED