feat(plugins): commits + diff viewer move to plugins (tab slot, path shims, diff.read) #28

Closed
gabrielvidal wants to merge 0 commits from feat-commits-plugins into main
pull from: feat-commits-plugins
Owner

Summary

Moves the commit feature out of the core into two live plugins, diff-viewer and commits, which ship in ai-agent-plugins (gabrielvidal/ai-agent-plugins#18 — merge together). This PR adds the generic platform points they build on and removes the core commit/diff UI. Commits are now captured for every harness (claude, pi, opencode, agy) by a git PATH shim, not only by Claude's Bash hook. The choices come from form commits-diff-viewer-plugins_zr3l5s.

Key changes

  • conversation.tab slot (ConversationPluginTabs.tsx, plugins/tabs.ts): the header's Thread | <label> N switch is fed by plugin tab slots. The frame is mounted hidden and shows itself with aiAgentPlugin.setTab({hidden, badge, label}). URLs are ?view=<pid>:<slot>&tp=…, and legacyView: "changes" keeps old ?view=changes&c= links working. New bridges: openTab, closeTab, and reply({text, send}), which writes into this conversation's reply box (replyRequests.ts → ResumeBox).

  • Tool cards: stackable (consecutive calls draw as one frame with init.stack), pullOut (stays in the folded summary view, where the old CommitStack sat), match.hasReport, and commits + reports in the card's init/update.

  • pathShims (manifest; operator approval; delivered like harnessHooks scripts to the lab and to workers' /sync):

    • sidecar/path_shims.py writes a POSIX-sh wrapper that launch._launch puts first on PATH for every harness. Read-only git goes straight to the real git; only trigger words start the plugin's script.
    • sidecar/aia_report.py sends reports: on the lab to POST /api/plugin-reports (per-session HMAC token), on a worker through the outbox report kind. A spool keeps them while offline.
    • Hub side: backend/plugins/reports.py stores reports per conversation and plugin, with caps, and joins them onto shell thread items by time window.
  • Capabilities: conversations.reports (a plugin reads its own reports and blobs) and diff.read (backend/plugins/hubdiff.py: commit list, commit diff with a root hint for worker commits, uncommitted, aggregate, repo commit). Guests are restricted exactly as by diff/routes.py.

  • ui.pages[].opens (plugins/opener.ts): Project and Service "Recent commits" rows link to whatever page opens commit. /diff/* addresses redirect (LegacyDiffRedirect.tsx).

  • Removed:

    • CommitCard.tsx, ChangesView.tsx, business/diff/**, lib/diffRoute.ts, lib/reviewStore.ts
    • the Drawer's /diff branch, the "Commits & changes" Details card, the commit eye switch, six diff queries
    • from sidecar/bash_diff.py: gitCommits (bashDiff stays)

    DiffCode and Diff moved to conversations/components/ for BashDiffBox and the Edit cards.

  • Seeding: carryover.py seeds a plugin's requires first (commits comes after diff-viewer).

  • Docs: new sections and capability rows in docs/plugins.md; updates to CLAUDE.md and sidecar/README.md.

Key decisions

  • A PATH shim, not git hooks: it never touches .git/hooks or core.hooksPath, and it works for every harness without LLM tokens. Shell-output parsing stays in core as the fallback for terminal sessions, old transcripts, and an rc file that resets PATH.
  • The diff engines stay in core (backend/diff/*, conversations/commits.py), reached through bridges. Plugins can't read repos or transcripts, and the same pattern was used for perf.read. The /api/* diff routes stay for the CLI.
  • Reports are generic (pathShims + hasReport). Core never names commits or diff-viewer.
  • New keys are written into the manifest only when set: none of the 64 existing plugins' approval fingerprints moved.

Changelog

  • Added: commits are captured in pi, opencode and agy conversations too, not only Claude's
  • Changed: the commit cards, the Changes tab, the Details commit list and the full-page diff are now the Diff viewer and Commits plugins (installed by default, for guests too)
  • Added: plugins can add a tab next to Thread in a conversation

Test notes

  • Backend: run module by module under bwrap, the suite matches main. The new test_plugin_commits_platform.py (21) passes. test_typed_plugins fails the same way on main.
  • Sidecar: the new test_path_shims.py and the updated test_bash_diff.py pass (54). They include real wrapper runs on a temp repo: read-only git never starts the script, exit codes pass through, and all four harnesses launch through the wrappers.
  • Frontend: tsc is clean. vitest has 1,084 passing; the 3 failures are the known useShareTarget ×2 and CacheExpiredNotice, which fail on main too.
  • End to end on a live local hub (EVOX2) with both plugins seeded:
    • 2 commits and a push went through the real shim and were joined onto the thread.
    • The legacy output-line card still works.
    • The stack card, inline diff, "Review in Changes ›", the Changes tab, Viewed ticks surviving a reload, and Send review into the reply box all work.
    • The Details cards, the Project "Recent commits" link to the diff page, and the /diff/* redirects all work.
    • The summary view keeps the card; dark mode and phone width look right.
  • Not tested: a guest's view.
  • Known gap: a guest's lab run inside Claude Code's sandbox may not reach the hub or its spool. The commit-line fallback still lists the commit.
  • Deploy: merge together with the ai-agent-plugins PR, then deploy from the Homelab (blue-green). Nothing was deployed from the EVOX2.

🤖 Generated with Claude Code

## Summary Moves the commit feature out of the core into two live plugins, `diff-viewer` and `commits`, which ship in ai-agent-plugins (gabrielvidal/ai-agent-plugins#18 — merge together). This PR adds the generic platform points they build on and removes the core commit/diff UI. Commits are now captured for every harness (claude, pi, opencode, agy) by a `git` PATH shim, not only by Claude's Bash hook. The choices come from form `commits-diff-viewer-plugins_zr3l5s`. ## Key changes - **`conversation.tab` slot** (`ConversationPluginTabs.tsx`, `plugins/tabs.ts`): the header's `Thread | <label> N` switch is fed by plugin tab slots. The frame is mounted hidden and shows itself with `aiAgentPlugin.setTab({hidden, badge, label})`. URLs are `?view=<pid>:<slot>&tp=…`, and `legacyView: "changes"` keeps old `?view=changes&c=` links working. New bridges: `openTab`, `closeTab`, and `reply({text, send})`, which writes into this conversation's reply box (`replyRequests.ts` → `ResumeBox`). - **Tool cards:** `stackable` (consecutive calls draw as one frame with `init.stack`), `pullOut` (stays in the folded summary view, where the old CommitStack sat), `match.hasReport`, and `commits` + `reports` in the card's init/update. - **`pathShims`** (manifest; operator approval; delivered like `harnessHooks` scripts to the lab and to workers' `/sync`): - `sidecar/path_shims.py` writes a POSIX-sh wrapper that `launch._launch` puts first on PATH for every harness. Read-only git goes straight to the real git; only trigger words start the plugin's script. - `sidecar/aia_report.py` sends reports: on the lab to `POST /api/plugin-reports` (per-session HMAC token), on a worker through the outbox `report` kind. A spool keeps them while offline. - Hub side: `backend/plugins/reports.py` stores reports per conversation and plugin, with caps, and joins them onto shell thread items by time window. - **Capabilities:** `conversations.reports` (a plugin reads its own reports and blobs) and `diff.read` (`backend/plugins/hubdiff.py`: commit list, commit diff with a `root` hint for worker commits, uncommitted, aggregate, repo commit). Guests are restricted exactly as by `diff/routes.py`. - **`ui.pages[].opens`** (`plugins/opener.ts`): Project and Service "Recent commits" rows link to whatever page opens `commit`. `/diff/*` addresses redirect (`LegacyDiffRedirect.tsx`). - **Removed:** - `CommitCard.tsx`, `ChangesView.tsx`, `business/diff/**`, `lib/diffRoute.ts`, `lib/reviewStore.ts` - the Drawer's `/diff` branch, the "Commits & changes" Details card, the commit eye switch, six diff queries - from `sidecar/bash_diff.py`: `gitCommits` (`bashDiff` stays) `DiffCode` and `Diff` moved to `conversations/components/` for BashDiffBox and the Edit cards. - **Seeding:** `carryover.py` seeds a plugin's `requires` first (`commits` comes after `diff-viewer`). - **Docs:** new sections and capability rows in `docs/plugins.md`; updates to `CLAUDE.md` and `sidecar/README.md`. ## Key decisions - **A PATH shim, not git hooks:** it never touches `.git/hooks` or `core.hooksPath`, and it works for every harness without LLM tokens. Shell-output parsing stays in core as the fallback for terminal sessions, old transcripts, and an rc file that resets PATH. - **The diff engines stay in core** (`backend/diff/*`, `conversations/commits.py`), reached through bridges. Plugins can't read repos or transcripts, and the same pattern was used for `perf.read`. The `/api/*` diff routes stay for the CLI. - **Reports are generic** (`pathShims` + `hasReport`). Core never names `commits` or `diff-viewer`. - **New keys are written into the manifest only when set:** none of the 64 existing plugins' approval fingerprints moved. ## Changelog - Added: commits are captured in pi, opencode and agy conversations too, not only Claude's - Changed: the commit cards, the Changes tab, the Details commit list and the full-page diff are now the Diff viewer and Commits plugins (installed by default, for guests too) - Added: plugins can add a tab next to Thread in a conversation ## Test notes - **Backend:** run module by module under bwrap, the suite matches main. The new `test_plugin_commits_platform.py` (21) passes. `test_typed_plugins` fails the same way on main. - **Sidecar:** the new `test_path_shims.py` and the updated `test_bash_diff.py` pass (54). They include real wrapper runs on a temp repo: read-only git never starts the script, exit codes pass through, and all four harnesses launch through the wrappers. - **Frontend:** `tsc` is clean. vitest has 1,084 passing; the 3 failures are the known `useShareTarget` ×2 and `CacheExpiredNotice`, which fail on main too. - **End to end on a live local hub (EVOX2)** with both plugins seeded: - 2 commits and a push went through the real shim and were joined onto the thread. - The legacy output-line card still works. - The stack card, inline diff, "Review in Changes ›", the Changes tab, Viewed ticks surviving a reload, and Send review into the reply box all work. - The Details cards, the Project "Recent commits" link to the diff page, and the `/diff/*` redirects all work. - The summary view keeps the card; dark mode and phone width look right. - **Not tested:** a guest's view. - **Known gap:** a guest's lab run inside Claude Code's sandbox may not reach the hub or its spool. The commit-line fallback still lists the commit. - **Deploy:** merge together with the ai-agent-plugins PR, then deploy from the Homelab (blue-green). Nothing was deployed from the EVOX2. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gabrielvidal self-assigned this 2026-11-27 20:17:29 +01:00
gabrielvidal added 1 commit 2026-11-27 20:17:29 +01:00
Generic platform points for the `diff-viewer` and `commits` plugins
(ai-agent-plugins): a `conversation.tab` slot (Thread | Changes N) with
setTab/openTab/closeTab/reply bridges; stackable + pullOut tool cards and
match.hasReport; `pathShims` (a git PATH shim for every harness) with
out-of-band reports (lab: /api/plugin-reports, worker: outbox `report`);
`conversations.reports` and `diff.read` hub bridges; ui.pages[].opens for
Project/Service "Recent commits". The core commit card, Changes view, diff
page and review store are gone; bash_diff.py keeps bashDiff only. Legacy
gitCommits / commit-line parsing stays for past transcripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner
Merged into `main` as 8e817b34d16c4c8a58ce8ee0b5799289f7a9acb8 by the auto-ship batch https://ai-agent.lab.gabvdl.xyz/conversation/76dfa3ab-29e0-4c68-be0f-2395c067be59.
gabrielvidal closed this pull request 2026-11-27 20:37:46 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gabrielvidal/ai-agent#28