c468b24d2b
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>
53 lines
2.1 KiB
Markdown
53 lines
2.1 KiB
Markdown
---
|
|
name: scan_flows_dir
|
|
kind: function
|
|
lang: go
|
|
domain: infra
|
|
version: "0.1.0"
|
|
purity: impure
|
|
signature: "func ScanFlowsDir(root string) ([]Flow, error)"
|
|
description: "Escanea el directorio dev/flows/ (root) y devuelve todos los Flows encontrados en *.md directos. Skippea INDEX.md, README.md y AGENT_GUIDE.md. Si un archivo falla al parsearse emite warning y continua. Resultado ordenado por ID ascendente."
|
|
tags: [flow, scanner, frontmatter, yaml, dev-ux, kanban]
|
|
uses_functions: []
|
|
uses_types: [flow_go_infra]
|
|
returns: [flow_go_infra]
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: ["fmt", "log", "os", "path/filepath", "sort", "strings", "gopkg.in/yaml.v3"]
|
|
params:
|
|
- name: root
|
|
desc: "Ruta al directorio dev/flows/ (absoluta o relativa)."
|
|
output: "Slice de Flow ordenado por ID asc con FilePath y MtimeNs rellenados. Flows con YAML malformado se omiten con warning."
|
|
tested: true
|
|
tests:
|
|
- "scan devuelve al menos 5 flows"
|
|
- "flow 0001 esta presente"
|
|
- "flows tienen FilePath y MtimeNs"
|
|
- "flows ordenados por ID asc"
|
|
test_file_path: "functions/infra/scan_flows_dir_test.go"
|
|
file_path: "functions/infra/scan_flows_dir.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
flows, err := infra.ScanFlowsDir("/home/lucas/fn_registry/dev/flows")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Printf("Total flows: %d\n", len(flows))
|
|
for _, f := range flows {
|
|
fmt.Printf(" %s [%s] %s\n", f.ID, f.Status, f.Title)
|
|
}
|
|
```
|
|
|
|
## Cuando usarla
|
|
|
|
Al arrancar el backend de kanban_cpp para cargar el panel Flows. Tambien util para dashboards de estado del proyecto que necesiten listar flujos activos/pendientes.
|
|
|
|
## Gotchas
|
|
|
|
- El struct `Flow` tiene campos `Name` y `Title` porque algunos flows del registry usan `name:` y otros `title:` en el frontmatter. `parseFlowMd` normaliza: si `Title` esta vacio pero `Name` no, copia `Name` a `Title`.
|
|
- No tiene subdirectorio `completed/` equivalente — todos los flows activos e historicos viven en el mismo directorio raiz.
|
|
- La funcion `parseFlowMd` es interna (no exportada). Si necesitas parsear un flow individual, usa directamente `yaml.Unmarshal` o expone una funcion separada.
|