@@ -76,23 +76,23 @@ is_tested() { grep -qx "$1" "$tmp/test_acs.txt"; }
7676
7777status_for () { # $1=id $2=done_tasks $3=pending_tasks
7878 local id=" $1 " done_t=" $2 " pend_t=" $3 " type=" ${1%% -* } "
79- if [ " $type " = " AC" ]; then
79+ if [[ " $type " == " AC" ] ]; then
8080 if is_tested " $id " ; then echo " verified" ; return ; fi
8181 if is_covered " $id " ; then
82- if [ -n " $pend_t " ]; then echo " implemented-test-pending" ; else echo " gap" ; fi
82+ if [[ -n " $pend_t " ] ]; then echo " implemented-test-pending" ; else echo " gap" ; fi
8383 return
8484 fi
8585 else
8686 if is_covered " $id " ; then
87- if [ -n " $pend_t " ]; then echo " in-progress" ; else echo " implemented" ; fi
87+ if [[ -n " $pend_t " ] ]; then echo " in-progress" ; else echo " implemented" ; fi
8888 return
8989 fi
9090 fi
91- if [ -n " $pend_t " ]; then
92- if [ -n " $done_t " ]; then echo " in-progress" ; else echo " planned" ; fi
91+ if [[ -n " $pend_t " ] ]; then
92+ if [[ -n " $done_t " ] ]; then echo " in-progress" ; else echo " planned" ; fi
9393 return
9494 fi
95- if [ -n " $done_t " ]; then echo " done-no-covers" ; return ; fi
95+ if [[ -n " $done_t " ] ]; then echo " done-no-covers" ; return ; fi
9696 echo " unmapped"
9797}
9898
@@ -109,12 +109,12 @@ write_json_file() { # $1=output path
109109 done_t=$( tasks_for " $id " " x" )
110110 pend_t=$( tasks_for " $id " " " )
111111 tests=" "
112- if [ " ${id%% -* } " = " AC" ]; then tests=$( tests_for " $id " ) ; fi
112+ if [[ " ${id%% -* } " == " AC" ] ]; then tests=$( tests_for " $id " ) ; fi
113113 covered=false
114114 if is_covered " $id " ; then covered=true; fi
115115 status=$( status_for " $id " " $done_t " " $pend_t " )
116116 domain=$( echo " $id " | cut -d- -f2)
117- if [ $first -eq 0 ]; then echo " ," ; fi
117+ if [[ $first -eq 0 ] ]; then echo " ," ; fi
118118 first=0
119119 printf ' {"id":"%s","type":"%s","domain":"%s","status":"%s","covered":%s,"doneTasks":[%s],"pendingTasks":[%s],"tests":[%s]}' \
120120 " $id " " ${id%% -* } " " $domain " " $status " " $covered " \
@@ -143,20 +143,20 @@ emit_matrix() {
143143 local type=" $1 " heading=" $2 " with_tests=" $3 "
144144 echo " ## $heading "
145145 echo
146- if [ " $with_tests " = " yes" ]; then
146+ if [[ " $with_tests " == " yes" ] ]; then
147147 echo " | ID | Status | Done tasks | Pending tasks | Tests |"
148148 echo " |----|--------|------------|---------------|-------|"
149149 else
150150 echo " | ID | Status | Done tasks | Pending tasks |"
151151 echo " |----|--------|------------|---------------|"
152152 fi
153153 while IFS= read -r id; do
154- [ " ${id%% -* } " = " $type " ] || continue
154+ [[ " ${id%% -* } " == " $type " ] ] || continue
155155 local done_t pend_t tests status
156156 done_t=$( tasks_for " $id " " x" )
157157 pend_t=$( tasks_for " $id " " " )
158158 status=$( label_for " $( status_for " $id " " $done_t " " $pend_t " ) " )
159- if [ " $with_tests " = " yes" ]; then
159+ if [[ " $with_tests " == " yes" ] ]; then
160160 tests=$( tests_for " $id " | tr ' ' ' \n' | { grep -v ' ^$' || true ; } | sed ' s/.*/`&`/' \
161161 | awk ' { printf "%s%s", (NR > 1 ? "<br>" : ""), $0 } END { print "" }' )
162162 echo " | $id | $status | ${done_t:- —} | ${pend_t:- —} | ${tests:- —} |"
@@ -245,14 +245,14 @@ SVGEOF
245245# ---------------------------------------------------------------------------
246246# Mode routing
247247# ---------------------------------------------------------------------------
248- if [ " $MODE " = " --json" ]; then
248+ if [[ " $MODE " == " --json" ] ]; then
249249 write_json_file /dev/stdout
250250 exit 0
251251fi
252252
253- if [ " $MODE " = " --canvas" ]; then
253+ if [[ " $MODE " == " --canvas" ] ]; then
254254 write_json_file " $tmp /data.json"
255- if [ ! -f " $CANVAS " ]; then
255+ if [[ ! -f " $CANVAS " ] ]; then
256256 echo " Canvas not found: $CANVAS " >&2
257257 echo " Set GOLDEN_THREAD_CANVAS or open the Golden Thread Coverage canvas once in Cursor." >&2
258258 exit 1
@@ -261,14 +261,14 @@ if [ "$MODE" = "--canvas" ]; then
261261 exit 0
262262fi
263263
264- if [ " $MODE " = " --matrix" ]; then
264+ if [[ " $MODE " == " --matrix" ] ]; then
265265 emit_matrix
266266 exit 0
267267fi
268268
269- if [ " $MODE " = " --refresh" ]; then
269+ if [[ " $MODE " == " --refresh" ] ]; then
270270 emit_matrix
271- if [ -f " $CANVAS " ]; then
271+ if [[ -f " $CANVAS " ] ]; then
272272 write_json_file " $tmp /data.json"
273273 python3 scripts/update-golden-thread-canvas.py " $tmp /data.json" " $CANVAS "
274274 else
@@ -291,20 +291,20 @@ done
291291
292292# --- 2. Tasks without a Traces field ----------------------------------------
293293untraced_tasks=$( grep -En ' ^- \[[ x]\] T[0-9]+' " $TASKS " | grep -v ' \*\*Traces\*\*' || true)
294- if [ -n " $untraced_tasks " ]; then
294+ if [[ -n " $untraced_tasks " ] ]; then
295295 err " tasks missing a Traces field:"
296296 echo " $untraced_tasks " | sed ' s/^/ /' >&2
297297fi
298298
299299# --- 3. Untraced scope (code/tests referencing unknown IDs) ------------------
300300orphan_covers=$( comm -13 " $tmp /prd.txt" " $tmp /covers.txt" )
301- if [ -n " $orphan_covers " ]; then
301+ if [[ -n " $orphan_covers " ] ]; then
302302 err " @covers IDs not in the PRD registry (untraced scope):"
303303 echo " $orphan_covers " | sed ' s/^/ /' >&2
304304fi
305305
306306orphan_tests=$( comm -13 <( grep ' ^AC-' " $tmp /prd.txt" ) " $tmp /test_acs.txt" )
307- if [ -n " $orphan_tests " ]; then
307+ if [[ -n " $orphan_tests " ] ]; then
308308 err " test names encode AC IDs not in the PRD registry (untraced scope):"
309309 echo " $orphan_tests " | sed ' s/^/ /' >&2
310310fi
@@ -331,7 +331,7 @@ echo " Untested ACs are tracked as pending tasks unless flagged above."
331331echo " Per-ID detail on demand: bash scripts/check-traceability.sh --json"
332332echo " Portfolio snapshot: bash scripts/check-traceability.sh --matrix"
333333
334- if [ " $fail " -ne 0 ]; then
334+ if [[ " $fail " -ne 0 ] ]; then
335335 echo " Gate 2: FAILED — golden thread broken (see FAIL lines above)." >&2
336336 exit 1
337337fi
0 commit comments