refactor(extension): extract Run Inspector view to media files - #44
Merged
Conversation
Move the inline CSS and body markup out of run_inspector.ts into media/inspector.css and media/inspector.html so the design lane can own look-and-feel without touching the plumbing; renderHtml keeps only the security/wiring shell (CSP, nonce, resource URIs). Pure refactor — body markup byte-identical, CSS identical modulo indent. Adds inspector_view_contract.test.ts pinning the DOM-id + message seam inspector_webview.ts depends on.
4 tasks
Member
|
Looks good, there should not be any conflicts. |
Rchari1
approved these changes
Jun 29, 2026
Address PR #44 review: - contract test: assert the computed-form ids (preview-a/b, m-*) the literal regex can't see; bind CSP checks to their directive and pin the load-bearing 'unsafe-inline' + img-src grants - run_inspector: trimEnd body so the rendered doc is byte-identical to main (no extra blank line); wrap the inspector.html read in try/catch with a fallback so a corrupt install degrades to a message, not a blank panel; comment why 'unsafe-inline' stays
This was referenced Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Creates the plumbing ⇄ look-and-feel seam the design lane needs (Kate, this week): the Run Inspector's inline
<style>+ body markup move out ofrun_inspector.tsinto design-owned resource files, so styling/layout can be iterated without touching the extension-host plumbing.media/inspector.css— all styling (the "feel")media/inspector.html— body markup (the "look")run_inspector.ts::renderHtmlnow owns only the security/wiring shell: CSP, nonce, and theasWebviewUriresource links. The message contract + buffering/state machine are untouched.inspector_view_contract.test.ts— pins the seam: every DOM idinspector_webview.tsdrives must exist in the markup, and the CSP must still authorize the linked stylesheet + nonce'd script. Reds if a look-and-feel change drops an id the plumbing depends on.chat_panel.tsis intentionally left alone — it's an iframe to opencode with a 3-line reset, not a design surface.Pure refactor — before/after equivalence
<style>indent (verified by diffinggit show main:vs the extracted files).watcher_contract,watcher_statemachine) + 3 new contract tests = 66 pass / 2 skip.media/ships in the VSIX (not.vscodeignore'd; both files added to the manifest assertion, which runs only against a locally-built VSIX — not yet a CI gate, see 1.4 — Gate VSIX contents in CI (packaging.test.ts is currently inert) #45).Test plan
main(the ~1% node can't assert)pnpm --filter amicode-v2 package→ packaging test confirmsmedia/inspector.{html,css}ship in the VSIX🤖 Generated with Claude Code