Files
settled-reach/tooling/atlas-commit-and-sync
T
jpmschweitzerandClaude Opus 4.6 bc8b01bbe6 fix(atlas): address PR #102 review — wiki headers, injection fix, proposal updates
Wiki headers: fix star type mismatches on GJ 53A (K→G), GJ 136 (M→G),
GJ 625 (K→M), GJ 682 (K→M), GJ 3728B (G→K), GJ 1128 (K→M).
Tooling: fix shell injection in atlas-commit-and-sync (use sys.argv).
Proposals: GJ625 M2→M2V, GJ432A heritage descriptor, GJ667C triple-star
note, GJ53A G5Vp peculiar note.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 18:00:10 +02:00

61 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Commit a single system proposal to DB, sync wiki, and create a git commit.
# Handles wipe-if-exists automatically.
#
# Usage: atlas-commit-and-sync "GJ 105A" [corridor_tag]
# corridor_tag defaults to "east_reach"
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ATLAS="$SCRIPT_DIR/atlas"
if [[ $# -lt 1 ]]; then
echo "Usage: atlas-commit-and-sync SYSTEM_ID [corridor_tag]" >&2
exit 1
fi
SYS_ID="$1"
CORRIDOR="${2:-east_reach}"
SLUG="${SYS_ID// /}"
FILE="docs/atlas/proposals/${SLUG}.json"
WIKI_SLUG="${SYS_ID// /-}"
WIKI="wiki/star-systems/${WIKI_SLUG}/index.md"
if [[ ! -f "$FILE" ]]; then
echo "ERROR: proposal not found: $FILE" >&2
exit 1
fi
# 1. Verify
echo "--- Verifying $FILE"
"$SCRIPT_DIR/atlas-verify" "$FILE"
# 2. Get system info for commit message
PROPER=$(python3 -c "import json,sys; d=json.load(open(sys.argv[1])); print(d.get('proper_name') or d['system_id'])" "$FILE")
# 3. Wipe existing data if present
BODY_COUNT=$("$ATLAS" show-system "$SYS_ID" 2>/dev/null \
| python3 -c "import json,sys; d=json.load(sys.stdin); print(len(d.get('bodies',[])))" 2>/dev/null \
|| echo "0")
if [[ "$BODY_COUNT" -gt 0 ]]; then
echo "--- Wiping existing data for $SYS_ID"
"$ATLAS" wipe-system "$SYS_ID"
fi
# 4. Commit to DB
echo "--- Committing $SYS_ID to systems.db"
"$ATLAS" commit-system "$FILE"
# 5. Sync wiki
echo "--- Syncing wiki"
"$ATLAS" sync-wiki "$SYS_ID"
# 6. Git add + commit
echo "--- Git commit"
git add "$FILE"
[[ -f "$WIKI" ]] && git add "$WIKI"
git commit -m "data(atlas): author ${SYS_ID} (${PROPER}) — ${CORRIDOR}
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>"
echo "--- Done: $SYS_ID ($PROPER)"