progress

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package progress provides timestamped logging to file and stdout with color support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPathLockedByCurrentProcess added in v0.4.0

func IsPathLockedByCurrentProcess(path string) bool

IsPathLockedByCurrentProcess reports whether this process holds the active lock for path.

func TryLockFile added in v0.4.0

func TryLockFile(f *os.File) (bool, error)

TryLockFile attempts to acquire a non-blocking exclusive lock. Returns (true, nil) if lock acquired, (false, nil) if file is locked by another process.

Types

type Colors added in v0.2.0

type Colors struct {
	// contains filtered or unexported fields
}

Colors holds all color configuration for output formatting. use NewColors to create from config.ColorConfig.

func NewColors added in v0.2.0

func NewColors(cfg config.ColorConfig) *Colors

NewColors creates Colors from config.ColorConfig. all colors must be provided - use config with embedded defaults fallback. panics if any color value is invalid (configuration error).

func (*Colors) Error added in v0.2.0

func (c *Colors) Error() *color.Color

Error returns the error color.

func (*Colors) ForPhase added in v0.2.0

func (c *Colors) ForPhase(p status.Phase) *color.Color

ForPhase returns the color for the given execution phase.

func (*Colors) Info added in v0.2.0

func (c *Colors) Info() *color.Color

Info returns the info color for informational messages.

func (*Colors) Signal added in v0.2.0

func (c *Colors) Signal() *color.Color

Signal returns the signal color.

func (*Colors) Timestamp added in v0.2.0

func (c *Colors) Timestamp() *color.Color

Timestamp returns the timestamp color.

func (*Colors) Warn added in v0.2.0

func (c *Colors) Warn() *color.Color

Warn returns the warning color.

type Config

type Config struct {
	PlanFile        string // plan filename (used to derive progress filename)
	PlanDescription string // plan description for plan mode (used for filename)
	Mode            string // execution mode: full, review, codex-only, plan
	Branch          string // current git branch
	NoColor         bool   // disable color output (sets color.NoColor globally)
}

Config holds logger configuration.

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger writes timestamped output to both file and stdout.

func NewLogger

func NewLogger(cfg Config, colors *Colors, holder *status.PhaseHolder) (*Logger, error)

NewLogger creates a logger writing to both a progress file and stdout. if the progress file already exists with a completion footer, it is truncated and a fresh header is written. if the file exists without a completion footer (interrupted run), existing log is preserved and a restart separator is written. colors must be provided (created via NewColors from config). holder is the shared PhaseHolder for reading the current execution phase.

func (*Logger) Close

func (l *Logger) Close() error

Close writes footer, releases the file lock, and closes the progress file.

func (*Logger) Elapsed

func (l *Logger) Elapsed() string

Elapsed returns formatted elapsed time since start. for durations >= 1 hour, truncates to minutes (e.g. "1h23m"); otherwise to seconds (e.g. "5m30s").

func (*Logger) Error

func (l *Logger) Error(format string, args ...any)

Error writes an error message in red.

func (*Logger) LogAnswer added in v0.4.0

func (l *Logger) LogAnswer(answer string)

LogAnswer logs the user's answer for plan creation mode. format: ANSWER: <answer>

func (*Logger) LogDiffStats added in v0.10.0

func (l *Logger) LogDiffStats(files, additions, deletions int)

LogDiffStats writes git diff stats to the progress file (file-only, no stdout). format: [timestamp] DIFFSTATS: files=F additions=A deletions=D

func (*Logger) LogDraftReview added in v0.6.0

func (l *Logger) LogDraftReview(action, feedback string)

LogDraftReview logs the user's draft review action and optional feedback. format: DRAFT REVIEW: <action> if feedback is non-empty: FEEDBACK: <feedback>

func (*Logger) LogQuestion added in v0.4.0

func (l *Logger) LogQuestion(question string, options []string)

LogQuestion logs a question and its options for plan creation mode. format: QUESTION: <question>\n OPTIONS: <opt1>, <opt2>, ...

func (*Logger) Path

func (l *Logger) Path() string

Path returns the progress file path.

func (*Logger) Print

func (l *Logger) Print(format string, args ...any)

Print writes a timestamped message to both file and stdout.

func (*Logger) PrintAligned

func (l *Logger) PrintAligned(text string)

PrintAligned writes text with timestamp on each line, suppressing empty lines.

func (*Logger) PrintRaw

func (l *Logger) PrintRaw(format string, args ...any)

PrintRaw writes without timestamp (for streaming output).

func (*Logger) PrintSection

func (l *Logger) PrintSection(section status.Section)

PrintSection writes a section header without timestamp in yellow. format: "\n--- {label} ---\n"

func (*Logger) Warn

func (l *Logger) Warn(format string, args ...any)

Warn writes a warning message in yellow.

Jump to

Keyboard shortcuts

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