# tp issue

Issues on the repo's own forge, from the command line. Issues live on the
**release remote's Forgejo** (or Gitea) — GitHub is a mirror by convention
and never holds them.

## Commands

| Command | Does | Prints |
|---|---|---|
| `list` | open issues | `#N title` per line, ascending; nothing if none |
| `list closed` / `list all` | issues in that state | `#N [state] title` per line |
| `show N` | one issue with its comments | title, state, url, body, comments |
| `create TITLE [-body FILE\|-]` | opens an issue | `#N url` |
| `edit N [-title T] [-body FILE\|-]` | changes title and/or body | `#N url` |
| `comment N BODY...` | adds a comment | the comment's url |
| `close N` / `reopen N` | changes state | `#N -> closed\|open` |

`-json` on any subcommand prints the result as JSON instead — an issue
(`number`, `title`, `state`, `body`, `url`), a list of them, a comment, or
for `show` the issue with a `comments` list. `-body -` reads the body from
stdin. Flags may come before or after the arguments.

Listing reads every page of results and excludes pull requests. Any API
failure prints the HTTP status and the forge's message and exits 1; a
token the forge quotes back is redacted.

## Which forge and token

The same resolution as `tp release`, with no configuration of its own:

- **Remote** — `release_remote` in `task-plus.yml`, default `origin`.
- **Forge** — the remote's `forge:` override (or the legacy top-level
  `forge:`), else detected from the host name. Hosts without "forgejo",
  "gitea" or "codeberg" in the name need `forge: forgejo`.
- **API** — `https://<host>/api/v1/repos/<owner>/<repo>`, from an https,
  `git@host:` or `ssh://` remote. An ssh alias remote (`alias:owner/repo`)
  is refused: its web host is unknown.
- **Token** — the remote's `token_env` variable; if unset in the
  environment, fetched through `secrets_provider: bitwarden` (needs
  `tp unlock`). With no `token_env` requests go unauthenticated, which
  works for reading a public repo; writes refuse to run without a token.

```yaml
remotes:
  - name: origin
    forge: forgejo
    token_env: BYTESTONE_FORGEJO_TOKEN
```
