Commit Graph

522 Commits

Author SHA1 Message Date
Bo-Yi Wu
ec658cfc33 chore(deps): update Go dependencies and CI workflow action versions (#932)
## Summary

- Run `go get -u ./...` and `go mod tidy` to update all Go dependencies
- Update CI workflow action versions:
  - `crazy-max/ghaction-import-gpg`: v6 → v7
  - `goreleaser/goreleaser-action`: v6 → v7
  - `docker/setup-qemu-action`: v3 → v4
  - `docker/setup-buildx-action`: v3 → v4
  - `docker/login-action`: v3 → v4
  - `docker/build-push-action`: v6 → v7

## Notable Go dependency updates

- `github.com/urfave/cli/v3`: v3.6.2 → v3.7.0
- `github.com/ProtonMail/go-crypto`: v1.3.0 → v1.4.0
- `charm.land/huh/v2`: v2.0.1 → v2.0.3
- `golang.org/x/crypto`: v0.48.0 → v0.49.0
- `golang.org/x/net`: v0.49.0 → v0.52.0

Reviewed-on: https://gitea.com/gitea/tea/pulls/932
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2026-03-12 05:28:47 +00:00
Bo-Yi Wu
cb9824b451 feat(repos): support owner-based repository listing with robust lookup (#931)
- Add an owner flag to the repos list command to list repositories for a specific user or organization
- Implement owner-based repository listing by detecting whether the owner is an organization or a user and calling the appropriate API
- Improve error handling for owner lookup by checking HTTP status codes instead of relying on error string matching
- Align repository search logic with the updated owner lookup behavior using HTTP response validation

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

Reviewed-on: https://gitea.com/gitea/tea/pulls/931
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2026-03-12 04:22:28 +00:00
Bo-Yi Wu
a531faa626 feat(repos): add repo edit subcommand (#928)
## Summary
- Add `tea repo edit` subcommand to update repository properties via the Gitea API
- Support flags: `--name`, `--description`/`--desc`, `--website`, `--private`, `--template`, `--archived`, `--default-branch`
- Boolean-like flags use string type to distinguish "not set" from "false", following the pattern in `releases/edit.go`

## Test plan
- [x] `go build ./...` passes
- [x] `go vet ./...` passes
- [x] `tea repo edit --help` shows all flags correctly
- [x] Manual test: `tea repo edit --private true` on a test repo
- [x] Manual test: `tea repo edit --name new-name --description "new desc"` on a test repo

Reviewed-on: https://gitea.com/gitea/tea/pulls/928
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2026-03-12 03:06:44 +00:00
Bo-Yi Wu
302c946cb8 feat: store OAuth tokens in OS keyring via credstore (#926)
## Summary

- Introduce `github.com/go-authgate/sdk-go/credstore` to store OAuth tokens securely in the OS keyring (macOS Keychain / Linux Secret Service / Windows Credential Manager), with automatic fallback to an encrypted JSON file
- Add `AuthMethod` field to `Login` struct; new OAuth logins are marked `auth_method: oauth` and no longer write `token`/`refresh_token`/`token_expiry` to `config.yml`
- Add `GetAccessToken()` / `GetRefreshToken()` / `GetTokenExpiry()` accessors that transparently read from credstore for OAuth logins, with fallback to YAML fields for legacy logins
- Update all token reference sites across the codebase to use the new accessors
- Non-OAuth logins (token, SSH) are completely unaffected; no migration of existing tokens

## Key files

| File | Role |
|------|------|
| `modules/config/credstore.go` | **New** — credstore wrapper (Load/Save/Delete) |
| `modules/config/login.go` | Login struct, token accessors, refresh logic |
| `modules/auth/oauth.go` | OAuth flow, token creation / re-authentication |
| `modules/api/client.go`, `cmd/login/helper.go`, `cmd/login/oauth_refresh.go` | Token reference updates |
| `modules/task/pull_*.go`, `modules/task/repo_clone.go` | Git operation token reference updates |

## Test plan

- [x] `go build ./...` compiles successfully
- [x] `go test ./...` all tests pass
- [x] `tea login add --oauth` completes OAuth flow; verify config.yml has `auth_method: oauth` but no token/refresh_token/token_expiry
- [x] `tea repos ls` API calls work (token read from credstore)
- [x] `tea login delete <name>` credstore token is also removed
- [x] Existing non-OAuth logins continue to work unchanged

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: https://gitea.com/gitea/tea/pulls/926
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2026-03-12 02:49:14 +00:00
techknowlogick
0346e1cbb5 add function comment 2026-03-10 10:00:39 -04:00
techknowlogick
cd4051ed38 make vet&fmt pass 2026-03-10 09:55:10 -04:00
Michal Suchanek
c797624fcf Update to charm libraries v2 (#923)
Reviewed-on: https://gitea.com/gitea/tea/pulls/923
Reviewed-by: techknowlogick <9+techknowlogick@noreply.gitea.com>
Co-authored-by: Michal Suchanek <msuchanek@suse.de>
Co-committed-by: Michal Suchanek <msuchanek@suse.de>
2026-03-09 16:36:00 +00:00
Renovate Bot
3372c9ec59 fix(deps): update module golang.org/x/oauth2 to v0.36.0 (#919)
Reviewed-on: https://gitea.com/gitea/tea/pulls/919
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-03-09 16:19:28 +00:00
techknowlogick
1ac8492ac7 go 1.26 2026-03-09 15:57:54 +00:00
Renovate Bot
d019f0dd72 fix(deps): update module github.com/go-git/go-git/v5 to v5.17.0 (#910)
Reviewed-on: https://gitea.com/gitea/tea/pulls/910
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-26 17:59:28 +00:00
techknowlogick
c031db2413 Parse multiple values in api subcommand (#911)
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-26 17:43:46 +00:00
Nikolaos Karaolidis
e3c550ff22 fix: authentication via env variables repo argument (#809)
---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/809
Co-authored-by: Nikolaos Karaolidis <nick@karaolidis.com>
Co-committed-by: Nikolaos Karaolidis <nick@karaolidis.com>
v0.12.0
2026-02-19 19:23:44 +00:00
Lunny Xiao
fab70f83c1 Fix issue detail view ignoring --owner flag (#899)
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/899
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-02-19 18:57:23 +00:00
techknowlogick
0b1147bfc0 build for windows aarch64 too 2026-02-19 18:41:21 +00:00
Lunny Xiao
93d4d3cc55 Skip token uniqueness check when using SSH authentication (#898)
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: silverwind <silverwind@noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/898
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-02-19 15:19:45 +00:00
Alain Thiffault
bdf15a57be feat(pulls): add JSON output support for single PR view (#864)
Reviewed-on: https://gitea.com/gitea/tea/pulls/864
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Alain Thiffault <athiffau@effectivemomentum.com>
Co-committed-by: Alain Thiffault <athiffau@effectivemomentum.com>
2026-02-19 15:16:21 +00:00
Lunny Xiao
87c8c3d6e0 Fix new tty prompt (#897)
Fix #827

---------

Co-authored-by: silverwind <silverwind@noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/897
Reviewed-by: silverwind <silverwind@noreply.gitea.com>
2026-02-16 03:37:44 +00:00
Michal Suchanek
dfd400f15b Fix termenv OSC RGBA handling (#907)
Fixes: #889
Reviewed-on: https://gitea.com/gitea/tea/pulls/907
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: Michal Suchanek <msuchanek@suse.de>
Co-committed-by: Michal Suchanek <msuchanek@suse.de>
2026-02-12 16:16:53 +00:00
yousfi saad
2152d99f2d Add tea actions runs and workflows commands (#880)
Implements comprehensive workflow execution tracking for Gitea Actions using tea CLI

## Features

### tea actions runs list
- List workflow runs with filtering (status, branch, event, actor, time)
- Time filters: relative (24h, 7d) and absolute dates
- Status symbols: ✓ success, ✘ failure, ⭮ pending, ⊘ skipped/cancelled, ⚠ blocked
- Multiple output formats: table, json, yaml, csv, tsv

### tea actions runs view
- View run details with metadata (ID, status, workflow, branch, event, trigger info)
- Shows jobs table with status, runner, duration
- Optional --jobs flag to toggle jobs display

### tea actions runs delete
- Delete/cancel workflow runs with confirmation prompt
- Supports --confirm/-y to skip prompt

### tea actions runs logs
- View job logs for all jobs or specific job (--job <id>)
- **New: --follow/-f flag for real-time log following** (like tail -f)
- Polls API every 2 seconds, only shows new content
- Auto-detects completion and exits

### tea actions workflows list
- List workflow files (.yml and .yaml) in repository
- Searches in .gitea/workflows and .github/workflows
- Shows active (✓) or inactive (✗) status based on recent runs
- Displays workflow name, path, and file size

## Commands

`tea actions runs list --status success --since 24h`
`tea actions runs view 123`
`tea actions runs delete 123 --confirm`
`tea actions runs logs 123 --job 456 --follow`
`tea actions workflows list`

## Tests
- 19 unit tests across all commands
- Full test suite passing
- Manual testing successful

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/880
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: yousfi saad <yousfi.saad@gmail.com>
Co-committed-by: yousfi saad <yousfi.saad@gmail.com>
2026-02-11 00:40:06 +00:00
Renovate Bot
ea795775af fix(deps): update module golang.org/x/crypto to v0.48.0 (#905)
Reviewed-on: https://gitea.com/gitea/tea/pulls/905
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-10 00:43:00 +00:00
Renovate Bot
1093ef1524 fix(deps): update module github.com/go-git/go-git/v5 to v5.16.5 (#904)
Reviewed-on: https://gitea.com/gitea/tea/pulls/904
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-10 00:42:45 +00:00
Renovate Bot
873a44f897 fix(deps): update module golang.org/x/sys to v0.41.0 (#901)
Reviewed-on: https://gitea.com/gitea/tea/pulls/901
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-09 05:22:44 +00:00
Renovate Bot
47f74ea696 fix(deps): update module golang.org/x/oauth2 to v0.35.0 (#900)
Reviewed-on: https://gitea.com/gitea/tea/pulls/900
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-09 04:56:34 +00:00
Michal Suchanek
59656dfcd2 Require non-empty token in GetLoginByToken (#895)
Fixes: #893
Reviewed-on: https://gitea.com/gitea/tea/pulls/895
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Michal Suchanek <msuchanek@suse.de>
Co-committed-by: Michal Suchanek <msuchanek@suse.de>
2026-02-08 18:11:54 +00:00
Michal Suchanek
e644cc49d4 Revert "Login requires a http/https login URL and revmoe SSH as a login method. SSH will be optional (#826)" (#891)
This reverts commit 90f8624ae7.

Fixes: #890

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/891
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Michal Suchanek <msuchanek@suse.de>
Co-committed-by: Michal Suchanek <msuchanek@suse.de>
2026-02-08 00:21:47 +00:00
boozedog
3595f8f89d fixed minor typo and grammar issue (#892)
Reviewed-on: https://gitea.com/gitea/tea/pulls/892
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: boozedog <boozedog@noreply.gitea.com>
Co-committed-by: boozedog <boozedog@noreply.gitea.com>
2026-02-07 16:02:20 +00:00
techknowlogick
49a9032d8a Move versions/filelocker into dedicated subpackages, and consistent headers in http requests (#888)
- move filelocker logic into dedicated subpackage
- consistent useragent in requests

Reviewed-on: https://gitea.com/gitea/tea/pulls/888
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-05 18:05:43 +00:00
techknowlogick
982adb4d02 Update README.md 2026-02-04 19:37:39 +00:00
techknowlogick
29488a1f46 build w/ go1.25 (#886)
Reviewed-on: https://gitea.com/gitea/tea/pulls/886
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-04 19:27:25 +00:00
Renovate Bot
a47ac265d2 chore(deps): update mcr.microsoft.com/devcontainers/go docker tag to v2 (#884)
Reviewed-on: https://gitea.com/gitea/tea/pulls/884
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-04 00:56:27 +00:00
Renovate Bot
037d1aad23 fix(deps): update module github.com/charmbracelet/lipgloss to v2 (#885)
Reviewed-on: https://gitea.com/gitea/tea/pulls/885
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-04 00:56:04 +00:00
Renovate Bot
e5342660fa chore(deps): update actions/checkout action to v6 (#882)
Reviewed-on: https://gitea.com/gitea/tea/pulls/882
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-04 00:16:06 +00:00
Renovate Bot
233ffe4508 chore(deps): update actions/setup-go action to v6 (#883)
Reviewed-on: https://gitea.com/gitea/tea/pulls/883
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-04 00:15:53 +00:00
techknowlogick
ae9eb4f2c0 Add locking to ensure safe concurrent access to config file (#881)
Reviewed-on: https://gitea.com/gitea/tea/pulls/881
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-03 23:48:18 +00:00
a1012112796
0d5bf60632 support create agit flow pull request (#867)
while looks the alibaba has not maintain
[`git-repo-go`](https://github.com/alibaba/git-repo-go/)
tool, to make agit flow pull requst can be create quickly.
add creating agit flow pull request feature
in tea tool

example:

```SHELL
tea pulls create --agit --remote=origin --topic=test-topic
--title="hello world" --description="test1
test 2
test 3"
```

Signed-off-by: a1012112796 <1012112796@qq.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/867
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-committed-by: a1012112796 <1012112796@qq.com>
2026-02-03 20:36:04 +00:00
techknowlogick
82d8a14c73 Add api subcommand for arbitrary api calls not covered by existing subcommands (#879)
Reviewed-on: https://gitea.com/gitea/tea/pulls/879
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-03 20:24:21 +00:00
Renovate Bot
6414a5e00e chore(deps): update docker.gitea.com/gitea docker tag to v1.25.4 (#877)
Reviewed-on: https://gitea.com/gitea/tea/pulls/877
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-03 01:06:13 +00:00
Renovate Bot
864face284 fix(deps): update module golang.org/x/oauth2 to v0.34.0 (#878)
Reviewed-on: https://gitea.com/gitea/tea/pulls/878
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-03 01:06:03 +00:00
Renovate Bot
383c5fdc03 fix(deps): update module github.com/urfave/cli/v3 to v3.6.2 (#876)
Reviewed-on: https://gitea.com/gitea/tea/pulls/876
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-03 01:00:21 +00:00
Renovate Bot
7801310a18 fix(deps): update module github.com/olekukonko/tablewriter to v1.1.3 (#875)
Reviewed-on: https://gitea.com/gitea/tea/pulls/875
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2026-02-03 01:00:03 +00:00
techknowlogick
c2180048a0 Split up Context (#873)
Reviewed-on: https://gitea.com/gitea/tea/pulls/873
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-02 23:16:39 +00:00
techknowlogick
629872d1e9 nix flake update (#872)
Reviewed-on: https://gitea.com/gitea/tea/pulls/872
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-02 23:05:45 +00:00
techknowlogick
0be14de5c2 bump devcontainer 2026-02-02 23:02:00 +00:00
techknowlogick
4f8cb7ef19 helpful error messages (#871)
Reviewed-on: https://gitea.com/gitea/tea/pulls/871
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-02 22:59:22 +00:00
techknowlogick
f638dba99b More improvements (#870)
- no duplicate logins
- link to html page rather than api in output
- client side pagination of watched repos

Reviewed-on: https://gitea.com/gitea/tea/pulls/870
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-02 22:58:25 +00:00
techknowlogick
20da414145 Code Cleanup (#869)
- switch to golangci-lint for linting
- switch to gofmpt for formatting
- fix lint and fmt issues that came up from switch to new tools
- upgrade go-sdk to 0.23.2
- support pagination for listing tracked times
- remove `FixPullHeadSha` workaround (upstream fix has been merged for 5+ years at this point)
- standardize on US spelling (previously a mix of US&UK spelling)
- remove some unused code
- reduce some duplication in parsing state and issue type
- reduce some duplication in reading input for secrets and variables
- reduce some duplication with PR Review code
- report error for when yaml parsing fails
- various other misc cleanup

Reviewed-on: https://gitea.com/gitea/tea/pulls/869
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-02 22:39:26 +00:00
techknowlogick
ae740a66e8 update sdk version (#868)
Reviewed-on: https://gitea.com/gitea/tea/pulls/868
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-02-02 19:54:44 +00:00
techknowlogick
c2e9265dae bump more CI actions 2026-02-02 19:53:20 +00:00
techknowlogick
45260e1a1f bump action versions in CI for PRs
disable govulncheck temporarily
2026-02-02 19:50:25 +00:00
Alain Thiffault
7ab3366220 fix(labels): improve delete command and fix --id flag type (#865)
## Summary

Fix the `tea labels delete` and `tea labels update` commands which were silently ignoring the `--id` flag.

## Problem

Both commands used `IntFlag` for the `--id` parameter but called `ctx.Int64("id")` to retrieve the value. This type mismatch caused the ID to always be read as `0`, making the commands useless.

**Before (bug):**
```bash
$ tea labels delete --id 36 --debug
DELETE: .../labels/0   # Wrong! ID ignored
```

**After (fix):**
```bash
$ tea labels delete --id 36 --debug
GET: .../labels/36     # Verify exists
DELETE: .../labels/36  # Correct ID
Label 'my-label' (id: 36) deleted successfully
```

## Changes

### labels/delete.go
- Change `IntFlag` to `Int64Flag` to match `ctx.Int64()` usage
- Make `--id` flag required
- Verify label exists before attempting deletion
- Provide clear error messages with label name and ID context
- Print success message after deletion

### labels/update.go
- Change `IntFlag` to `Int64Flag` to fix the same bug

## Test plan

- [x] `go test ./...` passes
- [x] `go vet ./...` passes
- [x] `gofmt` check passes
- [x] Manual testing confirms ID is now correctly passed to API
- [ ] CI passes

Reviewed-on: https://gitea.com/gitea/tea/pulls/865
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Alain Thiffault <athiffau@effectivemomentum.com>
Co-committed-by: Alain Thiffault <athiffau@effectivemomentum.com>
2026-01-25 23:36:42 +00:00