Documentation
¶
Overview ¶
Package workspace implements the multi-pack orchestration engine. It provides tools discovery, parallel pack operations, progress display, linting, and the sync engine used by packwand workspace commands.
Index ¶
- Variables
- func AutoLintDirs(dirs []string)
- func CacheSlotCount() int
- func CheckUpdatesInDir(dir string) ([]string, error)
- func CollectTargets(root string, honorIgnore bool, packFilter string, explicit bool) (targets []string, skipped []string)
- func ConfigureSubprocess(c *exec.Cmd)
- func CopyFileFast(src, dst string) error
- func FindRepoRoot() string
- func GitChangedFiles() []string
- func Indent(s, prefix string) string
- func LintOne(path string) error
- func MaxConcurrent() int
- func ModpacksDir() string
- func ResolveScope(args []string, startCwd string) (packFilter string, explicit bool)
- func Run(op Operation, packFilter string, explicit bool) error
- func RunLintFiles(files []string) (failed, checked int64)
- func RunSync(dryRun bool) error
- func SelfBin() string
- func WorkPool(targets []string, op Operation, prog *Progress) []string
- func WriteJSON(path string, v any) error
- type Operation
- type Progress
- type Resource
- type Scheduler
- type Task
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AutoLintDirs ¶
func AutoLintDirs(dirs []string)
AutoLintDirs lints all .pw.toml files under mods/ in each given dir. Warnings are printed but the function never exits — it is a best-effort post-op check.
func CacheSlotCount ¶
func CacheSlotCount() int
CacheSlotCount returns the number of packwand export operations that may run concurrently against the on-disk pack cache. Controlled by PACKWAND_CACHE_SLOTS.
func CheckUpdatesInDir ¶
CheckUpdatesInDir runs packwand update --all --dry-run and returns found update strings.
func CollectTargets ¶
func CollectTargets(root string, honorIgnore bool, packFilter string, explicit bool) (targets []string, skipped []string)
CollectTargets discovers pack subdirectories eligible for op under root.
func ConfigureSubprocess ¶
ConfigureSubprocess keeps workspace-level fanout from multiplying by each child packwand process's internal fanout. Explicit user limits are preserved.
func CopyFileFast ¶
CopyFileFast copies src to dst using a 1 MiB buffer.
func FindRepoRoot ¶
func FindRepoRoot() string
FindRepoRoot walks up from cwd looking for .git or modpacks/.
func GitChangedFiles ¶
func GitChangedFiles() []string
GitChangedFiles returns filenames changed in the last commit.
func MaxConcurrent ¶
func MaxConcurrent() int
MaxConcurrent returns the number of parallel workers to use.
func ModpacksDir ¶
func ModpacksDir() string
ModpacksDir returns the root directory containing all pack directories.
func ResolveScope ¶
ResolveScope converts command args into a (packFilter, explicit) pair. Pass startCwd as the directory where the user invoked the command.
func RunLintFiles ¶
RunLintFiles lints files concurrently and returns (failed, checked) counts.
func SelfBin ¶
func SelfBin() string
SelfBin returns the path to the running packwand binary for sub-invocations. Reads PACKWAND_BIN first; falls back to PACKWIZ_BIN for backward compatibility.
Types ¶
type Operation ¶
type Operation struct {
Name string
Gerund string
PackwizArgs []string
HonorIgnore bool
// ExtraArgsFor, when set, appends per-target arguments to PackwizArgs
// (e.g. a per-subdir --report path).
ExtraArgsFor func(dir string) []string
}
Operation describes a packwand sub-command to run across pack subdirectories.
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
func NewProgress ¶
NewProgress creates and starts a TTY progress display.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler runs tasks concurrently while serialising tasks that share a Resource.
func NewScheduler ¶
NewScheduler creates a Scheduler with the given worker count.
func (*Scheduler) Close ¶
func (s *Scheduler) Close()
Close signals that no more tasks will be submitted. Workers exit once all pending tasks finish. Must be called after the last Submit.
func (*Scheduler) Submit ¶
Submit enqueues a task and returns a channel that receives the error when done.
func (*Scheduler) SubmitWait ¶
SubmitWait submits a task and blocks until it completes.