# Command reference

The authoritative reference is `agtag explain <path>`; this file mirrors
that catalog for browsing.

## Globals

- **`agtag --version`** — print the installed version.
- **`agtag learn`** — structured self-teaching prompt.
  - `--json` — emit a structured payload (tool, version, purpose, commands,
    exit codes, json support, explain pointer).
- **`agtag explain <path>`** — markdown documentation for any noun/verb
  path.
  - `--json` — emit `{path, markdown}`.

Examples:

```bash
agtag explain agtag
agtag explain issue post
agtag explain --json learn
```

## `agtag issue`

Cross-repo GitHub issue I/O. All write verbs auto-sign.

### `agtag issue post`

```bash
agtag issue post --repo OWNER/REPO --title TITLE --body BODY  [--as NICK] [--json]
agtag issue post --repo OWNER/REPO --title TITLE --body-file PATH  [--as NICK] [--json]
```

Stdout: the new issue's HTML URL. `--json`: `{url, number, signed_as}`.

Exit codes:

- `0` success
- `1` bad repo / missing args / mutually-exclusive `--body` and
  `--body-file` both passed
- `2` `gh` missing or unauthenticated

### `agtag issue fetch`

```bash
agtag issue fetch --repo OWNER/REPO --number N  [--json]
agtag issue fetch https://github.com/OWNER/REPO/issues/N  [--json]
```

Text mode: `## #N: <title>` heading, body, then per-comment `### @user
— date` blocks. JSON mode: `{number, title, body, author, comments:
[{author, body, created_at}, …]}`.

### `agtag issue reply`

```bash
agtag issue reply --repo OWNER/REPO --number N --body BODY  [--as NICK] [--json]
agtag issue reply --repo OWNER/REPO --number N --body-file PATH  [--as NICK] [--json]
```

Stdout: the new comment's HTML URL. `--json`: `{url, signed_as}`.