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.
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:
- Resolve the project root + lock.
- Resolve the named plugin from the embedded catalog.
- Load + validate plugin.yaml; refuse the install on manifest errors (missing fields, name mismatch, …).
- 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).
- 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).
- Walk the embedded tree + write each file to the target.
- 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.
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:
- Lock entry must exist for `<name>` (otherwise the operator wants `plugin install` instead).
- Embedded catalog must carry `<name>` (URL-installed plugins can't be updated through this binary).
- Manifest loads + validates; CheckRequires runs against the running w17 version.
- Target dir is wiped + re-populated from the embedded tree. Manifest's `version` becomes the new `lock.plugins[].version`.
- Lock is re-signed once at the end (one save per command run regardless of how many plugins update).