Skip to content

omaclaren/pi-studio-opencode

Repository files navigation

pi-studio-opencode

OpenCode plug-in adaptation of the pi extension pi-studio.

It provides a local browser-based Studio workspace for OpenCode, with an editor on the left and response/preview on the right.

If you use pi itself, use the original pi-studio. This repo is for OpenCode.

Status

Usable and actively improving.

The main goal is a good OpenCode version of Studio rather than full feature parity with pi-studio.

Features

  • Launch Studio from an active OpenCode session with /studio
  • Attach Studio to the same session you are already using
  • Two-pane editor + response/preview workspace
  • Run, queue steering, stop, and browse response history
  • Raw response, rendered response preview, and editor preview
  • Load and save local files
  • Markdown / QMD / LaTeX preview with practical support for:
    • math fallback
    • Quarto-style callouts
    • preview page-break markers
    • local PDF figure preview via pdf.js
  • PDF export of the right-pane preview via pandoc + xelatex
  • Theme-aware Studio UI based on the active OpenCode theme
  • Footer/status info, pane focus controls, and response highlighting inspired by pi-studio

Install

Recommended installation:

bunx pi-studio-opencode@latest install

That updates your OpenCode config to add:

  • the pi-studio-opencode@latest plugin entry
  • the /studio command entry

For a project-local install instead of a user-wide one:

bunx pi-studio-opencode@latest install --project

Then restart OpenCode and run:

/studio

Manual config

If you prefer to edit config yourself, add this to either:

  • .opencode/opencode.jsonc
  • ~/.config/opencode/opencode.json
  • ~/.config/opencode/opencode.jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["pi-studio-opencode@latest"],
  "command": {
    "studio": {
      "template": "Open π Studio for this active opencode session.",
      "description": "Open π Studio attached to the current opencode session"
    }
  }
}

Notes

  • /studio opens a browser-based Studio linked to the current OpenCode session.
  • If /studio gets sent to the model as ordinary text, the plug-in probably did not load. Rebuild or reinstall the package, then fully restart OpenCode.
  • If you use --no-open, open the full tokenized URL shown by Studio, not just the bare port root.
  • --base-url, --session, and --directory are taken from the active OpenCode session during /studio.
  • The Studio UI is external to OpenCode; it is not an embedded pane.
  • Preview and PDF quality depend on local tooling:
    • pandoc for preview/PDF workflows
    • xelatex for PDF export

Standalone launcher

You can also launch the browser surface directly:

pi-studio-opencode --directory "/path/to/project"

or:

npx pi-studio-opencode --directory "/path/to/project"

To attach manually to an existing OpenCode server/session:

pi-studio-opencode --base-url "http://127.0.0.1:4096" --session "<session-id>" --directory "/path/to/project"

About

OpenCode plug-in adaptation of pi-studio with a browser-based two-pane Studio workspace

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors