curate

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 12 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 curate turns a parsed manifest and a toolset from plugit.yaml into the active toolset: which tools are served, under which names and descriptions, with which per-tool policy. It is pure: no I/O.

Index

Constants

This section is empty.

Variables

View Source
var ErrNameConflict = errors.New("tool name conflict")

ErrNameConflict means the final tool names clash or don't fit.

Functions

func AddToToolset

func AddToToolset(cfg *config.API, toolset string, keys []model.OpKey)

AddToToolset lists keys in a toolset (creating it if needed). Keys already listed keep their overrides untouched: sync only ever adds.

func CheckNames

func CheckNames(tools []Selected) error

CheckNames reports the first name that is too long with the prefix or clashes with another (ignoring case).

Types

type OpChange

type OpChange struct {
	Key          model.OpKey
	Old          *model.Tool
	New          *model.Tool
	What         []string
	Listed       []string
	AutoSelected []string
}

OpChange is one operation that differs between two manifests.

type Result

type Result struct {
	Tools   []Selected
	Missing []model.OpKey
}

Result is the active toolset.

func Apply

func Apply(all []model.Tool, ts config.Toolset, prefix string) (Result, error)

Apply selects tools from all (a manifest's tools, already named with prefix) according to ts (SPEC §9 item 6):

  • a tool is selected when its key is listed in ts.Tools;
  • include_tags and methods narrow the selection, or, when no keys are listed, select from the whole manifest;
  • a toolset with neither selects nothing.

A name override gets the prefix too (§9 item 7). Override descriptions are cleaned like spec text. Final names must be unique case-insensitively.

func Select

func Select(all []model.Tool, ts config.Toolset, prefix string) Result

Select is Apply without the final name check: clashing or overlong names are returned as they are (lint reports them all).

type Selected

type Selected struct {
	Tool     model.Tool
	Override policy.Override
}

Selected is one active tool.

type SyncDiff

type SyncDiff struct {
	Added, Removed, Changed     []OpChange
	ServersBefore, ServersAfter []string
	ServersChanged              bool
	BaseURLListed               bool
}

SyncDiff is what `plugit sync` shows before adopting a new spec (SPEC §2.3 "Sync diff", T3).

func DiffManifests

func DiffManifests(old, updated *model.Manifest, cfg config.API) SyncDiff

DiffManifests compares the manifest plugit has with a newly parsed one. Tools are matched by OpKey, their stable identity.

func (SyncDiff) Empty

func (d SyncDiff) Empty() bool

Empty reports whether nothing changed.

Jump to

Keyboard shortcuts

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