gitnexus 1.6.7-rc.6 → 1.6.7-rc.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitnexus",
|
|
3
|
-
"version": "1.6.7-rc.
|
|
3
|
+
"version": "1.6.7-rc.7",
|
|
4
4
|
"description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
|
|
5
5
|
"author": "Abhigyan Patwari",
|
|
6
6
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"test:watch": "vitest",
|
|
50
50
|
"test:coverage": "vitest run --coverage",
|
|
51
51
|
"test:cross-platform": "tsx scripts/run-cross-platform.ts",
|
|
52
|
-
"postinstall": "node scripts/materialize-vendor-grammars.cjs && node scripts/build-tree-sitter-dart.cjs && node scripts/build-tree-sitter-proto.cjs && node scripts/build-tree-sitter-swift.cjs",
|
|
52
|
+
"postinstall": "node scripts/materialize-vendor-grammars.cjs && node scripts/build-tree-sitter-dart.cjs && node scripts/build-tree-sitter-proto.cjs && node scripts/build-tree-sitter-swift.cjs && node scripts/build-tree-sitter-kotlin.cjs",
|
|
53
53
|
"prepare": "node scripts/build.js",
|
|
54
54
|
"prepack": "node scripts/build.js"
|
|
55
55
|
},
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Probe tree-sitter-kotlin native-binding availability at install time.
|
|
4
|
+
*
|
|
5
|
+
* Unlike Dart/Proto/Swift (vendored under vendor/ and materialized into
|
|
6
|
+
* node_modules/ at postinstall), tree-sitter-kotlin is a third-party npm
|
|
7
|
+
* `optionalDependency`. It ships SOURCE ONLY — no upstream `prebuilds/` dir —
|
|
8
|
+
* and its own `install` script runs `node-gyp-build`, which compiles the
|
|
9
|
+
* native binding from source via node-gyp. On a host without a C/C++ toolchain
|
|
10
|
+
* that build soft-fails: npm skips the optional dependency and the `gitnexus`
|
|
11
|
+
* install still succeeds. This probe surfaces a single, friendly install-time
|
|
12
|
+
* warning when the Kotlin binding is unavailable — whether npm pruned the
|
|
13
|
+
* optional dependency after a toolchain-less build failure (its dir is gone,
|
|
14
|
+
* which is the common case) or the dir survives but the binding won't load —
|
|
15
|
+
* instead of leaving a raw node-gyp error or a first-use runtime failure as the
|
|
16
|
+
* only signal. A deliberate opt-out (`--omit=optional`) stays silent. The probe
|
|
17
|
+
* does not copy, register, or mutate anything; the runtime require() path in
|
|
18
|
+
* parser-loader does the actual load. This probe MUST NEVER throw or exit
|
|
19
|
+
* non-zero — it must never break `gitnexus` install.
|
|
20
|
+
*/
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
|
|
24
|
+
if (process.env.GITNEXUS_SKIP_OPTIONAL_GRAMMARS === '1') {
|
|
25
|
+
console.warn(
|
|
26
|
+
'[tree-sitter-kotlin] Skipping native-binding probe (GITNEXUS_SKIP_OPTIONAL_GRAMMARS=1).',
|
|
27
|
+
);
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const kotlinDir = path.join(__dirname, '..', 'node_modules', 'tree-sitter-kotlin');
|
|
32
|
+
|
|
33
|
+
// `--omit=optional` / `--no-optional` / `.npmrc omit=optional` surface to
|
|
34
|
+
// lifecycle scripts as `npm_config_omit` containing `optional` (a comma- or
|
|
35
|
+
// space-separated list, e.g. `dev,optional`). That is a deliberate opt-out, so
|
|
36
|
+
// an absent package for that reason should stay silent. Any OTHER absence means
|
|
37
|
+
// npm attempted the optional dependency's native build and pruned the package
|
|
38
|
+
// after it soft-failed (the toolchain-less case) — exactly when the guidance
|
|
39
|
+
// below is worth surfacing.
|
|
40
|
+
const omitsOptional = /(^|[,\s])optional([,\s]|$)/.test(process.env.npm_config_omit || '');
|
|
41
|
+
|
|
42
|
+
function warnKotlinUnavailable(err) {
|
|
43
|
+
if (err) {
|
|
44
|
+
console.warn('[tree-sitter-kotlin] Native-binding probe failed:', err.message);
|
|
45
|
+
}
|
|
46
|
+
console.warn(
|
|
47
|
+
'[tree-sitter-kotlin] Kotlin (.kt/.kts) parsing will be unavailable. Non-Kotlin functionality is unaffected.',
|
|
48
|
+
);
|
|
49
|
+
console.warn(
|
|
50
|
+
'[tree-sitter-kotlin] This is expected on hosts without a C/C++ toolchain: tree-sitter-kotlin ships source only (no upstream prebuilt binaries) and compiles via node-gyp at install. Set GITNEXUS_SKIP_OPTIONAL_GRAMMARS=1 to skip this probe.',
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
if (!fs.existsSync(path.join(kotlinDir, 'bindings', 'node', 'index.js'))) {
|
|
56
|
+
// The package never materialized. If the user deliberately omitted optional
|
|
57
|
+
// dependencies, stay silent — they opted out. Otherwise npm pruned the
|
|
58
|
+
// package after its native build soft-failed (no toolchain), and this is the
|
|
59
|
+
// dominant real-world failure case: surface the guidance the raw node-gyp
|
|
60
|
+
// error would otherwise be the only signal of.
|
|
61
|
+
if (!omitsOptional) {
|
|
62
|
+
warnKotlinUnavailable();
|
|
63
|
+
}
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const nodeGypBuild = require('node-gyp-build');
|
|
68
|
+
nodeGypBuild(kotlinDir);
|
|
69
|
+
} catch (err) {
|
|
70
|
+
// The package is present but its native binding can't be loaded (e.g. the dir
|
|
71
|
+
// survived with --ignore-scripts, or a partial/ABI-mismatched build).
|
|
72
|
+
warnKotlinUnavailable(err);
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}
|