vision

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package vision implements the Vision domain: first-class storage for "future ideas that can't be acted on now". Vision items capture work that is conceptually important but currently blocked by dependencies, resources, or timing. They can be promoted to GTD tasks when conditions change.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("vision: not found")

ErrNotFound is returned when a requested vision item does not exist.

Functions

This section is empty.

Types

type AddVisionParams

type AddVisionParams struct {
	WorkspaceID      *uuid.UUID
	RepoName         string
	ProjectID        *uuid.UUID
	Title            string
	WhyBlocked       string
	DependsOn        []string // nil/empty → []
	ParentInitiative string   // empty → NULL
	ContextMD        string   // empty → NULL
}

AddVisionParams holds parameters for creating a new vision item.

type ListVisionFilter

type ListVisionFilter struct {
	ParentInitiative string       // empty = all initiatives
	Status           VisionStatus // empty = all non-dismissed
}

ListVisionFilter narrows a List call to specific statuses or initiatives.

type PromoteParams

type PromoteParams struct {
	PromotedTaskID uuid.UUID
}

PromoteParams holds parameters for promoting a vision item to a GTD task. The caller is responsible for actually creating the GTD task and passing back the resulting task ID.

type Store

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

Store is the Postgres-backed implementation of StoreIface.

func NewStore

func NewStore(pool *pgxpool.Pool, workspaceID *uuid.UUID) *Store

NewStore returns a Store backed by the given pool, scoped to the optional workspaceID. nil workspaceID = legacy unscoped mode.

func (*Store) Add

func (s *Store) Add(ctx context.Context, p AddVisionParams) (*VisionItem, error)

Add inserts a new vision item and returns the persisted record.

func (*Store) GetByID

func (s *Store) GetByID(ctx context.Context, id uuid.UUID) (*VisionItem, error)

GetByID returns the full vision item by id.

func (*Store) List

func (s *Store) List(ctx context.Context, filter ListVisionFilter) ([]VisionItemSummary, error)

List returns vision items, optionally filtered by status and/or initiative.

func (*Store) Promote

func (s *Store) Promote(ctx context.Context, id uuid.UUID, p PromoteParams) (*VisionItem, error)

Promote marks a vision item as promoted and records the resulting task id.

func (*Store) Update

func (s *Store) Update(ctx context.Context, id uuid.UUID, p UpdateVisionParams) (*VisionItem, error)

Update applies non-nil fields in p to the vision item with the given id.

type StoreIface

type StoreIface interface {
	// Add inserts a new vision item and returns the persisted record.
	Add(ctx context.Context, p AddVisionParams) (*VisionItem, error)

	// List returns vision items, optionally filtered by status and/or initiative.
	// When filter.Status is empty, all non-dismissed items are returned.
	// Results are ordered by created_at DESC.
	List(ctx context.Context, filter ListVisionFilter) ([]VisionItemSummary, error)

	// Update applies non-nil fields in p to the vision item with the given id.
	// Returns ErrNotFound if the id does not exist in the store's workspace scope.
	Update(ctx context.Context, id uuid.UUID, p UpdateVisionParams) (*VisionItem, error)

	// GetByID returns the full vision item by id.
	// Returns ErrNotFound if the id does not exist.
	GetByID(ctx context.Context, id uuid.UUID) (*VisionItem, error)

	// Promote marks a vision item as promoted and records the resulting task id.
	// Returns ErrNotFound if the id does not exist.
	Promote(ctx context.Context, id uuid.UUID, p PromoteParams) (*VisionItem, error)
}

StoreIface is the backend-agnostic contract for the Vision bounded context. Postgres-backed *Store and SQLite-backed *SQLiteStore both satisfy this interface.

type UpdateVisionParams

type UpdateVisionParams struct {
	Status          *VisionStatus
	ContextMD       *string
	LastDiscussedAt *time.Time
}

UpdateVisionParams holds parameters for updating a vision item. Zero values are ignored (nil pointer = no-op for optional fields).

type VisionItem

type VisionItem struct {
	ID               uuid.UUID    `json:"id"`
	WorkspaceID      *uuid.UUID   `json:"workspace_id,omitempty"`
	RepoName         string       `json:"repo_name,omitempty"`
	ProjectID        *uuid.UUID   `json:"project_id,omitempty"`
	Title            string       `json:"title"`
	WhyBlocked       string       `json:"why_blocked"`
	DependsOn        []string     `json:"depends_on"`
	ParentInitiative string       `json:"parent_initiative,omitempty"`
	Status           VisionStatus `json:"status"`
	ContextMD        string       `json:"context_md,omitempty"`
	PromotedTaskID   *uuid.UUID   `json:"promoted_task_id,omitempty"`
	LastDiscussedAt  *time.Time   `json:"last_discussed_at,omitempty"`
	CreatedAt        time.Time    `json:"created_at"`
}

VisionItem is the domain model for a vision item.

type VisionItemSummary

type VisionItemSummary struct {
	ID               uuid.UUID    `json:"id"`
	WorkspaceID      *uuid.UUID   `json:"workspace_id,omitempty"`
	RepoName         string       `json:"repo_name,omitempty"`
	ProjectID        *uuid.UUID   `json:"project_id,omitempty"`
	Title            string       `json:"title"`
	WhyBlocked       string       `json:"why_blocked"`
	DependsOn        []string     `json:"depends_on"`
	ParentInitiative string       `json:"parent_initiative,omitempty"`
	Status           VisionStatus `json:"status"`
	PromotedTaskID   *uuid.UUID   `json:"promoted_task_id,omitempty"`
	LastDiscussedAt  *time.Time   `json:"last_discussed_at,omitempty"`
	CreatedAt        time.Time    `json:"created_at"`
}

VisionItemSummary is a compact projection of VisionItem that omits context_md for list endpoints (reduces response size for frequent polling).

type VisionStatus

type VisionStatus string

VisionStatus represents the lifecycle of a vision item.

const (
	VisionStatusOpen       VisionStatus = "open"
	VisionStatusDiscussing VisionStatus = "discussing"
	VisionStatusMaturing   VisionStatus = "maturing"
	VisionStatusPromoted   VisionStatus = "promoted"
	VisionStatusDismissed  VisionStatus = "dismissed"
)

Jump to

Keyboard shortcuts

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