Skip to content

feat(variables): consolidate 5 CI/CD variable tools into 2 CQRS tools#43

Merged
polaz merged 3 commits intomainfrom
refactor/#9-variables-cqrs-consolidation
Jan 19, 2026
Merged

feat(variables): consolidate 5 CI/CD variable tools into 2 CQRS tools#43
polaz merged 3 commits intomainfrom
refactor/#9-variables-cqrs-consolidation

Conversation

@polaz
Copy link
Copy Markdown
Member

@polaz polaz commented Jan 19, 2026

Summary

  • Consolidates 5 CI/CD variable tools into 2 CQRS tools following the established pattern
  • browse_variables (Query): list, get actions
  • manage_variable (Command): create, update, delete actions
  • Uses flat schema pattern with .refine() for Claude API compatibility

Changes

  • Updated schema-readonly.ts with BrowseVariablesSchema
  • Updated schema.ts with ManageVariableSchema
  • Updated registry.ts with 2 CQRS tool handlers
  • Rewrote unit tests (45 tests passing)
  • Added integration tests for variables
  • Updated README.md documentation (58 → 55 tools)

Test plan

  • Unit tests pass (1416 tests)
  • Lint passes
  • Build succeeds
  • Integration tests with real GitLab instance

Closes #9

Consolidates variable operations following CQRS pattern:
- browse_variables (Query): list, get actions
- manage_variable (Command): create, update, delete actions

Uses flat z.object() with .refine() instead of z.discriminatedUnion()
for Claude API compatibility (no oneOf/allOf/anyOf at root level).

Closes #9
Copilot AI review requested due to automatic review settings January 19, 2026 18:59
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 96.55172% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/entities/variables/schema.ts 71.42% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request consolidates the CI/CD variables functionality from 5 individual tools into 2 CQRS-pattern tools, following the established architectural pattern in the codebase.

Changes:

  • Replaced 5 tools (list_variables, get_variable, create_variable, update_variable, delete_variable) with 2 CQRS tools (browse_variables, manage_variable)
  • Implemented flat schema pattern with .refine() for Claude API compatibility
  • Updated all 45 unit tests to reflect the new CQRS structure
  • Added comprehensive integration tests for the new variable schemas
  • Updated README.md to reflect the tool count change (58 → 55 tools)

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/entities/variables/schema-readonly.ts Implements BrowseVariablesSchema with "list" and "get" actions using flat schema pattern
src/entities/variables/schema.ts Implements ManageVariableSchema with "create", "update", and "delete" actions using flat schema pattern
src/entities/variables/registry.ts Consolidates 5 tool handlers into 2 CQRS handlers with proper action routing
tests/unit/entities/variables/registry.test.ts Refactored 45 unit tests to cover the new CQRS tools comprehensively
tests/integration/schemas/variables.test.ts Added new integration tests covering all actions and lifecycle operations
README.md Updated documentation to reflect 2 CQRS tools and adjusted total tool count from 58 to 55

Add comprehensive unit tests for BrowseVariablesSchema and
ManageVariableSchema covering:
- Action field validation (list, get, create, update, delete)
- Variable type coercion (env_var, file, env, environment, etc.)
- Boolean field coercion (flexibleBoolean)
- Filter and environment scope validation
- Edge cases and error handling

Increases test count from 45 to 108 for variables entity.
@github-actions
Copy link
Copy Markdown

📊 Test Coverage Report

Overall Coverage: 86.67%

Coverage Details

Metric Percentage
Statements 86.67%
Branches 81.14%
Functions 75.84%
Lines 87.11%

Coverage Report: View detailed coverage report

This report was generated automatically from your PR changes.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

## Tools 🛠️

**60 Tools Available** - Organized by entity and functionality below.
**57 Tools Available** - Organized by entity and functionality below.
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description mentions reducing tools from "58 → 55" but the diff shows "60 → 57". The actual change is correct (60 minus 3 equals 57), but the PR description should be updated to match the actual numbers.

Copilot uses AI. Check for mistakes.
@polaz polaz merged commit 4b6b82a into main Jan 19, 2026
26 checks passed
@polaz polaz deleted the refactor/#9-variables-cqrs-consolidation branch January 19, 2026 19:17
sw-release-bot bot pushed a commit that referenced this pull request Jan 19, 2026
## [6.6.0](v6.5.0...v6.6.0) (2026-01-19)

### Features

* **variables:** consolidate 5 CI/CD variable tools into 2 CQRS tools ([#43](#43)) ([4b6b82a](4b6b82a)), closes [#9](#9)
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.

refactor(variables): CQRS consolidation - 5 tools → 2 tools

2 participants