fix(cursor): harden stopDaemon PID validation, tighten regex, add lifecycle test

- Validate PID belongs to cursor daemon via /proc before signaling
- Tighten detectProvider regex to avoid over-matching o-prefixed models
- Add integration test for daemon start→health→stop lifecycle
- Add void cast on discarded handleHelp() return value
- Update model catalog date comment
This commit is contained in:
Tam Nhu Tran committed 2026-02-12 08:28:32 +07:00
1 parent 934238740e
commit 760a5c3ca4
4 files changed
+38 -3

No files matched your search

+23
View File
@@ -137,6 +137,29 @@ describe('startDaemon', () => {
expect(result.success).toBe(false);
expect(result.error).toContain('Invalid port');
});
it(
'starts and stops daemon successfully',
async () => {
const port = 18765;
const result = await startDaemon({ port, model: 'test' });
expect(result.success).toBe(true);
expect(result.pid).toBeDefined();
// Verify health
const running = await isDaemonRunning(port);
expect(running).toBe(true);
// Stop
const stopResult = await stopDaemon();
expect(stopResult.success).toBe(true);
// Verify stopped
const stillRunning = await isDaemonRunning(port);
expect(stillRunning).toBe(false);
},
35000
);
});
describe('isDaemonRunning', () => {