gitnexus 1.6.6-rc.68 → 1.6.6-rc.69
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/dist/cli/doctor.js +9 -0
- package/dist/cli/index.js +12 -12
- package/dist/cli/lazy-action.d.ts +1 -0
- package/dist/cli/lazy-action.js +17 -0
- package/dist/config/ignore-service.js +1 -7
- package/dist/core/ingestion/languages/ruby/arity.d.ts +22 -0
- package/dist/core/ingestion/languages/ruby/arity.js +38 -0
- package/dist/core/ingestion/languages/ruby/cache-stats.d.ts +7 -0
- package/dist/core/ingestion/languages/ruby/cache-stats.js +15 -0
- package/dist/core/ingestion/languages/ruby/captures.d.ts +2 -0
- package/dist/core/ingestion/languages/ruby/captures.js +518 -0
- package/dist/core/ingestion/languages/ruby/import-target.d.ts +26 -0
- package/dist/core/ingestion/languages/ruby/import-target.js +84 -0
- package/dist/core/ingestion/languages/ruby/index.d.ts +11 -0
- package/dist/core/ingestion/languages/ruby/index.js +11 -0
- package/dist/core/ingestion/languages/ruby/interpret.d.ts +29 -0
- package/dist/core/ingestion/languages/ruby/interpret.js +109 -0
- package/dist/core/ingestion/languages/ruby/merge-bindings.d.ts +2 -0
- package/dist/core/ingestion/languages/ruby/merge-bindings.js +18 -0
- package/dist/core/ingestion/languages/ruby/query.d.ts +36 -0
- package/dist/core/ingestion/languages/ruby/query.js +216 -0
- package/dist/core/ingestion/languages/ruby/receiver-binding.d.ts +33 -0
- package/dist/core/ingestion/languages/ruby/receiver-binding.js +66 -0
- package/dist/core/ingestion/languages/ruby/scope-resolver.d.ts +2 -0
- package/dist/core/ingestion/languages/ruby/scope-resolver.js +208 -0
- package/dist/core/ingestion/languages/ruby/simple-hooks.d.ts +14 -0
- package/dist/core/ingestion/languages/ruby/simple-hooks.js +41 -0
- package/dist/core/ingestion/languages/ruby.js +9 -0
- package/dist/core/ingestion/registry-primary-flag.js +1 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +17 -0
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.js +18 -3
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +9 -3
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +2 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +19 -6
- package/dist/core/ingestion/workers/worker-pool.js +78 -17
- package/dist/core/lbug/native-check.d.ts +6 -0
- package/dist/core/lbug/native-check.js +71 -0
- package/package.json +1 -1
package/dist/cli/doctor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { checkLbugNative } from '../core/lbug/native-check.js';
|
|
4
5
|
import { t } from './i18n/index.js';
|
|
5
6
|
function isCombiningMark(codePoint) {
|
|
6
7
|
return ((codePoint >= 0x0300 && codePoint <= 0x036f) ||
|
|
@@ -50,6 +51,14 @@ export const doctorCommand = async () => {
|
|
|
50
51
|
console.log(` ${label('doctor.labels.node', 10)}${fingerprint.node}`);
|
|
51
52
|
console.log(` ${label('doctor.labels.gitnexus', 10)}${fingerprint.gitnexus}`);
|
|
52
53
|
console.log(` ${label('doctor.labels.ladybugdb', 10)}${fingerprint.ladybugdb ?? 'unknown'}`);
|
|
54
|
+
const nativeCheck = checkLbugNative();
|
|
55
|
+
if (nativeCheck.ok) {
|
|
56
|
+
console.log(` ${padDisplayEnd('native', 10)}✓ lbugjs.node loaded`);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
console.log(` ${padDisplayEnd('native', 10)}✗ lbugjs.node missing`);
|
|
60
|
+
process.stderr.write(`\n${nativeCheck.message?.replace(/^/gm, ' ')}\n\n`);
|
|
61
|
+
}
|
|
53
62
|
console.log(` ${label('doctor.labels.onnx', 10)}${fingerprint.onnxruntime ?? 'unknown'}`);
|
|
54
63
|
console.log('');
|
|
55
64
|
console.log(t('doctor.capabilities'));
|
package/dist/cli/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Removing it from here improves MCP server startup time significantly.
|
|
4
4
|
import { Command } from 'commander';
|
|
5
5
|
import { createRequire } from 'node:module';
|
|
6
|
-
import { createLazyAction } from './lazy-action.js';
|
|
6
|
+
import { createLazyAction, createLbugLazyAction } from './lazy-action.js';
|
|
7
7
|
import { registerGroupCommands } from './group.js';
|
|
8
8
|
import { localizeCliHelp } from './help-i18n.js';
|
|
9
9
|
import { t } from './i18n/index.js';
|
|
@@ -48,7 +48,7 @@ program
|
|
|
48
48
|
.option('--embedding-sub-batch-size <n>', 'Number of chunks per embedding model call')
|
|
49
49
|
.option('--embedding-device <device>', 'Embedding device: auto, cpu, dml, cuda, or wasm')
|
|
50
50
|
.addHelpText('after', () => t('help.analyze.environment'))
|
|
51
|
-
.action(
|
|
51
|
+
.action(createLbugLazyAction(() => import('./analyze.js'), 'analyzeCommand'));
|
|
52
52
|
program
|
|
53
53
|
.command('index [path...]')
|
|
54
54
|
.description('Register an existing .gitnexus/ folder into the global registry (no re-analysis needed)')
|
|
@@ -60,11 +60,11 @@ program
|
|
|
60
60
|
.description('Start local HTTP server for web UI connection')
|
|
61
61
|
.option('-p, --port <port>', 'Port number', '4747')
|
|
62
62
|
.option('--host <host>', 'Bind address (default: 127.0.0.1, use 0.0.0.0 for remote access)')
|
|
63
|
-
.action(
|
|
63
|
+
.action(createLbugLazyAction(() => import('./serve.js'), 'serveCommand'));
|
|
64
64
|
program
|
|
65
65
|
.command('mcp')
|
|
66
66
|
.description('Start MCP server (stdio) — serves all indexed repos')
|
|
67
|
-
.action(
|
|
67
|
+
.action(createLbugLazyAction(() => import('./mcp.js'), 'mcpCommand'));
|
|
68
68
|
program
|
|
69
69
|
.command('list')
|
|
70
70
|
.description('List all indexed repositories')
|
|
@@ -108,11 +108,11 @@ program
|
|
|
108
108
|
.option('-v, --verbose', 'Enable verbose output (show LLM commands and responses)')
|
|
109
109
|
.option('--review', 'Stop after grouping to review module structure before generating pages')
|
|
110
110
|
.option('--lang <lang>', 'Output language for generated documentation (e.g. english, chinese, spanish, japanese)')
|
|
111
|
-
.action(
|
|
111
|
+
.action(createLbugLazyAction(() => import('./wiki.js'), 'wikiCommand'));
|
|
112
112
|
program
|
|
113
113
|
.command('augment <pattern>')
|
|
114
114
|
.description('Augment a search pattern with knowledge graph context (used by hooks)')
|
|
115
|
-
.action(
|
|
115
|
+
.action(createLbugLazyAction(() => import('./augment.js'), 'augmentCommand'));
|
|
116
116
|
program
|
|
117
117
|
.command('publish [path]')
|
|
118
118
|
.description('Notify the understand-quickly registry that this repo has a fresh GitNexus index. ' +
|
|
@@ -132,7 +132,7 @@ program
|
|
|
132
132
|
.option('-g, --goal <text>', 'What you want to find')
|
|
133
133
|
.option('-l, --limit <n>', 'Max processes to return (default: 5)')
|
|
134
134
|
.option('--content', 'Include full symbol source code')
|
|
135
|
-
.action(
|
|
135
|
+
.action(createLbugLazyAction(() => import('./tool.js'), 'queryCommand'));
|
|
136
136
|
program
|
|
137
137
|
.command('context [name]')
|
|
138
138
|
.description('360-degree view of a code symbol: callers, callees, processes')
|
|
@@ -140,7 +140,7 @@ program
|
|
|
140
140
|
.option('-u, --uid <uid>', 'Direct symbol UID (zero-ambiguity lookup)')
|
|
141
141
|
.option('-f, --file <path>', 'File path to disambiguate common names')
|
|
142
142
|
.option('--content', 'Include full symbol source code')
|
|
143
|
-
.action(
|
|
143
|
+
.action(createLbugLazyAction(() => import('./tool.js'), 'contextCommand'));
|
|
144
144
|
program
|
|
145
145
|
.command('impact <target>')
|
|
146
146
|
.description('Blast radius analysis: what breaks if you change a symbol')
|
|
@@ -151,12 +151,12 @@ program
|
|
|
151
151
|
.option('--limit <n>', 'Max symbols per depth level (default: 100)')
|
|
152
152
|
.option('--offset <n>', 'Skip N symbols per depth level for pagination')
|
|
153
153
|
.option('--summary-only', 'Return counts and risk only, omit symbol list')
|
|
154
|
-
.action(
|
|
154
|
+
.action(createLbugLazyAction(() => import('./tool.js'), 'impactCommand'));
|
|
155
155
|
program
|
|
156
156
|
.command('cypher <query>')
|
|
157
157
|
.description('Execute raw Cypher query against the knowledge graph')
|
|
158
158
|
.option('-r, --repo <name>', 'Target repository')
|
|
159
|
-
.action(
|
|
159
|
+
.action(createLbugLazyAction(() => import('./tool.js'), 'cypherCommand'));
|
|
160
160
|
program
|
|
161
161
|
.command('detect-changes')
|
|
162
162
|
.alias('detect_changes')
|
|
@@ -164,7 +164,7 @@ program
|
|
|
164
164
|
.option('-s, --scope <scope>', 'What to analyze: unstaged, staged, all, or compare', 'unstaged')
|
|
165
165
|
.option('-b, --base-ref <ref>', 'Branch/commit for compare scope (e.g. main)')
|
|
166
166
|
.option('-r, --repo <name>', 'Target repository')
|
|
167
|
-
.action(
|
|
167
|
+
.action(createLbugLazyAction(() => import('./tool.js'), 'detectChangesCommand'));
|
|
168
168
|
// ─── Eval Server (persistent daemon for SWE-bench) ─────────────────
|
|
169
169
|
program
|
|
170
170
|
.command('eval-server')
|
|
@@ -172,7 +172,7 @@ program
|
|
|
172
172
|
.option('-p, --port <port>', 'Port number', '4848')
|
|
173
173
|
.option('--host <host>', 'Bind address (default: 127.0.0.1, use 0.0.0.0 to expose to all interfaces)')
|
|
174
174
|
.option('--idle-timeout <seconds>', 'Auto-shutdown after N seconds idle (0 = disabled)', '0')
|
|
175
|
-
.action(
|
|
175
|
+
.action(createLbugLazyAction(() => import('./eval-server.js'), 'evalServerCommand'));
|
|
176
176
|
registerGroupCommands(program);
|
|
177
177
|
localizeCliHelp(program);
|
|
178
178
|
program.parse(process.argv);
|
|
@@ -4,3 +4,4 @@
|
|
|
4
4
|
* at compile time — catching typos when used with concrete module imports.
|
|
5
5
|
*/
|
|
6
6
|
export declare function createLazyAction<TModule extends Record<string, unknown>, TKey extends string & keyof TModule>(loader: () => Promise<TModule>, exportName: TKey): (...args: unknown[]) => Promise<void>;
|
|
7
|
+
export declare function createLbugLazyAction<TModule extends Record<string, unknown>, TKey extends string & keyof TModule>(loader: () => Promise<TModule>, exportName: TKey): (...args: unknown[]) => Promise<void>;
|
package/dist/cli/lazy-action.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* The generic constraints ensure the export name is a valid key of the module
|
|
4
4
|
* at compile time — catching typos when used with concrete module imports.
|
|
5
5
|
*/
|
|
6
|
+
import { checkLbugNative } from '../core/lbug/native-check.js';
|
|
6
7
|
function isCallable(value) {
|
|
7
8
|
return typeof value === 'function';
|
|
8
9
|
}
|
|
@@ -16,3 +17,19 @@ export function createLazyAction(loader, exportName) {
|
|
|
16
17
|
await action(...args);
|
|
17
18
|
};
|
|
18
19
|
}
|
|
20
|
+
export function createLbugLazyAction(loader, exportName) {
|
|
21
|
+
return async (...args) => {
|
|
22
|
+
const check = checkLbugNative();
|
|
23
|
+
if (!check.ok) {
|
|
24
|
+
process.stderr.write(`\n ${check.message?.replace(/\n/g, '\n ')}\n\n`);
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const module = await loader();
|
|
29
|
+
const action = module[exportName];
|
|
30
|
+
if (!isCallable(action)) {
|
|
31
|
+
throw new Error(`Lazy action export not found: ${exportName}`);
|
|
32
|
+
}
|
|
33
|
+
await action(...args);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -79,6 +79,7 @@ const DEFAULT_IGNORE_LIST = new Set([
|
|
|
79
79
|
'.generated',
|
|
80
80
|
'generated',
|
|
81
81
|
'auto-generated',
|
|
82
|
+
'monaco-workers', // Monaco editor web-worker bundles generated for browser runtime
|
|
82
83
|
'.terraform',
|
|
83
84
|
'.serverless',
|
|
84
85
|
// Documentation (optional - might want to keep)
|
|
@@ -294,13 +295,6 @@ export const shouldIgnorePath = (filePath) => {
|
|
|
294
295
|
return true;
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
|
-
// Ignore hidden files (starting with .)
|
|
298
|
-
if (fileName.startsWith('.') && fileName !== '.') {
|
|
299
|
-
// But allow some important config files
|
|
300
|
-
const allowedDotFiles = ['.env', '.gitignore']; // Already in IGNORED_FILES, so this is redundant
|
|
301
|
-
// Actually, let's NOT ignore all dot files - many are important configs
|
|
302
|
-
// Just rely on the explicit lists above
|
|
303
|
-
}
|
|
304
298
|
// Ignore files that look like generated/bundled code
|
|
305
299
|
if (fileNameLower.includes('.bundle.') ||
|
|
306
300
|
fileNameLower.includes('.chunk.') ||
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby arity check, accommodating `*args`, `**kwargs`, and defaults.
|
|
3
|
+
*
|
|
4
|
+
* The `def` metadata we care about (set by the existing Ruby method/
|
|
5
|
+
* function extractor):
|
|
6
|
+
* - `parameterCount` — total positional + keyword params
|
|
7
|
+
* - `requiredParameterCount` — min required (excludes defaults / `*args` / `**kwargs`)
|
|
8
|
+
* - `parameterTypes` — present when types are known; we also use it
|
|
9
|
+
* as a "we have varargs" hint (`'*args'`,
|
|
10
|
+
* `'**kwargs'` literals appear in the array).
|
|
11
|
+
*
|
|
12
|
+
* Verdicts:
|
|
13
|
+
* - `'compatible'` — `requiredParameterCount <= argCount <= parameterCount`,
|
|
14
|
+
* OR the def takes `*args` (then any `argCount >= required` ok).
|
|
15
|
+
* - `'incompatible'` — argCount is below required, OR above max with no `*args`.
|
|
16
|
+
* - `'unknown'` — def metadata is absent / incomplete.
|
|
17
|
+
*
|
|
18
|
+
* `'incompatible'` is a soft signal in `Registry.lookup` (penalized but
|
|
19
|
+
* still considered when no compatible candidate exists), per RFC 4.
|
|
20
|
+
*/
|
|
21
|
+
import type { Callsite, SymbolDefinition } from '../../../../_shared/index.js';
|
|
22
|
+
export declare function rubyArityCompatibility(def: SymbolDefinition, callsite: Callsite): 'compatible' | 'unknown' | 'incompatible';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby arity check, accommodating `*args`, `**kwargs`, and defaults.
|
|
3
|
+
*
|
|
4
|
+
* The `def` metadata we care about (set by the existing Ruby method/
|
|
5
|
+
* function extractor):
|
|
6
|
+
* - `parameterCount` — total positional + keyword params
|
|
7
|
+
* - `requiredParameterCount` — min required (excludes defaults / `*args` / `**kwargs`)
|
|
8
|
+
* - `parameterTypes` — present when types are known; we also use it
|
|
9
|
+
* as a "we have varargs" hint (`'*args'`,
|
|
10
|
+
* `'**kwargs'` literals appear in the array).
|
|
11
|
+
*
|
|
12
|
+
* Verdicts:
|
|
13
|
+
* - `'compatible'` — `requiredParameterCount <= argCount <= parameterCount`,
|
|
14
|
+
* OR the def takes `*args` (then any `argCount >= required` ok).
|
|
15
|
+
* - `'incompatible'` — argCount is below required, OR above max with no `*args`.
|
|
16
|
+
* - `'unknown'` — def metadata is absent / incomplete.
|
|
17
|
+
*
|
|
18
|
+
* `'incompatible'` is a soft signal in `Registry.lookup` (penalized but
|
|
19
|
+
* still considered when no compatible candidate exists), per RFC 4.
|
|
20
|
+
*/
|
|
21
|
+
export function rubyArityCompatibility(def, callsite) {
|
|
22
|
+
const max = def.parameterCount;
|
|
23
|
+
const min = def.requiredParameterCount;
|
|
24
|
+
if (max === undefined && min === undefined)
|
|
25
|
+
return 'unknown';
|
|
26
|
+
const argCount = callsite.arity;
|
|
27
|
+
if (!Number.isFinite(argCount) || argCount < 0)
|
|
28
|
+
return 'unknown';
|
|
29
|
+
// Detect varargs/kwargs from parameterTypes if present (the Ruby
|
|
30
|
+
// method extractor stores `'*args'`/`'**kwargs'` in this list).
|
|
31
|
+
const hasVarArgs = def.parameterTypes !== undefined &&
|
|
32
|
+
def.parameterTypes.some((t) => t === '*args' || t === '**kwargs' || t.startsWith('*'));
|
|
33
|
+
if (min !== undefined && argCount < min)
|
|
34
|
+
return 'incompatible';
|
|
35
|
+
if (max !== undefined && argCount > max && !hasVarArgs)
|
|
36
|
+
return 'incompatible';
|
|
37
|
+
return 'compatible';
|
|
38
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function recordRubyCacheHit(): void;
|
|
2
|
+
export declare function recordRubyCacheMiss(): void;
|
|
3
|
+
export declare function getRubyCaptureCacheStats(): {
|
|
4
|
+
readonly hits: number;
|
|
5
|
+
readonly misses: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function resetRubyCaptureCacheStats(): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
let hits = 0;
|
|
2
|
+
let misses = 0;
|
|
3
|
+
export function recordRubyCacheHit() {
|
|
4
|
+
hits++;
|
|
5
|
+
}
|
|
6
|
+
export function recordRubyCacheMiss() {
|
|
7
|
+
misses++;
|
|
8
|
+
}
|
|
9
|
+
export function getRubyCaptureCacheStats() {
|
|
10
|
+
return { hits, misses };
|
|
11
|
+
}
|
|
12
|
+
export function resetRubyCaptureCacheStats() {
|
|
13
|
+
hits = 0;
|
|
14
|
+
misses = 0;
|
|
15
|
+
}
|