Skip to content

feat(vscode): run loopfinder and show its viewer inside VS Code - #1

Merged
MotimotiNotch merged 1 commit into
mainfrom
feat/vscode-extension
Oct 7, 2026
Merged

MotimotiNotch merged 1 commit into
mainfrom
feat/vscode-extension

Conversation

@MotimotiNotch

Copy link
Copy Markdown
Owner

What

A VS Code extension in vscode/: the same CLI and the same viewer, inside the editor.

  • Commands: set up the workspace, build the graph, show the loops, copy the request for the AI agent.

  • No Node install needed: the CLI runs as a child process on the editor's own Node (ELECTRON_RUN_AS_NODE); traced scripts inherit it.

  • Workspace Trust: set up and build are off in an untrusted workspace, since building runs the workspace's scripts. The command bodies check it too (enablement only greys out menus). Showing a graph that is already built works anywhere.

  • Viewer: public/ as is, in a webview with a nonce CSP. app.js gains an optional window.loopfinderHost (vscode/media/host.js):

    • the graph arrives by message instead of fetch('flow.json')
    • a rebuilt graph replaces it, keeping the flow on screen and a picked loop with the same name
    • paths in the side pane open the file in the editor
    • auto theme follows the editor's theme

    In a browser, nothing changes.

  • Packaging: npm run package in vscode/ copies the CLI and the licenses into vscode/core/ and runs vsce package. The copies and the .vsix are ignored.

Checked

  • npm test: 26 pass
  • Demo build under VS Code's bundled Node (24)
  • Webview HTML opened in a browser with the same CSP and a stubbed acquireVsCodeApi: graph handoff, no CSP violations, theme follows the body class, rebuild keeps the picked loop, path click posts open
  • vsce package: 93 KB
  • Installed in VS Code: show, build, open a file from a path, theme follow

Not yet checked: build being off in Restricted Mode. Not published to the Marketplace / Open VSX yet.

🤖 Generated with Claude Code

https://claude.ai/code/session_015bPmcKMG3u2dhXdAKAM4sK

- vscode/: commands to set up, build, show the loops and copy the request
  for the AI agent. The CLI runs as a child process on the editor's own
  Node (ELECTRON_RUN_AS_NODE), so no Node install is needed.
- Init and build are off in an untrusted workspace (building runs the
  workspace's scripts); showing a built graph works anywhere.
- The viewer is public/ as is, served into a webview under a nonce CSP.
  app.js gains an optional window.loopfinderHost: the graph arrives by
  message, a rebuilt graph replaces it (keeping the flow and a loop of the
  same name), paths open in the editor, and auto theme follows the editor.
  In a browser nothing changes.
- scripts/prepare.js copies the CLI and licenses into vscode/core/ for
  `vsce package`; the copies and .vsix are ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015bPmcKMG3u2dhXdAKAM4sK
@MotimotiNotch
MotimotiNotch merged commit a10a5bf into main Oct 7, 2026
4 checks passed
@MotimotiNotch
MotimotiNotch deleted the feat/vscode-extension branch October 7, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant