feat(doctor): make stale closed issues check configurable (#1291)

Add stale_closed_issues_days config option to metadata.json:
- 0 (default): Check disabled - repos keep unlimited beads
- >0: Enable check with specified day threshold

Design philosophy: Time-based cleanup is a crude proxy for the real
concern (database size). Disabled by default since a repo with 100
closed issues from 5 years ago doesn't need cleanup.

Also adds a warning when check is disabled but database has >10,000
closed issues, recommending users enable the threshold.

Co-Authored-By: SageOx <ox@sageox.ai>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
This commit is contained in:
Ryan
2026-01-25 16:56:33 -08:00
committed by GitHub
parent 1423bdc5fb
commit 27d6a8c2da
3 changed files with 97 additions and 17 deletions

View File

@@ -18,7 +18,7 @@ type Config struct {
// Deletions configuration
DeletionsRetentionDays int `json:"deletions_retention_days,omitempty"` // 0 means use default (3 days)
// Dolt server mode configuration (bd-dolt.2.2)
// Dolt server mode configuration (bd-dolt.2.2)
// When Mode is "server", connects to external dolt sql-server instead of embedded.
// This enables multi-writer access for multi-agent environments.
DoltMode string `json:"dolt_mode,omitempty"` // "embedded" (default) or "server"
@@ -27,6 +27,10 @@ type Config struct {
DoltServerUser string `json:"dolt_server_user,omitempty"` // MySQL user (default: root)
// Note: Password should be set via BEADS_DOLT_PASSWORD env var for security
// Stale closed issues check configuration
// 0 = disabled (default), positive = threshold in days
StaleClosedIssuesDays int `json:"stale_closed_issues_days,omitempty"`
// Deprecated: LastBdVersion is no longer used for version tracking.
// Version is now stored in .local_version (gitignored) to prevent
// upgrade notifications firing after git operations reset metadata.json.
@@ -152,6 +156,15 @@ func (c *Config) GetDeletionsRetentionDays() int {
return c.DeletionsRetentionDays
}
// GetStaleClosedIssuesDays returns the configured threshold for stale closed issues.
// Returns 0 if disabled (the default), or a positive value if enabled.
func (c *Config) GetStaleClosedIssuesDays() int {
if c.StaleClosedIssuesDays < 0 {
return 0
}
return c.StaleClosedIssuesDays
}
// Backend constants
const (
BackendSQLite = "sqlite"