plugin

package
v0.1.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package plugin wires `w17ctl plugin <leaf>` — the plugin catalog commands (list / install / update / gen-pb). The internal catalog is embedded in the binary (embed/plugins, synced from plugins/* by `make sync-plugins-internal`); the command package owns both the embed and the install/update logic.

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 embedded plugins + their install state in this project's lock."`
	Install InstallCmd `cmd:"" help:"Install one plugin from the embedded catalog into the project. Refuses URLs (v1 supports name-only)."`
	Update  UpdateCmd  `` /* 135-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 embedded + installed plugins
  • `install` — extract one plugin from the embedded catalog into the project's `<proto_dir>/plugins/` tree + record it in the lock
  • `update` — re-extract one (or every) installed plugin from the embedded catalog, 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 (embedded catalog) or URL (v2 — not yet supported)."`
	Console string `` /* 219-byte string literal not displayed */
}

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

v1 supports name-only — the named plugin must exist in the embedded catalog. 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. Resolve the named plugin from the embedded catalog.
  3. Load + validate plugin.yaml; refuse the install on manifest errors (missing fields, name mismatch, …).
  4. Run [plugins.CheckRequires] against the running w17 version (currently a no-op — pre-launch — but the gate is plumbed for when a version constant lands).
  5. Target dir = `<root>/<proto_dir>/plugins/<name>/`. Refuse if the dir already exists (v1 has no `remove`; operator manually deletes per the implementation plan). Refuse if `<name>` already in lock.plugins[] regardless of disk state (operator must clean up first).
  6. Walk the embedded tree + write each file to the target.
  7. Append `PluginInstall{name, version, source: "internal"}` to the lock + save (re-signs).

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 `` /* 214-byte string literal not displayed */
}

ListCmd implements `w17ctl plugin list`. Walks the embedded catalog (each subdirectory of `embed/plugins/` is one plugin), loads each plugin.yaml, cross-references the lock's `plugins[]` to surface install state. One line per plugin; reports "no plugins available" when the catalog is empty.

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 `` /* 219-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. Embedded catalog must carry `<name>` (URL-installed plugins can't be updated through this binary).
  3. Manifest loads + validates; CheckRequires runs against the running w17 version.
  4. Target dir is wiped + re-populated from the embedded tree. 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