Commit f262866
feat(cli): Add unified Angular/React support with MCP integration and bug fixes
This commit introduces comprehensive Angular and React CLI support into the unified @sourceloop/cli package, along with critical bug fixes to the MCP server implementation.
## New Features
### Angular Commands (4)
- `angular:scaffold` - Scaffold Angular projects from ARC boilerplate
- `angular:generate` - Generate components, services, modules, directives, pipes, guards
- `angular:config` - Update Angular environment configuration files
- `angular:info` - Display Angular project information and statistics
### React Commands (4)
- `react:scaffold` - Scaffold React projects from ARC boilerplate
- `react:generate` - Generate components, hooks, contexts, pages, services, utils, Redux slices
- `react:config` - Update React .env and config.json files
- `react:info` - Display React project information and statistics
### Utility Classes
- `FileGenerator` - Shared file generation and project manipulation utilities
- `McpConfigInjector` - Automatic MCP configuration injection into scaffolded projects
- `TemplateFetcher` - Smart template fetching with GitHub and local path support
### Architecture
- **Unified CLI**: Single package (~8MB) vs separate packages (~208MB total)
- **Dynamic Templates**: Fetch templates from GitHub on-demand, no vendored templates
- **MCP Integration**: All 13 commands (5 backend + 4 Angular + 4 React) exposed via single MCP server
- **Auto MCP Injection**: Scaffolded projects automatically get .claude/mcp.json configuration
## Bug Fixes (MCP Server)
1. **Fix hookProcessMethods called in loop** (mcp.ts:95)
- Moved hookProcessMethods() call outside forEach loop
- Previously hooked process methods multiple times (once per command)
- Now hooks once before registering tools
2. **Fix console.error log level** (mcp.ts:156)
- Changed from 'debug' to 'error' level for console.error messages
- Ensures errors are properly categorized in MCP client logs
3. **Fix console.log not actually logging** (mcp.ts:178)
- Added missing originalLog(...args) call
- Previously intercepted but didn't execute original console.log
- Now properly logs to both MCP client and console
4. **Fix argToZod optional handling** (mcp.ts:183)
- Now correctly marks non-required args as optional
- Returns arg.required ? option : option.optional()
- Fixes validation errors for optional command arguments
## Technical Details
### Package Size Comparison
- Option 1 (Separate packages): ~208MB total across 3 packages
- Option 2 (Vendored templates): ~208MB single package
- **Option 3 (Dynamic fetching)**: **~8MB** single package (96% reduction)
### Command Organization
- Backend: `sl <command>` (scaffold, microservice, extension, cdk, update)
- Angular: `sl angular:<command>` (scaffold, generate, config, info)
- React: `sl react:<command>` (scaffold, generate, config, info)
### MCP Server
- Single server exposes all 13 commands as tools
- AI assistants can invoke any command via MCP protocol
- Unified configuration: `npx @sourceloop/cli mcp`
## Testing
- All existing tests passing
- MCP integration tests passing (2/2)
- Build successful with zero TypeScript errors
## Documentation
- Added comprehensive TDD.md explaining architecture decisions
- Detailed comparison of 3 architectural approaches
- Implementation details and future enhancements
📦 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 3b42d44 commit f262866
File tree
14 files changed
+3890
-19
lines changed- packages/cli
- src
- commands
- angular
- react
- utilities
14 files changed
+3890
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
40 | 48 | | |
41 | 49 | | |
42 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
43 | 146 | | |
44 | 147 | | |
45 | 148 | | |
| |||
193 | 296 | | |
194 | 297 | | |
195 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
196 | 387 | | |
197 | 388 | | |
198 | 389 | | |
| |||
0 commit comments