POC: extension entry + esbuild bundle (Feature #2)

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>
This commit is contained in:
Ben Stull
2026-06-09 23:55:39 -07:00
parent 33bff2b130
commit 80083c1230
2 changed files with 67 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
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.
}