@windyroad/itil 0.55.0 → 0.55.1-preview.836

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.
@@ -497,5 +497,5 @@
497
497
  }
498
498
  },
499
499
  "name": "wr-itil",
500
- "version": "0.55.0"
500
+ "version": "0.55.1"
501
501
  }
@@ -12,6 +12,11 @@ setup() {
12
12
  PLUGIN_ROOT="$REPO_ROOT/packages/itil"
13
13
  DIR="$(mktemp -d)"
14
14
  mkdir -p "$DIR/docs/rfcs"
15
+ # Hermeticity (P391): the AFK work-problems orchestrator exports
16
+ # WR_SUPPRESS_OVERSIGHT_NUDGE=1, which the hook self-suppresses on. Unset it so
17
+ # count-emitting tests assert real behaviour; guard-specific tests set it
18
+ # per-invocation via `run env WR_SUPPRESS_OVERSIGHT_NUDGE=...`.
19
+ unset WR_SUPPRESS_OVERSIGHT_NUDGE
15
20
  }
16
21
 
17
22
  teardown() { rm -rf "$DIR"; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/itil",
3
- "version": "0.55.0",
3
+ "version": "0.55.1-preview.836",
4
4
  "description": "ITIL-aligned IT service management for Claude Code (problem, and future incident/change skills)",
5
5
  "bin": {
6
6
  "windyroad-itil": "./bin/install.mjs"
@@ -183,6 +183,53 @@ EOF
183
183
  [ "$first_body" = "$second_body" ]
184
184
  }
185
185
 
186
+ @test "helper: multi-line section inserts before ## Fix Released under host awk (P392 BSD-awk getline fix)" {
187
+ # P392 — the insert-before-## Fix Released branch passed the multi-line
188
+ # new_section via `awk -v section=...`; BSD awk (macOS) rejects embedded
189
+ # newlines in a -v assignment and aborts (`awk: newline in string`),
190
+ # silently dropping the section refresh. This exercises that branch under
191
+ # the host awk: it must exit 0 AND place the rendered ## RFCs table
192
+ # immediately before ## Fix Released with the table rows intact.
193
+ cd "$WORKSPACE"
194
+ cat > docs/problems/open/202-released-problem.md <<'EOF'
195
+ # Problem 202: Released problem ticket
196
+
197
+ **Status**: Verifying
198
+
199
+ ## Description
200
+
201
+ Sample description.
202
+
203
+ ## Fix Released
204
+
205
+ Released in v1.2.3.
206
+ EOF
207
+ # RFC tracing problem 202 so a non-empty multi-line section is rendered
208
+ cat > docs/rfcs/RFC-100-sample-rfc.in-progress.md <<'EOF'
209
+ ---
210
+ status: in-progress
211
+ rfc-id: sample-rfc
212
+ problems: [P202]
213
+ adrs: []
214
+ jtbd: []
215
+ ---
216
+
217
+ # RFC-100: Sample RFC
218
+ EOF
219
+ run bash "$SCRIPT" docs/problems/open/202-released-problem.md RFCs
220
+ [ "$status" -eq 0 ]
221
+ grep -q '^## RFCs$' docs/problems/open/202-released-problem.md
222
+ grep -q 'RFC-100' docs/problems/open/202-released-problem.md
223
+ grep -q '^## Fix Released$' docs/problems/open/202-released-problem.md
224
+ # ## RFCs must precede ## Fix Released (inserted at the anchor, not at EOF)
225
+ local rfcs_line fix_line
226
+ rfcs_line=$(grep -n '^## RFCs$' docs/problems/open/202-released-problem.md | cut -d: -f1)
227
+ fix_line=$(grep -n '^## Fix Released$' docs/problems/open/202-released-problem.md | cut -d: -f1)
228
+ [ "$rfcs_line" -lt "$fix_line" ]
229
+ # The multi-line table row must survive intact
230
+ grep -q '| RFC-100 |' docs/problems/open/202-released-problem.md
231
+ }
232
+
186
233
  @test "helper: body does NOT contain a per-section-name branch (architect finding 4)" {
187
234
  # Structural test (tdd-review: structural-permitted —
188
235
  # justification: P176 SKILL.md I-invariant harness gap is the
@@ -263,10 +263,20 @@ mv "$tmp_file2" "$tmp_file"
263
263
  if [ -n "$new_section" ]; then
264
264
  if grep -q '^## Fix Released' "$tmp_file"; then
265
265
  tmp_file2="$(mktemp)"
266
- awk -v section="$new_section" '
267
- /^## Fix Released/ { printf "%s\n", section; print; next }
266
+ # Pass the multi-line section via a file: awk -v rejects embedded newlines
267
+ # on BSD awk (macOS), so getline keeps it portable across BSD awk + gawk
268
+ # (proven in effort-tally.sh --write, commit 1c967ba0; P392). new_section
269
+ # ends in a single \n, matching the prior `printf "%s\n", section` output.
270
+ section_file="$(mktemp)"
271
+ printf '%s' "$new_section" > "$section_file"
272
+ awk -v sf="$section_file" '
273
+ /^## Fix Released/ {
274
+ while ((getline ln < sf) > 0) print ln
275
+ close(sf); print ""; print; next
276
+ }
268
277
  { print }
269
278
  ' "$tmp_file" > "$tmp_file2"
279
+ rm -f "$section_file"
270
280
  mv "$tmp_file2" "$tmp_file"
271
281
  else
272
282
  # Ensure file ends with exactly one blank line before section