detect

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package detect determines the reference time for change detection using markers, events, or flags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractTimestamp

func ExtractTimestamp(jsonLine string) (time.Time, bool)

ExtractTimestamp extracts a timestamp from a JSON line without full unmarshal. Looks for "timestamp":"..." and parses as RFC3339.

Parameters:

  • jsonLine: JSON string to extract timestamp from

Returns:

  • time.Time: Parsed timestamp
  • bool: True if extraction succeeded

func FromEvents

func FromEvents() (time.Time, bool)

FromEvents scans events.jsonl in reverse for the last context-load-gate event.

Returns:

  • time.Time: Event timestamp
  • bool: True if a valid event was found

func FromMarkers

func FromMarkers() (time.Time, bool)

FromMarkers finds the second most recent ctx-loaded-* marker file. The most recent is the current session's marker.

Returns:

  • time.Time: Marker file modification time
  • bool: True if a valid marker was found

func ParseSinceFlag

func ParseSinceFlag(since string) (time.Time, string, error)

ParseSinceFlag parses a duration (like "24h") or date (like "2026-03-01").

Parameters:

  • since: Time reference string to parse

Returns:

  • time.Time: Parsed time
  • string: Human-readable label
  • error: Non-nil if parsing fails

func ReferenceTime

func ReferenceTime(since string) (time.Time, string, error)

ReferenceTime determines the reference time for change detection.

Priority:

  1. --since flag (duration like "24h" or date like "2026-03-01")
  2. ctx-loaded-* marker files (second most recent by mtime)
  3. events.jsonl (last context-load-gate event)
  4. Fallback to 24h ago

Parameters:

  • since: User-provided time reference, or empty for auto-detection

Returns:

  • time.Time: The determined reference time
  • string: Human-readable label describing the reference point
  • error: Non-nil if the --since value cannot be parsed

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL