project

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

FileStore 项目文件存储。

func NewFileStore

func NewFileStore(basePath string) (*FileStore, error)

NewFileStore 创建项目存储。

func (*FileStore) GetLatestPlan

func (s *FileStore) GetLatestPlan(_ context.Context, projectID string) (*PlanSuggestion, error)

func (*FileStore) GetPlan

func (s *FileStore) GetPlan(_ context.Context, projectID, planID string) (*PlanSuggestion, error)

func (*FileStore) GetProject

func (s *FileStore) GetProject(_ context.Context, projectID string) (*Project, error)

func (*FileStore) ListProjects

func (s *FileStore) ListProjects(_ context.Context, status string) ([]Project, error)

func (*FileStore) SavePlan

func (s *FileStore) SavePlan(_ context.Context, plan *PlanSuggestion) error

func (*FileStore) SaveProject

func (s *FileStore) SaveProject(_ context.Context, project *Project) error

type GoalType

type GoalType string

GoalType 目标类型。

const (
	GoalTypeLearning GoalType = "learning"
	GoalTypeTravel   GoalType = "travel"
	GoalTypeGeneric  GoalType = "generic"
)

type PlanConstraints

type PlanConstraints struct {
	RequireDeliverable bool `json:"require_deliverable,omitempty"`
	MinEstimateMinutes int  `json:"min_estimate_minutes,omitempty"`
	MaxEstimateMinutes int  `json:"max_estimate_minutes,omitempty"`
	MinTasks           int  `json:"min_tasks,omitempty"`
	MaxTasks           int  `json:"max_tasks,omitempty"`
	MinPracticeTasks   int  `json:"min_practice_tasks,omitempty"`
}

PlanConstraints 拆分约束。

type PlanSuggestion

type PlanSuggestion struct {
	PlanID           string          `json:"plan_id"`
	ProjectID        string          `json:"project_id"`
	GoalText         string          `json:"goal_text,omitempty"`
	GoalType         GoalType        `json:"goal_type"`
	Status           ProjectStatus   `json:"status"`
	Constraints      PlanConstraints `json:"constraints,omitempty"`
	Phases           []string        `json:"phases"`
	TasksPreview     []PlanTask      `json:"tasks_preview"`
	Confidence       float64         `json:"confidence"`
	Warnings         []string        `json:"warnings,omitempty"`
	AIHint           string          `json:"ai_hint,omitempty"`
	ConfirmedTaskIDs []string        `json:"confirmed_task_ids,omitempty"`
	ConfirmedAt      *time.Time      `json:"confirmed_at,omitempty"`
	CreatedAt        time.Time       `json:"created_at"`
}

PlanSuggestion 项目拆分建议。

type PlanTask

type PlanTask struct {
	// ID 是计划内任务 ID(非真实任务 ID),用于稳定映射与追踪。
	ID string `json:"id,omitempty"`
	// ParentID 是父计划任务 ID,用于在确认阶段恢复父子关系。
	ParentID        string   `json:"parent_id,omitempty"`
	Title           string   `json:"title"`
	Description     string   `json:"description,omitempty"`
	EstimateMinutes int      `json:"estimate_minutes"`
	DueOffsetDays   int      `json:"due_offset_days"`
	Priority        int      `json:"priority"`
	Quadrant        int      `json:"quadrant"`
	Tags            []string `json:"tags,omitempty"`
	Phase           string   `json:"phase"`
}

PlanTask 拆分后的任务建议。

type Project

type Project struct {
	ID           string        `json:"id"`
	Name         string        `json:"name"`
	Description  string        `json:"description,omitempty"`
	ParentID     string        `json:"parent_id,omitempty"`
	GoalText     string        `json:"goal_text,omitempty"`
	GoalType     GoalType      `json:"goal_type"`
	Status       ProjectStatus `json:"status"`
	ListID       string        `json:"list_id,omitempty"`
	Source       string        `json:"source,omitempty"`
	HorizonDays  int           `json:"horizon_days,omitempty"`
	LatestPlanID string        `json:"latest_plan_id,omitempty"`
	CompletedAt  *time.Time    `json:"completed_at,omitempty"`
	ArchivedAt   *time.Time    `json:"archived_at,omitempty"`
	Summary      string        `json:"summary,omitempty"`
	CreatedAt    time.Time     `json:"created_at"`
	UpdatedAt    time.Time     `json:"updated_at"`
}

Project 项目实体。

type ProjectStatus

type ProjectStatus string

ProjectStatus 项目状态。

const (
	StatusDraft          ProjectStatus = "draft"
	StatusSplitSuggested ProjectStatus = "split_suggested"
	StatusConfirmed      ProjectStatus = "confirmed"
	StatusSynced         ProjectStatus = "synced"
	StatusActive         ProjectStatus = "active"
	StatusCompleted      ProjectStatus = "completed"
	StatusArchived       ProjectStatus = "archived"
)

type Store

type Store interface {
	SaveProject(ctx context.Context, project *Project) error
	GetProject(ctx context.Context, projectID string) (*Project, error)
	ListProjects(ctx context.Context, status string) ([]Project, error)

	SavePlan(ctx context.Context, plan *PlanSuggestion) error
	GetPlan(ctx context.Context, projectID, planID string) (*PlanSuggestion, error)
	GetLatestPlan(ctx context.Context, projectID string) (*PlanSuggestion, error)
}

Store 项目与拆分建议存储接口。

Jump to

Keyboard shortcuts

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