Files
fn_registry/functions/infra/scan_issues_dir.md
T
Egutierrez c468b24d2b feat(0130): kanban_cpp v2 — backend Go + 5 registry parser fns + epic/sub-issues
Registry (issue 0130a):
- 5 fns infra: parse_issue_md, write_issue_md, scan_issues_dir,
  scan_flows_dir, watch_dir_fsnotify
- 3 tipos: Issue, Flow, FsEvent
- Tests round-trip + scan reales + watcher fsnotify (all PASS)
- Capability group 'kanban' nuevo (docs/capabilities/kanban.md)

Apps:
- apps/kanban_cpp/ (sub-repo) — frontend ImGui: board drag-drop,
  flows, filters, detail con CSV editors
- apps/kanban_cpp/backend/ — Go service port 8487: REST + SSE +
  fsnotify watcher, parser bidireccional MD<->SQLite cache

Issues:
- dev/issues/0130-kanban-cpp-v2.md (epic)
- 0130a parser, 0130b backend, 0130c frontend

CMakeLists.txt: add_subdirectory apps/kanban_cpp (registrado por
init_cpp_app scaffolder).

End-to-end verde: backend devuelve 189 issues + 9 flows; PATCH a
/api/issues/{id} reescribe .md (solo frontmatter, body intacto);
frontend --self-test exit 0; tests Go infra 5/5 PASS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 22:20:15 +02:00

55 lines
2.2 KiB
Markdown

---
name: scan_issues_dir
kind: function
lang: go
domain: infra
version: "0.1.0"
purity: impure
signature: "func ScanIssuesDir(root string) ([]Issue, error)"
description: "Escanea el directorio dev/issues/ (root) y devuelve todos los Issues encontrados en *.md directos y en completed/*.md. Si un archivo falla al parsearse emite un warning al log y continua. Resultado ordenado por ID ascendente."
tags: [issue, scanner, frontmatter, yaml, dev-ux, kanban]
uses_functions: [parse_issue_md_go_infra]
uses_types: [issue_go_infra]
returns: [issue_go_infra]
returns_optional: false
error_type: "error_go_core"
imports: ["fmt", "log", "os", "path/filepath", "sort", "strings"]
params:
- name: root
desc: "Ruta al directorio dev/issues/ (absoluta o relativa). Debe existir o retorna error."
output: "Slice de Issue ordenado por ID asc. Incluye issues de completed/ con Completed=true. Issues con YAML malformado se omiten con warning."
tested: true
tests:
- "scan devuelve al menos 90 issues"
- "issue 0130 esta presente"
- "issues ordenados por ID asc"
- "completed issues tienen Completed=true"
- "directorio inexistente retorna error"
test_file_path: "functions/infra/scan_issues_dir_test.go"
file_path: "functions/infra/scan_issues_dir.go"
---
## Ejemplo
```go
issues, err := infra.ScanIssuesDir("/home/lucas/fn_registry/dev/issues")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Total issues: %d\n", len(issues))
for _, iss := range issues {
fmt.Printf(" %s [%s] %s\n", iss.ID, iss.Status, iss.Title)
}
```
## Cuando usarla
Al arrancar el backend de kanban_cpp para poblar la cache SQLite inicial. Tambien util para cualquier herramienta que necesite un snapshot completo de todos los issues del proyecto (stats, dashboards, fn doctor).
## Gotchas
- Skippea automaticamente `INDEX.md` y `README.md` — no son issues.
- Si `completed/` no existe (no hay issues completados), no retorna error — devuelve los issues directos.
- La ordenacion es lexicografica por ID string, no numerica. `"0099" < "0100"` funciona bien con el formato de 4 digitos del registry.
- Un issue con YAML invalido no aborta el scan entero — solo ese archivo se omite con un `log.Printf` warning. Si necesitas comportamiento strict (abort en primer error), parsea manualmente con `ParseIssueMd`.