fix(cursor): address remaining PR #527 review feedback

- Add SIGKILL escalation in stopDaemon after SIGTERM timeout
- Document router difference between cursor/copilot help behavior
- Fix detectProvider to handle o1/o4 models via regex pattern
- Add fetchModelsFromDaemon fallback test for unreachable daemon
- Update CLAUDE.md help table with cursor command entry
This commit is contained in:
Tam Nhu Tran committed 2026-02-12 04:14:28 +07:00
1 parent 9f9db7dcea
commit afb5e746b3
5 files changed
+29 -1

No files matched your search

+17
View File
@@ -10,6 +10,7 @@ import {
getDefaultModel,
detectProvider,
formatModelName,
fetchModelsFromDaemon,
} from '../../../src/cursor/cursor-models';
describe('DEFAULT_CURSOR_MODELS', () => {
@@ -57,6 +58,12 @@ describe('detectProvider', () => {
expect(detectProvider('o3-mini')).toBe('openai');
});
it('detects o1 and o4 models as openai', () => {
expect(detectProvider('o1')).toBe('openai');
expect(detectProvider('o1-preview')).toBe('openai');
expect(detectProvider('o4-mini')).toBe('openai');
});
it('detects google models', () => {
expect(detectProvider('gemini-2.5-pro')).toBe('google');
});
@@ -80,3 +87,13 @@ describe('formatModelName', () => {
expect(formatModelName('my-custom-model')).toBe('My Custom Model');
});
});
describe('fetchModelsFromDaemon', () => {
it('falls back to DEFAULT_CURSOR_MODELS when daemon is unreachable', async () => {
// Use a port that nothing is listening on
const unreachablePort = 9999;
const models = await fetchModelsFromDaemon(unreachablePort);
expect(models).toEqual(DEFAULT_CURSOR_MODELS);
});
});