feat(issues): attach labels, assignee and milestone on create #17

Merged
dsh merged 1 commit from feat/6-issue-create-labels into master 2026-10-23 22:54:42 +00:00
Owner

What

gitea_issue_create could not attach labels, assignee or milestone: the tool definition did not declare them (so the harness dropped them) and the handler forwarded only title/body.

This PR:

  • declares labels (array of names or numeric ids), assignee (login) and milestone (number);
  • resolves label names case-insensitively against listLabels (limit 100), keeps numeric ids, preserves the caller's order and deduplicates;
  • fails the call on an unknown name instead of opening a silently unlabeled issue;
  • validates milestone is numeric;
  • echoes what was attached: #1 "…" opened with labels [type/bug] assigned to @dsh milestone #2 (Probe #6).

Verification

  • test/issue-create.test.mjs: name resolution (case-insensitive), mixed name/id ordering, dedup, unknown-name failure (no create call), non-array labels, assignee/milestone forwarding, invalid milestone, echo output, label-less echo.
  • npm test 74/74, leak scan clean, node --check clean.
  • Live on ml-lab/tardits:
    • labels: ["TYPE/BUG", "does-not-exist"] → unknown label name(s): does-not-exist…, no issue created;
    • labels: ["TYPE/BUG"], assignee: "dsh", milestone: 2 → #1 "…" opened with labels [type/bug] assigned to @dsh milestone #2 (Probe #6);
    • issue closed and the probe milestone deleted afterwards.

Acceptance (from #6)

  • Creating with labels in one call yields a labeled issue.
  • Unknown label name → error, not a silently unlabeled issue.
  • Assignee/milestone accepted.

Closes #6.

## What `gitea_issue_create` could not attach `labels`, `assignee` or `milestone`: the tool definition did not declare them (so the harness dropped them) and the handler forwarded only `title`/`body`. This PR: - declares `labels` (array of names or numeric ids), `assignee` (login) and `milestone` (number); - resolves label names case-insensitively against `listLabels` (limit 100), keeps numeric ids, preserves the caller's order and deduplicates; - **fails the call** on an unknown name instead of opening a silently unlabeled issue; - validates `milestone` is numeric; - echoes what was attached: `#1 "…" opened with labels [type/bug] assigned to @dsh milestone #2 (Probe #6)`. ## Verification - `test/issue-create.test.mjs`: name resolution (case-insensitive), mixed name/id ordering, dedup, unknown-name failure (no create call), non-array labels, assignee/milestone forwarding, invalid milestone, echo output, label-less echo. - `npm test` 74/74, leak scan clean, `node --check` clean. - Live on `ml-lab/tardits`: - `labels: ["TYPE/BUG", "does-not-exist"]` → `unknown label name(s): does-not-exist…`, no issue created; - `labels: ["TYPE/BUG"], assignee: "dsh", milestone: 2` → `#1 "…" opened with labels [type/bug] assigned to @dsh milestone #2 (Probe #6)`; - issue closed and the probe milestone deleted afterwards. ## Acceptance (from #6) - [x] Creating with labels in one call yields a labeled issue. - [x] Unknown label name → error, not a silently unlabeled issue. - [x] Assignee/milestone accepted. Closes #6.
The tool definition did not declare the fields and the handler forwarded only title/body. Resolve label names case-insensitively against listLabels, keep numeric ids, fail loudly on an unknown name, forward assignee/milestone, and echo what was attached.
dsh merged commit 69410483a6 into master 2026-10-23 22:54:42 +00:00
Sign in to join this conversation.
No description provided.