@ruso-0/nreki 10.7.3 → 10.11.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 CHANGED
@@ -2,6 +2,155 @@
2
2
 
3
3
  All notable changes to NREKI will be documented in this file.
4
4
 
5
+ ## v10.11.0 — Python Auto-Healing via basedpyright
6
+
7
+ ### Added
8
+ - **Python auto-healing now works** by switching the LSP engine to
9
+ basedpyright (fork of pyright that exposes auto-import quickfix
10
+ codeActions via standard LSP). When a user writes
11
+ `result = datetime.now()` without importing datetime, NREKI now
12
+ applies `from datetime import datetime` atomically in RAM before
13
+ the edit commits. Matches TypeScript auto-healing experience
14
+ ("feels like TS" — resolving reported user feedback).
15
+ - **Graceful fallback to pyright**: If basedpyright is not installed,
16
+ the sidecar falls back to pyright-langserver (validation only, no
17
+ healing) and emits a warning with install instructions. Zero
18
+ regression for users who have only pyright.
19
+ - **Anti-Sweep Shield in LSP healer**: The codeAction filter now
20
+ explicitly rejects suppression-style actions (`# pyright: ignore`,
21
+ `# noqa`, disable/suppress patterns) that would silence errors
22
+ rather than fix them. Previously "Add `# pyright: ignore[...]`"
23
+ would pass the filter because its title contains "add " — critical
24
+ architectural risk closed.
25
+
26
+ ### Changed
27
+ - `python-sidecar.ts` now detects basedpyright availability at boot
28
+ (synchronous check with 3s timeout) and chooses the appropriate
29
+ LSP server.
30
+ - Log output now shows which LSP engine was activated:
31
+ `"Python project detected. basedpyright-langserver sidecar registered."`
32
+ - Detection of basedpyright now passes a single-string command
33
+ (`"basedpyright --version"`) with `shell: true` to `spawnSync`.
34
+ This resolves the Windows `.cmd` shim (npm installs basedpyright
35
+ as `basedpyright.cmd`, and Node 18+ blocks direct `.cmd` spawn
36
+ under CVE-2024-27980) while avoiding the `DEP0190` deprecation
37
+ warning that fires when combining `shell: true` with an args
38
+ array. Without this, Windows users (majority of NREKI user base)
39
+ would silently fall back to pyright without auto-healing.
40
+ - `LspSidecarBase.boot()` now conditionally enables `shell: true`
41
+ on Windows when `command[0]` is a bare binary name (no path
42
+ separator). Required because the langserver spawn — not just
43
+ detection — hits the same CVE-2024-27980 block when launching
44
+ `.cmd` shims. Scoped to bare names so absolute paths with spaces
45
+ (e.g. `C:\Program Files\nodejs\node.exe` in mock sidecars) still
46
+ spawn directly without shell-concat breakage. Empirical verification
47
+ via `scripts/verify-basedpyright-spawn.ts` confirms
48
+ basedpyright-langserver now boots successfully on Windows (was
49
+ failing with ENOENT pre-fix).
50
+
51
+ ### Tests
52
+ - New test: `Anti-Sweep shield rejects suppression CodeActions
53
+ (ignore/noqa)` in tests/healer-atomic.test.ts. Total: 797 pass.
54
+
55
+ ### Installation
56
+ For Python auto-healing, install basedpyright globally:
57
+
58
+ npm install -g basedpyright
59
+
60
+ If already installed with pyright and conflicts occur:
61
+
62
+ npm install -g basedpyright --force
63
+
64
+ ### Version numbering note
65
+ Version 10.9.0 was reserved earlier for this release but skipped
66
+ during the v10.10.0 (multi-language parser) sprint. Jumping directly
67
+ to 10.11.0 to keep monotonic versioning.
68
+
69
+ ## v10.10.0 — Multi-language parser extensions + Python namespace inference
70
+
71
+ ### Added
72
+ - **Modern JS/TS extensions (.mjs, .cjs, .mts, .cts)** now fully
73
+ supported across parser, repo-map (PageRank graph), ast-navigator,
74
+ and imports extractor. Previously invisible to dependency graph.
75
+ - **Python flat imports** (`import X`, `import X.Y as Z`,
76
+ comma-separated `import A, B, C`) now extracted with alias
77
+ resolution.
78
+ - **Python namespace inference engine**: `import django.db.models as
79
+ db_models` followed by `db_models.Model` in body now correctly
80
+ extracts `Model` as symbol with `models` as pathHint, mirroring
81
+ the existing Go namespace-to-symbol pattern.
82
+ - **Token-budget shield for Python stdlib**: imports from os, sys,
83
+ re, json, time, math, datetime, typing, collections, itertools,
84
+ pathlib, functools, abc, asyncio, logging, copy, enum, hashlib,
85
+ random, string, threading, warnings, io are skipped from
86
+ auto-context injection. LLMs already know stdlib — injecting
87
+ signatures wastes tokens.
88
+
89
+ ### Notes
90
+ - v10.9.0 reserved for Python auto-healing (pyright codeAction
91
+ diagnostic + implementation). This release is a prerequisite:
92
+ auto-context now correctly feeds Python symbols to the model.
93
+ - Zero regression in existing TS/JS/Go tests.
94
+
95
+ ## v10.8.0 — Polyglot Kernel Fix
96
+
97
+ ### Fixed
98
+ - **Kernel and LSP sidecars now activate for Python-only and
99
+ Go-only projects.** Previously, `detectMode()` counted only
100
+ TS/JS files and returned "syntax" for Python/Go-only projects,
101
+ preventing kernel boot and sidecar (pyright/gopls) registration.
102
+ Users reported that Python and Go "didn't feel like TS" because
103
+ the kernel never ran.
104
+ - `TsCompilerWrapper.initConfig()` now degrades gracefully when no
105
+ `tsconfig.json`/`jsconfig.json` is found, initializing minimal
106
+ `compilerOptions` so the VFS and LSP sidecars can boot without
107
+ the TypeScript compiler crashing. The TS backend stays idle
108
+ while language-specific validation flows through sidecars.
109
+ - Kernel activation no longer requires `tsconfig.json`. Project
110
+ markers `pyproject.toml`, `requirements.txt`, `setup.py`,
111
+ `Pipfile`, `go.mod`, and `jsconfig.json` also trigger kernel
112
+ boot.
113
+
114
+ ### Changed
115
+ - Test `"should throw if tsconfig.json is missing"`
116
+ (tests/nreki-kernel.test.ts) updated to assert the new
117
+ polyglot fallback contract. Obsolete contract (throw on missing
118
+ tsconfig) replaced with graceful boot assertion.
119
+
120
+ ### Notes
121
+ - Pure TS/JS projects retain exact previous behavior. Zero
122
+ regression in existing test suite (794/794 pass).
123
+ - This fix is a prerequisite for v10.9.0 (Python auto-healing):
124
+ with the kernel now active for Python/Go projects, the next
125
+ step is diagnosing pyright's LSP codeAction behavior to enable
126
+ cross-language auto-heal.
127
+
128
+ ## v10.7.5 — Safe Uninstall Hotfix (P0 security fix)
129
+
130
+ ### Fixed
131
+ - **CRITICAL**: Added `npx @ruso-0/nreki deinit` command. Users who
132
+ previously ran `init` and then tried to `npm uninstall` would have
133
+ their Claude Code environment broken because the PreToolUse hooks in
134
+ `.claude/settings.json` would reference a deleted
135
+ `nreki-enforcer.mjs` script, blocking all native Read/Write/Edit
136
+ operations. Running `npx @ruso-0/nreki deinit` BEFORE `npm uninstall`
137
+ cleanly removes all NREKI hooks, restoring native tools.
138
+
139
+ ### Changed
140
+ - `--help` output updated to document the new `deinit` subcommand.
141
+
142
+ ### Notes
143
+ - This is a hotfix. Multi-client `init` support (Cursor, Windsurf,
144
+ Copilot, Cline, Codex) is planned for v10.8.0.
145
+
146
+ ## [10.7.4] - 2026-04-18
147
+
148
+ ### Changed
149
+ - Landing GIF rebuilt with cinematic pacing: line-by-line reveal, dramatic pauses before timing reveals (the `48ms` outline, the `67ms` Fiedler on 116 files). Total runtime 14.6s, 98 keyframes. Previous 10.7.3 GIF dumped all output in a single frame and looked static; this version reads like a live session an agent would actually experience.
150
+
151
+ ### Notes
152
+ Docs-only release. Library behavior identical to 10.7.1.
153
+
5
154
  ## [10.7.3] - 2026-04-18
6
155
 
7
156
  ### Fixed
package/README.md CHANGED
@@ -1,72 +1,72 @@
1
- # NREKI - Bulletproof Shield for AI Coding Agents
2
-
3
- <p align="center">
4
- <img src="https://img.shields.io/npm/v/@ruso-0/nreki?style=for-the-badge&color=blue" alt="npm version">
5
- <img src="https://img.shields.io/badge/Tests-783-brightgreen?style=for-the-badge" alt="783 Tests">
6
- <img src="https://img.shields.io/badge/AHI-9.7%2F10-brightgreen?style=for-the-badge" alt="AHI 9.7/10">
7
- <img src="https://img.shields.io/badge/Languages-TS%20%7C%20JS%20%7C%20Go%20%7C%20Python-blue?style=for-the-badge" alt="Multi-language">
8
- <img src="https://img.shields.io/badge/Cloud-Zero-orange?style=for-the-badge" alt="Zero Cloud">
9
- <img src="https://img.shields.io/badge/License-Apache_2.0-yellow?style=for-the-badge" alt="Apache 2.0">
10
- </p>
11
-
12
- **MCP plugin that validates AI agent edits in RAM before they touch disk.** When Claude Code, Cursor, or Copilot changes a function signature in one file and breaks 30 others, NREKI catches it in milliseconds - the file is never written. If the error is structural (missing import, forgotten `await`), NREKI auto-fixes it in RAM. Zero tokens wasted on fix-retry doom loops.
13
-
14
- **v10.7 - The NREKI Way.** Parasitic signals now ride inside `outline`: a defect radar flags LLM-rush patterns (`⚠️ [empty catch, any escape]`), a ghost oracle tags unreferenced exports (`👻 [0 ext refs]`), and engrams prefixed `ASSERT` survive code mutation. Zero added tokens per call - the signals live in surfaces the agent already reads.
15
-
16
- <p align="center"><img src="docs/demo.gif" alt="NREKI outline with defect + ghost tags"></p>
17
-
18
- ## Install
19
-
20
- ```bash
21
- # Claude Code
22
- claude mcp add nreki -- npx -y @ruso-0/nreki
23
-
24
- # Cursor / any MCP client - add to mcp.json:
25
- { "mcpServers": { "nreki": { "command": "npx", "args": ["-y", "@ruso-0/nreki"] } } }
26
-
27
- # Optional: installs CLAUDE.md instructions + CLI hook firewall
28
- npx @ruso-0/nreki init
29
- ```
30
-
31
- First run indexes the project automatically. Zero config for TS/JS; point a `tsconfig.json` at your code and NREKI detects the right validation mode.
32
-
33
- ## How it works
34
-
35
- ```
36
- AI proposes edit -> NREKI intercepts in RAM -> Compiler/LSP validates
37
- | |
38
- | No errors ----------------------> Two-Phase Atomic Commit to disk
39
- | Errors found --> Auto-Heal (TS CodeFix + LSP codeAction, atomic)
40
- | |
41
- | Fixed all? ---> Commit to disk
42
- | Some remain? -> Full rollback. Disk untouched. Errors returned to agent.
43
- ```
44
-
45
- Three tools (`nreki_navigate`, `nreki_code`, `nreki_guard`), 23 actions, 4 languages (TS/JS, Go via gopls, Python via pyright). Works with any MCP-compatible agent. Apache 2.0.
46
-
47
- ## Highlights
48
-
49
- - **Atomic multi-TextEdit healing.** When gopls or pyright proposes a quickfix with coupled edits (import + usage), NREKI applies every TextEdit of the chosen action together with per-file savepoints and bottom-up offset ordering. No more doom-loop retries where only the import lands and the usage stays broken.
50
- - **Tolerant Patch mode.** `nreki_code action:"edit" mode:"patch"` now retries with indent-flexible matching when the exact-indent search fails and the content is unique. The literal-`$` guarantee is preserved end-to-end (no V8 `$&` / `$$` substitution surprises).
51
- - **Cognitive Enforcer.** Agents can't `batch_edit` blindly - every edit in a batch is validated against a per-file passport (outline seen? symbol focused?). The v10.5.7 fix closed a bypass where 2+ edits could smuggle blind mutations through.
52
- - **TTRD Bounties.** Successful strict-type restoration reports the exact CFI (Continuous Friction Index) discount to the agent. Pavlovian reinforcement that actually quantifies what improved.
53
- - **Defect radar + ghost oracle.** Four inline detectors and a 0-ext-refs tagger run during `outline` - free signals, no extra tool call.
54
- - **Executable engrams.** Pin insights to symbols. Engrams prefixed `ASSERT` survive AST mutation; everything else invalidates on body change so memory can't go stale.
55
-
56
- ## Language support
57
-
58
- | Language | Validation | Auto-heal |
59
- |----------|------------|-----------|
60
- | TypeScript / JavaScript | Full (TS Compiler API) | TS CodeFix API |
61
- | Go | gopls LSP sidecar | codeAction (atomic) |
62
- | Python | pyright LSP sidecar | codeAction (atomic) |
63
-
64
- ## Docs & links
65
-
66
- - **[CHANGELOG.md](CHANGELOG.md)** - full version history (every patch, every release, every test count).
67
- - **[templates/CLAUDE.md](templates/CLAUDE.md)** - optimized instructions auto-installed by `npx @ruso-0/nreki init`.
68
- - **Issues / ideas** - GitHub Issues on this repo.
69
-
70
- ## License
71
-
72
- Apache 2.0. Zero cloud dependencies. Everything runs locally in the agent's process.
1
+ # NREKI - Bulletproof Shield for AI Coding Agents
2
+
3
+ <p align="center">
4
+ <img src="https://img.shields.io/npm/v/@ruso-0/nreki?style=for-the-badge&color=blue" alt="npm version">
5
+ <img src="https://img.shields.io/badge/Tests-783-brightgreen?style=for-the-badge" alt="783 Tests">
6
+ <img src="https://img.shields.io/badge/AHI-9.7%2F10-brightgreen?style=for-the-badge" alt="AHI 9.7/10">
7
+ <img src="https://img.shields.io/badge/Languages-TS%20%7C%20JS%20%7C%20Go%20%7C%20Python-blue?style=for-the-badge" alt="Multi-language">
8
+ <img src="https://img.shields.io/badge/Cloud-Zero-orange?style=for-the-badge" alt="Zero Cloud">
9
+ <img src="https://img.shields.io/badge/License-Apache_2.0-yellow?style=for-the-badge" alt="Apache 2.0">
10
+ </p>
11
+
12
+ **MCP plugin that validates AI agent edits in RAM before they touch disk.** When Claude Code, Cursor, or Copilot changes a function signature in one file and breaks 30 others, NREKI catches it in milliseconds - the file is never written. If the error is structural (missing import, forgotten `await`), NREKI auto-fixes it in RAM. Zero tokens wasted on fix-retry doom loops.
13
+
14
+ **v10.7 - The NREKI Way.** Parasitic signals now ride inside `outline`: a defect radar flags LLM-rush patterns (`⚠️ [empty catch, any escape]`), a ghost oracle tags unreferenced exports (`👻 [0 ext refs]`), and engrams prefixed `ASSERT` survive code mutation. Zero added tokens per call - the signals live in surfaces the agent already reads.
15
+
16
+ <p align="center"><img src="docs/demo.gif" alt="NREKI outline with defect + ghost tags"></p>
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ # Claude Code
22
+ claude mcp add nreki -- npx -y @ruso-0/nreki
23
+
24
+ # Cursor / any MCP client - add to mcp.json:
25
+ { "mcpServers": { "nreki": { "command": "npx", "args": ["-y", "@ruso-0/nreki"] } } }
26
+
27
+ # Optional: installs CLAUDE.md instructions + CLI hook firewall
28
+ npx @ruso-0/nreki init
29
+ ```
30
+
31
+ First run indexes the project automatically. Zero config for TS/JS; point a `tsconfig.json` at your code and NREKI detects the right validation mode.
32
+
33
+ ## How it works
34
+
35
+ ```
36
+ AI proposes edit -> NREKI intercepts in RAM -> Compiler/LSP validates
37
+ | |
38
+ | No errors ----------------------> Two-Phase Atomic Commit to disk
39
+ | Errors found --> Auto-Heal (TS CodeFix + LSP codeAction, atomic)
40
+ | |
41
+ | Fixed all? ---> Commit to disk
42
+ | Some remain? -> Full rollback. Disk untouched. Errors returned to agent.
43
+ ```
44
+
45
+ Three tools (`nreki_navigate`, `nreki_code`, `nreki_guard`), 23 actions, 4 languages (TS/JS, Go via gopls, Python via pyright). Works with any MCP-compatible agent. Apache 2.0.
46
+
47
+ ## Highlights
48
+
49
+ - **Atomic multi-TextEdit healing.** When gopls or pyright proposes a quickfix with coupled edits (import + usage), NREKI applies every TextEdit of the chosen action together with per-file savepoints and bottom-up offset ordering. No more doom-loop retries where only the import lands and the usage stays broken.
50
+ - **Tolerant Patch mode.** `nreki_code action:"edit" mode:"patch"` now retries with indent-flexible matching when the exact-indent search fails and the content is unique. The literal-`$` guarantee is preserved end-to-end (no V8 `$&` / `$$` substitution surprises).
51
+ - **Cognitive Enforcer.** Agents can't `batch_edit` blindly - every edit in a batch is validated against a per-file passport (outline seen? symbol focused?). The v10.5.7 fix closed a bypass where 2+ edits could smuggle blind mutations through.
52
+ - **TTRD Bounties.** Successful strict-type restoration reports the exact CFI (Continuous Friction Index) discount to the agent. Pavlovian reinforcement that actually quantifies what improved.
53
+ - **Defect radar + ghost oracle.** Four inline detectors and a 0-ext-refs tagger run during `outline` - free signals, no extra tool call.
54
+ - **Executable engrams.** Pin insights to symbols. Engrams prefixed `ASSERT` survive AST mutation; everything else invalidates on body change so memory can't go stale.
55
+
56
+ ## Language support
57
+
58
+ | Language | Validation | Auto-heal |
59
+ |----------|------------|-----------|
60
+ | TypeScript / JavaScript | Full (TS Compiler API) | TS CodeFix API |
61
+ | Go | gopls LSP sidecar | codeAction (atomic) |
62
+ | Python | pyright LSP sidecar | codeAction (atomic) |
63
+
64
+ ## Docs & links
65
+
66
+ - **[CHANGELOG.md](CHANGELOG.md)** - full version history (every patch, every release, every test count).
67
+ - **[templates/CLAUDE.md](templates/CLAUDE.md)** - optimized instructions auto-installed by `npx @ruso-0/nreki init`.
68
+ - **Issues / ideas** - GitHub Issues on this repo.
69
+
70
+ ## License
71
+
72
+ Apache 2.0. Zero cloud dependencies. Everything runs locally in the agent's process.
@@ -10,7 +10,7 @@ import path from "path";
10
10
  import { shouldProcess } from "./utils/file-filter.js";
11
11
  import { readSource } from "./utils/read-source.js";
12
12
  // ─── Constants ──────────────────────────────────────────────────────
13
- const SUPPORTED_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".go"]);
13
+ const SUPPORTED_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".py", ".go"]);
14
14
  const IGNORE_DIRS = new Set([
15
15
  "node_modules", "dist", "build", ".git", "coverage",
16
16
  ".next", "__pycache__", ".nreki",
@@ -1 +1 @@
1
- {"version":3,"file":"ast-navigator.js","sourceRoot":"","sources":["../src/ast-navigator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAwBpD,uEAAuE;AAEvE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAEnF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU;IACnD,OAAO,EAAE,aAAa,EAAE,QAAQ;CACnC,CAAC,CAAC;AAEH,0CAA0C;AAC1C,MAAM,iBAAiB,GAA2B;IAC9C,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,MAAM;CACpB,CAAC;AAEF,uEAAuE;AAEvE,SAAS,SAAS,CAAC,OAAe;IAC9B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;QACzB,IAAI,OAAoB,CAAC;QACzB,IAAI,CAAC;YACD,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,CAAC;QAAC,MAAM,CA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@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG;AA6CH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CA8BlF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG;AA6CH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAgDlF"}
package/dist/index.js CHANGED
@@ -35,6 +35,13 @@ import { logger } from "./utils/logger.js";
35
35
  // Array.shift() is O(N) in V8 because it reindexes the contiguous memory block.
36
36
  // Do not change pop() to shift().
37
37
  export function detectMode(dir) {
38
+ // Multi-lang project markers: presence forces kernel ON even when
39
+ // TS/JS file count is 0 (Python-only, Go-only projects).
40
+ const multiLangMarkers = [
41
+ "pyproject.toml", "requirements.txt", "setup.py", "Pipfile",
42
+ "go.mod",
43
+ ];
44
+ const hasMultiLangMarker = multiLangMarkers.some(m => fs.existsSync(path.join(dir, m)));
38
45
  let count = 0;
39
46
  const stack = [dir];
40
47
  const ignore = new Set(["node_modules", "dist", "build", ".git", ".next", "coverage"]);
@@ -61,12 +68,19 @@ export function detectMode(dir) {
61
68
  }
62
69
  }
63
70
  }
64
- // Escala por costo computacional: syntax < file < project < hologram
71
+ // With multi-lang marker: never return "syntax" force kernel ON
72
+ // in "file" mode so LSP sidecars register and validate per-file.
73
+ if (hasMultiLangMarker) {
74
+ if (count <= 200)
75
+ return "file";
76
+ return "project";
77
+ }
78
+ // Original behavior for pure TS/JS projects
65
79
  if (count < 50)
66
- return "syntax"; // O(0) - AST parsing only, kernel off
80
+ return "syntax";
67
81
  if (count <= 200)
68
- return "file"; // O(K) - Semantic checks on touched files only
69
- return "project"; // O(N) - Full cascade evaluation
82
+ return "file";
83
+ return "project";
70
84
  }
71
85
  // ─── CLI Flag Parsing ───────────────────────────────────────────────
72
86
  const args = process.argv.slice(2);
@@ -82,6 +96,7 @@ NREKI v${VERSION} - Semantic validation for Claude Code
82
96
  Usage:
83
97
  npx @ruso-0/nreki [options]
84
98
  npx @ruso-0/nreki init # Creates optimal CLAUDE.md instructions
99
+ npx @ruso-0/nreki deinit # Safely removes NREKI hooks before npm uninstall
85
100
 
86
101
  Options:
87
102
  --enable-embeddings Enable local ONNX semantic search (Pro mode)
@@ -91,6 +106,85 @@ Options:
91
106
  process.exit(0);
92
107
  }
93
108
  const enableEmbeddings = args.includes("--enable-embeddings");
109
+ // ─── Uninstall Subcommand (deinit) ───────────────────────────────
110
+ // Safely removes NREKI hooks before npm uninstall to prevent
111
+ // orphaned PreToolUse references from bricking Claude Code tools.
112
+ // Idempotent — safe to run multiple times or when nothing is installed.
113
+ if (args[0] === "deinit") {
114
+ logger.info("Uninstalling NREKI hooks and configuration...");
115
+ const cwd = process.cwd();
116
+ let modified = false;
117
+ // 1. Clean settings.json — remove PreToolUse entries referencing nreki-enforcer
118
+ const claudeSettingsPath = path.join(cwd, ".claude", "settings.json");
119
+ if (fs.existsSync(claudeSettingsPath)) {
120
+ try {
121
+ const raw = fs.readFileSync(claudeSettingsPath, "utf-8").replace(/^\uFEFF/, "");
122
+ const settings = JSON.parse(raw);
123
+ if (settings?.hooks?.PreToolUse && Array.isArray(settings.hooks.PreToolUse)) {
124
+ const originalLen = settings.hooks.PreToolUse.length;
125
+ settings.hooks.PreToolUse = settings.hooks.PreToolUse.filter((h) => {
126
+ if (!h.hooks || !Array.isArray(h.hooks))
127
+ return true;
128
+ return !h.hooks.some((cmd) => typeof cmd.command === "string" && cmd.command.includes("nreki-enforcer.mjs"));
129
+ });
130
+ if (settings.hooks.PreToolUse.length !== originalLen) {
131
+ if (settings.hooks.PreToolUse.length === 0)
132
+ delete settings.hooks.PreToolUse;
133
+ if (settings.hooks && Object.keys(settings.hooks).length === 0)
134
+ delete settings.hooks;
135
+ fs.writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 2), "utf-8");
136
+ logger.info("Removed NREKI hooks from .claude/settings.json");
137
+ modified = true;
138
+ }
139
+ }
140
+ }
141
+ catch (err) {
142
+ logger.error(`Failed to clean settings.json: ${err.message}`);
143
+ }
144
+ }
145
+ // 2. Delete enforcer hook script
146
+ const hookPath = path.join(cwd, ".claude", "hooks", "nreki-enforcer.mjs");
147
+ if (fs.existsSync(hookPath)) {
148
+ try {
149
+ fs.unlinkSync(hookPath);
150
+ logger.info("Deleted .claude/hooks/nreki-enforcer.mjs");
151
+ modified = true;
152
+ }
153
+ catch (err) {
154
+ logger.error(`Failed to delete hook script: ${err.message}`);
155
+ }
156
+ }
157
+ // 3. Clean CLAUDE.md — strip only NREKI block, preserve user's own rules
158
+ const claudeMdPath = path.join(cwd, "CLAUDE.md");
159
+ if (fs.existsSync(claudeMdPath)) {
160
+ try {
161
+ const content = fs.readFileSync(claudeMdPath, "utf-8").replace(/^\uFEFF/, "");
162
+ const markerIndex = content.indexOf("# NREKI ACTIVE");
163
+ if (markerIndex !== -1) {
164
+ const cleanedContent = content.substring(0, markerIndex).trim();
165
+ if (cleanedContent === "") {
166
+ fs.unlinkSync(claudeMdPath);
167
+ logger.info("Deleted empty CLAUDE.md");
168
+ }
169
+ else {
170
+ fs.writeFileSync(claudeMdPath, cleanedContent + "\n", "utf-8");
171
+ logger.info("Removed NREKI instructions from CLAUDE.md");
172
+ }
173
+ modified = true;
174
+ }
175
+ }
176
+ catch (err) {
177
+ logger.error(`Failed to clean CLAUDE.md: ${err.message}`);
178
+ }
179
+ }
180
+ if (modified) {
181
+ logger.info("NREKI deinit complete. Your environment is clean.");
182
+ }
183
+ else {
184
+ logger.info("No active NREKI configuration found. Nothing to clean.");
185
+ }
186
+ process.exit(0);
187
+ }
94
188
  // ─── Init Subcommand ────────────────────────────────────────────────
95
189
  if (args[0] === "init") {
96
190
  const claudePath = path.join(process.cwd(), "CLAUDE.md");
@@ -160,44 +254,54 @@ const monitor = new TokenMonitor();
160
254
  const sandbox = new AstSandbox();
161
255
  const circuitBreaker = new CircuitBreaker();
162
256
  const chronos = new ChronosMemory(process.cwd());
163
- // ─── NREKI Kernel (opt-in: only activates if tsconfig.json exists) ───
257
+ // ─── NREKI Kernel & Sidecars (Multi-Language Auto-Detect) ──────────
164
258
  let kernel;
165
259
  let nrekiMode = "syntax";
166
- const tsconfigPath = path.join(process.cwd(), "tsconfig.json");
167
- if (fs.existsSync(tsconfigPath)) {
168
- nrekiMode = detectMode(process.cwd());
260
+ const cwd = process.cwd();
261
+ const hasTsConfig = fs.existsSync(path.join(cwd, "tsconfig.json")) ||
262
+ fs.existsSync(path.join(cwd, "jsconfig.json"));
263
+ const hasGoProject = fs.existsSync(path.join(cwd, "go.mod"));
264
+ const pyMarkers = ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"];
265
+ const hasPyProject = pyMarkers.some(f => fs.existsSync(path.join(cwd, f)));
266
+ if (hasTsConfig || hasPyProject || hasGoProject) {
267
+ nrekiMode = detectMode(cwd);
169
268
  if (nrekiMode === "syntax") {
170
269
  logger.info("SYNTAX mode. Kernel disabled. Layer 1 AST only.");
171
270
  }
172
271
  else {
173
- logger.info(`${nrekiMode.toUpperCase()} mode detected. Kernel boots on first edit.`);
174
- kernel = new NrekiKernel(); // Instantiated but NOT booted
272
+ const envs = [
273
+ hasTsConfig ? "TS/JS" : "",
274
+ hasPyProject ? "Python" : "",
275
+ hasGoProject ? "Go" : "",
276
+ ].filter(Boolean).join(", ");
277
+ logger.info(`${nrekiMode.toUpperCase()} mode detected (${envs}). Kernel boots on first edit.`);
278
+ kernel = new NrekiKernel();
175
279
  }
176
280
  }
177
281
  else {
178
- logger.info("No tsconfig.json found. Semantic verification disabled. " +
179
- "Operating in Tree-sitter-only mode (Layer 1).");
282
+ logger.info("No project markers found (tsconfig.json / pyproject.toml / go.mod). " +
283
+ "Semantic verification disabled. Operating in Tree-sitter-only mode (Layer 1).");
180
284
  }
181
285
  // ─── LSP Sidecars (auto-detect Go and Python projects) ──────────
286
+ // Keep awaited sequential imports — prevents race condition where
287
+ // first edit arrives before sidecar is registered.
182
288
  if (kernel) {
183
- // Go: detect go.mod → register gopls sidecar
184
- if (fs.existsSync(path.join(process.cwd(), "go.mod"))) {
289
+ if (hasGoProject) {
185
290
  try {
186
291
  const { GoLspSidecar } = await import("./kernel/backends/go-sidecar.js");
187
- kernel.registerSidecar(".go", new GoLspSidecar(process.cwd()));
292
+ kernel.registerSidecar(".go", new GoLspSidecar(cwd));
188
293
  logger.info("Go project detected (go.mod). gopls sidecar registered.");
189
294
  }
190
295
  catch (err) {
191
296
  logger.error(`Failed to load Go sidecar: ${err.message}`);
192
297
  }
193
298
  }
194
- // Python: detect pyproject.toml, requirements.txt, setup.py, Pipfile → register pyright sidecar
195
- const pyMarkers = ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"];
196
- if (pyMarkers.some(f => fs.existsSync(path.join(process.cwd(), f)))) {
299
+ if (hasPyProject) {
197
300
  try {
198
301
  const { PythonLspSidecar } = await import("./kernel/backends/python-sidecar.js");
199
- kernel.registerSidecar(".py", new PythonLspSidecar(process.cwd()));
200
- logger.info("Python project detected. pyright sidecar registered.");
302
+ const pySidecar = new PythonLspSidecar(cwd);
303
+ kernel.registerSidecar(".py", pySidecar);
304
+ logger.info(`Python project detected. ${pySidecar.command[0]} sidecar registered.`);
201
305
  }
202
306
  catch (err) {
203
307
  logger.error(`Failed to load Python sidecar: ${err.message}`);