---
description: What the GitHub tracker can do for issue, epic, and initiative skills; operations, levels, categories, and visibility.
tags: [project-tracker, github, issue]
implements: project-tracker.capabilities@1
contract: 1
---
## Tracker

- Name: `github`
- Visibility: public for a public repository, private for a private one. Read it with `gh repo view --json isPrivate`.
- Levels held: issue, epic, initiative.
- Categories held: bug, feature, task.
- Needs `gh` 2.98.0 or later (`--type`, `--parent`, and `--add-sub-issue` arrived in 2.94.0; `--search-type` in 2.98.0). Check with `gh --version`; when older, tell the user to upgrade and stop.

## Detect

- The `origin` remote host is `github.com`: `git remote get-url origin`.
- `gh auth status` succeeds. When `gh` is missing or logged out, run the `init-buddy` skill if it is installed; otherwise tell the user to install and log in.
- The repository is `<owner>/<repo>` from the remote; pass it as `--repo` on every call.

## Kinds

Read the issue types of the repository:

```bash
gh api graphql -f query='{repository(owner:"<owner>",name:"<repo>"){issueTypes(first:20){nodes{name}}}}' \
  --jq '(.data.repository.issueTypes.nodes // [])[].name'
```

- Types come back (organization-owned repositories; defaults are `Bug`, `Feature`, `Task`): the type carries the category. Map bug to `Bug`, feature to `Feature`, task to `Task`. When a team renamed or removed a type, use the closest name from the list; when none fits, create the issue without a type and say so.
- `issueTypes` is `null` or empty (user-owned repositories have no issue types): the label carries the category. Bug is `bug`, feature is `enhancement`, task has no default label, so use `task` only when `gh label list --repo <owner>/<repo> --json name --jq '.[].name'` shows it. Never pass `--type` to such a repository: tested on a user-owned repository, `gh issue create --type Bug` creates the issue without a type and then exits 1 with `type "Bug" not found`, so a retry files a second copy.
- Level: an `epic` or `initiative` label. An issue with neither is an issue.
- Use only labels and types that exist. Do not create labels, except a missing level label after the user says yes to it (see **Retype**, Limits).

## Search

Run at least two passes:

```bash
gh issue list --repo <owner>/<repo> --state all --limit 10 \
  --search "<keywords> in:title,body" --json number,title,state,url
gh search issues "<keywords>" --repo <owner>/<repo> --search-type hybrid --limit 10 \
  --json number,title,state,url
```

Use the full title for the first pass and the core noun and verb for the second. Each hit is a number, title, state (open or closed), and URL.

## Create

```bash
gh issue create --repo <owner>/<repo> --title "<title>" --body-file <file> \
  [--type "<Bug|Feature|Task>"] [--label "<label>"...] [--parent <number|url>]
```

- Write the body to a temporary file and pass `--body-file`; never inline user text in the shell.
- Use `--type` when Kinds returned types; use `--label` for the category when it did not.
- For an epic, add `--label epic`; for an initiative, add `--label initiative`. Both keep the category type of the work.
- `--parent` attaches the new issue as a sub-issue of an existing one.
- `gh issue create` prints the URL of the new issue.
- When `gh issue create` exits non-zero, list the newest issues (`gh issue list --repo <owner>/<repo> --state all --limit 3`) before any retry: some failures leave an issue behind (`--type` on a repository without types does; a missing `--label` does not, it fails with `could not add label`).

## Link

- Child of: `--parent <number|url>` at create, or `gh issue edit <parent> --add-sub-issue <child>[,<child>...]` for existing issues. A child in another repository, even under another owner, attaches by its URL. Limits: 100 sub-issues per parent, 8 levels deep; read `subIssuesSummary` before attaching.
- Detach: `gh issue edit <parent> --remove-sub-issue <child>`.
- Blocked by or blocking, and related items: `gh issue edit <n> --add-blocked-by <other>`, or a line in the body (`Related to #12`) when the host does not support relationships (GitHub Enterprise Server before 3.19).
- Read the tree: `gh issue view <n> --json subIssues,subIssuesSummary,parent`.

## Retype

A level change on GitHub is in place, except epic → initiative: the item keeps its number, URL, comments, and type. Only the label changes, so the item stays in this repository; a level the routing puts on another tracker is a move, not a retype. Epic → initiative makes a new parent, because an initiative's body is a goal and a metric, not an outcome.

| Change | Steps | Open children |
|---|---|---|
| issue → epic | `gh issue edit <n> --add-label epic`; rewrite the body with `gh issue edit <n> --body-file <file>` when the skill moves its acceptance criteria into a child; then link the children | n/a: an issue has none |
| epic → initiative | a new item: run `Create` with `--label initiative`, then `gh issue edit <initiative> --add-sub-issue <epic>`; the epic keeps its label, body, and number | stay under the epic; the epic becomes the initiative's first epic |
| epic → issue | `gh issue edit <n> --remove-label epic` | kept as sub-issues unless the user asks to detach them; a child is never closed |
| initiative → epic | swap the label back: `--remove-label initiative --add-label epic`; rewrite the body with `gh issue edit <n> --body-file <file>` to drop the `Metric` section | kept as sub-issues unless the user asks to detach one (`--remove-sub-issue`); a child is never closed |

Limits: 100 children per parent, 8 levels. The level label must exist (`gh label list --repo <owner>/<repo> --search <label>`); when it does not, ask before creating it with `gh label create <label> --repo <owner>/<repo>`.

## Close

```bash
gh issue close <n> --repo <owner>/<repo> --reason "completed|not planned" [--comment "<why>"]
```

Done is `completed`. Not planned and moved are `not planned`; for moved, comment with the destination, unless the destination is a private tracker and this repository is public (then say only that it is tracked internally).

## Url

- `gh issue create` and `gh issue view <n> --json url --jq .url` print the URL.
- `https://github.com/<owner>/<repo>/issues/<n>` parses to repository and number.

## Ownership

```bash
gh repo view <owner>/<repo> --json viewerPermission --jq .viewerPermission
```

- `ADMIN` is `owned`. The owner of a user-owned repository always has `ADMIN` on it, and so does a person who administers an organization's repository. Tested: `ADMIN` on a user-owned and an organization-owned repository the user runs, `READ` on another owner's public repository.
- `MAINTAIN`, `WRITE`, `TRIAGE`, `READ`, or an empty value is `not owned`.
- A non-zero exit (the repository cannot be found, or `gh` is logged out) means unknown.

## Board

A board is a GitHub Projects board, named in the routing or by the user as `<owner>` and a project number. The token needs the `project` scope: `gh auth status` lists it, and `gh auth refresh -s project` adds it.

```bash
gh project item-add <number> --owner <owner> --url <issue-url> --format json --jq .id
gh project item-edit <number> --owner <owner> --url <issue-url> --field "<field>" --value "<option>"
```

- `item-add` prints the item's id.
- `item-edit` sets one field per call. A single-select field takes the option's name as `--value`. When `gh project item-edit --help` has no `--field` flag (an older `gh`), read the ids with `gh project field-list <number> --owner <owner> --format json` and pass `--project-id`, `--id`, `--field-id`, and `--single-select-option-id` instead.
- Read which boards an issue is on: `gh issue view <n> --repo <owner>/<repo> --json projectItems`.

## Transfer

```bash
gh issue transfer <n> <owner>/<destination-repo> --repo <owner>/<repo>
```

- The issue gets a new number and URL in the destination, and its old URL redirects to the new one. GitHub keeps a label or milestone only when the destination has one of the same name.
- Both repositories must have the same owner, the user needs write access to both, and an issue cannot move from a private repository to a public one.
- After the move, re-link it: read its new URL from `gh issue view <old-url> --json url --jq .url`, then rewrite every line in the parent's body that named the old reference, with a note such as `(moved from <owner>/<repo>#<n>)`. Then read the parent's tree with `Link`, and attach the issue again by its new URL when it is no longer a child.
- A transfer is irreversible in the sense of `project-tracker.executors`: it waits for a confirmation on the issue.

## Depend

Use the `epic-plan.mjs` script in the `epic` skill's `scripts/` folder, not a shell loop:

```bash
node <epic skill folder>/scripts/epic-plan.mjs depend --repo <owner>/<repo> --plan <plan.json> [--prune] [--write]
node <epic skill folder>/scripts/epic-plan.mjs graph --repo <owner>/<repo> --epic <n>
```

- `<plan.json>` maps each child to the full list of issues it is blocked by, such as `{"82": [], "84": ["83"]}`. Without `--write` the script prints the changes and writes nothing. With `--write` it runs one `gh issue edit <child> --add-blocked-by <a>,<b>` (and `--remove-blocked-by` with `--prune`) per child, reads each one back, and reports what did not verify. It refuses a plan with a cycle.
- `graph` prints each child's blockers, any blocker outside the epic, any cycle, and the waves of the run order.
- One link by hand: `gh issue edit <n> --repo <owner>/<repo> --add-blocked-by <other>`. Read them with `gh issue view <n> --json blockedBy,blocking`.

## Sync body

```bash
node <epic skill folder>/scripts/epic-plan.mjs sync-body --repo <owner>/<repo> --epic <n> [--write]
```

It rebuilds the `## Child Issues` list from the native sub-issues. It keeps the list's order, checks off closed children, fixes titles, appends new sub-issues, and drops lines for issues that are no longer children. It leaves every other line of the body as it is. Without `--write` it prints the new body and what changed. With `--write` it saves the body with `gh issue edit --body-file`.
