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

Method All

internal/entities/store.go:81–105  ·  view source on GitHub ↗

All returns every entity in the store sorted by name.

()

Source from the content-addressed store, hash-verified

79
80// All returns every entity in the store sorted by name.
81func (s *Store) All() ([]Entity, error) {
82 if err := s.migrateIfInstruction(); err != nil {
83 return nil, err
84 }
85 data := map[string]Entity{}
86 raw, err := os.ReadFile(s.Path())
87 if err != nil {
88 if os.IsNotExist(err) {
89 return nil, nil
90 }
91 return nil, fmt.Errorf("entities: read %s: %w", s.Path(), err)
92 }
93 if len(raw) == 0 {
94 return nil, nil
95 }
96 if err := json.Unmarshal(raw, &data); err != nil {
97 return nil, fmt.Errorf("entities: parse %s: %w", s.Path(), err)
98 }
99 out := make([]Entity, 0, len(data))
100 for _, e := range data {
101 out = append(out, e)
102 }
103 sort.Slice(out, func(i, j int) bool { return out[i].Name < out[j].Name })
104 return out, nil
105}
106
107// Get returns an entity by name.
108func (s *Store) Get(name string) (Entity, error) {

Callers 8

entitySearchCommandFunction · 0.95
GetMethod · 0.95
PutMethod · 0.95
TestStoreRoundTripFunction · 0.95
ListMethod · 0.45
ListRegistryMethod · 0.45
installAllFromStoreFunction · 0.45

Calls 3

migrateIfInstructionMethod · 0.95
PathMethod · 0.95
ReadFileMethod · 0.80