a3f75d61ec
Reorganizacion de dev/issues en subcarpetas (completed/, cpp/, gamedev/, kanban/, trading/, imagegen/, matrix/) y cambios acumulados en cmd/fn/pyrunner, .claude/commands y settings. Trabajo de otro LLM/sesion, commiteado a peticion del usuario para desbloquear el working tree. Excluido logs/ardour_mcp_server.log (ruido).
71 lines
2.5 KiB
Markdown
71 lines
2.5 KiB
Markdown
---
|
|
id: 0130a
|
|
title: 'Funciones registry: parser MD + scan dirs + writer + watcher'
|
|
status: pendiente
|
|
type: infra
|
|
domain:
|
|
- registry-quality
|
|
- dev-ux
|
|
scope: registry-only
|
|
priority: alta
|
|
depends: []
|
|
blocks:
|
|
- 0130b
|
|
related:
|
|
- "0130"
|
|
tags: [registry, go, parser, frontmatter, fsnotify, ausente-ready]
|
|
flow: "0130"
|
|
created: "2026-05-22"
|
|
updated: "2026-05-22"
|
|
---
|
|
|
|
# 0130a — Funciones registry para kanban_cpp v2
|
|
|
|
**Status:** pendiente
|
|
|
|
## Por que
|
|
|
|
El backend de kanban_cpp v2 necesita parsear/escribir frontmatter YAML de los `.md` de `dev/issues/` y `dev/flows/`. Estas piezas son reusables (cualquier app del registry puede operar sobre issues/flows), asi que viven en el registry, no en el backend de la app.
|
|
|
|
## Funciones a crear (delegar a fn-constructor en paralelo)
|
|
|
|
| ID | Firma | Pureza |
|
|
|---|---|---|
|
|
| `parse_issue_md_go_infra` | `(path string) (Issue, []byte body, error)` | impure (FS) |
|
|
| `write_issue_md_go_infra` | `(path string, issue Issue, body []byte) error` | impure (FS) |
|
|
| `scan_issues_dir_go_infra` | `(root string) ([]Issue, error)` | impure (FS) |
|
|
| `scan_flows_dir_go_infra` | `(root string) ([]Flow, error)` | impure (FS) |
|
|
| `watch_dir_fsnotify_go_infra` | `(ctx, root) (<-chan FsEvent, error)` | impure (FS, async) |
|
|
|
|
Tipos:
|
|
- `Issue_go_infra` — struct con campos del frontmatter (id, title, status, type, domain, scope, priority, depends, blocks, related, flow, tags, created, updated, file_path, mtime_ns).
|
|
- `Flow_go_infra` — struct equivalente para flows.
|
|
- `FsEvent_go_infra` — `{path, op}` con `op in {create, write, remove, rename}`.
|
|
|
|
## Notas de implementacion
|
|
|
|
- Usar `gopkg.in/yaml.v3` para parsing (preserva orden de keys via `yaml.Node`).
|
|
- Writer DEBE preservar:
|
|
- Orden de campos del frontmatter original.
|
|
- Body MD intacto (todo lo que va despues del segundo `---`).
|
|
- Comentarios YAML (libre, best-effort).
|
|
- `parse_issue_md` debe ser tolerante: si falta un campo opcional, default empty.
|
|
- `watch_dir_fsnotify` recursivo, debounce 200ms.
|
|
|
|
## DoD
|
|
|
|
- 5 pares `.go` + `.md` en `functions/infra/`.
|
|
- Tests unitarios:
|
|
- parse → write → parse round-trip preserva struct.
|
|
- scan_issues_dir devuelve >=90 issues actuales.
|
|
- watcher detecta creacion + modificacion + borrado.
|
|
- `fn index` registra los 5 IDs + 3 tipos.
|
|
- `fn doctor uses-functions` limpio.
|
|
|
|
## Anti-scope
|
|
|
|
NO incluye en esta tanda:
|
|
- Markdown rendering del body (eso lo hace el frontend si quiere).
|
|
- Validacion contra TAXONOMY (existe `fn doctor issues`).
|
|
- CRUD de issues nuevos (write_issue cubre el caso, pero crear file = scope del backend).
|