cli

package
v0.0.0-...-5f22abe Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitSuccess           = 0
	ExitError             = 1
	ExitValidationWarning = 2
)

Exit codes used by taskmd commands.

View Source
const (
	// DefaultTaskFile is the default file to read if no file is specified
	DefaultTaskFile = "tasks.md"
)

Variables

View Source
var (
	// Version information (set via build flags)
	Version   = "0.1.4"
	GitCommit = "unknown"
	BuildDate = "unknown"
	GitDirty  = ""
)
View Source
var ErrVerifyFailed = errors.New("verification failed")

ErrVerifyFailed is returned when one or more verification checks fail.

Functions

func Execute

func Execute() error

Execute runs the root command

func FullVersion

func FullVersion() string

FullVersion returns the display version string. Examples: "0.0.3", "0.0.3-abc1234", "0.0.3-abc1234*"

func ResolveScanDir

func ResolveScanDir(args []string) string

ResolveScanDir returns the scan directory from positional arg or --task-dir flag. Positional arg takes precedence for backward compatibility.

func StripANSI

func StripANSI(s string) string

StripANSI removes ANSI escape sequences from a string.

func ValidateFormat

func ValidateFormat(format string, supported []string) error

ValidateFormat checks that format is one of the supported values.

func WriteJSON

func WriteJSON(w io.Writer, v any) error

WriteJSON encodes v as indented JSON to w.

func WriteYAML

func WriteYAML(w io.Writer, v any) error

WriteYAML encodes v as YAML to w.

Types

type DiffResult

type DiffResult struct {
	Completed []string // files with +status: completed
	Added     []string // new files (--- /dev/null) with +status: pending
	Started   []string // files with +status: in-progress
	Blocked   []string // files with +status: blocked
	Cancelled []string // files with +status: cancelled
}

DiffResult categorizes files from a unified diff by their status change.

func (DiffResult) IsEmpty

func (d DiffResult) IsEmpty() bool

IsEmpty returns true if no changes were detected.

type FeedEntry

type FeedEntry struct {
	Hash      string       `json:"hash"`
	Author    string       `json:"author"`
	Timestamp time.Time    `json:"timestamp"`
	Message   string       `json:"message"`
	Files     []FileChange `json:"files"`
}

FeedEntry represents a single commit in the activity feed.

type FileChange

type FileChange struct {
	Path   string `json:"path"`
	Status string `json:"status"`
	TaskID string `json:"taskID,omitempty"`
}

FileChange represents a file changed in a commit.

type GlobalFlags

type GlobalFlags struct {
	Stdin      bool
	Quiet      bool
	Verbose    bool
	Debug      bool
	NoColor    bool
	TaskDir    string
	IgnoreDirs []string
	Workflow   string
}

GlobalFlags holds global flag values

func GetGlobalFlags

func GetGlobalFlags() GlobalFlags

GetGlobalFlags returns a struct with all global flag values

type InputResolver

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

InputResolver handles resolving input sources (stdin, explicit file, default file)

func NewInputResolver

func NewInputResolver(useStdin bool, verbose bool) *InputResolver

NewInputResolver creates a new input resolver

func (*InputResolver) ReadAll

func (ir *InputResolver) ReadAll(args []string) ([]byte, error)

ReadAll reads all content from the resolved input source

func (*InputResolver) ResolveInput

func (ir *InputResolver) ResolveInput(args []string) (io.Reader, func() error, error)

ResolveInput determines the input source and returns a reader and cleanup function Priority: stdin flag > explicit file argument > default tasks.md file

type Recommendation

type Recommendation = next.Recommendation

Recommendation is re-exported from the shared package.

type ReportTaskJSON

type ReportTaskJSON struct {
	ID           string   `json:"id"`
	Title        string   `json:"title"`
	Status       string   `json:"status"`
	Priority     string   `json:"priority,omitempty"`
	Dependencies []string `json:"dependencies,omitempty"`
}

ReportTaskJSON is the JSON representation of a task in report sections.

type SnapshotOutput

type SnapshotOutput struct {
	Tasks  []TaskSnapshot            `json:"tasks,omitempty" yaml:"tasks,omitempty"`
	Groups map[string][]TaskSnapshot `json:"groups,omitempty" yaml:"groups,omitempty"`
}

SnapshotOutput represents the full snapshot output

type TableWriter

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

TableWriter writes aligned table output where ANSI escape codes don't affect alignment. It accepts both plain-text and colored versions of each cell, computing column widths from the plain-text values and emitting the colored text with correct padding.

func NewTableWriter

func NewTableWriter() *TableWriter

NewTableWriter creates a TableWriter with the default " " column gap.

func (*TableWriter) AddHeader

func (tw *TableWriter) AddHeader(cols []string)

AddHeader adds a plain-text header row (no coloring).

func (*TableWriter) AddRow

func (tw *TableWriter) AddRow(plain, colored []string)

AddRow adds a data row. plain holds the visible text for width calculation; colored holds the text to render (may contain ANSI codes).

func (*TableWriter) AddSeparator

func (tw *TableWriter) AddSeparator()

AddSeparator adds a row of dashes sized to match column widths. The actual dash strings are computed in Flush.

func (*TableWriter) Flush

func (tw *TableWriter) Flush(w io.Writer)

Flush computes column widths and writes all rows to w.

type TagInfo

type TagInfo struct {
	Tag   string `json:"tag"`
	Count int    `json:"count"`
}

TagInfo holds a tag name and the number of tasks using it.

type TaskChanges

type TaskChanges struct {
	Completed []*model.Task
	Added     []*model.Task
	Started   []*model.Task
	Blocked   []*model.Task
	Cancelled []*model.Task
}

TaskChanges holds tasks categorized by their change type.

func (TaskChanges) IsEmpty

func (tc TaskChanges) IsEmpty() bool

IsEmpty returns true if no task changes were found.

type TaskSnapshot

type TaskSnapshot struct {
	// Core fields (always included unless --core is used)
	ID           string   `json:"id" yaml:"id"`
	Title        string   `json:"title" yaml:"title"`
	Status       string   `json:"status,omitempty" yaml:"status,omitempty"`
	Priority     string   `json:"priority,omitempty" yaml:"priority,omitempty"`
	Effort       string   `json:"effort,omitempty" yaml:"effort,omitempty"`
	Dependencies []string `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	Tags         []string `json:"tags,omitempty" yaml:"tags,omitempty"`
	Group        string   `json:"group,omitempty" yaml:"group,omitempty"`
	Created      string   `json:"created,omitempty" yaml:"created,omitempty"`
	FilePath     string   `json:"file_path,omitempty" yaml:"file_path,omitempty"`

	// Derived fields (only included with --derived)
	IsBlocked        *bool `json:"is_blocked,omitempty" yaml:"is_blocked,omitempty"`
	DependencyDepth  *int  `json:"dependency_depth,omitempty" yaml:"dependency_depth,omitempty"`
	TopologicalOrder *int  `json:"topological_order,omitempty" yaml:"topological_order,omitempty"`
	OnCriticalPath   *bool `json:"on_critical_path,omitempty" yaml:"on_critical_path,omitempty"`
}

TaskSnapshot represents a task with core or derived fields

Jump to

Keyboard shortcuts

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