feat(coding-bahn): Quelle ist der PC - OpenCode laeuft lokal, Modell kommt ueber MC2 :9001
Kurswechsel: Projekte liegen lokal, OpenChamber arbeitet an lokalen Dateien, push nach Gitea, Box zieht via projekte-sync nach. Kein Box-Umbau noetig - MC2 :9001/v1 reicht die Rollen-Aliase bereits durch. Box-Server auf :4096 zurueckgebaut, ufw-Regel entfernt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c8e5a7162b
commit
56668ee43d
@@ -0,0 +1,82 @@
|
||||
<#
|
||||
push-und-sync.ps1 — der Handschlag zwischen PC und AI-Box (21.08.2026).
|
||||
|
||||
Bahn: PC (Quelle der Wahrheit) -> Gitea -> Box ~/projekte
|
||||
|
||||
Warum ueberhaupt ein Skript: `projekte-sync` laeuft auf der Box stuendlich. Wer
|
||||
gerade gepusht hat, will aber nicht bis zu 60 Minuten warten. Das hier stoesst
|
||||
denselben Dienst sofort an — kein zweiter Mechanismus, nur ein Ausloeser.
|
||||
|
||||
Warum PowerShell und nicht Git-Bash: Push zum Gitea geht vom PC nur ueber den
|
||||
Git Credential Manager, und den gibt es hier (Lehre vom 24.07.).
|
||||
|
||||
Aufruf (im Projektordner):
|
||||
.\deploy\push-und-sync.ps1
|
||||
.\deploy\push-und-sync.ps1 -NurSync # nicht pushen, nur Box nachziehen
|
||||
.\deploy\push-und-sync.ps1 -Pfad "F:\Coding Stuff\rippy"
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string] $Pfad = (Get-Location).Path,
|
||||
[switch] $NurSync,
|
||||
[string] $BoxHost = "hitonabi@192.168.178.151"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Schritt($text) { Write-Host "`n== $text" -ForegroundColor Cyan }
|
||||
function Gut($text) { Write-Host " $text" -ForegroundColor Green }
|
||||
function Warn($text) { Write-Host " $text" -ForegroundColor Yellow }
|
||||
|
||||
Set-Location $Pfad
|
||||
|
||||
# --- 1. Ist das ueberhaupt ein Repo, und was steht an? ---------------------
|
||||
$null = git rev-parse --is-inside-work-tree 2>$null
|
||||
if ($LASTEXITCODE -ne 0) { throw "Kein Git-Repository: $Pfad" }
|
||||
|
||||
$zweig = (git branch --show-current).Trim()
|
||||
|
||||
# Repo-Name aus der Remote-URL, NICHT aus dem Ordnernamen: der lokale Ordner heisst
|
||||
# z. B. "mission-control-2", das Gitea-Repo aber "mission-control-v2". Der Ordnername
|
||||
# haette die Box-Abfrage still ins Leere laufen lassen.
|
||||
$remote = (git remote get-url origin).Trim()
|
||||
$repo = [System.IO.Path]::GetFileNameWithoutExtension(($remote -split '/')[-1])
|
||||
Schritt "Repo '$repo', Zweig '$zweig'"
|
||||
|
||||
$offen = git status --porcelain
|
||||
if ($offen) {
|
||||
Warn "Es liegen unversionierte/ungespeicherte Aenderungen:"
|
||||
$offen | Select-Object -First 10 | ForEach-Object { Warn " $_" }
|
||||
Warn "Diese werden NICHT mitgeschickt. Erst committen, dann erneut aufrufen."
|
||||
}
|
||||
|
||||
# --- 2. Pushen ------------------------------------------------------------
|
||||
if (-not $NurSync) {
|
||||
$ausstehend = git log --oneline "origin/$zweig..HEAD" 2>$null
|
||||
if (-not $ausstehend) {
|
||||
Gut "Nichts zu pushen — Gitea ist bereits auf Stand."
|
||||
} else {
|
||||
Schritt "Push nach Gitea ($(($ausstehend | Measure-Object).Count) Commit(s))"
|
||||
$ausstehend | ForEach-Object { Write-Host " $_" }
|
||||
git push origin $zweig
|
||||
if ($LASTEXITCODE -ne 0) { throw "Push fehlgeschlagen. Haengt die DDNS-Domain? Interne Adresse ist http://192.168.178.153:3000" }
|
||||
Gut "gepusht"
|
||||
}
|
||||
}
|
||||
|
||||
# --- 3. Box nachziehen lassen --------------------------------------------
|
||||
Schritt "Box zieht nach (projekte-sync)"
|
||||
ssh $BoxHost "systemctl --user start projekte-sync.service"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Sync-Dienst liess sich nicht starten." }
|
||||
|
||||
$stand = ssh $BoxHost "cd ~/projekte/$repo 2>/dev/null && git log --oneline -1 || echo 'NICHT-IN-PROJEKTE'"
|
||||
if ($stand -eq "NICHT-IN-PROJEKTE") {
|
||||
Warn "'$repo' liegt nicht unter ~/projekte."
|
||||
Warn "Bei mission-control-v2 ist das ABSICHT: das Live-Deployment liegt in ~/mission-control-v2"
|
||||
Warn "und wird bewusst nicht automatisch gezogen — es braucht seinen eigenen Deploy-Schritt."
|
||||
} else {
|
||||
Gut "Box steht jetzt auf: $stand"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Reference in New Issue
Block a user