|
| 1 | +# Contributing to Komet Node |
| 2 | + |
| 3 | +## Development environment |
| 4 | + |
| 5 | +This repository ships a [devcontainer](.devcontainer/) that provisions the full |
| 6 | +toolchain (Nix, the flake's `nix develop` shell, the Claude Code CLI, and the |
| 7 | +GitHub CLI). Open the repo in a devcontainer-aware editor and everything below is |
| 8 | +available out of the box. |
| 9 | + |
| 10 | +## Using the GitHub CLI (`gh`) |
| 11 | + |
| 12 | +`gh` is preinstalled in the devcontainer for creating pull requests, reviewing |
| 13 | +issues, and other GitHub tasks from the terminal. |
| 14 | + |
| 15 | +### Authenticating |
| 16 | + |
| 17 | +Authenticate once with a personal access token: |
| 18 | + |
| 19 | +```bash |
| 20 | +gh auth login |
| 21 | +``` |
| 22 | + |
| 23 | +Choose **GitHub.com** → **HTTPS** → **Paste an authentication token** when |
| 24 | +prompted, then paste the token you create below. |
| 25 | + |
| 26 | +Your credentials are stored in `~/.config/gh` inside the container, which is |
| 27 | +backed by a named volume. This means **your token survives container rebuilds** — |
| 28 | +you only need to authenticate once, not every time the container is recreated. |
| 29 | + |
| 30 | +To check or reset your authentication at any time: |
| 31 | + |
| 32 | +```bash |
| 33 | +gh auth status # show the current login |
| 34 | +gh auth logout # remove stored credentials |
| 35 | +``` |
| 36 | + |
| 37 | +### Creating a token with minimal permissions |
| 38 | + |
| 39 | +Prefer **fine-grained personal access tokens** — they let you grant only the |
| 40 | +access you actually need, scoped to a single repository, with a short expiry. |
| 41 | +Please generate tokens with the **least privilege** required for your work; avoid |
| 42 | +broad "classic" tokens with the full `repo` scope unless there is no alternative. |
| 43 | + |
| 44 | +1. Go to **GitHub → Settings → Developer settings → |
| 45 | + [Fine-grained personal access tokens](https://github.com/settings/personal-access-tokens/new)**. |
| 46 | +2. Give the token a descriptive name and set the **shortest expiry** that fits |
| 47 | + your workflow. |
| 48 | +3. Under **Repository access**, choose **Only select repositories** and pick just |
| 49 | + `runtimeverification/komet-node` (or your fork) — not "All repositories". |
| 50 | +4. Under **Permissions → Repository permissions**, grant only what you need. For a |
| 51 | + typical contributor workflow that is: |
| 52 | + - **Contents** → *Read and write* (clone, pull, push branches) |
| 53 | + - **Pull requests** → *Read and write* (open and update PRs) |
| 54 | + - **Issues** → *Read and write* (only if you triage or comment on issues) |
| 55 | + |
| 56 | + `Metadata → Read` is required and is selected automatically. Leave every other |
| 57 | + permission at **No access**. |
| 58 | +5. Click **Generate token** and copy it — GitHub shows it only once. Paste it into |
| 59 | + the `gh auth login` prompt above. |
| 60 | + |
| 61 | +> [!TIP] |
| 62 | +> Start with the narrowest set of permissions and add more only if a command |
| 63 | +> fails with an authorization error. A token that can do less is a smaller risk |
| 64 | +> if it ever leaks. |
0 commit comments