feat(core): add a native core front door for cross-fleet command parity#98
Merged
Conversation
…rity On the Unix side (dotfiles-core) the umbrella verb is `core` (core doctor / help / version / update, plus core-* twins). Windows had no `core` command — you had to remember `dotfiles-doctor` where macOS/Linux use `core doctor`. Add a native pwsh `core` front door (os/48-core.ps1) that mirrors Core's surface so the same command works fleet-wide: - `core` dispatcher (help/doctor/version/update; bare `core` = the index; did-you-mean on a typo), + standalone core-doctor/core-help/core-version twins. Thin routing over the host's existing verbs (dotfiles-doctor / dothelp / up), which stay canonical — the old names still work. - Loads from os/ (after 45-doctor) so the load contract resolves. Visual parity: `core doctor` (dotfiles-doctor) now renders Core's header grammar — `dotfiles-Windows <rev> — core-doctor (<glyph legend>)` with cyan section headers — instead of the inverse-chip banner, so the report reads the same on both shells. Also: register `core` in the dothelp catalog, document it in aliases.md, and add tests/Core.Tests.ps1 covering the dispatch + twins. Note: the cross-shell name pinning in dotfiles-core (PARITY.md + parity-check.sh) lands in a companion PR so CI gates the two shells together. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_012CpbBxJLgsg3T3ropqYGJA
There was a problem hiding this comment.
Pull request overview
Adds a native core command surface to the Windows PowerShell dotfiles so operators can use the same umbrella verbs (core doctor/help/version/update) across macOS/Linux and Windows, with matching standalone core-* twins and aligned core doctor rendering.
Changes:
- Introduces
powershell/os/48-core.ps1implementingcoredispatch pluscore-doctor/core-help/core-versionthin pass-through twins. - Updates
dotfiles-doctorheader/section styling for cross-shell visual parity and adjusts its load-contract requires. - Registers/documentation/tests: adds Pester coverage for routing, adds
coreto the help catalog, and documents it inaliases.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Core.Tests.ps1 | New Pester tests validating core dispatch, arg pass-through, typo suggestion behavior, and core-* twins. |
| powershell/os/48-core.ps1 | New core front door dispatcher + core-* standalone twins, using existing host verbs. |
| powershell/os/45-doctor.ps1 | Updates dotfiles-doctor header grammar and section colors; drops unused Write-DotBanner dependency. |
| powershell/Dotfiles/Help.Helpers.ps1 | Registers core <verb> in the dothelp catalog. |
| aliases.md | Documents the new core/core-* commands in the alias cheat sheet. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+269
to
+273
| $ver = 'dev' | ||
| if ($env:DOTFILES_WIN -and (Test-Cmd git)) { | ||
| $s = (& git -C $env:DOTFILES_WIN rev-parse --short HEAD 2>$null) | ||
| if ($s) { $ver = $s } | ||
| } |
… the doctor - tests/Core.Tests.ps1: the leaf stubs are `global:` functions, so a `$script:` recorder set in BeforeAll resolves to a different scope than the It blocks read — the 6 routing asserts saw an empty list and failed. Record into `$global:DotCoreCalls` so the stubs and asserts share one list. - doctor header + core-version: resolve the repo root as `$global:DOTFILES` else `$env:DOTFILES_WIN` (the same order the doctor's Repo-root probe uses) and apply the `.git` guard, so the header/version can't show `dev` when the root is only known via $global:DOTFILES (Copilot review). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_012CpbBxJLgsg3T3ropqYGJA
Three CI fixes for the `core` front door: - os/48-core.ps1: `$rest` splatted a STRING (`$args[1..N]` when N==1 is a scalar), so `core doctor -Quiet` exploded `-Quiet` char-by-char. Build the forward-args array with `@($args | Select-Object -Skip 1)` instead. - tests/Core.Tests.ps1: Test-Cmd is a load-time fragment function, not a module export, so it was absent in the unit context and core-version threw CommandNotFound. Stub it in BeforeAll, clean up in AfterAll. - README.md: add the new `48-core` fragment to the Layout box so the Repo.Tests golden check (box == on-disk fragments) holds. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_012CpbBxJLgsg3T3ropqYGJA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On macOS/Linux the umbrella verb is
core(core doctor/core help/core version/core update, pluscore-*twins). Windows had nocorecommand — you had to reach fordotfiles-doctorwhere the rest of the fleet usescore doctor. This closes that gap so the same command works on every machine.What
New front door (
powershell/os/48-core.ps1):coredispatcher —help/doctor/version/update; barecoreprints the command index; a typo gets a did-you-mean (via the module'sGet-DotLevenshtein). Mirrors dotfiles-core's zshcore().core-doctor/core-help/core-versiontwins (matching Core'score-*names).dotfiles-doctor/dothelp/up), which stay canonical — the old names still work.core-versionprintsdotfiles-Windows <rev>(this layer has nocore.versionfile, so the revision is the version).os/(after45-doctor.ps1) on purpose:core doctorbridges to the host'sdotfiles-doctor, so it must load after it for the# provides:/# requires:load contract to resolve.Visual parity:
core doctor(i.e.dotfiles-doctor) now renders Core's header grammar —dotfiles-Windows <rev> — core-doctor (✓ ok · ! warn · ✗ fail)with cyan section headers — instead of the inverse-chip banner, so the report reads the same on both shells. (Write-DotBannerdropped from the doctor'srequiressince it's no longer used there.)Also: registered
corein thedothelpcatalog, documented it inaliases.md, and addedtests/Core.Tests.ps1(routing + arg pass-through + twins + the typo path).Companion PR
The cross-shell name pinning lands in dotfiles-core (
PARITY.md+scripts/parity-check.sh) so CI gates the two shells together and this can't drift — opened separately.Verification note
I authored this without a local PowerShell runtime, so I leaned on the repo's own gates: the new fragment follows the
# provides:/# requires:load contract (LoadContract will check it),Core.Tests.ps1covers the dispatch, and PSScriptAnalyzer/Pester run in CI. The visual rendering (header line + cyan sections) couldn't be eyeballed here — worth a quick look on a real Windows box; it's two cosmetic edits in45-doctor.ps1and trivially tunable.🤖 Generated with Claude Code
Generated by Claude Code