mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
9b425c7550
* docs: add dingtalk and wecom CLI to external CLI hub Add dingtalk-workspace-cli and wecom-cli as external CLI integrations alongside lark-cli, gh, docker, etc. * feat: add confirmPrompt() to TUI module * feat: add Electron app registry with builtin + user-defined apps * feat: add Electron app launcher with auto-detect and restart * fix: launcher uses processName for path discovery, platform-guard tests * feat: integrate Electron auto-launcher into execution pipeline - CDPBridge.connect() accepts cdpEndpoint parameter instead of requiring env var - getBrowserFactory() selects CDPBridge for registered Electron apps by site name - executeCommand() calls resolveElectronEndpoint() for Electron apps, skips daemon check - Remove requiredEnv/OPENCLI_CDP_ENDPOINT from all chatwise commands - Remove chatwise-opencli.ps1 wrapper script and chatwise/shared.ts - Update antigravity/serve.ts to use launcher instead of manual env var - Replace hardcoded app names in scoreCDPTarget with registry lookup - Fix Discord bundleId typo (com.iscord.app → com.discord.app) * fix: resolve review issues — port collision and registry completeness - Change ChatGPT CDP port from 9224 to 9236 (was colliding with Antigravity) - scoreCDPTarget now uses full registry (builtin + user-defined) via getAllElectronApps() - Use displayName (falling back to processName) for target score boosting * fix: assign unique CDP ports — antigravity 9234, chatgpt 9236 Both were sharing port 9224, which could cause silent mis-connection.
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { getElectronApp, isElectronApp, loadApps } from './electron-apps.js';
|
|
|
|
describe('electron-apps registry', () => {
|
|
it('returns builtin app entry for cursor', () => {
|
|
const app = getElectronApp('cursor');
|
|
expect(app).toBeDefined();
|
|
expect(app!.port).toBe(9226);
|
|
expect(app!.processName).toBe('Cursor');
|
|
});
|
|
|
|
it('returns builtin app entry for codex', () => {
|
|
const app = getElectronApp('codex');
|
|
expect(app).toBeDefined();
|
|
expect(app!.port).toBe(9222);
|
|
});
|
|
|
|
it('returns undefined for non-Electron sites', () => {
|
|
expect(getElectronApp('bilibili')).toBeUndefined();
|
|
expect(getElectronApp('hackernews')).toBeUndefined();
|
|
});
|
|
|
|
it('isElectronApp returns true for registered apps', () => {
|
|
expect(isElectronApp('cursor')).toBe(true);
|
|
expect(isElectronApp('codex')).toBe(true);
|
|
expect(isElectronApp('chatwise')).toBe(true);
|
|
});
|
|
|
|
it('isElectronApp returns false for non-Electron sites', () => {
|
|
expect(isElectronApp('bilibili')).toBe(false);
|
|
expect(isElectronApp('unknown-app')).toBe(false);
|
|
});
|
|
|
|
it('loadApps merges user config additively', () => {
|
|
const apps = loadApps({
|
|
myapp: { port: 9234, processName: 'MyApp' },
|
|
});
|
|
expect(apps.myapp).toBeDefined();
|
|
expect(apps.myapp.port).toBe(9234);
|
|
// Builtins still present
|
|
expect(apps.cursor).toBeDefined();
|
|
});
|
|
|
|
it('loadApps does not override builtin entries', () => {
|
|
const apps = loadApps({
|
|
cursor: { port: 9999, processName: 'FakeCursor' },
|
|
});
|
|
expect(apps.cursor.port).toBe(9226); // Builtin wins
|
|
});
|
|
});
|