feat: logins list/default, actions run delete, date filters, label update alias

- fgj logins {list,default}: complementary UI to 'fgj auth'. 'list'
  shows all configured hosts (hostname, user, protocol, default flag,
  match_dirs) with --json. 'default [hostname]' gets or sets which
  host wins in resolution when no other signal is present.
  Adds 'Default bool' field to HostConfig; GetHost consults it between
  match_dirs and the codeberg.org fallback. Multiple defaults tolerated
  with a stderr warning; alphabetical-first wins.

- fgj actions run delete: delete a completed workflow run via raw
  DELETE (SDK v0.23.2 has no DeleteRepoActionRun). Fetches run first
  and refuses to delete non-terminal states unless --force; suggests
  'actions run cancel' for those. Confirmation prompt unless --yes.

- pr list / issue list gain --since and --before date filter flags.
  Accepts YYYY-MM-DD, RFC 3339, YYYY-MM-DD HH:MM:SS, and relative
  deltas (7d, 24h, 2w, 1m — months=30 days). Issues use server-side
  filter via ListIssueOption.Since/Before; PRs fall back to client-side
  (SDK lacks Since/Before on ListPullRequestsOptions).

- fgj label update added as alias for 'fgj label edit' (tea-compat).

All changes:
  cmd/logins.go (new, 140 LOC)
  cmd/actions_run_delete.go (new, ~85 LOC)
  cmd/pr.go, cmd/issue.go (+parseDateArg helper, filter wiring)
  cmd/label.go (1-line alias)
  internal/config/config.go (Default field + DefaultHost method)
  CHANGELOG.md
Built in parallel by three sub-agents; plus the label alias done
serially. go build / go vet / go test -race all clean.
This commit is contained in:
sid 2026-04-19 23:04:33 -06:00
parent d15deaf064
commit 2d69873f3e
7 changed files with 462 additions and 7 deletions

View file

@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `fgj branch {list,rename,delete}` — list branches with protection
status, rename branches, delete (protected branches are refused).
- `fgj branch {protect,unprotect}` — create, replace, or remove branch
protection rules with `--require-approvals`,
`--dismiss-stale-approvals`, `--require-signed-commits`,
`--block-on-rejected-reviews`, `--block-on-outdated-branch`,
`--push-whitelist`, `--merge-whitelist`, `--require-status-checks`.
`protect` is idempotent (create-or-edit).
- `fgj repo delete` — type-to-confirm deletion; `--yes` for scripts.
- `fgj repo search` — search repositories on the current host by
query, topic, or description; filter by `--type`, `--owner`,
@ -40,12 +46,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `fgj notification list [--all]` / `fgj notification read <id>`
list unread (default) or all notifications; mark individual
threads read.
- `fgj notification {unread,pin,unpin}` — flip thread state
(complements `read`). Uses the Gitea `NotifyStatus` enum.
- `fgj org {list,create,delete}` — list your orgs, create with
visibility/description, delete with confirmation.
- `fgj webhook {list,create,update,delete}` — full CRUD on repo
webhooks: gitea/slack/discord/etc. hook types, event selection,
content type, secret, branch filter, auth header.
### Added — Releases, Actions, Milestones, Time
- `fgj release asset {list,create,delete}` — granular release
attachment management. `delete` accepts numeric IDs or filenames.
- `fgj actions run delete` — delete a completed workflow run. Refuses
non-terminal runs unless `--force`; suggests `actions run cancel`
for those.
- `fgj milestone issues {add,remove}` — associate or disassociate
issues with a milestone. Milestone accepted as title or id.
- `fgj time {list,add,delete,reset}` — tracked-time management. Accepts
Go duration strings (`30m`, `1h30m`). `list` with no arg shows the
authenticated user's times across all repos.
### Added — Misc
- `fgj open [number] [--url]` — launch the repo / issue / PR page in
@ -53,6 +74,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
non-TTY stdout or with `--url`.
- `fgj whoami` — show the authenticated user and host.
- `fgj admin user list` — admin-gated user enumeration.
- `fgj logins {list,default}` — complement to `fgj auth`. `list` shows
all configured hosts in a table, highlighting the default. `default`
gets/sets which hostname wins when no other signal is present.
- `pr list` / `issue list` gain `--since` and `--before` flags
accepting `YYYY-MM-DD`, RFC 3339, `YYYY-MM-DD HH:MM:SS`, or relative
deltas (`7d`, `24h`, `2w`, `1m`). Server-side filter for issues,
client-side for PRs (SDK lacks a PR-side filter).
- `fgj label update` added as an alias for `fgj label edit`.
### Changed
@ -61,6 +90,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
prompts now use hidden input via `term.ReadPassword`; piped stdin is
read whole (prior `fmt.Scanln` broke on spaces/newlines and echoed
the typed value). Empty values are rejected.
- `HostConfig` gains an optional `default: true` field. When no other
signal selects a host (flag, `FGJ_HOST`, git remote, `match_dirs`),
the host marked default wins before the `codeberg.org` fallback.
Multiple `default: true` entries are tolerated with a stderr
warning; alphabetical-first wins.
- Gitea SDK bumped `v0.22.1``v0.23.2` (last release compatible with
Go 1.24; `v0.24+` requires Go 1.26).