From dba401fe5459864a30fb7cc185724b6f295be789 Mon Sep 17 00:00:00 2001 From: dungan Date: Sat, 28 Feb 2026 04:33:53 +0900 Subject: [PATCH] fix: statusline migration regex too broad, clobbers third-party statuslines (#670) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Claude Opus 4.6 --- bin/install.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/install.js b/bin/install.js index 116998231..8a135958d 100755 --- a/bin/install.js +++ b/bin/install.js @@ -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;