mirror of
https://github.com/instructkr/claude-code.git
synced 2026-05-28 16:36:45 +00:00
Add a lightweight ROADMAP duplicate-id guard and wire it into the low-risk docs/pre-push paths so optimistic append collisions introduced after the next-id helper are caught before merge. Constraint: Current ROADMAP contains legacy numbered lists and pre-helper duplicate low ids, so the default guard checks helper-era ids >=723 while preserving --min-id 1 for a future strict audit. Rejected: Fail CI on every numeric duplicate in the whole historical ROADMAP | current main would fail before this PR because old prose/list numbering is already duplicated. Confidence: high Scope-risk: narrow Directive: Keep roadmap-next-id.sh paired with roadmap-check-ids.sh when changing ROADMAP append workflows. Tested: bash -n scripts/roadmap-check-ids.sh scripts/roadmap-next-id.sh .github/hooks/pre-push; scripts/roadmap-check-ids.sh; temp ROADMAP copy with duplicate 723 failed nonzero and listed id 723; SKIP_CLAW_PRE_PUSH_BUILD=1 .github/hooks/pre-push; git diff --check; python3 .github/scripts/check_doc_source_of_truth.py; python3 .github/scripts/check_release_readiness.py Not-tested: full cargo workspace build/test because this is docs/scripts-only and the local pre-push cargo build was smoke-tested with its documented skip path.
35 lines
1.0 KiB
Bash
Executable File
35 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# roadmap-next-id.sh — print the next available ROADMAP item id.
|
|
# Usage: scripts/roadmap-next-id.sh [path/to/ROADMAP.md]
|
|
#
|
|
# Designed to be used before appending a new entry so that concurrent
|
|
# dogfood claws do not accidentally reuse the same id:
|
|
#
|
|
# NEXT=$(scripts/roadmap-next-id.sh)
|
|
# cat >> ROADMAP.md << EOF
|
|
# ${NEXT}. **...description...**
|
|
# EOF
|
|
#
|
|
# The script reads the highest numeric id prefix from ROADMAP.md and
|
|
# prints highest+1. It does not lock the file; callers working in
|
|
# parallel should git-pull immediately before appending, run
|
|
# scripts/roadmap-check-ids.sh before push, and resolve any append
|
|
# collision at git-push time.
|
|
set -euo pipefail
|
|
|
|
ROADMAP="${1:-ROADMAP.md}"
|
|
|
|
if [[ ! -f "$ROADMAP" ]]; then
|
|
echo "error: ROADMAP not found at $ROADMAP" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Find the highest leading integer from lines that start with a number + '.'.
|
|
highest=$(grep -E '^[0-9]+\.' "$ROADMAP" | grep -Eo '^[0-9]+' | sort -n | tail -1)
|
|
|
|
if [[ -z "$highest" ]]; then
|
|
echo 1
|
|
else
|
|
echo $(( highest + 1 ))
|
|
fi
|