Skip to content

Commit 5f32479

Browse files
authored
feat: Add --content flag for docs, config, and code search (#142)
1 parent d362683 commit 5f32479

18 files changed

Lines changed: 432 additions & 144 deletions

README.md

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ semble search "save_pretrained" ./my-project
6363
semble search "save model to disk" ./my-project --top-k 10
6464
​```
6565

66+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
67+
68+
​```bash
69+
semble search "deployment guide" ./my-project --content docs
70+
semble search "database host port" ./my-project --content config
71+
semble search "authentication" ./my-project --content all
72+
​```
73+
6674
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
6775

6876
​```bash
@@ -76,9 +84,10 @@ If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its plac
7684
### Workflow
7785

7886
1. Start with `semble search` to find relevant chunks.
79-
2. Inspect full files only when the returned chunk is not enough context.
80-
3. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
81-
4. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
87+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
88+
3. Inspect full files only when the returned chunk is not enough context.
89+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
90+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
8291
```
8392

8493
</details>
@@ -287,6 +296,8 @@ Add to `~/.config/zed/settings.json` (or `.zed/settings.json` in your project):
287296
| `search` | Search a codebase with a natural-language or code query. Pass `repo` as a local directory path or an https:// git URL. |
288297
| `find_related` | Given a file path and line number, return chunks semantically similar to the code at that location. |
289298

299+
By default the MCP server indexes only code files. To also index documentation, config, or everything, append `--content docs`, `--content config`, or `--content all` to the server command, or a combination, e.g. `--content code docs`. For example, in Claude Code: `claude mcp add semble -s user -- uvx --from "semble[mcp]" semble --content all`.
300+
290301

291302
<a id="bash-agentsmd"></a>
292303

@@ -307,6 +318,14 @@ semble search "save_pretrained" ./my-project
307318
semble search "save model to disk" ./my-project --top-k 10
308319
​```
309320

321+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
322+
323+
​```bash
324+
semble search "deployment guide" ./my-project --content docs
325+
semble search "database host port" ./my-project --content config
326+
semble search "authentication" ./my-project --content all
327+
​```
328+
310329
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
311330

312331
​```bash
@@ -320,9 +339,10 @@ If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its plac
320339
## Workflow
321340

322341
1. Start with `semble search` to find relevant chunks.
323-
2. Inspect full files only when the returned chunk is not enough context.
324-
3. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
325-
4. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
342+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
343+
3. Inspect full files only when the returned chunk is not enough context.
344+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
345+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
326346
```
327347

328348
### Sub-agent setup
@@ -357,11 +377,20 @@ semble search "save model to disk" https://github.com/MinishLab/model2vec
357377
# Limit results
358378
semble search "save model to disk" ./my-project --top-k 10
359379

380+
# Search docs and prose (markdown, rst, etc.) instead of code
381+
semble search "deployment guide" ./my-project --content docs
382+
383+
# Search config files (yaml, toml, terraform, etc.)
384+
semble search "database host port" ./my-project --content config
385+
386+
# Search everything (code, docs, and config)
387+
semble search "authentication" ./my-project --content all
388+
360389
# Find code similar to a known location
361390
semble find-related src/auth.py 42 ./my-project
362391
```
363392

364-
`path` defaults to the current directory when omitted; git URLs are accepted. If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
393+
`--content` accepts `code` (default), `docs`, `config`, or `all`. `path` defaults to the current directory when omitted; git URLs are accepted. If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
365394

366395
<details>
367396
<summary>Savings</summary>
@@ -395,11 +424,20 @@ Stats are stored in `~/.semble/savings.jsonl`.
395424
Semble can also be used as a Python library for programmatic access, useful when building custom tooling or integrating search directly into your own code.
396425

397426
```python
398-
from semble import SembleIndex
427+
from semble import ContentType, SembleIndex
399428

400-
# Index a local directory
429+
# Index a local directory (code only, the default)
401430
index = SembleIndex.from_path("./my-project")
402431

432+
# Index docs and prose (markdown, rst, etc.)
433+
index = SembleIndex.from_path("./my-project", content=ContentType.DOCS)
434+
435+
# Index everything (code, docs, and config)
436+
index = SembleIndex.from_path("./my-project", content=[ContentType.CODE, ContentType.DOCS, ContentType.CONFIG])
437+
438+
# Index code and docs together
439+
index = SembleIndex.from_path("./my-project", content=[ContentType.CODE, ContentType.DOCS])
440+
403441
# Index a remote git repository
404442
index = SembleIndex.from_git("https://github.com/MinishLab/model2vec")
405443

src/semble/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from semble.index import SembleIndex
2-
from semble.types import Chunk, EmbeddingMatrix, Encoder, IndexStats, SearchResult
2+
from semble.types import Chunk, ContentType, EmbeddingMatrix, Encoder, IndexStats, SearchResult
33
from semble.version import __version__
44

55
__all__ = [
66
"Chunk",
7+
"ContentType",
78
"EmbeddingMatrix",
89
"Encoder",
910
"IndexStats",

src/semble/agents/claude.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ semble search "save_pretrained" ./my-project
1212
semble search "save model to disk" ./my-project --top-k 10
1313
```
1414

15+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
16+
17+
```bash
18+
semble search "deployment guide" ./my-project --content docs
19+
semble search "database host port" ./my-project --content config
20+
semble search "authentication" ./my-project --content all
21+
```
22+
1523
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
1624

1725
```bash
@@ -25,6 +33,7 @@ If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its plac
2533
## Workflow
2634

2735
1. Start with `semble search` to find relevant chunks.
28-
2. Inspect full files only when the returned chunk is not enough context.
29-
3. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
30-
4. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
36+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
37+
3. Inspect full files only when the returned chunk is not enough context.
38+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
39+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.

src/semble/agents/copilot.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ semble search "save_pretrained" ./my-project
1212
semble search "save model to disk" ./my-project --top-k 10
1313
```
1414

15+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
16+
17+
```bash
18+
semble search "deployment guide" ./my-project --content docs
19+
semble search "database host port" ./my-project --content config
20+
semble search "authentication" ./my-project --content all
21+
```
22+
1523
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
1624

1725
```bash
@@ -25,6 +33,7 @@ If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its plac
2533
## Workflow
2634

2735
1. Start with `semble search` to find relevant chunks.
28-
2. Inspect full files only when the returned chunk is not enough context.
29-
3. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
30-
4. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
36+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
37+
3. Inspect full files only when the returned chunk is not enough context.
38+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
39+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.

src/semble/agents/cursor.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ semble search "save_pretrained" ./my-project
1111
semble search "save model to disk" ./my-project --top-k 10
1212
```
1313

14+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
15+
16+
```bash
17+
semble search "deployment guide" ./my-project --content docs
18+
semble search "database host port" ./my-project --content config
19+
semble search "authentication" ./my-project --content all
20+
```
21+
1422
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
1523

1624
```bash
@@ -24,6 +32,7 @@ If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its plac
2432
## Workflow
2533

2634
1. Start with `semble search` to find relevant chunks.
27-
2. Inspect full files only when the returned chunk is not enough context.
28-
3. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
29-
4. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
35+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
36+
3. Inspect full files only when the returned chunk is not enough context.
37+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
38+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.

src/semble/agents/gemini.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ semble search "save_pretrained" ./my-project
1414
semble search "save model to disk" ./my-project --top-k 10
1515
```
1616

17+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
18+
19+
```bash
20+
semble search "deployment guide" ./my-project --content docs
21+
semble search "database host port" ./my-project --content config
22+
semble search "authentication" ./my-project --content all
23+
```
24+
1725
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
1826

1927
```bash
@@ -27,6 +35,7 @@ If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its plac
2735
## Workflow
2836

2937
1. Start with `semble search` to find relevant chunks.
30-
2. Inspect full files only when the returned chunk is not enough context.
31-
3. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
32-
4. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
38+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
39+
3. Inspect full files only when the returned chunk is not enough context.
40+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
41+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.

src/semble/agents/kiro.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ semble search "save_pretrained" ./my-project
1414
semble search "save model to disk" ./my-project --top-k 10
1515
```
1616

17+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
18+
19+
```bash
20+
semble search "deployment guide" ./my-project --content docs
21+
semble search "database host port" ./my-project --content config
22+
semble search "authentication" ./my-project --content all
23+
```
24+
1725
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
1826

1927
```bash
@@ -27,6 +35,7 @@ If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its plac
2735
## Workflow
2836

2937
1. Start with `semble search` to find relevant chunks.
30-
2. Inspect full files only when the returned chunk is not enough context.
31-
3. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
32-
4. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
38+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
39+
3. Inspect full files only when the returned chunk is not enough context.
40+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
41+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.

src/semble/agents/opencode.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ semble search "save_pretrained" ./my-project
1515
semble search "save model to disk" ./my-project --top-k 10
1616
```
1717

18+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
19+
20+
```bash
21+
semble search "deployment guide" ./my-project --content docs
22+
semble search "database host port" ./my-project --content config
23+
semble search "authentication" ./my-project --content all
24+
```
25+
1826
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
1927

2028
```bash
@@ -28,6 +36,7 @@ If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its plac
2836
## Workflow
2937

3038
1. Start with `semble search` to find relevant chunks.
31-
2. Inspect full files only when the returned chunk is not enough context.
32-
3. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
33-
4. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
39+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
40+
3. Inspect full files only when the returned chunk is not enough context.
41+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
42+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.

0 commit comments

Comments
 (0)