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>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package infra
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ScanIssuesDir escanea el directorio root (dev/issues/) y devuelve todos los Issues
|
||||
// encontrados en *.md directos y en completed/*.md.
|
||||
// Si un archivo falla al parsearse, se emite un warning al log y se continua.
|
||||
// Los issues se devuelven ordenados por ID ascendente.
|
||||
func ScanIssuesDir(root string) ([]Issue, error) {
|
||||
// Verificar que el directorio raiz existe.
|
||||
if _, err := os.Stat(root); err != nil {
|
||||
return nil, fmt.Errorf("scan_issues_dir: root dir %s: %w", root, err)
|
||||
}
|
||||
|
||||
var issues []Issue
|
||||
|
||||
// Patterns a escanear: archivos directos y completed/
|
||||
patterns := []string{
|
||||
filepath.Join(root, "*.md"),
|
||||
filepath.Join(root, "completed", "*.md"),
|
||||
}
|
||||
|
||||
for _, pattern := range patterns {
|
||||
matches, err := filepath.Glob(pattern)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("scan_issues_dir: glob %s: %w", pattern, err)
|
||||
}
|
||||
|
||||
for _, path := range matches {
|
||||
// Saltar INDEX.md y README.md
|
||||
base := filepath.Base(path)
|
||||
if strings.EqualFold(base, "INDEX.md") || strings.EqualFold(base, "README.md") {
|
||||
continue
|
||||
}
|
||||
// Verificar que es un archivo regular
|
||||
info, err := os.Stat(path)
|
||||
if err != nil || !info.Mode().IsRegular() {
|
||||
continue
|
||||
}
|
||||
|
||||
iss, _, err := ParseIssueMd(path)
|
||||
if err != nil {
|
||||
log.Printf("scan_issues_dir: warning: skip %s: %v", path, err)
|
||||
continue
|
||||
}
|
||||
issues = append(issues, iss)
|
||||
}
|
||||
}
|
||||
|
||||
sort.Slice(issues, func(i, j int) bool {
|
||||
return issues[i].ID < issues[j].ID
|
||||
})
|
||||
|
||||
return issues, nil
|
||||
}
|
||||
Reference in New Issue
Block a user