sync: auto-sync from GURU-5070 at 2026-06-06 15:46:17
Author: Mike Swanson Machine: GURU-5070 Timestamp: 2026-06-06 15:46:17
This commit is contained in:
@@ -30,6 +30,11 @@ param(
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$u = $env:USERPROFILE
|
||||
|
||||
# Decode native (git) stdout as UTF-8 so captured patch text is not mangled, and give
|
||||
# us a UTF-8 (no BOM) encoding for writing patches `git apply` can actually parse.
|
||||
try { [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false) } catch {}
|
||||
$Utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
|
||||
function Save($src,$dst){
|
||||
if (Test-Path -LiteralPath $src) {
|
||||
$p = Split-Path $dst -Parent; if (-not (Test-Path $p)) { New-Item -ItemType Directory -Force -Path $p | Out-Null }
|
||||
@@ -81,6 +86,37 @@ if (Test-Path "$ClaudeToolsRoot\.claude\state") { Copy-Item "$ClaudeToolsRoot\.c
|
||||
Copy-Item "$ClaudeToolsRoot\.claude\bootstrap\*.ps1" "$root\bootstrap\" -Force -ErrorAction SilentlyContinue
|
||||
Copy-Item "$ClaudeToolsRoot\.claude\bootstrap\RESTORE.md" "$root\bootstrap\" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# --- at-risk local WIP: stashes + untracked diffs that are on NO remote ---
|
||||
# Written as UTF-8 (no BOM, LF) so restore-at-risk-work.ps1 / `git apply` can parse them.
|
||||
# (Earlier ad-hoc captures used PowerShell `>` redirection = UTF-16, which git apply
|
||||
# rejects with "No valid patches in input" - hence the explicit byte-level write here.)
|
||||
$awRoot = "$root\at-risk-work"
|
||||
function Save-RepoStashes($repo,$label){
|
||||
if (-not (Test-Path "$repo\.git")) { return }
|
||||
$marks = @(& git -C $repo stash list --format='%gd' 2>$null)
|
||||
if (-not $marks) { return }
|
||||
$dir = "$awRoot\$label"; New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
||||
$base = (& git -C $repo rev-parse HEAD 2>$null)
|
||||
[System.IO.File]::WriteAllText("$dir\BASE-COMMIT.txt", "$base`n", $Utf8NoBom)
|
||||
for ($i=0; $i -lt $marks.Count; $i++) {
|
||||
$files = @(& git -C $repo stash show --name-only "stash@{$i}" 2>$null)
|
||||
$slug = if ($files.Count) { ([IO.Path]::GetFileNameWithoutExtension($files[0])) -replace '[^\w\-]','_' } else { "stash$i" }
|
||||
$lines = @(& git -C $repo --no-pager stash show -p "stash@{$i}" 2>$null)
|
||||
[System.IO.File]::WriteAllText("$dir\stash$i-$slug.patch", (($lines -join "`n") + "`n"), $Utf8NoBom)
|
||||
Write-Host "[OK] at-risk stash: $label stash@{$i} -> stash$i-$slug.patch"
|
||||
}
|
||||
}
|
||||
Save-RepoStashes "$ClaudeToolsRoot\projects\msp-tools\guru-rmm" 'guru-rmm'
|
||||
Save-RepoStashes "$ClaudeToolsRoot\projects\msp-tools\guru-connect" 'guru-connect'
|
||||
# untracked working diffs (e.g. tmp-*.diff) that aren't committed anywhere
|
||||
$gcRepo = "$ClaudeToolsRoot\projects\msp-tools\guru-connect"
|
||||
if (Test-Path $gcRepo) {
|
||||
Get-ChildItem $gcRepo -Filter 'tmp-*.diff' -File -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
$dir = "$awRoot\guru-connect"; New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
||||
Copy-Item $_.FullName "$dir\$($_.Name)" -Force; Write-Host "[OK] at-risk untracked diff: guru-connect\$($_.Name)"
|
||||
}
|
||||
}
|
||||
|
||||
# --- manifests ---
|
||||
$m = "$root\manifests"
|
||||
$tools = 'node','npm','claude','gemini','grok','ollama','py','git','gh','jq','sops','age','cargo','rustc','code','op'
|
||||
|
||||
Reference in New Issue
Block a user