From cb7f7b58f5a735832caf54149183f0509a62bd7d Mon Sep 17 00:00:00 2001 From: Factor Date: Thu, 19 Nov 2026 12:09:52 +0100 Subject: [PATCH] feat: install.ps1 -Reload, switch layout at the end, document the junction reload Co-Authored-By: Ovis Fast (Claude) --- README.md | 18 +++++++++++++++--- scripts/install.ps1 | 23 ++++++++++++++++++++++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e22d96d..7d5a7f7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Source of the `ovis-composer` Herdr mod (Unified Prompt Experience). -- `mod/ovis-composer/` - the mod (ES modules, hot-reloaded by Herdr) +- `mod/ovis-composer/` - the mod (ES modules; Herdr does not see changes behind the junction - see Reload) - `layouts/ovis-composer.json` - its layout - `tests/` - Node tests for the pure modules (`npm test`) - `docs/superpowers/` - spec and plan @@ -18,8 +18,20 @@ Idempotent. An existing real `mods\ovis-composer` directory is renamed to takes its place, and the layout is copied to `~\.config\herdr-app\layouts\` (existing file backed up once as `.bak-20261119`). -Then switch: `herdr-app do layout.switch '{"name":"ovis-composer"}'` and check -with `herdr-app check \ovis-composer` and `herdr-app status`. +The script ends with `herdr-app do layout.switch '{"name":"ovis-composer"}'`. +Check with `herdr-app check \ovis-composer` and `herdr-app status`. + +## Reload + +Herdr does **not** see changes to the mod files behind the junction: a running +copy keeps the code it loaded. After every edit of `mod\ovis-composer`: + +```powershell +.\scripts\install.ps1 -Reload +``` + +It removes the junction and makes it again (the repo files stay), and Herdr +loads the mod from scratch. ## Uninstall diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 964424b..15e08ea 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -2,11 +2,16 @@ # # .\scripts\install.ps1 install (idempotent) # .\scripts\install.ps1 -Uninstall remove the junction, restore backups +# .\scripts\install.ps1 -Reload recreate the junction so Herdr loads the mod again +# +# Herdr does NOT see changes behind the junction on its own: after editing +# mod\ovis-composer run -Reload (the junction is removed and made again, and +# Herdr reloads the mod). # # Works on Windows PowerShell 5. [CmdletBinding()] -param([switch]$Uninstall) +param([switch]$Uninstall, [switch]$Reload) $ErrorActionPreference = 'Stop' @@ -65,6 +70,18 @@ function Install-KeyEntry { Write-Host "keys.json: $chord -> $action" } +if ($Reload) { + if (-not (Test-Junction $Junction)) { throw "$Junction is not a junction - run install.ps1 first." } + Remove-Junction $Junction + if (-not (Test-Path -LiteralPath (Join-Path $ModSource 'main.js'))) { + throw 'Repo files vanished after removing the junction - aborting.' + } + cmd /c mklink /J "`"$Junction`"" "`"$ModSource`"" | Out-Null + if ($LASTEXITCODE -ne 0) { throw 'mklink /J failed' } + Write-Host "Junction recreated: $Junction -> $ModSource (Herdr loads the mod again)" + exit 0 +} + if ($Uninstall) { if (Test-Junction $Junction) { Remove-Junction $Junction @@ -131,3 +148,7 @@ Write-Host "Layout copied" # 3. Key binding (Task 2). Install-KeyEntry + +# 4. Show the layout. +herdr-app do layout.switch '{"name":"ovis-composer"}' +if ($LASTEXITCODE -ne 0) { Write-Warning "layout.switch to ovis-composer failed (exit $LASTEXITCODE) - switch the layout by hand." }