fix: statusline migration regex too broad, clobbers third-party statuslines (#670)
The #330 migration that renames `statusline.js` → `gsd-statusline.js` uses `.includes('statusline.js')` which matches ANY file containing that substring. For example, a user's custom `ted-statusline.js` gets silently rewritten to `ted-gsd-statusline.js` (which doesn't exist). This happens inside `cleanupOrphanedHooks()` which runs before the interactive "Keep existing / Replace" prompt, so even choosing "Keep existing" doesn't prevent the damage. Fix: narrow the regex to only match the specific old GSD path pattern `hooks/statusline.js` (or `hooks\statusline.js` on Windows). Co-authored-by: ddungan <sckim@mococo.co.kr> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -951,16 +951,16 @@ function cleanupOrphanedHooks(settings) {
|
||||
console.log(` ${green}✓${reset} Removed orphaned hook registrations`);
|
||||
}
|
||||
|
||||
// Fix #330: Update statusLine if it points to old statusline.js path
|
||||
// Fix #330: Update statusLine if it points to old GSD statusline.js path
|
||||
// Only match the specific old GSD path pattern (hooks/statusline.js),
|
||||
// not third-party statusline scripts that happen to contain 'statusline.js'
|
||||
if (settings.statusLine && settings.statusLine.command &&
|
||||
settings.statusLine.command.includes('statusline.js') &&
|
||||
!settings.statusLine.command.includes('gsd-statusline.js')) {
|
||||
// Replace old path with new path
|
||||
/hooks[\/\\]statusline\.js/.test(settings.statusLine.command)) {
|
||||
settings.statusLine.command = settings.statusLine.command.replace(
|
||||
/statusline\.js/,
|
||||
'gsd-statusline.js'
|
||||
/hooks([\/\\])statusline\.js/,
|
||||
'hooks$1gsd-statusline.js'
|
||||
);
|
||||
console.log(` ${green}✓${reset} Updated statusline path (statusline.js → gsd-statusline.js)`);
|
||||
console.log(` ${green}✓${reset} Updated statusline path (hooks/statusline.js → hooks/gsd-statusline.js)`);
|
||||
}
|
||||
|
||||
return settings;
|
||||
|
||||
Reference in New Issue
Block a user