cli

package
v0.0.0-...-b2f7c29 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 54 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.2.5"
	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 LoadDefaultProject

func LoadDefaultProject() string

LoadDefaultProject reads the default_project key from the global config. Returns empty string if not set or if the config file doesn't exist.

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 FilterShortcuts

type FilterShortcuts struct {
	Status   string
	Priority string
	Phase    string
	Scope    string
	Filters  []string
}

FilterShortcuts holds the common shortcut filter parameters shared across commands.

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 GlobalProjectEntry

type GlobalProjectEntry struct {
	ID   string
	Name string
	Path string // Absolute, tilde-expanded
}

GlobalProjectEntry represents a registered project in the global config.

func LoadGlobalRegistry

func LoadGlobalRegistry() ([]GlobalProjectEntry, error)

LoadGlobalRegistry reads the projects list from ~/.taskmd.yaml (or $TASKMD_HOME_CONFIG). Returns an empty slice and nil error when the file does not exist or contains no projects. Does not validate that project paths exist on disk — callers decide that policy.

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 PhaseSummary

type PhaseSummary struct {
	ID       string         `json:"id" yaml:"id"`
	Name     string         `json:"name" yaml:"name"`
	Tasks    int            `json:"tasks" yaml:"tasks"`
	Done     int            `json:"done" yaml:"done"`
	Progress string         `json:"progress" yaml:"progress"`
	Due      string         `json:"due,omitempty" yaml:"due,omitempty"`
	ByStatus map[string]int `json:"by_status" yaml:"by_status"`
}

PhaseSummary holds computed stats for a single phase.

type ProjectRecommendation

type ProjectRecommendation struct {
	ProjectID string `json:"project" yaml:"project"`
	Recommendation
}

ProjectRecommendation wraps a recommendation with project context.

type ProjectSummary

type ProjectSummary struct {
	ID         string `json:"id" yaml:"id"`
	Name       string `json:"name" yaml:"name"`
	Path       string `json:"path" yaml:"path"`
	Tasks      int    `json:"tasks" yaml:"tasks"`
	Pending    int    `json:"pending" yaml:"pending"`
	InProgress int    `json:"in_progress" yaml:"in_progress"`
	Completed  int    `json:"completed" yaml:"completed"`
}

ProjectSummary holds computed stats for a registered project.

type ProjectTask

type ProjectTask struct {
	ProjectID string `json:"project" yaml:"project"`
	*model.Task
}

ProjectTask wraps a task with its originating project ID.

func (*ProjectTask) QualifiedID

func (pt *ProjectTask) QualifiedID() string

QualifiedID returns the task ID prefixed with the project ID.

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