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

Method List

internal/instructions/store.go:112–138  ·  view source on GitHub ↗

List returns all instructions (without installs) ordered by name.

(ctx context.Context)

Source from the content-addressed store, hash-verified

110
111// List returns all instructions (without installs) ordered by name.
112func (s *Store) List(ctx context.Context) ([]Instruction, error) {
113 if err := s.Init(ctx); err != nil {
114 return nil, err
115 }
116 db, err := s.open()
117 if err != nil {
118 return nil, err
119 }
120 defer db.Close()
121 rows, err := db.QueryContext(ctx, `SELECT id, name, description, content, created_at, updated_at FROM instructions ORDER BY name`)
122 if err != nil {
123 return nil, fmt.Errorf("instructions: list: %w", err)
124 }
125 defer rows.Close()
126 var out []Instruction
127 for rows.Next() {
128 var in Instruction
129 var created, updated string
130 if err := rows.Scan(&in.ID, &in.Name, &in.Description, &in.Content, &created, &updated); err != nil {
131 return nil, fmt.Errorf("instructions: scan: %w", err)
132 }
133 in.CreatedAt = parseTime(created)
134 in.UpdatedAt = parseTime(updated)
135 out = append(out, in)
136 }
137 return out, rows.Err()
138}
139
140// ListWithInstalls returns all instructions with their installs populated.
141func (s *Store) ListWithInstalls(ctx context.Context) ([]Instruction, error) {

Callers 9

ListWithInstallsMethod · 0.95
instructionForFileMethod · 0.95
providerListCommandMethod · 0.45
providerAddCommandMethod · 0.45
providerUpdateCommandMethod · 0.45
TestCRUDRoundTripFunction · 0.45
handleProvidersMethod · 0.45
handleToolsMethod · 0.45
handleEntitiesMethod · 0.45

Calls 4

InitMethod · 0.95
openMethod · 0.95
parseTimeFunction · 0.85
QueryContextMethod · 0.80

Tested by 1

TestCRUDRoundTripFunction · 0.36