Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/utils/__tests__/claude-settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,19 @@ describe('installStatusLine refreshInterval', () => {
await installStatusLine({ commandMode: 'auto-npx', supportsRefreshInterval: true });
expect(readInstalledRefreshInterval()).toBe(5);
});

it('should preserve existing refreshInterval when version is unsupported', async () => {
writeRawClaudeSettings(JSON.stringify({
statusLine: {
type: 'command',
command: CCSTATUSLINE_COMMANDS.NPM,
padding: 0,
refreshInterval: 5
}
}));
await installStatusLine({ commandMode: 'auto-npx', supportsRefreshInterval: false });
expect(readInstalledRefreshInterval()).toBe(5);
});
});

describe('refreshInterval', () => {
Expand Down
10 changes: 7 additions & 3 deletions src/utils/claude-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,13 @@ export async function installStatusLine({
padding: 0
};

// Only set refreshInterval if Claude Code version supports it (>=2.1.97)
if (supportsRefreshInterval) {
settings.statusLine.refreshInterval = existingRefreshInterval ?? 10;
// Default refreshInterval only on supported versions (>=2.1.97), but always keep an
// existing value - the version probe also returns false when `claude --version` fails.
const refreshInterval = supportsRefreshInterval
? (existingRefreshInterval ?? 10)
: existingRefreshInterval;
if (refreshInterval !== undefined) {
settings.statusLine.refreshInterval = refreshInterval;
}

await saveClaudeSettings(settings);
Expand Down