Skip to content

Try out the Stagewise Toolbar during Extension Development #1276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ export class ClineProvider
`style-src ${webview.cspSource} 'unsafe-inline' https://* http://${localServerUrl} http://0.0.0.0:${localPort}`,
`img-src ${webview.cspSource} https://storage.googleapis.com https://img.clerk.com data: https://*.googleusercontent.com https://*.googleapis.com`, // kilocode_change: add https://*.googleusercontent.com and https://*.googleapis.com
`media-src ${webview.cspSource}`,
`script-src 'unsafe-eval' ${webview.cspSource} https://* https://*.posthog.com http://${localServerUrl} http://0.0.0.0:${localPort} 'nonce-${nonce}'`,
`connect-src https://* https://*.posthog.com ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}`,
`script-src 'unsafe-eval' ${webview.cspSource} https://* https://*.posthog.com http://${localServerUrl} http://0.0.0.0:${localPort} http://localhost:5746/ping/stagewise http://localhost:5747/ping/stagewise ws://localhost:5746 ws://localhost:5747 'nonce-${nonce}'`,
`connect-src https://* https://*.posthog.com ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort} ws://localhost:* http://localhost:5746/ping/stagewise http://localhost:5747/ping/stagewise ws://localhost:5746 ws://localhost:5747`,
]

return /*html*/ `
Expand Down
2 changes: 2 additions & 0 deletions webview-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.8",
"@roo-code/types": "workspace:^",
"@stagewise/toolbar-react": "^0.4.9",
"@tailwindcss/vite": "^4.0.0",
"@tanstack/react-query": "^5.68.0",
"@types/seedrandom": "^3.0.8",
Expand Down Expand Up @@ -85,6 +86,7 @@
"devDependencies": {
"@roo-code/config-eslint": "workspace:^",
"@roo-code/config-typescript": "workspace:^",
"@stagewise/toolbar": "^0.4.9",
"@storybook/addon-essentials": "^8.4.7",
"@storybook/addon-interactions": "^8.4.7",
"@storybook/react": "^8.4.7",
Expand Down
26 changes: 26 additions & 0 deletions webview-ui/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import { StagewiseToolbar } from "@stagewise/toolbar-react"

import "./index.css"
import App from "./App"
Expand All @@ -11,8 +12,33 @@ import { getHighlighter } from "./utils/highlighter"
// Initialize Shiki early to hide initialization latency (async)
getHighlighter().catch((error: Error) => console.error("Failed to initialize Shiki highlighter:", error))

// Render the main app
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless vibe comment

createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the usual 'please wrap in // kilocode_change comments' but otherwise looks good!

if (process.env.NODE_ENV === "development") {
const toolbarConfig = {
plugins: [],
}

document.addEventListener("DOMContentLoaded", () => {
if (document.getElementById("stagewise-toolbar-root")) {
console.log("Stagewise toolbar already initialized, skipping...")
return
}

const toolbarRoot = document.createElement("div")
toolbarRoot.id = "stagewise-toolbar-root" // Ensure a unique ID
document.body.appendChild(toolbarRoot)

createRoot(toolbarRoot).render(
<StrictMode>
<StagewiseToolbar config={toolbarConfig} />
</StrictMode>,
)
console.log("🚀 Stagewise toolbar initialized successfully")
})
}