Documentation
¶
Overview ¶
Package project manages the TOML-backed project registry for ttal.
Projects are stored in ~/.config/ttal/projects.toml (or a per-team variant) as top-level alias sections with name and path fields; archived projects live under [archived]. The Store type provides CRUD and archive/unarchive operations with atomic writes, while resolve.go resolves project paths from taskwarrior project strings.
Plane: shared
Index ¶
- func GetProjectPath(alias string) (string, error)
- func ResolveProjectPath(projectName string) string
- func ResolveProjectPathForTeam(projectName, team string) string
- func ResolveProjectPathOrError(projectName string) (string, error)
- func ValidateProjectAlias(alias string) error
- type Project
- type Store
- func (s *Store) Add(alias, name, path string) error
- func (s *Store) Archive(alias string) error
- func (s *Store) Delete(alias string) error
- func (s *Store) Exists(alias string) (bool, error)
- func (s *Store) Get(alias string) (*Project, error)
- func (s *Store) List(archived bool) ([]Project, error)
- func (s *Store) Modify(alias string, updates map[string]string) error
- func (s *Store) Path() string
- func (s *Store) Unarchive(alias string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProjectPath ¶ added in v1.4.0
GetProjectPath looks up a project by exact alias and returns its path. Returns a user-friendly error listing available projects if not found. If the alias contains "." and a hierarchical parent exists, suggests it.
func ResolveProjectPath ¶
ResolveProjectPath looks up a project path by matching the taskwarrior project field against the ttal project alias. Returns empty string if no match found (caller should notify lifecycle agent).
Resolution order:
- If projectName matches an alias (with hierarchical fallback: "ttal.pr" → "ttal") → use that project's path
- If projectName contains exactly one alias ("ttal-cli" contains "ttal") → use that project's path
- If no match but only ONE project exists → use it (single-project shortcut)
- Otherwise → return empty (no match)
func ResolveProjectPathForTeam ¶ added in v1.3.0
ResolveProjectPathForTeam is like ResolveProjectPath but reads from the specified team's projects.toml instead of the cached active team. Use this when the team is known at call time (e.g. from a CleanupRequest) to avoid sync.Once cache issues in the daemon where config.ResolveProjectsPath() is cached at startup. When team is empty, falls back to ResolveProjectPath behavior.
func ResolveProjectPathOrError ¶ added in v1.3.0
ResolveProjectPathOrError resolves a project path from a taskwarrior project field. Returns a user-friendly error if the project alias is not registered.
func ValidateProjectAlias ¶ added in v1.0.0
ValidateProjectAlias checks that a project alias exists (exact match, active only). Returns a user-friendly error listing available projects if not found.
Types ¶
type Project ¶ added in v1.0.0
type Project struct {
Name string `toml:"name"`
Path string `toml:"path"`
Alias string `toml:"-"` // derived from TOML key
Archived bool `toml:"-"` // derived from section
}
Project represents a project entry.
type Store ¶ added in v1.0.0
type Store struct {
// contains filtered or unexported fields
}
Store manages project TOML files.
func (*Store) Add ¶ added in v1.0.0
Add creates a new project. Returns error if alias already exists.
func (*Store) Exists ¶ added in v1.0.0
Exists checks whether a project alias exists (in either active or archived).
func (*Store) Get ¶ added in v1.0.0
Get returns a project by alias (active only). Returns nil if not found.
func (*Store) List ¶ added in v1.0.0
List returns all projects. If archived is true, returns only archived; otherwise only active.