Commit 6077bf8
feat: Complete UMS CLI separation - migrate to pure functions (#70)
* feat: add comprehensive test coverage for Phase 1 utilities
- Add constants validation tests with 42 test cases covering all UMS v1.0 constants
- Add error formatting utility tests with 42 test cases for CLI error handling
- Add UMS error utility tests with 52 test cases for library error types
- All tests pass with comprehensive edge case coverage
- Improves test coverage for utility functions and type validation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add comprehensive conflict resolution tests for UMS v1.0
- Add extensive test suite for modules.config.yml conflict resolution
- Test all three conflict strategies: error, replace, and warn
- Test nested conflict resolution across multiple config levels
- Test performance with large numbers of conflicts
- Test edge cases: empty configs, malformed strategies, circular replacements
- Document current implementation gap where error strategy converts to warnings
- 23 comprehensive test cases with 100% coverage of conflict resolution scenarios
- All tests pass with proper mocking of file system operations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: implement Phase 1 of UMS CLI separation - extract file I/O operations
- Add CLI file operations utilities (file-operations.ts) with comprehensive error handling
- Add CLI configuration loader (config-loader.ts) for modules.config.yml management
- Update UMS library to support content-based parsing alongside file-based loading
- Add parseModule() and parsePersona() functions for content-only operations
- Make filePath optional in UMSModule interface for backward compatibility
- Update build command to use new CLI file operations with utf-8 encoding
- Add comprehensive test coverage for all new utilities (100% coverage)
- Maintain full backward compatibility with existing UMS library API
This completes Phase 1 of the CLI/library separation plan, moving all file I/O
operations to CLI helpers while preserving UMS library parsing capabilities.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: complete Phase 2 UMS CLI separation with comprehensive test fixes
This commit implements Phase 2 of the UMS CLI separation migration, moving
module discovery and configuration management from UMS library to CLI layer,
and fixes all tests to work with the new architecture.
**Phase 2 Architecture Changes:**
- Create CLI-based module discovery utilities with conflict resolution
- Refactor ModuleRegistry to accept pre-loaded modules via constructor
- Update BuildEngine to require ModuleRegistry through dependency injection
- Remove file system dependencies from UMS library core
- Move configuration management entirely to CLI layer
**New CLI Components:**
- `module-discovery.ts`: Utilities for discovering standard and local modules
- `module-discovery.test.ts`: Comprehensive tests for discovery logic
- Updated CLI commands to handle module discovery and registry creation
**UMS Library Changes:**
- ModuleRegistry constructor now accepts `(modules, warnings)` parameters
- BuildEngine constructor now requires `registry` parameter
- Removed file discovery logic from library core
- Updated tests to work with dependency injection pattern
**Test Infrastructure Updates:**
- Fixed build command tests for new ModuleRegistry/BuildEngine constructors
- Fixed search command tests to use direct module resolution
- Updated all mocks to match new architecture patterns
- Removed deprecated `loadModule` references from tests
- Fixed module-discovery test to handle multiple module instances correctly
**Lint Fixes:**
- Removed unnecessary `async` keywords from `loadModulesFromRegistry` functions
- Fixed `@typescript-eslint/require-await` errors in list.ts and search.ts
**Test Results:**
- CLI Package: 171 tests passing (8 test files)
- UMS Library: 96 tests passing (4 test files)
- Total: 267 tests passing with no errors
**Benefits:**
- Clear separation of concerns: CLI handles I/O, UMS lib handles logic
- Improved testability through dependency injection
- Centralized conflict resolution in CLI layer
- All tests pass with new architecture
- No lint errors remaining
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: complete Phase 3 UMS CLI separation - convert BuildEngine to pure functions
- Create pure function modules for complete separation of concerns:
* resolver.ts: Module resolution and conflict handling
* renderer.ts: Markdown rendering per UMS v1.0 spec
* report-generator.ts: Build report generation with SHA-256 hashing
- Deprecate BuildEngine and ModuleRegistry classes in favor of functional composition
- Update CLI build command to use pure function pipeline:
parsePersona → resolvePersonaModules → renderMarkdown → generateBuildReport
- Add comprehensive test coverage for all new pure functions (121 tests passing)
- Maintain backward compatibility during transition period
- Export new functions from UMS library index for public API
Phase 3 achieves complete architectural separation between CLI orchestration
and UMS library logic through dependency injection and pure functions.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: finalize UMS CLI separation with comprehensive test migration
Complete the migration from BuildEngine class-based architecture to pure
function-based UMS v1.0 implementation. This finalizes the separation of
concerns between CLI I/O operations and UMS library business logic.
Key changes:
- Update all CLI commands to use pure functions from UMS library
- Remove BuildEngine class and related test files from ums-lib
- Migrate tests to use pure function mocking patterns
- Add test setup files for both CLI and UMS packages
- Update package dependencies and exports in ums-lib
- Ensure clean architectural boundaries between packages
This completes the UMS CLI separation project, establishing a clean
separation where the CLI handles all I/O operations and the UMS library
provides pure data transformation functions for parsing, validation,
resolution, rendering, and reporting.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: improve JSDoc for parseModule function
Add comprehensive JSDoc documentation with parameter descriptions,
return type, and exception handling information.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: improve JSDoc for parsePersona function
Add comprehensive JSDoc documentation with YAML structure example,
parameter descriptions, return type, and exception handling.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: clarify filePath comment in UMSModule type
Improve comment to clearly specify when filePath is present vs absent,
making the optional behavior more explicit for API consumers.
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: make standard modules path configurable
Add default parameter to discoverStandardModules function to improve
testability and flexibility while maintaining backward compatibility.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: replace map() misuse with proper iteration in renderer
Replace incorrect use of map() with side effects with a proper for-of loop
to prevent potential array length mismatches and improve code clarity.
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: improve separator logic in renderer for maintainability
Replace complex conditional separator logic with cleaner join() approach
that builds module blocks first then joins with separators, improving
code readability and maintainability.
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 01d52b1 commit 6077bf8
File tree
45 files changed
+4865
-2217
lines changed- .claude/agents
- .gemini
- docs
- packages
- copilot-instructions-cli
- src
- commands
- test
- utils
- ums-lib
- src
- core
- test
- types
- utils
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
45 files changed
+4865
-2217
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 11 | + | |
20 | 12 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
27 | 25 | | |
28 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
29 | 55 | | |
30 | 56 | | |
31 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
32 | 63 | | |
33 | 64 | | |
34 | | - | |
| 65 | + | |
35 | 66 | | |
36 | 67 | | |
37 | | - | |
| 68 | + | |
38 | 69 | | |
39 | 70 | | |
40 | | - | |
| 71 | + | |
41 | 72 | | |
42 | 73 | | |
43 | | - | |
| 74 | + | |
44 | 75 | | |
45 | 76 | | |
46 | | - | |
| 77 | + | |
47 | 78 | | |
48 | | - | |
| 79 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
15 | 9 | | |
16 | 10 | | |
17 | | - | |
18 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
0 commit comments