mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-02 13:39:41 +02:00
fix(state-store): scope legacy ~/.claudeman migration to the default instance
The instance-isolation sweep routed every ~/.codeman write through dataPath() except the legacy ~/.claudeman → ~/.codeman migration in the StateStore constructor, which stayed hardcoded. Gate the whole legacy block on the default (prod) instance so a named instance (e.g. CODEMAN_INSTANCE=beta) never reads or renames into the shared ~/.codeman / ~/codeman-cases layout. Prod behavior is unchanged (CODEMAN_INSTANCE empty → migration still runs). Note: swapping newDir to getDataDir() was rejected — its mkdirSync side-effect would make !existsSync(newDir) false and silently disable the migration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+5
-3
@@ -39,7 +39,7 @@ import {
|
||||
TokenUsageEntry,
|
||||
} from './types.js';
|
||||
import { Debouncer, MAX_SESSION_TOKENS } from './utils/index.js';
|
||||
import { dataPath } from './config/instance.js';
|
||||
import { dataPath, CODEMAN_INSTANCE } from './config/instance.js';
|
||||
|
||||
/** Debounce delay for batching state writes (ms) */
|
||||
const SAVE_DEBOUNCE_MS = 500;
|
||||
@@ -90,8 +90,10 @@ export class StateStore {
|
||||
private _saveInFlight: Promise<void> | null = null;
|
||||
|
||||
constructor(filePath?: string) {
|
||||
// Migrate legacy data directory (~/.claudeman → ~/.codeman)
|
||||
if (!filePath) {
|
||||
// Migrate legacy data directory (~/.claudeman → ~/.codeman). Default (prod)
|
||||
// instance only — a named instance (e.g. beta) must never touch the shared
|
||||
// ~/.codeman / ~/codeman-cases layout, preserving instance isolation.
|
||||
if (!filePath && !CODEMAN_INSTANCE) {
|
||||
const legacyDir = join(homedir(), '.claudeman');
|
||||
const newDir = join(homedir(), '.codeman');
|
||||
if (existsSync(legacyDir) && !existsSync(newDir)) {
|
||||
|
||||
Reference in New Issue
Block a user