@windyroad/architect 0.12.2-preview.462 → 0.12.2-preview.464

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/architect",
3
- "version": "0.12.2-preview.462",
3
+ "version": "0.12.2-preview.464",
4
4
  "description": "Architecture decision enforcement for AI coding agents",
5
5
  "bin": {
6
6
  "windyroad-architect": "./bin/install.mjs"
@@ -23,6 +23,17 @@
23
23
 
24
24
  set -uo pipefail
25
25
 
26
+ # P334: force byte-locale for all awk/sed/sort/grep invocations in this script.
27
+ # Without this, BSD awk on macOS (default byte-counting for length/substr) and
28
+ # GNU awk on Linux (default character-counting under any UTF-8 locale) produce
29
+ # divergent output when ADR bodies contain multi-byte chars (em-dashes, smart
30
+ # quotes, etc.). LC_ALL=C makes both treat input as raw bytes — the truncated
31
+ # slice may cut mid-UTF-8 on long lines, but the output is byte-identical
32
+ # across platforms (which is what the CI drift gate at test 2145 enforces).
33
+ # Companion to the ASCII `...` change in compact_join_bullets/chosen
34
+ # truncation — both halves are needed to close P334.
35
+ export LC_ALL=C
36
+
26
37
  # --- Flag parsing ----------------------------------------------------------
27
38
  # `--check` (no write): generate to a temp file and diff against the on-disk
28
39
  # compendium. Exit 0 if byte-identical, 1 if drift, 2 if directory missing.
@@ -125,7 +136,10 @@ get_bullets() {
125
136
  | head -"$cap"
126
137
  }
127
138
 
128
- # Compact-join bullets onto one line, truncating each to N chars + "".
139
+ # Compact-join bullets onto one line, truncating each to N chars + "...".
140
+ # P334: ASCII "..." (3 bytes) instead of Unicode `…` (U+2026, 3 bytes UTF-8) so
141
+ # substr() length math agrees across BSD awk (byte-counting) and GNU awk
142
+ # (char-counting) without LC_ALL gymnastics. Sibling: P328.
129
143
  # Joins with "; ". Strips markdown emphasis to keep the line scannable.
130
144
  compact_join_bullets() {
131
145
  local per_item="${1:-120}"
@@ -138,7 +152,7 @@ compact_join_bullets() {
138
152
  gsub(/`/, "")
139
153
  # Drop nested-bullet continuation lines that survived earlier filters.
140
154
  if (length($0) == 0) next
141
- if (length($0) > n) line = substr($0, 1, n) ""
155
+ if (length($0) > n) line = substr($0, 1, n) "..."
142
156
  else line = $0
143
157
  if (out == "") out = line
144
158
  else out = out "; " line
@@ -188,7 +202,7 @@ truncate_with_ellipsis() {
188
202
  printf '%s' "$s"
189
203
  return
190
204
  fi
191
- printf '%s' "${s:0:n}"
205
+ printf '%s' "${s:0:n}..."
192
206
  }
193
207
 
194
208
  # --- Per-ADR entry emitter -------------------------------------------------
@@ -211,7 +225,7 @@ emit_entry() {
211
225
 
212
226
  # Chosen-option line — truncate to a comfortable summary length.
213
227
  chosen=$(get_chosen "$file" | strip_links | oneline)
214
- chosen=$(printf '%s' "$chosen" | awk -v n=240 '{ if (length($0) > n) print substr($0,1,n) ""; else print }')
228
+ chosen=$(printf '%s' "$chosen" | awk -v n=240 '{ if (length($0) > n) print substr($0,1,n) "..."; else print }')
215
229
 
216
230
  # Confirmation: cap 5 bullets, ≤ 110 chars each, joined with "; " on one line.
217
231
  # This is the routine-compliance scannable view; the full Confirmation list