{"id":46838477,"url":"https://github.com/git-pkgs/forge","last_synced_at":"2026-04-01T18:34:51.226Z","repository":{"id":336893920,"uuid":"1151400145","full_name":"git-pkgs/forge","owner":"git-pkgs","description":"Go library and CLI for working with git forges. Supports GitHub, GitLab, Gitea/Forgejo, and Bitbucket Cloud through a single interface.","archived":false,"fork":false,"pushed_at":"2026-03-29T19:05:19.000Z","size":412,"stargazers_count":36,"open_issues_count":19,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-29T21:18:55.419Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/git-pkgs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-06T12:21:53.000Z","updated_at":"2026-03-29T19:04:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/git-pkgs/forge","commit_stats":null,"previous_names":["git-pkgs/forges","git-pkgs/forge"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/git-pkgs/forge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-pkgs%2Fforge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-pkgs%2Fforge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-pkgs%2Fforge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-pkgs%2Fforge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/git-pkgs","download_url":"https://codeload.github.com/git-pkgs/forge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-pkgs%2Fforge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-03-10T12:02:27.013Z","updated_at":"2026-04-01T18:34:51.218Z","avatar_url":"https://github.com/git-pkgs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# forges\n\nGo library and CLI for working with git forges. Supports GitHub, GitLab, Gitea/Forgejo, and Bitbucket Cloud through a single interface.\n\n## CLI\n\n```\ngo install github.com/git-pkgs/forge/cmd/forge@latest\n```\n\nThe CLI detects which forge to use from your git remote, or you can set it with `--forge-type`.\n\n```\nforge repo view\nforge issue list --state open\nforge pr create --title \"Fix bug\" --head fix-branch\nforge pr review approve 42\nforge pr reviewer request 42 alice bob\nforge release list\nforge ci list\nforge ci log 12345 --job 67890\nforge branch list\nforge label list\nforge notification list --unread\nforge notification read --id 123\nforge api repos/{owner}/{repo}\n```\n\nRun `forge --help` for the full command list.\n\n### Authentication\n\nStore tokens with `forge auth login`:\n\n```\nforge auth login                          # interactive: asks domain + token\nforge auth login --domain github.com --token ghp_abc123\nforge auth login --domain gitea.example.com --token abc123 --type gitea\n```\n\nCheck what's configured with `forge auth status`.\n\nTokens are resolved in this order: CLI flags, environment variables (`FORGE_TOKEN`, `GITHUB_TOKEN`/`GH_TOKEN`, `GITLAB_TOKEN`, `GITEA_TOKEN`, `BITBUCKET_TOKEN`), then the config file at `~/.config/forge/config`.\n\n### Configuration\n\nTwo config files, both INI-style:\n\n`~/.config/forge/config` stores tokens and user preferences (respects `XDG_CONFIG_HOME`):\n\n```ini\n[default]\noutput = json\n\n[github.com]\ntoken = ghp_abc123\n\n[gitea.example.com]\ntype = gitea\ntoken = abc123\n```\n\n`.forge` in the repo root is for per-project settings, committed to the repo, no tokens:\n\n```ini\n[default]\nforge-type = gitlab\n\n[gitlab.internal.dev]\ntype = gitlab\n```\n\nThis tells forge that the project uses GitLab and that `gitlab.internal.dev` is a GitLab instance, so contributors don't each need `--forge-type` or `FORGE_HOST`.\n\nPrecedence from highest to lowest: CLI flags, environment variables, `.forge`, `~/.config/forge/config`, built-in defaults.\n\n## Library\n\n```go\nimport \"github.com/git-pkgs/forge\"\n```\n\n```go\nclient := forges.NewClient(\n    forges.WithToken(\"github.com\", os.Getenv(\"GITHUB_TOKEN\")),\n    forges.WithToken(\"gitlab.com\", os.Getenv(\"GITLAB_TOKEN\")),\n)\n\nrepo, err := client.FetchRepository(ctx, \"https://github.com/octocat/hello-world\")\n```\n\nThe `Forge` interface exposes services for repos, issues, pull requests, reviews, releases, CI, branches, labels, milestones, deploy keys, secrets, and notifications. Each backend implements these using its native SDK.\n\n```go\nf, _ := client.ForgeFor(\"github.com\")\nissues, _ := f.Issues().List(ctx, \"octocat\", \"hello-world\", forges.ListIssueOpts{State: \"open\"})\npr, _ := f.PullRequests().Get(ctx, \"octocat\", \"hello-world\", 42)\n```\n\nSelf-hosted instances can be registered explicitly or detected automatically:\n\n```go\nclient := forges.NewClient(\n    forges.WithGitea(\"gitea.example.com\", token),\n    forges.WithGitLab(\"gitlab.internal.dev\", token),\n)\n\n// or auto-detect\nerr := client.RegisterDomain(ctx, \"git.example.com\", token)\n```\n\nPURL support via `github.com/git-pkgs/purl`:\n\n```go\np, _ := purl.Parse(\"pkg:npm/lodash?repository_url=https://github.com/lodash/lodash\")\nrepo, err := client.FetchRepositoryFromPURL(ctx, p)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgit-pkgs%2Fforge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgit-pkgs%2Fforge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgit-pkgs%2Fforge/lists"}