Files
settled-reach/tooling/atlas-commit-and-sync
T
jpmschweitzerandClaude Opus 4.6 ff4a055ae5 feat(tooling): add atlas-update-field and atlas-commit-and-sync scripts
atlas-update-field: update system-level fields across star_systems,
system_gates, and system_history tables with field whitelist.
atlas-commit-and-sync: full per-system pipeline (verify → wipe → commit
→ sync-wiki → git commit). Updated atlas SKILL.md with new commands.

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

61 lines
1.6 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; d=json.load(open('$FILE')); print(d.get('proper_name') or d['system_id'])")
# 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)"