Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ GitHub Brain also includes a web-based UI for ultra-fast search:

And a Raycast extension:



![](./docs/raycast.png)

GitHub Brain is [programmed in Markdown](https://github.blog/ai-and-ml/generative-ai/spec-driven-development-using-markdown-as-a-programming-language-when-building-with-ai/).
Expand All @@ -46,8 +44,9 @@ github-brain <command> [<args>]

**Workflow:**

1. Use `pull` to populate the local database
2. Use `mcp` to start the MCP server
1. Use `login` to authenticate with GitHub (or set `GITHUB_TOKEN` manually)
2. Use `pull` to populate the local database
3. Use `mcp` to start the MCP server

Re-run `pull` anytime to update the database with new GitHub data.

Expand All @@ -62,6 +61,21 @@ You can change the home directory with the `-m` argument available for all comma

</details>

### `login`

Opens your browser to authorize _GitHub Brain_ app and stores resulting `GITHUB_TOKEN` in the `.env` file.
Optionally, you can also specify `ORGANIZATION` to store in the same file.

Example:

```sh
github-brain login
```

| Argument | Description |
| :------- | :----------------------------------------- |
| `-m` | Home directory. Default: `~/.github-brain` |

### `pull`

Populate the local database with GitHub data.
Expand All @@ -74,14 +88,14 @@ github-brain pull -o my-org

The first run may take a while. Subsequent runs are faster, fetching only new data.

| Argument | Variable | Description |
| :------- | :---------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-t` | `GITHUB_TOKEN` | Your GitHub [personal token](https://github.com/settings/personal-access-tokens) to access the API. **Required.** |
| `-o` | `ORGANIZATION` | The GitHub organization to pull data from. **Required.** |
| `-m` | | Home directory. Default: `~/.github-brain` (or checkout directory if run via `scripts/run`). |
| `-i` | | Pull only selected entities: `repositories`, `discussions`, `issues`, `pull-requests` (comma-separated). |
| `-f` | | Remove all data before pulling. With `-i`, removes only specified items. |
| `-e` | `EXCLUDED_REPOSITORIES` | Repositories to exclude (comma-separated). Useful for large repos not relevant to your analysis. |
| Argument | Variable | Description |
| :------- | :---------------------- | :------------------------------------------------------------------------------------------------------------------------------------- |
| | `GITHUB_TOKEN` | Your GitHub token. Use `login` command or create a [personal token](https://github.com/settings/personal-access-tokens). **Required.** |
| `-o` | `ORGANIZATION` | The GitHub organization to pull data from. **Required.** |
| `-m` | | Home directory. Default: `~/.github-brain` |
| `-i` | | Pull only selected entities: `repositories`, `discussions`, `issues`, `pull-requests` (comma-separated). |
| `-f` | | Remove all data before pulling. With `-i`, removes only specified items. |
| `-e` | `EXCLUDED_REPOSITORIES` | Repositories to exclude (comma-separated). Useful for large repos not relevant to your analysis. |

<details>
<summary>Personal access token scopes</summary>
Expand All @@ -104,10 +118,10 @@ Example:
github-brain mcp -o my-org
```

| Argument | Variable | Description |
| :------- | :------------- | :-------------------------------------------------------------------------------------------------------------------- |
| `-o` | `ORGANIZATION` | GitHub organization. **Required.** |
| `-m` | | Home directory. Default: `~/.github-brain` (or checkout directory if run via `scripts/run`). |
| Argument | Variable | Description |
| :------- | :------------- | :------------------------------------------ |
| `-o` | `ORGANIZATION` | GitHub organization. **Required.** |
| `-m` | | Home directory. Default: `~/.github-brain` |

### `ui`

Expand All @@ -117,11 +131,11 @@ Start the web UI for quick searches (alternative to MCP).
github-brain ui -o my-org
```

| Argument | Variable | Description |
| :------- | :------------- | :-------------------------------------------------------------------------------------------------------------------- |
| `-o` | `ORGANIZATION` | GitHub organization. **Required.** |
| `-m` | | Home directory. Default: `~/.github-brain` (or checkout directory if run via `scripts/run`). |
| `-p` | `UI_PORT` | Port. Default: `8080`. |
| Argument | Variable | Description |
| :------- | :------------- | :------------------------------------------|
| `-o` | `ORGANIZATION` | GitHub organization. **Required.** |
| `-m` | | Home directory. Default: `~/.github-brain` |
| `-p` | `UI_PORT` | Port. Default: `8080`. |

### Additional Arguments

Expand Down Expand Up @@ -183,4 +197,4 @@ The extension uses the MCP server to search GitHub data.

## Development

`scripts/run` builds and runs `github-brain` with the checkout directory as home (database in `db/`, config in `.env`).
`scripts/run` builds and runs `github-brain` with the checkout directory as home `-m` (database in `db/`, config in `.env`).
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ require (
github.com/joho/godotenv v1.5.1
github.com/mattn/go-sqlite3 v1.14.28
github.com/modelcontextprotocol/go-sdk v1.1.0
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/shurcooL/githubv4 v0.0.0-20230704064427-599ae7bbf278
golang.org/x/oauth2 v0.30.0
)

require (
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/x/ansi v0.10.1 // indirect
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs=
Expand Down Expand Up @@ -40,6 +42,8 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand All @@ -56,6 +60,7 @@ golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
Expand Down
Loading