# Forgejo CLI (fj) Command-line interface for interacting with Forgejo repositories. ## Authentication The `fj` CLI authenticates via `fj auth login`. Credentials are stored locally by fj. ## Repository Detection `fj` automatically detects the repository from git remotes when run inside a git repository. ## Common Commands ### Issues ```bash # List issues fj issue search -s open # Open issues fj issue search -s closed # Closed issues fj issue search # All issues # View issue details fj issue view # Full issue details # Create issue fj issue create "" --body "<body>" # Edit issue fj issue edit <number> --title "<new-title>" fj issue edit <number> --body "<new-body>" # Close/reopen fj issue close <number> fj issue reopen <number> # Labels fj issue label add <number> <label> fj issue label remove <number> <label> ``` ### Pull Requests ```bash # List PRs fj pr search -s open # Open PRs fj pr search -s closed # Closed/merged PRs # View PR fj pr view <number> # PR details fj pr view <number> diff # PR diff # Create PR fj pr create "<title>" --body "<body>" fj pr create "<title>" --body "Closes #<issue>" # Comment on PR fj pr comment <number> "<comment>" # Merge fj pr merge <number> # Default merge fj pr merge <number> -d # Delete branch after merge fj pr merge <number> -M squash # Squash commits fj pr merge <number> -M rebase # Rebase commits fj pr merge <number> -M rebase-merge # Rebase then merge commit ``` ### Repository ```bash fj repo view # Repository info fj repo clone <owner>/<repo> # Clone repository ``` ## Output Formatting Most commands support `--output` flag: - `--output json` - Machine-readable JSON - `--output table` - Tabular format (default for lists) - `--output simple` - Plain text ## Tips - Always verify you're in the correct repository before running commands - Use `fj issue search` to find issue numbers before viewing/editing - Reference issues in PR bodies with `Closes #N` for auto-linking