Skip to content

Add --before and --after time filtering with relative time support to gh aw inspect#103

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/fix-102
Closed

Add --before and --after time filtering with relative time support to gh aw inspect#103
Copilot wants to merge 4 commits intomainfrom
copilot/fix-102

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 19, 2025

This PR adds time-based filtering capabilities to the gh aw inspect command, supporting both absolute dates and relative time expressions like -24h (24 hours ago) or -3d (3 days ago).

Changes Made

Extended Time Delta System

  • Enhanced the existing TimeDelta struct to support negative relative times by adding a Sign field
  • Updated parseTimeDelta function to accept both + and - prefixes (e.g., +24h, -24h)
  • Added isRelativeTime helper function to detect relative time expressions
  • Added ResolveRelativeTime function to convert relative times to absolute timestamps
  • Maintained backward compatibility with existing stop-time frontmatter field functionality

Enhanced Inspect Command

  • Added --before and --after flags to filter workflow results by time
  • Supports multiple time formats:
    • Negative relative times: -24h, -3d, -1d12h30m (hours/days/minutes ago)
    • Positive relative times: +24h, +3d (hours/days/minutes from now)
    • Absolute dates: 2024-12-31 23:59:59, June 1, 2025, 1st January 2025
  • Added comprehensive time validation with helpful error messages
  • Enhanced verbose mode to show resolved absolute timestamps for relative times
  • Updated command help with examples and usage information

Example Usage

# Filter results after 24 hours ago
gh aw inspect weekly-research --after "-24h"

# Filter results between 3 and 1 days ago  
gh aw inspect weekly-research --after "-3d" --before "-1d"

# Mix relative and absolute times
gh aw inspect weekly-research --after "-1d12h30m" --before "2024-01-01"

# Verbose mode shows resolved timestamps
gh aw inspect weekly-research --after "-24h" --verbose
# Output: After: -24h (resolved to 2025-08-18 04:03:47 UTC)

Testing

  • Added comprehensive tests for negative relative time parsing
  • Updated existing tests to maintain backward compatibility
  • All CLI integration tests pass
  • Manual testing confirms proper validation and error handling

The existing time delta system for the stop-time frontmatter field now supports both positive and negative relative times, and this enhanced functionality is now available as filtering options in the inspect command.

Fixes #102.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build309341679/b270/cli.test -test.testlogfile=/tmp/go-build309341679/b270/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build1217218078/b001/cli.test -test.testlogfile=/tmp/go-build1217218078/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build1669324914/b270/cli.test -test.testlogfile=/tmp/go-build1669324914/b270/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits August 19, 2025 03:54
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… gh aw inspect

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] [copilot] update gh aw inspect time filter (--before, --after) to support relative time (-24) Add --before and --after time filtering with relative time support to gh aw inspect Aug 19, 2025
Copilot AI requested a review from pelikhan August 19, 2025 04:04
@pelikhan pelikhan closed this Aug 19, 2025
@pelikhan pelikhan deleted the copilot/fix-102 branch August 19, 2025 04:15
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.

[copilot] update gh aw inspect time filter (--before, --after) to support relative time (-24)

2 participants