75 lines
1.8 KiB
Bash
Executable File
75 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# BortStack ChatGPT snapshot generator
|
|
#
|
|
# Creates a lightweight repository snapshot containing the material
|
|
# needed for ChatGPT/Codex engineering work while excluding dependencies,
|
|
# Git history, caches, build output and other reproducible files.
|
|
|
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
cd "$REPO_ROOT"
|
|
|
|
DATE="$(date +%Y-%m-%d-%H%M)"
|
|
BRANCH="$(git branch --show-current)"
|
|
COMMIT="$(git rev-parse --short HEAD)"
|
|
|
|
OUTPUT_DIR="${REPO_ROOT}/snapshots"
|
|
OUTPUT_FILE="${OUTPUT_DIR}/bortstack-chatgpt-${DATE}-${COMMIT}.zip"
|
|
|
|
mkdir -p "$OUTPUT_DIR"
|
|
TEMP_FILE="$(mktemp "${OUTPUT_DIR}/.bortstack-chatgpt-XXXXXX.zip")"
|
|
rm -f "$TEMP_FILE"
|
|
trap 'rm -f "$TEMP_FILE"' EXIT
|
|
|
|
echo "BortStack ChatGPT Snapshot"
|
|
echo "============================="
|
|
echo "Branch: $BRANCH"
|
|
echo "Commit: $COMMIT"
|
|
echo "Output: $OUTPUT_FILE"
|
|
echo
|
|
|
|
zip -r -y "$TEMP_FILE" . \
|
|
-x ".git" \
|
|
".git/*" \
|
|
".aws/*" \
|
|
".codex/*" \
|
|
".agents/*" \
|
|
".env" \
|
|
".env.*" \
|
|
"*/.env" \
|
|
"*/.env.*" \
|
|
"*.pem" \
|
|
"*.key" \
|
|
"*.sqlite" \
|
|
"*.sqlite3" \
|
|
"*.db" \
|
|
".local/*" \
|
|
"api/.venv/*" \
|
|
"react/node_modules/*" \
|
|
"react/dist/*" \
|
|
"react/test-results/*" \
|
|
"*/__pycache__/*" \
|
|
"*.pyc" \
|
|
"*.pyo" \
|
|
"*/.pytest_cache/*" \
|
|
"*/.cache/*" \
|
|
"snapshots/*" \
|
|
"*.log" \
|
|
".DS_Store" \
|
|
"image-artifacts/" \
|
|
"image-artifacts/*" \
|
|
".task-worktrees/" \
|
|
".task-worktrees/*" \
|
|
".test-worktrees/" \
|
|
".test-worktrees/*"
|
|
|
|
mv -f "$TEMP_FILE" "$OUTPUT_FILE"
|
|
|
|
echo
|
|
echo "Snapshot complete."
|
|
echo "Size: $(du -h "$OUTPUT_FILE" | cut -f1)"
|
|
echo "Branch: $BRANCH"
|
|
echo "Commit: $COMMIT"
|
|
echo "File: $OUTPUT_FILE"
|