@reqlan/analytical 0.5.4 → 0.6.0
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 +13 -2
- package/out/analysis/git-dates-analyser.js +41 -12
- package/out/analysis/git-dates-analyser.js.map +1 -1
- package/out/core/analytical-store.d.ts +9 -2
- package/out/core/analytical-store.js +7 -5
- package/out/core/analytical-store.js.map +1 -1
- package/out/core/application-memory.d.ts +17 -2
- package/out/core/application-memory.js +23 -5
- package/out/core/application-memory.js.map +1 -1
- package/out/core/base-discovery.d.ts +40 -0
- package/out/core/base-discovery.js +166 -0
- package/out/core/base-discovery.js.map +1 -0
- package/out/core/context-model.d.ts +17 -0
- package/out/core/context-model.js.map +1 -1
- package/out/core/create-base.d.ts +11 -0
- package/out/core/create-base.js +33 -0
- package/out/core/create-base.js.map +1 -0
- package/out/core/rqignore.d.ts +25 -0
- package/out/core/rqignore.js +149 -0
- package/out/core/rqignore.js.map +1 -0
- package/out/core/types.d.ts +5 -1
- package/out/core/types.js.map +1 -1
- package/out/create-runtime.d.ts +29 -4
- package/out/create-runtime.js +47 -8
- package/out/create-runtime.js.map +1 -1
- package/out/export/html-export-assets.d.ts +2 -2
- package/out/export/html-export-assets.js +259 -239
- package/out/export/html-export-assets.js.map +1 -1
- package/out/graph/physics-core.d.ts +141 -0
- package/out/graph/physics-core.js +237 -0
- package/out/graph/physics-core.js.map +1 -0
- package/out/headless-index-service.d.ts +6 -23
- package/out/headless-index-service.js +5 -171
- package/out/headless-index-service.js.map +1 -1
- package/out/index-store/base-registry.d.ts +57 -0
- package/out/index-store/base-registry.js +192 -0
- package/out/index-store/base-registry.js.map +1 -0
- package/out/index-store/index-diagnostics-store.d.ts +72 -0
- package/out/index-store/index-diagnostics-store.js +238 -0
- package/out/index-store/index-diagnostics-store.js.map +1 -0
- package/out/index-store/index-file-error.d.ts +16 -0
- package/out/index-store/index-file-error.js +27 -0
- package/out/index-store/index-file-error.js.map +1 -0
- package/out/index-store/index-parse-issues.d.ts +9 -0
- package/out/index-store/index-parse-issues.js +62 -0
- package/out/index-store/index-parse-issues.js.map +1 -0
- package/out/index-store/index-status.d.ts +20 -0
- package/out/index-store/index-status.js +2 -0
- package/out/index-store/index-status.js.map +1 -0
- package/out/index-store/overview-coverage.d.ts +23 -0
- package/out/index-store/overview-coverage.js +254 -0
- package/out/index-store/overview-coverage.js.map +1 -0
- package/out/index-store/schema.d.ts +1 -1
- package/out/index-store/schema.js +4 -1
- package/out/index-store/schema.js.map +1 -1
- package/out/index-store/sqlite-store.d.ts +31 -2
- package/out/index-store/sqlite-store.js +152 -13
- package/out/index-store/sqlite-store.js.map +1 -1
- package/out/index-store/webview-table-queries.d.ts +65 -1
- package/out/index-store/webview-table-queries.js +188 -26
- package/out/index-store/webview-table-queries.js.map +1 -1
- package/out/index-store/workspace-index-file.d.ts +27 -0
- package/out/index-store/workspace-index-file.js +98 -0
- package/out/index-store/workspace-index-file.js.map +1 -0
- package/out/index-store/workspace-index-sync.d.ts +53 -0
- package/out/index-store/workspace-index-sync.js +164 -0
- package/out/index-store/workspace-index-sync.js.map +1 -0
- package/out/index-store/workspace-index.d.ts +80 -0
- package/out/index-store/workspace-index.js +525 -0
- package/out/index-store/workspace-index.js.map +1 -0
- package/out/index-store/workspace-mtime.d.ts +14 -0
- package/out/index-store/workspace-mtime.js +56 -0
- package/out/index-store/workspace-mtime.js.map +1 -0
- package/out/index.d.ts +25 -6
- package/out/index.js +12 -3
- package/out/index.js.map +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-base index registry: one WorkspaceIndex + AnalyticalStore per base.
|
|
3
|
+
*/
|
|
4
|
+
import type { AnalyticalStore } from '../core/analytical-store.js';
|
|
5
|
+
import { type BaseDescriptor } from '../core/base-discovery.js';
|
|
6
|
+
import type { IndexStatusSnapshot } from './index-status.js';
|
|
7
|
+
import { WorkspaceIndex } from './workspace-index.js';
|
|
8
|
+
export interface RegisteredBase {
|
|
9
|
+
descriptor: BaseDescriptor;
|
|
10
|
+
store: AnalyticalStore;
|
|
11
|
+
index: WorkspaceIndex;
|
|
12
|
+
}
|
|
13
|
+
export interface BaseStatusEntry {
|
|
14
|
+
base: BaseDescriptor;
|
|
15
|
+
status: IndexStatusSnapshot;
|
|
16
|
+
}
|
|
17
|
+
export declare class BaseRegistry {
|
|
18
|
+
private readonly entries;
|
|
19
|
+
get size(): number;
|
|
20
|
+
list(): BaseDescriptor[];
|
|
21
|
+
get(baseId: string): RegisteredBase | undefined;
|
|
22
|
+
getByRoot(root: string): RegisteredBase | undefined;
|
|
23
|
+
baseForFilePath(absPath: string): RegisteredBase | undefined;
|
|
24
|
+
/** Replace registry contents from discovered descriptors (does not open indexes). */
|
|
25
|
+
replaceDescriptors(bases: BaseDescriptor[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Discover bases under `roots` and register them.
|
|
28
|
+
* Returns the discovered descriptors (may be empty).
|
|
29
|
+
*/
|
|
30
|
+
rediscover(roots: string[]): BaseDescriptor[];
|
|
31
|
+
/**
|
|
32
|
+
* Open every registered index. Failures are isolated so one bad base cannot
|
|
33
|
+
* leave siblings stranded in `uninitialized`.
|
|
34
|
+
*/
|
|
35
|
+
activateAll(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Open + soft-sync one base when it is not ready (pin / idle catch-up).
|
|
38
|
+
* Joins an in-flight sync; no-op when already ready.
|
|
39
|
+
*/
|
|
40
|
+
ensureBaseReady(baseId: string, allRqFiles: string[]): Promise<boolean>;
|
|
41
|
+
deactivateAll(): Promise<void>;
|
|
42
|
+
syncBase(baseId: string, allRqFiles: string[]): Promise<boolean>;
|
|
43
|
+
syncAll(allRqFiles: string[]): Promise<boolean>;
|
|
44
|
+
clearAndRebuildBase(baseId: string, allRqFiles: string[]): Promise<boolean>;
|
|
45
|
+
cancelSync(baseId?: string): void;
|
|
46
|
+
checkStaleAll(allRqFiles: string[]): Promise<{
|
|
47
|
+
checked: number;
|
|
48
|
+
indexed: number;
|
|
49
|
+
removed: number;
|
|
50
|
+
}>;
|
|
51
|
+
statusByBase(relativePath?: (uri: string) => string): BaseStatusEntry[];
|
|
52
|
+
/** Aggregate glance: ready only if every base is ready (or no bases). */
|
|
53
|
+
aggregateReady(): boolean;
|
|
54
|
+
selectDefault(cwd?: string): RegisteredBase | undefined;
|
|
55
|
+
subscribeCatalogUpdates(listener: () => void): () => void;
|
|
56
|
+
subscribeStatusUpdates(listener: () => void): () => void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { createAnalyticalStore } from '../core/analytical-store.js';
|
|
2
|
+
import { baseForPath, discoverBases, filesOwnedByBase, selectDefaultBase } from '../core/base-discovery.js';
|
|
3
|
+
import { resolveApplicationMemoryPath } from '../core/application-memory.js';
|
|
4
|
+
import { WorkspaceIndex } from './workspace-index.js';
|
|
5
|
+
export class BaseRegistry {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.entries = new Map();
|
|
8
|
+
}
|
|
9
|
+
get size() {
|
|
10
|
+
return this.entries.size;
|
|
11
|
+
}
|
|
12
|
+
list() {
|
|
13
|
+
return [...this.entries.values()]
|
|
14
|
+
.map(e => e.descriptor)
|
|
15
|
+
.sort((a, b) => a.root.localeCompare(b.root));
|
|
16
|
+
}
|
|
17
|
+
get(baseId) {
|
|
18
|
+
return this.entries.get(baseId);
|
|
19
|
+
}
|
|
20
|
+
getByRoot(root) {
|
|
21
|
+
for (const entry of this.entries.values()) {
|
|
22
|
+
if (entry.descriptor.root === root || entry.descriptor.id === root) {
|
|
23
|
+
return entry;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
baseForFilePath(absPath) {
|
|
29
|
+
const match = baseForPath(this.list(), absPath);
|
|
30
|
+
return match ? this.entries.get(match.id) : undefined;
|
|
31
|
+
}
|
|
32
|
+
/** Replace registry contents from discovered descriptors (does not open indexes). */
|
|
33
|
+
replaceDescriptors(bases) {
|
|
34
|
+
const keep = new Set(bases.map(b => b.id));
|
|
35
|
+
for (const id of [...this.entries.keys()]) {
|
|
36
|
+
if (!keep.has(id)) {
|
|
37
|
+
const entry = this.entries.get(id);
|
|
38
|
+
void entry?.index.deactivate();
|
|
39
|
+
this.entries.delete(id);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
for (const descriptor of bases) {
|
|
43
|
+
if (this.entries.has(descriptor.id)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const store = createAnalyticalStore();
|
|
47
|
+
const storagePath = resolveApplicationMemoryPath(descriptor.root);
|
|
48
|
+
const index = new WorkspaceIndex(store, storagePath, descriptor.root);
|
|
49
|
+
this.entries.set(descriptor.id, { descriptor, store, index });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Discover bases under `roots` and register them.
|
|
54
|
+
* Returns the discovered descriptors (may be empty).
|
|
55
|
+
*/
|
|
56
|
+
rediscover(roots) {
|
|
57
|
+
const bases = discoverBases(roots);
|
|
58
|
+
this.replaceDescriptors(bases);
|
|
59
|
+
return bases;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Open every registered index. Failures are isolated so one bad base cannot
|
|
63
|
+
* leave siblings stranded in `uninitialized`.
|
|
64
|
+
*/
|
|
65
|
+
async activateAll() {
|
|
66
|
+
for (const entry of this.entries.values()) {
|
|
67
|
+
try {
|
|
68
|
+
await entry.index.open();
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Per-base store already recorded the open error.
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Open + soft-sync one base when it is not ready (pin / idle catch-up).
|
|
77
|
+
* Joins an in-flight sync; no-op when already ready.
|
|
78
|
+
*/
|
|
79
|
+
async ensureBaseReady(baseId, allRqFiles) {
|
|
80
|
+
const entry = this.entries.get(baseId);
|
|
81
|
+
if (!entry) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
const owned = filesOwnedByBase(entry.descriptor, allRqFiles, this.list());
|
|
85
|
+
return entry.index.ensureReady(owned);
|
|
86
|
+
}
|
|
87
|
+
async deactivateAll() {
|
|
88
|
+
for (const entry of this.entries.values()) {
|
|
89
|
+
await entry.index.deactivate();
|
|
90
|
+
}
|
|
91
|
+
this.entries.clear();
|
|
92
|
+
}
|
|
93
|
+
async syncBase(baseId, allRqFiles) {
|
|
94
|
+
const entry = this.entries.get(baseId);
|
|
95
|
+
if (!entry) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
const owned = filesOwnedByBase(entry.descriptor, allRqFiles, this.list());
|
|
99
|
+
return entry.index.syncWorkspace(owned);
|
|
100
|
+
}
|
|
101
|
+
async syncAll(allRqFiles) {
|
|
102
|
+
let ok = true;
|
|
103
|
+
for (const entry of this.entries.values()) {
|
|
104
|
+
const result = await this.syncBase(entry.descriptor.id, allRqFiles);
|
|
105
|
+
if (!result) {
|
|
106
|
+
ok = false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return ok;
|
|
110
|
+
}
|
|
111
|
+
async clearAndRebuildBase(baseId, allRqFiles) {
|
|
112
|
+
const entry = this.entries.get(baseId);
|
|
113
|
+
if (!entry) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
const owned = filesOwnedByBase(entry.descriptor, allRqFiles, this.list());
|
|
117
|
+
return entry.index.clearAndRebuildIndex(owned);
|
|
118
|
+
}
|
|
119
|
+
cancelSync(baseId) {
|
|
120
|
+
if (baseId) {
|
|
121
|
+
this.entries.get(baseId)?.index.cancelSync();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
for (const entry of this.entries.values()) {
|
|
125
|
+
entry.index.cancelSync();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async checkStaleAll(allRqFiles) {
|
|
129
|
+
let checked = 0;
|
|
130
|
+
let indexed = 0;
|
|
131
|
+
let removed = 0;
|
|
132
|
+
for (const entry of this.entries.values()) {
|
|
133
|
+
const owned = filesOwnedByBase(entry.descriptor, allRqFiles, this.list());
|
|
134
|
+
// Unopened / never-synced bases cannot idle-diff — catch them up first.
|
|
135
|
+
if (!entry.index.isReady && entry.index.state !== 'syncing' && entry.index.state !== 'opening') {
|
|
136
|
+
const ok = await entry.index.ensureReady(owned);
|
|
137
|
+
if (ok) {
|
|
138
|
+
checked += owned.length;
|
|
139
|
+
indexed += owned.length;
|
|
140
|
+
}
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const result = await entry.index.checkStaleFiles(owned);
|
|
144
|
+
checked += result.checked;
|
|
145
|
+
indexed += result.indexed;
|
|
146
|
+
removed += result.removed;
|
|
147
|
+
}
|
|
148
|
+
return { checked, indexed, removed };
|
|
149
|
+
}
|
|
150
|
+
statusByBase(relativePath) {
|
|
151
|
+
return this.list().map(base => {
|
|
152
|
+
const entry = this.entries.get(base.id);
|
|
153
|
+
return {
|
|
154
|
+
base,
|
|
155
|
+
status: entry.index.getStatusSnapshot(relativePath)
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/** Aggregate glance: ready only if every base is ready (or no bases). */
|
|
160
|
+
aggregateReady() {
|
|
161
|
+
if (this.entries.size === 0) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
for (const entry of this.entries.values()) {
|
|
165
|
+
if (!entry.index.isReady) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
selectDefault(cwd) {
|
|
172
|
+
const desc = selectDefaultBase(this.list(), cwd);
|
|
173
|
+
return desc ? this.entries.get(desc.id) : undefined;
|
|
174
|
+
}
|
|
175
|
+
subscribeCatalogUpdates(listener) {
|
|
176
|
+
const unsubs = [...this.entries.values()].map(e => e.index.subscribeCatalogUpdates(listener));
|
|
177
|
+
return () => {
|
|
178
|
+
for (const u of unsubs) {
|
|
179
|
+
u();
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
subscribeStatusUpdates(listener) {
|
|
184
|
+
const unsubs = [...this.entries.values()].map(e => e.index.subscribeStatusUpdates(listener));
|
|
185
|
+
return () => {
|
|
186
|
+
for (const u of unsubs) {
|
|
187
|
+
u();
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=base-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-registry.js","sourceRoot":"","sources":["../../src/index-store/base-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EACH,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAatD,MAAM,OAAO,YAAY;IAAzB;QACqB,YAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;IA0MjE,CAAC;IAxMG,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED,IAAI;QACA,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;aAC5B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;aACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,GAAG,CAAC,MAAc;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,C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B;QACxC,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9F,OAAO,GAAG,EAAE;YACR,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;gBACrB,CAAC,EAAE,CAAC;YACR,CAAC;QACL,CAAC,CAAC;IACN,CAAC;IAED,sBAAsB,CAAC,QAAoB;QACvC,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC7F,OAAO,GAAG,EAAE;YACR,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;gBACrB,CAAC,EAAE,CAAC;YACR,CAAC;QACL,CAAC,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type IndexTimingTrigger = 'soft_sync' | 'rebuild' | 'enqueue' | 'stale';
|
|
2
|
+
export type IndexFileOutcome = 'mtime_skip' | 'mtime_refresh' | 'hash_skip' | 'persisted' | 'error';
|
|
3
|
+
export interface IndexFileTimingRecord {
|
|
4
|
+
fileUri: string;
|
|
5
|
+
durationMs: number;
|
|
6
|
+
outcome: IndexFileOutcome;
|
|
7
|
+
pathDepth: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IndexSyncRunRecord {
|
|
10
|
+
trigger: IndexTimingTrigger;
|
|
11
|
+
startedAt: string;
|
|
12
|
+
finishedAt: string;
|
|
13
|
+
durationMs: number;
|
|
14
|
+
totalFiles: number;
|
|
15
|
+
skippedMtime: number;
|
|
16
|
+
indexedFiles: number;
|
|
17
|
+
errorFiles: number;
|
|
18
|
+
cancelled: boolean;
|
|
19
|
+
sumFileDurationMs: number;
|
|
20
|
+
avgPathDepth: number | undefined;
|
|
21
|
+
files: IndexFileTimingRecord[];
|
|
22
|
+
}
|
|
23
|
+
export interface IndexSyncRunSummary {
|
|
24
|
+
id: number;
|
|
25
|
+
trigger: IndexTimingTrigger;
|
|
26
|
+
startedAt: string;
|
|
27
|
+
finishedAt: string;
|
|
28
|
+
durationMs: number;
|
|
29
|
+
totalFiles: number;
|
|
30
|
+
skippedMtime: number;
|
|
31
|
+
indexedFiles: number;
|
|
32
|
+
errorFiles: number;
|
|
33
|
+
cancelled: boolean;
|
|
34
|
+
sumFileDurationMs: number;
|
|
35
|
+
avgPathDepth: number | undefined;
|
|
36
|
+
}
|
|
37
|
+
export interface IndexFileTimingRow {
|
|
38
|
+
id: number;
|
|
39
|
+
runId: number;
|
|
40
|
+
fileUri: string;
|
|
41
|
+
durationMs: number;
|
|
42
|
+
outcome: IndexFileOutcome;
|
|
43
|
+
pathDepth: number;
|
|
44
|
+
}
|
|
45
|
+
export interface IndexDiagnosticsOverview {
|
|
46
|
+
runCount: number;
|
|
47
|
+
latestRun: IndexSyncRunSummary | undefined;
|
|
48
|
+
/** Sum of wall durations across retained runs. */
|
|
49
|
+
totalDurationMs: number;
|
|
50
|
+
/** Sum of per-file durations across retained runs. */
|
|
51
|
+
totalFileDurationMs: number;
|
|
52
|
+
averageRunDurationMs: number;
|
|
53
|
+
averagePathDepth: number | undefined;
|
|
54
|
+
}
|
|
55
|
+
/** Path segment count under the base (e.g. `a/b/c.rq` → 3). */
|
|
56
|
+
export declare function pathDepthFromUri(fileUri: string): number;
|
|
57
|
+
export declare class IndexDiagnosticsStore {
|
|
58
|
+
private readonly db;
|
|
59
|
+
private constructor();
|
|
60
|
+
static open(dbPath: string): Promise<IndexDiagnosticsStore>;
|
|
61
|
+
close(): Promise<void>;
|
|
62
|
+
recordSyncRun(run: IndexSyncRunRecord): Promise<number>;
|
|
63
|
+
listRecentRuns(limit?: number): Promise<IndexSyncRunSummary[]>;
|
|
64
|
+
getRun(runId: number): Promise<IndexSyncRunSummary | undefined>;
|
|
65
|
+
listFileTimings(runId: number, options?: {
|
|
66
|
+
limit?: number;
|
|
67
|
+
order?: 'duration_desc' | 'duration_asc' | 'path';
|
|
68
|
+
}): Promise<IndexFileTimingRow[]>;
|
|
69
|
+
getOverview(): Promise<IndexDiagnosticsOverview>;
|
|
70
|
+
private migrate;
|
|
71
|
+
private trimOldRuns;
|
|
72
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-base indexing timing diagnostic store (`index-diagnostics.sqlite`).
|
|
3
|
+
* Sibling of ideas-index; survives Clear & rebuild.
|
|
4
|
+
*
|
|
5
|
+
* rq:["../../../reqlan rq/extension/module/index.rq".index_diagnostics_store]
|
|
6
|
+
* rq:["../../../reqlan rq/extension/features-index-diagnostics.rq".index_diagnostics_metrics]
|
|
7
|
+
* rq:["../../../reqlan rq/indexer/indexer.rq".index_diagnostics_timing]
|
|
8
|
+
*/
|
|
9
|
+
import initSqlJs from 'sql.js/dist/sql-asm.js';
|
|
10
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
11
|
+
import { dirname } from 'node:path';
|
|
12
|
+
const SCHEMA_VERSION = 1;
|
|
13
|
+
const MAX_RETAINED_RUNS = 50;
|
|
14
|
+
const BASE_SQL = [
|
|
15
|
+
`CREATE TABLE IF NOT EXISTS meta (
|
|
16
|
+
key TEXT PRIMARY KEY,
|
|
17
|
+
value TEXT NOT NULL
|
|
18
|
+
)`,
|
|
19
|
+
`CREATE TABLE IF NOT EXISTS sync_runs (
|
|
20
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
+
started_at TEXT NOT NULL,
|
|
22
|
+
finished_at TEXT NOT NULL,
|
|
23
|
+
duration_ms REAL NOT NULL,
|
|
24
|
+
trigger TEXT NOT NULL,
|
|
25
|
+
total_files INTEGER NOT NULL,
|
|
26
|
+
skipped_mtime INTEGER NOT NULL,
|
|
27
|
+
indexed_files INTEGER NOT NULL,
|
|
28
|
+
error_files INTEGER NOT NULL,
|
|
29
|
+
cancelled INTEGER NOT NULL DEFAULT 0,
|
|
30
|
+
sum_file_duration_ms REAL NOT NULL DEFAULT 0,
|
|
31
|
+
avg_path_depth REAL
|
|
32
|
+
)`,
|
|
33
|
+
`CREATE TABLE IF NOT EXISTS file_timings (
|
|
34
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
35
|
+
run_id INTEGER NOT NULL,
|
|
36
|
+
file_uri TEXT NOT NULL,
|
|
37
|
+
duration_ms REAL NOT NULL,
|
|
38
|
+
outcome TEXT NOT NULL,
|
|
39
|
+
path_depth INTEGER NOT NULL,
|
|
40
|
+
FOREIGN KEY (run_id) REFERENCES sync_runs(id) ON DELETE CASCADE
|
|
41
|
+
)`,
|
|
42
|
+
`CREATE INDEX IF NOT EXISTS idx_file_timings_run ON file_timings(run_id)`,
|
|
43
|
+
`CREATE INDEX IF NOT EXISTS idx_file_timings_duration ON file_timings(duration_ms DESC)`
|
|
44
|
+
];
|
|
45
|
+
/** Path segment count under the base (e.g. `a/b/c.rq` → 3). */
|
|
46
|
+
export function pathDepthFromUri(fileUri) {
|
|
47
|
+
const normalized = fileUri.replace(/\\/g, '/').replace(/^\.\/+/, '').replace(/^\/+/, '');
|
|
48
|
+
if (!normalized) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
return normalized.split('/').filter(Boolean).length;
|
|
52
|
+
}
|
|
53
|
+
export class IndexDiagnosticsStore {
|
|
54
|
+
constructor(db) {
|
|
55
|
+
this.db = db;
|
|
56
|
+
}
|
|
57
|
+
static async open(dbPath) {
|
|
58
|
+
const db = await openDatabase(dbPath);
|
|
59
|
+
const store = new IndexDiagnosticsStore(db);
|
|
60
|
+
await store.migrate();
|
|
61
|
+
return store;
|
|
62
|
+
}
|
|
63
|
+
async close() {
|
|
64
|
+
await persistDatabase(this.db);
|
|
65
|
+
this.db.db.close();
|
|
66
|
+
}
|
|
67
|
+
async recordSyncRun(run) {
|
|
68
|
+
try {
|
|
69
|
+
this.db.db.run('BEGIN');
|
|
70
|
+
this.db.db.run(`INSERT INTO sync_runs (
|
|
71
|
+
started_at, finished_at, duration_ms, trigger,
|
|
72
|
+
total_files, skipped_mtime, indexed_files, error_files,
|
|
73
|
+
cancelled, sum_file_duration_ms, avg_path_depth
|
|
74
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
75
|
+
run.startedAt,
|
|
76
|
+
run.finishedAt,
|
|
77
|
+
run.durationMs,
|
|
78
|
+
run.trigger,
|
|
79
|
+
run.totalFiles,
|
|
80
|
+
run.skippedMtime,
|
|
81
|
+
run.indexedFiles,
|
|
82
|
+
run.errorFiles,
|
|
83
|
+
run.cancelled ? 1 : 0,
|
|
84
|
+
run.sumFileDurationMs,
|
|
85
|
+
run.avgPathDepth ?? null
|
|
86
|
+
]);
|
|
87
|
+
const idRow = await get(this.db, 'SELECT last_insert_rowid() AS id');
|
|
88
|
+
const runId = idRow?.id ?? 0;
|
|
89
|
+
for (const file of run.files) {
|
|
90
|
+
this.db.db.run(`INSERT INTO file_timings (run_id, file_uri, duration_ms, outcome, path_depth)
|
|
91
|
+
VALUES (?, ?, ?, ?, ?)`, [runId, file.fileUri, file.durationMs, file.outcome, file.pathDepth]);
|
|
92
|
+
}
|
|
93
|
+
this.db.db.run('COMMIT');
|
|
94
|
+
this.db.dirty = true;
|
|
95
|
+
await this.trimOldRuns();
|
|
96
|
+
await persistDatabase(this.db);
|
|
97
|
+
return runId;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
try {
|
|
101
|
+
this.db.db.run('ROLLBACK');
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// ignore
|
|
105
|
+
}
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async listRecentRuns(limit = 20) {
|
|
110
|
+
const rows = await all(this.db, `SELECT * FROM sync_runs ORDER BY id DESC LIMIT ?`, Math.max(1, Math.min(limit, MAX_RETAINED_RUNS)));
|
|
111
|
+
return rows.map(mapRunSummary);
|
|
112
|
+
}
|
|
113
|
+
async getRun(runId) {
|
|
114
|
+
const row = await get(this.db, `SELECT * FROM sync_runs WHERE id = ?`, runId);
|
|
115
|
+
return row ? mapRunSummary(row) : undefined;
|
|
116
|
+
}
|
|
117
|
+
async listFileTimings(runId, options) {
|
|
118
|
+
const order = options?.order ?? 'duration_desc';
|
|
119
|
+
const orderSql = order === 'duration_asc'
|
|
120
|
+
? 'duration_ms ASC, file_uri ASC'
|
|
121
|
+
: order === 'path'
|
|
122
|
+
? 'file_uri ASC'
|
|
123
|
+
: 'duration_ms DESC, file_uri ASC';
|
|
124
|
+
const limit = Math.max(1, Math.min(options?.limit ?? 500, 2000));
|
|
125
|
+
const rows = await all(this.db, `SELECT * FROM file_timings WHERE run_id = ? ORDER BY ${orderSql} LIMIT ?`, runId, limit);
|
|
126
|
+
return rows.map(mapFileTiming);
|
|
127
|
+
}
|
|
128
|
+
async getOverview() {
|
|
129
|
+
const agg = await get(this.db, `SELECT
|
|
130
|
+
COUNT(*) AS run_count,
|
|
131
|
+
COALESCE(SUM(duration_ms), 0) AS total_duration,
|
|
132
|
+
COALESCE(SUM(sum_file_duration_ms), 0) AS total_file_duration,
|
|
133
|
+
AVG(avg_path_depth) AS avg_depth
|
|
134
|
+
FROM sync_runs`);
|
|
135
|
+
const runs = await this.listRecentRuns(1);
|
|
136
|
+
const runCount = agg?.run_count ?? 0;
|
|
137
|
+
const totalDurationMs = agg?.total_duration ?? 0;
|
|
138
|
+
return {
|
|
139
|
+
runCount,
|
|
140
|
+
latestRun: runs[0],
|
|
141
|
+
totalDurationMs,
|
|
142
|
+
totalFileDurationMs: agg?.total_file_duration ?? 0,
|
|
143
|
+
averageRunDurationMs: runCount > 0 ? totalDurationMs / runCount : 0,
|
|
144
|
+
averagePathDepth: agg?.avg_depth == null ? undefined : agg.avg_depth
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
async migrate() {
|
|
148
|
+
for (const sql of BASE_SQL) {
|
|
149
|
+
this.db.db.run(sql);
|
|
150
|
+
}
|
|
151
|
+
this.db.db.run(`INSERT INTO meta (key, value) VALUES (?, ?)
|
|
152
|
+
ON CONFLICT(key) DO UPDATE SET value = excluded.value`, ['schema_version', String(SCHEMA_VERSION)]);
|
|
153
|
+
this.db.dirty = true;
|
|
154
|
+
await persistDatabase(this.db);
|
|
155
|
+
}
|
|
156
|
+
async trimOldRuns() {
|
|
157
|
+
const cutoff = await get(this.db, `SELECT id FROM sync_runs ORDER BY id DESC LIMIT 1 OFFSET ?`, MAX_RETAINED_RUNS - 1);
|
|
158
|
+
if (!cutoff) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
this.db.db.run(`DELETE FROM file_timings WHERE run_id < ?`, [cutoff.id]);
|
|
162
|
+
this.db.db.run(`DELETE FROM sync_runs WHERE id < ?`, [cutoff.id]);
|
|
163
|
+
this.db.dirty = true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function mapRunSummary(row) {
|
|
167
|
+
return {
|
|
168
|
+
id: row.id,
|
|
169
|
+
trigger: row.trigger,
|
|
170
|
+
startedAt: row.started_at,
|
|
171
|
+
finishedAt: row.finished_at,
|
|
172
|
+
durationMs: row.duration_ms,
|
|
173
|
+
totalFiles: row.total_files,
|
|
174
|
+
skippedMtime: row.skipped_mtime,
|
|
175
|
+
indexedFiles: row.indexed_files,
|
|
176
|
+
errorFiles: row.error_files,
|
|
177
|
+
cancelled: row.cancelled !== 0,
|
|
178
|
+
sumFileDurationMs: row.sum_file_duration_ms,
|
|
179
|
+
avgPathDepth: row.avg_path_depth == null ? undefined : row.avg_path_depth
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function mapFileTiming(row) {
|
|
183
|
+
return {
|
|
184
|
+
id: row.id,
|
|
185
|
+
runId: row.run_id,
|
|
186
|
+
fileUri: row.file_uri,
|
|
187
|
+
durationMs: row.duration_ms,
|
|
188
|
+
outcome: row.outcome,
|
|
189
|
+
pathDepth: row.path_depth
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
let sqlJsModulePromise;
|
|
193
|
+
async function getSqlJsModule() {
|
|
194
|
+
sqlJsModulePromise ?? (sqlJsModulePromise = initSqlJs({}));
|
|
195
|
+
return sqlJsModulePromise;
|
|
196
|
+
}
|
|
197
|
+
async function openDatabase(path) {
|
|
198
|
+
await mkdir(dirname(path), { recursive: true });
|
|
199
|
+
const SQL = await getSqlJsModule();
|
|
200
|
+
let bytes;
|
|
201
|
+
try {
|
|
202
|
+
bytes = new Uint8Array(await readFile(path));
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
bytes = undefined;
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
db: bytes ? new SQL.Database(bytes) : new SQL.Database(),
|
|
209
|
+
dbPath: path,
|
|
210
|
+
dirty: false
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
async function persistDatabase(db) {
|
|
214
|
+
if (!db.dirty) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
await mkdir(dirname(db.dbPath), { recursive: true });
|
|
218
|
+
await writeFile(db.dbPath, Buffer.from(db.db.export()));
|
|
219
|
+
db.dirty = false;
|
|
220
|
+
}
|
|
221
|
+
async function get(db, sql, ...params) {
|
|
222
|
+
const rows = await all(db, sql, ...params);
|
|
223
|
+
return rows[0];
|
|
224
|
+
}
|
|
225
|
+
async function all(db, sql, ...params) {
|
|
226
|
+
const statement = db.db.prepare(sql, params);
|
|
227
|
+
const rows = [];
|
|
228
|
+
try {
|
|
229
|
+
while (statement.step()) {
|
|
230
|
+
rows.push(statement.getAsObject());
|
|
231
|
+
}
|
|
232
|
+
return rows;
|
|
233
|
+
}
|
|
234
|
+
finally {
|
|
235
|
+
statement.free();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=index-diagnostics-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-diagnostics-store.js","sourceRoot":"","sources":["../../src/index-store/index-diagnostics-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoEpC,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,QAAQ,GAAG;IACb;;;MAGE;IACF;;;;;;;;;;;;;MAaE;IACF;;;;;;;;MAQE;IACF,yEAAyE;IACzE,wFAAwF;CAC3F,CAAC;AA0BF,+DAA+D;AAC/D,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzF,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AACxD,CAAC;AAED,MAAM,OAAO,qBAAqB;IAG9B,YAAoB,EAAkB;QAClC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAc;QAC5B,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,qBAAqB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,KAAK,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AAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,MAAM,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxD,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,CAAC;AAED,KAAK,UAAU,GAAG,CAAI,EAAkB,EAAE,GAAW,EAAE,GAAG,MAAiB;IACvE,MAAM,IAAI,GAAG,MAAM,GAAG,CAAI,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED,KAAK,UAAU,GAAG,CAAI,EAAkB,EAAE,GAAW,EAAE,GAAG,MAAiB;IACvE,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAQ,EAAE,CAAC;IACrB,IAAI,CAAC;QACD,OAAO,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAO,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,SAAS,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IndexErrorPhase } from '../core/analytical-store.js';
|
|
2
|
+
import type { FileIndexIssueDraft } from './index-parse-issues.js';
|
|
3
|
+
export declare class IndexFileError extends Error {
|
|
4
|
+
readonly fileUri: string;
|
|
5
|
+
readonly phase: IndexErrorPhase;
|
|
6
|
+
readonly ideaNames?: string[];
|
|
7
|
+
readonly underlyingCause?: unknown;
|
|
8
|
+
constructor(message: string, fileUri: string, phase: IndexErrorPhase, ideaNames?: string[], cause?: unknown);
|
|
9
|
+
}
|
|
10
|
+
export declare function toFileIndexIssueDraft(error: IndexFileError): FileIndexIssueDraft;
|
|
11
|
+
export declare function recordCaughtFileIssue(recordFileIndexIssues: (fileUri: string, issues: FileIndexIssueDraft[]) => void, fileUri: string, error: unknown, fallbackMessage: string, fallbackPhase?: IndexErrorPhase): void;
|
|
12
|
+
export declare function recordCaughtIndexError(recordIndexError: (message: string, cause?: unknown, context?: {
|
|
13
|
+
fileUri?: string;
|
|
14
|
+
ideaNames?: string[];
|
|
15
|
+
phase?: IndexErrorPhase;
|
|
16
|
+
}) => void, error: unknown, fallbackMessage: string, fallbackPhase?: IndexErrorPhase): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { fileIssueFromError } from './index-parse-issues.js';
|
|
2
|
+
export class IndexFileError extends Error {
|
|
3
|
+
constructor(message, fileUri, phase, ideaNames, cause) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'IndexFileError';
|
|
6
|
+
this.fileUri = fileUri;
|
|
7
|
+
this.phase = phase;
|
|
8
|
+
this.ideaNames = ideaNames;
|
|
9
|
+
this.underlyingCause = cause;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function toFileIndexIssueDraft(error) {
|
|
13
|
+
return fileIssueFromError(error.phase, error.underlyingCause ?? error, error.message, 0, 0, error.ideaNames);
|
|
14
|
+
}
|
|
15
|
+
export function recordCaughtFileIssue(recordFileIndexIssues, fileUri, error, fallbackMessage, fallbackPhase = 'sync') {
|
|
16
|
+
if (error instanceof IndexFileError) {
|
|
17
|
+
recordFileIndexIssues(fileUri, [toFileIndexIssueDraft(error)]);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
recordFileIndexIssues(fileUri, [
|
|
21
|
+
fileIssueFromError(fallbackPhase, error, fallbackMessage)
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
export function recordCaughtIndexError(recordIndexError, error, fallbackMessage, fallbackPhase = 'sync') {
|
|
25
|
+
recordIndexError(fallbackMessage, error, { phase: fallbackPhase });
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index-file-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-file-error.js","sourceRoot":"","sources":["../../src/index-store/index-file-error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,OAAO,cAAe,SAAQ,KAAK;IAMrC,YACI,OAAe,EACf,OAAe,EACf,KAAsB,EACtB,SAAoB,EACpB,KAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;CACJ;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAqB;IACvD,OAAO,kBAAkB,CACrB,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,eAAe,IAAI,KAAK,EAC9B,KAAK,CAAC,OAAO,EACb,CAAC,EACD,CAAC,EACD,KAAK,CAAC,SAAS,CAClB,CAAC;AACN,CAAC;AAED,MAAM,UAAU,qBAAqB,CACjC,qBAA+E,EAC/E,OAAe,EACf,KAAc,EACd,eAAuB,EACvB,gBAAiC,MAAM;IAEvC,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;QAClC,qBAAqB,CAAC,OAAO,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO;IACX,CAAC;IACD,qBAAqB,CAAC,OAAO,EAAE;QAC3B,kBAAkB,CAAC,aAAa,EAAE,KAAK,EAAE,eAAe,CAAC;KAC5D,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,sBAAsB,CAClC,gBAIS,EACT,KAAc,EACd,eAAuB,EACvB,gBAAiC,MAAM;IAEvC,gBAAgB,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LangiumDocument } from 'langium';
|
|
2
|
+
import type { FileIndexIssue, IndexErrorPhase } from '../core/analytical-store.js';
|
|
3
|
+
import type { IdeaRecord } from '../core/types.js';
|
|
4
|
+
export type FileIndexIssueDraft = Omit<FileIndexIssue, 'fileUri' | 'at'>;
|
|
5
|
+
export declare function collectParseIssues(document: LangiumDocument): FileIndexIssueDraft[];
|
|
6
|
+
export declare function fileIssue(message: string, phase: IndexErrorPhase, line?: number, column?: number, ideaNames?: string[]): FileIndexIssueDraft;
|
|
7
|
+
export declare function fileIssueFromError(phase: IndexErrorPhase, error: unknown, fallbackMessage: string, line?: number, column?: number, ideaNames?: string[]): FileIndexIssueDraft;
|
|
8
|
+
export declare function unnamedIdeaIssues(ideas: IdeaRecord[]): FileIndexIssueDraft[];
|
|
9
|
+
export declare function validIdeas(ideas: IdeaRecord[]): IdeaRecord[];
|