Skip to content

[FEATURE] Age-based filtering: surface only repos dirty/unpushed for longer than N days #45

Description

@nilp0inter

What problem does this solve?

The signal-to-noise problem when scanning all your repos: any project you are actively working on is almost always dirty or ahead of upstream. That state is normal, expected, and not actionable. The repos you actually want to be warned about are the ones you touched, left dirty/unpushed, and then forgot — which is precisely the README's "Find old repos you forgot to commit/push" and "know which repos still have unpushed commits before you leave for the day" use cases.

Today the only filters are state-based (dirty|uncommitted|unpushed|...). So a daily or login-time reposcan run buries the one genuinely-forgotten repo among a dozen actively-edited ones, and you quickly learn to ignore the output — which defeats the purpose of running it on a schedule.

Concrete motivation: I want to wire reposcan into a shell login hook / periodic notification, but only want it to speak up about repos that have been sitting dirty or unpushed for more than, say, a week. There is currently no way to express "old and dirty".

Proposed solution

Add an age dimension based on how long the repo has been in its current at-risk state:

  • Add LastModified time.Time (JSON lastModified) to report.RepoState. Cheapest network-free signals: newest mtime among git status --porcelain entries for the uncommitted case, and git log -1 --format=%cI (tip commit date) for the unpushed case.
  • Add a --stale-days N flag (config staleDays) that, when > 0, keeps only repos whose relevant state is older than N days.
  • Compose with --filter: e.g. reposcan -f uncommitted --stale-days 7 = "uncommitted changes I haven't touched in a week", reposcan -f unpushed --stale-days 14 = "commits I've been sitting on for two weeks".

This turns reposcan from "list everything dirty right now" into "list what I've forgotten", which is the higher-value framing for automation (cron, login hooks, status bars) and keeps always-dirty active projects quiet.

Additional context

The exact semantics of "age" per state are a design choice (mtime vs commit date vs reflog) — happy to discuss the approach in the issue before coding. Glad to write the PR (report field + flag/config + filter composition + tests) if you'd take it.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions