Files
settled-reach/tooling/check-decision-ids
T
jpmschweitzerandClaude Opus 4.6 bc226d8baf chore(db): move db/connectors/ to tooling/db/ (#274)
Consolidates all connector scripts under tooling/ per project
structure conventions. Symlink at db/connectors → tooling/db/
preserves backwards compatibility (remove after Sprint 22).

Updated references in CLAUDE.md, Makefile, DEVOPS.md, all skill
files, agent files, rules, schema comments, and Sprint 21
briefings. Python scripts updated with correct SCHEMA_PATH
(now relative to WORKTREE_ROOT/db/schema.sql).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 11:08:00 +01:00

29 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Pre-commit check: detect duplicate decision IDs across decisions/*.md files.
# Fails if the same D-NNN, Q-NNN, or R-NNN appears in more than one file.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
# Use the decisions_sync.py check-dupes command
RESULT=$(python3 "$REPO_ROOT/tooling/db/decisions_sync.py" check-dupes 2>&1)
# Parse the JSON result
DUPES=$(echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('duplicates',0))" 2>/dev/null || echo "0")
TOTAL=$(echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('total_ids',0))" 2>/dev/null || echo "0")
if [ "$DUPES" -gt 0 ]; then
echo "check-decision-ids: FAILED — $DUPES duplicate ID(s) found"
echo "$RESULT" | python3 -c "
import sys, json
d = json.load(sys.stdin)
for detail in d.get('details', []):
print(f' {detail}')
" 2>/dev/null
exit 1
fi
echo "check-decision-ids: OK — $TOTAL unique IDs, no duplicates"
exit 0