v0.5.5
This release focuses on strict watch mode correctness, crash-safe file operations, Windows cleanup reliability, and more resilient glob and compare behavior. Strict watch now reports current state vs baseline (git-diff style), and config/status writes are protected with file locking and atomic writes to prevent corruption.
🔁 Changed
Strict Watch: State-Based Diffing
- Strict watch violations now show current state vs baseline, not accumulated history.
- Reverting breaking changes back to baseline now removes the violations file (no violations = no file).
--log-fileremains append-based for event history.- Missing third-party dependencies are no longer reported as strict watch violations.
🐞 Fixed
Watch Mode Cleanup on Exit
- Ensured
watch_status.jsonis deleted reliably on Windows and Cursor. - Signal handlers are registered at watch startup.
- Absolute path resolution for status file cleanup.
- Added synchronous fallback via
process.on('exit'). - MCP tools now clean up stale status files when PID validation fails.
Watch Mode Revert Correctness
- Prevented cache inconsistency when
pack()fails during incremental rebuild. - Restores contracts from the previous bundle on revert.
- Preserves reverse index entries.
- Rebuilds manifest and contracts from actual bundle contents.
Resilient Glob Failure Handling
- Continues processing remaining patterns when one fails.
- Returns partial results when at least one pattern succeeds.
- Throws aggregate error only when all patterns fail.
- Logs partial failures in debug mode.
Config Race Condition (TOCTOU)
- Introduced lightweight file locking (
O_CREAT | O_EXCL). - Locks detect and clean stale processes safely.
- Conservative ESRCH vs EPERM distinction to avoid deleting valid locks.
- Configurable timeout and retry behavior.
- No new dependencies.
Atomic File Writes
- Config and status files now use temp-file + rename pattern.
- Prevents partial writes if process crashes.
- Temp files are cleaned up on error.
Compare Handler Control Flow
- Added explicit
returnbeforeprocess.exit()in compare handler to prevent unintended execution.
🧪 Tests
- Added comprehensive cleanup utility tests.
- Added file locking tests (concurrency, stale detection, timeout).
- Added CLI routing and command tests.
- Added strict watch mode tests.
- Expanded glob failure handling coverage.
- All tests passing.
🔗 Related PRs