Skip to content

fix(forge/gitea): route concepts through correct tea CLI/api commands#1138

Closed
pseudoseed wants to merge 1 commit into
cluesmith:mainfrom
pseudoseed:fix/gitea-forge-tea-cli
Closed

fix(forge/gitea): route concepts through correct tea CLI/api commands#1138
pseudoseed wants to merge 1 commit into
cluesmith:mainfrom
pseudoseed:fix/gitea-forge-tea-cli

Conversation

@pseudoseed

Copy link
Copy Markdown

Fixes #1137.

The gitea forge preset was authored against the Gitea REST API JSON shape,
but the scripts invoke the tea CLI, whose --output json emits a different,
flattened shape — and in several places references a flag / field / subcommand
that tea does not have. Per the in-repo #920 note, tea wasn't available in
the authoring environment, so the preset was never run end-to-end.

This is not environment-specific: the failing flags/subcommands are defined
in the tea binary itself (independent of any server), and the canonical Gitea
REST shape the jq assumes is confirmed against public gitea.com. Details +
repro in #1137.

Fixes (verified against tea 0.14.2 + a live Gitea/Forgejo instance)

Concept Before After
user-identity tea whoami --output json (no such flag) tea api user | jq .login
pr-list --fields …,descriptioninvalid field 'description' (concept errored) drop field; body:""
pr-view tea pulls view → empty array tea api repos/:owner/:repo/pulls/:index (incl. additions/deletions)
issue-view tea issues view → list array, no body singular tea issue <id>
issue-comment tea issues comment (no subcommand) tea comments add
pr-exists .head.ref + closed&&merged .head (string) + state=="merged", --limit
recently-merged .head.ref, description, .merged .head, state=="merged", drop field
issue-search marked "unverified" confirmed working; caveat removed

Design note: the preset stays CLI-based (consistent with the working concepts
and the original design); tea api is used only where the CLI can't produce the
contract (pr-view, user-identity). Output shapes were checked against
forge-contracts.ts.

Testing

Each concept was run against a live instance and its output validated:
user-identity → login string; pr-exists → correct true/false; pr-list
→ valid PrListItem[] (int number); pr-viewPrViewResult with real
additions/deletions; issue-view → object with body+browser url;
recently-mergedMergedPrItem[] (all merged); issue-search → array with
body. issue-comment syntax confirmed (not executed — mutating).

The gitea .sh scripts are not exercised by CI (forge.test.ts uses mock
scripts), so validation is necessarily manual against a real forge.

The gitea forge preset was authored against the Gitea REST API JSON shape
but invokes the `tea` CLI, whose `--output json` emits a different,
flattened shape (and in places references a flag/field/subcommand tea does
not have). Verified against tea 0.14.2 + a live Gitea/Forgejo instance:

- user-identity:  tea whoami --output json  -> tea api user | jq .login
                  (tea whoami has no --output json flag)
- pr-exists:      .head.ref -> .head (flattened to a branch-name string),
                  closed+merged -> state=="merged", + --limit
- pr-list:        drop invalid `description` field (was erroring and
                  breaking the concept); body:"" (no body field on list)
- pr-view:        tea pulls view (empty array) -> tea api .../pulls/:index
                  (full object incl. additions/deletions, head/base refs)
- issue-view:     tea issues view (array, no body) -> singular tea issue
- issue-comment:  tea issues comment (no subcommand) -> tea comments add
- recently-merged: .head.ref -> .head, merged filter via state=="merged",
                  drop invalid `description` field
- issue-search:   drop "unverified" caveat (confirmed working)

The scripts are not exercised by CI (forge.test.ts uses mock scripts; per
the in-repo cluesmith#920 note tea is unavailable in the authoring env), so each
was validated manually against a live instance.

Fixes cluesmith#1137

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@waleedkadous

waleedkadous commented Jul 6, 2026 via email

Copy link
Copy Markdown
Contributor

@pseudoseed

Copy link
Copy Markdown
Author

Closing in favor of re-implementing this fix through Codev's BUGFIX protocol (issue #1137 as source of truth), per the maintainer's request. A fresh builder/bugfix-1137-* branch and PR will supersede this one.

The scope and approach here (routing gitea concepts through the correct tea CLI/tea api commands) will inform the redo.

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.

gitea forge preset is broken against the real tea CLI (0.14.2)

2 participants