From 14a0d79548d4de8fc2de95c1b94bb0de63a739d3 Mon Sep 17 00:00:00 2001 From: gglucass Date: Fri, 10 Jul 2026 04:44:32 +0200 Subject: [PATCH] Emit statusline setup nudge at most once per user (#483) Writes a flag file the first time the STATUSLINE SETUP NEEDED nudge fires, and skips it on later sessions so it stops nagging every start. Includes a regression test that a second session stays silent. --- hooks/ponytail-activate.js | 7 ++++++- tests/hooks.test.js | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/hooks/ponytail-activate.js b/hooks/ponytail-activate.js index 3087c7c..d54fbe4 100644 --- a/hooks/ponytail-activate.js +++ b/hooks/ponytail-activate.js @@ -53,7 +53,12 @@ if (!isCodex && !isCopilot) try { } } - if (!hasStatusline) { + // Nudge at most once — the flag file marks that the user has already seen + // (and implicitly declined) the statusline setup offer. Repeating it every + // session start turns a helpful hint into a nag. + const nudgeFlagPath = path.join(claudeDir, '.ponytail-statusline-nudged'); + if (!hasStatusline && !fs.existsSync(nudgeFlagPath)) { + try { fs.writeFileSync(nudgeFlagPath, ''); } catch (e) { /* best-effort */ } const isWindows = process.platform === 'win32'; const scriptName = isWindows ? 'ponytail-statusline.ps1' : 'ponytail-statusline.sh'; const scriptPath = path.join(__dirname, scriptName); diff --git a/tests/hooks.test.js b/tests/hooks.test.js index 032ea15..bf4a8eb 100644 --- a/tests/hooks.test.js +++ b/tests/hooks.test.js @@ -161,6 +161,24 @@ assert.ok( 'statusline nudge must reference the CLAUDE_CONFIG_DIR settings.json', ); +// #483: the statusline nudge fires at most once — after it writes its flag, a +// later session stays silent instead of re-nagging on every start. +assert.ok( + fs.existsSync(path.join(customConfigDir, '.ponytail-statusline-nudged')), + 'first nudge must write the once-only flag (#483)', +); +const secondNudge = run('ponytail-activate.js', { + HOME: home2, + USERPROFILE: home2, + CLAUDE_CONFIG_DIR: customConfigDir, + PONYTAIL_DEFAULT_MODE: 'lite', +}); +assert.equal(secondNudge.status, 0, secondNudge.stderr); +assert.ok( + !secondNudge.stdout.includes('STATUSLINE SETUP NEEDED'), + 'nudge must not repeat once the flag file exists (#483)', +); + const copilotData = path.join(temp, 'copilot-data'); const codexData = path.join(temp, 'codex-data-shadow'); result = run('ponytail-activate.js', {