@bglocation/tune-context 2.0.0 → 2.0.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bglocation",
3
- "description": "Context-engineering tooling for Claude Code from bglocation token-saving doctrine, configurators and semantic-search wiring.",
3
+ "description": "Context-engineering tooling for Claude Code from bglocation \u2014 token-saving doctrine, configurators and semantic-search wiring.",
4
4
  "owner": {
5
5
  "name": "Szymon Walczak",
6
6
  "url": "https://bglocation.dev"
@@ -10,7 +10,7 @@
10
10
  "name": "tune-context",
11
11
  "source": "./",
12
12
  "description": "Context-efficiency configurator for Claude Code: doctrine skills (token-efficiency, caveman, cdd, phase-workflow) plus a tune-context configurator that scaffolds a lean CLAUDE.md, subagents, settings and hooks.",
13
- "version": "2.0.0",
13
+ "version": "2.0.1",
14
14
  "author": {
15
15
  "name": "Szymon Walczak",
16
16
  "url": "https://bglocation.dev"
@@ -2,7 +2,7 @@
2
2
  "name": "tune-context",
3
3
  "displayName": "tune-context",
4
4
  "description": "Context-efficiency configurator for Claude Code: doctrine skills (token-efficiency, caveman, cdd, phase-workflow) plus a tune-context configurator that scaffolds a lean CLAUDE.md, subagents, settings and hooks.",
5
- "version": "2.0.0",
5
+ "version": "2.0.1",
6
6
  "author": {
7
7
  "name": "Szymon Walczak",
8
8
  "url": "https://bglocation.dev"
package/CHANGELOG.md CHANGED
@@ -5,6 +5,46 @@ All notable changes to `@bglocation/tune-context` are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.1] — 2026-07-26
9
+
10
+ ### Fixed
11
+
12
+ - **The npm-installed CLI did nothing at all in 2.0.0.** `npm i -g` puts the
13
+ `bin` entry on PATH as a symlink named `tune-context`, with no extension, but
14
+ 2.0.0's entry-point guard tested `process.argv[1].endsWith('tune-context.mjs')`.
15
+ That is false for the symlink, so `main()` never ran: every command —
16
+ `init`, `--version`, `--help` — exited 0 without printing a byte or touching a
17
+ file. Now compares resolved real paths, which holds for the npm symlink, a
18
+ direct `.mjs` invocation, the extensionless `bin/tune-context` wrapper (still
19
+ exactly one run, not two) and `import` from a test.
20
+ - Only the npm channel was affected. Plugin installs call `bin/tune-context`,
21
+ which invokes `main()` itself, and the hooks are always registered by literal
22
+ path — both kept working.
23
+
24
+ ### Testing
25
+
26
+ - The suite spawned `.../bin/tune-context.mjs` everywhere, which is the one shape
27
+ no user ever runs; that is why 119 green tests said nothing about a completely
28
+ dead CLI. Added a test that installs the binary the way npm does — through an
29
+ extensionless symlink — and asserts a silent exit 0 is a failure.
30
+
31
+ ### Upgrading from 2.0.0 (npm channel)
32
+
33
+ Upgrading is not enough on its own. If you ran `tune-context init` under 2.0.0
34
+ it exited 0 and looked like it worked, but **nothing was installed** — so
35
+ `~/.claude/hooks/context-reminder.mjs` is missing and the `UserPromptSubmit`
36
+ hook was never registered. Re-run it after upgrading:
37
+
38
+ ```bash
39
+ npm i -g @bglocation/tune-context@2.0.1
40
+ tune-context --version # must print 2.0.1 — silence means the upgrade did not take
41
+ tune-context init
42
+ ```
43
+
44
+ The `init` is idempotent and additive: it never removes a hook or permission
45
+ entry, and never touches content outside the managed blocks. Plugin-only
46
+ installs were unaffected and need nothing.
47
+
8
48
  ## [2.0.0] — 2026-07-25
9
49
 
10
50
  Three hardening epics' worth of work plus the first new feature since 1.0: a
@@ -16,7 +16,7 @@
16
16
  // "No model in the loop" is the feature here, not a gap — but the gap has to be
17
17
  // stated, or a CLI user cannot know what they did not get. Run the skill
18
18
  // (/tune-context) for the full pass.
19
- import { readFileSync } from 'node:fs';
19
+ import { readFileSync, realpathSync } from 'node:fs';
20
20
  import { dirname, join, resolve } from 'node:path';
21
21
  import { fileURLToPath } from 'node:url';
22
22
  import { claudeDirs, detectExistingConfig, detectMcpServers, detectRejectedMcpServers, detectStack } from '../cli/detect.mjs';
@@ -173,11 +173,37 @@ export function main() {
173
173
  }
174
174
  }
175
175
 
176
- // Guarded so importing this file for parseArgs/main (tests, or the
177
- // extensionless bin/tune-context wrapper) never runs the CLI as a side
178
- // effect of the import only direct invocation of THIS file does. The
179
- // wrapper has a different argv[1] (its own path), so it calls main()
180
- // explicitly instead of relying on this check.
181
- if (process.argv[1] && process.argv[1].endsWith('tune-context.mjs')) {
176
+ /**
177
+ * True only when THIS file is the process entry point, so importing it for
178
+ * parseArgs/main (tests, or the extensionless bin/tune-context wrapper) never
179
+ * runs the CLI as a side effect of the import.
180
+ *
181
+ * Deliberately NOT a filename-suffix test on argv[1]. npm installs the
182
+ * package.json `bin` entry as a symlink named `tune-context` — no extension —
183
+ * so `argv[1].endsWith('tune-context.mjs')` was false for every real npm-channel
184
+ * invocation: main() never ran and the CLI exited 0 in total silence. That
185
+ * shipped in 2.0.0 (see the symlink test in test/bin-tune-context.test.mjs);
186
+ * the whole suite missed it because tests and smoke:init both spawn the full
187
+ * `.../bin/tune-context.mjs` path, which is the one shape a user never uses.
188
+ *
189
+ * Comparing resolved real paths holds for all four shapes: direct `.mjs`
190
+ * invocation, the npm symlink (resolves THROUGH the link to this file), the
191
+ * extensionless wrapper (a different real path, so this stays false and the
192
+ * wrapper's own main() call is the single entry — no double run), and `import`
193
+ * from a test (argv[1] is the test runner). realpathSync on both sides also
194
+ * survives a symlinked package dir, as `npm link` and nvm both produce.
195
+ */
196
+ function isEntryPoint() {
197
+ if (!process.argv[1]) return false;
198
+ try {
199
+ return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
200
+ } catch {
201
+ // argv[1] can name something unresolvable (deleted, or a bare `-`); a CLI
202
+ // that cannot identify its own entry point must stay silent, not crash.
203
+ return false;
204
+ }
205
+ }
206
+
207
+ if (isEntryPoint()) {
182
208
  main();
183
209
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bglocation/tune-context",
3
- "version": "2.0.0",
4
- "description": "Context-efficiency configurator for Claude Code token-saving doctrine packaged as skills, plus a tune-context configurator that scaffolds a lean CLAUDE.md, doctrine skills, subagents, settings, hooks and MCP wiring.",
3
+ "version": "2.0.1",
4
+ "description": "Context-efficiency configurator for Claude Code \u2014 token-saving doctrine packaged as skills, plus a tune-context configurator that scaffolds a lean CLAUDE.md, doctrine skills, subagents, settings, hooks and MCP wiring.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Szymon Walczak",