feat(scripts): add dev:local:archive to snapshot dev data for debugging

Archives ~/.super-multica-dev and ~/Documents/Multica-dev into
~/.super-multica-dev-archives/<timestamp>/ before cleaning, so the
state can be fed to AI for post-mortem analysis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jiayuan Zhang 2026-02-15 00:58:39 +08:00
parent 9e40e8ca76
commit af7deb5a02
2 changed files with 43 additions and 0 deletions

View file

@ -19,6 +19,7 @@
"dev:gateway": "pnpm --filter @multica/gateway dev",
"dev:web": "pnpm --filter @multica/web dev",
"dev:local": "bash scripts/dev-local.sh",
"dev:local:archive": "bash scripts/archive-dev-data.sh",
"dev:all": "concurrently \"pnpm dev:gateway\" \"pnpm dev:web\"",
"build": "turbo build",
"build:desktop": "pnpm --filter @multica/desktop build",

42
scripts/archive-dev-data.sh Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/env bash
#
# Archive and clean the dev environment data.
#
# Moves ~/.super-multica-dev and ~/Documents/Multica-dev into a
# timestamped archive directory for later debugging / analysis.
#
# Usage:
# pnpm dev:local:archive
#
# Archives are stored in: ~/.super-multica-dev-archives/<timestamp>/
set -euo pipefail
TIMESTAMP=$(date +"%Y%m%d-%H%M%S")
ARCHIVE_BASE="$HOME/.super-multica-dev-archives"
ARCHIVE_DIR="$ARCHIVE_BASE/$TIMESTAMP"
DEV_DATA="$HOME/.super-multica-dev"
DEV_WORKSPACE="$HOME/Documents/Multica-dev"
# Check if there's anything to archive
if [ ! -d "$DEV_DATA" ] && [ ! -d "$DEV_WORKSPACE" ]; then
echo "Nothing to archive — neither $DEV_DATA nor $DEV_WORKSPACE exists."
exit 0
fi
mkdir -p "$ARCHIVE_DIR"
if [ -d "$DEV_DATA" ]; then
mv "$DEV_DATA" "$ARCHIVE_DIR/data"
echo " Archived $DEV_DATA -> $ARCHIVE_DIR/data"
fi
if [ -d "$DEV_WORKSPACE" ]; then
mv "$DEV_WORKSPACE" "$ARCHIVE_DIR/workspace"
echo " Archived $DEV_WORKSPACE -> $ARCHIVE_DIR/workspace"
fi
echo ""
echo "Archived to: $ARCHIVE_DIR"
echo "Dev environment is now clean. Run 'pnpm dev:local' to start fresh."