create-claude-workspace 2.3.24 → 2.3.26

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.
@@ -49,6 +49,9 @@ export function checkPlatformCLI(platform) {
49
49
  * Resolve the full path to a CLI binary.
50
50
  * First tries the bare name (in PATH), then checks known installation directories
51
51
  * for freshly installed tools that aren't in the current process PATH.
52
+ *
53
+ * When found outside PATH, adds the binary's directory to process.env.PATH
54
+ * so all subsequent execFileSync calls in this process can find it.
52
55
  */
53
56
  export function resolveCLIBinary(cli) {
54
57
  // Try bare name first (already in PATH)
@@ -62,18 +65,32 @@ export function resolveCLIBinary(cli) {
62
65
  }
63
66
  // Try known installation paths (winget, scoop, choco, brew, etc.)
64
67
  const candidates = getKnownCLIPaths(cli);
65
- for (const path of candidates) {
68
+ for (const fullPath of candidates) {
66
69
  try {
67
- execFileSync(path, ['--version'], { stdio: 'pipe', timeout: 10_000 });
68
- return path;
70
+ execFileSync(fullPath, ['--version'], { stdio: 'pipe', timeout: 10_000 });
71
+ // Add the directory to PATH so all future exec calls find it
72
+ addToProcessPath(fullPath);
73
+ return fullPath;
69
74
  }
70
75
  catch (err) {
71
- if (err.code !== 'ENOENT')
72
- return path;
76
+ if (err.code !== 'ENOENT') {
77
+ addToProcessPath(fullPath);
78
+ return fullPath;
79
+ }
73
80
  }
74
81
  }
75
82
  return null;
76
83
  }
84
+ /** Add the parent directory of a binary to process.env.PATH */
85
+ function addToProcessPath(binaryPath) {
86
+ const { dirname } = require('node:path');
87
+ const dir = dirname(binaryPath);
88
+ const sep = process.platform === 'win32' ? ';' : ':';
89
+ const currentPath = process.env.PATH ?? '';
90
+ if (!currentPath.split(sep).includes(dir)) {
91
+ process.env.PATH = `${dir}${sep}${currentPath}`;
92
+ }
93
+ }
77
94
  function getKnownCLIPaths(cli) {
78
95
  const paths = [];
79
96
  const isWindows = process.platform === 'win32';
@@ -285,16 +285,16 @@ export async function runScheduler(opts) {
285
285
  process.exit(1);
286
286
  }
287
287
  }
288
- // Task mode detection
288
+ // Task mode detection — always re-detect unless user explicitly set --task-mode
289
+ // (stored state may be stale if CLI was installed/authenticated since last run)
289
290
  if (opts.taskMode) {
290
291
  state.taskMode = opts.taskMode;
292
+ logger.info(`Task mode (from flag): ${state.taskMode}`);
291
293
  }
292
- else if (!existing) {
293
- // Auto-detect: platform mode if remote has issues with status:: labels
294
+ else {
294
295
  state.taskMode = detectTaskMode(opts.projectDir);
295
- logger.info(`Task mode auto-detected: ${state.taskMode}`);
296
+ logger.info(`Task mode: ${state.taskMode}`);
296
297
  }
297
- // If resuming existing state, keep the stored taskMode
298
298
  // Platform mode: shorter idle poll interval (30s vs 5min)
299
299
  const mutableOpts = opts;
300
300
  if (state.taskMode === 'platform' && !opts.taskMode && opts.idlePollInterval === SCHEDULER_DEFAULTS.idlePollInterval) {
@@ -785,6 +785,15 @@ export async function recoverOrphanedWorktrees(projectDir, state, logger, _deps)
785
785
  // Phase 1: Orphaned worktrees → re-inject into pipelines
786
786
  for (const worktreePath of orphans) {
787
787
  try {
788
+ // If the worktree directory was manually deleted, prune it from git and skip
789
+ if (!existsSync(worktreePath)) {
790
+ logger.info(`[recovery] Worktree directory missing: ${worktreePath} — pruning from git`);
791
+ try {
792
+ execFileSync('git', ['worktree', 'prune'], { cwd: projectDir, stdio: 'pipe', timeout: 10_000 });
793
+ }
794
+ catch { /* ignore */ }
795
+ continue;
796
+ }
788
797
  const branch = getCurrentBranch(worktreePath);
789
798
  const alreadyMerged = isBranchMerged(projectDir, branch);
790
799
  if (alreadyMerged) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-claude-workspace",
3
- "version": "2.3.24",
3
+ "version": "2.3.26",
4
4
  "author": "",
5
5
  "repository": {
6
6
  "type": "git",