@ataraxy-labs/sem 0.23.1 → 0.26.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 +55 -0
- package/README.md +133 -45
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,61 @@ All notable changes to sem are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.26.0] - 2026-10-02
|
|
8
|
+
|
|
9
|
+
### Removed
|
|
10
|
+
|
|
11
|
+
- **The strict and adaptive transaction policies are gone from pi, leaving the simple structural session policy as the only one.** `pi/config/transaction.mjs` and `pi/config/adaptive-transaction.mjs` are removed, and `config/simple-transaction.mjs` is now the documented configuration for `PI_SEM_MODE=transaction`.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Opt-in simple structural session policy for agents.** `pi/config/simple-transaction.mjs` packages batched exact reads, acknowledged context reuse, scoped edit composition and snapshot-checked edits without fixed discovery/transaction call quotas. Includes regression tests and setup instructions. This policy remains experimental, not a guarantee of faster sessions or semantic completeness.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Portable transaction startup and guarded batches.** The simple server starts without JeV credentials; external ranking requires explicit `SEM_JEV_ENABLED=1` plus credentials and task. Same-file exact-edit batches enforce intermediate snapshot guards and roll back earlier writes on a later edit error.
|
|
20
|
+
|
|
21
|
+
- Experimental structural-session adapter snapshot adds explicitly scoped reads and edit programs, batched discovery, bounded validation evidence, and timeout recovery. Retained as a research branch: benchmark timings vary with agent-selected validation workloads and do not establish a universal speedup.
|
|
22
|
+
- Text search includes eligible files without a structural parser (such as Objective-C++ `.mm` and custom build files), including alongside a warm structural index. Search responses preserve coverage limits separately from result pagination; binary content remains excluded.
|
|
23
|
+
|
|
24
|
+
- Simple transaction edits preserve overloaded entity selectors. Timed-out public checks retain partial diagnostics and restart their disposable checker so subsequent validation can proceed.
|
|
25
|
+
|
|
26
|
+
- Simple transaction read batches preserve valid results when another selector is malformed or a requested path is rejected as a symlink. Partial captures report their errors explicitly; strict capture and edit checks remain unchanged.
|
|
27
|
+
|
|
28
|
+
- **Copilot CLI can connect to the MCP server again.** Unsupported discovery probes return `Method not found` without closing the connection, allowing clients to fall back to `initialize` in both standalone and shared modes. Fixes #497.
|
|
29
|
+
- **Indexed name lookup sees renames and added definitions in edited files.** `sem find` checks indexed file freshness and reparses changed files on demand, without requiring a whole dependency-graph refresh. Includes TypeScript, Python and Rust regression coverage.
|
|
30
|
+
- **Dart dependency graphs now resolve ordinary calls, constructor-bound receivers and typed parameters.** Callers and refs no longer select a same-named Dart method for a TypeScript receiver (or vice versa); imported class owners take precedence. Persisted graph/query caches are invalidated so upgrades rebuild the affected edges. Fixes #491.
|
|
31
|
+
- **Shared MCP clients keep independent context history and stay bound to their repository.** Concurrent daemon startup is serialized with an OS lock, stale sockets recover after crashes, and handshakes are bounded. Adds `sem mcp --status` for health checks and reproducible lifecycle coverage on macOS and Linux.
|
|
32
|
+
- **Telemetry uploads are no longer rejected by the server.** 0.21.0 removed the install id from the upload payload while the ingest endpoint still required one, so every batch uploaded since then was refused and active-install counts only ever reflected 0.20.0 and older. Uploads now carry `hash(local seed + day number)`, where the seed is generated once, stays on the machine and is never sent, so a batch groups with the rest of that machine's day and with nothing before or after it. Telemetry is still local-by-default and opt-in, so this only changes the contents of an upload that someone enabled with `sem telemetry on`.
|
|
33
|
+
- **`sem setup` no longer reports success when part of it failed.** It writes the global `diff.external` config first, then installs the Claude Code hook and the pre-commit hook, and those two steps used to treat a permissions or JSON failure as a warning before falling through to a closing message that listed all three features as live and returned success. An unparseable `~/.claude/settings.json` therefore left changed git config, no hook, and a final line reading "sem is wired in". The closing summary is now built from the steps that actually ran, and a failed step reports what did and did not apply before exiting 2. The successful path is unchanged. Thanks to kantorcodes1 on Reddit for the report.
|
|
34
|
+
|
|
35
|
+
## [0.25.0] - 2026-09-13
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **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.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- **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).
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **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.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## [0.24.0] - 2026-08-23
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- **`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.
|
|
55
|
+
- **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.
|
|
56
|
+
- **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`.
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
|
|
60
|
+
- **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.
|
|
61
|
+
|
|
7
62
|
## [0.23.1] - 2026-08-22
|
|
8
63
|
|
|
9
64
|
### Fixed
|
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,27 @@ 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
|
-
|
|
475
|
+
On macOS and Linux, clients in the same checkout share a warm repository daemon.
|
|
476
|
+
Run `sem mcp --status` to check it. See the [shared runtime contract and reproducible benchmark](docs/shared-mcp.md)
|
|
477
|
+
for session isolation, fallback behavior, and current platform limits.
|
|
405
478
|
|
|
406
|
-
|
|
479
|
+
`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`.)
|
|
480
|
+
|
|
481
|
+
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
482
|
|
|
408
483
|
Add it once, then talk to your agent normally. It calls the tools on its own.
|
|
409
484
|
|
|
@@ -440,46 +515,56 @@ If `sem` isn't on the agent's PATH, use the absolute path to the binary. No sepa
|
|
|
440
515
|
sem diff --format json
|
|
441
516
|
```
|
|
442
517
|
|
|
518
|
+
Real output, from a one-line logic change to a Python function:
|
|
519
|
+
|
|
443
520
|
```json
|
|
444
521
|
{
|
|
445
522
|
"summary": {
|
|
446
|
-
"fileCount":
|
|
447
|
-
"added":
|
|
523
|
+
"fileCount": 1,
|
|
524
|
+
"added": 0,
|
|
448
525
|
"modified": 1,
|
|
449
|
-
"deleted":
|
|
526
|
+
"deleted": 0,
|
|
450
527
|
"moved": 0,
|
|
451
528
|
"renamed": 0,
|
|
452
529
|
"reordered": 0,
|
|
453
530
|
"binary": 0,
|
|
454
531
|
"orphan": 0,
|
|
455
|
-
"total":
|
|
532
|
+
"total": 1
|
|
456
533
|
},
|
|
457
534
|
"changes": [
|
|
458
535
|
{
|
|
459
|
-
"entityId": "
|
|
460
|
-
"changeType": "
|
|
536
|
+
"entityId": "auth.py::function::authenticate_user",
|
|
537
|
+
"changeType": "modified",
|
|
461
538
|
"entityType": "function",
|
|
462
|
-
"entityName": "
|
|
463
|
-
"startLine":
|
|
464
|
-
"endLine":
|
|
465
|
-
"oldStartLine":
|
|
466
|
-
"oldEndLine":
|
|
467
|
-
"
|
|
539
|
+
"entityName": "authenticate_user",
|
|
540
|
+
"startLine": 1,
|
|
541
|
+
"endLine": 6,
|
|
542
|
+
"oldStartLine": 1,
|
|
543
|
+
"oldEndLine": 4,
|
|
544
|
+
"oldEntityName": null,
|
|
545
|
+
"filePath": "auth.py",
|
|
546
|
+
"oldFilePath": null,
|
|
547
|
+
"oldParentId": null,
|
|
548
|
+
"beforeContent": "def authenticate_user(username, password):\n if not username or not password:\n return False\n return check_credentials(username, password)",
|
|
549
|
+
"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",
|
|
550
|
+
"commitSha": null,
|
|
551
|
+
"author": null,
|
|
552
|
+
"structuralChange": true
|
|
468
553
|
}
|
|
469
554
|
],
|
|
470
555
|
"binaryChanges": []
|
|
471
556
|
}
|
|
472
557
|
```
|
|
473
558
|
|
|
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.
|
|
559
|
+
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
560
|
|
|
476
561
|
## As a library
|
|
477
562
|
|
|
478
|
-
sem-core can be used as a Rust library dependency:
|
|
563
|
+
sem-core can be used as a Rust library dependency, from [crates.io](https://crates.io/crates/sem-core):
|
|
479
564
|
|
|
480
565
|
```toml
|
|
481
566
|
[dependencies]
|
|
482
|
-
sem-core =
|
|
567
|
+
sem-core = "0.23"
|
|
483
568
|
```
|
|
484
569
|
|
|
485
570
|
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 +575,21 @@ Used by [weave](https://github.com/Ataraxy-Labs/weave) (semantic merge driver) a
|
|
|
490
575
|
- **git2** for Git operations
|
|
491
576
|
- **rayon** for parallel file processing
|
|
492
577
|
- **xxhash** for structural hashing
|
|
493
|
-
-
|
|
578
|
+
- 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
|
|
579
|
+
- Plugin system for adding new languages and formats (see [CONTRIBUTING.md](CONTRIBUTING.md))
|
|
494
580
|
|
|
495
581
|
## Telemetry
|
|
496
582
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
Disable it any time:
|
|
583
|
+
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
584
|
|
|
501
585
|
```bash
|
|
502
|
-
|
|
586
|
+
sem telemetry preview # see current mode and exactly what would be sent
|
|
587
|
+
sem telemetry on # opt in: also upload counts to help improve sem
|
|
588
|
+
sem telemetry off # record nothing at all
|
|
503
589
|
```
|
|
504
590
|
|
|
591
|
+
`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.
|
|
592
|
+
|
|
505
593
|
## Contributing
|
|
506
594
|
|
|
507
595
|
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.26.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",
|