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

Method metadataSearchCommand

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

Source from the content-addressed store, hash-verified

51}
52
53func (a *App) metadataSearchCommand(state *globalState) *cobra.Command {
54 var kindFilter string
55 cmd := &cobra.Command{
56 Use: "search <query>",
57 Short: "Search the metadata index",
58 Args: cobra.MinimumNArgs(1),
59 RunE: func(cmd *cobra.Command, args []string) error {
60 out := cmd.OutOrStdout()
61 store := metadata.NewStore(state.storePath)
62 query := strings.Join(args, " ")
63
64 results, err := store.Search(context.Background(), metadata.SearchQuery{
65 Query: query,
66 Kind: kindFilter,
67 })
68 if err != nil {
69 return fmt.Errorf("search failed: %w", err)
70 }
71 if len(results) == 0 {
72 fmt.Fprintf(out, "No results for %q\n", query)
73 return nil
74 }
75 fmt.Fprintf(out, "Found %d result(s) for %q:\n\n", len(results), query)
76 fmt.Fprintf(out, " %-8s %-30s %-25s %s\n", "KIND", "NAME", "REPO", "DESCRIPTION")
77 fmt.Fprintf(out, " %-8s %-30s %-25s %s\n",
78 strings.Repeat("─", 8), strings.Repeat("─", 30),
79 strings.Repeat("─", 25), strings.Repeat("─", 40))
80 for _, item := range results {
81 repo := item.RepoOwner + "/" + item.RepoName
82 desc := item.Description
83 if len(desc) > 50 {
84 desc = desc[:47] + "..."
85 }
86 fmt.Fprintf(out, " %-8s %-30s %-25s %s\n", item.Kind, item.Name, repo, desc)
87 }
88 return nil
89 },
90 }
91 cmd.Flags().StringVar(&kindFilter, "type", "", "Filter by kind (skill, agent, instruction, plugin)")
92 return cmd
93}
94
95func (a *App) metadataInstallCommand(state *globalState) *cobra.Command {
96 var targets []string

Callers 1

metadataCommandMethod · 0.95

Calls 2

SearchMethod · 0.95
NewStoreFunction · 0.92

Tested by

no test coverage detected