MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / metadataInstallCommand

Method metadataInstallCommand

internal/cli/metadata.go:95–126  ·  view source on GitHub ↗
(state *globalState)

Source from the content-addressed store, hash-verified

93}
94
95func (a *App) metadataInstallCommand(state *globalState) *cobra.Command {
96 var targets []string
97 cmd := &cobra.Command{
98 Use: "install <install-key>",
99 Short: "Install a metadata item to one or more target coding agents",
100 Args: cobra.ExactArgs(1),
101 RunE: func(cmd *cobra.Command, args []string) error {
102 out := cmd.OutOrStdout()
103 store := metadata.NewStore(state.storePath)
104 svc := metadata.NewService(store)
105 installKey := args[0]
106
107 if len(targets) == 0 {
108 targets = []string{"claude"}
109 }
110
111 // Try each kind until found.
112 var lastErr error
113 for _, kind := range []string{"skill", "agent", "instruction", "plugin"} {
114 err := svc.InstallToTargets(context.Background(), kind, installKey, targets)
115 if err == nil {
116 fmt.Fprintf(out, "✓ Installed %s to %s\n", installKey, strings.Join(targets, ", "))
117 return nil
118 }
119 lastErr = err
120 }
121 return fmt.Errorf("install failed: %w", lastErr)
122 },
123 }
124 cmd.Flags().StringSliceVar(&targets, "target", []string{"claude"}, "Target coding agent(s); repeat or comma-separate (e.g. --target claude,codex)")
125 return cmd
126}

Callers 1

metadataCommandMethod · 0.95

Calls 3

InstallToTargetsMethod · 0.95
NewStoreFunction · 0.92
NewServiceFunction · 0.92

Tested by

no test coverage detected