ops

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: BSD-2-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeResumer added in v0.16.0

type ClaudeResumer interface {
	// ResumeSession replaces the current process with an interactive claude --resume session.
	ResumeSession(sessionID string, cwd string) error
}

ClaudeResumer resumes an existing Claude session.

func NewClaudeResumer added in v0.16.0

func NewClaudeResumer(claudeScript string) ClaudeResumer

NewClaudeResumer creates a ClaudeResumer using the given claude script. Returns nil if the binary is not found.

func NewClaudeResumerForTesting added in v0.16.0

func NewClaudeResumerForTesting(
	claudePath string,
	chdir func(string) error,
	execFn func(string, []string, []string) error,
) ClaudeResumer

NewClaudeResumerForTesting creates a ClaudeResumer with injectable dependencies. Intended for testing.

type ClaudeSessionStarter added in v0.16.0

type ClaudeSessionStarter interface {
	// StartSession runs claude in headless mode to create a session, returns session_id.
	StartSession(ctx context.Context, prompt string, cwd string) (string, error)
}

ClaudeSessionStarter starts a new headless Claude session.

func NewClaudeSessionStarter added in v0.16.0

func NewClaudeSessionStarter(claudeScript string) ClaudeSessionStarter

NewClaudeSessionStarter creates a ClaudeSessionStarter using the given claude script. Returns nil if the binary is not found.

func NewClaudeSessionStarterWithRunner added in v0.16.0

func NewClaudeSessionStarterWithRunner(
	claudePath string,
	runCmd func(ctx context.Context, args []string, dir string) ([]byte, error),
) ClaudeSessionStarter

NewClaudeSessionStarterWithRunner creates a ClaudeSessionStarter with an injectable command runner. Intended for testing.

type CompleteOperation

type CompleteOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		taskName string,
		vaultName string,
		outputFormat string,
	) error
}

func NewCompleteOperation

func NewCompleteOperation(
	taskStorage storage.TaskStorage,
	goalStorage storage.GoalStorage,
	dailyNoteStorage storage.DailyNoteStorage,
	currentDateTime libtime.CurrentDateTime,
) CompleteOperation

NewCompleteOperation creates a new complete operation.

type DecisionAckOperation added in v0.24.0

type DecisionAckOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		vaultName string,
		decisionName string,
		statusOverride string,
		outputFormat string,
	) error
}

func NewDecisionAckOperation added in v0.24.0

func NewDecisionAckOperation(
	decisionStorage storage.DecisionStorage,
	currentDateTime libtime.CurrentDateTime,
) DecisionAckOperation

NewDecisionAckOperation creates a new decision ack operation.

type DecisionListItem added in v0.23.0

type DecisionListItem struct {
	Name         string `json:"name"`
	Reviewed     bool   `json:"reviewed"`
	ReviewedDate string `json:"reviewed_date,omitempty"`
	Status       string `json:"status,omitempty"`
	Type         string `json:"type,omitempty"`
	PageType     string `json:"page_type,omitempty"`
	Vault        string `json:"vault"`
}

DecisionListItem represents a decision in list output.

type DecisionListOperation added in v0.23.0

type DecisionListOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		vaultName string,
		showReviewed bool,
		showAll bool,
		outputFormat string,
	) error
}

func NewDecisionListOperation added in v0.23.0

func NewDecisionListOperation(decisionStorage storage.DecisionStorage) DecisionListOperation

NewDecisionListOperation creates a new decision list operation.

type DeferOperation

type DeferOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		taskName string,
		dateStr string,
		vaultName string,
		outputFormat string,
	) error
}

func NewDeferOperation

func NewDeferOperation(
	taskStorage storage.TaskStorage,
	dailyNoteStorage storage.DailyNoteStorage,
	currentDateTime libtime.CurrentDateTime,
) DeferOperation

NewDeferOperation creates a new defer operation.

type EntityClearOperation added in v0.30.0

type EntityClearOperation interface {
	Execute(ctx context.Context, vaultPath, entityName, key string) error
}

EntityClearOperation clears a single frontmatter field value on an entity.

func NewGoalClearOperation added in v0.30.0

func NewGoalClearOperation(goalStorage storage.GoalStorage) EntityClearOperation

NewGoalClearOperation creates an EntityClearOperation for goals.

func NewObjectiveClearOperation added in v0.30.0

func NewObjectiveClearOperation(objectiveStorage storage.ObjectiveStorage) EntityClearOperation

NewObjectiveClearOperation creates an EntityClearOperation for objectives.

func NewThemeClearOperation added in v0.30.0

func NewThemeClearOperation(themeStorage storage.ThemeStorage) EntityClearOperation

NewThemeClearOperation creates an EntityClearOperation for themes.

func NewVisionClearOperation added in v0.30.0

func NewVisionClearOperation(visionStorage storage.VisionStorage) EntityClearOperation

NewVisionClearOperation creates an EntityClearOperation for visions.

type EntityGetOperation added in v0.30.0

type EntityGetOperation interface {
	Execute(ctx context.Context, vaultPath, entityName, key string) (string, error)
}

EntityGetOperation retrieves a single frontmatter field value from an entity.

func NewGoalGetOperation added in v0.30.0

func NewGoalGetOperation(goalStorage storage.GoalStorage) EntityGetOperation

NewGoalGetOperation creates an EntityGetOperation for goals.

func NewObjectiveGetOperation added in v0.30.0

func NewObjectiveGetOperation(objectiveStorage storage.ObjectiveStorage) EntityGetOperation

NewObjectiveGetOperation creates an EntityGetOperation for objectives.

func NewThemeGetOperation added in v0.30.0

func NewThemeGetOperation(themeStorage storage.ThemeStorage) EntityGetOperation

NewThemeGetOperation creates an EntityGetOperation for themes.

func NewVisionGetOperation added in v0.30.0

func NewVisionGetOperation(visionStorage storage.VisionStorage) EntityGetOperation

NewVisionGetOperation creates an EntityGetOperation for visions.

type EntityListAddOperation added in v0.33.0

type EntityListAddOperation interface {
	Execute(ctx context.Context, vaultPath, entityName, field, value string) error
}

EntityListAddOperation appends a value to a list frontmatter field on an entity.

func NewGoalListAddOperation added in v0.33.0

func NewGoalListAddOperation(goalStorage storage.GoalStorage) EntityListAddOperation

NewGoalListAddOperation creates an EntityListAddOperation for goals.

func NewObjectiveListAddOperation added in v0.33.0

func NewObjectiveListAddOperation(
	objectiveStorage storage.ObjectiveStorage,
) EntityListAddOperation

NewObjectiveListAddOperation creates an EntityListAddOperation for objectives.

func NewTaskListAddOperation added in v0.33.0

func NewTaskListAddOperation(taskStorage storage.TaskStorage) EntityListAddOperation

NewTaskListAddOperation creates an EntityListAddOperation for tasks.

func NewThemeListAddOperation added in v0.33.0

func NewThemeListAddOperation(themeStorage storage.ThemeStorage) EntityListAddOperation

NewThemeListAddOperation creates an EntityListAddOperation for themes.

func NewVisionListAddOperation added in v0.33.0

func NewVisionListAddOperation(visionStorage storage.VisionStorage) EntityListAddOperation

NewVisionListAddOperation creates an EntityListAddOperation for visions.

type EntityListRemoveOperation added in v0.33.0

type EntityListRemoveOperation interface {
	Execute(ctx context.Context, vaultPath, entityName, field, value string) error
}

EntityListRemoveOperation removes a value from a list frontmatter field on an entity.

func NewGoalListRemoveOperation added in v0.33.0

func NewGoalListRemoveOperation(goalStorage storage.GoalStorage) EntityListRemoveOperation

NewGoalListRemoveOperation creates an EntityListRemoveOperation for goals.

func NewObjectiveListRemoveOperation added in v0.33.0

func NewObjectiveListRemoveOperation(
	objectiveStorage storage.ObjectiveStorage,
) EntityListRemoveOperation

NewObjectiveListRemoveOperation creates an EntityListRemoveOperation for objectives.

func NewTaskListRemoveOperation added in v0.33.0

func NewTaskListRemoveOperation(taskStorage storage.TaskStorage) EntityListRemoveOperation

NewTaskListRemoveOperation creates an EntityListRemoveOperation for tasks.

func NewThemeListRemoveOperation added in v0.33.0

func NewThemeListRemoveOperation(themeStorage storage.ThemeStorage) EntityListRemoveOperation

NewThemeListRemoveOperation creates an EntityListRemoveOperation for themes.

func NewVisionListRemoveOperation added in v0.33.0

func NewVisionListRemoveOperation(visionStorage storage.VisionStorage) EntityListRemoveOperation

NewVisionListRemoveOperation creates an EntityListRemoveOperation for visions.

type EntitySetOperation added in v0.30.0

type EntitySetOperation interface {
	Execute(ctx context.Context, vaultPath, entityName, key, value string) error
}

EntitySetOperation sets a single frontmatter field value on an entity.

func NewGoalSetOperation added in v0.30.0

func NewGoalSetOperation(goalStorage storage.GoalStorage) EntitySetOperation

NewGoalSetOperation creates an EntitySetOperation for goals.

func NewObjectiveSetOperation added in v0.30.0

func NewObjectiveSetOperation(objectiveStorage storage.ObjectiveStorage) EntitySetOperation

NewObjectiveSetOperation creates an EntitySetOperation for objectives.

func NewThemeSetOperation added in v0.30.0

func NewThemeSetOperation(themeStorage storage.ThemeStorage) EntitySetOperation

NewThemeSetOperation creates an EntitySetOperation for themes.

func NewVisionSetOperation added in v0.30.0

func NewVisionSetOperation(visionStorage storage.VisionStorage) EntitySetOperation

NewVisionSetOperation creates an EntitySetOperation for visions.

type EntityShowOperation added in v0.30.0

type EntityShowOperation interface {
	Execute(ctx context.Context, vaultPath, vaultName, entityName, outputFormat string) error
}

EntityShowOperation returns full detail for a single entity.

func NewGoalShowOperation added in v0.30.0

func NewGoalShowOperation(goalStorage storage.GoalStorage) EntityShowOperation

NewGoalShowOperation creates an EntityShowOperation for goals.

func NewObjectiveShowOperation added in v0.30.0

func NewObjectiveShowOperation(objectiveStorage storage.ObjectiveStorage) EntityShowOperation

NewObjectiveShowOperation creates an EntityShowOperation for objectives.

func NewThemeShowOperation added in v0.30.0

func NewThemeShowOperation(themeStorage storage.ThemeStorage) EntityShowOperation

NewThemeShowOperation creates an EntityShowOperation for themes.

func NewVisionShowOperation added in v0.30.0

func NewVisionShowOperation(visionStorage storage.VisionStorage) EntityShowOperation

NewVisionShowOperation creates an EntityShowOperation for visions.

type FrontmatterClearOperation added in v0.9.0

type FrontmatterClearOperation interface {
	Execute(ctx context.Context, vaultPath, taskName, key string) error
}

func NewFrontmatterClearOperation added in v0.9.0

func NewFrontmatterClearOperation(taskStorage storage.TaskStorage) FrontmatterClearOperation

NewFrontmatterClearOperation creates a new frontmatter clear operation.

type FrontmatterGetOperation added in v0.9.0

type FrontmatterGetOperation interface {
	Execute(ctx context.Context, vaultPath, taskName, key string) (string, error)
}

func NewFrontmatterGetOperation added in v0.9.0

func NewFrontmatterGetOperation(taskStorage storage.TaskStorage) FrontmatterGetOperation

NewFrontmatterGetOperation creates a new frontmatter get operation.

type FrontmatterSetOperation added in v0.9.0

type FrontmatterSetOperation interface {
	Execute(ctx context.Context, vaultPath, taskName, key, value string) error
}

func NewFrontmatterSetOperation added in v0.9.0

func NewFrontmatterSetOperation(taskStorage storage.TaskStorage) FrontmatterSetOperation

NewFrontmatterSetOperation creates a new frontmatter set operation.

type GoalCompleteOperation added in v0.36.0

type GoalCompleteOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		goalName string,
		vaultName string,
		outputFormat string,
		force bool,
	) error
}

func NewGoalCompleteOperation added in v0.36.0

func NewGoalCompleteOperation(
	goalStorage storage.GoalStorage,
	taskStorage storage.TaskStorage,
	currentDateTime libtime.CurrentDateTime,
) GoalCompleteOperation

NewGoalCompleteOperation creates a new goal complete operation.

type GoalCompleteResult added in v0.36.0

type GoalCompleteResult struct {
	Success   bool   `json:"success"`
	Name      string `json:"name,omitempty"`
	Status    string `json:"status,omitempty"`
	Completed string `json:"completed,omitempty"`
	Vault     string `json:"vault,omitempty"`
	Error     string `json:"error,omitempty"`
}

GoalCompleteResult represents the JSON result of a goal complete operation.

type IncompleteResult added in v0.10.8

type IncompleteResult struct {
	Success    bool   `json:"success"`
	Reason     string `json:"reason"`
	Pending    int    `json:"pending"`
	InProgress int    `json:"inprogress"`
	Completed  int    `json:"completed"`
	Total      int    `json:"total"`
}

IncompleteResult represents the result when a task has incomplete subtasks.

type IssueType

type IssueType string

IssueType represents the type of lint issue found.

const (
	IssueTypeMissingFrontmatter     IssueType = "MISSING_FRONTMATTER"
	IssueTypeInvalidPriority        IssueType = "INVALID_PRIORITY"
	IssueTypeDuplicateKey           IssueType = "DUPLICATE_KEY"
	IssueTypeInvalidStatus          IssueType = "INVALID_STATUS"
	IssueTypeOrphanGoal             IssueType = "ORPHAN_GOAL"
	IssueTypeStatusCheckboxMismatch IssueType = "STATUS_CHECKBOX_MISMATCH"
)

type LintIssue

type LintIssue struct {
	FilePath    string
	IssueType   IssueType
	Description string
	Fixable     bool
	Fixed       bool
}

LintIssue represents a single lint issue found in a file.

type LintIssueJSON added in v0.8.0

type LintIssueJSON struct {
	File        string `json:"file"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Fixed       bool   `json:"fixed,omitempty"`
}

LintIssueJSON represents a lint issue in JSON format.

type LintOperation

type LintOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		tasksDir string,
		fix bool,
		outputFormat string,
	) error
	ExecuteFile(
		ctx context.Context,
		filePath string,
		taskName string,
		vaultName string,
		outputFormat string,
	) error
}

func NewLintOperation

func NewLintOperation() LintOperation

NewLintOperation creates a new lint operation.

type ListOperation

type ListOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		vaultName string,
		pagesDir string,
		statusFilter string,
		showAll bool,
		assigneeFilter string,
		goalFilter string,
		outputFormat string,
	) error
}

func NewListOperation

func NewListOperation(
	pageStorage storage.PageStorage,
) ListOperation

NewListOperation creates a new list operation.

type MutationResult added in v0.8.0

type MutationResult struct {
	Success   bool     `json:"success"`
	Name      string   `json:"name,omitempty"`
	Vault     string   `json:"vault,omitempty"`
	Error     string   `json:"error,omitempty"`
	Warnings  []string `json:"warnings,omitempty"`
	SessionID string   `json:"session_id,omitempty"`
}

MutationResult represents the result of a mutation operation.

type ObjectiveCompleteOperation added in v0.36.0

type ObjectiveCompleteOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		objectiveName string,
		vaultName string,
		outputFormat string,
	) error
}

func NewObjectiveCompleteOperation added in v0.36.0

func NewObjectiveCompleteOperation(
	objectiveStorage storage.ObjectiveStorage,
	currentDateTime libtime.CurrentDateTime,
) ObjectiveCompleteOperation

NewObjectiveCompleteOperation creates a new objective complete operation.

type ObjectiveCompleteResult added in v0.36.0

type ObjectiveCompleteResult struct {
	Success   bool   `json:"success"`
	Name      string `json:"name,omitempty"`
	Status    string `json:"status,omitempty"`
	Completed string `json:"completed,omitempty"`
	Vault     string `json:"vault,omitempty"`
	Error     string `json:"error,omitempty"`
}

ObjectiveCompleteResult represents the JSON result of an objective complete operation.

type RecurringMutationResult added in v0.10.7

type RecurringMutationResult struct {
	Success   bool     `json:"success"`
	Name      string   `json:"name,omitempty"`
	Vault     string   `json:"vault,omitempty"`
	Recurring bool     `json:"recurring"`
	NextDate  string   `json:"next_date,omitempty"`
	Error     string   `json:"error,omitempty"`
	Warnings  []string `json:"warnings,omitempty"`
}

RecurringMutationResult represents the result of a recurring task mutation.

type SearchOperation

type SearchOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		scopeDir string,
		query string,
		topK int,
		outputFormat string,
	) error
}

func NewSearchOperation

func NewSearchOperation() SearchOperation

NewSearchOperation creates a new search operation.

type ShowOperation added in v0.19.0

type ShowOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		vaultName string,
		taskName string,
		outputFormat string,
	) error
}

ShowOperation returns full detail for a single task.

func NewShowOperation added in v0.19.0

func NewShowOperation(taskStorage storage.TaskStorage) ShowOperation

NewShowOperation creates a new show operation.

type TaskDetail added in v0.19.0

type TaskDetail struct {
	Name            string   `json:"name"`
	Status          string   `json:"status"`
	Phase           string   `json:"phase,omitempty"`
	Assignee        string   `json:"assignee,omitempty"`
	Priority        int      `json:"priority,omitempty"`
	Category        string   `json:"category,omitempty"`
	Recurring       string   `json:"recurring,omitempty"`
	DeferDate       string   `json:"defer_date,omitempty"`
	PlannedDate     string   `json:"planned_date,omitempty"`
	DueDate         string   `json:"due_date,omitempty"`
	ClaudeSessionID string   `json:"claude_session_id,omitempty"`
	Goals           []string `json:"goals,omitempty"`
	Description     string   `json:"description,omitempty"`
	Content         string   `json:"content"`
	ModifiedDate    string   `json:"modified_date,omitempty"`
	FilePath        string   `json:"file_path"`
	Vault           string   `json:"vault"`
}

TaskDetail contains full task information for JSON output.

type TaskListItem added in v0.8.0

type TaskListItem struct {
	Name            string `json:"name"`
	Status          string `json:"status"`
	Assignee        string `json:"assignee,omitempty"`
	Priority        int    `json:"priority,omitempty"`
	Vault           string `json:"vault"`
	Category        string `json:"category,omitempty"`
	Recurring       string `json:"recurring,omitempty"`
	DeferDate       string `json:"defer_date,omitempty"`
	PlannedDate     string `json:"planned_date,omitempty"`
	DueDate         string `json:"due_date,omitempty"`
	ClaudeSessionID string `json:"claude_session_id,omitempty"`
	Phase           string `json:"phase,omitempty"`
}

TaskListItem represents a task in list output.

type UpdateOperation

type UpdateOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		taskName string,
		vaultName string,
		outputFormat string,
	) error
}

func NewUpdateOperation

func NewUpdateOperation(
	taskStorage storage.TaskStorage,
	goalStorage storage.GoalStorage,
) UpdateOperation

NewUpdateOperation creates a new update operation.

type VaultDispatcher added in v0.27.3

type VaultDispatcher interface {
	FirstSuccess(
		ctx context.Context,
		vaults []*config.Vault,
		fn func(vault *config.Vault) error,
	) error
}

VaultDispatcher tries a callback against each vault until one succeeds.

func NewVaultDispatcher added in v0.27.3

func NewVaultDispatcher() VaultDispatcher

NewVaultDispatcher creates a new VaultDispatcher.

type WatchEvent added in v0.20.0

type WatchEvent struct {
	Event string `json:"event"`
	Name  string `json:"name"`
	Vault string `json:"vault"`
	Path  string `json:"path"`
}

WatchEvent is the JSON-encoded event emitted on stdout.

type WatchOperation added in v0.20.0

type WatchOperation interface {
	Execute(ctx context.Context, vaults []WatchTarget) error
}

WatchOperation watches vault directories and streams change events.

func NewWatchOperation added in v0.20.0

func NewWatchOperation() WatchOperation

NewWatchOperation creates a new WatchOperation.

type WatchTarget added in v0.20.0

type WatchTarget struct {
	VaultPath string
	VaultName string
	WatchDirs []string
}

WatchTarget describes a vault and the directories to watch within it.

type WorkOnOperation added in v0.6.0

type WorkOnOperation interface {
	Execute(
		ctx context.Context,
		vaultPath string,
		taskName string,
		assignee string,
		vaultName string,
		outputFormat string,
		isInteractive bool,
	) error
}

func NewWorkOnOperation added in v0.6.0

func NewWorkOnOperation(
	taskStorage storage.TaskStorage,
	dailyNoteStorage storage.DailyNoteStorage,
	currentDateTime libtime.CurrentDateTime,
	starter ClaudeSessionStarter,
	resumer ClaudeResumer,
) WorkOnOperation

NewWorkOnOperation creates a new work-on operation.

Jump to

Keyboard shortcuts

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