49 lines
2.5 KiB
Markdown
49 lines
2.5 KiB
Markdown
---
|
|
name: issue
|
|
description: Create a Gitea issue in the project's canonical format. Run when the user asks to file/create an issue, or types /tea:issue. Ensures exclusive type/* labels exist, composes the body from the type's template, and posts via tea api. Format lives in the use skill's references.
|
|
---
|
|
|
|
# /tea:issue — create an issue in the canonical format
|
|
|
|
Thin procedure on top of the canonical format defined in
|
|
[`../use/references/issue-format.md`](../use/references/issue-format.md).
|
|
Read that file first — it is the single source of truth for types, labels,
|
|
templates, and language rules. Login rules are the same as everywhere:
|
|
always `--login "$GITEA_LOGIN"`, never a literal name (see `/tea:use`).
|
|
|
|
## Steps
|
|
|
|
1. **Read the format**: load `../use/references/issue-format.md`.
|
|
2. **Pick the type** — `bug`, `feature`, `refactor`, or `draft` (for ideas
|
|
not ready for work). If it is not obvious from the request, ask the user
|
|
(one question).
|
|
3. **Ensure labels exist**: `tea labels list --login "$GITEA_LOGIN" -o json`.
|
|
For each missing `type/*` label, create it via `tea api` with
|
|
`"exclusive": true` exactly as shown in the format doc. Do NOT use
|
|
`tea labels create` for these — it cannot set exclusivity.
|
|
4. **Compose title and body** per the format: English imperative title without
|
|
a type prefix; the type's template with all sections present, in order,
|
|
headers in English, prose in Russian; `## Spec` filled with a repo path,
|
|
a URL, or the literal `none` — ask the user if you cannot determine which.
|
|
5. **Post via tmp/ + tea api** (the body is always multi-line, so entity
|
|
commands are off the table — see "Rich payloads" in `/tea:use`):
|
|
```bash
|
|
mkdir -p tmp/issue
|
|
# write {"title": "...", "body": "...", "labels": [<type-label-id>]} as JSON
|
|
tea api --login "$GITEA_LOGIN" -X POST -d @tmp/issue/<slug>.json \
|
|
repos/{owner}/{repo}/issues
|
|
```
|
|
The create endpoint takes label **IDs** (integers), not names — take them
|
|
from the `tea labels list` output of step 3 (or from the create response).
|
|
If labels fail to attach on create, fall back to
|
|
`PUT repos/{owner}/{repo}/issues/{n}/labels` with `{"labels": [<id>]}`.
|
|
6. **Report**: show the issue URL and the applied `type/*` label.
|
|
|
|
## Editing an existing issue
|
|
|
|
When asked to bring an existing issue to the format: fetch it
|
|
(`tea issues <n> --login "$GITEA_LOGIN" -o json`), restructure the body into
|
|
the type's template without losing information, then
|
|
`PATCH repos/{owner}/{repo}/issues/{n}` with the new title/body and ensure
|
|
exactly one `type/*` label is set.
|