Skip to content

feat(cli): Add --env-gates flag to list-tools for USE_* documentation#59

Merged
polaz merged 2 commits intomainfrom
feat/53-env-gates
Jan 20, 2026
Merged

feat(cli): Add --env-gates flag to list-tools for USE_* documentation#59
polaz merged 2 commits intomainfrom
feat/53-env-gates

Conversation

@polaz
Copy link
Copy Markdown
Member

@polaz polaz commented Jan 20, 2026

Summary

  • Add --env-gates flag to yarn list-tools that shows which USE_* environment variable controls which tools
  • Automates documentation of feature gates, replacing error-prone manual documentation

Changes

  • Add FeatureGate interface and optional gate field to EnhancedToolDefinition type
  • Add gate metadata to all 11 entity registries (22 tools total):
    • USE_LABELS: browse_labels, manage_label
    • USE_GITLAB_WIKI: browse_wiki, manage_wiki
    • USE_MILESTONE: browse_milestones, manage_milestone
    • USE_PIPELINE: browse_pipelines, manage_pipeline, manage_pipeline_job
    • USE_VARIABLES: browse_variables, manage_variable
    • USE_MRS: browse_merge_requests, browse_mr_discussions, manage_merge_request, manage_mr_discussion, manage_draft_notes
    • USE_FILES: browse_files, manage_files
    • USE_WORKITEMS: browse_work_items, manage_work_item
    • USE_WEBHOOKS: list_webhooks, manage_webhook
    • USE_SNIPPETS: browse_snippets, manage_snippet
    • USE_INTEGRATIONS: list_integrations, manage_integration
  • Core tools (13) remain ungated - always enabled
  • Implement extractEnvGates() and printEnvGatesMarkdown() functions
  • Add unit tests for new functionality

Usage

# Show env gates markdown table
yarn list-tools --env-gates

# JSON output for automation
yarn list-tools --env-gates --json

Test plan

  • All 2076 tests pass
  • yarn list-tools --env-gates outputs correct markdown table
  • yarn list-tools --env-gates --json outputs valid JSON
  • All 11 USE_* variables documented with their tools
  • Core tools shown as "always on"

Closes #53

- Add FeatureGate interface and gate field to EnhancedToolDefinition
- Add gate metadata to all entity registries (labels, wiki, milestones,
  pipelines, variables, files, mrs, workitems, webhooks, snippets,
  integrations) - core tools remain ungated (always enabled)
- Implement --env-gates flag showing which USE_* controls which tools
- Support both markdown table and JSON output formats
- Add unit tests for env-gates functionality

Usage:
  yarn list-tools --env-gates         # Markdown table
  yarn list-tools --env-gates --json  # JSON output

Closes #53
Copilot AI review requested due to automatic review settings January 20, 2026 08:25
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 20, 2026

📊 Test Coverage Report

Overall Coverage: 87.5%

Coverage Details

Metric Percentage
Statements 87.5%
Branches 80.03%
Functions 73.52%
Lines 88%

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

This PR adds a --env-gates flag to the yarn list-tools CLI command to document which USE_* environment variables control which tools. This replaces manual documentation with automated generation, reducing errors and improving maintainability.

Changes:

  • Add FeatureGate interface and optional gate field to type definitions
  • Add gate metadata to all 22 gated tools across 11 entity registries
  • Implement CLI functions to extract and display gate information in both markdown and JSON formats
  • Add comprehensive unit tests for the new functionality

Reviewed changes

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

Show a summary per file
File Description
src/types.ts Adds FeatureGate interface and gate field to EnhancedToolDefinition
src/entities/labels/registry.ts Adds USE_LABELS gate to browse_labels and manage_label tools
src/entities/wiki/registry.ts Adds USE_GITLAB_WIKI gate to wiki tools
src/entities/milestones/registry.ts Adds USE_MILESTONE gate to milestone tools
src/entities/pipelines/registry.ts Adds USE_PIPELINE gate to pipeline and job tools
src/entities/variables/registry.ts Adds USE_VARIABLES gate to variable tools
src/entities/mrs/registry.ts Adds USE_MRS gate to merge request and discussion tools
src/entities/files/registry.ts Adds USE_FILES gate to file browsing and management tools
src/entities/workitems/registry.ts Adds USE_WORKITEMS gate to work item tools
src/entities/webhooks/registry.ts Adds USE_WEBHOOKS gate to webhook tools
src/entities/snippets/registry.ts Adds USE_SNIPPETS gate to snippet tools
src/entities/integrations/registry.ts Adds USE_INTEGRATIONS gate to integration tools
src/cli/list-tools.ts Implements --env-gates flag with extraction and formatting functions
tests/unit/cli/list-tools.test.ts Adds comprehensive tests for env gates functionality

@polaz polaz merged commit 579c682 into main Jan 20, 2026
12 checks passed
@polaz polaz deleted the feat/53-env-gates branch January 20, 2026 08:27
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 96.42857% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/cli/list-tools.ts 97.22% 0 Missing and 2 partials ⚠️
src/entities/mrs/registry.ts 50.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

sw-release-bot bot pushed a commit that referenced this pull request Jan 20, 2026
## [6.12.0](v6.11.0...v6.12.0) (2026-01-20)

### Features

* **cli:** add --env-gates flag to list-tools for USE_* documentation ([#59](#59)) ([579c682](579c682)), closes [#53](#53)
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.

feat(cli): Add --env-gates flag to list-tools for USE_* documentation

2 participants