Refactor repo for standalone portable provider workflow

This commit is contained in:
beatz174-bit
2026-04-21 13:10:19 +10:00
parent bf179254b5
commit 3b6d62ba07
9 changed files with 171 additions and 203 deletions
+8 -11
View File
@@ -13,7 +13,7 @@ echo "time: $(date -u +%FT%TZ)"
echo
echo "--- tools ---"
for cmd in bash git python3 docker; do
for cmd in bash git go terraform; do
if have "$cmd"; then
echo "$cmd: $(command -v "$cmd")"
else
@@ -23,17 +23,14 @@ done
echo
echo "--- repo ---"
[[ -f services-up.sh ]] && echo "services-up.sh: present" || echo "services-up.sh: missing"
[[ -d core ]] && echo "core/: present" || true
[[ -d apps ]] && echo "apps/: present" || true
[[ -d monitoring ]] && echo "monitoring/: present" || true
for path in README.md go.mod main.go internal/provider/provider.go; do
if [[ -f "$path" ]]; then
echo "$path: present"
else
echo "$path: missing"
fi
done
echo
echo "--- git status ---"
git status --short || true
echo
if have docker && docker compose version >/dev/null 2>&1; then
echo "--- docker compose ---"
docker compose version || true
fi
+7 -72
View File
@@ -7,80 +7,15 @@ source "$SCRIPT_DIR/lib.sh"
cd_repo_root
log "Starting Codex environment setup in $(pwd)"
log "Refreshing Codex environment and running repository checks"
if ! have git; then
die "git is required"
fi
"$SCRIPT_DIR/setup.sh"
if ! have bash; then
die "bash is required"
fi
# Keep all Codex-local state inside the repo or user home.
ensure_dir .codex
ensure_dir .codex/bin
ensure_dir .codex/cache
ensure_dir .codex/tmp
ensure_dir .codex/logs
# Useful environment defaults for repeatable non-interactive runs.
cat > .codex/env <<'EOF'
export CI=1
export TERM=xterm-256color
export PYTHONDONTWRITEBYTECODE=1
export PIP_DISABLE_PIP_VERSION_CHECK=1
export PIP_NO_INPUT=1
export GIT_PAGER=cat
EOF
# Optional Python venv for helper tooling.
if have python3; then
log "python3 detected"
if [[ ! -d .codex/venv ]]; then
python3 -m venv .codex/venv
fi
# shellcheck disable=SC1091
source .codex/venv/bin/activate
python -m pip install --upgrade pip setuptools wheel >/dev/null
# Install only lightweight tooling that is broadly useful.
python -m pip install \
pyyaml \
requests \
jinja2 \
>/dev/null
if [[ -x scripts/check.sh ]]; then
./scripts/check.sh
else
warn "python3 not found; skipping virtualenv setup"
log "scripts/check.sh not found; running go test ./..."
go test ./...
fi
# Basic repo checks based on your environment style.
if [[ -f services-up.sh ]]; then
log "Found services-up.sh"
chmod +x services-up.sh || true
else
warn "services-up.sh not found at repo root"
fi
# Make codex scripts executable.
find codex -maxdepth 1 -type f -name '*.sh' -exec chmod +x {} +
# Create a simple local ignore file for Codex-generated junk if needed.
touch .git/info/exclude
append_if_missing ".codex/" .git/info/exclude
append_if_missing ".pytest_cache/" .git/info/exclude
append_if_missing "__pycache__/" .git/info/exclude
# Helpful summary file for Codex tasks.
cat > .codex/README.md <<'EOF'
This directory contains local, disposable Codex environment state.
Contents:
- env: shell exports for non-interactive work
- venv: optional Python virtual environment
- cache/: tool cache
- tmp/: temporary files
- logs/: script logs
EOF
log "Setup complete"
log "Maintenance complete"
+7 -46
View File
@@ -7,34 +7,24 @@ source "$SCRIPT_DIR/lib.sh"
cd_repo_root
log "Starting Codex environment setup in $(pwd)"
log "Preparing repository-local Codex environment in $(pwd)"
if ! have git; then
die "git is required"
fi
for cmd in bash git; do
have "$cmd" || die "$cmd is required"
done
if ! have bash; then
die "bash is required"
fi
# Keep all Codex-local state inside the repo or user home.
ensure_dir .codex
ensure_dir .codex/bin
ensure_dir .codex/cache
ensure_dir .codex/tmp
ensure_dir .codex/logs
# Useful environment defaults for repeatable non-interactive runs.
cat > .codex/env <<'EOF'
cat > .codex/env <<'ENVEOF'
export CI=1
export TERM=xterm-256color
export PYTHONDONTWRITEBYTECODE=1
export PIP_DISABLE_PIP_VERSION_CHECK=1
export PIP_NO_INPUT=1
export GIT_PAGER=cat
EOF
ENVEOF
# Optional Python venv for helper tooling.
if have python3; then
log "python3 detected"
if [[ ! -d .codex/venv ]]; then
@@ -43,44 +33,15 @@ if have python3; then
# shellcheck disable=SC1091
source .codex/venv/bin/activate
python -m pip install --upgrade pip setuptools wheel >/dev/null
# Install only lightweight tooling that is broadly useful.
python -m pip install \
pyyaml \
requests \
jinja2 \
>/dev/null
else
warn "python3 not found; skipping virtualenv setup"
warn "python3 not found; skipping optional venv setup"
fi
# Basic repo checks based on your environment style.
if [[ -f services-up.sh ]]; then
log "Found services-up.sh"
chmod +x services-up.sh || true
else
warn "services-up.sh not found at repo root"
fi
# Make codex scripts executable.
find codex -maxdepth 1 -type f -name '*.sh' -exec chmod +x {} +
# Create a simple local ignore file for Codex-generated junk if needed.
touch .git/info/exclude
append_if_missing ".codex/" .git/info/exclude
append_if_missing ".pytest_cache/" .git/info/exclude
append_if_missing "__pycache__/" .git/info/exclude
# Helpful summary file for Codex tasks.
cat > .codex/README.md <<'EOF'
This directory contains local, disposable Codex environment state.
Contents:
- env: shell exports for non-interactive work
- venv: optional Python virtual environment
- cache/: tool cache
- tmp/: temporary files
- logs/: script logs
EOF
log "Setup complete"