diffctx 1.12.2 → 1.12.3

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/README.md CHANGED
@@ -27,6 +27,9 @@ changed lines and stops once more context stops paying for itself.
27
27
  | Python API | ✗ | ✗ | ✗ | ✓ |
28
28
  | MCP server | ✗ | ✗ | ✗ | ✓ |
29
29
 
30
+ Fuller positioning — measured results, and when a whole-repo packer or a
31
+ persistent code-graph server fits better: [COMPARISON.md](COMPARISON.md).
32
+
30
33
  ## Install
31
34
 
32
35
  ```bash
@@ -44,6 +47,13 @@ npx diffctx . --diff HEAD~1 # npm wrapper over the native binary
44
47
  docker run --rm -v "$PWD:/repo" ghcr.io/nikolay-e/diffctx . --diff HEAD~1
45
48
  ```
46
49
 
50
+ On Windows, via Scoop (this repository is the bucket):
51
+
52
+ ```powershell
53
+ scoop bucket add diffctx https://github.com/nikolay-e/diffctx
54
+ scoop install diffctx/diffctx
55
+ ```
56
+
47
57
  The image runs as a non-root user (uid 10001) and writes to stdout — the
48
58
  native binary has no `-o` flag, so redirect to capture: `... --diff HEAD~1 >
49
59
  context.yaml`.
@@ -80,11 +90,12 @@ the `--budget` token cap is hit.
80
90
  | Flag | Default | Description |
81
91
  |-------------|---------|--------------------------------------------------------------------------|
82
92
  | `--scoring` | `ego` | `ego` = bounded expansion around changed nodes (fast, predictable radius); `ppr` = Personalized PageRank (global, smoother decay, slower); `bm25` = lexical retrieval against the diff hunks (baseline for sparse graphs) |
83
- | `--budget` | auto | Hard token cap: `N` enforces a fixed cap, `-1` disables it, `0` is a strict-zero floor (empty selection; use `--full` for changed files only) |
93
+ | `--budget` | auto | Hard cap in o200k_base tokens (see [Token counting](docs/product/token-budget.md)): `N` enforces a fixed cap, `-1` disables it, `0` is a strict-zero floor (empty selection; use `--full` for changed files only) |
84
94
  | `--alpha` | 0.60 | PPR damping; higher = context clusters tighter around changes (`--scoring ppr` only) |
85
95
  | `--tau` | 0.12 | Relevance threshold for full fragment content; lower-scoring fragments are stubbed or dropped (lower = more context) |
86
96
  | `--full` | false | Only the changed files, every fragment, no related-code context |
87
97
  | `--timeout` | 300 | Wall-clock deadline in seconds; on expiry diffctx exits 124 instead of hanging |
98
+ | `--with-raw-diff` | false | Also embed git's raw unified diff ahead of the selected fragments — additive (selection unchanged), not charged to `--budget`, lock/ignored/secret-like sections omitted. Python CLI only |
88
99
 
89
100
  Calibration of `--alpha`, `--tau`, and the edge-weight priors:
90
101
  [`docs/engineering/parameter-strategy.md`](docs/engineering/parameter-strategy.md).
@@ -108,19 +119,20 @@ diffctx graph . --level file -f graphml -o g.xml # file-level graph as GraphML
108
119
  <!-- BEGIN USAGE -->
109
120
  ```bash
110
121
  # full codebase export:
111
- diffctx . # Markdown to stdout + token count
112
- diffctx . -f md -c # Markdown → clipboard
113
- diffctx . -f json -o tree.json # JSON → file
114
- diffctx . --no-content # structure only, no file contents
115
- diffctx . --max-depth 3 # limit depth
116
- diffctx . -i custom.ignore # custom ignore patterns
122
+ diffctx . # Markdown to stdout + token count
123
+ diffctx . -f md -c # Markdown → clipboard
124
+ diffctx . -f json -o tree.json # JSON → file
125
+ diffctx . --no-content # structure only, no file contents
126
+ diffctx . --max-depth 3 # limit depth
127
+ diffctx . -i custom.ignore # custom ignore patterns
117
128
 
118
129
  # diff context mode (requires git repo):
119
- diffctx . --diff # uncommitted changes (working tree vs HEAD)
120
- diffctx . --diff HEAD~1 # context for last commit
121
- diffctx . --diff main..feature # context for feature branch
122
- diffctx . --diff HEAD~1 --budget 30000 # limit to ~30k tokens
123
- diffctx . --diff HEAD~1 -c # diff context to clipboard
130
+ diffctx . --diff # uncommitted changes (working tree vs HEAD)
131
+ diffctx . --diff HEAD~1 # context for last commit
132
+ diffctx . --diff main..feature # context for feature branch
133
+ diffctx . --diff HEAD~1 --budget 30000 # limit to ~30k tokens
134
+ diffctx . --diff HEAD~1 -c # diff context to clipboard
135
+ diffctx . --diff HEAD~1 --with-raw-diff # raw patch + selected context
124
136
  ```
125
137
  <!-- END USAGE -->
126
138
 
@@ -131,6 +143,11 @@ Every run reports token count and size on stderr — `12,847 tokens
131
143
  `<binary file: N bytes>`, `<file too large: N bytes>`, or
132
144
  `<unreadable content: not utf-8>`.
133
145
 
146
+ Counts come from tiktoken's `o200k_base` encoder and are exact only for the
147
+ GPT-4o family; Claude, Gemini and others tokenize differently, so treat
148
+ `--budget` as an upper bound in o200k tokens and leave headroom. Details:
149
+ [`docs/product/token-budget.md`](docs/product/token-budget.md).
150
+
134
151
  ## Python API
135
152
 
136
153
  ```python
@@ -146,6 +163,7 @@ ctx = build_diff_context(
146
163
  full=False,
147
164
  scoring_mode="ego",
148
165
  timeout=300,
166
+ with_raw_diff=False, # True also embeds the raw unified diff (not charged to budget)
149
167
  )
150
168
  print(to_markdown(ctx))
151
169
 
@@ -186,6 +204,12 @@ anchored `/root_only.txt`). `.diffctx/whitelist` acts as an include-only filter,
186
204
  and the output file is always auto-ignored. `--no-default-ignores` disables the
187
205
  built-in patterns; `--no-ignores` disables all ignore rules (tree mode only).
188
206
 
207
+ An excluded path never appears in the output in any role: in diff mode it is
208
+ dropped both from `changed_files` and from the candidate universe, so it cannot
209
+ come back as a related-context fragment either (including under `--full`). The
210
+ same guarantee covers secret-like paths (`id_rsa`, `*.pem`, `*.key`, ...),
211
+ which are filtered even without an ignore entry.
212
+
189
213
  ## Token cache
190
214
 
191
215
  Diff mode caches per-blob tokenization under
@@ -235,6 +259,12 @@ Apache 2.0
235
259
 
236
260
  - [Documentation site](https://nikolay-e.github.io/diffctx/) — the pipeline
237
261
  end to end: diff → fragments → graph → relevance → selection
262
+ - [GitHub Action](docs/product/github-action.md) — diff context as a CI step
263
+ for LLM review
264
+ - [Token counting](docs/product/token-budget.md) — which encoder, and what
265
+ `--budget` means for non-GPT models
266
+ - [Comparison](COMPARISON.md) — measured results, and when a whole-repo packer
267
+ or a persistent code-graph server fits better
238
268
  - [Changelog](CHANGELOG.md)
239
269
  - [Security policy](SECURITY.md) — threat model and vulnerability reporting
240
270
  - [Parameter strategy](docs/engineering/parameter-strategy.md) — how `--alpha`,
package/checksums.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "diffctx-1.12.2-aarch64-apple-darwin.tar.gz": "fa575452f5120305c7a6c2ce2abd9bc58b93a775fbe430c740f54c5646379295",
3
- "diffctx-1.12.2-aarch64-unknown-linux-gnu.tar.gz": "c36b6a56241f96a410f291b5069001adf075fa0fbce152818d0ae8eab2af00cc",
4
- "diffctx-1.12.2-x86_64-pc-windows-msvc.zip": "f2d063f64d9b4b23c28efa9b87e7d18aa57947e75c5fbe37eba99824e03eebfc",
5
- "diffctx-1.12.2-x86_64-unknown-linux-gnu.tar.gz": "3faa5da74a60e3289a4f86110be397a80b4733ca3d0655e999c0bd53a679197b"
2
+ "diffctx-1.12.3-aarch64-apple-darwin.tar.gz": "d62da2cd29e08130dc82936080d0b5734dc91bf392b9d7beb7696d7869bbd56c",
3
+ "diffctx-1.12.3-aarch64-unknown-linux-gnu.tar.gz": "a064e1edf242ddd448d8ed12445dacdcc32c5084ee82c62d54854e3b6b15abca",
4
+ "diffctx-1.12.3-x86_64-pc-windows-msvc.zip": "daf1064d4a4983305812443f79cb9a3d350c53468a513a127a4d5f079a19489c",
5
+ "diffctx-1.12.3-x86_64-unknown-linux-gnu.tar.gz": "83019a9eb2fa8a49eaa7999f5f6f9d88c72a88719c6ab456135ef0ed38f6f7fa"
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "diffctx",
3
3
  "mcpName": "io.github.nikolay-e/diffctx",
4
- "version": "1.12.2",
4
+ "version": "1.12.3",
5
5
  "description": "Selects the minimum code an LLM needs to review a git diff",
6
6
  "keywords": [
7
7
  "git",