Implement bd stale command (bd-c01f, closes #184)

- Add bd stale command to find abandoned/forgotten issues
- Support --days (default 30), --status, --limit, --json flags
- Implement GetStaleIssues in SQLite and Memory storage
- Add full RPC/daemon support
- Comprehensive test suite (6 tests, all passing)
- Update AGENTS.md documentation

Resolves GitHub issue #184

Amp-Thread-ID: https://ampcode.com/threads/T-f021ddb8-54e3-41bf-ba7a-071749663c1d
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-31 23:03:48 -07:00
parent 645af0b72d
commit cc7918daf4
12 changed files with 721 additions and 1 deletions

View File

@@ -731,6 +731,37 @@ func (m *MemoryStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*type
return nil, nil
}
func (m *MemoryStorage) GetStaleIssues(ctx context.Context, filter types.StaleFilter) ([]*types.Issue, error) {
m.mu.RLock()
defer m.mu.RUnlock()
cutoff := time.Now().AddDate(0, 0, -filter.Days)
var stale []*types.Issue
for _, issue := range m.issues {
if issue.Status == types.StatusClosed {
continue
}
if filter.Status != "" && string(issue.Status) != filter.Status {
continue
}
if issue.UpdatedAt.Before(cutoff) {
stale = append(stale, issue)
}
}
// Sort by updated_at ascending (oldest first)
sort.Slice(stale, func(i, j int) bool {
return stale[i].UpdatedAt.Before(stale[j].UpdatedAt)
})
if filter.Limit > 0 && len(stale) > filter.Limit {
stale = stale[:filter.Limit]
}
return stale, nil
}
func (m *MemoryStorage) AddComment(ctx context.Context, issueID, actor, comment string) error {
return nil
}