create-claude-workspace 1.1.2 → 1.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.
|
@@ -127,7 +127,21 @@ function formatDuration(ms) {
|
|
|
127
127
|
return secs > 0 ? `${mins}m ${secs}s` : `${mins}m`;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
function isGitRepo(dir) {
|
|
131
|
+
try {
|
|
132
|
+
execSync('git rev-parse --git-dir', { cwd: dir, stdio: 'pipe' });
|
|
133
|
+
return true;
|
|
134
|
+
} catch {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
130
139
|
function ensureWorktree(projectDir) {
|
|
140
|
+
if (!isGitRepo(projectDir)) {
|
|
141
|
+
log('Not a git repository — skipping worktree.');
|
|
142
|
+
return projectDir;
|
|
143
|
+
}
|
|
144
|
+
|
|
131
145
|
const wtDir = resolve(projectDir, '.worktrees', 'autonomous');
|
|
132
146
|
|
|
133
147
|
if (existsSync(wtDir)) {
|
|
@@ -372,9 +386,9 @@ async function main() {
|
|
|
372
386
|
if (opts.worktree) {
|
|
373
387
|
try {
|
|
374
388
|
workDir = ensureWorktree(opts.projectDir);
|
|
375
|
-
log(`Worktree: ${workDir}`);
|
|
389
|
+
if (workDir !== opts.projectDir) log(`Worktree: ${workDir}`);
|
|
376
390
|
} catch (e) {
|
|
377
|
-
|
|
391
|
+
log(`Worktree setup failed: ${e.message}. Working in project directory.`);
|
|
378
392
|
}
|
|
379
393
|
}
|
|
380
394
|
|