feat(cases): rename a case and its folder, with a lock and live-session handling

This commit is contained in:
Devvyn committed 2026-10-23 04:12:37 +08:00
1 parent 002de32a08
commit ab0bc0aecd
14 files changed
+884

No files matched your search

+6
View File
@@ -151,6 +151,7 @@ import {
} from './session-attachment-history.js';
import type { SessionAttachmentHistoryItem, DisplayModel } from './types/session.js';
import { resolveConfigModel } from './model-config-resolvers.js';
import { isCasePathLocked } from './case-rename.js';
import { legacyConfigForMode } from './session-cli-registry-bridge.js';
import {
launchModelFor,
@@ -948,6 +949,11 @@ export class Session extends EventEmitter {
}
) {
super();
// A case folder being renamed (src/case-rename.ts) must not gain a session mid-move: its pane would
// start in a directory that is about to have a different path.
if (config.workingDir && isCasePathLocked(config.workingDir)) {
throw new Error(`The case folder ${config.workingDir} is being renamed. Try again in a moment.`);
}
this.setMaxListeners(25);
// Default error handler prevents unhandled 'error' events from crashing the process.