Add configurable discovery cache directory#128
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable location for Tryke’s persistent discovery cache, exposed via a new global --cache-dir CLI flag and [tool.tryke] cache_dir in pyproject.toml, and threads the resolved cache directory through discovery-driven flows (test, watch, server, graph).
Changes:
- Add global
--cache-dirflag andcache_dirconfig option with precedence CLI > config > default<project-root>/.tryke/cache. - Plumb cache directory overrides through discovery entry points (test discovery variants, watch, server, graph).
- Update cache persistence to support custom cache directories and write narrower
.gitignorerules for user-provided cache dirs; add regression tests and docs.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/reference/cli.md | Documents --cache-dir for top-level and relevant subcommands. |
| docs/guides/configuration.md | Documents [tool.tryke] cache_dir and CLI override behavior. |
| crates/tryke/src/cli.rs | Adds global --cache-dir flag and parsing tests. |
| crates/tryke/src/main.rs | Resolves cache dir and threads it through test/watch/server/graph flows. |
| crates/tryke/src/discovery.rs | Adds *_with_cache_dir discovery functions and preserves existing APIs via wrappers. |
| crates/tryke/src/watch.rs | Extends watch entrypoint to accept an optional cache dir override. |
| crates/tryke/src/graph.rs | Adds cache-dir-aware graph/fixture graph functions and wrapper compatibility. |
| crates/tryke_server/src/server.rs | Adds server support for passing an optional cache dir into discovery. |
| crates/tryke_discovery/src/discoverer.rs | Adds cache-dir-aware constructors and routes cache loading accordingly; adds tests. |
| crates/tryke_discovery/src/cache.rs | Adds cache-dir-based loading and best-effort .gitignore writing behavior; adds tests. |
| crates/tryke_config/src/lib.rs | Adds cache_dir to config, resolves relative paths, and provides precedence resolver + tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e494a8ad6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@sarvesh1327 thank you! |
Context
Closes #76.
Changes
--cache-dirflag and top-level[tool.tryke] cache_dirconfig option.<project-root>/.tryke/cachedefault.<cache-dir>/discovery-v1.binand use narrow custom-cache.gitignoreentries so user-provided directories are not broadly ignored.Test plan
cargo fmt --all --checkcargo test -p tryke_config cache_dir -- --nocapturecargo test -p tryke cli::tests:: -- --nocapturecargo test -p tryke_discovery custom_cache_dir -- --nocapturecargo test -p tryke_discovery configured_cache_dir -- --nocapturecargo test -p tryke_discovery cache::tests::default_cache_writes_broad_gitignore_in_state_dir -- --nocapturecargo test -p tryke_discovery cache::tests::custom_cache_dir_writes_narrow_gitignore -- --nocaptureuv run cargo test --workspace --all-featurescargo clippy --workspace --all-targets --all-features -- -D warningsuvx prek run -a