@house365/comate 0.9.15 → 0.9.16

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": "@house365/comate",
3
- "version": "0.9.15",
3
+ "version": "0.9.16",
4
4
  "description": "comate —— SDD (规约驱动开发) 的 AI 开发编排器(Agent Skills)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -314,13 +314,26 @@ _hash_stream() {
314
314
  fi
315
315
  }
316
316
 
317
- # hash_file <file> — sha256 hex of one file.
317
+ # _hash_file_stream <file> - emit canonical content for hashing.
318
+ # Text files are normalized to LF so a checkout/tool that temporarily writes
319
+ # CRLF cannot create a false provenance or impl_hash drift. Binary files stay
320
+ # byte-for-byte unchanged.
321
+ _hash_file_stream() {
322
+ local file="$1"
323
+ if [ ! -s "$file" ] || LC_ALL=C grep -Iq . "$file" 2>/dev/null; then
324
+ sed 's/\r$//' "$file"
325
+ else
326
+ cat "$file"
327
+ fi
328
+ }
329
+
330
+ # hash_file <file> - sha256 hex of one file (LF-canonical for text).
318
331
  hash_file() {
319
332
  local file="$1"
320
333
  if command -v sha256sum >/dev/null 2>&1; then
321
- sha256sum "$file" | awk '{print $1}'
334
+ _hash_file_stream "$file" | sha256sum | awk '{print $1}'
322
335
  elif command -v shasum >/dev/null 2>&1; then
323
- shasum -a 256 "$file" | awk '{print $1}'
336
+ _hash_file_stream "$file" | shasum -a 256 | awk '{print $1}'
324
337
  else
325
338
  die "$COMATE_ENV" "ERROR: sha256sum or shasum is required"
326
339
  fi
@@ -336,6 +336,30 @@ seed_open() {
336
336
  [[ "$output" == *'impl_hash'*'fail'* ]] || [[ "$output" == *'"block":true'* ]]
337
337
  }
338
338
 
339
+ # --- line-ending stability ---
340
+
341
+ @test "impl_hash ignores text line-ending changes" {
342
+ comate state demo init fix
343
+ local d="openspec/changes/demo"
344
+ printf '# p\n' > "$d/proposal.md"
345
+ printf '# d\n' > "$d/design.md"
346
+ printf '# plan\n' > "$d/plan.md"
347
+ printf -- '- [x] t1\n' > "$d/tasks.md"
348
+ comate state demo set plan "$d/plan.md" >/dev/null
349
+ comate guard demo open --apply >/dev/null 2>&1
350
+ comate handoff demo build --write >/dev/null 2>&1
351
+ comate guard demo build --apply >/dev/null 2>&1
352
+
353
+ printf '# plan\r\n' > "$d/plan.md"
354
+ printf -- '- [x] t1\r\n' > "$d/tasks.md"
355
+ printf 'verification\n' > "$d/verification.md"
356
+ comate state demo set verification_report "$d/verification.md" >/dev/null
357
+ comate state demo set branch_status handled >/dev/null
358
+ run comate guard demo verify --json
359
+ [ "$status" -eq 0 ]
360
+ [[ "$output" == *'impl_hash matches current plan+tasks'*'pass'* ]]
361
+ }
362
+
339
363
  # --- archive ---
340
364
 
341
365
  @test "archive delegates spec merge to openspec instead of copying delta over main" {