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 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/dennis
2026-01-16 14:49:44 -08:00
committed by Steve Yegge
parent d3606c8c46
commit 95cb58e36f

View File

@@ -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)