Skip to content

Add configurable discovery cache directory#128

Merged
thejchap merged 4 commits into
thejchap:mainfrom
sarvesh1327:feat/cache-dir-override-main
May 21, 2026
Merged

Add configurable discovery cache directory#128
thejchap merged 4 commits into
thejchap:mainfrom
sarvesh1327:feat/cache-dir-override-main

Conversation

@sarvesh1327
Copy link
Copy Markdown
Contributor

Context

Closes #76.

Changes

  • Add a global --cache-dir flag and top-level [tool.tryke] cache_dir config option.
  • Resolve cache directory precedence as CLI override > config > existing <project-root>/.tryke/cache default.
  • Thread the resolved cache directory through test discovery, changed/changed-first, watch, server, and graph paths.
  • Store custom cache data as <cache-dir>/discovery-v1.bin and use narrow custom-cache .gitignore entries so user-provided directories are not broadly ignored.
  • Document the new config/CLI surface and add regression coverage.

Test plan

  • cargo fmt --all --check
  • cargo test -p tryke_config cache_dir -- --nocapture
  • cargo test -p tryke cli::tests:: -- --nocapture
  • cargo test -p tryke_discovery custom_cache_dir -- --nocapture
  • cargo test -p tryke_discovery configured_cache_dir -- --nocapture
  • cargo test -p tryke_discovery cache::tests::default_cache_writes_broad_gitignore_in_state_dir -- --nocapture
  • cargo test -p tryke_discovery cache::tests::custom_cache_dir_writes_narrow_gitignore -- --nocapture
  • uv run cargo test --workspace --all-features
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • uvx prek run -a

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-dir flag and cache_dir config 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 .gitignore rules 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.

Comment thread docs/guides/configuration.md
Comment thread crates/tryke_discovery/src/cache.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/tryke_discovery/src/cache.rs Outdated
@thejchap
Copy link
Copy Markdown
Owner

@sarvesh1327 thank you!

@thejchap thejchap merged commit 359b11d into thejchap:main May 21, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--cache-dir cli flag

3 participants