plugin

package
v0.1.0-rc.30 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package plugin wires `w17ctl plugin <leaf>` — the plugin catalogue commands (list / install / update / gen-pb). The catalogue is SERVED BY THE CONSOLE (ListPluginCatalog / FetchPlugin); the client carries no copy, so a plugin change reaches a consumer through a console deploy rather than through a client release. This package owns the install/update logic and nothing else.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	List    ListCmd    `cmd:"" help:"List the console's plugin catalogue + each plugin's install state in this project's lock."`
	Install InstallCmd `cmd:"" help:"Install one plugin from the console's catalogue into the project. Refuses URLs (v1 supports name-only)."`
	Update  UpdateCmd  `` /* 190-byte string literal not displayed */
	GenPb   GenPbCmd   `` /* 145-byte string literal not displayed */
}

Cmd is the parent of `w17ctl plugin <leaf>` commands:

  • `list` — inventory of the console's catalogue + installed plugins
  • `install` — fetch one plugin from the console's catalogue into the project's `<proto_dir>/plugins/` tree + record it in the lock
  • `update` — re-fetch one (or every) installed plugin from the console's catalogue, refreshing the on-disk tree + the lock version

`remove` is a v2 feature; until then operators manually `rm -rf <proto_dir>/plugins/<name>/` + drop the lock entry.

type GenPbCmd

type GenPbCmd struct {
	Dir     string `` /* 137-byte string literal not displayed */
	Console string `` /* 175-byte string literal not displayed */
}

GenPbCmd implements `w17ctl plugin gen-pb [dir]`.

It regenerates a plugin's standalone `src/gen/pb/*.pb.go` from its `proto/` tree — the committed pb files that exist ONLY for the plugin author's local dev/test loop (`go test ./...` inside `src/`). The project codegen pipeline generates its OWN per-activation pb at staging time and never uses these files.

Thin-client model: the compile is a COMPILER concern, so it runs on the console. The client only uploads the raw proto/ tree + plugin.yaml to the GeneratePluginPb RPC, and writes the pb.go files the server returns — no buf / loader / manifest / placeholder logic client-side.

func (*GenPbCmd) Run

func (c *GenPbCmd) Run() error

type InstallCmd

type InstallCmd struct {
	Source  string `arg:"" name:"name|url" help:"Plugin name (the console's catalogue) or URL (v2 — not yet supported)."`
	Console string `` /* 214-byte string literal not displayed */
}

InstallCmd implements `w17ctl plugin install <name|url>`.

v1 supports name-only — the named plugin must exist in the console's catalogue. URLs are accepted at the argument layer to reserve the surface for v2 but rejected at the handler with a steering message.

Install:

  1. Resolve the project root + lock.
  2. Refuse if `<name>` is already in lock.plugins[], or if `<root>/<proto_dir>/plugins/<name>/` already exists — v1 has no `remove`, so the operator cleans up first. Both are local checks and run BEFORE the console is dialled: a repeat install should not stream a plugin tree only to refuse it.
  3. Stream the plugin from the console into a sibling STAGING dir.
  4. Validate the staged plugin.yaml server-side (InspectPluginManifest): manifest errors, name/dir disagreement, requirement warnings.
  5. Append `PluginInstall{name, version, source: "internal"}` to the lock via EditLock (the server appends + re-signs).
  6. Only then rename the staged tree into place.

func (*InstallCmd) Run

func (c *InstallCmd) Run() error

type ListCmd

type ListCmd struct {
	LockPath string `name:"lock" placeholder:"PATH" default:"w17/lock.yaml" help:"Path to the lock file."`
	Console  string `` /* 189-byte string literal not displayed */
}

ListCmd implements `w17ctl plugin list`. Asks the console for its plugin catalogue and cross-references the lock's `plugins[]` to surface install state. One line per plugin; reports "no plugins available" when the console serves none and the lock records none.

func (*ListCmd) Run

func (c *ListCmd) Run() error

type UpdateCmd

type UpdateCmd struct {
	Name    string `arg:"" optional:"" name:"name" help:"Installed plugin to refresh. Mutually exclusive with --all."`
	All     bool   `name:"all" help:"Update every plugin recorded in lock.plugins[]."`
	Console string `` /* 214-byte string literal not displayed */
}

UpdateCmd implements `w17ctl plugin update <name>` and `w17ctl plugin update --all`. Both branches share the same per-plugin logic; --all just iterates over every installed plugin in the lock.

Per-plugin update:

  1. Lock entry must exist for `<name>` (otherwise the operator wants `plugin install` instead).
  2. The console's catalogue must carry `<name>` (URL-installed plugins can't be updated through this path).
  3. The fetched manifest is validated server-side; CheckRequires runs against the running w17 version.
  4. The refreshed tree is staged, then swapped in. The manifest's `version` becomes the new `lock.plugins[].version`.
  5. Lock is re-signed once at the end (one save per command run regardless of how many plugins update).

func (*UpdateCmd) Run

func (c *UpdateCmd) Run() error

Jump to

Keyboard shortcuts

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