Commit graph

4 commits

Author SHA1 Message Date
Test User
3ed0a9d9ff fix(date): improve cross-platform date command compatibility
Fixes date command errors on macOS with Homebrew GNU coreutils:
- 'date: invalid option -- v' when GNU date runs BSD syntax
- 'syntax error in expression' when stat returns filesystem metadata

Changes:
- Replace uname-based detection with capability detection (try/fallback)
- Try GNU commands first, fall back to BSD, then ultimate fallbacks
- Add date -r fallback for file mtime (most portable)

This handles mixed environments where uname returns "Darwin" but
GNU coreutils are in PATH from Homebrew.

Credit: @farce1 (PR #119)
2026-02-02 09:39:39 -07:00
Test User
fdff095c18 feat(analyzer): add Claude CLI JSON format support and session management
- Extend parse_json_response() to support both flat and Claude CLI formats
  - Extract result, sessionId, and metadata fields
  - Support metadata.files_changed, metadata.has_errors, completion_status
  - Parse progress_indicators array for confidence boosting
- Add session management functions for continuity tracking:
  - store_session_id(): Persist session with ISO timestamp
  - get_last_session_id(): Retrieve stored session ID
  - should_resume_session(): Check session validity (24-hour expiration)
- Add get_epoch_seconds() to date_utils.sh for cross-platform epoch time
- Auto-persist sessionId to .session_id file during response analysis
- Add 16 new TDD tests for Claude CLI format and session management
- Update documentation for v0.9.6 (239 tests total)

Test count: 239 (up from 223)
2026-01-09 17:46:02 -07:00
frankbria
70279c017e fix(date): ensure Linux date utility returns UTC timestamps
Add -u flag to GNU date command in get_iso_timestamp() to match
the macOS implementation and function documentation. Both platforms
now consistently return UTC timestamps in YYYY-MM-DDTHH:MM:SS+00:00
format.

Before: date -Iseconds (returned local time on Linux)
After:  date -u -Iseconds (returns UTC on Linux)
2025-12-31 16:48:24 -07:00
frankbria
3d7db2c3ae feat(date): add cross-platform date compatibility for macOS and Linux
Add cross-platform date utility library to handle differences between
GNU date (Linux) and BSD date (macOS). Fixes issues with:
- ISO 8601 timestamp formatting (-Iseconds flag)
- Date arithmetic operations (-d vs -v flags)

Changes:
- Created lib/date_utils.sh with get_iso_timestamp() and get_next_hour_time()
- Updated ralph_loop.sh to use date utilities (2 instances)
- Updated lib/circuit_breaker.sh to use date utilities (4 instances)
- Updated lib/response_analyzer.sh to use date utilities (1 instance)

All date operations now work consistently across both platforms without
modification. The utility automatically detects the OS and uses the
appropriate date command syntax.

Tested on Linux with GNU date - all syntax checks and integration tests pass.
2025-12-31 16:04:49 -07:00