Skip to content

feat: add workspace-ideas plugin#16

Open
ZoRDoK wants to merge 5 commits into
jmfederico:mainfrom
ZoRDoK:feat/workspace-ideas-plugin
Open

feat: add workspace-ideas plugin#16
ZoRDoK wants to merge 5 commits into
jmfederico:mainfrom
ZoRDoK:feat/workspace-ideas-plugin

Conversation

@ZoRDoK

@ZoRDoK ZoRDoK commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Problem

External PI WEB plugins need a small public API surface to persist workspace-local files and start a session from a workspace panel without relying on private /api/... calls.

The Workspace Ideas plugin now lives outside this repo in:

https://github.com/ZoRDoK/pi-web-plugins/tree/main/plugins/pi-ideas

Change

Add public seams needed by external workspace plugins:

  • WorkspaceFiles.writeFile(path, content) in the public plugin API.
  • WorkspacePanelSessions.startWithPrompt(prompt, { newWorkspace, ideaId }) returning WorkspacePanelSessionInfo with optional workspaceId.
  • Client wiring so workspace panel contexts expose files.writeFile and sessions.startWithPrompt.
  • Server route to write workspace files through the existing workspace boundary checks.
  • Server route to create an idea worktree from the selected workspace's current HEAD.

The bundled workspace-ideas plugin source was moved out of pi-web; it is now installable as a Pi package from the external plugin repository.

Verification

npm run verify — typecheck, lint, knip, and 588 tests pass.

@ZoRDoK
ZoRDoK force-pushed the feat/workspace-ideas-plugin branch 2 times, most recently from e47610a to 724695c Compare June 12, 2026 21:12
@jmfederico

Copy link
Copy Markdown
Owner

I wonder if you would want to publish your plugin as an npm package instead?

I have not looked at the code but seems like if you only use the plugin API, it should be doable.

@jmfederico

Copy link
Copy Markdown
Owner

And any API changes needed I am more than happy to merge to make PI WEB easier to extend

ZoRDoK added 4 commits June 19, 2026 19:44
Adds a bundled "Ideas" workspace panel that lets users capture short
ideas, run each one in a new git worktree + Pi session, and mark them
done. State lives in .pi-web/ideas.json.

Plugin (pi-web-plugins/workspace-ideas):
- Captures ideas, persists them in .pi-web/ideas.json via public
  WorkspaceFiles.writeFile.
- Warns if .pi-web/ is not gitignored, offers one-click fix.
- Run starts a Pi session in a fresh idea worktree via
  WorkspacePanelSessions.startWithPrompt({ newWorkspace, ideaId }).
- Done archives the idea and keeps a link to its session.

Core changes (minimal seams):
- WorkspaceFiles.writeFile in the public plugin API.
- WorkspacePanelSessions.startWithPrompt seam to start a session in a
  new idea worktree without changing focus and refresh host state.
- PUT /api/.../workspaces/:id/file and POST /api/.../idea-workspace
  routes (path-escape guarded).
- .gitignore: ignore .pi-web/ in this repo.
Previously `git worktree add` ran with `-C project.path` and no
start-point, so the new worktree was always based on the HEAD of the
main worktree (usually main) regardless of which workspace the user
had selected. Run it with `-C workspace.path` and an explicit `HEAD`
start-point so the idea branch forks from the currently selected
workspace's branch.
The Fix button silently swallowed write errors and never re-read the
gitignore status, so the warning could stay visible after a failed or
no-op write. Wrap fixGitignore in try/catch, re-load gitignore state
from disk after writing, and show an explicit success or error status.
@ZoRDoK
ZoRDoK force-pushed the feat/workspace-ideas-plugin branch from 9d76be7 to c05d246 Compare June 19, 2026 16:46
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.

2 participants