{"id":15633613,"url":"https://github.com/hmarr/codeowners","last_synced_at":"2025-05-14T19:02:01.568Z","repository":{"id":43289759,"uuid":"282309982","full_name":"hmarr/codeowners","owner":"hmarr","description":"🔒 Command line tool and Go library for CODEOWNERS files","archived":false,"fork":false,"pushed_at":"2025-02-03T09:42:39.000Z","size":66,"stargazers_count":195,"open_issues_count":12,"forks_count":23,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T13:18:13.142Z","etag":null,"topics":["cli","codeowners","go"],"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/hmarr.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":"codeowners.go","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-24T20:26:41.000Z","updated_at":"2025-04-08T14:38:57.000Z","dependencies_parsed_at":"2025-02-28T18:05:32.415Z","dependency_job_id":"25a66901-64ab-4bd1-ad61-34fcfa9cc6c6","html_url":"https://github.com/hmarr/codeowners","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmarr%2Fcodeowners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmarr%2Fcodeowners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmarr%2Fcodeowners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmarr%2Fcodeowners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hmarr","download_url":"https://codeload.github.com/hmarr/codeowners/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717240,"owners_count":21150390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cli","codeowners","go"],"created_at":"2024-10-03T10:49:37.356Z","updated_at":"2025-04-13T13:18:20.407Z","avatar_url":"https://github.com/hmarr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# codeowners\n\n![build](https://github.com/hmarr/codeowners/workflows/build/badge.svg)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/hmarr/codeowners)](https://pkg.go.dev/github.com/hmarr/codeowners)\n\nA CLI and Go library for GitHub's [CODEOWNERS file](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax).\n\n## Command line tool\n\nThe `codeowners` CLI identifies the owners for files in a local repository or directory.\n\n### Installation\n\nIf you're on macOS, you can install the CLI from the [homebrew tap](https://github.com/hmarr/homebrew-tap#codeowners).\n\n```console\n$ brew tap hmarr/tap\n$ brew install codeowners\n```\n\nOtherwise, grab a binary from the [releases page](https://github.com/hmarr/codeowners/releases) or install from source with `go install`:\n\n```console\n$ go install github.com/hmarr/codeowners/cmd/codeowners@latest\n```\n\n### Usage\n\nBy default, the command line tool will walk the directory tree, printing the code owners of any files that are found.\n\n```console\n$ codeowners --help\nusage: codeowners \u003cpath\u003e...\n  -f, --file string     CODEOWNERS file path\n  -h, --help            show this help message\n  -o, --owner strings   filter results by owner\n  -u, --unowned         only show unowned files (can be combined with -o)\n\n$ ls\nCODEOWNERS       DOCUMENTATION.md README.md        example.go       example_test.go\n\n$ cat CODEOWNERS\n*.go       @example/go-engineers\n*.md       @example/docs-writers\nREADME.md  product-manager@example.com\n\n$ codeowners\nCODEOWNERS                           (unowned)\nREADME.md                            product-manager@example.com\nexample_test.go                      @example/go-engineers\nexample.go                           @example/go-engineers\nDOCUMENTATION.md                     @example/docs-writers\n```\n\nTo limit the files the tool looks at, provide one or more paths as arguments.\n\n```console\n$ codeowners *.md\nREADME.md                            product-manager@example.com\nDOCUMENTATION.md                     @example/docs-writers\n```\n\nPass the `--owner` flag to filter results by a specific owner.\n\n```console\n$ codeowners -o @example/go-engineers\nexample_test.go                      @example/go-engineers\nexample.go                           @example/go-engineers\n```\n\nPass the `--unowned` flag to only show unowned files.\n\n```console\n$ codeowners -u\nCODEOWNERS                           (unowned)\n```\n\n## Go library\n\nA package for parsing CODEOWNERS files and matching files to owners.\n\n### Installation\n\n```console\n$ go get github.com/hmarr/codeowners\n```\n\n### Usage\n\nFull documentation is available at [pkg.go.dev](https://pkg.go.dev/github.com/hmarr/codeowners).\n\nHere's a quick example to get you started:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/hmarr/codeowners\"\n)\n\nfunc main() {\n\tfile, err := os.Open(\"CODEOWNERS\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\truleset, err := codeowners.ParseFile(file)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\trule, err := ruleset.Match(\"path/to/file\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"Owners: %v\\n\", rule.Owners)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmarr%2Fcodeowners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhmarr%2Fcodeowners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmarr%2Fcodeowners/lists"}