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.
This commit is contained in:
gglucass 2026-07-10 04:44:32 +02:00 committed by GitHub
parent f12f210eb5
commit 14a0d79548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View File

@ -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);

View File

@ -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', {