From 95cb58e36f44eeeff162ad136c61d43bff8394c9 Mon Sep 17 00:00:00 2001 From: gastown/crew/dennis Date: Fri, 16 Jan 2026 14:49:44 -0800 Subject: [PATCH] fix(beads): ensure directory exists before writing routes.jsonl WriteRoutes() would fail if the beads directory didn't exist yet. Add os.MkdirAll before creating the routes file. Fixes #552 Co-Authored-By: Claude Opus 4.5 --- internal/beads/routes.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/beads/routes.go b/internal/beads/routes.go index cf67d7f6..54447fa1 100644 --- a/internal/beads/routes.go +++ b/internal/beads/routes.go @@ -113,6 +113,11 @@ func RemoveRoute(townRoot string, prefix string) error { // WriteRoutes writes routes to routes.jsonl, overwriting existing content. func WriteRoutes(beadsDir string, routes []Route) error { + // Ensure beads directory exists + if err := os.MkdirAll(beadsDir, 0755); err != nil { + return fmt.Errorf("creating beads directory: %w", err) + } + routesPath := filepath.Join(beadsDir, RoutesFileName) file, err := os.Create(routesPath)