feat(docs): add --export flag to list-tools for TOOLS.md generation#51
Merged
feat(docs): add --export flag to list-tools for TOOLS.md generation#51
Conversation
Add documentation export capability to the list-tools CLI script: - Add --export flag to generate complete TOOLS.md markdown - Add --toc flag for table of contents - Add --no-examples flag to skip example JSON blocks - Add getAllToolDefinitionsUnfiltered() method to registry-manager for getting all tools without env filtering (for documentation) - Apply schema transformation to flatten discriminated unions - Include tier badges for tools with tier requirements - Extract actions from CQRS schemas and display in tables - Group tools by entity category (Core, Work Items, MRs, etc.) - Add version and timestamp to generated header Usage: yarn list-tools --export > docs/TOOLS.md yarn list-tools --export --toc --no-examples Closes #47
📊 Test Coverage ReportOverall Coverage: 87.14% Coverage Details
Coverage Report: View detailed coverage report
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR adds documentation export functionality to the list-tools CLI, enabling automated generation of TOOLS.md reference documentation with configurable options. The implementation includes extracting CQRS action definitions, displaying tier requirements, and providing flexible output formats.
Changes:
- Added
getAllToolDefinitionsUnfiltered()method to bypass environment filtering for documentation generation - Implemented comprehensive documentation export with
--export,--toc, and--no-examplesflags - Moved list-tools from
src/scripts/tosrc/root directory
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/registry-manager.ts | Added getAllToolDefinitionsUnfiltered() method to return all tool definitions without environment variable filtering for documentation purposes |
| src/list-tools.ts | New comprehensive CLI tool for listing and exporting tool documentation with multiple output formats, action extraction, and tier badge support |
| package.json | Updated script paths to reflect file relocation from src/scripts/ to src/ |
Add environment variable to control JSON Schema output format: - GITLAB_SCHEMA_MODE=flat (default): Flatten discriminated unions to single object with action enum for AI clients compatibility - GITLAB_SCHEMA_MODE=discriminated: Keep oneOf structure with separate branches per action for clients supporting JSON Schema Changes: - Add GITLAB_SCHEMA_MODE and SchemaMode type to config.ts - Update schema-utils.ts to use config import instead of process.env - Rename getSchemaFormat() to getSchemaMode() for consistency - Update tests to mock GITLAB_SCHEMA_MODE Partial implementation of #49
- Fix regex for space replacement to use global flag (/g) - Extract ACTION_DESCRIPTIONS to constant object - Extract action descriptions dynamically from oneOf branches - Update extractParameters to merge params from all oneOf branches - Update generateExample to use first oneOf branch - Add unit tests for getAllToolDefinitionsUnfiltered - Return original schemas in getAllToolDefinitionsUnfiltered for richer docs
- Add 6 tests for GITLAB_SCHEMA_MODE parsing in config.test.ts - Add 6 tests for --export mode in list-tools.test.ts - oneOf schema action extraction - parameter merging with action hints - --toc and --no-examples flags - flat schema fallback
- Rename GITLAB_SCHEMA_FORMAT to GITLAB_SCHEMA_MODE throughout - Add documentation for yarn list-tools --export flag - Document --toc and --no-examples options - Describe export mode output: actions table, parameters, examples, tier badges
…tion TOOLS.md export improvements: - Group parameters by common (all actions) vs action-specific - Much cleaner human-readable documentation format - Add extractParametersGrouped() for structured parameter extraction Semantic-release integration: - Auto-generate docs/TOOLS.md during release via @semantic-release/exec - Add TOOLS.md to git assets for automatic commit - Remove manual commit step from CI workflow Code organization: - Move list-tools.ts to src/cli/ directory - Move tests to tests/unit/cli/ PR review fixes: - Add bounds checking for --entity/--tool CLI args - Add clarifying comment for ENTITY_TOOLS categories - Remove unused toolName parameter from generateExample - Add fallback for package.json version detection - Fix misleading test description for getAllToolDefinitionsUnfiltered
Add comprehensive tests for list-tools.ts: - Verbose mode with no parameters - Tier info badges (premium/ultimate/free) - Unresolved $ref type handling - Common + action-specific parameters grouping - Action-specific params sorting by required status - Example generation with all parameter naming patterns
Remove unused oneOf handling from extractParameters function. This code was never executed because extractParametersGrouped handles oneOf schemas directly and only calls extractParameters for flat schemas. Reduces code by ~50 lines and improves coverage to 96%.
Warn users about typos (e.g., --exprt instead of --export) with helpful error message pointing to --help. Also: - Remove unused artifact download from semantic-release CI job - Ensure docs directory exists before TOOLS.md generation
db4ccc7 to
5b32648
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--exportflag to generate complete TOOLS.md documentation--tocflag for table of contents--no-examplesflag to skip example JSON blocksgetAllToolDefinitionsUnfiltered()method for documentation export (no env filtering)Usage
Example Output
Test plan
yarn buildpassesyarn lintpassesyarn test:unitpasses (1780 tests)yarn list-tools --exportgenerates 39 toolsyarn list-tools --export --tocincludes table of contentsyarn list-tools --export --no-examplesskips JSON examplesCloses #47