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>
34 lines
857 B
Go
34 lines
857 B
Go
package infra
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"os"
|
|
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
// WriteIssueMd serializa el frontmatter del Issue a YAML y lo escribe en path junto al body.
|
|
// El archivo resultante tiene formato: "---\n<yaml>---\n<body>".
|
|
// El body se preserva exactamente tal como fue recibido (sin normalizar trailing newlines).
|
|
// Los campos de runtime (FilePath, MtimeNs, Completed) se omiten del YAML via yaml:"-".
|
|
func WriteIssueMd(path string, iss Issue, body []byte) error {
|
|
var buf bytes.Buffer
|
|
|
|
yamlBytes, err := yaml.Marshal(iss)
|
|
if err != nil {
|
|
return fmt.Errorf("write_issue_md: marshal %s: %w", path, err)
|
|
}
|
|
|
|
buf.WriteString("---\n")
|
|
buf.Write(yamlBytes)
|
|
buf.WriteString("---\n")
|
|
buf.Write(body)
|
|
|
|
if err := os.WriteFile(path, buf.Bytes(), 0644); err != nil {
|
|
return fmt.Errorf("write_issue_md: write %s: %w", path, err)
|
|
}
|
|
|
|
return nil
|
|
}
|