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

Function scanExistingTasks

apps/cli/internal/sync/import_engine.go:178–199  ·  view source on GitHub ↗

scanExistingTasks scans the directory for task IDs and external_ids.

(dir string, verbose bool)

Source from the content-addressed store, hash-verified

176
177// scanExistingTasks scans the directory for task IDs and external_ids.
178func scanExistingTasks(dir string, verbose bool) (ids []string, externalIDs map[string]bool, err error) {
179 externalIDs = make(map[string]bool)
180
181 if _, statErr := os.Stat(dir); os.IsNotExist(statErr) {
182 return nil, externalIDs, nil
183 }
184
185 taskScanner := scanner.NewScanner(dir, verbose, nil)
186 result, err := taskScanner.Scan()
187 if err != nil {
188 return nil, nil, err
189 }
190
191 ids = make([]string, 0, len(result.Tasks))
192 for _, t := range result.Tasks {
193 ids = append(ids, t.ID)
194 if t.ExternalID != "" {
195 externalIDs[t.ExternalID] = true
196 }
197 }
198 return ids, externalIDs, nil
199}
200
201// appendSourceURL appends a source reference to the task description.
202func appendSourceURL(description, url string) string {

Callers 1

RunImportFunction · 0.85

Calls 1

ScanMethod · 0.95

Tested by

no test coverage detected