feat: auto detect hostname
This commit is contained in:
parent
2c27823e18
commit
c0baf4fa3b
13 changed files with 300 additions and 125 deletions
18
README.md
18
README.md
|
|
@ -87,12 +87,12 @@ fgj pr view 123 # Automatically uses current repo
|
|||
fgj pr list -R owner/repo
|
||||
```
|
||||
|
||||
The tool reads `.git/config` to find the origin remote and extract the owner/repo information. If you're not in a git repository, you'll need to use the `-R` flag.
|
||||
The tool reads `.git/config` to find the origin remote and extract both the owner/repo information and the Forgejo instance hostname. If you're not in a git repository, you'll need to use the `-R` flag.
|
||||
|
||||
### Pull Requests
|
||||
|
||||
```bash
|
||||
# List pull requests (auto-detects repo from git)
|
||||
# List pull requests (auto-detects repo and hostname from git)
|
||||
fgj pr list
|
||||
|
||||
# Or specify explicitly
|
||||
|
|
@ -114,7 +114,7 @@ fgj pr merge 123 --merge-method squash
|
|||
### Issues
|
||||
|
||||
```bash
|
||||
# List issues (auto-detects repo from git)
|
||||
# List issues (auto-detects repo and hostname from git)
|
||||
fgj issue list
|
||||
|
||||
# Or specify explicitly
|
||||
|
|
@ -237,14 +237,22 @@ hosts:
|
|||
|
||||
### Environment Variables
|
||||
|
||||
- `FGJ_HOST`: Override the default Forgejo instance
|
||||
- `FGJ_HOST`: Override the default Forgejo instance (auto-detected from git remote if not set)
|
||||
- `FGJ_TOKEN`: Provide authentication token
|
||||
|
||||
Hostname is resolved in this priority order:
|
||||
1. Command-specific flags (e.g., `--hostname`)
|
||||
2. `FGJ_HOST` environment variable
|
||||
3. Auto-detected from git remote URL
|
||||
4. Default to `codeberg.org`
|
||||
|
||||
### Command-line Flags
|
||||
|
||||
- `--hostname`: Specify Forgejo instance for a command
|
||||
- `--hostname`: Specify Forgejo instance for a command (overrides auto-detection and environment variables)
|
||||
- `--config`: Use a custom config file
|
||||
|
||||
When working in a git repository, `fgj` automatically detects the Forgejo instance from your origin remote URL, so you typically don't need to specify `--hostname` unless working with multiple instances.
|
||||
|
||||
## Use with AI Coding Agents
|
||||
|
||||
`fgj` is designed to work seamlessly with AI coding agents like Claude Code. Common patterns:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue