fix(install): preserve dev-preferences.md in Claude Code legacy cleanup path
After #1540 migrated Claude Code to skills/ format, the uninstall added a legacy commands/gsd/ cleanup that wiped the directory without checking for user files. Add preserve logic to the legacy cleanup path matching what Gemini's commands/gsd/ path already has. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3692,9 +3692,23 @@ function uninstall(isGlobal, runtime = 'claude') {
|
|||||||
// Also clean up legacy commands/gsd/ from older installs
|
// Also clean up legacy commands/gsd/ from older installs
|
||||||
const legacyCommandsDir = path.join(targetDir, 'commands', 'gsd');
|
const legacyCommandsDir = path.join(targetDir, 'commands', 'gsd');
|
||||||
if (fs.existsSync(legacyCommandsDir)) {
|
if (fs.existsSync(legacyCommandsDir)) {
|
||||||
|
// Preserve user-generated files before legacy wipe (#1423)
|
||||||
|
const devPrefsPath = path.join(legacyCommandsDir, 'dev-preferences.md');
|
||||||
|
const preservedDevPrefs = fs.existsSync(devPrefsPath) ? fs.readFileSync(devPrefsPath, 'utf-8') : null;
|
||||||
|
|
||||||
fs.rmSync(legacyCommandsDir, { recursive: true });
|
fs.rmSync(legacyCommandsDir, { recursive: true });
|
||||||
removedCount++;
|
removedCount++;
|
||||||
console.log(` ${green}✓${reset} Removed legacy commands/gsd/`);
|
console.log(` ${green}✓${reset} Removed legacy commands/gsd/`);
|
||||||
|
|
||||||
|
if (preservedDevPrefs) {
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(legacyCommandsDir, { recursive: true });
|
||||||
|
fs.writeFileSync(devPrefsPath, preservedDevPrefs);
|
||||||
|
console.log(` ${green}✓${reset} Preserved commands/gsd/dev-preferences.md`);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(` ${red}✗${reset} Failed to restore dev-preferences.md: ${err.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user