Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit 20e142a

Browse files
committed
Create walkthrough webview panel in activity bar
- Add walkthrough view to dialectic activity bar container in package.json - Create WalkthroughWebviewProvider with basic webview setup - Register webview provider in extension activation - Update DaemonClient to pass walkthrough messages to webview - Add placeholder HTML with walkthrough data display Completes Commit 2 of Phase 2 for issue #23 walkthrough system. Next: Implement walkthrough content rendering.
1 parent cc29e37 commit 20e142a

File tree

3 files changed

+79
-4
lines changed

3 files changed

+79
-4
lines changed

extension/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@
7373
{
7474
"id": "dialectic.syntheticPR",
7575
"name": "Code Review"
76+
},
77+
{
78+
"id": "dialectic.walkthrough",
79+
"name": "Walkthrough",
80+
"type": "webview"
7681
}
7782
]
7883
},

extension/src/extension.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as fs from 'fs';
55
import * as crypto from 'crypto';
66
import { ReviewWebviewProvider } from './reviewWebview';
77
import { SyntheticPRProvider } from './syntheticPRProvider';
8+
import { WalkthroughWebviewProvider } from './walkthroughWebview';
89

910
// TEST TEST TEST
1011

@@ -192,7 +193,8 @@ class DaemonClient implements vscode.Disposable {
192193
private context: vscode.ExtensionContext,
193194
private reviewProvider: ReviewWebviewProvider,
194195
private outputChannel: vscode.OutputChannel,
195-
private syntheticPRProvider: SyntheticPRProvider
196+
private syntheticPRProvider: SyntheticPRProvider,
197+
private walkthroughProvider: WalkthroughWebviewProvider
196198
) { }
197199

198200
start(): void {
@@ -293,11 +295,11 @@ class DaemonClient implements vscode.Disposable {
293295
try {
294296
const walkthroughPayload = message.payload as PresentWalkthroughPayload;
295297

296-
// For now, just log the received walkthrough data
297298
this.outputChannel.appendLine(`Received walkthrough with base_uri: ${walkthroughPayload.base_uri}`);
298299
this.outputChannel.appendLine(`Walkthrough sections: ${Object.keys(walkthroughPayload).filter(k => k !== 'base_uri' && walkthroughPayload[k as keyof PresentWalkthroughPayload]).join(', ')}`);
299300

300-
// TODO: Implement walkthrough webview rendering
301+
// Show walkthrough in webview
302+
this.walkthroughProvider.showWalkthrough(walkthroughPayload);
301303

302304
// Send success response back through daemon
303305
this.sendResponse(message.id, { success: true });
@@ -849,10 +851,16 @@ export function activate(context: vscode.ExtensionContext) {
849851
// Create synthetic PR provider for AI-generated pull requests
850852
const syntheticPRProvider = new SyntheticPRProvider(context);
851853

854+
// Create walkthrough webview provider
855+
const walkthroughProvider = new WalkthroughWebviewProvider(context.extensionUri);
856+
context.subscriptions.push(
857+
vscode.window.registerWebviewViewProvider(WalkthroughWebviewProvider.viewType, walkthroughProvider)
858+
);
859+
852860
console.log('Webview provider created successfully');
853861

854862
// 💡: Set up daemon client connection for message bus communication
855-
const daemonClient = new DaemonClient(context, reviewProvider, outputChannel, syntheticPRProvider);
863+
const daemonClient = new DaemonClient(context, reviewProvider, outputChannel, syntheticPRProvider, walkthroughProvider);
856864
daemonClient.start();
857865

858866
// Set up comment callback to send comments as feedback
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import * as vscode from 'vscode';
2+
3+
export class WalkthroughWebviewProvider implements vscode.WebviewViewProvider {
4+
public static readonly viewType = 'dialectic.walkthrough';
5+
6+
private _view?: vscode.WebviewView;
7+
8+
constructor(private readonly _extensionUri: vscode.Uri) {}
9+
10+
public resolveWebviewView(
11+
webviewView: vscode.WebviewView,
12+
context: vscode.WebviewViewResolveContext,
13+
_token: vscode.CancellationToken,
14+
) {
15+
this._view = webviewView;
16+
17+
webviewView.webview.options = {
18+
enableScripts: true,
19+
localResourceRoots: [this._extensionUri]
20+
};
21+
22+
webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);
23+
}
24+
25+
public showWalkthrough(walkthrough: any) {
26+
if (this._view) {
27+
this._view.show?.(true);
28+
this._view.webview.postMessage({
29+
type: 'walkthrough',
30+
data: walkthrough
31+
});
32+
}
33+
}
34+
35+
private _getHtmlForWebview(webview: vscode.Webview) {
36+
return `<!DOCTYPE html>
37+
<html lang="en">
38+
<head>
39+
<meta charset="UTF-8">
40+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
41+
<title>Walkthrough</title>
42+
</head>
43+
<body>
44+
<div id="content">
45+
<p>Walkthrough received - rendering coming soon!</p>
46+
</div>
47+
<script>
48+
const vscode = acquireVsCodeApi();
49+
window.addEventListener('message', event => {
50+
const message = event.data;
51+
if (message.type === 'walkthrough') {
52+
document.getElementById('content').innerHTML =
53+
'<h3>Walkthrough Received</h3><pre>' +
54+
JSON.stringify(message.data, null, 2) +
55+
'</pre>';
56+
}
57+
});
58+
</script>
59+
</body>
60+
</html>`;
61+
}
62+
}

0 commit comments

Comments
 (0)