plugin

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 22 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 plugin is the client side of a Cartographer plugin: the loaders and previews of the skill, agent, hook and provider points, the acquisition of a source (folder or git repository), the diff of two trees and the provider cells handed to provisioning. The data it works on (manifest, tree reader, pinned store, point registry) lives in internal/plugin/core, which the server may link; this package may not be linked by the server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultProviderEnv

func DefaultProviderEnv() core.ProviderEnv

DefaultProviderEnv is the machine ResolveProvider reads at run time.

func DiffPrint

func DiffPrint(w io.Writer, name string, d Delta)

DiffPrint writes d in plain words. A permission added is flagged with "!!" and listed first: it is the line the consent turns on. Every plugin-supplied string goes through esc.

func Fetch

func Fetch(ctx context.Context, s Source, tmpParent string) ([]core.TreeFile, string, error)

Fetch brings the files of the source into memory; nothing is stored. tmpParent holds the throwaway repository of a git fetch. A git source also returns the resolved 40-hex commit; a folder is a snapshot and returns "".

func GlobMatch

func GlobMatch(glob, p string) bool

GlobMatch reports whether p, a path in the placeholder form ("{home}/notes/a.md"), matches glob, a manifest file glob. The dialect: the path is split on "/"; a segment of the glob is matched as path.Match does (* ? [..] within one segment, never across a "/"), and a segment that is exactly ** matches zero or more whole segments. Both are compared as written: the anchor is part of the first segment.

func Preview

func Preview(w io.Writer, p core.Plugin, in PreviewInfo, opts core.Options)

Preview prints what installing p would do, in plain words: every plugin-supplied string goes through esc, and each point prints its own contributions. The printed block is the record of what the user consented to.

func ProviderCells added in v0.29.0

func ProviderCells(r core.ResolvedProvider, active bool) provisioning.PluginCells

ProviderCells is what provisioning reads of the provider: its destination cells, the agent layout, the capability row and the invoke hint. active is the state of the plugin: an inactive provider's cells stay resolvable (what it installed is retired through them) but its hook directory leaves the dispatcher. The MCP file is a cell only when it is the provider's own literal file: the base's file is the base's, and a pattern is written by the registry's own expansion (configurator.Apply), never as a destination of the KB's MCP descriptors.

func RangeMetOK

func RangeMetOK(rng, v string) bool

RangeMetOK is RangeMet with a malformed range counting as not met.

func ToolName

func ToolName(plugin, tool string) string

ToolName is the name a plugin's tool is served and called by: <plugin>_<tool> with hyphens turned into underscores (a client's tool names are identifiers). The bridge, the approval-time `tools` hint, `plugin validate` and the approval preview all use this one function, so the name a user reads is the name `cartographer call` takes.

Types

type Delta

type Delta struct {
	Added, Removed []string
	Changed        []FileChange
	// OldVersion and NewVersion are the manifest versions.
	OldVersion, NewVersion string
	// OldDigest and NewDigest are the tree digests; DiffPrint shows 12 hex of each
	// when the versions are equal, so an edit without a bump is visible.
	OldDigest, NewDigest string
	// CartographerFrom and CartographerTo are the `cartographer` ranges, equal when unchanged.
	CartographerFrom, CartographerTo string
	// DependsAdded and DependsRemoved are "name range" lines; a changed range is one of each.
	DependsAdded, DependsRemoved []string
	// PermissionsAdded and PermissionsRemoved are one human line each.
	PermissionsAdded, PermissionsRemoved []string
	// PathsAdded and PathsRemoved are the provider destinations resolved on this machine.
	PathsAdded, PathsRemoved []string
}

Delta is what an update changes against the approved tree: the text the user reads before consenting. Everything in it is plugin-supplied, so DiffPrint escapes it.

func Diff

func Diff(old, next core.Plugin, env core.ProviderEnv) Delta

Diff compares an approved tree with a newer one, resolving provider destinations against env (the machine's home).

func (Delta) Empty

func (d Delta) Empty() bool

Empty reports whether nothing the user would read differs.

type FileChange

type FileChange struct {
	Path             string
	OldSize, NewSize int
	// Mode is true when only the executable bit changed.
	Mode bool
}

FileChange is one file that differs between two trees.

type PreviewInfo

type PreviewInfo struct {
	Source, Ref, SHA string
	// Side is the component the preview is for: only its sdk levels,
	// permissions and contributions are shown, and the other sides are named
	// as not loaded. Empty shows every side (plugin validate).
	Side core.Side
	// Have reports the version of a configured plugin, for `depends`.
	Have func(name string) (string, bool)
}

PreviewInfo is what a preview needs besides the tree: where it came from and what the machine already has. Source must already be redacted by the caller.

type Source

type Source struct {
	Git    bool
	Remote string // git: the remote as typed, without the @ref
	Ref    string // git: branch, tag or full sha; empty means HEAD
	Path   string // folder: absolute, symlinks resolved
}

Source is where a plugin comes from: a git remote at a ref, or a folder.

func ParseSource

func ParseSource(s string) (Source, error)

ParseSource reads a source typed by the user (os.Args or their config, never a KB or a plugin). An existing directory is a folder, whatever it is called. Otherwise it is a git source: a URL with a scheme git accepts or an scp-like remote (host:path), optionally followed by @<ref>. The ref is split at the LAST @, and only when it lies after the URL's host (or the ':' of an scp-like remote) and the text after it holds neither ':' nor '/', so https://user@host and git@host:team/x.git stay whole and git@host:team/x.git@v1 has ref v1.

func (Source) String

func (s Source) String() string

String is the form recorded in the user's file.

Directories

Path Synopsis
Package core is the half of the plugin system the server and the Surveyor link: the manifest and its version ranges, the families and the contribution-point registry, the reader and digest of an in-memory tree, the pinned store and the provider descriptor with its resolver.
Package core is the half of the plugin system the server and the Surveyor link: the manifest and its version ranges, the families and the contribution-point registry, the reader and digest of an in-memory tree, the pinned store and the provider descriptor with its resolver.
Package star runs the Starlark script of a plugin for a client: plugin.star at the root and the lib/*.star files it loads.
Package star runs the Starlark script of a plugin for a client: plugin.star at the root and the lib/*.star files it loads.
Package starcore is the server-safe Starlark runtime of a plugin script.
Package starcore is the server-safe Starlark runtime of a plugin script.
internal/seam
Package seam holds the test seams of the Starlark runtime.
Package seam holds the test seams of the Starlark runtime.
recipes
Package recipes is the surveyor side of the Starlark runtime: the recipe() registrar of surveyor.star and the call of a recipe's verbs (spec, check, list, fetch).
Package recipes is the surveyor side of the Starlark runtime: the recipe() registrar of surveyor.star and the call of a recipe's verbs (spec, check, list, fetch).
startest
Package startest is the door of the tests to the test seams of starcore.
Package startest is the door of the tests to the test seams of starcore.

Jump to

Keyboard shortcuts

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