@wrongstack/tools 0.7.5 → 0.7.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/dist/audit.js +3 -3
- package/dist/audit.js.map +1 -1
- package/dist/bash.js +7 -6
- package/dist/bash.js.map +1 -1
- package/dist/builtin.js +2070 -133
- package/dist/builtin.js.map +1 -1
- package/dist/codebase-index/index.d.ts +120 -0
- package/dist/codebase-index/index.js +1974 -0
- package/dist/codebase-index/index.js.map +1 -0
- package/dist/codebase-stats-tool-BLhQmPNc.d.ts +158 -0
- package/dist/diff.js +4 -4
- package/dist/document.js +2 -2
- package/dist/edit.js +2 -2
- package/dist/exec.js +5 -5
- package/dist/exec.js.map +1 -1
- package/dist/fetch.js +4 -3
- package/dist/fetch.js.map +1 -1
- package/dist/format.js +3 -3
- package/dist/format.js.map +1 -1
- package/dist/git.js +3 -3
- package/dist/glob.js +2 -2
- package/dist/grep.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2039 -102
- package/dist/index.js.map +1 -1
- package/dist/install.js +3 -3
- package/dist/install.js.map +1 -1
- package/dist/json.js +1 -1
- package/dist/lint.js +3 -3
- package/dist/lint.js.map +1 -1
- package/dist/logs.js +5 -5
- package/dist/logs.js.map +1 -1
- package/dist/outdated.js +3 -3
- package/dist/pack.js +2070 -133
- package/dist/pack.js.map +1 -1
- package/dist/patch.js +4 -4
- package/dist/process-registry.js +1 -1
- package/dist/read.js +2 -2
- package/dist/replace.js +4 -4
- package/dist/replace.js.map +1 -1
- package/dist/scaffold.js +2 -2
- package/dist/test.js +3 -3
- package/dist/test.js.map +1 -1
- package/dist/tree.js +2 -2
- package/dist/typecheck.js +3 -3
- package/dist/typecheck.js.map +1 -1
- package/dist/write.js +2 -2
- package/package.json +8 -4
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { d as Symbol, F as FileMeta, e as SymbolKind, f as SymbolLang, c as SearchResult, b as IndexStats, R as Ref } from '../codebase-stats-tool-BLhQmPNc.js';
|
|
2
|
+
export { a as FileSymbols, I as IndexResult, S as SCHEMA_VERSION, g as codebaseIndexTool, h as codebaseSearchTool, i as codebaseStatsTool } from '../codebase-stats-tool-BLhQmPNc.js';
|
|
3
|
+
import '@wrongstack/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SQLite storage layer for the codebase index.
|
|
7
|
+
*
|
|
8
|
+
* Uses `node:sqlite` (synchronous API — DatabaseSync class).
|
|
9
|
+
* Database file: {projectRoot}/.codebase-index/index.db
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
declare class IndexStore {
|
|
13
|
+
private projectRoot;
|
|
14
|
+
private db;
|
|
15
|
+
constructor(projectRoot: string);
|
|
16
|
+
private initSchema;
|
|
17
|
+
insertSymbols(symbols: Symbol[], nextId: number): number;
|
|
18
|
+
deleteSymbolsForFile(file: string): void;
|
|
19
|
+
deleteFile(file: string): void;
|
|
20
|
+
upsertFile(meta: FileMeta): void;
|
|
21
|
+
getFileMeta(file: string): FileMeta | null;
|
|
22
|
+
getAllFileMetas(): FileMeta[];
|
|
23
|
+
search(query: string, filter?: {
|
|
24
|
+
kind?: SymbolKind;
|
|
25
|
+
lang?: SymbolLang;
|
|
26
|
+
file?: string;
|
|
27
|
+
lspKind?: number;
|
|
28
|
+
}): SearchResult[];
|
|
29
|
+
getAllIndexable(): Array<{
|
|
30
|
+
id: number;
|
|
31
|
+
text: string;
|
|
32
|
+
}>;
|
|
33
|
+
getStats(): IndexStats;
|
|
34
|
+
setLastIndexed(ts: number): void;
|
|
35
|
+
clearAll(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Insert cross-references for a given source symbol id.
|
|
38
|
+
* Replaces any existing refs from the same source (idempotent on re-index).
|
|
39
|
+
*/
|
|
40
|
+
insertRefs(fromId: number, refs: Ref[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* Delete all refs whose source symbols are in a given file.
|
|
43
|
+
* Used when re-indexing a file to clear stale refs.
|
|
44
|
+
*/
|
|
45
|
+
deleteRefsForFile(file: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve `to_name` → `to_id` for all refs that have a name but no id.
|
|
48
|
+
* Call this after all symbols have been inserted to fill in cross-references.
|
|
49
|
+
*/
|
|
50
|
+
resolveRefs(): number;
|
|
51
|
+
/**
|
|
52
|
+
* Find all references TO a given symbol (who calls / uses this symbol?).
|
|
53
|
+
*/
|
|
54
|
+
findRefsTo(symbolId: number): Ref[];
|
|
55
|
+
/**
|
|
56
|
+
* Find all references FROM a given symbol (what does this symbol call/use?).
|
|
57
|
+
*/
|
|
58
|
+
findRefsFrom(symbolId: number): Ref[];
|
|
59
|
+
private sizeBytes;
|
|
60
|
+
close(): void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* BM25 ranking implementation — no external dependencies.
|
|
65
|
+
*
|
|
66
|
+
* Algorithm: Okapi BM25 with standard parameters (k1=1.5, b=0.75).
|
|
67
|
+
*/
|
|
68
|
+
interface Bm25Doc {
|
|
69
|
+
id: number;
|
|
70
|
+
tokens: string[];
|
|
71
|
+
raw: string;
|
|
72
|
+
len: number;
|
|
73
|
+
}
|
|
74
|
+
/** Tokenise a string into lowercase word tokens. */
|
|
75
|
+
declare function tokenise(text: string): string[];
|
|
76
|
+
interface IndexableDoc {
|
|
77
|
+
id: number;
|
|
78
|
+
text: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Build indexable text for BM25 from a symbol's fields.
|
|
82
|
+
* The name is split into camelCase/SnakeCase words so that queries
|
|
83
|
+
* like "complex" match "complexOperation". The verbatim name is
|
|
84
|
+
* also included for exact-match queries.
|
|
85
|
+
*/
|
|
86
|
+
declare function buildIndexableText(name: string, signature: string, docComment: string): string;
|
|
87
|
+
declare function buildBm25Index(docs: IndexableDoc[]): Bm25Index;
|
|
88
|
+
declare class Bm25Index {
|
|
89
|
+
private documents;
|
|
90
|
+
private df;
|
|
91
|
+
private N;
|
|
92
|
+
private readonly safeAvgLen;
|
|
93
|
+
constructor(documents: Bm25Doc[], df: Record<string, number>, N: number, avgLen: number);
|
|
94
|
+
score(query: string, filter?: (id: number) => boolean): Array<{
|
|
95
|
+
id: number;
|
|
96
|
+
score: number;
|
|
97
|
+
}>;
|
|
98
|
+
getDoc(id: number): Bm25Doc | undefined;
|
|
99
|
+
extractSnippet(docId: number, queryTokens: string[], radius?: number): string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* LSP SymbolKind mapping utilities.
|
|
104
|
+
*
|
|
105
|
+
* LSP SymbolKind numbers are defined by vscode-languageserver-protocol.
|
|
106
|
+
* This module maps between LSP kind numbers and the internal SymbolKind taxonomy.
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Maps an LSP kind number to the corresponding internal SymbolKind.
|
|
111
|
+
* Returns null if the LSP kind has no equivalent in the internal taxonomy.
|
|
112
|
+
*/
|
|
113
|
+
declare function lspKindToInternalKind(k: number): SymbolKind | null;
|
|
114
|
+
/**
|
|
115
|
+
* Maps an internal SymbolKind to the corresponding LSP kind number.
|
|
116
|
+
* Returns null if the internal kind has no equivalent LSP kind.
|
|
117
|
+
*/
|
|
118
|
+
declare function internalKindToLspKind(k: SymbolKind): number | null;
|
|
119
|
+
|
|
120
|
+
export { FileMeta, IndexStats, IndexStore, SearchResult, Symbol, SymbolKind, SymbolLang, buildBm25Index, buildIndexableText, internalKindToLspKind, lspKindToInternalKind, tokenise };
|