Decision-Linked Development (DLD) — a workflow for recording, linking, and maintaining development decisions alongside code. Skills for planning, recording, implementing, auditing, and documenting decisions via @decision annotations.
55
69%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Advisory
Suggest reviewing before use
#!/usr/bin/env bash
# Detect locally-added decision files whose IDs collide with the base branch or open PRs.
# Output: one line per collision: <relative-path>\t<DL-NNN>
# Exits 0 with no output if there are no collisions.
# Usage: find-collisions.sh [--base <ref>]
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../../dld-common/scripts/common.sh"
BASE="origin/main"
while [[ $# -gt 0 ]]; do
case "$1" in
--base) BASE="$2"; shift 2 ;;
*) echo "Unknown arg: $1" >&2; exit 1 ;;
esac
done
PROJECT_ROOT="$(get_project_root)"
RECORDS_DIR_REL="$(config_get decisions_dir)/records"
if ! git -C "$PROJECT_ROOT" rev-parse --verify --quiet "$BASE^{commit}" >/dev/null; then
echo "Error: base ref '$BASE' not found." >&2
exit 1
fi
TAKEN=$(bash "$SCRIPT_DIR/list-taken-ids.sh" --base "$BASE")
LOCAL_ADDED=$(git -C "$PROJECT_ROOT" diff --name-only --diff-filter=A "$BASE"...HEAD -- "$RECORDS_DIR_REL" 2>/dev/null || true)
if [[ -z "$LOCAL_ADDED" ]]; then
exit 0
fi
while IFS= read -r path; do
[[ -z "$path" ]] && continue
id=$(basename "$path" .md)
if [[ ! "$id" =~ ^DL-[0-9]+$ ]]; then
continue
fi
if grep -qxF "$id" <<<"$TAKEN"; then
printf "%s\t%s\n" "$path" "$id"
fi
done <<< "$LOCAL_ADDED"