projects

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 35 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package projects is the named groups of folders of this computer sessions work in, such as a repository and the ones always opened with it: kept once for every profile in projects.json of the folder they share, each with a slug branches and commands name it by and a main folder its sessions and task worktrees start in. A session is in the project whose folder holds its own, the innermost winning, and a profile's sessions start in the main folder of the project it works in when nothing names a folder. Features that keep boards of tasks bind them to projects through hooks, and hear as sessions move into projects and projects change

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Branch

func Branch(slug, task, title string) string

Branch of a task of the project of the slug, valid for git by its making: the slug, a slash and the task's id, then a dash and the words of the title in lower case letters and digits joined by dashes, 40 characters of them at most, when it has any

func Slug

func Slug(text string) (string, error)

Slug of a project as typed, made lower case and checked: an error the person reads when it can't be one

Types

type Archived

type Archived struct {
	Project          Project
	Boards, Profiles []string
}

What archiving or restoring a project did: the project as kept, the boards that were bound to it, and the profiles that worked in it

type Board

type Board struct {
	Slug, Name string
	// Id of the project the board's new tasks are linked to, empty for none
	Project string
}

A board of tasks a feature keeps, such as one of the task board, which a project can be bound to

type Change

type Change struct {
	Name, Description, Icon *string
}

Fields of a project to change, nil keeping what it holds

type Entered

type Entered struct {
	// Folder the session works in now
	Folder string
	// It worked in a folder of the project already and stayed there
	Stayed bool
	// What happened, line by line, for the person
	Lines []string
}

What moving a session into a project did

type Folder

type Folder struct {
	// Whole path, its links resolved
	Path string `json:"path"`
	// What the folder is to the project, such as web, empty for none
	Label string    `json:"label,omitempty"`
	Added time.Time `json:"added_at"`
}

A folder of a project

type Hooks

type Hooks struct {
	// Boards of tasks the feature keeps that are not archived, each with the project it is bound to
	Boards func() ([]Board, error)
	// Binds the board of the slug to the project of the id, so the board's new tasks are linked to it from then on, or to none for an empty
	// id
	Bind func(ctx context.Context, board, project string) error
	// Binds the board of the slug to none while it is bound to the project of the id, as a project archived or deleted lets go of its
	// boards, a board bound to another since left as it is: whether it was let go of. A binding to none stands in where it is nil
	Unbind func(ctx context.Context, board, project string) (bool, error)
	// Hears that a session moved into a project or a project changed, such as to show again the project each session works in
	Changed func(ctx context.Context)
}

What a feature that works with projects adds to them, each part left nil when it has none

type Moved

type Moved struct {
	Session, From, To string
	// Git branch and repository root of the folder it works in now, and the id and name of the project the folder lies in, empty for none
	Branch, Root, Project, Title string
}

What a session moving to another folder came to, as what follows sessions hears of it

type Project

type Project struct {
	// p_ and eight hex digits
	ID string `json:"id"`
	// Lower case handle commands, branches and the task board name it by, never changed
	Slug string `json:"slug"`
	Name string `json:"name"`
	// What it is for, empty when nothing is said
	Description string `json:"description,omitempty"`
	// Short mark shown before its name, such as an emoji, empty for none
	Icon string `json:"icon,omitempty"`
	// Main folder first, then the others in the order they were added; never empty
	Folders []Folder  `json:"folders"`
	Created time.Time `json:"created_at"`
	// Hidden from the lists and holding no session until it is restored
	Archived bool `json:"archived,omitempty"`
}

A named group of folders of this computer sessions work in

func (Project) Main

func (p Project) Main() string

Folder its sessions start in and its tasks make their worktrees from

func (Project) Title

func (p Project) Title() string

Name as a person reads it, its mark before it when it has one

type Projects

type Projects struct {
	Registry
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config, stores *sessions.Sessions, host *terminal.Terminal) *Projects

Registers the setting of the project each profile works in, owned by the host

func (*Projects) Active

func (p *Projects) Active(cfg *config.Config) (Project, bool)

Project the profile of the settings works in, as Where new sessions start names it by its id; false for none, or one archived or deleted

func (*Projects) AddFolder

func (p *Projects) AddFolder(ctx context.Context, id, path, label string, main bool) (Project, error)

Adds the folder, a whole path, to the project of the id with its label, as its main folder when asked

func (*Projects) Archive

func (p *Projects) Archive(ctx context.Context, id string, archive bool) (Archived, error)

Archives the project of the id, its boards bound to no project and no profile working in it any longer, or restores it

func (*Projects) Bind

func (p *Projects) Bind(ctx context.Context, board, id string) error

Binds the board of tasks of the slug to the project of the id, which must not be archived, or to none for an empty id

func (*Projects) Boards

func (p *Projects) Boards(id string) ([]Board, error)

Boards of tasks bound to the project of the id

func (*Projects) Create

func (p *Projects) Create(ctx context.Context, spec Spec) (Project, error)

Makes the project, and binds the spec's board to it

func (*Projects) Delete

func (p *Projects) Delete(ctx context.Context, id string) error

Deletes the archived project of the id for good, its folders and the tasks linked to it left as they are

func (*Projects) Enter

func (p *Projects) Enter(ctx context.Context, cfg *config.Config, session string, project Project) (Entered, error)

Moves the session of the profile of the settings into the main folder of the project, the folder of its commands with it wherever the place they run in reaches that folder, the lines of what happened saying where they start; a session in a folder of the project already stays. An error means the session did not move

func (*Projects) Folder

func (p *Projects) Folder(cfg *config.Config) string

Main folder of the project the profile of the settings works in, where its sessions start when nothing names a folder; empty for none, or for a main folder gone from this computer

func (*Projects) Get

func (p *Projects) Get(ref string) (Project, error)

Project the text names, archived ones too: its id, else its slug, else its name in any case; an *Unknown when none does, and an error naming their slugs when several projects have the name

func (*Projects) Guarding

func (p *Projects) Guarding(unreadable func(cfg *config.Config, path string) string)

Hands over why the tools of a profile may not read a path, empty when they may, which a session may not move into a folder against

func (*Projects) Label

func (p *Projects) Label(ctx context.Context, id, path, label string) (Project, error)

Gives the folder of the project of the id the label, such as web, or none for an empty one

func (*Projects) List

func (p *Projects) List(archived bool) ([]Project, error)

Every project, oldest first, the archived ones too when asked

func (*Projects) Move

func (p *Projects) Move(ctx context.Context, cfg *config.Config, session, folder string, near bool) (Entered, error)

Moves a session of the profile of the settings to a folder under the rules of a person's /cd: a folder of this computer that is there, that the profile's guard of the tools lets be read, for a session whose folder no one else names, as a code editor names the folder of a session it shows and a session that works for another works where that one gave it. Near keeps the move to folders inside the one the session works in and those of the projects, as for a person in a chat or an extension. Its commands follow, and every feature hears of it. An error says in words why it did not move

func (*Projects) Moving

func (p *Projects) Moving(fn func(ctx context.Context, cfg *config.Config, moved Moved))

Hands over what hears of each session that moved to another folder, such as the hook point on_session_move

func (*Projects) Of

func (p *Projects) Of(path string) (Project, bool)

Project not archived one of whose folders holds the path, its links resolved, the innermost folder winning; false for none

func (*Projects) Register

func (p *Projects) Register(registrant Registrant)

Adds a registrant; a registry nested in the host reaches it through Host

func (*Projects) RemoveFolder

func (p *Projects) RemoveFolder(ctx context.Context, id, path string) (Project, error)

Takes the folder out of the project of the id, the folder itself left as it is; the next folder becomes the main one when it was

func (*Projects) SetMain

func (p *Projects) SetMain(ctx context.Context, id, path string) (Project, error)

Makes the folder of the project of the id its main folder

func (*Projects) Snapshot

func (p *Projects) Snapshot() (Snapshot, error)

Projects as the file holds them now, none when there is no file or it holds nothing, read again only once the file changed: a caller that only reads looks projects up in it with no copy of them all

func (*Projects) Update

func (p *Projects) Update(ctx context.Context, id string, change Change) (Project, error)

Changes the fields of the project of the id that the change sets

func (*Projects) Use

func (p *Projects) Use(cfg *config.Config, id string) error

Has the profile of the settings work in the project of the id, so its new sessions start in its main folder, or in none for an empty id

type Registrant

type Registrant interface {
	Hooks() Hooks
}

type Registry

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

func (*Registry) Hooks

func (r *Registry) Hooks() Hooks

Hooks of every registrant: the boards of them all, a binding and a letting go by the one that keeps the board, and every hearing in turn

func (*Registry) Host

func (r *Registry) Host() *Projects

Host the registry is nested in, through which plugins find, change and enter projects

func (*Registry) Register

func (r *Registry) Register(registrant Registrant)

type Snapshot

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

The projects as projects.json held them at one read, oldest first, shared by every read of it and never changed in place, with the place of each among them by its id

func (Snapshot) ByID

func (s Snapshot) ByID(id string) (Project, bool)

Project of the id, archived ones too, found by its id alone in any case as Get finds it, a copy of its own; false for none

func (Snapshot) List

func (s Snapshot) List(archived bool) []Project

Every project, oldest first, the archived ones too when asked, each a copy of its own

type Spec

type Spec struct {
	Name string
	// Slug it is named by, made from the name when empty
	Slug        string
	Description string
	Icon        string
	// Whole paths of its folders, a leading ~ standing for the home folder, the first its main folder
	Folders []string
	// Board of tasks bound to it once it is made, none when empty
	Board string
	// Asked with the main folder as it is kept, its links resolved, once every check the projects as they are allow passed and before
	// anything is made, such as for the user's approval: its error is answered as it is and nothing is made; nil asks nothing
	Allow func(main string) error
}

What a new project is made of

type Taken

type Taken struct {
	Folder  string
	Project Project
}

A folder a project holds already: the folder, and the project that holds it

func (*Taken) Error

func (e *Taken) Error() string

type Unknown

type Unknown struct {
	Ref   string
	Slugs []string
}

No project the text names: the text, and the slugs of the projects there are

func (*Unknown) Error

func (e *Unknown) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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