The Library now reads Codex's plugin cache (plugins/cache/<marketplace>/<plugin>/<version>,
manifests under .codex-plugin, .claude-plugin or .cursor-plugin; config.toml's
enabled flag) and Pi's packages (settings.json packages, package.json pi.skills,
user and project scope) and lists what they bring on the skills, MCP and hooks
tabs under "Installed in the agents themselves", with origin and scope.
Read-only: nothing is copied, linked or registered; the agent keeps loading it,
load status stays unknown. Paths stay inside the plugin; an unreadable file
means unknown. New GET /api/library/native (lazy, not on the polled
/api/library) and `magpie library native`. Docs row in library.md.
Run (mica, sandbox HOME, nothing of the live ~/.codex or ~/.pi touched):
- go vet darwin; internal/library native tests (6) and the new GUI test
library-native.test.cjs in chromium and webkit, 5 languages, 980 and 380 px.
- Built binary against a sandbox copy of the real Codex cache manifests (74 files).
- Not tried: Claude native plugins, subagents, Pi MCP and hooks, a live Codex
or Pi, Windows and WSL Pi. The whole GUI suite and the full Go suite run after the push.
- Not mine: every package using testenv is red on origin/main 9ec023a46 from the
stale docs index (docs/routing-groups.html and its ja/zh copies; its author is
regenerating it), so go test of internal/library and internal/gui fails there
before and after this change. TestEveryRouteHasACommandOrIsNamed named the new
route; settings_parity_test.go now maps it to `magpie library native`.
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/yetone/magpie/internal/library"
|
|
)
|
|
|
|
// libraryNativeCmd is magpie library native: what the plugins Codex and
|
|
// the packages Pi installed themselves declare. It reads and writes
|
|
// nothing; the agent loads them, and whether one is loaded in a session
|
|
// isn't known from its files.
|
|
func libraryNativeCmd(rest []string) error {
|
|
if len(rest) != 0 {
|
|
return fmt.Errorf("usage:\n %s", libraryUsage)
|
|
}
|
|
v := library.ReadNative()
|
|
if len(v) == 0 {
|
|
fmt.Println(muted.Render("no plugins or packages installed through Codex or Pi"))
|
|
return nil
|
|
}
|
|
for _, p := range v {
|
|
where := p.Scope
|
|
if p.Project != "" {
|
|
where += " " + p.Project
|
|
}
|
|
state := "state unknown"
|
|
if p.Enabled != nil {
|
|
state = map[bool]string{true: "on", false: "off"}[*p.Enabled] + " in its settings"
|
|
}
|
|
fmt.Printf("%s %s %s (%s, %s)\n", p.AgentName, p.Name, p.Version, where, state)
|
|
for _, x := range p.Parts {
|
|
fmt.Printf(" %-5s %s", x.Kind, x.Name)
|
|
if x.Detail != "" && x.Kind != "skill" {
|
|
fmt.Printf(" %s", x.Detail)
|
|
}
|
|
fmt.Println()
|
|
}
|
|
}
|
|
return nil
|
|
}
|