harness

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 11 Imported by: ? 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 harness declares harnesses.yaml, the repository file that defines where zip items are placed (see site/src/content/docs/guides/zip-items.md). Keep it free of agent dependencies, like pkg/catalog.

Index

Constants

View Source
const (
	KindDirectory   = "directory"
	KindMarketplace = "marketplace"
	KindSettings    = "settings"
)

Placement kinds.

View Source
const (
	ScopeMachine = "machine"
	ScopeUser    = "user"
)

Scopes. An OS without a scope is ScopeMachine.

View Source
const (
	Darwin  = "darwin"
	Windows = "windows"
)

OS keys of Placement.Paths and Placement.Scope.

View Source
const DefaultCatalogTemplate = `` /* 704-byte string literal not displayed */

DefaultCatalogTemplate renders a manifest_files entry written as a bare path: the Claude Code marketplace catalog (zip-items guide, "Marketplace and settings placements"). It is a template like any a brand writes, so a brand overrides it by copying it under {path, template}.

View Source
const DefaultSettingsTemplate = `` /* 422-byte string literal not displayed */

DefaultSettingsTemplate renders a settings placement that has no template: the Claude Code drop-in that registers the marketplace and enables its managed plugins, or nothing, which removes the file, when the marketplace holds no plugin.

Variables

View Source
var DefaultManifestFiles = []string{".claude-plugin/marketplace.json"}

DefaultManifestFiles is where a marketplace's manifest is written when its block lists no manifest_files.

Functions

This section is empty.

Types

type ManifestFile

type ManifestFile struct {
	Path     string `yaml:"path"`
	Template string `yaml:"template,omitempty"`
}

ManifestFile is one manifest_files entry: a path, which gets DefaultCatalogTemplate, or {path, template}, which gets that template (render.FileContext). In YAML a bare string is a path.

func (*ManifestFile) UnmarshalYAML

func (f *ManifestFile) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML accepts a string or a {path, template} mapping.

type Marketplace

type Marketplace struct {
	Name                                string         `yaml:"name"`
	Owner                               any            `yaml:"owner"`
	Renames                             any            `yaml:"renames,omitempty"`
	AllowCrossMarketplaceDependenciesOn any            `yaml:"allowCrossMarketplaceDependenciesOn,omitempty"`
	ManifestFiles                       []ManifestFile `yaml:"manifest_files,omitempty"`
}

Marketplace configures a marketplace placement's manifest. Owner, Renames and AllowCrossMarketplaceDependenciesOn are written to the manifest unchanged, so they stay untyped.

func (Marketplace) Files

func (m Marketplace) Files() []string

Files returns the paths of Manifests.

func (Marketplace) Manifests

func (m Marketplace) Manifests() []ManifestFile

Manifests returns the manifest files to write, relative to the placement root, each with its template: DefaultCatalogTemplate for an entry written as a path, and DefaultManifestFiles when the block lists none.

type Placement

type Placement struct {
	Kind string `yaml:"kind"`
	// Paths maps an OS (darwin, windows) to the placement root on it.
	Paths map[string]string `yaml:"paths,omitempty"`
	// Scope maps an OS to machine or user. An OS left out is machine.
	Scope        map[string]string `yaml:"scope,omitempty"`
	WorksIn      []string          `yaml:"works_in,omitempty"`
	ActionLabels map[string]string `yaml:"action_labels,omitempty"`
	Exclusive    bool              `yaml:"exclusive,omitempty"`
	// Marketplace is set for KindMarketplace only.
	Marketplace *Marketplace `yaml:"marketplace,omitempty"`
	// Registers names the placement a KindSettings file registers: a
	// marketplace, or with Template any directory or marketplace.
	Registers string `yaml:"registers,omitempty"`
	// Template renders a KindSettings file in place of
	// DefaultSettingsTemplate (render.FileContext). An empty output removes
	// the file.
	Template string `yaml:"template,omitempty"`
}

Placement is a named destination for zip items.

func (Placement) Path

func (p Placement) Path(goos string) (string, bool)

Path returns the placement root for goos and whether it has one.

func (Placement) Registered

func (p Placement) Registered(name, root string) *render.Registered

Registered describes placement name, rooted at root, to the template of a settings placement that registers it.

func (Placement) ScopeFor

func (p Placement) ScopeFor(goos string) string

ScopeFor returns the placement's scope on goos.

func (Placement) SettingsTemplate

func (p Placement) SettingsTemplate() string

SettingsTemplate returns the template a settings placement's file is rendered from: its own, or DefaultSettingsTemplate.

func (Placement) View

func (p Placement) View(name, root string) render.Placement

View describes placement name, rooted at root, to a template.

type Table

type Table struct {
	Placements map[string]Placement `yaml:"placements"`
	// CheckFacts are the facts makecatalogs -check renders templates with,
	// over the built-in samples (conditions.SampleFacts): the admin facts
	// the templates read.
	CheckFacts map[string]any `yaml:"check_facts,omitempty"`
	// Order holds the placement names in file order. Parse fills it.
	Order []string `yaml:"-"`
}

Table is a parsed harnesses.yaml.

func Parse

func Parse(data []byte) (Table, error)

Parse decodes harnesses.yaml, rejecting unknown fields, and validates it. An empty file is an empty table.

func (Table) Names

func (t Table) Names() []string

Names returns the placement names in file order. This is the table's order wherever an order matters, such as label fallback.

func (Table) Storefront

func (t Table) Storefront(item catalog.Item, goos string) (labels map[string]string, worksIn []string)

Storefront returns what the storefront shows for item on goos: its action labels and the harnesses it works in. A label comes from the item's custom_action_labels, else from the first of its placements with a variant on goos, in table order, that sets it; a key set nowhere is left out, for the UI's built-in label. worksIn is the union of those placements' works_in, in table order. Only a zip item has placements.

func (Table) Validate

func (t Table) Validate() error

Validate reports every problem in the table, one error per problem.

Jump to

Keyboard shortcuts

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