From de4382b3456070bbdfbc4c86f456cc946f975a83 Mon Sep 17 00:00:00 2001 From: beads/refinery Date: Sun, 11 Jan 2026 10:47:14 -0800 Subject: [PATCH] bd daemon sync: 2026-01-11 10:47:14 --- .beads/issues.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 7b36ac74..72a18f75 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -1140,6 +1140,7 @@ {"id":"bd-g4b4","title":"bd close hooks: context check and notifications","description":"Add hook system to bd close for notifications and custom actions.\n\n## Scope (MVP)\n\nImplement **command hooks only** for bd close. Deferred: notify, webhook types.\n\n## Implementation\n\n### 1. Config Schema\n\nAdd to internal/configfile/config.go:\n\n```go\ntype HooksConfig struct {\n OnClose []HookEntry `yaml:\"on_close,omitempty\"`\n}\n\ntype HookEntry struct {\n Command string `yaml:\"command\"` // Shell command to run\n Name string `yaml:\"name,omitempty\"` // Optional display name\n}\n```\n\nAdd `Hooks HooksConfig` field to Config struct.\n\n### 2. Hook Execution\n\nCreate internal/hooks/close_hooks.go:\n\n```go\nfunc RunCloseHooks(ctx context.Context, cfg *configfile.Config, issue *types.Issue) error {\n for _, hook := range cfg.Hooks.OnClose {\n cmd := exec.CommandContext(ctx, \"sh\", \"-c\", hook.Command)\n cmd.Env = append(os.Environ(),\n \"BEAD_ID=\"+issue.ID,\n \"BEAD_TITLE=\"+issue.Title,\n \"BEAD_TYPE=\"+string(issue.IssueType),\n \"BEAD_PRIORITY=\"+strconv.Itoa(issue.Priority),\n \"BEAD_CLOSE_REASON=\"+issue.CloseReason,\n )\n cmd.Stdout = os.Stdout\n cmd.Stderr = os.Stderr\n if err := cmd.Run(); err \\!= nil {\n // Log warning but dont fail the close\n fmt.Fprintf(os.Stderr, \"Warning: close hook %q failed: %v\\n\", hook.Name, err)\n }\n }\n return nil\n}\n```\n\n### 3. Integration Point\n\nIn cmd/bd/close.go, after successful close:\n\n```go\n// Run close hooks\nif cfg := configfile.Load(); cfg \\!= nil {\n hooks.RunCloseHooks(ctx, cfg, closedIssue)\n}\n```\n\n### 4. Example Config\n\n```yaml\n# .beads/config.yaml\nhooks:\n on_close:\n - name: show-next\n command: bd ready --limit 1\n - name: context-check \n command: echo \"Issue $BEAD_ID closed. Check context if nearing limit.\"\n```\n\n## Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| BEAD_ID | Issue ID (e.g., bd-abc1) |\n| BEAD_TITLE | Issue title |\n| BEAD_TYPE | Issue type (task, bug, feature, etc.) |\n| BEAD_PRIORITY | Priority (0-4) |\n| BEAD_CLOSE_REASON | Close reason if provided |\n\n## Testing\n\nAdd test in internal/hooks/close_hooks_test.go:\n- Test hook execution with mock config\n- Test env vars are set correctly\n- Test hook failure doesnt block close\n\n## Files to Create/Modify\n\n1. **Create:** internal/hooks/close_hooks.go\n2. **Create:** internal/hooks/close_hooks_test.go \n3. **Modify:** internal/configfile/config.go (add HooksConfig)\n4. **Modify:** cmd/bd/close.go (call RunCloseHooks)\n5. **Modify:** docs/CONFIG.md (document hooks config)\n\n## Out of Scope (Future)\n\n- notify hook type (gt mail integration)\n- webhook type (HTTP POST)\n- on_create, on_update hooks\n- Hook timeout configuration\n- Parallel hook execution","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-12-22T17:03:56.183461-08:00","updated_at":"2025-12-23T13:38:15.898746-08:00","closed_at":"2025-12-23T13:38:15.898746-08:00","dependencies":[{"issue_id":"bd-g4b4","depends_on_id":"bd-iz5t","type":"parent-child","created_at":"2025-12-23T12:44:07.811793-08:00","created_by":"daemon"}]} {"id":"bd-g5p7","title":"Extract duplicated validation logic from CLI commands","description":"~150 lines of identical validation logic duplicated between cmd_create.go and cmd_update.go\n\nDuplication found:\n- validateBeadFields(): 2 identical copies (50+ lines each) \n- parseTimeWithDefault(): 2 identical copies (30 lines each)\n- Flag definitions: 15+ duplicate registrations\n\nSolution: Extract to shared packages:\n- internal/validation/bead.go - Centralized validation\n- internal/utils/time.go - Consolidate time parsing (already exists)\n- cmd/bd/flags.go - Shared flag registration\n\nImpact: Changes require touching 2+ files; high risk of inconsistency; steep learning curve\n\nEffort: 4-6 hours","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-16T14:51:10.159953-08:00","updated_at":"2025-11-21T10:01:44.281231-05:00","closed_at":"2025-11-20T20:39:34.426726-05:00"} {"id":"bd-g5q9","title":"Session ended: gt-beads-crew-emma","status":"closed","priority":2,"issue_type":"event","created_at":"2026-01-07T17:31:24.24289-08:00","created_by":"beads/crew/emma","updated_at":"2026-01-07T17:31:24.27373-08:00","closed_at":"2026-01-07T17:31:24.27373-08:00","close_reason":"auto-closed session event"} +{"id":"bd-g68fw","title":"Session ended: gt-beads-refinery","status":"closed","priority":2,"issue_type":"event","owner":"steve.yegge@gmail.com","created_at":"2026-01-11T10:47:13.883254-08:00","created_by":"beads/refinery","updated_at":"2026-01-11T10:47:13.944406-08:00","closed_at":"2026-01-11T10:47:13.944406-08:00","close_reason":"auto-closed session cost wisp","ephemeral":true} {"id":"bd-g6m5","title":"Code smell: Mixed daemon/direct mode logic throughout commands","description":"Most commands duplicate logic for both daemon and direct modes:\n\n```go\nif daemonClient != nil {\n // Daemon implementation\n} else {\n // Direct implementation\n}\n```\n\nThis pattern appears multiple times within the same function in show.go, list.go, and other commands.\n\n**Problem:**\n- Doubles the code paths to test\n- Changes to data retrieval require updates in two places\n- Difficult to reason about behavior\n\n**Acceptance Criteria:**\n- [ ] Create StorageAccessor interface for both modes\n- [ ] Use strategy pattern for daemon vs direct operations\n- [ ] Centralize dispatching logic\n- [ ] Reduce code duplication\n- [ ] Tests pass","status":"hooked","priority":3,"issue_type":"chore","created_at":"2025-12-28T18:59:31.571393-08:00","created_by":"beads/crew/dave","updated_at":"2025-12-30T15:44:43.359727-08:00","dependencies":[{"issue_id":"bd-g6m5","depends_on_id":"bd-ox1o","type":"blocks","created_at":"2025-12-28T19:00:23.716024-08:00","created_by":"daemon"}]} {"id":"bd-g7ay","title":"Merge: obsidian-mjwn3dvc","description":"branch: polecat/obsidian-mjwn3dvc\ntarget: main\nsource_issue: obsidian-mjwn3dvc\nrig: beads","status":"closed","priority":2,"issue_type":"merge-request","created_at":"2026-01-02T02:03:39.189973-08:00","created_by":"mayor","updated_at":"2026-01-02T13:41:56.629738-08:00","closed_at":"2026-01-02T13:41:56.629738-08:00","close_reason":"Branches merged, cleaning up stale MR beads"} {"id":"bd-g7eq","title":"Agent beads: structured labels for filtering","description":"## Agent Beads Need Queryable Labels\n\nCurrently agent beads have role_type/rig in description text, not as labels. This breaks @group resolution in gt mail.\n\n## Current State\n\n```json\n{\n \"id\": \"gt-gastown-witness\",\n \"issue_type\": \"agent\",\n \"description\": \"...\\\\nrole_type: witness\\\\nrig: gastown\\\\n...\"\n}\n```\n\nCannot query: `bd list --type=agent --label=role_type:witness` returns nothing.\n\n## Required\n\nAgent bead creation should add labels:\n- `role_type:\u003ctype\u003e` (witness, refinery, crew, polecat, dog, mayor, deacon)\n- `rig:\u003crig\u003e` (gastown, beads, or \"town\" for town-level)\n\n## Where to Fix\n\ngt polecat/crew/agent creation commands should add labels:\n```bash\nbd create --type=agent ... --labels=\"role_type:witness,rig:gastown\"\n```\n\n## Queries Enabled\n\n```bash\nbd list --type=agent --label=role_type:witness # All witnesses\nbd list --type=agent --label=rig:gastown # All gastown agents\nbd list --type=agent --label=role_type:dog # All dogs\n```\n\n## Acceptance\n- New agent beads created with role_type/rig labels\n- Existing agent beads backfilled (one-time script)\n- @group patterns work in gt mail router","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-29T20:47:33.950733-08:00","created_by":"gastown/crew/joe","updated_at":"2025-12-29T21:16:00.746383-08:00","closed_at":"2025-12-29T21:16:00.746383-08:00","close_reason":"Implemented: role_type/rig labels for agent beads, auto-labeling on create/update, backfill command"}