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

Function writeModelsCache

internal/providers/models.go:288–302  ·  view source on GitHub ↗
(path string, models []string)

Source from the content-addressed store, hash-verified

286}
287
288func writeModelsCache(path string, models []string) error {
289 if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {
290 return err
291 }
292 entry := cacheEntry{Models: models, FetchedAt: time.Now()}
293 payload, err := json.MarshalIndent(entry, "", " ")
294 if err != nil {
295 return err
296 }
297 tmp := fmt.Sprintf("%s.tmp.%d", path, os.Getpid())
298 if err := os.WriteFile(tmp, payload, 0o600); err != nil {
299 return err
300 }
301 return os.Rename(tmp, path)
302}
303
304func discoveryShell(command string) (string, []string) {
305 if runtime.GOOS == "windows" {

Callers 1

ResolveModelsFunction · 0.85

Calls 1

RenameMethod · 0.45

Tested by

no test coverage detected