web

package
v0.0.0-...-f5048bd Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

func Export(cfg ExportConfig) error

Export generates a self-contained static site from task data.

func ExportWithFS

func ExportWithFS(cfg ExportConfig, embeddedFS fs.FS) error

ExportWithFS generates a static site using the provided embedded filesystem. This is separated from Export to allow tests to inject a mock FS.

func StaticFiles

func StaticFiles() fs.FS

StaticFiles returns an empty filesystem when web assets are not embedded.

Types

type Config

type Config struct {
	Port     int
	ScanDir  string
	Dev      bool
	Verbose  bool
	ReadOnly bool
	Version  string
}

Config holds server configuration.

type ConfigResponse

type ConfigResponse struct {
	ReadOnly bool   `json:"readonly"`
	Version  string `json:"version"`
}

ConfigResponse is the JSON response for GET /api/config.

type DataProvider

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

DataProvider caches scan results and invalidates on file changes.

func NewDataProvider

func NewDataProvider(scanDir string, verbose bool) *DataProvider

NewDataProvider creates a DataProvider for the given directory.

func (*DataProvider) GetArchivedTasks

func (dp *DataProvider) GetArchivedTasks() ([]*model.Task, error)

GetArchivedTasks scans archive directories for tasks used in dependency resolution.

func (*DataProvider) GetTasks

func (dp *DataProvider) GetTasks() ([]*model.Task, error)

GetTasks returns cached tasks, rescanning if dirty.

func (*DataProvider) Invalidate

func (dp *DataProvider) Invalidate()

Invalidate marks cached data as stale.

type ErrorResponse

type ErrorResponse struct {
	Error   string   `json:"error"`
	Details []string `json:"details,omitempty"`
}

ErrorResponse is a structured JSON error response.

type ExportConfig

type ExportConfig struct {
	OutputDir string
	ScanDir   string
	BasePath  string
	Verbose   bool
	Version   string
}

ExportConfig holds configuration for the static site export.

type SSEBroker

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

SSEBroker manages Server-Sent Events connections.

func NewSSEBroker

func NewSSEBroker() *SSEBroker

NewSSEBroker creates a new SSE broker.

func (*SSEBroker) Broadcast

func (b *SSEBroker) Broadcast()

Broadcast sends a reload event to all connected clients.

func (*SSEBroker) ServeHTTP

func (b *SSEBroker) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles SSE connections at /api/events.

type Server

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

Server is the taskmd web server.

func NewServer

func NewServer(cfg Config) *Server

NewServer creates a new web server.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the HTTP server. It blocks until ctx is cancelled.

type TaskDetail

type TaskDetail struct {
	*model.Task
	Body           string `json:"body"`
	WorklogEntries int    `json:"worklog_entries,omitempty"`
	WorklogUpdated string `json:"worklog_updated,omitempty"`
}

TaskDetail includes the body field for individual task detail views

type TaskUpdateRequest

type TaskUpdateRequest struct {
	Title    *string   `json:"title"`
	Status   *string   `json:"status"`
	Priority *string   `json:"priority"`
	Effort   *string   `json:"effort"`
	Type     *string   `json:"type"`
	Owner    *string   `json:"owner"`
	Parent   *string   `json:"parent"`
	Tags     *[]string `json:"tags"`
	Body     *string   `json:"body"`
}

TaskUpdateRequest is the JSON request body for PUT /api/tasks/{id}.

type WorklogEntryJSON

type WorklogEntryJSON struct {
	Timestamp string `json:"timestamp"`
	Content   string `json:"content"`
}

WorklogEntryJSON is a single worklog entry for the API.

Jump to

Keyboard shortcuts

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