diff --git a/README.md b/README.md index 7617cea..159c4a8 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A concise VS Code extension to build high‑quality XML prompts from selected workspace files and apply LLM‑suggested changes back to your code.

- Overwrite extension interface showing the Context tab with file explorer, selected files, token counts, and copy buttons + Overwrite extension interface showing the Context tab with file explorer, selected files, token counts, and copy buttons

## Features @@ -26,7 +26,7 @@ A concise VS Code extension to build high‑quality XML prompts from selected wo - Privacy-preserving telemetry controls.

- Overwrite extension interface showing the Context tab with file explorer, selected files, token counts, and copy buttons + Overwrite extension interface showing the Context tab with file explorer, selected files, token counts, and copy buttons

## How to use @@ -49,3 +49,7 @@ For complete details, see [TELEMETRY.md](TELEMETRY.md). ## Requirements - VS Code 1.85.0+ + +## Acknowledgments + +This project is heavily inspired by [RepoPrompt](https://repoprompt.com/) by @provencher. diff --git a/resources/screenshot-1.jpg b/resources/screenshot-1.jpg index 600ee8c..4fba50d 100644 Binary files a/resources/screenshot-1.jpg and b/resources/screenshot-1.jpg differ diff --git a/resources/screenshot-4.jpg b/resources/screenshot-4.jpg new file mode 100644 index 0000000..fba1f0b Binary files /dev/null and b/resources/screenshot-4.jpg differ diff --git a/src/providers/file-explorer/html-generator.ts b/src/providers/file-explorer/html-generator.ts index ff3719a..6f70639 100644 --- a/src/providers/file-explorer/html-generator.ts +++ b/src/providers/file-explorer/html-generator.ts @@ -1,10 +1,7 @@ -import * as fs from 'node:fs' -import * as path from 'node:path' import * as vscode from 'vscode' import { getNonce } from '../../utils/webview' const DEV_WEBVIEW_URL = 'http://localhost:5173' -const DEV_TIMEOUT = 3000 // 3 seconds timeout for dev server connection /** * Generates the HTML content for the webview, choosing between dev and prod. @@ -26,14 +23,6 @@ export function getHtmlForWebview( function getDevHtml(webview: vscode.Webview, extensionUri: vscode.Uri): string { const nonce = getNonce() - // Check if we have built webview assets for fallback - const webviewAssetsDir = vscode.Uri.joinPath( - extensionUri, - 'dist', - 'webview-ui', - ) - const hasBuiltAssets = checkIfAssetsExist(webviewAssetsDir) - // Path to codicons from the extension's node_modules const codiconUri = webview.asWebviewUri( vscode.Uri.joinPath( @@ -46,116 +35,10 @@ function getDevHtml(webview: vscode.Webview, extensionUri: vscode.Uri): string { ), ) - if (hasBuiltAssets) { - // Use built assets with development features - return getDevHtmlWithBuiltAssets(webview, extensionUri, nonce, codiconUri) - } - - // Use dev server (original behavior) + // Use dev server (original behavior) - prefer dev server for development return getDevHtmlWithServer(webview, extensionUri, nonce, codiconUri) } -/** - * Check if built webview assets exist and are valid. - */ -function checkIfAssetsExist(assetsDir: vscode.Uri): boolean { - try { - const assetsPath = assetsDir.fsPath - - // Check if directory exists - if (!fs.existsSync(assetsPath)) { - return false - } - - // Check for required files - const requiredFiles = [ - path.join(assetsPath, 'assets', 'index.js'), - path.join(assetsPath, 'assets', 'index.css'), - path.join(assetsPath, 'assets', 'codicon.css'), - ] - - return requiredFiles.every((file) => fs.existsSync(file)) - } catch { - return false - } -} - -/** - * Development HTML using built assets with hot reload capabilities. - */ -function getDevHtmlWithBuiltAssets( - webview: vscode.Webview, - extensionUri: vscode.Uri, - nonce: string, - codiconUri: vscode.Uri, -): string { - const cspSource = webview.cspSource - - // Paths to built assets - const scriptUri = webview.asWebviewUri( - vscode.Uri.joinPath( - extensionUri, - 'dist', - 'webview-ui', - 'assets', - 'index.js', - ), - ) - const styleUri = webview.asWebviewUri( - vscode.Uri.joinPath( - extensionUri, - 'dist', - 'webview-ui', - 'assets', - 'index.css', - ), - ) - - // CSP for development with built assets - const csp = [ - `default-src 'none'`, - `font-src ${cspSource} data:`, - `connect-src ws://localhost:5173 ${cspSource}`, // Allow WebSocket for HMR - `img-src ${cspSource} https: data:`, - `script-src 'nonce-${nonce}' 'unsafe-eval' 'unsafe-inline'`, // Allow eval for HMR - `style-src ${cspSource} 'unsafe-inline'`, - ].join('; ') - - return ` - - - - - - - - Overwrite (Dev) - - -
- - - -` -} - /** * Development HTML using Vite dev server (original behavior). */ diff --git a/src/webview-ui/src/components/context-tab/user-instructions.tsx b/src/webview-ui/src/components/context-tab/user-instructions.tsx index 7e38fda..25dcff8 100644 --- a/src/webview-ui/src/components/context-tab/user-instructions.tsx +++ b/src/webview-ui/src/components/context-tab/user-instructions.tsx @@ -9,9 +9,20 @@ const UserInstructions: React.FC = ({ }) => { return (
- - User Instruction - +
+ + User Instruction + + + Docs + +