Documentation
¶
Overview ¶
Package cli wires up the prosa CLI: cobra command tree, persistent flags, and the dispatcher for sub-commands. Rendering lives in internal/cli/render; long-running progress in internal/cli/spinner.
Index ¶
- func Execute() int
- func IsInteractive() bool
- func ParseBetween(s string) (time.Time, time.Time, error)
- func ParseLast(s string) (time.Duration, error)
- func ParseSince(s string) (time.Time, error)
- func TerminalWidth() int
- func WindowDescriptor(w Window) string
- type Match
- type ProjectScope
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute() int
Execute is the entry point invoked by cmd/prosa/main.go. It returns the process exit code (0 on success, 1 on error).
func IsInteractive ¶
func IsInteractive() bool
IsInteractive reports whether both stdout and stderr are attached to a TTY. Bubble Tea and color rendering disable themselves when either is piped or redirected — common in cron/LaunchAgent invocations where otherwise we'd emit ANSI escape garbage into log files.
func ParseBetween ¶
ParseBetween parses "YYYY-MM-DD..YYYY-MM-DD" into an inclusive UTC range. End is the last nanosecond of the second day; end must be >= start.
func ParseLast ¶
ParseLast parses window strings like "7d", "12h", "45m". Days ("7d") are handled here because time.ParseDuration doesn't understand them.
func ParseSince ¶
ParseSince parses a YYYY-MM-DD date in UTC as the start of the day.
func TerminalWidth ¶
func TerminalWidth() int
TerminalWidth returns the current stdout width, falling back to the design baseline when stdout is not attached to a terminal.
func WindowDescriptor ¶
WindowDescriptor returns a phrase for empty-state messages ("no sessions <X>").
Types ¶
type Match ¶
Match is the resolved auto-filter target. Exactly one of Remote/Marker/Path is populated; callers use that to choose which SessionFilter dimension to set. When none matches, Found is false.
func DetectProject ¶
DetectProject resolves the project for timeline auto-filtering per INTENT §5: git remote → .prosa.yaml marker → longest project_path ancestor. Returns Match{Found: false} when nothing matches.
type ProjectScope ¶
type ProjectScope struct {
Scope render.ContextScope
Label string
Project string
Match Match
}
ProjectScope is the resolved project scope for read commands.
func ResolveProjectScope ¶
func ResolveProjectScope(ctx context.Context, flags globalFlags, s *store.Store) ProjectScope
func ResolveProjectScopeFromLocalStore ¶
func ResolveProjectScopeFromLocalStore(ctx context.Context, flags globalFlags) ProjectScope
func (ProjectScope) ApplyListRequest ¶
func (s ProjectScope) ApplyListRequest(req *prosav1.ListRequest)
func (ProjectScope) ApplyReportRequest ¶
func (s ProjectScope) ApplyReportRequest(req *prosav1.GetReportRequest)
func (ProjectScope) ApplySearchRequest ¶
func (s ProjectScope) ApplySearchRequest(req *prosav1.SearchRequest)
func (ProjectScope) ApplySessionFilter ¶
func (s ProjectScope) ApplySessionFilter(filter *store.SessionFilter)
type Window ¶
type Window struct {
Since, Until time.Time
LastLabel string // "7d" — non-empty iff window came from --last
SinceLabel string // "2026-01-01" — non-empty iff --since
BetweenLabel string // "2026-01-01 and 2026-03-15" — non-empty iff --between
HeatmapLabel string // "53 weeks" — non-empty iff the fixed heatmap window
}
Window is the resolved time range for a query plus the descriptor labels the renderer uses to assemble the context line. Exactly one of LastLabel / SinceLabel / BetweenLabel / HeatmapLabel is non-empty after a successful ResolveWindow or HeatmapWindow.
func HeatmapWindow ¶
HeatmapWindow returns the fixed 53-week trailing window aligned to Sunday in UTC. Canonical spec: docs/panel/screens.md (heatmap).
func ResolveWindow ¶
ResolveWindow resolves the time window from exactly one of --last / --since / --between. --last is "active" only when explicitly set (Cobra Changed check), so the default "7d" doesn't shadow --since or --between.
func (Window) LastSegment ¶
LastSegment returns the label for the "last X" context line tail, collapsing LastLabel and HeatmapLabel so call sites don't branch.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package browser opens URLs in the system default browser.
|
Package browser opens URLs in the system default browser. |
|
Package render formats the prosa timeline for both interactive terminals (Lipgloss colors, day-grouped headers, active markers) and non-interactive sinks (pipes/redirects/scripts — plain tab-separated rows without escape codes).
|
Package render formats the prosa timeline for both interactive terminals (Lipgloss colors, day-grouped headers, active markers) and non-interactive sinks (pipes/redirects/scripts — plain tab-separated rows without escape codes). |
|
Package rpc loads the saved auth.json and constructs Connect clients that automatically attach the Bearer token.
|
Package rpc loads the saved auth.json and constructs Connect clients that automatically attach the Bearer token. |
|
Package schedule installs and removes the prosa-sync background job using the OS-native scheduler: launchd on macOS, systemd user timers on Linux.
|
Package schedule installs and removes the prosa-sync background job using the OS-native scheduler: launchd on macOS, systemd user timers on Linux. |
|
Package spinner provides a Bubble Tea progress display for `prosa sync`.
|
Package spinner provides a Bubble Tea progress display for `prosa sync`. |