@windyroad/architect 0.6.1 → 0.6.2-preview.300

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "wr-architect",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Architecture decision enforcement for Claude Code"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/architect",
3
- "version": "0.6.1",
3
+ "version": "0.6.2-preview.300",
4
4
  "description": "Architecture decision enforcement for AI coding agents",
5
5
  "bin": {
6
6
  "windyroad-architect": "./bin/install.mjs"
@@ -56,7 +56,7 @@ Same P056-safe `local_max + origin_max + 1` formula as `/wr-architect:create-adr
56
56
  ```bash
57
57
  local_max=$(ls docs/decisions/*.md 2>/dev/null | sed 's/.*\///' | grep -oE '^[0-9]+' | sort -n | tail -1)
58
58
  origin_max=$(git ls-tree --name-only origin/main docs/decisions/ 2>/dev/null | sed 's|^docs/decisions/||' | grep -oE '^[0-9]+' | sort -n | tail -1)
59
- next=$(printf '%03d' $(( $(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
59
+ next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
60
60
  ```
61
61
 
62
62
  `--name-only` is required (P056): without it, each `git ls-tree` line includes the 40-char blob SHA which can contain three-digit runs that the digit-extraction regex false-matches.
@@ -97,7 +97,7 @@ teardown() {
97
97
  [ "$local_max" = "123" ]
98
98
 
99
99
  # No origin available in the fixture; default to 0 then increment.
100
- next=$(printf '%03d' $(( $(echo -e "${local_max:-0}\n0" | sort -n | tail -1) + 1 )))
100
+ next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n0" | sort -n | tail -1) + 1 )))
101
101
  [ "$next" = "124" ]
102
102
  }
103
103
 
@@ -107,7 +107,7 @@ teardown() {
107
107
  | sed 's/.*\///' \
108
108
  | grep -oE '^[0-9]+' \
109
109
  | sort -n | tail -1)
110
- next=$(printf '%03d' $(( $(echo -e "${local_max:-0}\n0" | sort -n | tail -1) + 1 )))
110
+ next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n0" | sort -n | tail -1) + 1 )))
111
111
  [ "$next" = "001" ]
112
112
  }
113
113
 
@@ -119,10 +119,29 @@ teardown() {
119
119
  local_max=50
120
120
  origin_max=175 # parallel session pushed ADR-175
121
121
 
122
- next=$(printf '%03d' $(( $(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
122
+ next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
123
123
  [ "$next" = "176" ]
124
124
  }
125
125
 
126
+ @test "capture-adr: next-ID handles 099 → 100 transition without octal-eval failure (P164)" {
127
+ # P164 regression: bash $(( ... )) parses leading-zero numbers as octal.
128
+ # `099` is invalid octal (digits >= 8). Without `10#` prefix, this fires:
129
+ # bash: 099: value too great for base (error token is "099")
130
+ # The fix is the standard `10#` base-10 prefix on the inner $(echo ... | tail -1).
131
+ mkdir -p "$TMPROOT/docs/decisions"
132
+ : > "$TMPROOT/docs/decisions/098-foo.proposed.md"
133
+ : > "$TMPROOT/docs/decisions/099-bar.proposed.md"
134
+
135
+ local_max=$(ls "$TMPROOT/docs/decisions"/*.md 2>/dev/null \
136
+ | sed 's/.*\///' \
137
+ | grep -oE '^[0-9]+' \
138
+ | sort -n | tail -1)
139
+ [ "$local_max" = "099" ]
140
+
141
+ next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n0" | sort -n | tail -1) + 1 )))
142
+ [ "$next" = "100" ]
143
+ }
144
+
126
145
  # ---------------------------------------------------------------------------
127
146
  # Skeleton-fill MADR shape — capture-adr writes a deferred-placeholder ADR
128
147
  # at status: proposed. Load-bearing primitives:
@@ -78,7 +78,7 @@ local_max=$(ls docs/decisions/*.md 2>/dev/null | sed 's/.*\///' | grep -oE '^[0-
78
78
  origin_max=$(git ls-tree --name-only origin/main docs/decisions/ 2>/dev/null | sed 's|^docs/decisions/||' | grep -oE '^[0-9]+' | sort -n | tail -1)
79
79
 
80
80
  # Take the max of the two and increment.
81
- next=$(printf '%03d' $(( $(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
81
+ next=$(printf '%03d' $(( 10#$(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
82
82
  ```
83
83
 
84
84
  If the local choice would have collided with an origin ADR created since the last fetch, the `git ls-tree origin/<base>` lookup catches it here and the renumber is automatic. Log the renumber in the user-facing report (e.g. "Bumped next ADR number from 020 → 021 to avoid collision with origin").