@maxgfr/codeindex 2.17.0 → 2.17.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.
- package/package.json +1 -1
- package/scripts/engine.d.mts +3 -3
- package/scripts/engine.mjs +39 -3
- package/src/engine-cli.ts +56 -2
- package/src/types.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maxgfr/codeindex",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.1",
|
|
4
4
|
"description": "Self-contained, deterministic repo-indexing engine: walk + language detection + symbol/import extraction (tree-sitter AST with regex fallback) + import resolution + typed cross-file link-graph + analytics. Ships as a single zero-dependency engine.mjs that consumer tools vendor.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.33.0",
|
package/scripts/engine.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const ENGINE_VERSION = "2.17.
|
|
1
|
+
declare const ENGINE_VERSION = "2.17.1";
|
|
2
2
|
declare const SCHEMA_VERSION = 4;
|
|
3
3
|
declare const EXTRACTOR_VERSION = 10;
|
|
4
4
|
type FileKind = "code" | "doc" | "config" | "asset" | "other";
|
|
@@ -255,7 +255,7 @@ declare function extractAst(rel: string, ext: string, content: string, opts?: {
|
|
|
255
255
|
maxCalls?: number;
|
|
256
256
|
}): AstResult | undefined;
|
|
257
257
|
|
|
258
|
-
declare const DEFAULT_GRAMMARS_URL = "https://github.com/maxgfr/codeindex/releases/download/v2.17.
|
|
258
|
+
declare const DEFAULT_GRAMMARS_URL = "https://github.com/maxgfr/codeindex/releases/download/v2.17.1/grammars-2.17.1.tar.gz";
|
|
259
259
|
interface GrammarsPullTarget {
|
|
260
260
|
url: string;
|
|
261
261
|
sha256Url?: string;
|
|
@@ -780,6 +780,6 @@ declare function keywords(question: string): string[];
|
|
|
780
780
|
declare function rankedKeywords(question: string): string[];
|
|
781
781
|
declare function rrf<T>(lists: T[][], keyOf: (item: T) => string, k?: number): Map<string, number>;
|
|
782
782
|
|
|
783
|
-
declare function runCli(
|
|
783
|
+
declare function runCli(rawArgv: string[]): Promise<void>;
|
|
784
784
|
|
|
785
785
|
export { type ArchRule, type BuildIndexOptions, type BuiltinRule, type CallerEntry, type CallerIndex, type CallerIndexOptions, type CallerSite, type ChangeCoupling, type CodeInfo, type CodeSymbol, type CouplingOptions, DEFAULT_GRAMMARS_URL, DEFAULT_MAX_FILES, type DeadSymbol, type DiffFile, type DiffSpec, EMBED_VERSION, ENGINE_VERSION, EXTRACTOR_VERSION, type Edge, type EdgeKind, type EditResult, type EmbedEndpointOptions, type EmbedPullTarget, type EmbeddingIndex, type EmbeddingRecord, type EmbeddingUnit, type FileCategory, type FileKind, type FileNode, type FileRecord, type FindSymbolOptions, type ForbiddenEdgeRule, type GrammarsPullResult, type GrammarsPullTarget, type GrammarsTier, type GrammarsTierName, type Graph, type GrepOptions, type Hotspot, type Hunk, type IgnoreRule, type IndexArtifacts, MARKDOWN_EXT, type MarkdownInfo, type McpServerOptions, type MermaidOptions, type ModuleInfo, type ModuleNode, type RawCallerIndex, type RawCallerSite, type RawRef, type RenderScipOptions, type RepoMapOptions, type RepoScan, type Resolution, type ResolveContext, type RiskHotspot, type RuleSeverity, type RuleViolation, SCHEMA_VERSION, type ScanOptions, type SearchHit, type SearchOptions, type SearchResult, type SemanticSearchOptions, type SemanticSearchResult, type ShResult, type StaticEmbedModel, type SurpriseEdge, type SymbolComplexity, type SymbolIndex, type SymbolMatch, type SymbolReferences, type TestMap, type Tier, type WalkOptions, type WalkResult, type WalkedFile, type WarmGrammarsOptions, type WarmGrammarsResult, type WorkspaceInfo, type WorkspaceKind, type WorkspacePackage, allGrammarKeys, applyCentrality, basicTokenize, betweennessOf, buildArtifactsFromScan, buildCallerIndex, buildEmbeddingIndex, buildEndpointIndex, buildGraph, buildIndexArtifacts, buildModules, buildRawCallerIndex, buildResolveContext, buildSymbolIndex, byKey, byStr, categorize, changeCoupling, changedSince, checkRules, classify, clip, clipInline, communityOf, compileGlobs, complexityOfSource, computeImportPairs, computeSurprises, computeSymbolRefs, computeTestMap, deleteMemory, deserializeEmbeddings, detectCommunities, detectWorkspaces, diffFiles, diffHunks, embedEndpointUrl, embedViaEndpoint, embeddingUnits, enclosingSymbol, encode, encodeQueryViaEndpoint, ensureGrammars, escapeRegExp, extToLang, extractAst, extractCode, extractGrammarsTarball, extractMarkdown, extractSymbols, extractTarInto, fetchExpectedSha256, fetchGrammarsTarball, findDeadCode, findReferences, findSymbol, foldText, gitChurn, grammarKeyForExt, grammarKeysForExts, grammarReady, grepRepo, hasEmbedModel, have, headCommit, healthzUrl, insertAfterSymbol, insertBeforeSymbol, intDot, isCode, isDoc, isGitWorktree, isIgnored, isSurprising, isTestFile, isTestPath, keywords, languageOf, listMemories, loadEmbedModel, pagerankOf, parseGitignore, parseRules, probeEndpoint, pullGrammars, quantize, rankHotspots, rankedKeywords, readMemory, readText, renderGraphJson, renderMermaid, renderRepoMap, renderScip, renderSymbolsJson, replaceSymbolBody, resolveBaseRef, resolveCallEdges, resolveDocLink, resolveEmbedEndpoint, resolveEmbedModelDir, resolveEmbedPullUrl, resolveGrammarsDir, resolveGrammarsPullTarget, resolveGrammarsTier, resolveImport, resolveUniqueSymbol, rewriteCommand, riskHotspots, roundHalfToEven, rrf, runCli, runMcpServer, scanRepo, searchIndex, searchSemantic, serializeEmbeddings, sh, sha1, sharedGrammarsCacheDir, shortHash, slugify, subtokens, symbolComplexity, symbolsOverview, testsForModule, tierForPath, tokenize, uniqueSymbolDefs, untestedModules, untrackedFiles, walk, warmGrammars, wordpiece, writeMemory };
|
package/scripts/engine.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var ENGINE_VERSION, SCHEMA_VERSION, EXTRACTOR_VERSION;
|
|
|
14
14
|
var init_types = __esm({
|
|
15
15
|
"src/types.ts"() {
|
|
16
16
|
"use strict";
|
|
17
|
-
ENGINE_VERSION = "2.17.
|
|
17
|
+
ENGINE_VERSION = "2.17.1";
|
|
18
18
|
SCHEMA_VERSION = 4;
|
|
19
19
|
EXTRACTOR_VERSION = 10;
|
|
20
20
|
}
|
|
@@ -11831,7 +11831,8 @@ Commands:
|
|
|
11831
11831
|
wins); --server-name <name> overrides the announced serverInfo
|
|
11832
11832
|
version Print the engine version
|
|
11833
11833
|
|
|
11834
|
-
Flags:
|
|
11834
|
+
Flags (accepted before OR after the subcommand: '--repo X scan' and
|
|
11835
|
+
'scan --repo X' are equivalent):
|
|
11835
11836
|
--repo <dir> Repo root (default: cwd)
|
|
11836
11837
|
--out <file> Write output to a file instead of stdout (\`scip\`: --out -
|
|
11837
11838
|
writes the binary index to stdout)
|
|
@@ -11946,7 +11947,42 @@ function parseMcpFlags(argv) {
|
|
|
11946
11947
|
if (defaultRepo && !existsSync5(defaultRepo)) throw new Error(`--repo path does not exist: ${defaultRepo}`);
|
|
11947
11948
|
return { defaultRepo, serverInfo: name2 ? { name: name2 } : void 0 };
|
|
11948
11949
|
}
|
|
11949
|
-
|
|
11950
|
+
var VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
11951
|
+
"--repo",
|
|
11952
|
+
"--out",
|
|
11953
|
+
"--project-root",
|
|
11954
|
+
"--include",
|
|
11955
|
+
"--exclude",
|
|
11956
|
+
"--scope",
|
|
11957
|
+
"--ignore-dir",
|
|
11958
|
+
"--max-files",
|
|
11959
|
+
"--max-bytes",
|
|
11960
|
+
"--max-calls",
|
|
11961
|
+
"--max-hits",
|
|
11962
|
+
"--budget-tokens",
|
|
11963
|
+
"--since",
|
|
11964
|
+
"--config",
|
|
11965
|
+
"--limit",
|
|
11966
|
+
"--server-name"
|
|
11967
|
+
]);
|
|
11968
|
+
function hoistLeadingFlags(argv) {
|
|
11969
|
+
const lead = [];
|
|
11970
|
+
let i2 = 0;
|
|
11971
|
+
while (i2 < argv.length) {
|
|
11972
|
+
const a = argv[i2];
|
|
11973
|
+
if (a === void 0 || !a.startsWith("-")) break;
|
|
11974
|
+
lead.push(a);
|
|
11975
|
+
i2++;
|
|
11976
|
+
if (VALUE_FLAGS.has(a) && i2 < argv.length) {
|
|
11977
|
+
lead.push(argv[i2]);
|
|
11978
|
+
i2++;
|
|
11979
|
+
}
|
|
11980
|
+
}
|
|
11981
|
+
if (lead.length === 0 || i2 >= argv.length) return argv;
|
|
11982
|
+
return [argv[i2], ...lead, ...argv.slice(i2 + 1)];
|
|
11983
|
+
}
|
|
11984
|
+
async function runCli(rawArgv) {
|
|
11985
|
+
const argv = hoistLeadingFlags(rawArgv);
|
|
11950
11986
|
const [cmd, ...rest] = argv;
|
|
11951
11987
|
if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {
|
|
11952
11988
|
process.stdout.write(HELP);
|
package/src/engine-cli.ts
CHANGED
|
@@ -100,7 +100,8 @@ Commands:
|
|
|
100
100
|
wins); --server-name <name> overrides the announced serverInfo
|
|
101
101
|
version Print the engine version
|
|
102
102
|
|
|
103
|
-
Flags:
|
|
103
|
+
Flags (accepted before OR after the subcommand: '--repo X scan' and
|
|
104
|
+
'scan --repo X' are equivalent):
|
|
104
105
|
--repo <dir> Repo root (default: cwd)
|
|
105
106
|
--out <file> Write output to a file instead of stdout (\`scip\`: --out -
|
|
106
107
|
writes the binary index to stdout)
|
|
@@ -258,7 +259,60 @@ export function parseMcpFlags(argv: string[]): { defaultRepo?: string; serverInf
|
|
|
258
259
|
return { defaultRepo, serverInfo: name ? { name } : undefined };
|
|
259
260
|
}
|
|
260
261
|
|
|
261
|
-
|
|
262
|
+
// Flags that consume the following argv element. Needed to hoist leading flags
|
|
263
|
+
// past the subcommand without mistaking a flag's VALUE for the command name
|
|
264
|
+
// (`--repo /x scan`: `/x` must not be read as the command).
|
|
265
|
+
const VALUE_FLAGS = new Set([
|
|
266
|
+
"--repo",
|
|
267
|
+
"--out",
|
|
268
|
+
"--project-root",
|
|
269
|
+
"--include",
|
|
270
|
+
"--exclude",
|
|
271
|
+
"--scope",
|
|
272
|
+
"--ignore-dir",
|
|
273
|
+
"--max-files",
|
|
274
|
+
"--max-bytes",
|
|
275
|
+
"--max-calls",
|
|
276
|
+
"--max-hits",
|
|
277
|
+
"--budget-tokens",
|
|
278
|
+
"--since",
|
|
279
|
+
"--config",
|
|
280
|
+
"--limit",
|
|
281
|
+
"--server-name",
|
|
282
|
+
]);
|
|
283
|
+
|
|
284
|
+
// Accept global flags BEFORE the subcommand as well as after, so
|
|
285
|
+
// `codeindex --repo /x scan` and `codeindex scan --repo /x` agree. A strict
|
|
286
|
+
// subcommand-first parser reads the leading flag as the command name and fails
|
|
287
|
+
// with a baffling "unknown flag: scan".
|
|
288
|
+
//
|
|
289
|
+
// This is not only ergonomics. A host that wraps the CLI may splice a flag in
|
|
290
|
+
// right after the binary name — iterion's rewriter `inject_flag` does exactly
|
|
291
|
+
// that, turning `codeindex grep foo` into `codeindex --max-hits 40 grep foo` —
|
|
292
|
+
// and without hoisting that command cannot run at all.
|
|
293
|
+
//
|
|
294
|
+
// Returns argv unchanged when there is nothing to hoist, so `--help`,
|
|
295
|
+
// `--version` and a bare subcommand all keep their existing behaviour.
|
|
296
|
+
export function hoistLeadingFlags(argv: string[]): string[] {
|
|
297
|
+
const lead: string[] = [];
|
|
298
|
+
let i = 0;
|
|
299
|
+
while (i < argv.length) {
|
|
300
|
+
const a = argv[i];
|
|
301
|
+
if (a === undefined || !a.startsWith("-")) break;
|
|
302
|
+
lead.push(a);
|
|
303
|
+
i++;
|
|
304
|
+
if (VALUE_FLAGS.has(a) && i < argv.length) {
|
|
305
|
+
lead.push(argv[i] as string);
|
|
306
|
+
i++;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// No leading flags, or they were the whole line (`--help`, `--version`).
|
|
310
|
+
if (lead.length === 0 || i >= argv.length) return argv;
|
|
311
|
+
return [argv[i] as string, ...lead, ...argv.slice(i + 1)];
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export async function runCli(rawArgv: string[]): Promise<void> {
|
|
315
|
+
const argv = hoistLeadingFlags(rawArgv);
|
|
262
316
|
const [cmd, ...rest] = argv;
|
|
263
317
|
if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {
|
|
264
318
|
process.stdout.write(HELP);
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Single source of truth for the engine version the bundle reports. Kept in
|
|
2
2
|
// lockstep with package.json by the release pipeline. Do not edit by hand
|
|
3
3
|
// outside a release.
|
|
4
|
-
export const ENGINE_VERSION = "2.17.
|
|
4
|
+
export const ENGINE_VERSION = "2.17.1";
|
|
5
5
|
|
|
6
6
|
// Bumped whenever the on-disk artifact shape changes, so a consumer can reject
|
|
7
7
|
// an index written by an incompatible engine instead of misreading it. The
|