claude-remote-cli 2.2.0 → 2.2.1
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/server/config.js +9 -0
- package/dist/server/index.js +15 -3
- package/package.json +1 -1
package/dist/server/config.js
CHANGED
|
@@ -47,3 +47,12 @@ export function writeMeta(configPath, meta) {
|
|
|
47
47
|
ensureMetaDir(configPath);
|
|
48
48
|
fs.writeFileSync(fp, JSON.stringify(meta, null, 2), 'utf8');
|
|
49
49
|
}
|
|
50
|
+
export function deleteMeta(configPath, worktreePath) {
|
|
51
|
+
const fp = metaFilePath(configPath, worktreePath);
|
|
52
|
+
try {
|
|
53
|
+
fs.unlinkSync(fp);
|
|
54
|
+
}
|
|
55
|
+
catch (_) {
|
|
56
|
+
// File may not exist; ignore
|
|
57
|
+
}
|
|
58
|
+
}
|
package/dist/server/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { execFile } from 'node:child_process';
|
|
|
8
8
|
import { promisify } from 'node:util';
|
|
9
9
|
import express from 'express';
|
|
10
10
|
import cookieParser from 'cookie-parser';
|
|
11
|
-
import { loadConfig, saveConfig, DEFAULTS, readMeta, writeMeta, ensureMetaDir } from './config.js';
|
|
11
|
+
import { loadConfig, saveConfig, DEFAULTS, readMeta, writeMeta, deleteMeta, ensureMetaDir } from './config.js';
|
|
12
12
|
import * as auth from './auth.js';
|
|
13
13
|
import * as sessions from './sessions.js';
|
|
14
14
|
import { setupWebSocket } from './ws.js';
|
|
@@ -340,8 +340,18 @@ async function main() {
|
|
|
340
340
|
await execFileAsync('git', ['worktree', 'remove', worktreePath], { cwd: repoPath });
|
|
341
341
|
}
|
|
342
342
|
catch (err) {
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
// If git worktree remove fails, the directory may be an orphaned worktree
|
|
344
|
+
// that git no longer tracks. Try to remove the directory directly.
|
|
345
|
+
if (fs.existsSync(worktreePath)) {
|
|
346
|
+
try {
|
|
347
|
+
fs.rmSync(worktreePath, { recursive: true });
|
|
348
|
+
}
|
|
349
|
+
catch (rmErr) {
|
|
350
|
+
res.status(500).json({ error: execErrorMessage(rmErr, 'Failed to remove worktree directory') });
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
// If directory doesn't exist, the worktree is already gone — continue to cleanup
|
|
345
355
|
}
|
|
346
356
|
try {
|
|
347
357
|
// Prune stale worktree refs
|
|
@@ -359,6 +369,8 @@ async function main() {
|
|
|
359
369
|
// Non-fatal: branch may not exist or may be checked out elsewhere
|
|
360
370
|
}
|
|
361
371
|
}
|
|
372
|
+
// Clean up metadata file
|
|
373
|
+
deleteMeta(CONFIG_PATH, worktreePath);
|
|
362
374
|
res.json({ ok: true });
|
|
363
375
|
});
|
|
364
376
|
// POST /sessions
|