From 07e941a65de08e98fca0b87c1684a281ae211553 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Mon, 22 Dec 2025 15:40:07 -0800 Subject: [PATCH] bd sync: 2025-12-22 15:40:07 --- .beads/issues.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 5301de81..802c718c 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -398,7 +398,7 @@ {"id":"bd-u0sb","title":"Merge: bd-uqfn","description":"branch: polecat/cheedo\ntarget: main\nsource_issue: bd-uqfn\nrig: beads","status":"closed","priority":2,"issue_type":"merge-request","created_at":"2025-12-20T01:11:52.033964-08:00","updated_at":"2025-12-20T23:17:26.994875-08:00","closed_at":"2025-12-20T23:17:26.994875-08:00","close_reason":"Branches nuked, MRs obsolete"} {"id":"bd-u2sc","title":"GH#692: Code quality and refactoring improvements","description":"Epic for implementing refactoring suggestions from GitHub issue #692 (rsnodgrass). These are code quality improvements that don't change functionality but improve maintainability, type safety, and performance.\n\nOriginal issue: https://github.com/steveyegge/beads/issues/692\n\nHigh priority items:\n1. Replace map[string]interface{} with typed structs for JSON output\n2. Adopt slices.SortFunc instead of sort.Slice (Go 1.21+)\n3. Split large files (sync.go, init.go, show.go)\n4. Introduce slog for structured logging in daemon\n\nLower priority:\n5. Further CLI helper extraction\n6. Preallocate slices in hot paths\n7. Polish items (error wrapping, table-driven parsing)","status":"open","priority":3,"issue_type":"epic","created_at":"2025-12-22T14:26:31.630004-08:00","updated_at":"2025-12-22T14:43:08.562025-08:00","external_ref":"gh-692"} {"id":"bd-u2sc.1","title":"Replace map[string]interface{} with typed JSON response structs","description":"Many CLI commands use map[string]interface{} for JSON output which loses type safety and compile-time error detection.\n\nFiles with map[string]interface{}:\n- cmd/bd/compact.go (10+ instances)\n- cmd/bd/cleanup.go\n- cmd/bd/daemons.go\n- cmd/bd/daemon_lifecycle.go\n\nExample fix:\n```go\n// Before\nresult := map[string]interface{}{\n \"status\": \"ok\",\n \"count\": 42,\n}\n\n// After\ntype CompactResponse struct {\n Status string `json:\"status\"`\n Count int `json:\"count\"`\n}\nresult := CompactResponse{Status: \"ok\", Count: 42}\n```\n\nBenefits:\n- Compile-time type checking\n- IDE autocompletion\n- Easier refactoring\n- Self-documenting API","status":"open","priority":2,"issue_type":"task","created_at":"2025-12-22T14:26:44.088548-08:00","updated_at":"2025-12-22T14:26:44.088548-08:00","dependencies":[{"issue_id":"bd-u2sc.1","depends_on_id":"bd-u2sc","type":"parent-child","created_at":"2025-12-22T14:26:44.088931-08:00","created_by":"daemon"}]} -{"id":"bd-u2sc.2","title":"Migrate sort.Slice to slices.SortFunc","description":"Go 1.21+ provides slices.SortFunc which is cleaner and slightly faster than sort.Slice.\n\nFound 15+ instances of sort.Slice in:\n- cmd/bd/autoflush.go\n- cmd/bd/count.go\n- cmd/bd/daemon_sync.go\n- cmd/bd/doctor.go\n- cmd/bd/export.go\n- cmd/bd/import.go\n- cmd/bd/integrity.go\n- cmd/bd/jira.go\n- cmd/bd/list.go\n- cmd/bd/migrate_hash_ids.go\n- cmd/bd/rename_prefix.go\n- cmd/bd/show.go\n\nExample migration:\n```go\n// Before\nsort.Slice(issues, func(i, j int) bool {\n return issues[i].Priority \u003c issues[j].Priority\n})\n\n// After\nslices.SortFunc(issues, func(a, b *types.Issue) int {\n return cmp.Compare(a.Priority, b.Priority)\n})\n```\n\nBenefits:\n- Cleaner 3-way comparison\n- Slightly better performance\n- Modern idiomatic Go","status":"open","priority":3,"issue_type":"task","created_at":"2025-12-22T14:26:55.573524-08:00","updated_at":"2025-12-22T14:26:55.573524-08:00","dependencies":[{"issue_id":"bd-u2sc.2","depends_on_id":"bd-u2sc","type":"parent-child","created_at":"2025-12-22T14:26:55.573978-08:00","created_by":"daemon"}]} +{"id":"bd-u2sc.2","title":"Migrate sort.Slice to slices.SortFunc","description":"Go 1.21+ provides slices.SortFunc which is cleaner and slightly faster than sort.Slice.\n\nFound 15+ instances of sort.Slice in:\n- cmd/bd/autoflush.go\n- cmd/bd/count.go\n- cmd/bd/daemon_sync.go\n- cmd/bd/doctor.go\n- cmd/bd/export.go\n- cmd/bd/import.go\n- cmd/bd/integrity.go\n- cmd/bd/jira.go\n- cmd/bd/list.go\n- cmd/bd/migrate_hash_ids.go\n- cmd/bd/rename_prefix.go\n- cmd/bd/show.go\n\nExample migration:\n```go\n// Before\nsort.Slice(issues, func(i, j int) bool {\n return issues[i].Priority \u003c issues[j].Priority\n})\n\n// After\nslices.SortFunc(issues, func(a, b *types.Issue) int {\n return cmp.Compare(a.Priority, b.Priority)\n})\n```\n\nBenefits:\n- Cleaner 3-way comparison\n- Slightly better performance\n- Modern idiomatic Go","status":"closed","priority":3,"issue_type":"task","created_at":"2025-12-22T14:26:55.573524-08:00","updated_at":"2025-12-22T15:10:12.639807-08:00","closed_at":"2025-12-22T15:10:12.639807-08:00","close_reason":"Migrated all 19 instances of sort.Slice to slices.SortFunc across 17 files in cmd/bd/. Used cmp.Compare for orderable types, time.Compare for time comparisons, and cmp.Or for multi-field sorts.","dependencies":[{"issue_id":"bd-u2sc.2","depends_on_id":"bd-u2sc","type":"parent-child","created_at":"2025-12-22T14:26:55.573978-08:00","created_by":"daemon"}]} {"id":"bd-u2sc.3","title":"Split large cmd/bd files into logical modules","description":"Several cmd/bd files exceed 1000 lines and should be split for maintainability:\n\n| File | Lines | Recommendation |\n|------|-------|----------------|\n| sync.go | 2201 | Split: sync_core.go, sync_branch.go, sync_remote.go |\n| init.go | 1742 | Split: init.go, init_wizard.go, init_hooks.go |\n| show.go | 1380 | Split: show.go, show_formatters.go, show_threads.go |\n| compact.go | 1112 | Split: compact.go, compact_tiers.go |\n\nGuidelines:\n- Each file should focus on one aspect\n- Keep public API in main file\n- Move helpers/formatters to separate files\n- Consider internal/ packages for complex logic\n\nNote: This is a lower priority task - large files are inconvenient but not blocking.","status":"open","priority":3,"issue_type":"task","created_at":"2025-12-22T14:27:06.146343-08:00","updated_at":"2025-12-22T14:27:06.146343-08:00","dependencies":[{"issue_id":"bd-u2sc.3","depends_on_id":"bd-u2sc","type":"parent-child","created_at":"2025-12-22T14:27:06.146704-08:00","created_by":"daemon"}]} {"id":"bd-u2sc.4","title":"Introduce slog for structured daemon logging","description":"The daemon currently uses fmt.Fprintf for logging which produces unstructured output. Migrating to slog would provide:\n\n- Structured, parseable logs (JSON format option)\n- Log levels (debug, info, warn, error)\n- Context propagation\n- Better log aggregation\n\nFiles to update:\n- cmd/bd/daemon_logger.go\n- Debug output throughout daemon code\n\nExample:\n```go\n// Before\nfmt.Fprintf(os.Stderr, \"Warning: failed to detect user role: %v\\n\", err)\n\n// After\nslog.Warn(\"failed to detect user role\", \"error\", err)\n```\n\nThis is particularly valuable for daemon troubleshooting since daemon logs are often reviewed after the fact.","status":"open","priority":3,"issue_type":"task","created_at":"2025-12-22T14:27:16.47144-08:00","updated_at":"2025-12-22T14:27:16.47144-08:00","dependencies":[{"issue_id":"bd-u2sc.4","depends_on_id":"bd-u2sc","type":"parent-child","created_at":"2025-12-22T14:27:16.471878-08:00","created_by":"daemon"}]} {"id":"bd-umbf","title":"Design contributor namespace isolation for beads pollution prevention","description":"## Problem\n\nWhen contributors work on beads-the-project using beads-the-tool, their personal work-tracking issues leak into PRs. The .beads/issues.jsonl is intentionally tracked (it's the project's issue database), but contributors' local issues pollute the diff.\n\nThis is a recursion problem unique to self-hosting projects.\n\n## Possible Solutions to Explore\n\n1. **Contributor namespaces** - Each contributor gets a private prefix (e.g., `bd-steve-xxxx`) that's gitignored or filtered\n2. **Separate database** - Contributors use BEADS_DIR pointing elsewhere for personal tracking\n3. **Issue ownership/visibility flags** - Mark issues as \"local-only\" vs \"project\"\n4. **Prefix-based filtering** - Configure which prefixes are committed vs ignored\n\n## Design Considerations\n\n- Should be zero-friction for contributors (no manual setup)\n- Must not break existing workflows\n- Needs to work with sync/collaboration features\n- Consider: what if a \"personal\" issue graduates to \"project\" issue?\n\n## Expansion Needed\n\nThis is a placeholder. Needs detailed design exploration before implementation.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-12-13T18:00:29.638743-08:00","updated_at":"2025-12-13T18:00:41.345673-08:00"}