feat(web): purpose-built tool cards for Forgejo write tools #5

Merged
lucas merged 1 commit from feat/t-68 into main 2026-10-14 17:06:17 +02:00
Collaborator

The nine Forgejo write tools (forgejo_create_pr, forgejo_update_pr, forgejo_create_pr_comment, forgejo_post_review, forgejo_create_issue, forgejo_create_issue_comment, forgejo_update_issue_description, forgejo_update_issue_labels, forgejo_close_issue) now attach a typed details payload to successful results (packages/protocol/src/forgejo-tools.ts). The model-visible text is unchanged apart from a , draft suffix on draft PRs. Each card now shows bodies as rendered markdown in a collapsed section, lists a review's inline comments, and ends with a structured result line whose PR/issue/comment/review refs link to Forgejo (html_url, new tab). Results without details (sessions recorded before this change) fall back to the result text with clickable URLs. forgejo_create_pr gains a draft flag: it prefixes the title with WIP: unless a WIP prefix is already there, and reports the draft state from Forgejo's response.

Decisions

  • forgejo_create_pr_thread_comment is a write tool but was not one of the nine. Its card keeps the text result; only its body preview moved from raw monospace to the new collapsed markdown section, so the old BodyPreview helper could be deleted.
  • Added three small shared helpers in forgejo/ui.tsx, each used across several views: stringArray (reads string-array args defensively), isStringArray and isForgejoUrl (details type guards). LabelTags (renders labels as tags) lives there too, because both create views use it.
  • In ForgejoTool.tsx, read-tool cases keep their existing running/partial result logic. Write views get the GitTool-style running | ok | error state, plus details only on ok.

Verification

  • bun run typecheck: protocol, server and web all exit 0.
  • cd apps/server && bun test src/forgejo: 143 pass, 0 fail, including the new draftTitle cases and the unchanged textResult("hi") shape test.
  • A throwaway stub-client script (deleted afterwards) ran all nine tools against canned API responses:
    • draft: true sends the title WIP: x; an existing [WIP] prefix is not doubled.
    • Details report the response's draft value.
    • Comment and review target URLs have their #fragment stripped.
    • A label no-op returns noop: true with the current names.
    • close_issue without a comment gives a null comment id and URL.
    • Error results carry no details key.
    • Every text output matches the previous format.
  • Not tested in a browser or against a real Forgejo instance.
The nine Forgejo write tools (`forgejo_create_pr`, `forgejo_update_pr`, `forgejo_create_pr_comment`, `forgejo_post_review`, `forgejo_create_issue`, `forgejo_create_issue_comment`, `forgejo_update_issue_description`, `forgejo_update_issue_labels`, `forgejo_close_issue`) now attach a typed `details` payload to successful results (`packages/protocol/src/forgejo-tools.ts`). The model-visible text is unchanged apart from a `, draft` suffix on draft PRs. Each card now shows bodies as rendered markdown in a collapsed section, lists a review's inline comments, and ends with a structured result line whose PR/issue/comment/review refs link to Forgejo (`html_url`, new tab). Results without details (sessions recorded before this change) fall back to the result text with clickable URLs. `forgejo_create_pr` gains a `draft` flag: it prefixes the title with `WIP: ` unless a WIP prefix is already there, and reports the draft state from Forgejo's response. ## Decisions - `forgejo_create_pr_thread_comment` is a write tool but was not one of the nine. Its card keeps the text result; only its body preview moved from raw monospace to the new collapsed markdown section, so the old `BodyPreview` helper could be deleted. - Added three small shared helpers in `forgejo/ui.tsx`, each used across several views: `stringArray` (reads string-array args defensively), `isStringArray` and `isForgejoUrl` (details type guards). `LabelTags` (renders labels as tags) lives there too, because both create views use it. - In `ForgejoTool.tsx`, read-tool cases keep their existing running/partial result logic. Write views get the `GitTool`-style `running | ok | error` state, plus details only on `ok`. ## Verification - `bun run typecheck`: protocol, server and web all exit 0. - `cd apps/server && bun test src/forgejo`: 143 pass, 0 fail, including the new `draftTitle` cases and the unchanged `textResult("hi")` shape test. - A throwaway stub-client script (deleted afterwards) ran all nine tools against canned API responses: - `draft: true` sends the title `WIP: x`; an existing `[WIP]` prefix is not doubled. - Details report the response's `draft` value. - Comment and review target URLs have their `#fragment` stripped. - A label no-op returns `noop: true` with the current names. - `close_issue` without a comment gives a null comment id and URL. - Error results carry no `details` key. - Every text output matches the previous format. - Not tested in a browser or against a real Forgejo instance.
The nine Forgejo write tools (create/update PR, PR and issue comments,
post review, create issue, update description, update labels, close
issue) now attach a typed `details` payload to their results
(`@omp-deck/protocol` forgejo-tools.ts). The model-visible text is
unchanged. The web cards render it: markdown bodies, a review's inline
comments, and a structured result line whose PR/issue/comment/review
refs link to Forgejo. Results without details (older sessions) fall
back to the text with clickable URLs.

`forgejo_create_pr` gains a `draft` flag: it prefixes the title with
`WIP: ` (Forgejo's draft marker) unless a WIP prefix is already there,
and the result reports the draft state Forgejo returned.

Co-Authored-By: Claude Opus 5.5 via omp-deck
lucas approved these changes 2026-10-14 17:06:11 +02:00
lucas merged commit 391709abce into main 2026-10-14 17:06:17 +02:00
lucas deleted branch feat/t-68 2026-10-14 17:06:17 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lucas/omp-deck!5
No description provided.