Skip to content

feat: make context optional#23

Open
jhult wants to merge 1 commit into
neul-labs:mainfrom
jhult:feat/optional-context
Open

feat: make context optional#23
jhult wants to merge 1 commit into
neul-labs:mainfrom
jhult:feat/optional-context

Conversation

@jhult
Copy link
Copy Markdown
Contributor

@jhult jhult commented May 14, 2026

Summary

Makes the context store feature optional via Cargo feature flags. Context—grite's distributed file/symbol index that AI agents can query to understand project structure—is still enabled by default, but can now be disabled at compile time to reduce binary size and compilation time by excluding tree-sitter and language grammar dependencies.

Changes

Features

  • Added context feature flag to grite, libgrite-cli, libgrite-core, and libgrite-git crates
  • Made all tree-sitter dependencies optional (12 crates: tree-sitter, streaming-iterator, and 10 language grammars)
  • Context remains enabled by default for backwards compatibility

Refactoring

  • Added #[cfg(feature = "context")] guards to context-related CLI commands, types, store methods, event handlers, and tests
  • Updated libgrite-ipc to use default-features = false for libgrite-core

Files Changed

Type Files
Modified 19

Key files:

  • crates/libgrite-core/Cargo.toml - Feature flag definition with optional tree-sitter deps
  • crates/libgrite-core/src/store/mod.rs - Conditional context store fields and methods
  • crates/grite/src/cli.rs - Conditional context subcommand
  • crates/libgrite-cli/src/types.rs - Conditional context option/result types

Test Plan

  • cargo test - Context tests run with default features enabled
  • cargo test --no-default-features - Tests compile and pass without context feature
  • cargo check --no-default-features - All crates compile successfully without context
  • cargo build - Binary builds with context enabled by default
  • cargo build --no-default-features - Binary builds successfully without context

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.

1 participant