CHANGELOG_LABELS.md 5.2 KB

Changelog - Label Management Feature

[Unreleased] - 2025-10-29

Added

Core Functionality

  • 10 new label management methods in GogsClient class (src/gogs-client.ts):
    • listLabels(owner, repo) - List all labels in a repository
    • getLabel(owner, repo, labelId) - Get a specific label by ID
    • createLabel(owner, repo, data) - Create a new label with name and color
    • updateLabel(owner, repo, labelId, data) - Update an existing label
    • deleteLabel(owner, repo, labelId) - Delete a label from a repository
    • listIssueLabels(owner, repo, issueNumber) - List labels on a specific issue
    • addIssueLabels(owner, repo, issueNumber, labelIds) - Add labels to an issue
    • removeIssueLabel(owner, repo, issueNumber, labelId) - Remove a label from an issue
    • replaceIssueLabels(owner, repo, issueNumber, labelIds) - Replace all labels on an issue
    • removeAllIssueLabels(owner, repo, issueNumber) - Remove all labels from an issue

MCP Server Integration

  • 10 new Zod validation schemas in server.ts:

    • ListLabelsSchema - Validates list labels request
    • GetLabelSchema - Validates get single label request
    • CreateLabelSchema - Validates create label request with required name and color
    • UpdateLabelSchema - Validates update label request with optional fields
    • DeleteLabelSchema - Validates delete label request
    • ListIssueLabelsSchema - Validates list issue labels request
    • AddIssueLabelsSchema - Validates add labels to issue request
    • RemoveIssueLabelSchema - Validates remove label from issue request
    • ReplaceIssueLabelsSchema - Validates replace issue labels request
    • RemoveAllIssueLabelsSchema - Validates remove all labels request
  • 10 new MCP tools registered in server.ts:

    • list_labels - MCP tool to list repository labels
    • get_label - MCP tool to get single label
    • create_label - MCP tool to create new label
    • update_label - MCP tool to update existing label
    • delete_label - MCP tool to delete label
    • list_issue_labels - MCP tool to list issue labels
    • add_issue_labels - MCP tool to add labels to issue
    • remove_issue_label - MCP tool to remove label from issue
    • replace_issue_labels - MCP tool to replace all issue labels
    • remove_all_issue_labels - MCP tool to remove all issue labels
  • 10 new handler cases in server.ts for processing label tool requests

Documentation

  • README.md:

    • Added "Label Management" section to Features overview
    • Added "Label Management Tools" section with comprehensive documentation
    • Documented all 10 label management tools with parameters and descriptions
    • Added color format specification (#rrggbb hex codes)
  • USAGE_EXAMPLES.md:

    • Added "Label Management" section with practical examples
    • Provided natural language usage examples for all 10 operations
    • Demonstrated repository-level label operations
    • Demonstrated issue-level label operations
    • Showed examples of CRUD operations on labels

Type System

  • Imported GogsLabel type in gogs-client.ts for type safety
  • All methods properly typed with TypeScript
  • Return types specified for all label operations

Changed

  • Updated import statement in gogs-client.ts to include GogsLabel type
  • Enhanced MCP server tool list with 10 new label management tools
  • Extended switch statement in server.ts with 10 new case handlers

Technical Details

API Endpoints Utilized

  • GET /repos/:owner/:repo/labels - List repository labels
  • GET /repos/:owner/:repo/labels/:id - Get single label
  • POST /repos/:owner/:repo/labels - Create label
  • PATCH /repos/:owner/:repo/labels/:id - Update label
  • DELETE /repos/:owner/:repo/labels/:id - Delete label
  • GET /repos/:owner/:repo/issues/:index/labels - List issue labels
  • POST /repos/:owner/:repo/issues/:index/labels - Add labels to issue
  • DELETE /repos/:owner/:repo/issues/:index/labels/:id - Remove label from issue
  • PUT /repos/:owner/:repo/issues/:index/labels - Replace issue labels
  • DELETE /repos/:owner/:repo/issues/:index/labels - Remove all issue labels

Code Statistics

  • Total lines added: 706
  • Files modified: 4
    • src/gogs-client.ts: +126 lines
    • src/server.ts: +441 lines
    • README.md: +79 lines
    • USAGE_EXAMPLES.md: +60 lines

Build Status

  • ✅ TypeScript compilation successful
  • ✅ No type errors
  • ✅ All methods compiled to JavaScript
  • ✅ Source maps generated
  • ✅ Type definitions (.d.ts) generated

Testing

  • Verified successful TypeScript compilation
  • Confirmed all methods present in compiled output
  • Validated tool registration in MCP server
  • Checked handler implementation for all tools

Breaking Changes

None - This is a purely additive feature

Deprecations

None

Security

  • All label operations require appropriate Gogs server permissions
  • Access token permissions respected
  • No additional security concerns introduced

Performance

  • Label operations use standard HTTP requests to Gogs API
  • No impact on existing functionality
  • Efficient implementation with no unnecessary API calls

References

  • Issue: #3 - feat: gogs labels
  • Gogs API Documentation: docs-api/Issues/Labels.md
  • Commit: 72483e2 - feat: implement Gogs label management