Skip to content

feat(cli): codegraph clean subcommand + auto-prune of explore cache#54

Merged
smochan merged 1 commit into
mainfrom
feat/clean-explore-cache
May 30, 2026
Merged

feat(cli): codegraph clean subcommand + auto-prune of explore cache#54
smochan merged 1 commit into
mainfrom
feat/clean-explore-cache

Conversation

@smochan

@smochan smochan commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • New module `codegraph/cache_prune.py` with LRU prune-by-mtime.
  • New `codegraph clean` subcommand: `--max-size-mb 50` (default) or `--all`.
  • `codegraph serve` auto-prunes on startup and prints current cache size.

v0.1.2 backlog item #6.

Test plan

  • 7 unit tests in `tests/test_cache_prune.py` (under-cap no-op, oldest-first eviction, empty-subdir sweep, max=0 wipe, missing dir).
  • CLI smoke: `codegraph clean --help` renders.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

codegraph PR review

Diff vs main · severity ≤ high

codegraph review (target: main)

Diff: +17 / -0 / ~0 nodes, +75 / -0 edges

Findings (0)

No findings.

Triggered by codegraph CI · last run

@smochan smochan force-pushed the feat/clean-explore-cache branch from 744e120 to c01eb76 Compare May 30, 2026 17:11
@github-actions

Copy link
Copy Markdown

codegraph PR review

Diff vs main · severity ≤ high

codegraph review (target: main)

Diff: +61 / -0 / ~0 nodes, +253 / -1 edges

Findings (0)

No findings.

Triggered by codegraph CI · last run

`codegraph serve` generated a pyvis HTML page per explored function
and never pruned them. Long-lived projects could grow
`.codegraph/explore/` to hundreds of MB.

New module `codegraph/cache_prune.py` implements LRU eviction by mtime
(oldest first). `codegraph clean --max-size-mb 50` (default) prunes
until under the cap; `--all` wipes everything. `codegraph serve` runs
the prune on startup and prints the current cache size as a dim line
so users notice if it's still growing.

v0.1.2 backlog item #6.
@smochan smochan force-pushed the feat/clean-explore-cache branch from c01eb76 to b993c1c Compare May 30, 2026 17:44
@github-actions

Copy link
Copy Markdown

codegraph PR review

Diff vs main · severity ≤ high

codegraph review (target: main)

Diff: +17 / -0 / ~0 nodes, +75 / -0 edges

Findings (0)

No findings.

Triggered by codegraph CI · last run

@smochan smochan merged commit c2eb0af into main May 30, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant