Skip to content

feat(cli): add --date flag to match GUI anomaly_date parameter#89

Merged
bordumb merged 9 commits intomainfrom
fn-29
Jan 27, 2026
Merged

feat(cli): add --date flag to match GUI anomaly_date parameter#89
bordumb merged 9 commits intomainfrom
fn-29

Conversation

@bordumb
Copy link
Copy Markdown
Owner

@bordumb bordumb commented Jan 27, 2026

Summary

  • Add missing --date flag to CLI that maps to anomaly_date in the SDK
  • Ensures CLI investigations target the correct date like the GUI does
  • Previously CLI defaulted to today's date, causing investigations to look at wrong time range

Changes

  • Add --date option (YYYY-MM-DD format, defaults to today)
  • Pass anomaly_date to start_investigation() call
  • Add test for --date flag
  • Update CLI docs with --date in options table and examples

Test plan

  • Run uv run pytest python-packages/dataing-cli/tests/test_commands_run.py -v - all 12 tests pass
  • Verify dataing run start --help shows the --date flag
  • Pre-commit checks pass

🤖 Generated with Claude Code

bordumb and others added 9 commits January 27, 2026 00:01
Add new Rich formatting functions to display.py:
- format_timestamp(): elapsed time as [MM:SS]
- format_hypothesis(): blue-bordered hypothesis panels
- format_query(): yellow-bordered SQL with syntax highlighting
- format_evidence_item(): green/red panels based on support
- format_synthesis(): cyan panel with root cause and recommendations

All formatters handle missing fields gracefully and truncate
long SQL content (>20 lines) with ellipsis indicator.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Panels accumulate progressively (don't replace each other)
- Each panel shows [MM:SS] elapsed timestamp prefix
- Hypotheses numbered sequentially (#1, #2, etc.)
- Event type mapping: hypothesis_testing, run_evidence, run_completed
- Timeline persists after completion (transient=False)
- Heartbeat events refresh display without new panels
- Ctrl+C exits cleanly with code 130
- Updated test to match new "Synthesis" output format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add --no-stream flag: waits silently, outputs final result only
- Deprecate --no-watch (still works, exits immediately after URL)
- Add _wait_for_completion() helper for silent waiting
- Support both JSON and Rich output modes with --no-stream
- Exit code 0 on success, 1 on failure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove indent=2 from JSON output (NDJSON requires single-line)
- Add separators=(",", ":") for compact output
- Use print() instead of console.print() to avoid ANSI codes
- Each event is now one parseable JSON line

Output is now compatible with jq streaming:
  dataing run start ... --json | jq .event

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Detect non-TTY stdout with sys.stdout.isatty()
- Add _watch_run_plain_text() for piped output
- Plain text format: [MM:SS] event_type: message
- No ANSI codes when output is piped to file/tee
- Updated test to accept both Rich and plain text formats

Works with: dataing run start ... > output.txt
Works with: dataing run start ... | tee output.log

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add 20 new test cases for timeline display functionality:
- TestFormatTimestamp: elapsed time formatting
- TestFormatHypothesis: blue panels with numbering
- TestFormatQuery: yellow panels with SQL highlighting, truncation
- TestFormatEvidenceItem: green/red/yellow based on verdict
- TestFormatSynthesis: cyan panels with recommendations
- TestTimelineFormattersEdgeCases: missing data, mock objects

All 108 CLI tests now pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update cli.md with progressive timeline display documentation
- Add color coding table for event types (hypothesis, query, evidence, synthesis)
- Document --no-stream flag for wait-and-output behavior
- Document NDJSON streaming format with examples
- Document non-TTY plain text fallback
- Update justfile demo output with explicit CLI commands:
  - dataing run start with streaming timeline
  - dataing --json for NDJSON output
  - dataing --no-stream for scripted usage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use main.orders, main.events etc. (correct for DuckDB demo)
- Schema qualification is standard for real databases:
  - PostgreSQL: schema.table (e.g., public.orders)
  - Snowflake: database.schema.table
  - DuckDB: schema.table (e.g., main.orders)
- Keep user_id (matches demo fixture anomaly)
- Update justfile demo commands with correct table names

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add missing --date flag to CLI that maps to anomaly_date in the SDK,
ensuring CLI investigations target the correct date like the GUI does.

- Add --date option (YYYY-MM-DD format, defaults to today)
- Pass anomaly_date to start_investigation() call
- Add test for --date flag
- Update CLI docs with --date in options table and examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
dataing Ready Ready Preview, Comment Jan 27, 2026 2:28am
dataing-app Ready Ready Preview, Comment Jan 27, 2026 2:28am
dataing-docs Ready Ready Preview, Comment Jan 27, 2026 2:28am

@bordumb bordumb merged commit c7a4f7a into main Jan 27, 2026
4 checks passed
bordumb pushed a commit that referenced this pull request Jan 27, 2026
# [1.5.0](v1.4.0...v1.5.0) (2026-01-27)

### Features

* **cli:** add --date flag to match GUI anomaly_date parameter ([#89](#89)) ([c7a4f7a](c7a4f7a)), closes [#1](#1) [#2](#2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant