Add portable Codex ops kit

This commit is contained in:
slaguru666
2026-04-12 14:00:55 +01:00
commit aa907983db
19 changed files with 679 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
STAMP="$(date +%Y%m%d-%H%M%S)"
DEST="${1:-$REPO_ROOT/export/codex-portable-$STAMP}"
mkdir -p "$DEST"
mkdir -p "$DEST/codex-home"
copy_if_exists() {
local src="$1"
local dest="$2"
if [[ -e "$src" ]]; then
mkdir -p "$(dirname "$dest")"
cp -R "$src" "$dest"
fi
}
copy_if_exists "$CODEX_HOME/config.toml" "$DEST/codex-home/config.toml"
copy_if_exists "$CODEX_HOME/AGENTS.md" "$DEST/codex-home/AGENTS.md"
copy_if_exists "$CODEX_HOME/memories" "$DEST/codex-home/memories"
copy_if_exists "$CODEX_HOME/rules" "$DEST/codex-home/rules"
copy_if_exists "$REPO_ROOT/templates" "$DEST/templates"
copy_if_exists "$REPO_ROOT/memory" "$DEST/memory"
copy_if_exists "$REPO_ROOT/scripts" "$DEST/scripts"
copy_if_exists "$REPO_ROOT/docs" "$DEST/docs"
copy_if_exists "$REPO_ROOT/README.md" "$DEST/README.md"
cat > "$DEST/EXPORT_NOTES.txt" <<EOF
Portable Codex bundle created at:
$DEST
Included:
- config.toml
- AGENTS.md
- memories/
- rules/
- repo templates, memory, docs, and scripts
Excluded on purpose:
- auth.json
- sessions/
- logs SQLite files
- state SQLite files
- cache/
- plugins/
EOF
echo "Exported portable bundle to: $DEST"