@windyroad/architect 0.3.1-preview.95 → 0.3.2-preview.99

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.3.1-preview.95",
3
+ "version": "0.3.2-preview.99",
4
4
  "description": "Architecture decision enforcement for AI coding agents",
5
5
  "bin": {
6
6
  "windyroad-architect": "./bin/install.mjs"
@@ -56,10 +56,27 @@ Before writing the ADR file, perform a decision-boundary analysis on the gathere
56
56
 
57
57
  ### 3. Determine sequence number and filename
58
58
 
59
- - Next number = highest existing decision number + 1 (or 001 if none exist)
59
+ - Next number = **max of the local and origin highest decision numbers**, plus 1 (or 001 if none exist).
60
60
  - Filename: `NNN-decision-title-in-kebab-case.proposed.md`
61
61
  - Pad the number to 3 digits (001, 002, ... 010, 011, etc.)
62
62
 
63
+ **Why compare against origin?** Per ADR-019 confirmation criterion 2, ticket-creator skills MUST re-check next-number assignment against `git ls-tree origin/<base>` before assigning. Without it, parallel sessions can mint the same ADR number for different decisions, causing a destructive surgical rebase on push (this was the failure mode that motivated ADR-019 itself).
64
+
65
+ ```bash
66
+ # Local-max number
67
+ local_max=$(ls docs/decisions/*.md 2>/dev/null | sed 's/.*\///' | grep -oE '^[0-9]+' | sort -n | tail -1)
68
+
69
+ # Origin-max number — reads remote-tracking ref; no fetch needed here
70
+ # because `wr-architect:agent` upstream callers (e.g. work-problems) run
71
+ # the Step 0 preflight that does the fetch.
72
+ origin_max=$(git ls-tree origin/main docs/decisions/ 2>/dev/null | grep -oE '[0-9]{3}' | sort -n | tail -1)
73
+
74
+ # Take the max of the two and increment.
75
+ next=$(printf '%03d' $(( $(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
76
+ ```
77
+
78
+ 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").
79
+
63
80
  ### 4. Write the ADR
64
81
 
65
82
  Write the file to `docs/decisions/` with this structure:
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bats
2
+ # Doc-lint guard: create-adr SKILL.md step 3 (Determine sequence number)
3
+ # must include the next-ID collision guard against origin per ADR-019
4
+ # confirmation criterion 2.
5
+ #
6
+ # Structural assertion — Permitted Exception to the source-grep ban (ADR-005 / P011).
7
+ # These tests assert that the skill specification document instructs the
8
+ # ADR creator to compare next-number against origin/<base> before
9
+ # assigning, so parallel sessions don't produce colliding ADR numbers.
10
+ #
11
+ # Cross-reference:
12
+ # P043 (next-ID collision guard in ticket-creator skills)
13
+ # ADR-019 (AFK orchestrator preflight, including next-ID guard)
14
+
15
+ setup() {
16
+ SKILL_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
17
+ SKILL_FILE="${SKILL_DIR}/SKILL.md"
18
+ }
19
+
20
+ @test "SKILL.md cites ADR-019 (next-ID collision guard)" {
21
+ run grep -n "ADR-019" "$SKILL_FILE"
22
+ [ "$status" -eq 0 ]
23
+ }
24
+
25
+ @test "SKILL.md step 3 references git ls-tree origin for next-number lookup" {
26
+ # ADR-019 mechanism: the ADR creator MUST re-check next-number against
27
+ # `git ls-tree origin/<base>` before assigning.
28
+ run grep -n "git ls-tree origin" "$SKILL_FILE"
29
+ [ "$status" -eq 0 ]
30
+ }
31
+
32
+ @test "SKILL.md mentions taking the max of local and origin numbers" {
33
+ run grep -niE "max of (the )?(two|local and origin)|max\(.*origin" "$SKILL_FILE"
34
+ [ "$status" -eq 0 ]
35
+ }