Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: use pinned submodule commits in update scripts, reject dirty working tree before standardization

Adam Eivycb60193d75e5
diff --git a/server/services/pm2Standardizer.js b/server/services/pm2Standardizer.js
index 314d669f4e..0c5fb6daf2 100644
--- a/server/services/pm2Standardizer.js
+++ b/server/services/pm2Standardizer.js
@@ -309,7 +309,8 @@ module.exports = ${configStr};
}
/**
- * Create git backup before modifications
+ * Create git backup before modifications.
+ * Refuses to proceed if the working tree has uncommitted changes to avoid data loss.
*/
export async function createGitBackup(repoPath) {
// Check if git repo
@@ -317,6 +318,12 @@ export async function createGitBackup(repoPath) {
return { success: false, reason: 'Not a git repository' };
}
+ // Refuse to overwrite uncommitted changes
+ const { stdout: statusOut } = await execAsync('git status --porcelain', { cwd: repoPath, windowsHide: true });
+ if (statusOut.trim()) {
+ return { success: false, reason: 'Working tree has uncommitted changes — commit or discard them before standardizing' };
+ }
+
const timestamp = Date.now();
const branch = `portos-backup-${timestamp}`;
@@ -407,7 +414,7 @@ export async function applyStandardization(repoPath, plan) {
errors: []
};
- // Create git backup first
+ // Create git backup first — abort if working tree is dirty
if (plan.currentState.hasGit) {
const backup = await createGitBackup(repoPath);
if (backup.success) {
@@ -415,6 +422,9 @@ export async function applyStandardization(repoPath, plan) {
console.log(`📦 Created backup branch: ${backup.branch}`);
} else {
console.log(`⚠️ Could not create backup: ${backup.reason}`);
+ if (backup.reason?.includes('uncommitted changes')) {
+ return { success: false, error: backup.reason, filesModified: [], errors: [backup.reason] };
+ }
}
}
diff --git a/update.ps1 b/update.ps1
index 8b989a3e4a..c01684a451 100644
--- a/update.ps1
+++ b/update.ps1
@@ -110,7 +110,7 @@ Write-SafeHost ""
# Update submodules (slash-do and any others)
Step "submodules" "running" "Updating submodules..."
-Invoke-Logged git submodule update --init --recursive --remote
+Invoke-Logged git submodule update --init --recursive
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Step "submodules" "done" "Submodules updated"
Write-SafeHost ""
diff --git a/update.sh b/update.sh
index 5fe0e2b99a..a67c49b35c 100755
--- a/update.sh
+++ b/update.sh
@@ -72,7 +72,7 @@ log ""
# Update submodules (slash-do and any others)
step "submodules" "running" "Updating submodules..."
-run git submodule update --init --recursive --remote
+run git submodule update --init --recursive
step "submodules" "done" "Submodules updated"
log ""