bd sync: 2025-11-26 20:33:12
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
{"id":"bd-mnap","title":"Investigate performance issues in VS Code Copilot (Windows)","description":"Beads unusable in Windows 11 VS Code Copilot chat with Sonnet 4.5.\nSummary event happens every 3-4 turns, taking 3 minutes.\nCopilot summarizes after ~125k tokens despite model supporting 1M.\nLarge context size of beads might be triggering aggressive summarization.\nNeed workaround or optimization for context size.\n","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:56:30.124918-05:00","updated_at":"2025-11-20T18:56:30.124918-05:00"}
|
||||
{"id":"bd-nq41","title":"Fix Homebrew warning about Ruby file location","description":"Homebrew warning: Found Ruby file outside steveyegge/beads tap formula directory.\nWarning points to: /opt/homebrew/Library/Taps/steveyegge/homebrew-beads/bd.rb\nIt should likely be inside a Formula/ directory or similar structure expected by Homebrew taps.\n","status":"open","priority":2,"issue_type":"chore","created_at":"2025-11-20T18:56:21.226579-05:00","updated_at":"2025-11-20T18:56:21.226579-05:00"}
|
||||
{"id":"bd-p6vp","title":"Clarify .beads/.gitattributes handling in Protected Branches docs","description":"Protected Branches docs quick start leaves untracked `.beads` directory and `.gitattributes`.\nQuestion: Are these changes meant to be checked into the protected branch?\nNeed to clarify if these should be ignored or committed, or if the instructions are missing a step.\n","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:56:25.79407-05:00","updated_at":"2025-11-20T18:56:25.79407-05:00"}
|
||||
{"id":"bd-pbj","title":"bd doctor --fix should run bd sync to commit untracked deletions.jsonl","description":"After running bd cleanup -f, the deletions.jsonl file is created but left untracked. bd doctor --fix should notice this and run bd sync to commit it.\n\nCurrent behavior:\n- bd cleanup -f creates/updates deletions.jsonl\n- git status shows deletions.jsonl as untracked\n- bd doctor --fix does not notice or fix this\n\nExpected behavior:\n- bd doctor --fix should detect untracked .beads/*.jsonl files\n- Should offer to run bd sync to commit them\n\nRelated: The git hooks were also missing deletions.jsonl from their staging loops - that's been fixed in this session.","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-26T20:29:33.901199-08:00","updated_at":"2025-11-26T20:29:33.901199-08:00"}
|
||||
{"id":"bd-pbj","title":"bd doctor --fix should run bd sync to commit untracked deletions.jsonl","description":"After running bd cleanup -f, the deletions.jsonl file is created but left untracked. bd doctor --fix should notice this and run bd sync to commit it.\n\nCurrent behavior:\n- bd cleanup -f creates/updates deletions.jsonl\n- git status shows deletions.jsonl as untracked\n- bd doctor --fix does not notice or fix this\n\nExpected behavior:\n- bd doctor --fix should detect untracked .beads/*.jsonl files\n- Should offer to run bd sync to commit them\n\nRelated: The git hooks were also missing deletions.jsonl from their staging loops - that's been fixed in this session.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-26T20:29:33.901199-08:00","updated_at":"2025-11-26T20:33:03.296592-08:00","closed_at":"2025-11-26T20:33:03.296592-08:00"}
|
||||
{"id":"bd-qsm","title":"Auto-compact deletions during bd sync","description":"Parent: bd-imj\n\n## Task\nOptionally prune deletions manifest during sync when threshold exceeded.\n\n**Note: Opt-in feature** - disabled by default to avoid sync latency.\n\n## Implementation\n\nIn `bd sync`:\n```go\nfunc (s *Syncer) Sync() error {\n // ... existing sync logic ...\n \n // Auto-compact only if enabled\n if s.config.GetBool(\"deletions.auto_compact\", false) {\n deletionCount := deletions.Count(\".beads/deletions.jsonl\")\n threshold := s.config.GetInt(\"deletions.auto_compact_threshold\", 1000)\n \n if deletionCount \u003e threshold {\n retentionDays := s.config.GetInt(\"deletions.retention_days\", 7)\n if err := s.compactor.PruneDeletions(retentionDays); err != nil {\n log.Warnf(\"Failed to auto-compact deletions: %v\", err)\n // Non-fatal, continue sync\n }\n }\n }\n \n // ... rest of sync ...\n}\n```\n\n## Configuration\n```yaml\ndeletions:\n retention_days: 7\n auto_compact: false # Opt-in, disabled by default\n auto_compact_threshold: 1000 # Trigger when \u003e N entries (if enabled)\n```\n\n## Acceptance Criteria\n- [ ] Auto-compact disabled by default\n- [ ] Enabled via config `deletions.auto_compact: true`\n- [ ] Sync checks deletion count only when enabled\n- [ ] Auto-prunes when threshold exceeded\n- [ ] Failure is non-fatal (logged warning)\n- [ ] Test: no compaction when disabled\n- [ ] Test: compaction triggers when enabled and threshold exceeded","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-25T09:57:04.522795-08:00","updated_at":"2025-11-25T15:03:01.469629-08:00","closed_at":"2025-11-25T15:03:01.469629-08:00"}
|
||||
{"id":"bd-s0z","title":"Consider extracting error handling helpers","description":"Evaluate creating FatalError() and WarnError() helpers as suggested in ERROR_HANDLING.md to reduce boilerplate and enforce consistency. Prototype in a few files first to validate the approach.","status":"open","priority":4,"issue_type":"task","created_at":"2025-11-24T00:28:57.248959-08:00","updated_at":"2025-11-24T00:28:57.248959-08:00"}
|
||||
{"id":"bd-t3b","title":"Add test coverage for internal/config package","description":"","design":"Config package has 1 test file. Need comprehensive tests. Target: 70% coverage","acceptance_criteria":"- At least 3 test files\n- Package coverage \u003e= 70%","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:22.91657-05:00","updated_at":"2025-11-20T21:21:22.91657-05:00","dependencies":[{"issue_id":"bd-t3b","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.201036-05:00","created_by":"daemon"}]}
|
||||
|
||||
@@ -212,6 +212,8 @@ func applyFixes(result doctorResult) {
|
||||
err = fix.DatabaseConfig(result.Path)
|
||||
case "Deletions Manifest":
|
||||
err = fix.HydrateDeletionsManifest(result.Path)
|
||||
case "Untracked Files":
|
||||
err = fix.UntrackedJSONL(result.Path)
|
||||
default:
|
||||
fmt.Printf(" ⚠ No automatic fix available for %s\n", check.Name)
|
||||
fmt.Printf(" Manual fix: %s\n", check.Fix)
|
||||
@@ -567,6 +569,11 @@ func runDiagnostics(path string) doctorResult {
|
||||
result.Checks = append(result.Checks, deletionsCheck)
|
||||
// Don't fail overall check for missing deletions manifest, just warn
|
||||
|
||||
// Check 19: Untracked .beads/*.jsonl files (bd-pbj)
|
||||
untrackedCheck := checkUntrackedBeadsFiles(path)
|
||||
result.Checks = append(result.Checks, untrackedCheck)
|
||||
// Don't fail overall check for untracked files, just warn
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -2123,6 +2130,77 @@ func checkDeletionsManifest(path string) doctorCheck {
|
||||
}
|
||||
}
|
||||
|
||||
// checkUntrackedBeadsFiles checks for untracked .beads/*.jsonl files that should be committed.
|
||||
// This catches deletions.jsonl created by bd cleanup -f that hasn't been committed yet. (bd-pbj)
|
||||
func checkUntrackedBeadsFiles(path string) doctorCheck {
|
||||
beadsDir := filepath.Join(path, ".beads")
|
||||
|
||||
// Skip if .beads doesn't exist
|
||||
if _, err := os.Stat(beadsDir); os.IsNotExist(err) {
|
||||
return doctorCheck{
|
||||
Name: "Untracked Files",
|
||||
Status: statusOK,
|
||||
Message: "N/A (no .beads directory)",
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we're in a git repository
|
||||
gitDir := filepath.Join(path, ".git")
|
||||
if _, err := os.Stat(gitDir); os.IsNotExist(err) {
|
||||
return doctorCheck{
|
||||
Name: "Untracked Files",
|
||||
Status: statusOK,
|
||||
Message: "N/A (not a git repository)",
|
||||
}
|
||||
}
|
||||
|
||||
// Run git status --porcelain to find untracked files in .beads/
|
||||
cmd := exec.Command("git", "status", "--porcelain", ".beads/")
|
||||
cmd.Dir = path
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return doctorCheck{
|
||||
Name: "Untracked Files",
|
||||
Status: statusWarning,
|
||||
Message: "Unable to check git status",
|
||||
Detail: err.Error(),
|
||||
}
|
||||
}
|
||||
|
||||
// Parse output for untracked JSONL files (lines starting with "??")
|
||||
var untrackedJSONL []string
|
||||
for _, line := range strings.Split(string(output), "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
// Untracked files start with "?? "
|
||||
if strings.HasPrefix(line, "?? ") {
|
||||
file := strings.TrimPrefix(line, "?? ")
|
||||
// Only care about .jsonl files
|
||||
if strings.HasSuffix(file, ".jsonl") {
|
||||
untrackedJSONL = append(untrackedJSONL, filepath.Base(file))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(untrackedJSONL) == 0 {
|
||||
return doctorCheck{
|
||||
Name: "Untracked Files",
|
||||
Status: statusOK,
|
||||
Message: "All .beads/*.jsonl files are tracked",
|
||||
}
|
||||
}
|
||||
|
||||
return doctorCheck{
|
||||
Name: "Untracked Files",
|
||||
Status: statusWarning,
|
||||
Message: fmt.Sprintf("Untracked JSONL files: %s", strings.Join(untrackedJSONL, ", ")),
|
||||
Detail: "These files should be committed to propagate changes to other clones",
|
||||
Fix: "Run 'bd doctor --fix' to stage and commit untracked files, or manually: git add .beads/*.jsonl && git commit",
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(doctorCmd)
|
||||
doctorCmd.Flags().BoolVar(&perfMode, "perf", false, "Run performance diagnostics and generate CPU profile")
|
||||
|
||||
81
cmd/bd/doctor/fix/untracked.go
Normal file
81
cmd/bd/doctor/fix/untracked.go
Normal file
@@ -0,0 +1,81 @@
|
||||
package fix
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UntrackedJSONL stages and commits untracked .beads/*.jsonl files.
|
||||
// This fixes the issue where bd cleanup -f creates deletions.jsonl but
|
||||
// leaves it untracked. (bd-pbj)
|
||||
func UntrackedJSONL(path string) error {
|
||||
if err := validateBeadsWorkspace(path); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
beadsDir := filepath.Join(path, ".beads")
|
||||
|
||||
// Find untracked JSONL files
|
||||
cmd := exec.Command("git", "status", "--porcelain", ".beads/")
|
||||
cmd.Dir = path
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to check git status: %w", err)
|
||||
}
|
||||
|
||||
// Parse output for untracked JSONL files
|
||||
var untrackedFiles []string
|
||||
for _, line := range strings.Split(string(output), "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
// Untracked files start with "?? "
|
||||
if strings.HasPrefix(line, "?? ") {
|
||||
file := strings.TrimPrefix(line, "?? ")
|
||||
if strings.HasSuffix(file, ".jsonl") {
|
||||
untrackedFiles = append(untrackedFiles, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(untrackedFiles) == 0 {
|
||||
fmt.Println(" No untracked JSONL files found")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stage the untracked files
|
||||
for _, file := range untrackedFiles {
|
||||
fullPath := filepath.Join(path, file)
|
||||
// Verify file exists in .beads directory (security check)
|
||||
if !strings.HasPrefix(fullPath, beadsDir) {
|
||||
continue
|
||||
}
|
||||
if _, err := os.Stat(fullPath); os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
|
||||
addCmd := exec.Command("git", "add", file)
|
||||
addCmd.Dir = path
|
||||
if err := addCmd.Run(); err != nil {
|
||||
return fmt.Errorf("failed to stage %s: %w", file, err)
|
||||
}
|
||||
fmt.Printf(" Staged %s\n", filepath.Base(file))
|
||||
}
|
||||
|
||||
// Commit the staged files
|
||||
commitMsg := "chore(beads): commit untracked JSONL files\n\nAuto-committed by bd doctor --fix (bd-pbj)"
|
||||
commitCmd := exec.Command("git", "commit", "-m", commitMsg)
|
||||
commitCmd.Dir = path
|
||||
commitCmd.Stdout = os.Stdout
|
||||
commitCmd.Stderr = os.Stderr
|
||||
|
||||
if err := commitCmd.Run(); err != nil {
|
||||
return fmt.Errorf("failed to commit: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user