projects

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package projects handles multi-project discovery, resolution, and budget allocation. Supports explicit project paths, glob patterns, and priority-based budget splitting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverProjectsInDir

func DiscoverProjectsInDir(dir string) ([]string, error)

DiscoverProjectsInDir finds projects in a directory (non-recursive).

func ExpandGlobPatterns

func ExpandGlobPatterns(patterns, excludes []string) ([]string, error)

ExpandGlobPatterns expands glob patterns and filters out excluded paths.

func IsProjectPath

func IsProjectPath(path string) bool

IsProjectPath checks if a path looks like a valid project directory. Checks for common project indicators like .git, go.mod, package.json, etc.

func MergeProjectConfig

func MergeProjectConfig(globalCfg *config.Config, projectPath string) (*config.Config, error)

MergeProjectConfig loads and merges a per-project config with the global config. Per-project config overrides global settings.

Types

type BudgetAllocation

type BudgetAllocation struct {
	Project    Project
	Tokens     int64   // Allocated token budget
	Percentage float64 // Percentage of total budget
}

BudgetAllocation contains budget info for a project.

func AllocateBudget

func AllocateBudget(projects []Project, totalBudget int64) []BudgetAllocation

AllocateBudget distributes the total budget across projects by priority weight. Projects with higher priority get proportionally more budget.

type Project

type Project struct {
	Path     string         // Absolute path to project
	Priority int            // Priority for ordering (higher = more important)
	Config   *config.Config // Merged configuration for this project
	Weight   float64        // Normalized weight for budget allocation
}

Project represents a resolved project with merged configuration.

func FilterNotProcessedSince

func FilterNotProcessedSince(projects []Project, s *state.State, since time.Duration) []Project

FilterNotProcessedSince returns projects not processed within the given duration.

func FilterProcessedToday

func FilterProcessedToday(projects []Project, s *state.State) []Project

FilterProcessedToday removes projects that were already processed today.

func SelectNext

func SelectNext(projects []Project, s *state.State) *Project

SelectNext picks the next project to process based on priority and staleness. Returns nil if no projects are available.

func SortByPriority

func SortByPriority(projects []Project) []Project

SortByPriority orders projects by priority (highest first).

type ProjectSummary

type ProjectSummary struct {
	Path           string
	Priority       int
	LastRun        time.Time
	RunCount       int
	ProcessedToday bool
}

ProjectSummary provides summary info for a project.

func GetProjectSummaries

func GetProjectSummaries(projects []Project, s *state.State) []ProjectSummary

GetProjectSummaries returns summary info for all projects.

type Resolver

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

Resolver handles project discovery and configuration merging.

func NewResolver

func NewResolver(globalCfg *config.Config) *Resolver

NewResolver creates a resolver with the given global configuration.

func (*Resolver) DiscoverProjects

func (r *Resolver) DiscoverProjects() ([]Project, error)

DiscoverProjects resolves all projects from configuration. Expands glob patterns, excludes specified paths, and merges per-project configs.

Jump to

Keyboard shortcuts

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