@reqlan/analytical 0.8.2 → 0.10.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.
Files changed (179) hide show
  1. package/README.md +27 -2
  2. package/README.template.md +1 -1
  3. package/out/core/barrel-page.d.ts +2 -1
  4. package/out/core/barrel-page.js +18 -83
  5. package/out/core/barrel-page.js.map +1 -1
  6. package/out/core/base-discovery.d.ts +6 -0
  7. package/out/core/base-discovery.js +56 -4
  8. package/out/core/base-discovery.js.map +1 -1
  9. package/out/core/create-base.js +10 -14
  10. package/out/core/create-base.js.map +1 -1
  11. package/out/core/file-reference-resolve.js +8 -2
  12. package/out/core/file-reference-resolve.js.map +1 -1
  13. package/out/core/index-error.d.ts +3 -3
  14. package/out/core/index-error.js.map +1 -1
  15. package/out/core/index-state-types.d.ts +47 -0
  16. package/out/core/index-state-types.js +11 -0
  17. package/out/core/index-state-types.js.map +1 -0
  18. package/out/core/path-relative.d.ts +15 -0
  19. package/out/core/path-relative.js +84 -0
  20. package/out/core/path-relative.js.map +1 -0
  21. package/out/core/rqignore.js +62 -62
  22. package/out/core/rqignore.js.map +1 -1
  23. package/out/core/types.d.ts +12 -3
  24. package/out/core/types.js +4 -1
  25. package/out/core/types.js.map +1 -1
  26. package/out/core/workspace-paths.d.ts +1 -1
  27. package/out/core/workspace-paths.js +8 -44
  28. package/out/core/workspace-paths.js.map +1 -1
  29. package/out/export/build-export-snapshot.js +1 -1
  30. package/out/export/build-export-snapshot.js.map +1 -1
  31. package/out/export/export-utils.d.ts +5 -0
  32. package/out/export/export-utils.js +38 -0
  33. package/out/export/export-utils.js.map +1 -0
  34. package/out/export/write-csv-export.js +1 -1
  35. package/out/export/write-csv-export.js.map +1 -1
  36. package/out/export/write-markdown-export.js +1 -1
  37. package/out/export/write-markdown-export.js.map +1 -1
  38. package/out/index-store/base-registry.d.ts +2 -3
  39. package/out/index-store/base-registry.js +8 -4
  40. package/out/index-store/base-registry.js.map +1 -1
  41. package/out/index-store/fuzzy-search-hit.d.ts +10 -0
  42. package/out/index-store/fuzzy-search-hit.js +2 -0
  43. package/out/index-store/fuzzy-search-hit.js.map +1 -0
  44. package/out/index-store/index-diagnostics-store.d.ts +4 -0
  45. package/out/index-store/index-diagnostics-store.js +44 -88
  46. package/out/index-store/index-diagnostics-store.js.map +1 -1
  47. package/out/index-store/index-file-error.d.ts +1 -1
  48. package/out/index-store/index-parse-issues.d.ts +4 -3
  49. package/out/index-store/index-parse-issues.js +0 -38
  50. package/out/index-store/index-parse-issues.js.map +1 -1
  51. package/out/index-store/index-status.d.ts +1 -1
  52. package/out/index-store/schema.d.ts +1 -1
  53. package/out/index-store/schema.js +6 -2
  54. package/out/index-store/schema.js.map +1 -1
  55. package/out/index-store/sqlite-store.d.ts +10 -4
  56. package/out/index-store/sqlite-store.js +81 -606
  57. package/out/index-store/sqlite-store.js.map +1 -1
  58. package/out/index-store/webview-graph-queries.d.ts +7 -0
  59. package/out/index-store/webview-graph-queries.js.map +1 -1
  60. package/out/index-store/webview-table-queries.d.ts +1 -1
  61. package/out/index-store/webview-table-queries.js +9 -0
  62. package/out/index-store/webview-table-queries.js.map +1 -1
  63. package/out/index-store/workspace-index-file.d.ts +3 -14
  64. package/out/index-store/workspace-index-file.js +1 -118
  65. package/out/index-store/workspace-index-file.js.map +1 -1
  66. package/out/index-store/workspace-index-sync.d.ts +4 -17
  67. package/out/index-store/workspace-index-sync.js +29 -11
  68. package/out/index-store/workspace-index-sync.js.map +1 -1
  69. package/out/index-store/workspace-index.d.ts +36 -9
  70. package/out/index-store/workspace-index.js +223 -120
  71. package/out/index-store/workspace-index.js.map +1 -1
  72. package/out/index.d.ts +16 -39
  73. package/out/index.js +9 -23
  74. package/out/index.js.map +1 -1
  75. package/out/native/generated.d.ts +102 -0
  76. package/out/native/generated.js +4 -0
  77. package/out/native/generated.js.map +1 -0
  78. package/out/native/index.d.ts +17 -0
  79. package/out/native/index.js +12 -0
  80. package/out/native/index.js.map +1 -0
  81. package/out/native/load-native.d.ts +50 -0
  82. package/out/native/load-native.js +152 -0
  83. package/out/native/load-native.js.map +1 -0
  84. package/out/{analysis-api.d.ts → native/native-analysis-api.d.ts} +24 -20
  85. package/out/native/native-analysis-api.js +212 -0
  86. package/out/native/native-analysis-api.js.map +1 -0
  87. package/out/native/native-index-store.d.ts +5 -0
  88. package/out/native/native-index-store.js +6 -0
  89. package/out/native/native-index-store.js.map +1 -0
  90. package/out/native/native-sql-db.d.ts +135 -0
  91. package/out/native/native-sql-db.js +217 -0
  92. package/out/native/native-sql-db.js.map +1 -0
  93. package/out/native/native-workspace-index.d.ts +164 -0
  94. package/out/native/native-workspace-index.js +283 -0
  95. package/out/native/native-workspace-index.js.map +1 -0
  96. package/out/native/open-analysis-api.d.ts +16 -0
  97. package/out/native/open-analysis-api.js +21 -0
  98. package/out/native/open-analysis-api.js.map +1 -0
  99. package/out/native/parse-source.d.ts +24 -0
  100. package/out/native/parse-source.js +26 -0
  101. package/out/native/parse-source.js.map +1 -0
  102. package/package.json +18 -22
  103. package/out/analysis/analyser-registry.d.ts +0 -21
  104. package/out/analysis/analyser-registry.js +0 -33
  105. package/out/analysis/analyser-registry.js.map +0 -1
  106. package/out/analysis/completion-tracking-analyser.d.ts +0 -3
  107. package/out/analysis/completion-tracking-analyser.js +0 -37
  108. package/out/analysis/completion-tracking-analyser.js.map +0 -1
  109. package/out/analysis/deprecation-impact-analyser.d.ts +0 -3
  110. package/out/analysis/deprecation-impact-analyser.js +0 -21
  111. package/out/analysis/deprecation-impact-analyser.js.map +0 -1
  112. package/out/analysis/file-related-analyser.d.ts +0 -5
  113. package/out/analysis/file-related-analyser.js +0 -41
  114. package/out/analysis/file-related-analyser.js.map +0 -1
  115. package/out/analysis/fuzzy-search-analyser.d.ts +0 -17
  116. package/out/analysis/fuzzy-search-analyser.js +0 -25
  117. package/out/analysis/fuzzy-search-analyser.js.map +0 -1
  118. package/out/analysis/fuzzy-search-worker-client.d.ts +0 -39
  119. package/out/analysis/fuzzy-search-worker-client.js +0 -178
  120. package/out/analysis/fuzzy-search-worker-client.js.map +0 -1
  121. package/out/analysis/fuzzy-search-worker.d.ts +0 -32
  122. package/out/analysis/fuzzy-search-worker.js +0 -81
  123. package/out/analysis/fuzzy-search-worker.js.map +0 -1
  124. package/out/analysis/fuzzy-search.d.ts +0 -38
  125. package/out/analysis/fuzzy-search.js +0 -217
  126. package/out/analysis/fuzzy-search.js.map +0 -1
  127. package/out/analysis/git-dates-analyser.d.ts +0 -9
  128. package/out/analysis/git-dates-analyser.js +0 -77
  129. package/out/analysis/git-dates-analyser.js.map +0 -1
  130. package/out/analysis/list-ideas-analyser.d.ts +0 -3
  131. package/out/analysis/list-ideas-analyser.js +0 -7
  132. package/out/analysis/list-ideas-analyser.js.map +0 -1
  133. package/out/analysis/local-graph-analyser.d.ts +0 -6
  134. package/out/analysis/local-graph-analyser.js +0 -42
  135. package/out/analysis/local-graph-analyser.js.map +0 -1
  136. package/out/analysis/semantic-search-analyser.d.ts +0 -8
  137. package/out/analysis/semantic-search-analyser.js +0 -51
  138. package/out/analysis/semantic-search-analyser.js.map +0 -1
  139. package/out/analysis-api.js +0 -190
  140. package/out/analysis-api.js.map +0 -1
  141. package/out/core/analytical-store.d.ts +0 -85
  142. package/out/core/analytical-store.js +0 -143
  143. package/out/core/analytical-store.js.map +0 -1
  144. package/out/core/context-model.d.ts +0 -204
  145. package/out/core/context-model.js +0 -36
  146. package/out/core/context-model.js.map +0 -1
  147. package/out/core/context-signals.d.ts +0 -149
  148. package/out/core/context-signals.js +0 -397
  149. package/out/core/context-signals.js.map +0 -1
  150. package/out/create-runtime.d.ts +0 -47
  151. package/out/create-runtime.js +0 -79
  152. package/out/create-runtime.js.map +0 -1
  153. package/out/export/export-html.d.ts +0 -4
  154. package/out/export/export-html.js +0 -12
  155. package/out/export/export-html.js.map +0 -1
  156. package/out/export/html-export-assets.d.ts +0 -3
  157. package/out/export/html-export-assets.js +0 -1926
  158. package/out/export/html-export-assets.js.map +0 -1
  159. package/out/export/html-export-template.d.ts +0 -18
  160. package/out/export/html-export-template.js +0 -1139
  161. package/out/export/html-export-template.js.map +0 -1
  162. package/out/export/html-export-utils.d.ts +0 -86
  163. package/out/export/html-export-utils.js +0 -485
  164. package/out/export/html-export-utils.js.map +0 -1
  165. package/out/export/write-html-export.d.ts +0 -2
  166. package/out/export/write-html-export.js +0 -181
  167. package/out/export/write-html-export.js.map +0 -1
  168. package/out/graph/physics-core-source.d.ts +0 -5
  169. package/out/graph/physics-core-source.js +0 -8
  170. package/out/graph/physics-core-source.js.map +0 -1
  171. package/out/graph/physics-core.d.ts +0 -141
  172. package/out/graph/physics-core.js +0 -237
  173. package/out/graph/physics-core.js.map +0 -1
  174. package/out/index-store/idea-extractor.d.ts +0 -11
  175. package/out/index-store/idea-extractor.js +0 -351
  176. package/out/index-store/idea-extractor.js.map +0 -1
  177. package/out/index-store/overview-coverage.d.ts +0 -23
  178. package/out/index-store/overview-coverage.js +0 -254
  179. package/out/index-store/overview-coverage.js.map +0 -1
@@ -0,0 +1,164 @@
1
+ import type { NativeQuerySurface, NativeSqlDbHandle } from './native-sql-db.js';
2
+ import type { DocumentUpdate, DocumentUpdateIdea, FileIndexIssue, IndexError, IndexEvent, IndexState, WorkspaceChange, WorkspaceFileChange } from '../core/index-state-types.js';
3
+ import type { FileIndexIssueDraft } from '../index-store/index-parse-issues.js';
4
+ import type { IndexSyncProgress } from '../index-store/index-status.js';
5
+ export interface NativeIndexFileResult {
6
+ fileUri: string;
7
+ diagnostics: string[];
8
+ }
9
+ /**
10
+ * Raw status snapshot from the native runtime. `fileIssues` / `lastError` carry
11
+ * indexed file URIs; the TS facade maps them to workspace-relative views.
12
+ */
13
+ export interface NativeIndexStatusSnapshot {
14
+ state: IndexState;
15
+ ready: boolean;
16
+ ideaCount: number;
17
+ edgeCount: number;
18
+ fileIssueCount: number;
19
+ lastError?: IndexError | null;
20
+ fileIssues: FileIndexIssue[];
21
+ syncProgress?: IndexSyncProgress | null;
22
+ recentDocumentUpdates: DocumentUpdate[];
23
+ recentWorkspaceChanges: WorkspaceFileChange[];
24
+ }
25
+ /** Extra error context recorded alongside an index failure. */
26
+ export interface RecordIndexErrorContext {
27
+ fileUri?: string;
28
+ ideaNames?: string[];
29
+ phase?: string;
30
+ cause?: string;
31
+ }
32
+ export interface NativeSyncResult {
33
+ processed: number;
34
+ total: number;
35
+ currentFile?: string | null;
36
+ skippedMtime: number;
37
+ indexed: number;
38
+ errors: number;
39
+ cancelled: boolean;
40
+ fileIssues: Array<{
41
+ fileUri: string;
42
+ message: string;
43
+ }>;
44
+ }
45
+ export interface NativeFuzzySearchHit {
46
+ id: string;
47
+ name: string;
48
+ kind: string;
49
+ fileUri: string;
50
+ summary: string;
51
+ lineStart: number;
52
+ score: number;
53
+ }
54
+ export interface NativeFuzzySearchResult {
55
+ hits: NativeFuzzySearchHit[];
56
+ total: number;
57
+ truncated: boolean;
58
+ }
59
+ /**
60
+ * Coverage metrics for the Ideas Summary Overview, computed natively.
61
+ * Shape mirrors the Rust `OverviewCoverageScores` (camelCase serde).
62
+ * rq:["../../../reqlan rq/extension/module/ideas_summary/webview.rq".overview_coverage_scores]
63
+ */
64
+ export interface OverviewCoverageScores {
65
+ ideaCount: number;
66
+ rqFileCount: number;
67
+ eligibleNonRqFileCount: number;
68
+ referencedEligibleFileCount: number;
69
+ /** 0–100; null when there are no eligible non-.rq files. */
70
+ fileCoveragePct: number | null;
71
+ distinctFileReferenceCount: number;
72
+ totalLoc: number;
73
+ /** Ideas per 1000 LOC; null when LOC is 0. */
74
+ ideasPerKLoc: number | null;
75
+ /** True when LOC counting hit size caps (totals are lower bounds). */
76
+ locTruncated: boolean;
77
+ calculatedAt: number;
78
+ }
79
+ export interface NativeWorkspaceIndexHandle extends NativeQuerySurface {
80
+ ensureReady(): NativeSyncResult;
81
+ syncWorkspace(hardRebuild: boolean): NativeSyncResult;
82
+ cancelSync(): void;
83
+ indexFile(filePathOrUri: string): NativeIndexFileResult;
84
+ deleteDocument(fileUri: string): void;
85
+ shutdown?: () => void;
86
+ clearIdeas(): void;
87
+ ideaCounts(): {
88
+ ideas: number;
89
+ edges: number;
90
+ };
91
+ statusSnapshot(): NativeIndexStatusSnapshot;
92
+ indexState(): IndexState;
93
+ canDispatchIndex(event: IndexEvent): boolean;
94
+ dispatchIndex(event: IndexEvent): boolean;
95
+ setIndexReady(ideaCount: number, edgeCount: number): void;
96
+ recordIndexError(message: string, fileUri?: string, ideaNames?: string[], phase?: string, cause?: string): void;
97
+ clearLastError(): void;
98
+ setSyncProgress(progress?: IndexSyncProgress | null): void;
99
+ recordFileIssues(fileUri: string, issues: FileIndexIssueDraft[]): void;
100
+ clearFileIssues(): void;
101
+ clearFileIssuesForFile(fileUri: string): void;
102
+ recordDocumentUpdate(fileUri: string, ideaCount: number, ideas: DocumentUpdateIdea[]): void;
103
+ recordWorkspaceChange(fileUri: string, change: WorkspaceChange): void;
104
+ clearActivity(): void;
105
+ fuzzySearch(query: string, limit?: number, requireQuery?: boolean, offset?: number): NativeFuzzySearchResult;
106
+ /** Fill git dates for ideas (all missing when `ideaIds` omitted); returns rows updated. */
107
+ fillGitDates(ideaIds?: string[] | null): number;
108
+ /** Compute Ideas Summary overview coverage over the workspace base. */
109
+ computeOverviewCoverage(): OverviewCoverageScores;
110
+ ideasQuery(sql: string, params?: unknown[]): Record<string, unknown>[];
111
+ ideasExecute(sql: string, params?: unknown[]): number;
112
+ ideasExecuteBatch(sql: string): void;
113
+ ideasLastInsertRowid(): number;
114
+ diagnosticsQuery(sql: string, params?: unknown[]): Record<string, unknown>[];
115
+ diagnosticsExecute(sql: string, params?: unknown[]): number;
116
+ diagnosticsExecuteBatch(sql: string): void;
117
+ diagnosticsLastInsertRowid(): number;
118
+ }
119
+ export declare class NativeWorkspaceIndex {
120
+ private readonly handle;
121
+ /**
122
+ * Once closed, the underlying Rust handle rejects every call. Diagnostic
123
+ * mutations from a lagging soft-sync task must no-op rather than throw.
124
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".native_bridge]
125
+ */
126
+ private closed;
127
+ private constructor();
128
+ static open(workspaceRoot: string, storagePath?: string): NativeWorkspaceIndex;
129
+ ensureReady(): NativeSyncResult;
130
+ syncWorkspace(hardRebuild?: boolean): NativeSyncResult;
131
+ cancelSync(): void;
132
+ indexFile(filePathOrUri: string): NativeIndexFileResult;
133
+ close(): void;
134
+ get isClosed(): boolean;
135
+ deleteDocument(fileUri: string): void;
136
+ clearIdeas(): void;
137
+ ideaCounts(): {
138
+ ideas: number;
139
+ edges: number;
140
+ };
141
+ statusSnapshot(): NativeIndexStatusSnapshot;
142
+ indexState(): IndexState;
143
+ canDispatchIndex(event: IndexEvent): boolean;
144
+ dispatchIndex(event: IndexEvent): boolean;
145
+ setIndexReady(ideaCount: number, edgeCount: number): void;
146
+ recordIndexError(message: string, context?: RecordIndexErrorContext): void;
147
+ clearLastError(): void;
148
+ setSyncProgress(progress?: IndexSyncProgress): void;
149
+ recordFileIssues(fileUri: string, issues: FileIndexIssueDraft[]): void;
150
+ clearFileIssues(): void;
151
+ clearFileIssuesForFile(fileUri: string): void;
152
+ recordDocumentUpdate(fileUri: string, ideaCount: number, ideas?: DocumentUpdateIdea[]): void;
153
+ recordWorkspaceChange(fileUri: string, change: WorkspaceChange): void;
154
+ clearActivity(): void;
155
+ fuzzySearch(query: string, limit?: number, requireQuery?: boolean, offset?: number): NativeFuzzySearchResult;
156
+ /** Fill git dates for ideas (all missing when `ideaIds` omitted); returns rows updated. */
157
+ fillGitDates(ideaIds?: string[]): number;
158
+ /** Compute Ideas Summary overview coverage over the workspace base. */
159
+ computeOverviewCoverage(): OverviewCoverageScores;
160
+ /** Shared ideas-DB SQL surface; NativeWorkspaceIndex owns the connection. */
161
+ ideasSqlHandle(): NativeSqlDbHandle;
162
+ /** Shared diagnostics-DB SQL surface; NativeWorkspaceIndex owns the connection. */
163
+ diagnosticsSqlHandle(): NativeSqlDbHandle;
164
+ }
@@ -0,0 +1,283 @@
1
+ /**
2
+ * Drop-in workspace sync facade over napi NativeWorkspaceIndex.
3
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".native_bridge]
4
+ * rq:["../../../reqlan rq/indexer/indexer.rq".indexer_rust]
5
+ */
6
+ import { loadNativeEngine } from './load-native.js';
7
+ export class NativeWorkspaceIndex {
8
+ constructor(handle) {
9
+ this.handle = handle;
10
+ /**
11
+ * Once closed, the underlying Rust handle rejects every call. Diagnostic
12
+ * mutations from a lagging soft-sync task must no-op rather than throw.
13
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".native_bridge]
14
+ */
15
+ this.closed = false;
16
+ }
17
+ static open(workspaceRoot, storagePath) {
18
+ const engine = loadNativeEngine();
19
+ if (!engine.NativeWorkspaceIndex) {
20
+ throw new Error('NativeWorkspaceIndex is missing from the native engine; rebuild reqlan-napi.');
21
+ }
22
+ return new NativeWorkspaceIndex(engine.NativeWorkspaceIndex.open(workspaceRoot, storagePath));
23
+ }
24
+ ensureReady() {
25
+ return this.handle.ensureReady();
26
+ }
27
+ syncWorkspace(hardRebuild = false) {
28
+ return this.handle.syncWorkspace(hardRebuild);
29
+ }
30
+ cancelSync() {
31
+ this.handle.cancelSync();
32
+ }
33
+ indexFile(filePathOrUri) {
34
+ const result = this.handle.indexFile(filePathOrUri);
35
+ return {
36
+ fileUri: result.fileUri,
37
+ diagnostics: result.diagnostics ?? []
38
+ };
39
+ }
40
+ close() {
41
+ this.closed = true;
42
+ const shutdown = this.handle.shutdown;
43
+ if (typeof shutdown === 'function') {
44
+ shutdown.call(this.handle);
45
+ }
46
+ }
47
+ get isClosed() {
48
+ return this.closed;
49
+ }
50
+ deleteDocument(fileUri) {
51
+ this.handle.deleteDocument(fileUri);
52
+ }
53
+ clearIdeas() {
54
+ this.handle.clearIdeas();
55
+ }
56
+ ideaCounts() {
57
+ return this.handle.ideaCounts();
58
+ }
59
+ // ---- index lifecycle FSM + status snapshot --------------------------------
60
+ statusSnapshot() {
61
+ return this.handle.statusSnapshot();
62
+ }
63
+ indexState() {
64
+ return this.handle.indexState();
65
+ }
66
+ canDispatchIndex(event) {
67
+ if (this.closed) {
68
+ return false;
69
+ }
70
+ return this.handle.canDispatchIndex(event);
71
+ }
72
+ dispatchIndex(event) {
73
+ if (this.closed) {
74
+ return false;
75
+ }
76
+ return this.handle.dispatchIndex(event);
77
+ }
78
+ setIndexReady(ideaCount, edgeCount) {
79
+ if (this.closed) {
80
+ return;
81
+ }
82
+ this.handle.setIndexReady(ideaCount, edgeCount);
83
+ }
84
+ recordIndexError(message, context) {
85
+ if (this.closed) {
86
+ return;
87
+ }
88
+ this.handle.recordIndexError(message, context?.fileUri, context?.ideaNames, context?.phase, context?.cause);
89
+ }
90
+ clearLastError() {
91
+ if (this.closed) {
92
+ return;
93
+ }
94
+ this.handle.clearLastError();
95
+ }
96
+ setSyncProgress(progress) {
97
+ if (this.closed) {
98
+ return;
99
+ }
100
+ this.handle.setSyncProgress(progress ?? null);
101
+ }
102
+ recordFileIssues(fileUri, issues) {
103
+ if (this.closed) {
104
+ return;
105
+ }
106
+ this.handle.recordFileIssues(fileUri, issues);
107
+ }
108
+ clearFileIssues() {
109
+ if (this.closed) {
110
+ return;
111
+ }
112
+ this.handle.clearFileIssues();
113
+ }
114
+ clearFileIssuesForFile(fileUri) {
115
+ if (this.closed) {
116
+ return;
117
+ }
118
+ this.handle.clearFileIssuesForFile(fileUri);
119
+ }
120
+ recordDocumentUpdate(fileUri, ideaCount, ideas = []) {
121
+ if (this.closed) {
122
+ return;
123
+ }
124
+ this.handle.recordDocumentUpdate(fileUri, ideaCount, ideas);
125
+ }
126
+ recordWorkspaceChange(fileUri, change) {
127
+ if (this.closed) {
128
+ return;
129
+ }
130
+ this.handle.recordWorkspaceChange(fileUri, change);
131
+ }
132
+ clearActivity() {
133
+ if (this.closed) {
134
+ return;
135
+ }
136
+ this.handle.clearActivity();
137
+ }
138
+ fuzzySearch(query, limit, requireQuery = false, offset) {
139
+ return this.handle.fuzzySearch(query, limit, requireQuery, offset);
140
+ }
141
+ /** Fill git dates for ideas (all missing when `ideaIds` omitted); returns rows updated. */
142
+ fillGitDates(ideaIds) {
143
+ if (this.closed) {
144
+ return 0;
145
+ }
146
+ return this.handle.fillGitDates(ideaIds ?? null);
147
+ }
148
+ /** Compute Ideas Summary overview coverage over the workspace base. */
149
+ computeOverviewCoverage() {
150
+ return this.handle.computeOverviewCoverage();
151
+ }
152
+ /** Shared ideas-DB SQL surface; NativeWorkspaceIndex owns the connection. */
153
+ ideasSqlHandle() {
154
+ const { handle } = this;
155
+ return {
156
+ query: (sql, params) => handle.ideasQuery(sql, params),
157
+ execute: (sql, params) => handle.ideasExecute(sql, params),
158
+ executeBatch: sql => handle.ideasExecuteBatch(sql),
159
+ lastInsertRowid: () => handle.ideasLastInsertRowid(),
160
+ close() {
161
+ // Connection lifetime is owned by NativeWorkspaceIndex.
162
+ },
163
+ // Typed webview query surface delegates to the ideas-DB store methods.
164
+ countIdeas: query => handle.countIdeas(query),
165
+ listIdeasPageRows: query => handle.listIdeasPageRows(query),
166
+ listReferenceChipRows: ideaIds => handle.listReferenceChipRows(ideaIds),
167
+ countIdeasets: query => handle.countIdeasets(query),
168
+ listIdeasetsPageRows: query => handle.listIdeasetsPageRows(query),
169
+ listIdeasetMemberRows: (ideasetId, kind, fileUri) => handle.listIdeasetMemberRows(ideasetId, kind, fileUri),
170
+ countReferences: query => handle.countReferences(query),
171
+ listReferencesPageRows: query => handle.listReferencesPageRows(query),
172
+ listTodoIdeaRows: () => handle.listTodoIdeaRows(),
173
+ listIdeasForGraphQuery: (query, limit) => handle.listIdeasForGraphQuery(query, limit),
174
+ listRecentGitIdeaRows: limit => handle.listRecentGitIdeaRows(limit),
175
+ listIdeaIdsMissingGitDates: (limit, fileUri, preferFileUri) => handle.listIdeaIdsMissingGitDates(limit, fileUri, preferFileUri),
176
+ listAttributeIdeaRows: () => handle.listAttributeIdeaRows(),
177
+ // Typed domain read/write surface delegates to the ideas-DB store methods.
178
+ migrateIdeasSchema: () => handle.migrateIdeasSchema(),
179
+ getDocumentHash: fileUri => handle.getDocumentHash(fileUri),
180
+ getDocumentMtimeMs: fileUri => handle.getDocumentMtimeMs(fileUri),
181
+ listDocumentMtimeRows: () => handle.listDocumentMtimeRows(),
182
+ listDocumentUris: () => handle.listDocumentUris(),
183
+ listAllIdeaRows: () => handle.listAllIdeaRows(),
184
+ getIdeaRow: id => handle.getIdeaRow(id),
185
+ getIdeasInFileRows: fileUri => handle.getIdeasInFileRows(fileUri),
186
+ getIdeaAtLineRow: (fileUri, line) => handle.getIdeaAtLineRow(fileUri, line),
187
+ getIdeasetAtLineRow: (fileUri, line) => handle.getIdeasetAtLineRow(fileUri, line),
188
+ listIdeasInFileWithRangeRows: fileUri => handle.listIdeasInFileWithRangeRows(fileUri),
189
+ listIdeasetsInFileWithRangeRows: fileUri => handle.listIdeasetsInFileWithRangeRows(fileUri),
190
+ getIdeasByIdsRows: ids => handle.getIdeasByIdsRows(ids),
191
+ searchIdeaRows: search => handle.searchIdeaRows(search),
192
+ listReferencesForIdea: ideaId => handle.listReferencesForIdea(ideaId),
193
+ countUnresolvedForIdea: ideaId => handle.countUnresolvedForIdea(ideaId),
194
+ countEdgesFromFile: fileUri => handle.countEdgesFromFile(fileUri),
195
+ getEdgesFromRows: sourceId => handle.getEdgesFromRows(sourceId),
196
+ getEdgesToRows: targetId => handle.getEdgesToRows(targetId),
197
+ getEdgesForNodesRows: nodeIds => handle.getEdgesForNodesRows(nodeIds),
198
+ getEdgesReferencingFileRows: filePath => handle.getEdgesReferencingFileRows(filePath),
199
+ getAllEdgeRows: () => handle.getAllEdgeRows(),
200
+ listFileReferenceTargetRows: () => handle.listFileReferenceTargetRows(),
201
+ allIdeaRawRows: () => handle.allIdeaRawRows(),
202
+ counts: () => handle.counts(),
203
+ updateDocumentMtime: (fileUri, mtimeMs) => handle.updateDocumentMtime(fileUri, mtimeMs),
204
+ updateGitDates: (id, createdAt, modifiedAt, changeCount) => handle.updateGitDates(id, createdAt, modifiedAt, changeCount),
205
+ clearAll: () => handle.clearAll(),
206
+ removeDocuments: fileUris => handle.removeDocuments(fileUris),
207
+ upsertDocument: (fileUri, contentHash, ideas, edges, mtimeMs) => handle.upsertDocument(fileUri, contentHash, ideas, edges, mtimeMs)
208
+ };
209
+ }
210
+ /** Shared diagnostics-DB SQL surface; NativeWorkspaceIndex owns the connection. */
211
+ diagnosticsSqlHandle() {
212
+ const { handle } = this;
213
+ return {
214
+ query: (sql, params) => handle.diagnosticsQuery(sql, params),
215
+ execute: (sql, params) => handle.diagnosticsExecute(sql, params),
216
+ executeBatch: sql => handle.diagnosticsExecuteBatch(sql),
217
+ lastInsertRowid: () => handle.diagnosticsLastInsertRowid(),
218
+ close() {
219
+ // Connection lifetime is owned by NativeWorkspaceIndex.
220
+ },
221
+ // The idea-graph query surface does not apply to the diagnostics DB.
222
+ ...unsupportedQuerySurface('diagnostics')
223
+ };
224
+ }
225
+ }
226
+ /** Idea-graph query surface method names, used to stub the diagnostics connection. */
227
+ const IDEA_QUERY_SURFACE_METHODS = [
228
+ 'countIdeas',
229
+ 'listIdeasPageRows',
230
+ 'listReferenceChipRows',
231
+ 'countIdeasets',
232
+ 'listIdeasetsPageRows',
233
+ 'listIdeasetMemberRows',
234
+ 'countReferences',
235
+ 'listReferencesPageRows',
236
+ 'listTodoIdeaRows',
237
+ 'listIdeasForGraphQuery',
238
+ 'listRecentGitIdeaRows',
239
+ 'listIdeaIdsMissingGitDates',
240
+ 'listAttributeIdeaRows',
241
+ 'migrateIdeasSchema',
242
+ 'getDocumentHash',
243
+ 'getDocumentMtimeMs',
244
+ 'listDocumentMtimeRows',
245
+ 'listDocumentUris',
246
+ 'listAllIdeaRows',
247
+ 'getIdeaRow',
248
+ 'getIdeasInFileRows',
249
+ 'getIdeaAtLineRow',
250
+ 'getIdeasetAtLineRow',
251
+ 'listIdeasInFileWithRangeRows',
252
+ 'listIdeasetsInFileWithRangeRows',
253
+ 'getIdeasByIdsRows',
254
+ 'searchIdeaRows',
255
+ 'listReferencesForIdea',
256
+ 'countUnresolvedForIdea',
257
+ 'countEdgesFromFile',
258
+ 'getEdgesFromRows',
259
+ 'getEdgesToRows',
260
+ 'getEdgesForNodesRows',
261
+ 'getEdgesReferencingFileRows',
262
+ 'getAllEdgeRows',
263
+ 'listFileReferenceTargetRows',
264
+ 'allIdeaRawRows',
265
+ 'counts',
266
+ 'updateDocumentMtime',
267
+ 'updateGitDates',
268
+ 'clearAll',
269
+ 'removeDocuments',
270
+ 'upsertDocument'
271
+ ];
272
+ /** Query-surface stubs for connections that do not host the idea graph (diagnostics DB). */
273
+ function unsupportedQuerySurface(context) {
274
+ const fail = () => {
275
+ throw new Error(`Idea-graph query surface is not available on the ${context} connection.`);
276
+ };
277
+ const surface = {};
278
+ for (const name of IDEA_QUERY_SURFACE_METHODS) {
279
+ surface[name] = fail;
280
+ }
281
+ return surface;
282
+ }
283
+ //# sourceMappingURL=native-workspace-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-workspace-index.js","sourceRoot":"","sources":["../../src/native/native-workspace-index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAmJpD,MAAM,OAAO,oBAAoB;IAQ7B,YAAqC,MAAkC;QAAlC,WAAM,GAAN,MAAM,CAA4B;QAPvE;;;;WAIG;QACK,WAAM,GAAG,KAAK,CAAC;IAEmD,CAAC;IAE3E,MAAM,CAAC,IAAI,CAAC,aAAqB,EAAE,WAAoB;QACnD,MAAM,MAAM,GAAG,gBAAgB,EAAwD,CAAC;QACxF,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACX,8EAA8E,CACjF,CAAC;QACN,CAAC;QACD,OAAO,IAAI,oBAAoB,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;IAClG,CAAC;IAED,W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AG,uBAAuB,CAAC,aAAa,CAAC;SAC5C,CAAC;IACN,CAAC;CACJ;AAED,sFAAsF;AACtF,MAAM,0BAA0B,GAAiC;IAC7D,YAAY;IACZ,mBAAmB;IACnB,uBAAuB;IACvB,eAAe;IACf,sBAAsB;IACtB,uBAAuB;IACvB,iBAAiB;IACjB,wBAAwB;IACxB,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,uBAAuB;IACvB,oBAAoB;IACpB,iBAAiB;IACjB,oBAAoB;IACpB,uBAAuB;IACvB,kBAAkB;IAClB,iBAAiB;IACjB,YAAY;IACZ,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,8BAA8B;IAC9B,iCAAiC;IACjC,mBAAmB;IACnB,gBAAgB;IAChB,uBAAuB;IACvB,wBAAwB;IACxB,oBAAoB;IACpB,kBAAkB;IAClB,gBAAgB;IAChB,sBAAsB;IACtB,6BAA6B;IAC7B,gBAAgB;IAChB,6BAA6B;IAC7B,gBAAgB;IAChB,QAAQ;IACR,qBAAqB;IACrB,gBAAgB;IAChB,UAAU;IACV,iBAAiB;IACjB,gBAAgB;CACnB,CAAC;AAEF,4FAA4F;AAC5F,SAAS,uBAAuB,CAAC,OAAe;IAC5C,MAAM,IAAI,GAAG,GAAU,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,oDAAoD,OAAO,cAAc,CAAC,CAAC;IAC/F,CAAC,CAAC;IACF,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,KAAK,MAAM,IAAI,IAAI,0BAA0B,EAAE,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACzB,CAAC;IACD,OAAO,OAAwC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Headless AnalysisApi over the core native engine.
3
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".cutover]
4
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".native_bridge]
5
+ */
6
+ import { NativeAnalysisApi, type AnalysisRuntimeOptions } from './native-analysis-api.js';
7
+ export type HeadlessAnalysisApi = NativeAnalysisApi;
8
+ export interface OpenedAnalysisApi {
9
+ api: HeadlessAnalysisApi;
10
+ engine: 'native';
11
+ dispose: () => Promise<void>;
12
+ }
13
+ /**
14
+ * Open a headless AnalysisApi via the required core native engine.
15
+ */
16
+ export declare function openAnalysisApi(options: AnalysisRuntimeOptions): Promise<OpenedAnalysisApi>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Headless AnalysisApi over the core native engine.
3
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".cutover]
4
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".native_bridge]
5
+ */
6
+ import { NativeAnalysisApi } from './native-analysis-api.js';
7
+ import { loadNativeEngine } from './load-native.js';
8
+ /**
9
+ * Open a headless AnalysisApi via the required core native engine.
10
+ */
11
+ export async function openAnalysisApi(options) {
12
+ loadNativeEngine();
13
+ const api = new NativeAnalysisApi(options);
14
+ await api.ensureReady();
15
+ return {
16
+ api,
17
+ engine: 'native',
18
+ dispose: async () => undefined
19
+ };
20
+ }
21
+ //# sourceMappingURL=open-analysis-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-analysis-api.js","sourceRoot":"","sources":["../../src/native/open-analysis-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACH,iBAAiB,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAUpD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAA+B;IACjE,gBAAgB,EAAE,CAAC;IACnB,MAAM,GAAG,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;IACxB,OAAO;QACH,GAAG;QACH,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS;KACjC,CAAC;AACN,CAAC"}
@@ -0,0 +1,24 @@
1
+ export interface NativeParseElement {
2
+ type: string;
3
+ name?: string;
4
+ }
5
+ export interface NativeParseDiagnostic {
6
+ severity: number;
7
+ line: number;
8
+ character: number;
9
+ message: string;
10
+ text: string;
11
+ }
12
+ export interface NativeParseResult {
13
+ ok: boolean;
14
+ errorCount: number;
15
+ diagnostics: NativeParseDiagnostic[];
16
+ elements: NativeParseElement[];
17
+ }
18
+ export declare function parseReqlanSource(source: string): NativeParseResult;
19
+ /**
20
+ * Top-level idea names in a document via the core engine — used for historical
21
+ * (git revision) extract without loading Langium.
22
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".parser_rust]
23
+ */
24
+ export declare function extractIdeaNames(source: string): string[];
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Single-file parse via the core Rust engine (no Langium).
3
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".parser_rust]
4
+ * rq:["../../../reqlan rq/cli/cli_package.rq".commands]
5
+ */
6
+ import { loadNativeEngine } from './load-native.js';
7
+ export function parseReqlanSource(source) {
8
+ const engine = loadNativeEngine();
9
+ if (typeof engine.parseReqlanSource !== 'function') {
10
+ throw new Error('Native parseReqlanSource is missing; rebuild crates/reqlan-napi (cargo build -p reqlan-napi).');
11
+ }
12
+ return engine.parseReqlanSource(source);
13
+ }
14
+ /**
15
+ * Top-level idea names in a document via the core engine — used for historical
16
+ * (git revision) extract without loading Langium.
17
+ * rq:["../../../reqlan rq/core_analysis/rust_port.rq".parser_rust]
18
+ */
19
+ export function extractIdeaNames(source) {
20
+ const engine = loadNativeEngine();
21
+ if (typeof engine.extractIdeaNames !== 'function') {
22
+ throw new Error('Native extractIdeaNames is missing; rebuild crates/reqlan-napi (cargo build -p reqlan-napi).');
23
+ }
24
+ return engine.extractIdeaNames(source);
25
+ }
26
+ //# sourceMappingURL=parse-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-source.js","sourceRoot":"","sources":["../../src/native/parse-source.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAsBpD,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC5C,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAClC,IAAI,OAAO,MAAM,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CACX,+FAA+F,CAClG,CAAC;IACN,CAAC;IACD,OAAO,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAsB,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC3C,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAClC,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CACX,8FAA8F,CACjG,CAAC;IACN,CAAC;IACD,OAAO,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reqlan/analytical",
3
- "description": "Shared requirement graph index and analysers for reqlan",
4
- "version": "0.8.2",
3
+ "description": "Native requirement graph index and analysis API for reqlan",
4
+ "version": "0.10.0",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
7
7
  "repository": {
@@ -25,36 +25,32 @@
25
25
  "types": "./out/index.d.ts",
26
26
  "default": "./out/index.js"
27
27
  },
28
- "./context-model": {
29
- "types": "./out/core/context-model.d.ts",
30
- "default": "./out/core/context-model.js"
28
+ "./core": {
29
+ "types": "./out/native/index.d.ts",
30
+ "default": "./out/native/index.js"
31
31
  },
32
- "./context-signals": {
33
- "types": "./out/core/context-signals.d.ts",
34
- "default": "./out/core/context-signals.js"
35
- },
36
- "./graph-physics": {
37
- "types": "./out/graph/physics-core.d.ts",
38
- "default": "./out/graph/physics-core.js"
39
- },
40
- "./filter-specials": {
41
- "types": "./out/core/filter-specials.d.ts",
42
- "default": "./out/core/filter-specials.js"
32
+ "./native": {
33
+ "types": "./out/native/index.d.ts",
34
+ "default": "./out/native/index.js"
43
35
  }
44
36
  },
45
37
  "devDependencies": {
46
38
  "vitest": "~3.1.3"
47
39
  },
48
40
  "dependencies": {
49
- "ignore": "^7.0.6",
50
- "langium": "~4.3.0",
51
- "sql.js": "^1.14.1",
52
- "zustand": "~5.0.8",
53
- "@reqlan/language": "1.8.2"
41
+ "ignore": "^7.0.6"
42
+ },
43
+ "optionalDependencies": {
44
+ "@reqlan/analytical-win32-x64-msvc": "0.10.0",
45
+ "@reqlan/analytical-linux-x64-gnu": "0.10.0",
46
+ "@reqlan/analytical-win32-arm64-msvc": "0.10.0",
47
+ "@reqlan/analytical-darwin-arm64": "0.10.0",
48
+ "@reqlan/analytical-darwin-x64": "0.10.0",
49
+ "@reqlan/analytical-linux-arm64-gnu": "0.10.0"
54
50
  },
55
51
  "scripts": {
56
52
  "clean": "shx rm -fr *.tsbuildinfo out",
57
- "build": "node scripts/generate-physics-core-source.mjs && tsc -b tsconfig.json",
53
+ "build": "tsc -b tsconfig.json",
58
54
  "build:clean": "pnpm run clean && pnpm run build",
59
55
  "test": "vitest run"
60
56
  }
@@ -1,21 +0,0 @@
1
- /**
2
- * Registry and contracts for graph analysers.
3
- */
4
- import type { AnalyticalStore } from '../core/analytical-store.js';
5
- import type { SqliteIndexStore } from '../index-store/sqlite-store.js';
6
- export interface AnalyserContext {
7
- store: SqliteIndexStore;
8
- analytical: AnalyticalStore;
9
- workspaceRoot?: string;
10
- }
11
- export interface Analyser<TParams = unknown, TResult = unknown> {
12
- readonly id: string;
13
- run(context: AnalyserContext, params: TParams): Promise<TResult> | TResult;
14
- }
15
- export declare class AnalyserRegistry {
16
- private readonly analysers;
17
- register<TParams, TResult>(analyser: Analyser<TParams, TResult>): void;
18
- get(id: string): Analyser | undefined;
19
- run<TParams, TResult>(context: AnalyserContext, id: string, params: TParams): Promise<TResult>;
20
- list(): string[];
21
- }