feat(f6): wire DiffViewController into activation (SLICE-3)
F6 §6.2. BaselineStore from context.storageUri (in-memory fallback), advance subscribed to the seam's onDidApplyAgentEdit, ensureBaseline on first sight in renderIfOpen, diffViewController on the CowritingApi, commands stubbed in the no-folder path (#8 precedent). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -6,6 +6,8 @@ import { AttributionController } from "./attributionController";
|
|||||||
import { ProposalController } from "./proposalController";
|
import { ProposalController } from "./proposalController";
|
||||||
import { buildFingerprint } from "./anchorer";
|
import { buildFingerprint } from "./anchorer";
|
||||||
import { VersionGuard } from "./versionGuard";
|
import { VersionGuard } from "./versionGuard";
|
||||||
|
import { BaselineStore } from "./baselineStore";
|
||||||
|
import { DiffViewController } from "./diffViewController";
|
||||||
|
|
||||||
const CHANNEL_NAME = "Cowriting (Cline SDK)";
|
const CHANNEL_NAME = "Cowriting (Cline SDK)";
|
||||||
|
|
||||||
@@ -14,6 +16,7 @@ export interface CowritingApi {
|
|||||||
attributionController: AttributionController;
|
attributionController: AttributionController;
|
||||||
proposalController: ProposalController;
|
proposalController: ProposalController;
|
||||||
versionGuard: VersionGuard;
|
versionGuard: VersionGuard;
|
||||||
|
diffViewController: DiffViewController;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext): CowritingApi | undefined {
|
export function activate(context: vscode.ExtensionContext): CowritingApi | undefined {
|
||||||
@@ -63,6 +66,8 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
|||||||
"cowriting.acceptProposal",
|
"cowriting.acceptProposal",
|
||||||
"cowriting.rejectProposal",
|
"cowriting.rejectProposal",
|
||||||
"cowriting.proposeAgentEdit",
|
"cowriting.proposeAgentEdit",
|
||||||
|
"cowriting.toggleDiffView",
|
||||||
|
"cowriting.pinDiffBaseline",
|
||||||
]) {
|
]) {
|
||||||
context.subscriptions.push(vscode.commands.registerCommand(command, stub));
|
context.subscriptions.push(vscode.commands.registerCommand(command, stub));
|
||||||
}
|
}
|
||||||
@@ -83,6 +88,18 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
|||||||
const proposalController = new ProposalController(store, attributionController, root, versionGuard);
|
const proposalController = new ProposalController(store, attributionController, root, versionGuard);
|
||||||
context.subscriptions.push(proposalController);
|
context.subscriptions.push(proposalController);
|
||||||
|
|
||||||
|
// --- F6: diff-view toggle (Feature #17) ---
|
||||||
|
// Baseline lives in VS Code workspace storage, never the repo (INV-19).
|
||||||
|
// storageUri can be undefined in odd host states → in-memory fallback (§6.5).
|
||||||
|
const storageDir = context.storageUri?.fsPath;
|
||||||
|
const baselineStore = storageDir ? new BaselineStore(storageDir) : null;
|
||||||
|
const diffViewController = new DiffViewController(baselineStore, root);
|
||||||
|
context.subscriptions.push(diffViewController);
|
||||||
|
// The seam's single machine-landing signal advances the baseline (INV-18).
|
||||||
|
context.subscriptions.push(
|
||||||
|
attributionController.onDidApplyAgentEdit((e) => diffViewController.advance(e.document)),
|
||||||
|
);
|
||||||
|
|
||||||
// One SHARED sidecar watcher for both controllers; self-writes are
|
// One SHARED sidecar watcher for both controllers; self-writes are
|
||||||
// suppressed centrally in the store (the sidecar is co-owned).
|
// suppressed centrally in the store (the sidecar is co-owned).
|
||||||
const watcher = vscode.workspace.createFileSystemWatcher("**/.threads/**/*.json");
|
const watcher = vscode.workspace.createFileSystemWatcher("**/.threads/**/*.json");
|
||||||
@@ -228,12 +245,13 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
|||||||
threadController.renderAll(doc);
|
threadController.renderAll(doc);
|
||||||
attributionController.loadAll(doc);
|
attributionController.loadAll(doc);
|
||||||
proposalController.renderAll(doc);
|
proposalController.renderAll(doc);
|
||||||
|
diffViewController.ensureBaseline(doc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
vscode.workspace.textDocuments.forEach(renderIfOpen);
|
vscode.workspace.textDocuments.forEach(renderIfOpen);
|
||||||
context.subscriptions.push(vscode.workspace.onDidOpenTextDocument(renderIfOpen));
|
context.subscriptions.push(vscode.workspace.onDidOpenTextDocument(renderIfOpen));
|
||||||
|
|
||||||
return { threadController, attributionController, proposalController, versionGuard };
|
return { threadController, attributionController, proposalController, versionGuard, diffViewController };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deactivate(): void {
|
export function deactivate(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user