Skip to content

MartinMinkov/pi-workbench

 
 

Repository files navigation

pi-workbench

Native review workspaces for pi, powered by Glimpse, Monaco, and a TypeScript web UI.

This repository started as a fork of badlogic/pi-diff-review. The fork has since grown into pi-workbench, a home for native Pi workspaces that help review structured context, add feedback, navigate relevant code, run side conversations, and send final instructions back into pi.

pi-workbench owns these workflows directly. For example, /btw is now a feature in this repository rather than a wrapper around the standalone pi-btw package.

pi install git:https://github.com/MartinMinkov/pi-workbench

What it adds

pi-workbench currently registers three native workspaces:

  • /diff-review opens a native review window for the current git repository. From there you can review a working tree diff, the last commit, or the full repository snapshot without loading every file up front.
  • /response-review opens a native response review workspace for the current Pi session.
  • /btw opens a native side-conversation workspace backed by a real Pi sub-session.

Latest diff-review features include:

  • Native Glimpse review window with a Monaco diff editor.
  • Review scopes for git diff, last commit, and all files.
  • Lazy file loading and cached file contents per scope.
  • Status-aware sidebar for modified, added, deleted, renamed, and untracked files.
  • Sidebar filters for status, reviewed files, commented files, and changed files.
  • Repository-wide code search from the sidebar, with inline match previews.
  • Collapsible file tree and collapsible sidebar.
  • Inline comments on the original side, modified side, or whole file.
  • Structured comment kinds: feedback, question, risk, explain, and tests.
  • Editable submitted comments before finishing the review.
  • A review queue that tracks submitted comments and lets you jump back to them.
  • Overall review notes that are prepended to the generated pi prompt.
  • Mark-reviewed state for files, with an option to hide reviewed files.
  • Line wrapping and changed-region display toggles for the editor.
  • Per-file scroll restoration while moving between files and scopes.
  • Waiting UI in pi while the native review window is open.
  • Safer submit, cancel, and teardown handling for review windows.

Navigation

The review workspace also includes code-navigation tools:

  • Back and forward navigation history inside the review window.
  • Clickable navigation links for supported symbols, imports, and module paths.
  • Changed-symbol outline for the active file.
  • Current-symbol display in the editor header.
  • Quick-open files with Cmd/Ctrl+P.
  • Command palette with Cmd/Ctrl+Shift+P.
  • Keyboard shortcuts for focusing code search, marking files reviewed, and moving between submitted comments.

Semantic definition lookup is available for:

  • Rust, via rust-analyzer when it is installed.
  • Go, via gopls when it is installed.
  • TypeScript and JavaScript, via the bundled TypeScript language service.

For other languages, the UI falls back to repository-local import and module path navigation where possible.

Review workflows

Diff review

  1. Run /diff-review in pi while inside a git repository.
  2. Pick a scope: git diff, last commit, or all files.
  3. Search, filter, and navigate files from the sidebar.
  4. Add inline comments, file comments, or an overall review note.
  5. Edit or delete submitted comments from the review queue if needed.
  6. Finish the review to insert a structured feedback prompt into pi.

The generated prompt preserves comment kind, scope, file path, line range, and old/new side context so pi can apply the feedback with useful location metadata.

Response review

  1. Run /response-review in pi after one or more assistant responses.
  2. Pick an assistant response from the sidebar.
  3. Navigate headings/code blocks from the outline.
  4. Select text and press C or use the comment button to add anchored feedback.
  5. Add optional overall feedback and a draft/next prompt.
  6. Finish the review to insert a structured follow-up prompt into pi.

BTW side conversation

BTW is a native workspace for side conversations that should not derail the main Pi thread. It opens a real Pi sub-session with coding-tool access, keeps the side-thread transcript in the workspace, and can hand the result back to the main session when you are ready.

Common commands:

/btw <question>
/btw --save <question>
/btw:new [question]
/btw:tangent [question]
/btw:inject [instructions]
/btw:summarize [instructions]
/btw:model [<provider> <model> <api> | clear]
/btw:thinking [<level> | clear]
/btw:clear

Typical flow:

  1. Run /btw <question> to open the native BTW workspace and ask a side question.
  2. Continue the side thread from the workspace composer while the main session stays focused.
  3. Use New, Tangent, model/thinking overrides, or /btw:* commands for lifecycle control.
  4. Use Inject for the full thread or Summarize for a condensed handoff back to the main Pi session.

Requirements

  • macOS, Linux, or Windows.
  • Node.js 20+.
  • pnpm for dependency management.
  • pi installed.
  • Internet access for the Tailwind and Monaco CDNs used by the review window.
  • bun only if you want to rebuild dist/web/ locally.
  • Optional: rust-analyzer and/or gopls for semantic Rust and Go navigation.

Windows notes

Glimpse supports Windows. To build the native host during install you need:

  • .NET 8 SDK.
  • Microsoft Edge WebView2 Runtime.

Development

pnpm install
pnpm run check
pnpm run check:web
pnpm run lint
pnpm run build:web

The web UI source lives under each feature's web/ directory and is bundled into dist/web/<feature>/. The pre-commit hook runs both TypeScript checks, rebuilds the web bundle, and stages the generated dist/web assets.

Project layout

  • src/extension.ts - package entry point that registers all workbench features.
  • src/features/diff-review/ - diff review feature slice.
    • host/ - pi command registration, repository loading, navigation, prompt composition.
    • web/ - Monaco diff review workspace.
    • shared/ - diff-review contracts and pure shared helpers.
  • src/features/response-review/ - assistant response review feature slice.
    • host/ - session extraction, command registration, prompt composition.
    • web/ - response picker, rendered response view, annotations, review queue.
    • shared/ - response-review contracts.
  • src/features/btw/ - native BTW side-conversation feature slice.
    • host/ - Pi sub-session runtime, persistence, handoff commands, workspace lifecycle.
    • web/ - transcript, composer, model/thinking controls, handoff actions.
  • src/shared/host/ - host-only helpers shared across features.
  • src/shared/web/ - browser-only helpers shared across features.
  • src/shared/contracts/ - runtime-neutral contracts shared across features.
  • dist/web/ - built web assets consumed by native Glimpse windows.

Git history highlights

Recent history shows the fork expanding beyond the original native diff review:

  • Added review scopes, lazy loading, and last-commit review support.
  • Refactored the web UI into a modular TypeScript runtime.
  • Added review navigation, reference workflows, and semantic language backends.
  • Added the command palette, repository code search, and changed-symbol inspector.
  • Improved comment drafting, editing, paste handling, and review-queue navigation.
  • Hardened waiting UI, backend failure handling, and review-window teardown.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 90.6%
  • HTML 8.2%
  • Other 1.2%