Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Commands share common arguments via `#[command(flatten)]`:
pub struct MyCmd {
pub module: String,
#[command(flatten)]
pub common: CommonArgs, // Adds --project, --regex, --limit
pub common: CommonArgs, // Adds --regex, --limit
}
```

Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ Use `code_search describe` to see detailed documentation, or `code_search descri
**Setup flags:**
- `--install-skills`: Install skill and agent templates to `.claude/` (34 skills + 1 agent)
- `--install-hooks`: Install post-commit git hook for automatic incremental updates
- `--project-name <NAME>`: Project name for git hook config (optional, used with `--install-hooks`)
- `--mix-env <ENV>`: Mix environment for git hook (used with `--install-hooks`, default: dev)
- `--force`: Overwrite existing template/hook files (preserves by default)
- `--dry-run`: Show what would be created without making changes
Expand All @@ -155,7 +154,6 @@ Most commands support these options:

- `-l, --limit <N>`: Maximum results to return (default: 100, max: 1000)
- `-r, --regex`: Treat patterns as regular expressions
- `--project <NAME>`: Filter to a specific project (default: "default")
- `--db <PATH>`: Database file path (auto-resolved if not specified)
- `-o, --format <FORMAT>`: Output format (table, json, toon)

Expand Down Expand Up @@ -232,8 +230,7 @@ The post-commit hook automatically:

**No configuration required!** The hook works out of the box. Optional configuration:
```bash
git config code-search.project-name my_app # For multi-project databases
git config code-search.mix-env test # Default: dev
git config code-search.mix-env test # Default: dev
```

See [docs/GIT_HOOKS.md](docs/GIT_HOOKS.md) for detailed documentation and troubleshooting.
Expand Down Expand Up @@ -272,5 +269,5 @@ After installation:
- Written in Rust using clap for CLI parsing
- Uses SurrealDB (RocksDB-backed) for graph queries
- Call graph data is extracted separately by [ex_ast](https://github.com/CamonZ/ex_ast)
- Supports multiple projects in the same database via `--project` flag
- One database per project (stored in `.code_search/surrealdb.rocksdb`)
- Embeds templates in binary for self-contained distribution
1 change: 0 additions & 1 deletion cli/src/commands/accepts/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ impl Execute for AcceptsCmd {
let entries = find_accepts(
db,
&self.pattern,
&self.common.project,
self.common.regex,
self.module.as_deref(),
self.common.limit,
Expand Down
2 changes: 0 additions & 2 deletions cli/src/commands/boundaries/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ impl Execute for BoundariesCmd {
db,
HotspotKind::Ratio,
self.module.as_deref(),
&self.common.project,
self.common.regex,
self.common.limit,
false,
Expand Down Expand Up @@ -89,7 +88,6 @@ mod tests {
min_ratio: 2.0,
module: None,
common: crate::commands::CommonArgs {
project: "default".to_string(),
regex: false,
limit: 50,
},
Expand Down
9 changes: 1 addition & 8 deletions cli/src/commands/browse_module/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ pub struct BrowseModuleResult {
#[serde(skip_serializing_if = "Option::is_none")]
pub kind_filter: Option<DefinitionKind>,

/// Project that was searched
pub project: String,

/// Total number of definitions found (before limit applied)
pub total_items: usize,

Expand Down Expand Up @@ -133,7 +130,6 @@ impl Execute for BrowseModuleCmd {
let funcs = find_functions_in_module(
db,
&self.module_or_file,
&self.common.project,
self.common.regex,
self.common.limit,
)?;
Expand Down Expand Up @@ -169,7 +165,6 @@ impl Execute for BrowseModuleCmd {
&self.module_or_file,
self.name.as_deref(),
None, // kind filter (optional, not used for browse)
&self.common.project,
self.common.regex,
self.common.limit,
)?;
Expand All @@ -195,7 +190,6 @@ impl Execute for BrowseModuleCmd {
&self.module_or_file,
self.name.as_deref(),
None, // kind filter (optional, not used for browse)
&self.common.project,
self.common.regex,
self.common.limit,
)?;
Expand All @@ -214,7 +208,7 @@ impl Execute for BrowseModuleCmd {

// Query structs
if should_query_structs {
let fields = find_struct_fields(db, &self.module_or_file, &self.common.project, self.common.regex, self.common.limit)?;
let fields = find_struct_fields(db, &self.module_or_file, self.common.regex, self.common.limit)?;
let structs = group_fields_into_structs(fields);

for struct_def in structs {
Expand Down Expand Up @@ -248,7 +242,6 @@ impl Execute for BrowseModuleCmd {
Ok(BrowseModuleResult {
search_term: self.module_or_file,
kind_filter: self.kind,
project: self.common.project,
total_items,
definitions,
})
Expand Down
12 changes: 0 additions & 12 deletions cli/src/commands/browse_module/execute_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ mod tests {
crate::shared_fixture! {
fixture_name: call_graph_db,
fixture_type: call_graph,
project: "test_project",
}

crate::shared_fixture! {
fixture_name: structs_db,
fixture_type: structs,
project: "test_project",
}

// =========================================================================
Expand All @@ -35,7 +33,6 @@ mod tests {
kind: Some(DefinitionKind::Functions),
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand All @@ -59,7 +56,6 @@ mod tests {
kind: Some(DefinitionKind::Functions),
name: Some("get_user".to_string()),
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand Down Expand Up @@ -87,7 +83,6 @@ mod tests {
kind: Some(DefinitionKind::Specs),
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand Down Expand Up @@ -115,7 +110,6 @@ mod tests {
kind: Some(DefinitionKind::Types),
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand Down Expand Up @@ -143,7 +137,6 @@ mod tests {
kind: Some(DefinitionKind::Structs),
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand Down Expand Up @@ -172,7 +165,6 @@ mod tests {
kind: None, // No kind filter - get all
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand Down Expand Up @@ -204,7 +196,6 @@ mod tests {
kind: Some(DefinitionKind::Functions),
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: true,
limit: 100,
},
Expand All @@ -230,7 +221,6 @@ mod tests {
kind: Some(DefinitionKind::Functions),
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: true,
limit: 100,
},
Expand Down Expand Up @@ -270,7 +260,6 @@ mod tests {
kind: Some(DefinitionKind::Functions),
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: true,
limit: 5,
},
Expand All @@ -295,7 +284,6 @@ mod tests {
kind: None,
name: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand Down
12 changes: 3 additions & 9 deletions cli/src/commands/browse_module/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ impl Outputable for BrowseModuleResult {
// Header
if let Some(kind) = self.kind_filter {
output.push_str(&format!(
"Definitions in {} (kind: {}, project: {})\n\n",
self.search_term, kind, self.project
"Definitions in {} (kind: {})\n\n",
self.search_term, kind
));
} else {
output.push_str(&format!(
"Definitions in {} (project: {})\n\n",
self.search_term, self.project
));
output.push_str(&format!("Definitions in {}\n\n", self.search_term));
}

// Empty state
Expand Down Expand Up @@ -138,7 +135,6 @@ mod tests {
let result = BrowseModuleResult {
search_term: "NonExistent".to_string(),
kind_filter: None,
project: "default".to_string(),
total_items: 0,
definitions: vec![],
};
Expand All @@ -154,7 +150,6 @@ mod tests {
let result = BrowseModuleResult {
search_term: "MyApp.Accounts".to_string(),
kind_filter: None,
project: "default".to_string(),
total_items: 1,
definitions: vec![Definition::Function {
module: "MyApp.Accounts".to_string(),
Expand Down Expand Up @@ -186,7 +181,6 @@ mod tests {
let result = BrowseModuleResult {
search_term: "MyApp.Accounts".to_string(),
kind_filter: None,
project: "default".to_string(),
total_items: 2,
definitions: vec![
Definition::Function {
Expand Down
12 changes: 4 additions & 8 deletions cli/src/commands/browse_module/output_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ mod tests {
// =========================================================================

const EMPTY_TABLE: &str = "\
Definitions in NonExistent (project: default)
Definitions in NonExistent

No definitions found.
";

const FUNCTIONS_ONLY_TABLE: &str = "\
Definitions in MyApp.Accounts (kind: functions, project: default)
Definitions in MyApp.Accounts (kind: functions)

Found 2 definition(s):

Expand All @@ -29,7 +29,7 @@ Found 2 definition(s):
";

const MIXED_TYPES_TABLE: &str = "\
Definitions in MyApp.Accounts (project: default)
Definitions in MyApp.Accounts

Found 3 definition(s):

Expand All @@ -43,7 +43,7 @@ Found 3 definition(s):
";

const STRUCT_TABLE: &str = "\
Definitions in MyApp.User (kind: structs, project: default)
Definitions in MyApp.User (kind: structs)

Found 1 definition(s):

Expand All @@ -63,7 +63,6 @@ Found 1 definition(s):
BrowseModuleResult {
search_term: "NonExistent".to_string(),
kind_filter: None,
project: "default".to_string(),
total_items: 0,
definitions: vec![],
}
Expand All @@ -74,7 +73,6 @@ Found 1 definition(s):
BrowseModuleResult {
search_term: "MyApp.Accounts".to_string(),
kind_filter: Some(DefinitionKind::Functions),
project: "default".to_string(),
total_items: 2,
definitions: vec![
Definition::Function {
Expand Down Expand Up @@ -115,7 +113,6 @@ Found 1 definition(s):
BrowseModuleResult {
search_term: "MyApp.Accounts".to_string(),
kind_filter: None,
project: "default".to_string(),
total_items: 3,
definitions: vec![
Definition::Type {
Expand Down Expand Up @@ -159,7 +156,6 @@ Found 1 definition(s):
BrowseModuleResult {
search_term: "MyApp.User".to_string(),
kind_filter: Some(DefinitionKind::Structs),
project: "default".to_string(),
total_items: 1,
definitions: vec![Definition::Struct {
module: "MyApp.User".to_string(),
Expand Down
1 change: 0 additions & 1 deletion cli/src/commands/calls_from/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ impl Execute for CallsFromCmd {
&self.module,
self.function.as_deref(),
self.arity,
&self.common.project,
self.common.regex,
self.common.limit,
)?;
Expand Down
5 changes: 0 additions & 5 deletions cli/src/commands/calls_from/execute_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ mod tests {
function: None,
arity: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand Down Expand Up @@ -80,7 +79,6 @@ mod tests {
function: Some("get_user".to_string()),
arity: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand Down Expand Up @@ -120,7 +118,6 @@ mod tests {
function: None,
arity: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: true,
limit: 100,
},
Expand Down Expand Up @@ -148,7 +145,6 @@ mod tests {
function: None,
arity: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: false,
limit: 100,
},
Expand All @@ -172,7 +168,6 @@ mod tests {
function: None,
arity: None,
common: CommonArgs {
project: "test_project".to_string(),
regex: true,
limit: 1,
},
Expand Down
1 change: 0 additions & 1 deletion cli/src/commands/calls_to/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ impl Execute for CallsToCmd {
&self.module,
self.function.as_deref(),
self.arity,
&self.common.project,
self.common.regex,
self.common.limit,
)?;
Expand Down
Loading