@bakapiano/ccsm 0.17.4 → 0.17.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.
Files changed (2) hide show
  1. package/bin/ccsm.js +22 -14
  2. package/package.json +1 -1
package/bin/ccsm.js CHANGED
@@ -122,21 +122,29 @@ function isSameVersion(running) {
122
122
  // (b) bind port 7777 before the helper's own respawn does. Either
123
123
  // way the upgrade derails. Bail out instead — the helper's UI on
124
124
  // 7779 is already showing the user what's happening.
125
- const lockPath = path.join(HOME, '.upgrade.lock');
126
- try {
127
- const raw = fs.readFileSync(lockPath, 'utf8');
128
- const lock = JSON.parse(raw);
129
- const ageMs = Date.now() - (lock.startedAt || 0);
130
- const ownerAlive = lock.pid ? pidAlive(lock.pid) : false;
131
- if (ownerAlive && ageMs < 10 * 60_000) {
132
- console.log(`ccsm: upgrade in progress (helper pid=${lock.pid}, ${Math.round(ageMs/1000)}s ago, target=${lock.target || '?'})`);
133
- console.log(` see http://localhost:${lock.helperPort || 7779}/ for live progress`);
134
- process.exit(0);
125
+ //
126
+ // Exception: the helper itself spawns ccsm.cmd at the END of the
127
+ // upgrade (after npm install completes) to bring the new backend up.
128
+ // It sets CCSM_FROM_UPGRADE=1 in that child's env. We MUST skip the
129
+ // lock check in that case, otherwise we'd refuse our own respawn and
130
+ // the user would be stuck staring at "Backend not running".
131
+ if (process.env.CCSM_FROM_UPGRADE !== '1') {
132
+ const lockPath = path.join(HOME, '.upgrade.lock');
133
+ try {
134
+ const raw = fs.readFileSync(lockPath, 'utf8');
135
+ const lock = JSON.parse(raw);
136
+ const ageMs = Date.now() - (lock.startedAt || 0);
137
+ const ownerAlive = lock.pid ? pidAlive(lock.pid) : false;
138
+ if (ownerAlive && ageMs < 10 * 60_000) {
139
+ console.log(`ccsm: upgrade in progress (helper pid=${lock.pid}, ${Math.round(ageMs/1000)}s ago, target=${lock.target || '?'})`);
140
+ console.log(` see http://localhost:${lock.helperPort || 7779}/ for live progress`);
141
+ process.exit(0);
142
+ }
143
+ // Stale lock (pid dead OR > 10min) — clean up and continue.
144
+ try { fs.unlinkSync(lockPath); } catch {}
145
+ } catch {
146
+ // ENOENT or parse error → no lock, proceed.
135
147
  }
136
- // Stale lock (pid dead OR > 10min) — clean up and continue.
137
- try { fs.unlinkSync(lockPath); } catch {}
138
- } catch {
139
- // ENOENT or parse error → no lock, proceed.
140
148
  }
141
149
 
142
150
  // Case 1: existing instance on the preferred port
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakapiano/ccsm",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
4
4
  "description": "Claude Code Session Manager — Windows web UI to manage many concurrent claude sessions: live list, snapshot/restore, focus existing window, new session in an isolated workspace with repo clones",
5
5
  "license": "MIT",
6
6
  "main": "server.js",