Conversation
- Added `versions` property to `CLIStoreCmdSharedFlags` interface. - Implemented `createStoreFromFlags` function to handle both remote and local UCD store creation. - Introduced `runVersionPrompt` function for selecting Unicode versions during store initialization. - Updated error handling to ensure either `--remote` or `--store-dir` is specified.
…ommand * Enhanced error messages for unsupported features and store initialization failures. * Updated version selection logic to prompt users when no versions are specified. * Refined command usage documentation for clarity.
* Moved error exports to improve structure and readability. * Ensures better organization of error handling in the UCD store module.
- Introduced `analyze` method to perform analysis on specified Unicode versions. - Added `AnalyzeOptions` interface to define options for analysis, including orphaned file checks. - Implemented error handling for version validation and analysis process. - Created `VersionAnalysis` interface to structure the results of the analysis.
🦋 Changeset detectedLatest commit: 6a43284 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (26)
WalkthroughThis change introduces a comprehensive "analyze" capability to the UCD Store ecosystem. It adds a new CLI subcommand, implements versioned file completeness/orphan checks in the store, introduces supporting types and utilities, updates tests, and removes the old "status" command. Several package build scripts are also updated to use explicit TypeScript configs. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant UCDStore
participant API
participant FS
User->>CLI: Run "store analyze" [flags, versions]
CLI->>UCDStore: new UCDStore(options)
CLI->>UCDStore: analyze({checkOrphaned, versions})
loop For each version
UCDStore->>API: GET /api/v1/versions/{version}/file-tree
API-->>UCDStore: [expected file tree]
UCDStore->>FS: List actual files for version
FS-->>UCDStore: [actual file paths]
UCDStore->>UCDStore: Compare expected vs actual, find missing/orphaned
end
UCDStore-->>CLI: [VersionAnalysis[]]
CLI-->>User: Output results (JSON or text)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Poem
Tip You can customize the tone of the review comments and chat replies.Set the ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
* Introduced `runAnalyzeStore` function to analyze UCD store versions. * Added flags for JSON output and orphaned file checks. * Updated `runStoreRoot` to include the new `analyze` subcommand. * Removed obsolete `status` command and its related files.
* Added a type check to validate that 'entries' is an array of UnicodeTreeNode. * Throws a TypeError if the validation fails, improving error handling.
- Added functionality to analyze a specific version of files in the store. - Checks for orphaned files if the `checkOrphaned` option is enabled. - Throws an error if the specified version is not found in the store. - Returns an analysis object containing details about orphaned and missing files.
…aths for Unicode versions - Implements `getExpectedFilePaths` to fetch expected file paths from the API. - Handles API errors by throwing `UCDStoreError` with a descriptive message. - Includes tests for valid version retrieval and error handling scenarios.
* Improved error handling to account for additional error scenarios. * Added new methods `getFileTree` and `getFilePaths` for better file management. * Updated tests to cover new error handling and file retrieval logic.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
* Enables the use of experimental decorators in the TypeScript configuration.
This is because when using the Node FS Bridge we are using a base path, and the base path that is being used by the different features inside the ucd-store will also use this basePath. So in the end the base path will be duplicated.
* Moved the version selection logic inside the try block to ensure that the remote or store directory is validated before prompting for versions. * This change prevents potential errors when no versions are provided and improves error handling during the initialization process.
- Updated the constructor to accept a `versions` parameter. - Initialized the private `#versions` property with the provided versions.
* Eliminated the import of `UCDStoreVersionNotFoundError` as it was not utilized in the test file.
* Updated `listdir` calls to use `joinURL` for correct path resolution. * Simplified return values in `getExpectedFilePaths` by removing unnecessary version prefix. * Enhanced filtering logic in `analyze` methods to improve clarity and correctness. * Introduced `stripChildrenFromEntries` utility function for cleaner entry processing in tests. * Adjusted test cases to reflect changes in expected file paths and analysis results.
* Changed `describe` to `describe.todo` for custom store analyze operations. * Enhanced assertions in the test for analyzing a store with no files. * Improved clarity and consistency in the test structure.
* Added `memfs` as a dependency for improved memory filesystem handling. * Updated `createMemoryMockFS` to utilize `memfs` for file operations. * Enhanced `listdir` functionality to support recursive directory listing. * Refactored tests to ensure compatibility with the new filesystem bridge.
* Added `GLOB_TESTS` to the ignores list in ESLint configuration for better file handling. * Updated `createMemoryMockFS` to ensure type safety by casting return values. * Improved path handling in `createFSEntry` and `entryMap` for consistency.
* Cleaned up the test file by removing the unused `vi` import. * This improves code readability and maintains a cleaner codebase.
* Modified the `build` script in multiple package.json files to use `tsdown --tsconfig=./tsconfig.build.json`. * Removed experimental decorators from TypeScript configuration files. * Improved consistency across packages regarding build configurations.
Preview Deployment for WebThe Web worker has been deployed successfully. Preview URL: https://preview.ucdjs.dev This preview was built from commit 6a43284 🤖 This comment will be updated automatically when you push new commits to this PR. |
Preview Deployment for ApiThe Api worker has been deployed successfully. Preview URL: https://preview.api.ucdjs.dev This preview was built from commit 6a43284 🤖 This comment will be updated automatically when you push new commits to this PR. |
There was a problem hiding this comment.
Pull Request Overview
This PR implements the analyze method on the UCD Store to enable analysis of Unicode version data integrity and completeness. The implementation provides comprehensive store analysis capabilities including orphaned file detection and missing file identification.
Key changes include:
- Implementation of the core
analyzemethod with version-specific analysis logic - Addition of comprehensive test coverage for both local and remote store analysis scenarios
- Introduction of supporting infrastructure for file path comparison and validation
Reviewed Changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ucd-store/src/store.ts | Implements the main analyze method and version-specific analysis logic |
| packages/ucd-store/src/internal/files.ts | Adds utility function to fetch expected file paths from the API |
| packages/ucd-store/src/types.ts | Defines AnalyzeOptions and VersionAnalysis interfaces for the analyze functionality |
| packages/ucd-store/test/store-analyze.test.ts | Comprehensive test suite covering various analysis scenarios |
| packages/cli/src/cmd/store/analyze.ts | CLI command implementation for the analyze functionality |
| packages/utils/src/flatten.ts | Adds input validation to the flattenFilePaths function |
| packages/ucd-store/test/__shared.ts | Updates memory mock filesystem to support listdir operations |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
* Updated the log message to accurately reflect that all versions will be analyzed when no specific versions are provided.
🔗 Linked issue
resolves #133
📚 Description
This PR implements the analyze method on the UCD Store.
Summary by CodeRabbit
New Features
Bug Fixes
Chores
Tests
Refactor
Documentation