[Feature]: Support gt, the new official Gitea CLI that replaces the archived tea#27210

opened13d agobyHhakubo

Summary

tea has been archived. Its README now says:

tea has been replaced by gt, the new official CLI for Gitea, and this repository will be archived. Please use gt and open new issues and pull requests at https://gitea.com/gitea/cli.

T3 Code's Forgejo/Gitea integration only knows about fj and tea. New Gitea users will install gt, and T3 Code won't detect it. They'll see "Not authenticated" / "Install Forgejo CLI (fj 0.6 or later) or Gitea CLI (tea 0.16 or later)" and won't know why.

Where tea is hard-coded

  • packages/source-control-forgejo/src/server/ForgejoCli.ts
    • command: Schema.Literals(["fj", "tea"])
    • Login discovery runs tea login list --output json
    • API calls run tea api --include --login <login> --repo <repo> --method … <url>, and the HTTP status is parsed from stderr because tea exits 0 on HTTP errors
    • Error and help strings mention tea login add and tea login default
  • packages/source-control-forgejo/src/shared/definition.ts: CHECKOUT_COMMAND and changeRequestCloseCommand regexes match tea pr|pulls …; searchKeywords includes "tea"
  • docs/user/source-control.md: links to https://gitea.com/gitea/tea and documents tea login add / tea login default

What changes with gt

From Migrating from tea and the gt README:

teagt
tea login addgt auth login (--with-token or --oauth)
tea login list, tea whoamigt auth status
tea login defaultgt auth switch
--login, -l--host and --user
--repo, -r--repo, -R
--output json--json, --jq
tea pulls …gt pr …

Other differences:

  • gt has its own config (config.yml, hosts.yml) and doesn't read tea's, so users have to log in again
  • Credentials go in the OS keyring by default; --credential-store file is opt-in
  • GITEA_TOKEN plus GITEA_CLI_HOST / GITEA_INSTANCE_URL are supported for headless setups. This is relevant to T3 Code servers running as a background service.
  • gt requires Gitea 28 or newer, so tea may still be needed for older instances

Proposal

  1. Detect gt alongside fj and tea. Suggested order: fj → gt → tea, keeping tea as a legacy fallback for Gitea < 28 and existing setups.
  2. Read logins from gt auth status --json, or whatever gt exposes for this, and make API requests through gt api (or the equivalent) using --host/--user instead of --login.
  3. Check whether gt api reports HTTP failures through its exit code, so the stderr status parsing workaround only applies to tea.
  4. Recognize gt pr checkout|merge|close in CHECKOUT_COMMAND / changeRequestCloseCommand, and add "gt" to searchKeywords.
  5. Update the docs, error messages and Settings to point to https://gitea.com/gitea/cli and gt auth login.
  • #12297: Gitea showing Not Authenticated even when authenticated through tea CLI
  • #21526: Gitea repositories identified as Forgejo
This conversation has been locked.