gitnexus 1.6.10-rc.1 → 1.6.10-rc.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
@@ -43,13 +43,13 @@ To configure MCP for your editor, run `npx gitnexus setup` once — or set it up
43
43
  | **Claude Code** | Yes | Yes | Yes (PreToolUse + PostToolUse) | **Full** |
44
44
  | **Cursor** | Yes | Yes | Yes (postToolUse, [manual install](../gitnexus-cursor-integration/README.md#hook-install)) | **Full** |
45
45
  | **Antigravity** (Google) | Yes | Yes | Yes (AfterTool, [Gemini CLI hooks schema](https://geminicli.com/docs/hooks/reference/)) | **Full** |
46
- | **Codex** | Yes | Yes | — | MCP + Skills |
46
+ | **Codex** | Yes | Yes | Yes (PreToolUse + PostToolUse, [Codex hooks](https://developers.openai.com/codex/hooks)) | **Full** |
47
47
  | **OpenCode** | Yes | Yes | — | MCP + Skills |
48
48
  | **CodeBuddy** (Tencent) | Yes | Yes | — | MCP + Skills |
49
49
  | **Qoder** (Alibaba) | Yes | Yes | — | MCP + Skills |
50
50
  | **Windsurf** | Yes | — | — | MCP |
51
51
 
52
- > **Claude Code** gets the deepest integration: MCP tools + agent skills + PreToolUse hooks that automatically enrich grep/glob/bash calls with knowledge graph context + PostToolUse hooks that detect a stale index after commits and prompt the agent to reindex.
52
+ > **Claude Code** and **Codex** get the deepest integration: MCP tools + agent skills + PreToolUse hooks that automatically enrich grep/glob/bash calls with knowledge graph context + PostToolUse hooks that detect a stale index after commits and prompt the agent to reindex.
53
53
 
54
54
  ### Community Integrations
55
55
 
@@ -71,12 +71,23 @@ claude mcp add gitnexus -- npx -y gitnexus@latest mcp
71
71
  claude mcp add gitnexus -- cmd /c npx -y gitnexus@latest mcp
72
72
  ```
73
73
 
74
- ### Codex (full support — MCP + skills)
74
+ ### Codex (full support — MCP + skills + hooks)
75
75
 
76
76
  ```bash
77
77
  codex mcp add gitnexus -- npx -y gitnexus@latest mcp
78
78
  ```
79
79
 
80
+ Codex hooks (PreToolUse graph enrichment + PostToolUse stale-index detection in `~/.codex/hooks.json`, [same schema as Claude Code](https://developers.openai.com/codex/hooks)) need the bundled adapter script, so they are installed by `gitnexus setup -c codex` rather than manually.
81
+
82
+ Alternatively, install everything as a [Codex plugin](https://developers.openai.com/codex/plugins/build) (MCP + skills + hooks in one step):
83
+
84
+ ```bash
85
+ codex plugin marketplace add abhigyanpatwari/GitNexus
86
+ # then inside Codex: /plugins → install "GitNexus"
87
+ ```
88
+
89
+ > **Codex notes:** SessionStart is intentionally not registered — Codex reads [AGENTS.md natively](https://developers.openai.com/codex/guides/agents-md), which already carries the GitNexus context block. Newly installed hooks need a one-time approval in Codex via `/hooks` before they run. Pick **one** install route (`gitnexus setup -c codex` **or** the plugin): plugin hooks load alongside `~/.codex/hooks.json`, so installing both can fire duplicate hooks per tool call.
90
+
80
91
  ### Cursor / Windsurf
81
92
 
82
93
  Add to `~/.cursor/mcp.json` (global — works for all projects):
@@ -209,6 +220,7 @@ gitnexus analyze [path] # Index a repository (or update stale index)
209
220
  gitnexus analyze --repair-fts # Fast path: rebuild/verify only FTS indexes on existing index data
210
221
  gitnexus analyze --force # Full rebuild: re-parse + graph rebuild + FTS rebuild
211
222
  gitnexus analyze --embeddings # Enable embedding generation (slower, better search)
223
+ gitnexus embeddings install # Fetch the optional local embedding stack on demand (--cuda, --force)
212
224
  gitnexus analyze --skills # Generate repo-specific skill files from detected communities
213
225
  gitnexus analyze --skip-agents-md # Preserve custom AGENTS.md/CLAUDE.md gitnexus section edits
214
226
  gitnexus analyze --skip-skills # Skip installing .claude/skills/gitnexus/ skill files
@@ -409,6 +421,27 @@ If `npm install -g gitnexus` fails on native modules:
409
421
  npm install -g gitnexus
410
422
  ```
411
423
 
424
+ ### Installation fails behind an HTTP proxy (`onnxruntime-node` postinstall)
425
+
426
+ `onnxruntime-node`'s postinstall downloads optional CUDA GPU binaries from `api.nuget.org` — outside the npm registry, so registry mirrors don't cover it, and its proxy layer (`global-agent`) ignores the standard `HTTP_PROXY`/`HTTPS_PROXY` variables and rejects 302 redirects ([#2370](https://github.com/abhigyanpatwari/GitNexus/issues/2370)).
427
+
428
+ Since the packages are optional dependencies, a failed download no longer breaks `npm install -g gitnexus` — npm skips the embedding stack and everything else works. The stack then **self-heals on demand**: the first `gitnexus analyze --embeddings` (or an explicit `gitnexus embeddings install`) fetches it through your configured npm registry — mirrors and proxies apply, no NuGet download involved — into `~/.gitnexus/embedding-runtime`.
429
+
430
+ ```bash
431
+ # heal a proxy-degraded install manually (CPU embeddings; registry-only)
432
+ gitnexus embeddings install
433
+
434
+ # reinstall into the prefix even when the stack already resolves
435
+ gitnexus embeddings install --force
436
+
437
+ # CUDA GPU hosts: also fetch GPU binaries (NuGet; set the proxy global-agent reads)
438
+ GLOBAL_AGENT_HTTPS_PROXY=<proxy-url> gitnexus embeddings install --cuda
439
+ ```
440
+
441
+ The prefix defaults to `~/.gitnexus/embedding-runtime`; set `GITNEXUS_EMBEDDING_RUNTIME_DIR` to install it elsewhere (e.g. a writable path in a container).
442
+
443
+ > **Node requirement for the on-demand prefix:** the self-heal loads the prefixed packages via `module.registerHooks`, available on Node **≥ 22.15** (on the 22.x line) or **≥ 23.5** (on the 23.x line). On an older Node the packages install but can't be loaded from the prefix — reinstall them into the install itself instead (works on every supported Node): `ONNXRUNTIME_NODE_INSTALL=skip npm install -g gitnexus` (Windows: `set ONNXRUNTIME_NODE_INSTALL=skip && npm install -g gitnexus`). Skipping only the CUDA download keeps full CPU embeddings (CPU embeddings don't need it). Check the result any time with `gitnexus doctor` (Embeddings → Support line).
444
+
412
445
  ### Analyze warns about unavailable FTS or VECTOR extensions
413
446
 
414
447
  GitNexus uses optional DuckDB extensions for BM25 and vector search. The `gitnexus serve` and MCP read paths only ever try to `LOAD` the extensions — they never block on a network install. The `analyze` command, by default, attempts one bounded out-of-process `INSTALL` if `LOAD` fails and proceeds even when that install times out, so the index is always written to disk; BM25/vector search degrade gracefully until the extensions become available.
@@ -27,8 +27,9 @@ import { cliError } from './cli-message.js';
27
27
  import { EMBEDDING_DIMS_ERROR, normalizeEmbeddingDims } from './embedding-dims.js';
28
28
  import { formatElapsed } from './format-elapsed.js';
29
29
  import { isHfDownloadFailure } from '../core/embeddings/hf-env.js';
30
- import { safeUrl } from '../core/embeddings/http-client.js';
31
- import { isLocalEmbeddingRuntimeBlockerMessage } from '../core/embeddings/runtime-support.js';
30
+ import { isHttpMode, safeUrl } from '../core/embeddings/http-client.js';
31
+ import { isLocalEmbeddingRuntimeBlockerMessage, isMissingLocalEmbeddingStackMessage, localEmbeddingPrefixUnloadableMessage, localEmbeddingStackMissingMessage, } from '../core/embeddings/runtime-support.js';
32
+ import { ANALYZE_EMBEDDING_INSTALL_TIMEOUT_MS, getEmbeddingInstallTimeoutMs, getEmbeddingRuntimeDir, installEmbeddingRuntime, isPrefixRuntimeLoadable, resolveEmbeddingRuntime, } from '../core/embeddings/runtime-install.js';
32
33
  import { warnIfNpm11NpxRisk } from './resolve-invocation.js';
33
34
  // Capture stderr.write at module load BEFORE anything (LadybugDB native
34
35
  // init, progress bar, console redirection) can monkey-patch it. The
@@ -797,6 +798,52 @@ const analyzeCommandImpl = async (inputPath, cliOptions) => {
797
798
  console.log(' Note: custom HTTP embeddings require BOTH --embedding-base-url and --embedding-model ' +
798
799
  '(or the matching env vars). Falling back to local ONNX embeddings.\n');
799
800
  }
801
+ // On-demand embedding runtime (#2370): when the optional stack was pruned at
802
+ // install time (proxy-blocked NuGet download in onnxruntime-node's
803
+ // postinstall), heal it here instead of failing later in the pipeline. The
804
+ // install goes through the user's npm registry config (mirrors/proxies
805
+ // apply) with --ignore-scripts, so no NuGet download is attempted. Runs
806
+ // before bar.start() like the sibling validations above.
807
+ if (embeddingsEnabled && !isHttpMode()) {
808
+ const resolved = resolveEmbeddingRuntime();
809
+ // Resolved-but-unloadable (a populated prefix on a Node with no
810
+ // module.registerHooks), or nothing installed on such a Node: fail fast with
811
+ // capability guidance instead of dying mid-pipeline over an unusable prefix
812
+ // or downloading a runtime the loader can't reach. A package-sourced stack
813
+ // never needs the hook, so it is excluded. --embeddings was explicitly
814
+ // requested and this failure is deterministic, so fail fast rather than
815
+ // silently degrading to BM25 (distinct from a transient install timeout).
816
+ if (!isPrefixRuntimeLoadable() && (resolved === null || resolved.source === 'runtime-prefix')) {
817
+ cliError(` ${localEmbeddingPrefixUnloadableMessage().replace(/\n/g, '\n ')}\n`, {
818
+ recoveryHint: 'local-embedding-stack-missing',
819
+ });
820
+ process.exitCode = 1;
821
+ return;
822
+ }
823
+ // On-demand embedding runtime (#2370): when the optional stack was pruned at
824
+ // install time (proxy-blocked NuGet download in onnxruntime-node's
825
+ // postinstall), heal it here instead of failing later in the pipeline. The
826
+ // install goes through the user's npm registry config (mirrors/proxies
827
+ // apply) with --ignore-scripts, so no NuGet download is attempted.
828
+ if (resolved === null) {
829
+ console.log(` Local embedding runtime is not installed (optional packages were skipped at install time).\n` +
830
+ ` Downloading it now from your npm registry into ${getEmbeddingRuntimeDir()} …\n` +
831
+ ` (one-time; rerun manually anytime with \`gitnexus embeddings install\`)\n`);
832
+ try {
833
+ // Short deadline (env override still wins): analyze is interactive, so a
834
+ // blackholed proxy must not stall the whole index run for the 10-minute
835
+ // default — fail over to the guidance below instead.
836
+ await installEmbeddingRuntime({}, getEmbeddingInstallTimeoutMs(ANALYZE_EMBEDDING_INSTALL_TIMEOUT_MS));
837
+ console.log(' Embedding runtime installed.\n');
838
+ }
839
+ catch (err) {
840
+ cliError(` Could not install the embedding runtime: ${err instanceof Error ? err.message : String(err)}\n\n` +
841
+ ` ${localEmbeddingStackMissingMessage().replace(/\n/g, '\n ')}\n`, { recoveryHint: 'local-embedding-stack-missing' });
842
+ process.exitCode = 1;
843
+ return;
844
+ }
845
+ }
846
+ }
800
847
  if (options.repairFts && options.force) {
801
848
  cliError(' Cannot combine `--repair-fts` with `--force`. ' +
802
849
  'Use `--repair-fts` for fast FTS-only repair, or `--force` for a full rebuild.\n');
@@ -1203,6 +1250,18 @@ const analyzeCommandImpl = async (inputPath, cliOptions) => {
1203
1250
  process.exitCode = 1;
1204
1251
  return;
1205
1252
  }
1253
+ // The optional embedding stack (@huggingface/transformers → onnxruntime-node)
1254
+ // was pruned at install time — usually a proxy-blocked NuGet download during
1255
+ // onnxruntime-node's postinstall (#2370). Checked before the generic
1256
+ // module-not-found "installation may be corrupt" hint below, which would
1257
+ // otherwise misdiagnose a deliberate optional-dependency skip.
1258
+ if (isMissingLocalEmbeddingStackMessage(msg)) {
1259
+ cliError(` ${msg.replace(/\n/g, '\n ')}\n`, {
1260
+ recoveryHint: 'local-embedding-stack-missing',
1261
+ });
1262
+ process.exitCode = 1;
1263
+ return;
1264
+ }
1206
1265
  // HF download failure — show clean guidance without the raw stack trace.
1207
1266
  // Checked before writeFatalToStderr so the user sees one focused message
1208
1267
  // rather than a stack-trace dump followed by a second remediation block.
@@ -12,7 +12,7 @@ import { type CliMessageKey, type CliMessageVars } from './i18n/index.js';
12
12
  * Consumers can import this type to narrow log-record `recoveryHint`
13
13
  * fields without restating the literal list.
14
14
  */
15
- export type RecoveryHint = 'wal-corruption' | 'wal-checkpoint-threshold' | 'heap-oom-respawn' | 'native-worker-abort' | 'hf-endpoint-unreachable' | 'local-embedding-unsupported' | 'large-repo' | 'npm-resolution' | 'module-not-found' | 'gitnexusrc-invalid' | 'default-branch-invalid';
15
+ export type RecoveryHint = 'wal-corruption' | 'wal-checkpoint-threshold' | 'heap-oom-respawn' | 'native-worker-abort' | 'hf-endpoint-unreachable' | 'local-embedding-unsupported' | 'local-embedding-stack-missing' | 'large-repo' | 'npm-resolution' | 'module-not-found' | 'gitnexusrc-invalid' | 'default-branch-invalid';
16
16
  /**
17
17
  * Common shape for the optional structured-field bag passed to
18
18
  * `cliError`/`cliWarn`/`cliInfo`. Typed so the `recoveryHint` slot is
@@ -1,3 +1,4 @@
1
+ import { type EmbeddingRuntimeResolution } from '../core/embeddings/runtime-install.js';
1
2
  export declare function displayWidth(value: string): number;
2
3
  export declare function padDisplayEnd(value: string, columns: number): string;
3
4
  /**
@@ -14,6 +15,10 @@ export declare function localEmbeddingDoctorStatus(opts: {
14
15
  httpMode: boolean;
15
16
  platform?: NodeJS.Platform;
16
17
  arch?: NodeJS.Architecture;
18
+ /** Injectable for tests; defaults to probing the real install. */
19
+ resolution?: EmbeddingRuntimeResolution | null;
20
+ /** Injectable for tests; defaults to this Node's registerHooks capability. */
21
+ prefixLoadable?: boolean;
17
22
  }): {
18
23
  status: string;
19
24
  detail: string | null;
@@ -1,7 +1,8 @@
1
1
  import { getRuntimeCapabilities, getRuntimeFingerprint } from '../core/platform/capabilities.js';
2
2
  import { resolveEmbeddingConfig } from '../core/embeddings/config.js';
3
3
  import { isHttpMode } from '../core/embeddings/http-client.js';
4
- import { getLocalEmbeddingRuntimeBlocker } from '../core/embeddings/runtime-support.js';
4
+ import { getLocalEmbeddingRuntimeBlocker, localEmbeddingPrefixUnloadableMessage, localEmbeddingStackMissingMessage, } from '../core/embeddings/runtime-support.js';
5
+ import { isPrefixRuntimeLoadable, resolveEmbeddingRuntime, } from '../core/embeddings/runtime-install.js';
5
6
  import { cudaRedirectDoctorStatus } from '../core/embeddings/onnxruntime-node-resolver.js';
6
7
  import { checkLbugNative } from '../core/lbug/native-check.js';
7
8
  import { getExtensionInstallPolicy } from '../core/lbug/extension-loader.js';
@@ -64,6 +65,25 @@ export function localEmbeddingDoctorStatus(opts) {
64
65
  if (blocker) {
65
66
  return { status: `✗ local embeddings unavailable on ${platform}/${arch}`, detail: blocker };
66
67
  }
68
+ // The stack is an optionalDependency — npm prunes it when onnxruntime-node's
69
+ // postinstall can't download its CUDA binaries (proxy/firewall, #2370).
70
+ const resolution = opts.resolution !== undefined ? opts.resolution : resolveEmbeddingRuntime();
71
+ if (resolution === null) {
72
+ return {
73
+ status: '✗ optional embedding stack not installed',
74
+ detail: localEmbeddingStackMissingMessage(),
75
+ };
76
+ }
77
+ // A prefix-sourced stack needs module.registerHooks to load; on Node < 22.15 /
78
+ // < 23.5 it is present but unreachable (#2372). Report loadability, not bare
79
+ // presence, so the diagnostic stops claiming a ✓ the loader can't honour.
80
+ const prefixLoadable = opts.prefixLoadable ?? isPrefixRuntimeLoadable();
81
+ if (resolution.source === 'runtime-prefix' && !prefixLoadable) {
82
+ return {
83
+ status: '✗ embedding stack installed in the prefix but not loadable on this Node',
84
+ detail: localEmbeddingPrefixUnloadableMessage(),
85
+ };
86
+ }
67
87
  return { status: '✓ local embeddings supported', detail: null };
68
88
  }
69
89
  export const doctorCommand = async () => {
@@ -102,6 +102,17 @@ export function getEditorTargets(home = os.homedir()) {
102
102
  needle: 'gitnexus-hook',
103
103
  scriptDir: path.join(home, '.claude', 'hooks', 'gitnexus'),
104
104
  },
105
+ {
106
+ id: 'codex',
107
+ label: 'Codex',
108
+ // Codex hooks use Claude Code's exact {hooks: {Event: [...]}} JSON shape
109
+ // and hookSpecificOutput response contract, in a dedicated hooks.json
110
+ // (https://developers.openai.com/codex/hooks).
111
+ settingsFile: path.join(home, '.codex', 'hooks.json'),
112
+ events: ['PreToolUse', 'PostToolUse'],
113
+ needle: 'gitnexus-hook',
114
+ scriptDir: path.join(home, '.codex', 'hooks', 'gitnexus'),
115
+ },
105
116
  {
106
117
  id: 'antigravity',
107
118
  label: 'Antigravity',
@@ -0,0 +1,12 @@
1
+ export interface EmbeddingsInstallOptions {
2
+ cuda?: boolean;
3
+ force?: boolean;
4
+ }
5
+ /**
6
+ * `gitnexus embeddings install [--cuda] [--force]` — fetch the optional local
7
+ * embedding stack on demand (#2370). Goes through the user's npm registry
8
+ * config (mirrors/proxies apply); with --cuda it additionally runs
9
+ * onnxruntime-node's postinstall to download the CUDA GPU binaries from NuGet
10
+ * (set GLOBAL_AGENT_HTTPS_PROXY behind a proxy).
11
+ */
12
+ export declare const embeddingsInstallCommand: (options?: EmbeddingsInstallOptions) => Promise<void>;
@@ -0,0 +1,49 @@
1
+ import { cliError, cliInfo, cliWarn } from './cli-message.js';
2
+ import { getEmbeddingRuntimeDir, getEmbeddingStackSpecs, installEmbeddingRuntime, isPrefixRuntimeLoadable, resolveEmbeddingRuntime, } from '../core/embeddings/runtime-install.js';
3
+ import { localEmbeddingPrefixUnloadableMessage } from '../core/embeddings/runtime-support.js';
4
+ /**
5
+ * `gitnexus embeddings install [--cuda] [--force]` — fetch the optional local
6
+ * embedding stack on demand (#2370). Goes through the user's npm registry
7
+ * config (mirrors/proxies apply); with --cuda it additionally runs
8
+ * onnxruntime-node's postinstall to download the CUDA GPU binaries from NuGet
9
+ * (set GLOBAL_AGENT_HTTPS_PROXY behind a proxy).
10
+ */
11
+ export const embeddingsInstallCommand = async (options = {}) => {
12
+ const resolved = resolveEmbeddingRuntime();
13
+ if (resolved?.source === 'package' && !options.force) {
14
+ cliInfo('The embedding stack is already installed with gitnexus itself — nothing to do.\n' +
15
+ '(Use --force to install a copy into the runtime prefix anyway.)');
16
+ return;
17
+ }
18
+ const specs = Object.entries(getEmbeddingStackSpecs())
19
+ .map(([name, spec]) => `${name}@${spec}`)
20
+ .join(', ');
21
+ cliInfo(`Installing ${specs} into ${getEmbeddingRuntimeDir()} …`);
22
+ cliInfo(options.cuda
23
+ ? 'CUDA mode: onnxruntime-node will download GPU binaries from NuGet ' +
24
+ '(set GLOBAL_AGENT_HTTPS_PROXY=<proxy-url> behind a proxy).'
25
+ : 'CPU mode: install scripts are skipped — only your npm registry is contacted.');
26
+ try {
27
+ await installEmbeddingRuntime({ cuda: options.cuda, onOutput: (line) => cliInfo(` ${line}`) });
28
+ }
29
+ catch (err) {
30
+ cliError(`${err instanceof Error ? err.message : String(err)}\n`, {
31
+ recoveryHint: 'local-embedding-stack-missing',
32
+ });
33
+ process.exitCode = 1;
34
+ return;
35
+ }
36
+ const postInstall = resolveEmbeddingRuntime();
37
+ if (postInstall === null) {
38
+ cliInfo('✗ Install completed but the stack still does not resolve — check the output above.');
39
+ process.exitCode = 1;
40
+ return;
41
+ }
42
+ if (postInstall.source === 'runtime-prefix' && !isPrefixRuntimeLoadable()) {
43
+ // The packages are in the prefix, but this Node has no module.registerHooks
44
+ // to load them — don't claim readiness the loader can't honour.
45
+ cliWarn(`${localEmbeddingPrefixUnloadableMessage()}\n`);
46
+ return;
47
+ }
48
+ cliInfo('✓ Embedding runtime installed. `gitnexus analyze --embeddings` is ready.');
49
+ };
@@ -17,6 +17,8 @@ const COMMAND_DESCRIPTION_KEYS = {
17
17
  list: 'help.command.list.description',
18
18
  status: 'help.command.status.description',
19
19
  doctor: 'help.command.doctor.description',
20
+ embeddings: 'help.command.embeddings.description',
21
+ 'embeddings install': 'help.command.embeddings.install.description',
20
22
  clean: 'help.command.clean.description',
21
23
  remove: 'help.command.remove.description',
22
24
  wiki: 'help.command.wiki.description',
@@ -143,6 +145,8 @@ const OPTION_DESCRIPTION_KEYS = {
143
145
  'eval-server|-p, --port <port>': 'help.option.port',
144
146
  'eval-server|--host <host>': 'help.option.evalServer.host',
145
147
  'eval-server|--idle-timeout <seconds>': 'help.option.evalServer.idleTimeout',
148
+ 'embeddings install|--cuda': 'help.option.embeddings.install.cuda',
149
+ 'embeddings install|--force': 'help.option.embeddings.install.force',
146
150
  'group create|--force': 'help.option.group.create.force',
147
151
  'group sync|--skip-embeddings': 'help.option.group.sync.skipEmbeddings',
148
152
  'group sync|--exact-only': 'help.option.group.sync.exactOnly',
@@ -117,6 +117,8 @@ export declare const en: {
117
117
  readonly 'help.command.list.description': "List all indexed repositories";
118
118
  readonly 'help.command.status.description': "Show index status for current repo";
119
119
  readonly 'help.command.doctor.description': "Show runtime platform capabilities and embedding configuration";
120
+ readonly 'help.command.embeddings.description': "Manage the on-demand local embedding runtime";
121
+ readonly 'help.command.embeddings.install.description': "Install the local embedding stack (@huggingface/transformers + onnxruntime-node) on demand. Heals installs where npm skipped the optional packages (e.g. behind an HTTP proxy, #2370). Downloads only from your configured npm registry — mirrors and proxies apply.";
120
122
  readonly 'help.command.clean.description': "Delete GitNexus index for current repo";
121
123
  readonly 'help.command.remove.description': "Delete the GitNexus index for a registered repo (by alias, name, or absolute path). Unlike `clean`, does not require being inside the repo. Idempotent on unknown targets.";
122
124
  readonly 'help.command.wiki.description': "Generate repository wiki from knowledge graph";
@@ -220,6 +222,8 @@ export declare const en: {
220
222
  readonly 'help.option.check.cycles': "Detect circular imports and fail when any are found";
221
223
  readonly 'help.option.evalServer.host': "Bind address (default: 127.0.0.1, use 0.0.0.0 to expose to all interfaces)";
222
224
  readonly 'help.option.evalServer.idleTimeout': "Auto-shutdown after N seconds idle (0 = disabled)";
225
+ readonly 'help.option.embeddings.install.cuda': "Also download the CUDA GPU binaries (runs onnxruntime-node's NuGet postinstall; set GLOBAL_AGENT_HTTPS_PROXY behind a proxy)";
226
+ readonly 'help.option.embeddings.install.force': "Install into the runtime prefix even when the stack already resolves";
223
227
  readonly 'help.option.group.create.force': "Overwrite existing group";
224
228
  readonly 'help.option.group.sync.skipEmbeddings': "Exact + BM25 only (no embedding fallback)";
225
229
  readonly 'help.option.group.sync.exactOnly': "Exact match only";
@@ -117,6 +117,8 @@ export const en = {
117
117
  'help.command.list.description': 'List all indexed repositories',
118
118
  'help.command.status.description': 'Show index status for current repo',
119
119
  'help.command.doctor.description': 'Show runtime platform capabilities and embedding configuration',
120
+ 'help.command.embeddings.description': 'Manage the on-demand local embedding runtime',
121
+ 'help.command.embeddings.install.description': 'Install the local embedding stack (@huggingface/transformers + onnxruntime-node) on demand. Heals installs where npm skipped the optional packages (e.g. behind an HTTP proxy, #2370). Downloads only from your configured npm registry — mirrors and proxies apply.',
120
122
  'help.command.clean.description': 'Delete GitNexus index for current repo',
121
123
  'help.command.remove.description': 'Delete the GitNexus index for a registered repo (by alias, name, or absolute path). Unlike `clean`, does not require being inside the repo. Idempotent on unknown targets.',
122
124
  'help.command.wiki.description': 'Generate repository wiki from knowledge graph',
@@ -220,6 +222,8 @@ export const en = {
220
222
  'help.option.check.cycles': 'Detect circular imports and fail when any are found',
221
223
  'help.option.evalServer.host': 'Bind address (default: 127.0.0.1, use 0.0.0.0 to expose to all interfaces)',
222
224
  'help.option.evalServer.idleTimeout': 'Auto-shutdown after N seconds idle (0 = disabled)',
225
+ 'help.option.embeddings.install.cuda': "Also download the CUDA GPU binaries (runs onnxruntime-node's NuGet postinstall; set GLOBAL_AGENT_HTTPS_PROXY behind a proxy)",
226
+ 'help.option.embeddings.install.force': 'Install into the runtime prefix even when the stack already resolves',
223
227
  'help.option.group.create.force': 'Overwrite existing group',
224
228
  'help.option.group.sync.skipEmbeddings': 'Exact + BM25 only (no embedding fallback)',
225
229
  'help.option.group.sync.exactOnly': 'Exact match only',
@@ -118,6 +118,8 @@ export declare const cliResources: {
118
118
  readonly 'help.command.list.description': "List all indexed repositories";
119
119
  readonly 'help.command.status.description': "Show index status for current repo";
120
120
  readonly 'help.command.doctor.description': "Show runtime platform capabilities and embedding configuration";
121
+ readonly 'help.command.embeddings.description': "Manage the on-demand local embedding runtime";
122
+ readonly 'help.command.embeddings.install.description': "Install the local embedding stack (@huggingface/transformers + onnxruntime-node) on demand. Heals installs where npm skipped the optional packages (e.g. behind an HTTP proxy, #2370). Downloads only from your configured npm registry — mirrors and proxies apply.";
121
123
  readonly 'help.command.clean.description': "Delete GitNexus index for current repo";
122
124
  readonly 'help.command.remove.description': "Delete the GitNexus index for a registered repo (by alias, name, or absolute path). Unlike `clean`, does not require being inside the repo. Idempotent on unknown targets.";
123
125
  readonly 'help.command.wiki.description': "Generate repository wiki from knowledge graph";
@@ -221,6 +223,8 @@ export declare const cliResources: {
221
223
  readonly 'help.option.check.cycles': "Detect circular imports and fail when any are found";
222
224
  readonly 'help.option.evalServer.host': "Bind address (default: 127.0.0.1, use 0.0.0.0 to expose to all interfaces)";
223
225
  readonly 'help.option.evalServer.idleTimeout': "Auto-shutdown after N seconds idle (0 = disabled)";
226
+ readonly 'help.option.embeddings.install.cuda': "Also download the CUDA GPU binaries (runs onnxruntime-node's NuGet postinstall; set GLOBAL_AGENT_HTTPS_PROXY behind a proxy)";
227
+ readonly 'help.option.embeddings.install.force': "Install into the runtime prefix even when the stack already resolves";
224
228
  readonly 'help.option.group.create.force': "Overwrite existing group";
225
229
  readonly 'help.option.group.sync.skipEmbeddings': "Exact + BM25 only (no embedding fallback)";
226
230
  readonly 'help.option.group.sync.exactOnly': "Exact match only";
@@ -360,6 +364,8 @@ export declare const cliResources: {
360
364
  'help.command.list.description': string;
361
365
  'help.command.status.description': string;
362
366
  'help.command.doctor.description': string;
367
+ 'help.command.embeddings.description': string;
368
+ 'help.command.embeddings.install.description': string;
363
369
  'help.command.clean.description': string;
364
370
  'help.command.remove.description': string;
365
371
  'help.command.wiki.description': string;
@@ -463,6 +469,8 @@ export declare const cliResources: {
463
469
  'help.option.check.cycles': string;
464
470
  'help.option.evalServer.host': string;
465
471
  'help.option.evalServer.idleTimeout': string;
472
+ 'help.option.embeddings.install.cuda': string;
473
+ 'help.option.embeddings.install.force': string;
466
474
  'help.option.group.create.force': string;
467
475
  'help.option.group.sync.skipEmbeddings': string;
468
476
  'help.option.group.sync.exactOnly': string;
@@ -117,6 +117,8 @@ export declare const zhCN: {
117
117
  'help.command.list.description': string;
118
118
  'help.command.status.description': string;
119
119
  'help.command.doctor.description': string;
120
+ 'help.command.embeddings.description': string;
121
+ 'help.command.embeddings.install.description': string;
120
122
  'help.command.clean.description': string;
121
123
  'help.command.remove.description': string;
122
124
  'help.command.wiki.description': string;
@@ -220,6 +222,8 @@ export declare const zhCN: {
220
222
  'help.option.check.cycles': string;
221
223
  'help.option.evalServer.host': string;
222
224
  'help.option.evalServer.idleTimeout': string;
225
+ 'help.option.embeddings.install.cuda': string;
226
+ 'help.option.embeddings.install.force': string;
223
227
  'help.option.group.create.force': string;
224
228
  'help.option.group.sync.skipEmbeddings': string;
225
229
  'help.option.group.sync.exactOnly': string;
@@ -117,6 +117,8 @@ export const zhCN = {
117
117
  'help.command.list.description': '列出所有已索引仓库',
118
118
  'help.command.status.description': '显示当前仓库的索引状态',
119
119
  'help.command.doctor.description': '显示运行平台能力和嵌入配置',
120
+ 'help.command.embeddings.description': '管理按需安装的本地嵌入运行时',
121
+ 'help.command.embeddings.install.description': '按需安装本地嵌入组件(@huggingface/transformers + onnxruntime-node)。修复 npm 跳过可选包的安装(例如在 HTTP 代理后,#2370)。仅从你配置的 npm registry 下载 — 镜像和代理均生效。',
120
122
  'help.command.clean.description': '删除当前仓库的 GitNexus 索引',
121
123
  'help.command.remove.description': '删除已注册仓库的 GitNexus 索引(按别名、名称或绝对路径)。与 `clean` 不同,不要求位于仓库内;未知目标会幂等处理。',
122
124
  'help.command.wiki.description': '从知识图谱生成仓库 Wiki',
@@ -220,6 +222,8 @@ export const zhCN = {
220
222
  'help.option.check.cycles': '检测循环导入,并在发现循环时失败',
221
223
  'help.option.evalServer.host': '绑定地址(默认:127.0.0.1;用 0.0.0.0 暴露到所有网卡)',
222
224
  'help.option.evalServer.idleTimeout': '空闲 N 秒后自动关闭(0 = 禁用)',
225
+ 'help.option.embeddings.install.cuda': '同时下载 CUDA GPU 二进制文件(运行 onnxruntime-node 的 NuGet postinstall;代理后请设置 GLOBAL_AGENT_HTTPS_PROXY)',
226
+ 'help.option.embeddings.install.force': '即使嵌入组件已可解析,也强制安装到运行时目录',
223
227
  'help.option.group.create.force': '覆盖现有仓库组',
224
228
  'help.option.group.sync.skipEmbeddings': '仅使用 exact + BM25(不使用嵌入回退)',
225
229
  'help.option.group.sync.exactOnly': '仅精确匹配',
package/dist/cli/index.js CHANGED
@@ -153,6 +153,17 @@ program
153
153
  .command('doctor')
154
154
  .description('Show runtime platform capabilities and embedding configuration')
155
155
  .action(createLazyAction(() => import('./doctor.js'), 'doctorCommand'));
156
+ program
157
+ .command('embeddings')
158
+ .description('Manage the on-demand local embedding runtime')
159
+ .command('install')
160
+ .description('Install the local embedding stack (@huggingface/transformers + onnxruntime-node) on demand. ' +
161
+ 'Heals installs where npm skipped the optional packages (e.g. behind an HTTP proxy, #2370). ' +
162
+ 'Downloads only from your configured npm registry — mirrors and proxies apply.')
163
+ .option('--cuda', "Also download the CUDA GPU binaries (runs onnxruntime-node's NuGet postinstall; " +
164
+ 'set GLOBAL_AGENT_HTTPS_PROXY behind a proxy)')
165
+ .option('--force', 'Install into the runtime prefix even when the stack already resolves')
166
+ .action(createLazyAction(() => import('./embeddings.js'), 'embeddingsInstallCommand'));
156
167
  program
157
168
  .command('clean')
158
169
  .description('Delete GitNexus index for current repo')
package/dist/cli/setup.js CHANGED
@@ -407,20 +407,26 @@ export async function copyHookHelpers(srcDir, destDir, label, result) {
407
407
  return failedRequired;
408
408
  }
409
409
  /**
410
- * Install GitNexus hooks to ~/.claude/settings.json for Claude Code.
411
- * Merges hook config without overwriting existing hooks, preserving
412
- * comments and formatting in the JSONC file.
410
+ * Install GitNexus hooks for editors that use Claude Code's hooks schema.
411
+ *
412
+ * Claude Code registers hooks in ~/.claude/settings.json; Codex uses a
413
+ * dedicated ~/.codex/hooks.json with the identical {hooks: {Event: [...]}}
414
+ * JSON shape, stdin payload, and hookSpecificOutput response contract
415
+ * (https://developers.openai.com/codex/hooks), so both runtimes share this
416
+ * installer and the same bundled adapter script. Merges hook config without
417
+ * overwriting existing hooks, preserving comments and formatting.
413
418
  */
414
- async function installClaudeCodeHooks(result) {
415
- const claudeDir = path.join(os.homedir(), '.claude');
416
- if (!(await dirExists(claudeDir)))
419
+ async function installClaudeSchemaHooks(result, id) {
420
+ const hookCfg = hookTarget(id);
421
+ const settingsPath = hookCfg.settingsFile;
422
+ const label = `${hookCfg.label} hooks`;
423
+ // Gate on the editor's own config dir (~/.claude, ~/.codex) existing.
424
+ if (!(await dirExists(path.dirname(settingsPath))))
417
425
  return;
418
- const claudeHook = hookTarget('claude');
419
- const settingsPath = claudeHook.settingsFile;
420
426
  // Source hooks bundled within the gitnexus package (hooks/claude/)
421
427
  const pluginHooksPath = path.join(__dirname, '..', '..', 'hooks', 'claude');
422
- // Copy unified hook script to ~/.claude/hooks/gitnexus/
423
- const destHooksDir = claudeHook.scriptDir;
428
+ // Copy unified hook script to the editor's hooks/gitnexus/ dir
429
+ const destHooksDir = hookCfg.scriptDir;
424
430
  try {
425
431
  await fs.mkdir(destHooksDir, { recursive: true });
426
432
  const src = path.join(pluginHooksPath, 'gitnexus-hook.cjs');
@@ -431,7 +437,7 @@ async function installClaudeCodeHooks(result) {
431
437
  const normalizedCli = path.resolve(resolvedCli).replace(/\\/g, '/');
432
438
  const jsonCli = JSON.stringify(normalizedCli);
433
439
  if (!content.includes(CLI_PATH_SOURCE_LITERAL)) {
434
- result.errors.push('Claude Code hooks: gitnexus-hook.cjs no longer contains the cliPath literal to patch — the installed hook may fail to resolve the CLI. Update CLI_PATH_SOURCE_LITERAL in setup.ts.');
440
+ result.errors.push(`${label}: gitnexus-hook.cjs no longer contains the cliPath literal to patch — the installed hook may fail to resolve the CLI. Update CLI_PATH_SOURCE_LITERAL in setup.ts.`);
435
441
  }
436
442
  content = content.replace(CLI_PATH_SOURCE_LITERAL, `let cliPath = ${jsonCli};`);
437
443
  await fs.writeFile(dest, content, 'utf-8');
@@ -446,12 +452,12 @@ async function installClaudeCodeHooks(result) {
446
452
  await fs.access(dest);
447
453
  }
448
454
  catch {
449
- result.errors.push('Claude Code hooks: adapter script was not installed — skipping hook registration');
455
+ result.errors.push(`${label}: adapter script was not installed — skipping hook registration`);
450
456
  return;
451
457
  }
452
- const failedRequired = await copyHookHelpers(pluginHooksPath, destHooksDir, 'Claude Code hooks', result);
458
+ const failedRequired = await copyHookHelpers(pluginHooksPath, destHooksDir, label, result);
453
459
  if (failedRequired.length > 0) {
454
- result.errors.push(`Claude Code hooks: required helper(s) ${failedRequired.join(', ')} failed to copy — skipping hook registration`);
460
+ result.errors.push(`${label}: required helper(s) ${failedRequired.join(', ')} failed to copy — skipping hook registration`);
455
461
  return;
456
462
  }
457
463
  const hookPath = path.join(destHooksDir, 'gitnexus-hook.cjs').replace(/\\/g, '/');
@@ -467,9 +473,10 @@ async function installClaudeCodeHooks(result) {
467
473
  }
468
474
  })();
469
475
  const hookEntries = [];
470
- // NOTE: SessionStart hooks are broken on Windows (Claude Code bug #23576).
471
- // Session context is delivered via CLAUDE.md / skills instead.
472
- if (!hasGitnexusHook(parsed?.hooks, 'PreToolUse', claudeHook.needle)) {
476
+ // NOTE: SessionStart hooks are broken on Windows (Claude Code bug #23576),
477
+ // and Codex reads AGENTS.md natively. Session context is delivered via
478
+ // CLAUDE.md / AGENTS.md / skills instead.
479
+ if (!hasGitnexusHook(parsed?.hooks, 'PreToolUse', hookCfg.needle)) {
473
480
  hookEntries.push({
474
481
  eventName: 'PreToolUse',
475
482
  value: {
@@ -485,7 +492,7 @@ async function installClaudeCodeHooks(result) {
485
492
  },
486
493
  });
487
494
  }
488
- if (!hasGitnexusHook(parsed?.hooks, 'PostToolUse', claudeHook.needle)) {
495
+ if (!hasGitnexusHook(parsed?.hooks, 'PostToolUse', hookCfg.needle)) {
489
496
  hookEntries.push({
490
497
  eventName: 'PostToolUse',
491
498
  value: {
@@ -502,19 +509,19 @@ async function installClaudeCodeHooks(result) {
502
509
  });
503
510
  }
504
511
  if (hookEntries.length === 0) {
505
- result.configured.push('Claude Code hooks (already configured)');
512
+ result.configured.push(`${label} (already configured)`);
506
513
  return;
507
514
  }
508
515
  const ok = await mergeHooksJsonc(settingsPath, hookEntries);
509
516
  if (ok) {
510
- result.configured.push('Claude Code hooks (PreToolUse, PostToolUse)');
517
+ result.configured.push(`${label} (PreToolUse, PostToolUse)`);
511
518
  }
512
519
  else {
513
- result.errors.push('Claude Code hooks: settings.json is corrupt — skipping to preserve existing content');
520
+ result.errors.push(`${label}: ${path.basename(settingsPath)} is corrupt — skipping to preserve existing content`);
514
521
  }
515
522
  }
516
523
  catch (err) {
517
- result.errors.push(`Claude Code hooks: ${err.message}`);
524
+ result.errors.push(`${label}: ${err.message}`);
518
525
  }
519
526
  }
520
527
  // ─── Antigravity (Google) ──────────────────────────────────────────
@@ -1053,7 +1060,7 @@ export const setupCommand = async (options) => {
1053
1060
  // Install global skills for platforms that support them
1054
1061
  if (selected.has('claude')) {
1055
1062
  await installClaudeCodeSkills(result);
1056
- await installClaudeCodeHooks(result);
1063
+ await installClaudeSchemaHooks(result, 'claude');
1057
1064
  }
1058
1065
  if (selected.has('antigravity')) {
1059
1066
  await installAntigravitySkills(result);
@@ -1067,8 +1074,10 @@ export const setupCommand = async (options) => {
1067
1074
  await installCodeBuddySkills(result);
1068
1075
  if (selected.has('qoder'))
1069
1076
  await installQoderSkills(result);
1070
- if (selected.has('codex'))
1077
+ if (selected.has('codex')) {
1071
1078
  await installCodexSkills(result);
1079
+ await installClaudeSchemaHooks(result, 'codex');
1080
+ }
1072
1081
  // Print results
1073
1082
  if (result.configured.length > 0) {
1074
1083
  console.log(' Configured:');