80083c1230
activate() registers showClineSdkInfo, which renders the SDK summary to a notification and output channel. esbuild bundles to CJS, keeping vscode and @cline/sdk external (the ESM SDK loads via runtime dynamic import). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import * as vscode from "vscode";
|
|
import { fetchSdkSummary } from "./cline";
|
|
|
|
const CHANNEL_NAME = "Cowriting (Cline SDK)";
|
|
|
|
export function activate(context: vscode.ExtensionContext): void {
|
|
const output = vscode.window.createOutputChannel(CHANNEL_NAME);
|
|
context.subscriptions.push(output);
|
|
|
|
const command = vscode.commands.registerCommand(
|
|
"cowriting.showClineSdkInfo",
|
|
async () => {
|
|
try {
|
|
const summary = await fetchSdkSummary();
|
|
output.clear();
|
|
output.appendLine(`@cline/sdk version: ${summary.version}`);
|
|
output.appendLine(`Builtin tools (${summary.tools.length}):`);
|
|
for (const tool of summary.tools) {
|
|
output.appendLine(` • ${tool.id} — ${tool.description}`);
|
|
}
|
|
output.show(true);
|
|
await vscode.window.showInformationMessage(
|
|
`Cline SDK ${summary.version} loaded — ${summary.tools.length} builtin tools. See the "${CHANNEL_NAME}" output channel.`
|
|
);
|
|
} catch (err) {
|
|
const message = err instanceof Error ? err.message : String(err);
|
|
output.appendLine(`Failed to drive @cline/sdk: ${message}`);
|
|
output.show(true);
|
|
await vscode.window.showErrorMessage(
|
|
`Cowriting: failed to load @cline/sdk — ${message}`
|
|
);
|
|
}
|
|
}
|
|
);
|
|
context.subscriptions.push(command);
|
|
}
|
|
|
|
export function deactivate(): void {
|
|
// Nothing to clean up beyond the disposables registered on the context.
|
|
}
|