project

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigDir is the directory name for project configuration.
	ConfigDir = ".co"
	// ConfigFile is the name of the project config file.
	ConfigFile = "config.toml"
	// TrackingDB is the name of the tracking database file.
	TrackingDB = "tracking.db"
	// MainDir is the directory name for the main repository.
	MainDir = "main"

	// RepoTypeLocal indicates a symlinked local repository.
	RepoTypeLocal = "local"
	// RepoTypeGitHub indicates a cloned GitHub repository.
	RepoTypeGitHub = "github"
)
View Source
const BeadsPathProject = ".co/.beads"

BeadsPathProject is the path for project-local beads (standalone, not synced).

View Source
const BeadsPathRepo = "main/.beads"

BeadsPathRepo is the path for beads in the repository (synced with git).

Variables

This section is empty.

Functions

func FormatTabName

func FormatTabName(prefix, workID, friendlyName string) string

FormatTabName formats a tab name with an optional friendly name. If friendlyName is not empty, formats as "prefix-workID (friendlyName)", otherwise just "prefix-workID".

func SessionNameForProject

func SessionNameForProject(projectName string) string

SessionNameForProject returns the zellij session name for a specific project. This is used consistently across the codebase for session management.

Types

type BeadsConfig

type BeadsConfig struct {
	// Path to beads directory (relative to project root)
	// "main/.beads" = beads in repository (synced with git)
	// ".co/.beads" = project-local beads (standalone, not synced)
	Path string `toml:"path"`
}

BeadsConfig contains beads path configuration.

type ClaudeConfig

type ClaudeConfig struct {
	// SkipPermissions controls whether to run Claude with --dangerously-skip-permissions.
	// Defaults to true when not specified in config.
	SkipPermissions *bool `toml:"skip_permissions"`

	// TimeLimitMinutes is the maximum duration in minutes for a Claude session.
	// When set to 0 or omitted, there is no time limit.
	TimeLimitMinutes int `toml:"time_limit"`

	// TaskTimeoutMinutes controls the maximum execution time for a task in minutes.
	// Defaults to 60 minutes when not specified.
	TaskTimeoutMinutes *int `toml:"task_timeout_minutes"`
}

ClaudeConfig contains Claude Code configuration.

func (*ClaudeConfig) GetTaskTimeout

func (c *ClaudeConfig) GetTaskTimeout() time.Duration

GetTaskTimeout returns the task timeout duration. Defaults to 60 minutes when not explicitly configured. If time_limit is set and is less than the default/configured task_timeout_minutes, time_limit takes precedence.

func (*ClaudeConfig) ShouldSkipPermissions

func (c *ClaudeConfig) ShouldSkipPermissions() bool

ShouldSkipPermissions returns true if Claude should run with --dangerously-skip-permissions. Defaults to true when not explicitly configured.

func (*ClaudeConfig) TimeLimit

func (c *ClaudeConfig) TimeLimit() time.Duration

TimeLimit returns the maximum duration for a Claude session. Returns 0 if no time limit is configured.

type Config

type Config struct {
	Project   ProjectConfig   `toml:"project"`
	Repo      RepoConfig      `toml:"repo"`
	Beads     BeadsConfig     `toml:"beads"`
	Hooks     HooksConfig     `toml:"hooks"`
	Linear    LinearConfig    `toml:"linear"`
	Claude    ClaudeConfig    `toml:"claude"`
	Workflow  WorkflowConfig  `toml:"workflow"`
	Scheduler SchedulerConfig `toml:"scheduler"`
	Zellij    ZellijConfig    `toml:"zellij"`
	LogParser LogParserConfig `toml:"log_parser"`
}

Config represents the project configuration stored in .co/config.toml.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads and parses a config.toml file.

func (*Config) GenerateDocumentedConfig

func (c *Config) GenerateDocumentedConfig() string

GenerateDocumentedConfig generates a documented config.toml string with comments. This includes the actual project values plus commented-out examples for optional sections.

func (*Config) SaveConfig

func (c *Config) SaveConfig(path string) error

SaveConfig writes the config to the specified path.

func (*Config) SaveDocumentedConfig

func (c *Config) SaveDocumentedConfig(path string) error

SaveDocumentedConfig writes a fully documented config to the specified path. This creates a config file with inline comments explaining all available options.

type HooksConfig

type HooksConfig struct {
	// Env is a list of environment variables to set before running commands.
	// Format: ["KEY=value", "ANOTHER_KEY=value"]
	// These are applied when spawning Claude in zellij tabs.
	Env []string `toml:"env"`
}

HooksConfig contains hook configuration.

type LinearConfig

type LinearConfig struct {
	// APIKey is the Linear API key for authentication.
	APIKey string `toml:"api_key"`
}

LinearConfig contains Linear integration configuration.

type LogParserConfig

type LogParserConfig struct {
	// UseClaude controls whether to use Claude for log analysis instead of the Go parser.
	// Defaults to false when not specified.
	UseClaude bool `toml:"use_claude"`

	// Model specifies which Claude model to use for log analysis.
	// Valid values: "haiku", "sonnet", "opus"
	// Defaults to "haiku" when not specified.
	Model string `toml:"model"`
}

LogParserConfig contains log parser configuration.

func (*LogParserConfig) GetModel

func (l *LogParserConfig) GetModel() string

GetModel returns the configured Claude model for log analysis. Defaults to "haiku" when not specified or when an invalid model is configured. Valid models are: "haiku", "sonnet", "opus".

func (*LogParserConfig) ShouldUseClaude

func (l *LogParserConfig) ShouldUseClaude() bool

ShouldUseClaude returns true if Claude should be used for log analysis.

type Project

type Project struct {
	Root   string        // Project directory path
	Config *Config       // Parsed config.toml
	DB     *db.DB        // Tracking database (lazy loaded)
	Beads  *beads.Client // Beads database client (for issue tracking)
}

Project represents an orchestrator project.

func Create

func Create(ctx context.Context, dir, repoSource string) (*Project, error)

Create initializes a new project at the given directory. repoSource can be a local path (symlinked) or GitHub URL (cloned).

func Find

func Find(ctx context.Context, flagValue string) (*Project, error)

Find finds a project from a flag value or current directory. If flagValue is non-empty, uses that path; otherwise uses cwd.

func (*Project) BeadsPath

func (p *Project) BeadsPath() string

BeadsPath returns the path to the beads directory.

func (*Project) Close

func (p *Project) Close() error

Close closes any open resources (database and beads client).

func (*Project) MainRepoPath

func (p *Project) MainRepoPath() string

MainRepoPath returns the path to the main repository.

func (*Project) WorktreePath

func (p *Project) WorktreePath(taskID string) string

WorktreePath returns the path where a task's worktree should be created.

type ProjectConfig

type ProjectConfig struct {
	Name      string    `toml:"name"`
	CreatedAt time.Time `toml:"created_at"`
}

ProjectConfig contains project metadata.

type RepoConfig

type RepoConfig struct {
	Type       string `toml:"type"`        // "local" or "github"
	Source     string `toml:"source"`      // Original path or URL
	Path       string `toml:"path"`        // Always "main"
	BaseBranch string `toml:"base_branch"` // Base branch for feature branches (default: "main")
}

RepoConfig contains repository configuration.

func (*RepoConfig) GetBaseBranch

func (r *RepoConfig) GetBaseBranch() string

GetBaseBranch returns the configured base branch or "main" if not set.

type SchedulerConfig

type SchedulerConfig struct {
	// PRFeedbackIntervalMinutes is the interval between PR feedback checks.
	// Defaults to 5 minutes when not specified.
	PRFeedbackIntervalMinutes *int `toml:"pr_feedback_interval_minutes"`

	// CommentResolutionIntervalMinutes is the interval between comment resolution checks.
	// Defaults to 5 minutes when not specified.
	CommentResolutionIntervalMinutes *int `toml:"comment_resolution_interval_minutes"`

	// SchedulerPollSeconds is the scheduler polling interval.
	// Defaults to 1 second when not specified.
	SchedulerPollSeconds *int `toml:"scheduler_poll_seconds"`

	// ActivityUpdateSeconds is the interval for updating task activity timestamps.
	// Defaults to 30 seconds when not specified.
	ActivityUpdateSeconds *int `toml:"activity_update_seconds"`
}

SchedulerConfig contains scheduler timing configuration.

func (*SchedulerConfig) GetActivityUpdateInterval

func (s *SchedulerConfig) GetActivityUpdateInterval() time.Duration

GetActivityUpdateInterval returns the activity update interval. Defaults to 30 seconds when not specified.

func (*SchedulerConfig) GetCommentResolutionInterval

func (s *SchedulerConfig) GetCommentResolutionInterval() time.Duration

GetCommentResolutionInterval returns the comment resolution check interval. Defaults to 5 minutes when not specified.

func (*SchedulerConfig) GetPRFeedbackInterval

func (s *SchedulerConfig) GetPRFeedbackInterval() time.Duration

GetPRFeedbackInterval returns the PR feedback check interval. Defaults to 5 minutes when not specified.

func (*SchedulerConfig) GetSchedulerPollInterval

func (s *SchedulerConfig) GetSchedulerPollInterval() time.Duration

GetSchedulerPollInterval returns the scheduler polling interval. Defaults to 1 second when not specified.

type WorkflowConfig

type WorkflowConfig struct {
	// MaxReviewIterations limits the number of review/fix cycles.
	// Defaults to 2 when not specified.
	MaxReviewIterations *int `toml:"max_review_iterations"`
}

WorkflowConfig contains workflow configuration.

func (*WorkflowConfig) GetMaxReviewIterations

func (w *WorkflowConfig) GetMaxReviewIterations() int

GetMaxReviewIterations returns the configured max review iterations or 2 if not specified.

type ZellijConfig

type ZellijConfig struct {
	// KillTabsOnDestroy controls whether to automatically kill zellij tabs
	// when work is destroyed. Includes work, task, console, and claude tabs.
	// Defaults to true when not specified.
	KillTabsOnDestroy *bool `toml:"kill_tabs_on_destroy"`
}

ZellijConfig contains zellij tab management configuration.

func (*ZellijConfig) ShouldKillTabsOnDestroy

func (z *ZellijConfig) ShouldKillTabsOnDestroy() bool

ShouldKillTabsOnDestroy returns true if zellij tabs should be killed when work is destroyed. Defaults to true when not explicitly configured.

Jump to

Keyboard shortcuts

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