fj/CHANGELOG.md
sid e3d7904929 feat: repo archive/unarchive + completion install
- fgj repo {archive,unarchive}: toggle a repo's archived state via
  EditRepo with *bool Archived. Archive prompts for confirmation
  (requires --yes in non-TTY envs); unarchive is reversible, no prompt.
  Accepts positional owner/name or -R flag; -R wins when both given.

- fgj completion install [shell]: idempotent install of completion
  scripts to shell-standard locations. Auto-detects shell from $SHELL
  if omitted. Paths: bash → XDG (or brew prefix on macOS), zsh →
  ~/.zsh/completions/_fgj, fish → ~/.config/fish/completions/fgj.fish.
  --system (bash only) prints the sudo command for /etc paths without
  writing. --dry-run prints the target path without writing.
  Compares existing-file contents before overwrite to stay idempotent.

Both files built by sub-agents in parallel. Build + vet + test clean.
2026-04-19 23:12:12 -06:00

341 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] — 0.4.0
### Added — Repository Management
- `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`,
`--private`, `--archived`.
- `fgj repo migrate` — import from GitHub, GitLab, Gitea, Gogs, or
a plain Git remote; supports mirror mode and selective import of
wiki/labels/milestones/issues/PRs/releases/LFS.
- `fgj repo create-from-template` — scaffold a repo from a template,
with fine-grained control over what to copy (content, topics,
labels, webhooks, git hooks, avatar).
### Added — Pull Requests
- `fgj pr clean <n>` — delete the local branch created by
`fgj pr checkout`. Refuses if the PR is open (use `--force`) or
if the branch is currently checked out.
- `fgj pr approve <n>` / `fgj pr reject <n>` — shortcuts over
`pr review`; `reject` requires a body.
- `fgj pr review-comments <n>` — list inline review comments across
every review on a PR.
- `fgj pr resolve <comment-id>` / `fgj pr unresolve <comment-id>`
mark review threads (un)resolved. Requires Forgejo 8.x+ /
Gitea 1.22+ server-side.
### Added — Notifications & Organizations
- `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
the default browser; auto-detects issue-vs-PR; prints URL on
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`.
- `fgj repo {archive,unarchive}` — toggle a repository's archived state
via `EditRepo`. Archiving prompts for confirmation (requires `--yes`
in non-TTY environments); unarchiving is reversible and skips the
prompt.
- `fgj completion install [shell]` — idempotently writes the
completion script to the shell-standard location (XDG for bash,
`~/.zsh/completions/_fgj` for zsh, `~/.config/fish/completions/fgj.fish`
for fish; brew prefix on macOS when present). Supports `--dry-run`
and `--system` (bash only, prints the required sudo command).
### Changed
- `fgj actions secret create` stdin handling reworked. Adds `--body`
(inline) and `--body-file` (path or `-` for stdin) flags; interactive
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).
### Development
- Switched to standard semver tags (`v0.3.1`, `v0.4.0`, …); retired
letter-suffix scheme (`v0.3.0a``v0.3.0f`) which Go's module resolver
ignored, leaving `go install @latest` pointing at the pre-migration
`v0.3.0` tag.
- Version string is now injected at build time via `-ldflags`; the
hardcoded constant in `cmd/root.go` has been replaced with a
`var version = "dev"` fallback. `make build` derives the version from
`git describe --tags --always --dirty`.
- Added `.goreleaser.yaml` for multi-platform release builds
(linux/darwin/windows/freebsd × amd64/arm64/arm) with SHA256
checksums and auto-generated release notes.
- Added `.gitea/workflows/release.yml` that publishes release artifacts
to the Forgejo release page on tag push.
- Aligned CI Go version (`1.24`) with `go.mod`; previously CI ran on
`1.21` while `go.mod` required `1.24`.
## [0.3.1] - 2026-04-19
### Fixed
- `go install forgejo.zerova.net/public/fgj-sid@latest` now resolves
correctly. Previous releases used letter-suffix tags (`v0.3.0a``f`)
which are not valid Go module versions and were ignored by the
module resolver, leaving `@latest` pinned to `v0.3.0` — a commit
that predates the module-path migration from `codeberg.org/romaintb/fgj`.
## [0.3.0c] - 2026-03-21
### Added
#### Label Management
- `fgj label list` - List repository labels
- `fgj label create` - Create a label with color and description
- `fgj label edit` - Edit label name, color, or description
- `fgj label delete` - Delete a label
#### Milestone Management
- `fgj milestone list` - List milestones with state filtering
- `fgj milestone view` - View milestone details
- `fgj milestone create` - Create a milestone with description and due date
- `fgj milestone edit` - Edit milestone title, description, due date, or state
- `fgj milestone delete` - Delete a milestone
#### Wiki Management
- `fgj wiki list` - List wiki pages
- `fgj wiki view` - View wiki page content
- `fgj wiki create` - Create a wiki page from flag or file
- `fgj wiki edit` - Edit a wiki page
- `fgj wiki delete` - Delete a wiki page
#### Issue Dependencies
- `fgj issue edit --add-dependency <number>` - Add issue dependency
- `fgj issue edit --remove-dependency <number>` - Remove issue dependency
## [0.3.0b] - 2026-03-21
### Added
#### Repository Management
- `fgj repo edit` - Edit repository settings (visibility, description, homepage, default branch)
### Fixed
- `fgj repo create --public` flag was defined but never read; now properly wired up
## [0.3.0a] - 2026-03-21
### Added
#### Raw API Access
- `fgj api <endpoint>` - Make authenticated REST API requests to any Forgejo/Gitea endpoint
- HTTP method selection (`--method`/`-X`), auto-switches to POST when fields are provided
- JSON field assembly (`--field`/`-f`) with type inference (bool, int, float, null, string)
- Raw string fields (`--raw-field`/`-F`)
- Request body from file or stdin (`--input`)
- Custom headers (`--header`/`-H`)
- Path interpolation (`{owner}`, `{repo}`) from git context
- Response header display (`--include`/`-i`)
#### Pull Request Management
- `fgj pr diff <number>` - View the diff for a pull request
- Colorized output (`--color auto/always/never`)
- Changed file names only (`--name-only`)
- Diffstat summary (`--stat`)
- `fgj pr comment <number>` - Add a comment to a pull request
- Body from flag (`--body`/`-b`) or file (`--body-file`, `-` for stdin)
- JSON output (`--json`)
- `fgj pr review <number>` - Submit a review on a pull request
- Approve (`--approve`/`-a`), request changes (`--request-changes`/`-r`), or comment (`--comment`/`-c`)
- Body from flag or file
- JSON output (`--json`)
#### Agentic / Machine-Readable Output
- `--json-errors` global flag for structured JSON error output on stderr
- Error codes: `auth_required`, `not_found`, `api_error`, `invalid_input`, `git_detection_failed`, `network_error`
- HTTP status code and detail included when available
- Automatic mapping of API errors (401/403 → `auth_required`, 404 → `not_found`)
## [0.3.0] - 2026-03-13
### Added
#### Forgejo Actions
- `fgj actions run watch <run-id>` - Poll a run until completion
- `fgj actions run rerun <run-id>` - Trigger a rerun of a workflow run
- `fgj actions run cancel <run-id>` - Cancel an in-progress workflow run
- `fgj actions workflow enable <workflow>` - Enable a workflow
- `fgj actions workflow disable <workflow>` - Disable a workflow
#### Repository Management
- `fgj repo create <name>` - Create a new repository with full option set: `--private`/`--public`, `--description`, `--add-readme`, `--gitignore`, `--license`, `--homepage`, `--clone`, `--team`
#### Issue Management
- `fgj issue create -l <label>` - Assign labels when creating an issue
- `fgj issue edit --add-label` / `--remove-label` - Add or remove labels on existing issues
- `fgj issue close -c <comment>` - Close an issue with an optional comment
#### Workflow Management
- `fgj actions workflow list/view/run` - List, view, and trigger workflows
#### Auth Helpers
- `fgj auth token` - Print the stored token for the current host
- `fgj auth logout` - Remove authentication for a host
#### Shell Completions and Man Pages
- `fgj completion [bash|zsh|fish|powershell]` - Generate shell completion scripts
- `fgj manpages --dir <path>` - Generate man pages for all commands
#### JSON Output
- `--json` flag for all list and view commands: PRs, issues, releases, workflow runs, workflows
### Fixed
- Respect `$XDG_CONFIG_HOME` for config file location (was always using `~/.config`)
## [0.2.0] - 2026-01-09
### Added
#### Release Management
- `fgj release list` - List releases for a repository
- `fgj release view` - View details of a specific release (supports "latest" keyword)
- `fgj release create` - Create new releases with optional asset uploads
- `fgj release upload` - Upload assets to existing releases with optional clobber support
- `fgj release delete` - Delete releases (preserves Git tags)
#### Issue Management
- `fgj issue edit` - Edit existing issues with support for updating title, body, and labels
#### Pull Request Management
- `fgj pr create --assignee` - Assign users when creating pull requests
#### Repository Detection
- Automatic hostname detection from git remote URLs
- Improved multi-instance support with auto-detection from git context
### Improved
- Enhanced documentation with AUR and Homebrew installation instructions
- Added functional tests for release management and issue editing
- Added Makefile `install` target for easier local installation
- Added `.editorconfig` for consistent code formatting
### Development
- CI: Added nightly builds for continuous testing
- Expanded functional test coverage for new features
## [0.1.0] - 2025-12-16
### Added
#### Core Features
- Initial release of fgj - Forgejo CLI tool
- Multi-instance support for any Forgejo/Gitea instance
- Automatic repository detection from git context (optional `-R` flag)
- Secure authentication with personal access tokens
- Configuration management via `~/.config/fgj/config.yaml`
#### Pull Request Management
- `fgj pr list` - List pull requests with filtering by state
- `fgj pr view` - View detailed pull request information
- `fgj pr create` - Create new pull requests
- `fgj pr merge` - Merge pull requests with configurable merge methods
#### Issue Management
- `fgj issue list` - List issues with state filtering
- `fgj issue view` - View detailed issue information
- `fgj issue create` - Create new issues
- `fgj issue comment` - Add comments to issues
- `fgj issue close` - Close issues
#### Repository Operations
- `fgj repo view` - View repository details
- `fgj repo list` - List user repositories
- `fgj repo clone` - Clone repositories with protocol selection (HTTPS/SSH)
- `fgj repo fork` - Fork repositories
#### Forgejo Actions Support
- `fgj actions run list` - List workflow runs with status and metadata
- `fgj actions run view` - View detailed run information, jobs, and logs
- Support for `--verbose`, `--log`, `--log-failed`, and `--job` flags
- `fgj actions secret list` - List repository secrets
- `fgj actions secret create` - Create repository secrets
- `fgj actions secret delete` - Delete repository secrets
- `fgj actions variable list` - List repository variables
- `fgj actions variable get` - Get variable values
- `fgj actions variable create` - Create repository variables
- `fgj actions variable update` - Update repository variables
- `fgj actions variable delete` - Delete repository variables
#### Authentication
- `fgj auth login` - Interactive authentication with Forgejo instances
- `fgj auth status` - Check authentication status
- Environment variable support (`FGJ_HOST`, `FGJ_TOKEN`)
#### Development
- Comprehensive unit test suite
- Functional end-to-end tests
- CI/CD pipeline with automated testing
- Code quality checks and linting
### Technical Details
- Built with Go 1.23+
- Uses Gitea SDK for API interactions
- Cobra framework for CLI structure
- Viper for configuration management
[0.3.0c]: https://forgejo.zerova.net/public/fgj-sid/releases/tag/v0.3.0c
[0.3.0b]: https://forgejo.zerova.net/public/fgj-sid/releases/tag/v0.3.0b
[0.3.0a]: https://forgejo.zerova.net/public/fgj-sid/releases/tag/v0.3.0a
[0.3.0]: https://codeberg.org/romaintb/fgj/releases/tag/v0.3.0
[0.2.0]: https://codeberg.org/romaintb/fgj/releases/tag/v0.2.0
[0.1.0]: https://codeberg.org/romaintb/fgj/releases/tag/v0.1.0