tasks

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package tasks implements a file-authoritative task ledger for TinyMem.

The task system follows these principles: 1. tinyTasks.md is the sole source of truth for task state 2. TinyMem never infers task completion 3. Memory entries are fully rebuildable from the file 4. If file and memory disagree, file wins 5. Memory never stores subtask text or implementation detail

The system supports: - Top-level checkbox tasks with nested subtasks - Stable task identification based on section and position - One-way sync from file to memory - Drift detection and recovery

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTaskFileHash

func GetTaskFileHash(dirPath string) (string, error)

GetTaskFileHash returns the hash of the tinyTasks.md file

func HasTaskFile

func HasTaskFile(dirPath string) (bool, error)

HasTaskFile checks if tinyTasks.md exists in the given directory

Types

type ByteReader

type ByteReader struct {
	Data []byte
	Pos  int
}

ByteReader is a simple wrapper to implement io.Reader interface

func (*ByteReader) Read

func (br *ByteReader) Read(p []byte) (n int, err error)

type Service

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

Service handles task operations

func NewService

func NewService(db *storage.DB, memoryService *memory.Service, projectID string) *Service

NewService creates a new task service

func (*Service) CanActOnTask added in v0.1.23

func (s *Service) CanActOnTask(taskID string, query string) (bool, error)

CanActOnTask checks if an action can be performed on a task based on safety rules

func (*Service) CanCreateNewTask added in v0.1.23

func (s *Service) CanCreateNewTask(query string) bool

CanCreateNewTask checks if a new task can be created based on the query

func (*Service) CreateOrUpdateTask

func (s *Service) CreateOrUpdateTask(task *Task) error

CreateOrUpdateTask creates or updates a task in memory

func (*Service) DeleteTask

func (s *Service) DeleteTask(key string) error

DeleteTask removes a task from memory

func (*Service) DetectAndRecoverDrift

func (s *Service) DetectAndRecoverDrift(filePath string) error

DetectAndRecoverDrift checks for differences between file and memory and recovers if needed

func (*Service) GetAllTasks

func (s *Service) GetAllTasks() ([]*memory.Memory, error)

GetAllTasks retrieves all task memories for the project

func (*Service) GetTaskByKey

func (s *Service) GetTaskByKey(key string) (*memory.Memory, error)

GetTaskByKey retrieves a task by its key

func (*Service) GetTaskStatus

func (s *Service) GetTaskStatus(projectPath string) (map[string]interface{}, error)

GetTaskStatus returns a summary of task status

func (*Service) HasExplicitTaskContinuationIntent added in v0.1.23

func (s *Service) HasExplicitTaskContinuationIntent(query string) bool

HasExplicitTaskContinuationIntent checks if the query explicitly requests task continuation

func (*Service) SyncTasks

func (s *Service) SyncTasks(projectPath string) error

SyncTasks performs synchronization of tasks from file to memory

func (*Service) SyncTasksFromFile

func (s *Service) SyncTasksFromFile(filePath string) error

SyncTasksFromFile synchronizes tasks from the tinyTasks.md file to memory

type Task

type Task struct {
	ID           string            `json:"id"`
	Title        string            `json:"title"`
	Section      string            `json:"section"`
	Index        int               `json:"index"`
	StepsTotal   int               `json:"steps_total"`
	StepsDone    int               `json:"steps_done"`
	Completed    bool              `json:"completed"`
	State        TaskState         `json:"state"`
	Mode         TaskMode          `json:"mode"`
	LastSeenHash string            `json:"last_seen_hash"`
	FilePath     string            `json:"file_path"`
	LastUpdated  string            `json:"last_updated"`
	ExtraFields  map[string]string `json:"extra_fields,omitempty"` // For future extensibility
}

Task represents a parsed task from tinyTasks.md

func ParseTasks

func ParseTasks(r io.Reader) ([]*Task, error)

ParseTasks parses the tinyTasks.md file and returns a list of tasks

type TaskMode added in v0.1.23

type TaskMode string

TaskMode represents how the task should be treated

const (
	TaskModeDormant TaskMode = "dormant" // Default - read-only, no execution
	TaskModeActive  TaskMode = "active"  // Only when explicitly requested by user
)

type TaskSafetyEnforcer added in v0.1.23

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

TaskSafetyEnforcer enforces the safety rules for task operations

func NewTaskSafetyEnforcer added in v0.1.23

func NewTaskSafetyEnforcer() *TaskSafetyEnforcer

NewTaskSafetyEnforcer creates a new safety enforcer

func (*TaskSafetyEnforcer) CanActOnTask added in v0.1.23

func (e *TaskSafetyEnforcer) CanActOnTask(task *Task, query string) bool

CanActOnTask determines if an action can be performed on a task

func (*TaskSafetyEnforcer) CanCreateNewTask added in v0.1.23

func (e *TaskSafetyEnforcer) CanCreateNewTask(query string) bool

CanCreateNewTask determines if a new task can be created without affecting existing tasks

func (*TaskSafetyEnforcer) HasExplicitTaskContinuationIntent added in v0.1.23

func (e *TaskSafetyEnforcer) HasExplicitTaskContinuationIntent(query string) bool

HasExplicitTaskContinuationIntent checks if the user explicitly requested to continue tasks

type TaskState added in v0.1.23

type TaskState string

TaskState represents the state of a task

const (
	TaskStateOpen      TaskState = "open"
	TaskStateCompleted TaskState = "completed"
)

Jump to

Keyboard shortcuts

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