MCPcopy Create free account
hub / github.com/driangle/taskmd / parseScopeEntries

Function parseScopeEntries

apps/cli/internal/cli/validate.go:351–388  ·  view source on GitHub ↗

parseScopeEntries converts raw viper scope data into typed ScopeConfig entries.

(scopeMap map[string]any)

Source from the content-addressed store, hash-verified

349
350// parseScopeEntries converts raw viper scope data into typed ScopeConfig entries.
351func parseScopeEntries(scopeMap map[string]any) map[string]validator.ScopeConfig {
352 scopes := make(map[string]validator.ScopeConfig, len(scopeMap))
353 for name, val := range scopeMap {
354 sc := validator.ScopeConfig{} // Paths stays nil if not found
355
356 entryMap, ok := val.(map[string]any)
357 if !ok {
358 scopes[name] = sc
359 continue
360 }
361
362 if desc, ok := entryMap["description"].(string); ok {
363 sc.Description = desc
364 }
365
366 pathsRaw, exists := entryMap["paths"]
367 if !exists {
368 scopes[name] = sc
369 continue
370 }
371
372 pathsSlice, ok := pathsRaw.([]any)
373 if !ok {
374 scopes[name] = sc
375 continue
376 }
377
378 paths := make([]string, 0, len(pathsSlice))
379 for _, p := range pathsSlice {
380 if s, ok := p.(string); ok {
381 paths = append(paths, s)
382 }
383 }
384 sc.Paths = paths
385 scopes[name] = sc
386 }
387 return scopes
388}
389
390// collectArchivedIDs scans archive directories and returns a set of task IDs found there.
391func collectArchivedIDs(s *scanner.Scanner) map[string]bool {

Calls

no outgoing calls