Commit 13ec7e6
feat: Add tag-based directory grouping for Swagger generator (#53)
* feat: Add tag-based directory grouping for Swagger generator
- Modified MakeSwaggerMcpToolCommand to create tag-based directories (Tools/Pet/, Tools/Store/, etc.)
- Updated MakeMcpToolCommand to support subdirectories and namespaces
- Updated MakeMcpResourceCommand to support subdirectories and namespaces
- Added createTagDirectory() method to convert tags to StudlyCase directory names
- Tools and resources now organized by OpenAPI tags for better organization
Co-authored-by: Sangrak Choi <[email protected]>
* Fix styling
* feat: Add comprehensive test coverage for tag-based directory grouping
- Add MakeSwaggerMcpToolCommandTest.php with createTagDirectory() method tests
- Add MakeMcpToolCommandTest.php with tag directory path and namespace tests
- Extend MakeMcpResourceCommandTest.php with tag directory support tests
- Add TagDirectoryEdgeCasesTest.php with comprehensive edge case coverage
- Test special characters, unicode, empty tags, namespace collision prevention
- Add integration tests for full swagger-to-tools generation with tag directories
- Ensure backward compatibility and proper config registration
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Sangrak Choi <[email protected]>
* Fix styling
* feat: Add path-based grouping option and remove backward compatibility
- Add grouping strategy options: tag (default), path, none
- Implement path-based directory grouping using first path segment
- Remove all backward compatibility code (116 lines)
- Deleted selectEndpoints(), selectByTag(), selectByPath(), selectIndividually()
- Removed unused property
- Clean up legacy endpoint selection logic
- Update tests with comprehensive coverage for both grouping strategies
- Add 8 new test cases for path-based grouping functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Sangrak Choi <[email protected]>
* Fix styling
* feat: Add interactive CLI prompts for grouping selection
- Remove default value from --group-by option
- Add getGroupingOption() method with interactive prompts
- Prompt users to choose between tag, path, or none grouping
- Default to tag-based grouping when no selection made
- Add comprehensive test coverage for interactive behavior
- Update existing tests to use new groupingMethod property
Co-authored-by: Sangrak Choi <[email protected]>
* Fix styling
* feat: Add preview examples for grouping options in interactive CLI
- Show real endpoint examples for each grouping strategy (tag, path, none)
- Display directory structures with actual file paths before user selection
- Add generateGroupingPreviews() method to parse swagger and create samples
- Enhanced user experience with color-coded folder icons and clear formatting
- Comprehensive test coverage for preview functionality
- Limit previews to 6 items for clean CLI display
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Sangrak Choi <[email protected]>
* Fix styling
* fix(commands): improve special character handling and no-interaction mode
- Fix MakeSwaggerMcpToolCommand to properly handle special characters in tag names
- Convert special characters (/, ., @, -, _) to StudlyCase directory names
- Default empty or whitespace-only tags to 'General' directory
- Add proper --no-interaction mode support for automated testing
- Fix command constructors to properly inject filesystem dependency
- Improve auto-registration logic in programmatic and no-interaction modes
- Fix MigrateToolsCommand backup handling in no-interaction mode
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix(commands): improve tool config registration and test reliability
- Fix backslash escaping in MakeMcpToolCommand for proper class name registration
- Add handling for empty tools array in config file
- Update tests to use POST instead of GET for proper tool generation testing
- Remove trailing whitespace in MakeSwaggerMcpToolCommand
- All 135 tests now pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: change command name to make:mcp-tools-from-swagger
- Changed from make:swagger-mcp-tool to make:mcp-tools-from-swagger for clarity
- Updated all tests to use the new command name
- Command now clearly indicates it generates multiple tools from swagger
* refactor: rename command class to match command name
- Renamed MakeSwaggerMcpToolCommand to MakeMcpToolsFromSwaggerCommand
- Renamed test file to MakeMcpToolsFromSwaggerCommandTest
- Updated all references in tests and service provider
- Better alignment between command name (make:mcp-tools-from-swagger) and class name
* Revert "refactor: rename command class to match command name"
This reverts commit 4129ee8.
* Revert "fix: change command name to make:mcp-tools-from-swagger"
This reverts commit 6c656ff.
* docs: Update README.md with new grouping options for Swagger generator
- Added documentation for --group-by option (tag, path, none)
- Documented interactive grouping selection with preview
- Updated v1.4.0 changelog to highlight grouping strategies
- Added examples showing all three grouping methods
- Enhanced key features list with organization strategies
Co-authored-by: Sangrak Choi <[email protected]>
* feat: enhance Swagger MCP generator with improved interactive preview
- Replace "General/" folder with root directory for no-grouping option
- Add comprehensive statistics in interactive preview (total endpoints, tools, resources)
- Show directory structure with file counts per group
- Display actual file examples with HTTP methods and paths
- Add "... and X more files" indicators for large groups
- Improve visual hierarchy with tree-style formatting
- Update README.md with v1.4.2 enhancements documentation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Fix styling
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Sangrak Choi <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: kargnas <[email protected]>1 parent 537639c commit 13ec7e6
File tree
9 files changed
+1741
-201
lines changed- src/Console/Commands
- tests/Console/Commands
9 files changed
+1741
-201
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | | - | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | | - | |
| 56 | + | |
55 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
| |||
653 | 661 | | |
654 | 662 | | |
655 | 663 | | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
656 | 744 | | |
657 | 745 | | |
658 | 746 | | |
| |||
719 | 807 | | |
720 | 808 | | |
721 | 809 | | |
722 | | - | |
| 810 | + | |
723 | 811 | | |
724 | 812 | | |
725 | | - | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
726 | 818 | | |
727 | 819 | | |
728 | 820 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
90 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
139 | 150 | | |
140 | 151 | | |
141 | 152 | | |
| |||
188 | 199 | | |
189 | 200 | | |
190 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
191 | 209 | | |
192 | 210 | | |
193 | | - | |
| 211 | + | |
194 | 212 | | |
195 | 213 | | |
196 | 214 | | |
| |||
249 | 267 | | |
250 | 268 | | |
251 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
252 | 277 | | |
253 | 278 | | |
254 | | - | |
| 279 | + | |
255 | 280 | | |
256 | 281 | | |
257 | 282 | | |
| |||
267 | 292 | | |
268 | 293 | | |
269 | 294 | | |
270 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
271 | 298 | | |
272 | 299 | | |
273 | 300 | | |
| |||
283 | 310 | | |
284 | 311 | | |
285 | 312 | | |
286 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
287 | 316 | | |
288 | 317 | | |
289 | 318 | | |
290 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
291 | 322 | | |
292 | 323 | | |
293 | 324 | | |
294 | 325 | | |
295 | 326 | | |
296 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
297 | 330 | | |
298 | 331 | | |
299 | 332 | | |
| |||
302 | 335 | | |
303 | 336 | | |
304 | 337 | | |
305 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
306 | 341 | | |
307 | 342 | | |
308 | 343 | | |
| |||
319 | 354 | | |
320 | 355 | | |
321 | 356 | | |
322 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
323 | 360 | | |
324 | 361 | | |
325 | 362 | | |
326 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
327 | 366 | | |
328 | 367 | | |
329 | 368 | | |
| |||
0 commit comments