@ataraxy-labs/sem 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -1
- package/README.md +129 -45
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,49 @@ All notable changes to sem are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.25.0] - 2026-09-13
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **BSL (1C:Enterprise) language support.** Procedures and functions are extracted as entities from `.bsl` and `.osl` files via the alkoleft/tree-sitter-bsl grammar, behind a `lang-bsl` feature included in `grammar-all`. Requested in Ataraxy-Labs/weave#132.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **TypeScript instance fields are typed from all three declaration forms.** Field types were learned only from an explicit `this.x = ...` in the constructor body, so a field with an initializer or annotation, and a constructor parameter property (the shape most dependency-injection code uses), were never typed and calls through them resolved to nothing. Method-level impact came back empty for DI code (#474).
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **Semantic diffs retain added and deleted containers alongside their changed children.** A whole section appearing or disappearing is structural information its leaves do not restate, and a parent rename the matcher cannot confirm is now visible as the Deleted/Added pair rather than only a child move. Modified containers whose own declaration did not change are still suppressed. Based on work in #481.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.24.0] - 2026-08-23
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- **`sem find`, `sem grep`, and `sem context` now accept multiple queries in a single call.** `sem find name1 name2 …` resolves each name independently — a miss on one doesn't affect the others; `sem grep -e pattern1 -e pattern2 …` (rg-style repeated `-e`) keeps each pattern's hits separate; `sem context --entity A --entity B …` packs context for several entities in one invocation, each under the same `--budget`, refusing on an ambiguous or unresolved name the same way the single-entity form does. The MCP `find`, `grep`, and `context` tools gained matching array parameters (`queries[]`, `patterns[]`, `entities[]`). Single-query usage is unchanged.
|
|
27
|
+
- **New `sem_callers` MCP tool**, exposing the same reverse-caller lookup as the CLI's `sem callers`. `sem callers` itself gained `--limit` (cap the result list) and now refuses — listing every candidate — when a name matches more than one definition, instead of silently answering for just one.
|
|
28
|
+
- **A middle zoom level between an outline and full source: `sem entities --signatures` and `sem context --headers`.** Each shows an entity's signature (up to where its body starts) plus the first line of its leading doc comment, instead of either the bare name alone or the full body. Available over MCP as `signatures: true` on `entities` and `mode: "headers"` on `context`.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **sem-mcp's `format` parameter now applies everywhere `entities` can return results.** It was previously honored on some response shapes but ignored on others: `entities`' free-text and query-ranking modes always rendered human-readable text even when `format=json` was requested, and the cloud-served directory-listing fast path always returned raw JSON even for the default text format.
|
|
33
|
+
|
|
34
|
+
## [0.23.1] - 2026-08-22
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- **CSV, JSON, and Vue entities no longer collide on generated ids with entities from other files.** Their id-generation scheme is now disambiguated per plugin, closing a gap where two entities could silently collapse onto the same id and one would drop out of the graph.
|
|
39
|
+
- **Entities from non-code files (Markdown, TOML, YAML, JSON, CSV, Vue/Svelte) now carry accurate byte ranges**, so tools that rely on byte offsets (extraction, editing, highlighting) work correctly for these file types instead of getting an inaccurate span.
|
|
40
|
+
- **Markdown headings that appear inside a fenced code block are no longer parsed as real document headings.**
|
|
41
|
+
- **TypeScript/JavaScript entity byte spans now include a leading `export` keyword when present**, so extracting an exported declaration's exact source text no longer drops the `export ` prefix. Facts schema v4 — existing caches rebuild automatically on first use.
|
|
42
|
+
- **`sem entities` no longer opens the git repository through libgit2 on every call.** That was a fixed per-call cost regardless of file size, disproportionately noticeable on small-file lookups; it's now only paid when actually needed.
|
|
43
|
+
- **sem-mcp's `query` and `limit` parameters on the `entities` and `context` tools now work correctly** (previously ignored).
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- **sem-mcp: new `find` and `grep` tools**, giving MCP clients the same fast entity-lookup and trigram-accelerated search already available from the CLI (`sem find`, `sem grep`).
|
|
48
|
+
- **sem-mcp: `entities` and `context` tools accept `format=json`**, returning structured JSON instead of human-readable text for callers that want to parse results programmatically.
|
|
49
|
+
|
|
7
50
|
## [0.23.0] - 2026-08-22
|
|
8
51
|
|
|
9
52
|
### Changed
|
|
@@ -55,7 +98,7 @@ All notable changes to sem are documented in this file.
|
|
|
55
98
|
|
|
56
99
|
### Performance
|
|
57
100
|
|
|
58
|
-
- **Cold graph builds are 11-30% faster and peak RSS is down 17-40% on giant corpora, versus 0.21.** Measured end-to-end on the shipped release binary: home-assistant-core 5.9s, TypeScript monster 11.2s, dotnet-runtime 46.7s, llvm-project 34.7s, linux 35.2s cold full-CLI (warm rebuilds: 0.2-1.3s). Every corpus improved on both the engine-only and full-CLI metrics
|
|
101
|
+
- **Cold graph builds are 11-30% faster and peak RSS is down 17-40% on giant corpora, versus 0.21.** Measured end-to-end on the shipped release binary: home-assistant-core 5.9s, TypeScript monster 11.2s, dotnet-runtime 46.7s, llvm-project 34.7s, linux 35.2s cold full-CLI (warm rebuilds: 0.2-1.3s). Every corpus improved on both the engine-only and full-CLI metrics.
|
|
59
102
|
- **C#/C++ builds now skip re-parsing files whose facts are already known**, closing the last gap in precomputed-facts reuse (JS/TS/Python/Go/Java/Rust already had it). A per-file gate proves a corpus-wide invariant — no entity's parent lives in a different file — before trusting precomputed facts wholesale, so this needed no facts-schema change. Measured on dotnet-runtime: reparse time drops from 10.6s to 65ms.
|
|
60
103
|
- **Parsed file facts now persist to disk as a content-addressed corpus**, so a build that has seen a file's exact content before warm-starts it instead of re-parsing from scratch, even in a fresh process. Fixed a regression where checking a shared corpus against a large number of prior contributors got slower as the corpus grew (one repo's known-content rebuild was measured 332% slower against a 7.9GB shared corpus than a 556MB one); it now costs the same regardless of corpus size.
|
|
61
104
|
- **`sem context` regained a fast tier it had lost, by reading each entity's body from its own file at an indexed byte span instead of walking and hydrating the whole corpus.** A prior cascade of cache removals deleted the old fast path along with a correctness bug it had, but left `sem context` always doing a full corpus load — measured on the TypeScript monster 1.11s down to 48ms, on a mid-size repo 0.16-0.28s down to 4.6ms. Verified byte-identical against the always-correct full-load path across both entity- and file-scoped lookups; still declines (never approximates) on a stale cache, an ambiguous name, or any entity missing a span.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
> **Part of the [Ataraxy Labs](https://ataraxy-labs.com) stack
|
|
1
|
+
> **Part of the [Ataraxy Labs](https://ataraxy-labs.com) stack**: agent-native infrastructure for software development. See also: [weave](https://ataraxy-labs.com/weave) (entity-level git merge driver) · [inspect](https://github.com/Ataraxy-Labs/inspect) (semantic code review) · [opensessions](https://github.com/Ataraxy-Labs/opensessions) (tmux sidebar for coding agents).
|
|
2
2
|
>
|
|
3
3
|
> Read the manifesto: https://ataraxy-labs.com/#thesis · Essays: https://ataraxy-labs.com/blogs · LLMs: https://ataraxy-labs.com/llms.txt
|
|
4
4
|
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
<p align="center">
|
|
28
28
|
<a href="https://github.com/Ataraxy-Labs/sem/releases/latest"><img src="https://img.shields.io/github/v/release/Ataraxy-Labs/sem?color=blue&label=release" alt="Release"></a>
|
|
29
29
|
<img src="https://img.shields.io/badge/rust-stable-orange" alt="Rust">
|
|
30
|
-
<img src="https://img.shields.io/badge/tests-
|
|
31
|
-
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow" alt="License"></a>
|
|
32
|
-
<img src="https://img.shields.io/badge/languages-
|
|
30
|
+
<img src="https://img.shields.io/badge/tests-900%2B_passing-brightgreen" alt="Tests">
|
|
31
|
+
<a href="LICENSE-MIT"><img src="https://img.shields.io/badge/license-MIT-yellow" alt="License"></a>
|
|
32
|
+
<img src="https://img.shields.io/badge/languages-32-blue" alt="Languages">
|
|
33
33
|
</p>
|
|
34
34
|
|
|
35
35
|
sem is a semantic version control tool that works on top of Git. It parses your code with tree-sitter, extracts every function, class, and method as an entity, and diffs at the entity level instead of lines. This means you see "function `blahh` was modified" instead of "lines x-y changed."
|
|
@@ -60,6 +60,12 @@ Or via winget on Windows:
|
|
|
60
60
|
winget install AtaraxyLabs.sem
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
Or via Scoop on Windows:
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
scoop install sem
|
|
67
|
+
```
|
|
68
|
+
|
|
63
69
|
Or install the npm wrapper into `node_modules`:
|
|
64
70
|
|
|
65
71
|
```bash
|
|
@@ -79,7 +85,13 @@ Once installed, update to the latest release any time:
|
|
|
79
85
|
sem update
|
|
80
86
|
```
|
|
81
87
|
|
|
82
|
-
Or
|
|
88
|
+
Or via cargo, from [crates.io](https://crates.io/crates/sem-cli):
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cargo install sem-cli
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Or build the latest `main` from source (requires Rust):
|
|
83
95
|
|
|
84
96
|
```bash
|
|
85
97
|
cargo install --git https://github.com/Ataraxy-Labs/sem sem-cli
|
|
@@ -216,7 +228,7 @@ sem log authenticateUser --json
|
|
|
216
228
|
|
|
217
229
|
With no entity, `sem log` analyzes recent repo history at the entity level:
|
|
218
230
|
**hotspots** (most-changed functions/classes, with author counts) and
|
|
219
|
-
**co-change pairs** (entities that repeatedly change in the same commits
|
|
231
|
+
**co-change pairs** (entities that repeatedly change in the same commits:
|
|
220
232
|
"if you touch one, don't forget the other"):
|
|
221
233
|
|
|
222
234
|
```bash
|
|
@@ -263,6 +275,47 @@ sem context authenticateUser --json
|
|
|
263
275
|
sem context authenticateUser --no-default-excludes
|
|
264
276
|
```
|
|
265
277
|
|
|
278
|
+
### sem find / callers / refs / grep
|
|
279
|
+
|
|
280
|
+
Cold-start lookups backed by an on-disk, mmap-able query index (`index.sem`, stored next to the SQLite entity cache). The first call in a repo builds the index; every call after that reads it directly, no daemon or background process involved:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Find where an entity is defined
|
|
284
|
+
sem find "function diff_command"
|
|
285
|
+
|
|
286
|
+
# Who calls it
|
|
287
|
+
sem callers diff_command
|
|
288
|
+
|
|
289
|
+
# What it calls
|
|
290
|
+
sem refs diff_command
|
|
291
|
+
|
|
292
|
+
# Text search across source files (rg-compatible file:line:text output,
|
|
293
|
+
# served from the index's trigram postings when one exists)
|
|
294
|
+
sem grep "TODO"
|
|
295
|
+
|
|
296
|
+
# JSON output on any of the above
|
|
297
|
+
sem find diff_command --json
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Measured on this repo (`crates/`) with `time`: the first `sem find` (index not built yet) took 185ms; the second call against the same repo, once the index existed, took 7ms. Run it yourself; the exact numbers will depend on your machine and repo size. The point is the cold-vs-warm gap: no daemon needs to stay alive for the warm number to hold.
|
|
301
|
+
|
|
302
|
+
### sem graph
|
|
303
|
+
|
|
304
|
+
Prints the full entity dependency graph for the current repo, or `--json` for the underlying edge list (the same graph `sem impact` and `sem context` are built on top of):
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
sem graph
|
|
308
|
+
sem graph --json
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### sem stats
|
|
312
|
+
|
|
313
|
+
Local, cumulative counters: how many diffs `sem` has run in this environment and how much of that was noise filtered out. Nothing here leaves your machine (see [Telemetry](#telemetry)):
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
sem stats
|
|
317
|
+
```
|
|
318
|
+
|
|
266
319
|
## Use as default Git diff
|
|
267
320
|
|
|
268
321
|
Replace `git diff` output with entity-level diffs. Agents and humans get sem output automatically without changing any commands.
|
|
@@ -284,8 +337,8 @@ sem unsetup
|
|
|
284
337
|
## Entity-level diffs on every pull request
|
|
285
338
|
|
|
286
339
|
Add the GitHub Action and every PR gets one sticky comment showing which
|
|
287
|
-
functions, classes, and methods changed
|
|
288
|
-
|
|
340
|
+
functions, classes, and methods changed. It updates in place on each push and
|
|
341
|
+
calls out cosmetic-only PRs (formatting/comments) explicitly:
|
|
289
342
|
|
|
290
343
|
```yaml
|
|
291
344
|
# .github/workflows/entity-diff.yml
|
|
@@ -299,16 +352,16 @@ jobs:
|
|
|
299
352
|
runs-on: ubuntu-latest
|
|
300
353
|
steps:
|
|
301
354
|
- uses: actions/checkout@v4
|
|
302
|
-
- uses: Ataraxy-Labs/sem/action@v0.
|
|
355
|
+
- uses: Ataraxy-Labs/sem/action@v0.23.1
|
|
303
356
|
```
|
|
304
357
|
|
|
305
358
|
No config, no API keys, never fails your build. See [action/](action/) for details.
|
|
306
359
|
|
|
307
360
|
## Cloud acceleration (for scale and teams)
|
|
308
361
|
|
|
309
|
-
Local is always free and always fast
|
|
362
|
+
Local is always free and always fast: the on-disk index answers day-to-day queries in single-digit milliseconds even from a cold process, so there's nothing to keep warm and no login required. You do not pay to make your laptop fast.
|
|
310
363
|
|
|
311
|
-
Cloud is for what a laptop can't do. On a very large monorepo the first local graph build can take a few seconds; a shared team graph shouldn't be rebuilt per developer; and CI wants the graph without checking anything out. `sem login` connects those cases to sem cloud, which keeps a warm, pre-built graph for your registered repos and serves the heavy queries from it
|
|
364
|
+
Cloud is for what a laptop can't do. On a very large monorepo the first local graph build can take a few seconds; a shared team graph shouldn't be rebuilt per developer; and CI wants the graph without checking anything out. `sem login` connects those cases to sem cloud, which keeps a warm, pre-built graph for your registered repos and serves the heavy queries from it instead of rebuilding locally.
|
|
312
365
|
|
|
313
366
|
```bash
|
|
314
367
|
sem login # GitHub device flow, one time
|
|
@@ -321,6 +374,23 @@ It is fully optional and transparent:
|
|
|
321
374
|
- `SEM_LOCAL=1` forces local computation even when logged in.
|
|
322
375
|
- Small repos see no change, local is already fast. The win is for large codebases where rebuilding the graph each time is the bottleneck.
|
|
323
376
|
|
|
377
|
+
Related commands, all cloud-account scoped:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
sem logout # log out
|
|
381
|
+
sem whoami # show current cloud identity
|
|
382
|
+
sem cloud status # cloud + telemetry state for this repo (offline; sends nothing)
|
|
383
|
+
sem cloud enable # turn on cloud queries for a public repo (shows what's sent first)
|
|
384
|
+
sem cloud share # same, with extra confirmation, for a private repo
|
|
385
|
+
sem cloud forget # delete this repo's cloud index and unregister it
|
|
386
|
+
sem xref --json # cross-repo dependencies across your indexed repos
|
|
387
|
+
sem repos # where your code is stored: cloud-indexed repos + local caches
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
`sem cloud --help` lists every subcommand (`list`, `preview`, `log`, `never` included); each one is read-only or requires explicit confirmation before it sends anything.
|
|
391
|
+
|
|
392
|
+
If your team runs code review through sem cloud, `sem review listen <diff-id-or-url>` execs a coding agent pre-configured to join that review as a live listener that answers reviewer questions anchored to specific lines of the diff.
|
|
393
|
+
|
|
324
394
|
## What it parses
|
|
325
395
|
|
|
326
396
|
32 programming languages with full entity extraction via tree-sitter:
|
|
@@ -328,16 +398,16 @@ It is fully optional and transparent:
|
|
|
328
398
|
| Language | Extensions | Entities |
|
|
329
399
|
|----------|-----------|----------|
|
|
330
400
|
| TypeScript | `.ts` `.tsx` `.mts` `.cts` | functions, classes, interfaces, types, enums, exports |
|
|
331
|
-
| JavaScript | `.js` `.jsx` `.mjs` `.cjs` | functions, classes, variables, exports |
|
|
332
|
-
| Python | `.py` | functions, classes, decorated definitions |
|
|
401
|
+
| JavaScript | `.js` `.jsx` `.mjs` `.cjs` `.es6` | functions, classes, variables, exports |
|
|
402
|
+
| Python | `.py` `.pyi` | functions, classes, decorated definitions |
|
|
333
403
|
| Go | `.go` | functions, methods, types, vars, consts |
|
|
334
404
|
| Rust | `.rs` | functions, structs, enums, impls, traits, mods, consts |
|
|
335
405
|
| Java | `.java` | classes, methods, interfaces, enums, fields, constructors |
|
|
336
406
|
| C | `.c` `.h` | functions, structs, enums, unions, typedefs |
|
|
337
|
-
| C++ | `.cpp` `.cc` `.hpp` | functions, classes, structs, enums, namespaces, templates |
|
|
407
|
+
| C++ | `.cpp` `.cc` `.cxx` `.hpp` `.hh` `.hxx` | functions, classes, structs, enums, namespaces, templates |
|
|
338
408
|
| C# | `.cs` | classes, methods, interfaces, enums, structs, properties |
|
|
339
409
|
| Ruby | `.rb` | methods, classes, modules |
|
|
340
|
-
| PHP | `.php` | functions, classes, methods, interfaces, traits, enums |
|
|
410
|
+
| PHP | `.php` `.inc` `.phtml` `.module` | functions, classes, methods, interfaces, traits, enums |
|
|
341
411
|
| Swift | `.swift` | functions, classes, protocols, structs, enums, properties |
|
|
342
412
|
| Elixir | `.ex` `.exs` | modules, functions, macros, guards, protocols |
|
|
343
413
|
| Bash | `.sh` | functions |
|
|
@@ -345,15 +415,15 @@ It is fully optional and transparent:
|
|
|
345
415
|
| Lua | `.lua` | functions (global, local, table, and method forms) |
|
|
346
416
|
| HCL/Terraform | `.hcl` `.tf` `.tfvars` | blocks, attributes (qualified names for nested blocks) |
|
|
347
417
|
| Kotlin | `.kt` `.kts` | classes, interfaces, objects, functions, properties, companion objects |
|
|
348
|
-
| Fortran | `.f90` `.f95` `.f` | functions, subroutines, modules, programs |
|
|
418
|
+
| Fortran | `.f90` `.f95` `.f03` `.f08` `.f` `.for` | functions, subroutines, modules, programs |
|
|
349
419
|
| Vue | `.vue` | template/script/style blocks + inner TS/JS entities |
|
|
350
|
-
| XML | `.xml` `.plist` `.svg` `.csproj` | elements (nested, tag-name identity) |
|
|
420
|
+
| XML | `.xml` `.plist` `.svg` `.csproj` + 9 more MSBuild/resource extensions | elements (nested, tag-name identity) |
|
|
351
421
|
| ERB | `.erb` `.html.erb` | blocks, expressions, code tags |
|
|
352
|
-
| Svelte | `.svelte` `.svelte.js` `.svelte.ts` | component blocks + rune JS/TS modules |
|
|
422
|
+
| Svelte | `.svelte` `.svelte.js` `.svelte.ts` (+ `.test`/`.spec` variants) | component blocks + rune JS/TS modules |
|
|
353
423
|
| Perl | `.pl` `.pm` `.t` | subroutines, packages |
|
|
354
424
|
| Dart | `.dart` | classes, mixins, extensions, enums, type aliases, functions |
|
|
355
425
|
| OCaml | `.ml` `.mli` | values, modules, types, classes, externals |
|
|
356
|
-
| Scala | `.scala` `.sc` `.sbt` | classes, objects, traits, enums, functions, vals, extensions |
|
|
426
|
+
| Scala | `.scala` `.sc` `.sbt` `.kojo` `.mill` | classes, objects, traits, enums, functions, vals, extensions |
|
|
357
427
|
| Nix | `.nix` | bindings, inherit declarations |
|
|
358
428
|
| Haskell | `.hs` | functions, signatures, data types, newtypes, classes, instances, type synonyms |
|
|
359
429
|
| Elm | `.elm` | value declarations, type aliases, type declarations, port annotations, infix declarations |
|
|
@@ -372,6 +442,7 @@ Plus structured data formats:
|
|
|
372
442
|
| EDN | `.edn` | top-level map entries (keyword keys) |
|
|
373
443
|
| CSV | `.csv` `.tsv` | rows (first column as identity) |
|
|
374
444
|
| Markdown | `.md` `.mdx` | heading-based sections |
|
|
445
|
+
| LaTeX | `.tex` `.latex` `.cls` `.sty` | sections (part/chapter/section/…), plus theorem/lemma/proof/figure/table/algorithm and other tracked environments |
|
|
375
446
|
|
|
376
447
|
Everything else falls back to chunk-based diffing.
|
|
377
448
|
|
|
@@ -387,23 +458,23 @@ For files with non-standard extensions, create a `.semrc` in your project root:
|
|
|
387
458
|
|
|
388
459
|
sem also reads `.gitattributes` patterns (`diff=` and `linguist-language=`) if you already have those set up. `.semrc` takes priority when both define the same extension.
|
|
389
460
|
|
|
390
|
-
For files with no extension at all, sem detects the language automatically from content (
|
|
461
|
+
For files with no extension at all, sem detects the language automatically from content (shebang lines, vim modelines, and structural heuristics like `package`/`import`/`use` statements). This covers 30+ languages with no config needed.
|
|
391
462
|
|
|
392
463
|
## How matching works
|
|
393
464
|
|
|
394
465
|
Three-phase entity matching:
|
|
395
466
|
|
|
396
|
-
1. **Exact ID match
|
|
397
|
-
2. **Structural hash match
|
|
398
|
-
3. **Fuzzy similarity
|
|
467
|
+
1. **Exact ID match**: same entity in before/after = modified or unchanged
|
|
468
|
+
2. **Structural hash match**: same AST structure, different name = renamed or moved (ignores whitespace/comments)
|
|
469
|
+
3. **Fuzzy similarity**: >80% token overlap = probable rename
|
|
399
470
|
|
|
400
471
|
This means sem detects renames and moves, not just additions and deletions. Structural hashing also distinguishes cosmetic changes (whitespace, formatting) from real logic changes.
|
|
401
472
|
|
|
402
473
|
## Use with AI agents (MCP)
|
|
403
474
|
|
|
404
|
-
`sem mcp` starts a [Model Context Protocol](https://modelcontextprotocol.io) server over stdin/stdout. It's not a command you run and read yourself: it's a server your coding agent launches in the background so it can ask sem questions while it works. That's the reason `mcp` lives alongside the normal commands. The agent gets
|
|
475
|
+
`sem mcp` starts a [Model Context Protocol](https://modelcontextprotocol.io) server over stdin/stdout. It's not a command you run and read yourself: it's a server your coding agent launches in the background so it can ask sem questions while it works. That's the reason `mcp` lives alongside the normal commands. The agent gets 8 entity-level tools mirroring the CLI: `sem_entities`, `sem_diff`, `sem_blame`, `sem_impact`, `sem_log`, `sem_context`, `sem_find`, `sem_grep`. (If you're also using sem cloud for code review, four more tools let an agent attach to a review and answer reviewer questions in a loop: `join_review`, `wait_for_branch`, `reply_to_branch`, `list_open_branches`.)
|
|
405
476
|
|
|
406
|
-
Why an agent wants these: instead of reading whole files and burning tokens, it can ask "what breaks if I change `submitOrder`" (`sem_impact`) or "give me just the context to refactor this function" (`sem_context
|
|
477
|
+
Why an agent wants these: instead of reading whole files and burning tokens, it can ask "what breaks if I change `submitOrder`" (`sem_impact`) or "give me just the context to refactor this function" (`sem_context`, which returns the function's source plus its callers and callees) and get a precise, deterministic answer from the dependency graph instead of a grep result that might miss a caller.
|
|
407
478
|
|
|
408
479
|
Add it once, then talk to your agent normally. It calls the tools on its own.
|
|
409
480
|
|
|
@@ -440,46 +511,56 @@ If `sem` isn't on the agent's PATH, use the absolute path to the binary. No sepa
|
|
|
440
511
|
sem diff --format json
|
|
441
512
|
```
|
|
442
513
|
|
|
514
|
+
Real output, from a one-line logic change to a Python function:
|
|
515
|
+
|
|
443
516
|
```json
|
|
444
517
|
{
|
|
445
518
|
"summary": {
|
|
446
|
-
"fileCount":
|
|
447
|
-
"added":
|
|
519
|
+
"fileCount": 1,
|
|
520
|
+
"added": 0,
|
|
448
521
|
"modified": 1,
|
|
449
|
-
"deleted":
|
|
522
|
+
"deleted": 0,
|
|
450
523
|
"moved": 0,
|
|
451
524
|
"renamed": 0,
|
|
452
525
|
"reordered": 0,
|
|
453
526
|
"binary": 0,
|
|
454
527
|
"orphan": 0,
|
|
455
|
-
"total":
|
|
528
|
+
"total": 1
|
|
456
529
|
},
|
|
457
530
|
"changes": [
|
|
458
531
|
{
|
|
459
|
-
"entityId": "
|
|
460
|
-
"changeType": "
|
|
532
|
+
"entityId": "auth.py::function::authenticate_user",
|
|
533
|
+
"changeType": "modified",
|
|
461
534
|
"entityType": "function",
|
|
462
|
-
"entityName": "
|
|
463
|
-
"startLine":
|
|
464
|
-
"endLine":
|
|
465
|
-
"oldStartLine":
|
|
466
|
-
"oldEndLine":
|
|
467
|
-
"
|
|
535
|
+
"entityName": "authenticate_user",
|
|
536
|
+
"startLine": 1,
|
|
537
|
+
"endLine": 6,
|
|
538
|
+
"oldStartLine": 1,
|
|
539
|
+
"oldEndLine": 4,
|
|
540
|
+
"oldEntityName": null,
|
|
541
|
+
"filePath": "auth.py",
|
|
542
|
+
"oldFilePath": null,
|
|
543
|
+
"oldParentId": null,
|
|
544
|
+
"beforeContent": "def authenticate_user(username, password):\n if not username or not password:\n return False\n return check_credentials(username, password)",
|
|
545
|
+
"afterContent": "def authenticate_user(username, password):\n if not username or not password:\n return False\n if not check_credentials(username, password):\n return False\n return True",
|
|
546
|
+
"commitSha": null,
|
|
547
|
+
"author": null,
|
|
548
|
+
"structuralChange": true
|
|
468
549
|
}
|
|
469
550
|
],
|
|
470
551
|
"binaryChanges": []
|
|
471
552
|
}
|
|
472
553
|
```
|
|
473
554
|
|
|
474
|
-
The named change-type buckets (`added`, `modified`, `deleted`, `moved`, `renamed`, `reordered`) always sum to `total`. `orphan` is a cross-cutting metadata count for module-level changes, and those changes are already included in the named change-type buckets.
|
|
555
|
+
The named change-type buckets (`added`, `modified`, `deleted`, `moved`, `renamed`, `reordered`) always sum to `total`. `orphan` is a cross-cutting metadata count for module-level changes, and those changes are already included in the named change-type buckets. `beforeContent`/`afterContent` carry the entity's full source on either side of the change; `structuralChange` is `false` when the diff is cosmetic only (whitespace, comments).
|
|
475
556
|
|
|
476
557
|
## As a library
|
|
477
558
|
|
|
478
|
-
sem-core can be used as a Rust library dependency:
|
|
559
|
+
sem-core can be used as a Rust library dependency, from [crates.io](https://crates.io/crates/sem-core):
|
|
479
560
|
|
|
480
561
|
```toml
|
|
481
562
|
[dependencies]
|
|
482
|
-
sem-core =
|
|
563
|
+
sem-core = "0.23"
|
|
483
564
|
```
|
|
484
565
|
|
|
485
566
|
Used by [weave](https://github.com/Ataraxy-Labs/weave) (semantic merge driver) and [inspect](https://github.com/Ataraxy-Labs/inspect) (entity-level code review).
|
|
@@ -490,18 +571,21 @@ Used by [weave](https://github.com/Ataraxy-Labs/weave) (semantic merge driver) a
|
|
|
490
571
|
- **git2** for Git operations
|
|
491
572
|
- **rayon** for parallel file processing
|
|
492
573
|
- **xxhash** for structural hashing
|
|
493
|
-
-
|
|
574
|
+
- A per-repo cache directory (SQLite entity cache + an mmap-able query index) backs `find`/`callers`/`refs`/`grep` with cold-process lookups and no background daemon
|
|
575
|
+
- Plugin system for adding new languages and formats (see [CONTRIBUTING.md](CONTRIBUTING.md))
|
|
494
576
|
|
|
495
577
|
## Telemetry
|
|
496
578
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
Disable it any time:
|
|
579
|
+
Local by default: sem counts command names (e.g. `diff`, `impact`) on your own machine only, and in that mode nothing is ever uploaded. No code, file paths, repo names, or user identity is recorded, and no network call is made.
|
|
500
580
|
|
|
501
581
|
```bash
|
|
502
|
-
|
|
582
|
+
sem telemetry preview # see current mode and exactly what would be sent
|
|
583
|
+
sem telemetry on # opt in: also upload counts to help improve sem
|
|
584
|
+
sem telemetry off # record nothing at all
|
|
503
585
|
```
|
|
504
586
|
|
|
587
|
+
`SEM_NO_TELEMETRY=1` or `DO_NOT_TRACK=1` force the record-nothing behavior regardless of mode. Development builds (anything run out of a `cargo build` `target/` directory) never record, so working on sem itself doesn't pollute the numbers.
|
|
588
|
+
|
|
505
589
|
## Contributing
|
|
506
590
|
|
|
507
591
|
Want to add a new language? See [CONTRIBUTING.md](CONTRIBUTING.md) for a step-by-step guide.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ataraxy-labs/sem",
|
|
3
3
|
"mcpName": "io.github.Ataraxy-Labs/sem",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"description": "npm wrapper for the sem CLI. Downloads the matching release binary and exposes the sem command in node_modules/.bin.",
|
|
6
6
|
"license": "MIT OR Apache-2.0",
|
|
7
7
|
"type": "module",
|