feat(admin): extract shared settings-config module for CLI and admin UI#672
feat(admin): extract shared settings-config module for CLI and admin UI#672Ferryx349 wants to merge 3 commits into
Conversation
Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
🦋 Changeset detectedLatest commit: 89f09b9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
Pull request overview
This PR extracts the CLI’s settings configuration primitives (settings file paths, load/save, dot-path get/set, and validation) into shared runtime modules under src/utils, so both the CLI and the upcoming admin settings editor can reuse the same implementation. It also exports the guided settings schema previously embedded in the CLI configure TUI.
Changes:
- Introduces shared
src/utils/settings-config.ts(settings IO, dot-path helpers, validation) andsrc/utils/settings-guided-schema.ts(guided field metadata + validators). - Updates CLI commands/TUI to consume the shared modules (and turns the old CLI config module into a re-export shim).
- Adds unit tests for the extracted settings-config and guided schema modules, plus a changeset.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/utils/settings-config.spec.ts | Adds unit coverage for parsing, dot-path helpers, defaults-path validation, and guided schema exports. |
| src/utils/settings-guided-schema.ts | New shared guided schema module for reuse by CLI and admin UI. |
| src/utils/settings-config.ts | New shared settings config module (paths, IO, parsing, dot-path ops, schema validation). |
| src/cli/utils/paths.ts | Switches CLI path helpers to re-export shared settings-config path functions. |
| src/cli/utils/config.ts | Replaces prior implementation with re-exports from shared settings-config. |
| src/cli/tui/menus/configure.ts | Uses shared format/path helpers and imports guided schema from the new shared module. |
| src/cli/commands/config.ts | Uses shared settings-config helpers and removes duplicated label/category logic. |
| .changeset/shared-settings-config-module.md | Publishes the refactor as a minor change via changeset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
Description
Extracts settings read/validate/path logic from
src/cli/utils/config.tsinto shared runtime modules so the admin settings editor (Phase 3) can reuse the same primitives as the CLI.Also exports the guided field schema from the configure TUI for admin UI consumption.
Why
The admin console settings editor needs the same dot-path get/set, validation, and guided field metadata that the CLI already uses. Duplicating that logic would drift over time; this PR establishes a single source of truth ahead of the admin UI work.
Related Issue
Fixes:- #664
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: