Files
fn_registry/functions/infra/write_issue_md.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

2.5 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path
write_issue_md function go infra 0.1.0 impure func WriteIssueMd(path string, iss Issue, body []byte) error Serializa el frontmatter de un struct Issue a YAML y escribe el archivo Markdown en disco con formato ---\nyaml---\nbody. Preserva el body exactamente sin normalizar trailing newlines ni reordenar. Los campos de runtime (FilePath, MtimeNs, Completed) se omiten del YAML via yaml:"-".
issue
writer
frontmatter
yaml
dev-ux
kanban
issue_go_infra
false error_go_core
bytes
fmt
os
gopkg.in/yaml.v3
name desc
path Ruta de destino del archivo .md (puede ser la misma de la que se leyo para un update in-place)
name desc
iss Struct Issue con el frontmatter a serializar. FilePath/MtimeNs/Completed se ignoran en el YAML de salida
name desc
body Body MD tal como fue devuelto por ParseIssueMd — se escribe byte a byte sin modificar
nil en exito, error si el marshal YAML falla o el archivo no se puede escribir true
round-trip parse-write-parse preserva struct
archivo resultante empieza con ---
error en path inexistente
functions/infra/write_issue_md_test.go functions/infra/write_issue_md.go

Ejemplo

// Actualizar status de un issue in-place
iss, body, err := infra.ParseIssueMd("dev/issues/0130-kanban-cpp-v2.md")
if err != nil { log.Fatal(err) }

iss.Status = "in-progress"
iss.Updated = "2026-05-22"

if err := infra.WriteIssueMd("dev/issues/0130-kanban-cpp-v2.md", iss, body); err != nil {
    log.Fatal(err)
}

Cuando usarla

Cuando el backend de kanban_cpp necesite actualizar el frontmatter de un issue (cambio de status, priority, tags, etc.) sin tocar el body. Siempre usar en par con parse_issue_md_go_infra: parse → modificar struct → write.

Gotchas

  • yaml.Marshal de v3 puede reordenar campos respecto al original — el orden del YAML de salida sera el orden de declaracion del struct Issue, no el del archivo original. Si el orden importa para diff legibilidad, documentarlo.
  • El body se escribe byte a byte. Si lo modificas antes de pasar, lo que escribes es lo que queda.
  • No hace backup previo. En sistemas con watcher activo, el write dispara un evento write en watch_dir_fsnotify_go_infra — el backend debe ignorar sus propios writes para no entrar en loop.