cli/cmd/module/cmd_list.go
Claude 41f786a222
Some checks are pending
Security Scan / Go Vulnerability Check (push) Waiting to run
Security Scan / Secret Detection (push) Waiting to run
Security Scan / Dependency & Config Scan (push) Waiting to run
feat(module): add CLI commands for marketplace module management
Wire `core module install/remove/list/update` commands to the
marketplace.Installer from pkg/marketplace. Follows the exact
pattern established by cmd/plugin/.

- install: clone from Git repo with optional ed25519 verification
- list: table output of installed modules
- update: pull latest + re-verify manifest (supports --all)
- remove: confirmation prompt then cleanup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 10:37:52 +00:00

51 lines
859 B
Go

package module
import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
)
func addListCommand(parent *cli.Command) {
listCmd := cli.NewCommand(
"list",
i18n.T("List installed modules"),
"",
func(cmd *cli.Command, args []string) error {
return runList()
},
)
parent.AddCommand(listCmd)
}
func runList() error {
_, st, inst, err := moduleSetup()
if err != nil {
return err
}
defer st.Close()
installed, err := inst.Installed()
if err != nil {
return err
}
if len(installed) == 0 {
cli.Dim("No modules installed")
return nil
}
table := cli.NewTable("Code", "Name", "Version", "Repo")
for _, m := range installed {
table.AddRow(m.Code, m.Name, m.Version, m.Repo)
}
fmt.Println()
table.Render()
fmt.Println()
cli.Dim(fmt.Sprintf("%d module(s) installed", len(installed)))
return nil
}