create codex configuration

This commit is contained in:
beatzaplenty committed 2026-04-21 12:44:32 +10:00
1 parent dd489aba0c
commit b3ebf4a596
5 files changed
+324

No files matched your search

Executable
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -euo pipefail
log() {
printf '[codex] %s\n' "$*"
}
warn() {
printf '[codex][warn] %s\n' "$*" >&2
}
die() {
printf '[codex][error] %s\n' "$*" >&2
exit 1
}
have() {
command -v "$1" >/dev/null 2>&1
}
repo_root() {
git rev-parse --show-toplevel 2>/dev/null || pwd
}
cd_repo_root() {
cd "$(repo_root)"
}
ensure_file() {
local path="$1"
[[ -f "$path" ]] || die "Required file not found: $path"
}
ensure_dir() {
local path="$1"
mkdir -p "$path"
}
append_if_missing() {
local line="$1"
local file="$2"
touch "$file"
grep -Fqx "$line" "$file" || printf '%s\n' "$line" >> "$file"
}