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:
dungan
2026-02-28 04:33:53 +09:00
committed by GitHub
parent 69b28eeca4
commit dba401fe54

View File

@@ -951,16 +951,16 @@ function cleanupOrphanedHooks(settings) {
console.log(` ${green}✓${reset} Removed orphaned hook registrations`); 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 && if (settings.statusLine && settings.statusLine.command &&
settings.statusLine.command.includes('statusline.js') && /hooks[\/\\]statusline\.js/.test(settings.statusLine.command)) {
!settings.statusLine.command.includes('gsd-statusline.js')) {
// Replace old path with new path
settings.statusLine.command = settings.statusLine.command.replace( settings.statusLine.command = settings.statusLine.command.replace(
/statusline\.js/, /hooks([\/\\])statusline\.js/,
'gsd-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; return settings;