@aiassesstech/mighty-mark 0.6.13 → 0.6.14

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.13",
3
+ "version": "0.6.14",
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",
@@ -69,6 +69,10 @@ GITHUB_SSH_HOST="github-nole-backup"
69
69
  # Branch to store backup archives (keeps main branch clean)
70
70
  GITHUB_BACKUP_BRANCH="backups"
71
71
 
72
+ # How many backup archives to keep in the GitHub repo.
73
+ # Older archives are pruned each run to prevent unbounded repo growth.
74
+ GITHUB_RETENTION=14
75
+
72
76
  # Max file size for a single GitHub push (bytes). Files larger than
73
77
  # this are split into chunks. GitHub's limit is 100 MB.
74
78
  GITHUB_MAX_FILE_SIZE=$((95 * 1024 * 1024)) # 95 MB (with margin)
@@ -299,6 +299,7 @@ if [[ "${PUSH_TO_GITHUB:-false}" == "true" ]] && [[ -d "${GITHUB_REPO_DIR:-}" ]]
299
299
  log "Pushing backup to GitHub (branch: $GITHUB_BACKUP_BRANCH)..."
300
300
 
301
301
  PUSH_WORK=$(mktemp -d "/tmp/fleet-backup-push-XXXXXX")
302
+ GITHUB_RETENTION=${GITHUB_RETENTION:-14}
302
303
 
303
304
  (
304
305
  cd "$GITHUB_REPO_DIR"
@@ -322,9 +323,6 @@ if [[ "${PUSH_TO_GITHUB:-false}" == "true" ]] && [[ -d "${GITHUB_REPO_DIR:-}" ]]
322
323
  git checkout --orphan "$GITHUB_BACKUP_BRANCH"
323
324
  fi
324
325
 
325
- # Clean previous backup files from the working tree
326
- rm -f fleet-*.tar.gz fleet-*.tar.gz.part-* latest-manifest.json
327
-
328
326
  # Split large archives into chunks under GitHub's file size limit
329
327
  if [[ "$ARCHIVE_SIZE" -gt "${GITHUB_MAX_FILE_SIZE:-99614720}" ]]; then
330
328
  log " Splitting archive into chunks (${ARCHIVE_SIZE_MB} MB > limit)..."
@@ -339,6 +337,19 @@ if [[ "${PUSH_TO_GITHUB:-false}" == "true" ]] && [[ -d "${GITHUB_REPO_DIR:-}" ]]
339
337
 
340
338
  cp "$MANIFEST_FILE" ./latest-manifest.json
341
339
 
340
+ # Prune old backups beyond retention to prevent unbounded repo growth
341
+ ARCHIVE_COUNT=$(ls -1t fleet-*.tar.gz 2>/dev/null | wc -l | tr -d ' ')
342
+ if [[ "$ARCHIVE_COUNT" -gt "$GITHUB_RETENTION" ]]; then
343
+ PRUNE_COUNT=$((ARCHIVE_COUNT - GITHUB_RETENTION))
344
+ log " Pruning $PRUNE_COUNT old backup(s) from GitHub (keeping last $GITHUB_RETENTION)..."
345
+ ls -1t fleet-*.tar.gz | tail -n "$PRUNE_COUNT" | while read -r OLD; do
346
+ rm -f "$OLD"
347
+ # Also remove any split chunks for this archive
348
+ rm -f "${OLD}".part-* 2>/dev/null
349
+ log " Removed: $OLD"
350
+ done
351
+ fi
352
+
342
353
  git add -A
343
354
  git config user.name "Mighty Mark (Automated)"
344
355
  git config user.email "mighty-mark@aiassesstech.com"
@@ -353,7 +364,7 @@ Extensions: $EXTENSION_COUNT | Agents: $AGENT_COUNT | Memory files: $MEMORY_FILE
353
364
  Checksum: sha256:${CHECKSUM:0:16}...
354
365
  Agent: mighty-mark (sentinel duty — fleet safety checkpoint)"
355
366
 
356
- git push origin "$GITHUB_BACKUP_BRANCH" --force
367
+ git push origin "$GITHUB_BACKUP_BRANCH"
357
368
  log " Pushed to origin/$GITHUB_BACKUP_BRANCH"
358
369
  fi
359
370
  )