add project move verb to migrate between distro and host types#24
Merged
Conversation
Cross-type migration without losing the user-facing config. The verb tears down the materialized side (bare mirror for distroProject, per-project bin dir for hostProject) plus every session of the project, mutates the profile entry to the new type, and re-provisions the new side. tabColor / defaultBranch / enabled / hostMounts / claudeSettings / claudeFile carry over. Refuses on dirty sessions unless -DiscardDirty. - modules/Projects.psm1: Move-ProjectInProfile helper. Reads -Raw to preserve %ENV%, strips type-specific fields (remote, hostCheckout, hostShadows, hostTools), rewrites the new-type set, writes back via Write-Profile. - claudearium.ps1: Invoke-ProjectMove. Validates required args by direction (-HostCheckout for ->host, -Remote auto-detected from the existing hostCheckout origin for ->distro). Checks every session for uncommitted work (distro via Get-SessionDirtyFileCount, host via `git -C <hostWorktreePath> status --porcelain`). Writes a millisecond- precision profile snapshot (.bak-yyyyMMdd-HHmmss-fff) before any mutation so back-to-back moves don''t clobber the safety net. - claudearium.ps1: -To and -DiscardDirty added to the script param block. `move` wired into Invoke-Project''s switch + the help line. - Tests: tests/pure/Projects.Tests.ps1 (8 cases: distro<->host mutation, preservation of unrelated fields, hostTools drop on ->host, custom -HostShadows, missing-arg errors, Test-Profile validity after a full round-trip). Registered in TestRegistry.psm1. tests/distro adds a real round-trip (add distro, move to host, move back) — 3 cases. - Docs: usage.md verb entry, cookbook.md recipe, architecture.md verb table, design-decisions.md §24 (why move is lossy on uncommitted work; why no session preservation across the boundary; why a millisecond-precise backup snapshot). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The host-shadow override expression at line 1759 used the form
-HostShadows (if (...) { $HostShadows } else { $null })
which parses as PowerShell trying to invoke `if` as a command name —
"The term 'if' is not recognized as a name of a cmdlet" at runtime.
Bind to a variable first instead. PowerShell's `if` is an expression
in assignment position but not in argument position.
The distro lane caught this on PR #24''s first run; pure tests exercise
Move-ProjectInProfile directly so they missed it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
project move <name> -To <host|distro> [-HostCheckout <path>] [-Remote <url>] [-DiscardDirty] [-Force]. Migrates a project betweendistroProjectandhostProjectin place — tears down the materialized side, mutates the profile entry, re-provisions the new side. PreservestabColor,defaultBranch,enabled,hostMounts,claudeSettings,claudeFile.-DiscardDirty.<profile>.bak-yyyyMMdd-HHmmss-fff) before any mutation, so back-to-back moves don''t clobber the safety net.-Remotefrom the existinghostCheckout''soriginURL when moving host -> distro.Test plan
.\test-claudearium.ps1 -ParseCheck(68 files clean).\test-claudearium.ps1 -Auto -Only pure -CI(358/358, +8 new pure cases)project movewith dirty sessions, confirm refusal + the -DiscardDirty escape hatch🤖 Generated with Claude Code