Skip to content

feat: add work_item_update MCP tool#399

Merged
bakeb7j0 merged 1 commit intokahuna/390-bug-drainfrom
feature/287-work-item-update
May 5, 2026
Merged

feat: add work_item_update MCP tool#399
bakeb7j0 merged 1 commit intokahuna/390-bug-drainfrom
feature/287-work-item-update

Conversation

@bakeb7j0
Copy link
Copy Markdown
Contributor

@bakeb7j0 bakeb7j0 commented May 5, 2026

Summary

Adds work_item_update MCP tool to update existing GitHub/GitLab issues (title, body, body sections, labels, assignees, milestone). Mirrors work_item (create) shape via the platform adapter pattern.

Changes

  • New handlers/work_item_update.ts — adapter-dispatching handler with zod validation
  • New lib/adapters/work-item-update-github.tsgh issue edit adapter
  • New lib/adapters/work-item-update-gitlab.tsglab issue update adapter (milestone returns platform_unsupported)
  • New lib/work-item-section.ts — H2 section splicing helper
  • 48 new tests across handler + adapters + section helper
  • Wired into lib/adapters/types.ts PLATFORM_ADAPTER_METHODS and both adapter implementations

Tests

  • ✅ 2194 pass / 0 fail / 3 skip
  • ✅ All 48 new tests pass
  • ./scripts/ci/validate.sh green (76/76 tools registered)

Notes

GitLab milestone updates return platform_unsupportedglab issue update --milestone requires numeric milestone id resolution that's out of scope. Same asymmetry pattern as #281.

Closes #287

Sister tool to work_item (#341 / Story 2.17) — that one creates issues/PRs;
this one updates an existing GitHub/GitLab issue.

Patch shape supports:
- title — replace title
- body — replace full body
- body_section — replace ONE H2 section, preserving all other sections
  verbatim (the AC contract for #287; section is matched after
  normalizeHeading so case/whitespace variants all collapse to the same key)
- labels / assignees — replacement semantics implemented as add/remove diff
  against the current set on disk (gh issue edit and glab issue update both
  expose only additive flags)
- milestone — GitHub only; GitLab returns platform_unsupported because
  glab issue update --milestone needs a numeric id and group/project
  resolution this thin tool does not own
- dry_run — short-circuit before invoking the platform CLI; returns the
  proposed updated_fields and the resolved_body for body_section patches

Implementation lives in lib/adapters/work-item-update-{github,gitlab}.ts
behind getAdapter() — the handler shell is platform-agnostic, gate-greps
clean. Section splicing is in lib/work-item-section.ts so it is unit-tested
in isolation.

Test coverage:
- 8 unit tests for spliceH2Section (lib/work-item-section.test.ts)
- 16 subprocess-boundary tests for the GitHub adapter
- 14 subprocess-boundary tests for the GitLab adapter
- 10 integration tests for the handler (cross-platform dispatch + envelope)

48 new tests; full suite 2194 pass / 0 fail. Validate emits 76/76 tools
registered including work_item_update.

Closes #287
@bakeb7j0 bakeb7j0 merged commit af74b5d into kahuna/390-bug-drain May 5, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants