Initial commit: 小羚羚小程序 Axhub Make workspace.

Include xll-miniapp prototype, PRD resources, annotation directory sync, agent skills, and cloud publishing setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
王冕
2026-06-30 15:32:30 +08:00
commit a619938e0c
1227 changed files with 251728 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import { describe, expect, it, vi } from 'vitest';
import {
findListeningPidsOnPort,
releaseListeningProcessesOnPort,
} from './utils/portOccupancy';
describe('client port occupancy helpers', () => {
it('reads listening PIDs with lsof on macOS and Linux', () => {
const spawnSync = vi.fn(() => ({
stdout: '123\n456\n123\n',
stderr: '',
status: 0,
})) as any;
expect(findListeningPidsOnPort(51720, {
platform: 'darwin',
spawnSync,
})).toEqual([123, 456]);
expect(spawnSync).toHaveBeenCalledWith('lsof', [
'-tiTCP',
':51720',
'-sTCP:LISTEN',
], expect.objectContaining({ encoding: 'utf8' }));
});
it('terminates other listening processes while ignoring the current process', () => {
const spawnSync = vi.fn(() => ({
stdout: '111\n222\n',
stderr: '',
status: 0,
})) as any;
const killPid = vi.fn();
expect(releaseListeningProcessesOnPort(51720, {
platform: 'linux',
spawnSync,
killPid,
currentPid: 111,
waitMs: 0,
})).toEqual([222]);
expect(killPid).toHaveBeenCalledWith(222, 'SIGTERM');
});
});