@aiassesstech/mighty-mark 0.6.15 → 0.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiassesstech/mighty-mark",
3
- "version": "0.6.15",
3
+ "version": "0.6.17",
4
4
  "description": "System Health Sentinel for AI Assess Tech Fleet — autonomous monitoring, watchdog recovery, and fleet infrastructure oversight.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -89,10 +89,6 @@ PUSH_WORK=""
89
89
 
90
90
  cleanup() {
91
91
  [[ -n "$STAGING_DIR" ]] && rm -rf "$STAGING_DIR"
92
- [[ -n "$PUSH_WORK" ]] && rm -rf "$PUSH_WORK"
93
- if [[ -n "${GITHUB_REPO_DIR:-}" ]]; then
94
- git -C "$GITHUB_REPO_DIR" worktree prune 2>/dev/null || true
95
- fi
96
92
  }
97
93
 
98
94
  on_error() {
@@ -298,7 +294,6 @@ log "Manifest: $MANIFEST_FILE"
298
294
  if [[ "${PUSH_TO_GITHUB:-false}" == "true" ]] && [[ -d "${GITHUB_REPO_DIR:-}" ]]; then
299
295
  log "Pushing backup to GitHub (branch: $GITHUB_BACKUP_BRANCH)..."
300
296
 
301
- PUSH_WORK=$(mktemp -d "/tmp/fleet-backup-push-XXXXXX")
302
297
  GITHUB_RETENTION=${GITHUB_RETENTION:-14}
303
298
 
304
299
  (
@@ -312,15 +307,15 @@ if [[ "${PUSH_TO_GITHUB:-false}" == "true" ]] && [[ -d "${GITHUB_REPO_DIR:-}" ]]
312
307
 
313
308
  git fetch origin "$GITHUB_BACKUP_BRANCH" 2>/dev/null || true
314
309
 
315
- if git rev-parse --verify "origin/$GITHUB_BACKUP_BRANCH" >/dev/null 2>&1; then
316
- git worktree add "$PUSH_WORK" "origin/$GITHUB_BACKUP_BRANCH" 2>/dev/null || true
317
- cd "$PUSH_WORK"
318
- git checkout -B "$GITHUB_BACKUP_BRANCH" 2>/dev/null || true
310
+ CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
311
+ if [[ "$CURRENT_BRANCH" != "$GITHUB_BACKUP_BRANCH" ]]; then
312
+ if git rev-parse --verify "origin/$GITHUB_BACKUP_BRANCH" >/dev/null 2>&1; then
313
+ git checkout -B "$GITHUB_BACKUP_BRANCH" "origin/$GITHUB_BACKUP_BRANCH" 2>/dev/null || true
314
+ else
315
+ git checkout --orphan "$GITHUB_BACKUP_BRANCH"
316
+ fi
319
317
  else
320
- cd "$PUSH_WORK"
321
- git init
322
- git remote add origin "$REMOTE_URL"
323
- git checkout --orphan "$GITHUB_BACKUP_BRANCH"
318
+ git reset --hard "origin/$GITHUB_BACKUP_BRANCH" 2>/dev/null || true
324
319
  fi
325
320
 
326
321
  # Split large archives into chunks under GitHub's file size limit
@@ -344,7 +339,6 @@ if [[ "${PUSH_TO_GITHUB:-false}" == "true" ]] && [[ -d "${GITHUB_REPO_DIR:-}" ]]
344
339
  log " Pruning $PRUNE_COUNT old backup(s) from GitHub (keeping last $GITHUB_RETENTION)..."
345
340
  ls -1t fleet-*.tar.gz | tail -n "$PRUNE_COUNT" | while read -r OLD; do
346
341
  rm -f "$OLD"
347
- # Also remove any split chunks for this archive
348
342
  rm -f "${OLD}".part-* 2>/dev/null
349
343
  log " Removed: $OLD"
350
344
  done