mirror of
https://github.com/cline/cline.git
synced 2026-09-21 05:10:09 +08:00
* Move the apps to the root dir * Update all references from sdk/apps/ to apps/ * Update dependencies * Install bun types * Fix types * Fix types * Fix linter * Ingore apps from vscode * Fix security warning * Fix windows install * Enable windows dev mode * Revert "Enable windows dev mode" This reverts commita46c99282e. * Revert "Ingore apps from vscode" This reverts commit47f7b265d2. * Revert "Fix windows install" This reverts commit1dabba1556. * update the repo root * fix root dir * fix path * fix other path * Fix unrelated changes * fix: address apps move follow-up blockers (#11228) * fix: update root app command paths * fix: include moved apps in root checks * fix: clean up moved app path references --------- Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
import { getConnector, listConnectors } from "../connectors/registry";
|
|
import type { ConnectIo, ConnectStopResult } from "../connectors/types";
|
|
|
|
export async function stopAllConnectors(
|
|
io: ConnectIo,
|
|
): Promise<ConnectStopResult & { executed: number }> {
|
|
let stoppedProcesses = 0;
|
|
let stoppedSessions = 0;
|
|
let executed = 0;
|
|
for (const entry of listConnectors()) {
|
|
const connector = await getConnector(entry.name);
|
|
if (!connector) {
|
|
continue;
|
|
}
|
|
if (!connector.stopAll) {
|
|
continue;
|
|
}
|
|
executed += 1;
|
|
const result = await connector.stopAll(io);
|
|
stoppedProcesses += result.stoppedProcesses;
|
|
stoppedSessions += result.stoppedSessions;
|
|
}
|
|
return { stoppedProcesses, stoppedSessions, executed };
|
|
}
|
|
|
|
export async function runStopAllConnectors(io: ConnectIo): Promise<number> {
|
|
const { stoppedProcesses, stoppedSessions, executed } =
|
|
await stopAllConnectors(io);
|
|
if (executed === 0) {
|
|
io.writeln("[connect] no adapters support stop yet");
|
|
return 0;
|
|
}
|
|
io.writeln(
|
|
`[connect] stopped processes=${stoppedProcesses} sessions=${stoppedSessions}`,
|
|
);
|
|
return 0;
|
|
}
|
|
|
|
export async function runStopConnector(
|
|
adapterName: string,
|
|
io: ConnectIo,
|
|
): Promise<number> {
|
|
const connector = await getConnector(adapterName);
|
|
if (!connector) {
|
|
io.writeErr(`unknown connect adapter "${adapterName}"`);
|
|
return 1;
|
|
}
|
|
if (!connector.stopAll) {
|
|
io.writeErr(`connect adapter "${adapterName}" does not support stop`);
|
|
return 1;
|
|
}
|
|
const result: ConnectStopResult = await connector.stopAll(io);
|
|
io.writeln(
|
|
`[connect] ${connector.name} stopped processes=${result.stoppedProcesses} sessions=${result.stoppedSessions}`,
|
|
);
|
|
return 0;
|
|
}
|
|
|
|
export async function runConnectAdapter(
|
|
adapterName: string,
|
|
passthroughArgs: string[],
|
|
io: ConnectIo,
|
|
): Promise<number> {
|
|
const connector = await getConnector(adapterName);
|
|
if (!connector) {
|
|
io.writeErr(`unknown connect adapter "${adapterName}"`);
|
|
return 1;
|
|
}
|
|
return connector.run(passthroughArgs, io);
|
|
}
|
|
|
|
export function formatAdapterList(): string {
|
|
const lines: string[] = [];
|
|
for (const connector of listConnectors()) {
|
|
lines.push(` ${connector.name.padEnd(12)} ${connector.description}`);
|
|
}
|
|
return lines.join("\n");
|
|
}
|