Skip to content

add project move verb to migrate between distro and host types#24

Merged
MaceWindu merged 2 commits into
masterfrom
feat/project-move-verb
May 17, 2026
Merged

add project move verb to migrate between distro and host types#24
MaceWindu merged 2 commits into
masterfrom
feat/project-move-verb

Conversation

@MaceWindu
Copy link
Copy Markdown
Owner

Summary

  • New verb project move <name> -To <host|distro> [-HostCheckout <path>] [-Remote <url>] [-DiscardDirty] [-Force]. Migrates a project between distroProject and hostProject in place — tears down the materialized side, mutates the profile entry, re-provisions the new side. Preserves tabColor, defaultBranch, enabled, hostMounts, claudeSettings, claudeFile.
  • Refuses on uncommitted session work (both distro and host worktrees are checked) unless -DiscardDirty.
  • Writes a millisecond-precision profile snapshot (<profile>.bak-yyyyMMdd-HHmmss-fff) before any mutation, so back-to-back moves don''t clobber the safety net.
  • Smart-detects -Remote from the existing hostCheckout''s origin URL 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)
  • Distro lane via CI — covers the add -> move-to-host -> move-back round-trip on a real ephemeral distro
  • Manual: run project move with dirty sessions, confirm refusal + the -DiscardDirty escape hatch

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 17, 2026 22:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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>
@MaceWindu MaceWindu merged commit 0047889 into master May 17, 2026
8 checks passed
@MaceWindu MaceWindu deleted the feat/project-move-verb branch May 17, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants