@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.
- package/README.md +27 -2
- package/README.template.md +1 -1
- package/out/core/barrel-page.d.ts +2 -1
- package/out/core/barrel-page.js +18 -83
- package/out/core/barrel-page.js.map +1 -1
- package/out/core/base-discovery.d.ts +6 -0
- package/out/core/base-discovery.js +56 -4
- package/out/core/base-discovery.js.map +1 -1
- package/out/core/create-base.js +10 -14
- package/out/core/create-base.js.map +1 -1
- package/out/core/file-reference-resolve.js +8 -2
- package/out/core/file-reference-resolve.js.map +1 -1
- package/out/core/index-error.d.ts +3 -3
- package/out/core/index-error.js.map +1 -1
- package/out/core/index-state-types.d.ts +47 -0
- package/out/core/index-state-types.js +11 -0
- package/out/core/index-state-types.js.map +1 -0
- package/out/core/path-relative.d.ts +15 -0
- package/out/core/path-relative.js +84 -0
- package/out/core/path-relative.js.map +1 -0
- package/out/core/rqignore.js +62 -62
- package/out/core/rqignore.js.map +1 -1
- package/out/core/types.d.ts +12 -3
- package/out/core/types.js +4 -1
- package/out/core/types.js.map +1 -1
- package/out/core/workspace-paths.d.ts +1 -1
- package/out/core/workspace-paths.js +8 -44
- package/out/core/workspace-paths.js.map +1 -1
- package/out/export/build-export-snapshot.js +1 -1
- package/out/export/build-export-snapshot.js.map +1 -1
- package/out/export/export-utils.d.ts +5 -0
- package/out/export/export-utils.js +38 -0
- package/out/export/export-utils.js.map +1 -0
- package/out/export/write-csv-export.js +1 -1
- package/out/export/write-csv-export.js.map +1 -1
- package/out/export/write-markdown-export.js +1 -1
- package/out/export/write-markdown-export.js.map +1 -1
- package/out/index-store/base-registry.d.ts +2 -3
- package/out/index-store/base-registry.js +8 -4
- package/out/index-store/base-registry.js.map +1 -1
- package/out/index-store/fuzzy-search-hit.d.ts +10 -0
- package/out/index-store/fuzzy-search-hit.js +2 -0
- package/out/index-store/fuzzy-search-hit.js.map +1 -0
- package/out/index-store/index-diagnostics-store.d.ts +4 -0
- package/out/index-store/index-diagnostics-store.js +44 -88
- package/out/index-store/index-diagnostics-store.js.map +1 -1
- package/out/index-store/index-file-error.d.ts +1 -1
- package/out/index-store/index-parse-issues.d.ts +4 -3
- package/out/index-store/index-parse-issues.js +0 -38
- package/out/index-store/index-parse-issues.js.map +1 -1
- package/out/index-store/index-status.d.ts +1 -1
- package/out/index-store/schema.d.ts +1 -1
- package/out/index-store/schema.js +6 -2
- package/out/index-store/schema.js.map +1 -1
- package/out/index-store/sqlite-store.d.ts +10 -4
- package/out/index-store/sqlite-store.js +81 -606
- package/out/index-store/sqlite-store.js.map +1 -1
- package/out/index-store/webview-graph-queries.d.ts +7 -0
- package/out/index-store/webview-graph-queries.js.map +1 -1
- package/out/index-store/webview-table-queries.d.ts +1 -1
- package/out/index-store/webview-table-queries.js +9 -0
- package/out/index-store/webview-table-queries.js.map +1 -1
- package/out/index-store/workspace-index-file.d.ts +3 -14
- package/out/index-store/workspace-index-file.js +1 -118
- package/out/index-store/workspace-index-file.js.map +1 -1
- package/out/index-store/workspace-index-sync.d.ts +4 -17
- package/out/index-store/workspace-index-sync.js +29 -11
- package/out/index-store/workspace-index-sync.js.map +1 -1
- package/out/index-store/workspace-index.d.ts +36 -9
- package/out/index-store/workspace-index.js +223 -120
- package/out/index-store/workspace-index.js.map +1 -1
- package/out/index.d.ts +16 -39
- package/out/index.js +9 -23
- package/out/index.js.map +1 -1
- package/out/native/generated.d.ts +102 -0
- package/out/native/generated.js +4 -0
- package/out/native/generated.js.map +1 -0
- package/out/native/index.d.ts +17 -0
- package/out/native/index.js +12 -0
- package/out/native/index.js.map +1 -0
- package/out/native/load-native.d.ts +50 -0
- package/out/native/load-native.js +152 -0
- package/out/native/load-native.js.map +1 -0
- package/out/{analysis-api.d.ts → native/native-analysis-api.d.ts} +24 -20
- package/out/native/native-analysis-api.js +212 -0
- package/out/native/native-analysis-api.js.map +1 -0
- package/out/native/native-index-store.d.ts +5 -0
- package/out/native/native-index-store.js +6 -0
- package/out/native/native-index-store.js.map +1 -0
- package/out/native/native-sql-db.d.ts +135 -0
- package/out/native/native-sql-db.js +217 -0
- package/out/native/native-sql-db.js.map +1 -0
- package/out/native/native-workspace-index.d.ts +164 -0
- package/out/native/native-workspace-index.js +283 -0
- package/out/native/native-workspace-index.js.map +1 -0
- package/out/native/open-analysis-api.d.ts +16 -0
- package/out/native/open-analysis-api.js +21 -0
- package/out/native/open-analysis-api.js.map +1 -0
- package/out/native/parse-source.d.ts +24 -0
- package/out/native/parse-source.js +26 -0
- package/out/native/parse-source.js.map +1 -0
- package/package.json +18 -22
- package/out/analysis/analyser-registry.d.ts +0 -21
- package/out/analysis/analyser-registry.js +0 -33
- package/out/analysis/analyser-registry.js.map +0 -1
- package/out/analysis/completion-tracking-analyser.d.ts +0 -3
- package/out/analysis/completion-tracking-analyser.js +0 -37
- package/out/analysis/completion-tracking-analyser.js.map +0 -1
- package/out/analysis/deprecation-impact-analyser.d.ts +0 -3
- package/out/analysis/deprecation-impact-analyser.js +0 -21
- package/out/analysis/deprecation-impact-analyser.js.map +0 -1
- package/out/analysis/file-related-analyser.d.ts +0 -5
- package/out/analysis/file-related-analyser.js +0 -41
- package/out/analysis/file-related-analyser.js.map +0 -1
- package/out/analysis/fuzzy-search-analyser.d.ts +0 -17
- package/out/analysis/fuzzy-search-analyser.js +0 -25
- package/out/analysis/fuzzy-search-analyser.js.map +0 -1
- package/out/analysis/fuzzy-search-worker-client.d.ts +0 -39
- package/out/analysis/fuzzy-search-worker-client.js +0 -178
- package/out/analysis/fuzzy-search-worker-client.js.map +0 -1
- package/out/analysis/fuzzy-search-worker.d.ts +0 -32
- package/out/analysis/fuzzy-search-worker.js +0 -81
- package/out/analysis/fuzzy-search-worker.js.map +0 -1
- package/out/analysis/fuzzy-search.d.ts +0 -38
- package/out/analysis/fuzzy-search.js +0 -217
- package/out/analysis/fuzzy-search.js.map +0 -1
- package/out/analysis/git-dates-analyser.d.ts +0 -9
- package/out/analysis/git-dates-analyser.js +0 -77
- package/out/analysis/git-dates-analyser.js.map +0 -1
- package/out/analysis/list-ideas-analyser.d.ts +0 -3
- package/out/analysis/list-ideas-analyser.js +0 -7
- package/out/analysis/list-ideas-analyser.js.map +0 -1
- package/out/analysis/local-graph-analyser.d.ts +0 -6
- package/out/analysis/local-graph-analyser.js +0 -42
- package/out/analysis/local-graph-analyser.js.map +0 -1
- package/out/analysis/semantic-search-analyser.d.ts +0 -8
- package/out/analysis/semantic-search-analyser.js +0 -51
- package/out/analysis/semantic-search-analyser.js.map +0 -1
- package/out/analysis-api.js +0 -190
- package/out/analysis-api.js.map +0 -1
- package/out/core/analytical-store.d.ts +0 -85
- package/out/core/analytical-store.js +0 -143
- package/out/core/analytical-store.js.map +0 -1
- package/out/core/context-model.d.ts +0 -204
- package/out/core/context-model.js +0 -36
- package/out/core/context-model.js.map +0 -1
- package/out/core/context-signals.d.ts +0 -149
- package/out/core/context-signals.js +0 -397
- package/out/core/context-signals.js.map +0 -1
- package/out/create-runtime.d.ts +0 -47
- package/out/create-runtime.js +0 -79
- package/out/create-runtime.js.map +0 -1
- package/out/export/export-html.d.ts +0 -4
- package/out/export/export-html.js +0 -12
- package/out/export/export-html.js.map +0 -1
- package/out/export/html-export-assets.d.ts +0 -3
- package/out/export/html-export-assets.js +0 -1926
- package/out/export/html-export-assets.js.map +0 -1
- package/out/export/html-export-template.d.ts +0 -18
- package/out/export/html-export-template.js +0 -1139
- package/out/export/html-export-template.js.map +0 -1
- package/out/export/html-export-utils.d.ts +0 -86
- package/out/export/html-export-utils.js +0 -485
- package/out/export/html-export-utils.js.map +0 -1
- package/out/export/write-html-export.d.ts +0 -2
- package/out/export/write-html-export.js +0 -181
- package/out/export/write-html-export.js.map +0 -1
- package/out/graph/physics-core-source.d.ts +0 -5
- package/out/graph/physics-core-source.js +0 -8
- package/out/graph/physics-core-source.js.map +0 -1
- package/out/graph/physics-core.d.ts +0 -141
- package/out/graph/physics-core.js +0 -237
- package/out/graph/physics-core.js.map +0 -1
- package/out/index-store/idea-extractor.d.ts +0 -11
- package/out/index-store/idea-extractor.js +0 -351
- package/out/index-store/idea-extractor.js.map +0 -1
- package/out/index-store/overview-coverage.d.ts +0 -23
- package/out/index-store/overview-coverage.js +0 -254
- package/out/index-store/overview-coverage.js.map +0 -1
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Characters treated as the same separator family: underscore, hyphen,
|
|
3
|
-
* ellipsis / dots, and whitespace. Runs collapse to nothing for matching so
|
|
4
|
-
* `cli package`, `cli_package`, `cli-package`, and `cli...package` align.
|
|
5
|
-
*/
|
|
6
|
-
const SEPARATOR_RE = /[_\-\s.…]+/g;
|
|
7
|
-
/** Lowercase and strip interchangeable separators for comparison. */
|
|
8
|
-
export function normalizeSearchSeparators(value) {
|
|
9
|
-
return value.toLowerCase().replace(SEPARATOR_RE, '');
|
|
10
|
-
}
|
|
11
|
-
/** Split on interchangeable separators into lowercase word tokens. */
|
|
12
|
-
export function splitSearchTokens(value) {
|
|
13
|
-
return value
|
|
14
|
-
.toLowerCase()
|
|
15
|
-
.split(SEPARATOR_RE)
|
|
16
|
-
.map(token => token.trim())
|
|
17
|
-
.filter(Boolean);
|
|
18
|
-
}
|
|
19
|
-
export function filterAndScoreIdeas(ideas, query) {
|
|
20
|
-
return rankScoredIdeas(scoreIdeas(ideas, query));
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Score ideas in chunks, yielding to the event loop so UI actions (e.g. openIdea)
|
|
24
|
-
* are not blocked by a long synchronous scan of a large index.
|
|
25
|
-
* Returns `undefined` when `isCancelled` becomes true mid-run.
|
|
26
|
-
*/
|
|
27
|
-
export async function filterAndScoreIdeasAsync(ideas, query, options) {
|
|
28
|
-
const chunkSize = Math.max(1, options?.chunkSize ?? 250);
|
|
29
|
-
const isCancelled = options?.isCancelled;
|
|
30
|
-
const rawNeedle = query.trim().toLowerCase();
|
|
31
|
-
const needle = normalizeSearchSeparators(rawNeedle);
|
|
32
|
-
const queryTokens = splitSearchTokens(rawNeedle);
|
|
33
|
-
const scored = [];
|
|
34
|
-
for (let index = 0; index < ideas.length; index += 1) {
|
|
35
|
-
if (index > 0 && index % chunkSize === 0) {
|
|
36
|
-
if (isCancelled?.()) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
await yieldEventLoop();
|
|
40
|
-
if (isCancelled?.()) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const idea = ideas[index];
|
|
45
|
-
if (idea.kind === 'ideaset') {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
const score = rawNeedle ? scoreIdeaMatch(idea, rawNeedle, needle, queryTokens) : 1;
|
|
49
|
-
if (score <= 0) {
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
scored.push({
|
|
53
|
-
id: idea.id,
|
|
54
|
-
name: idea.name,
|
|
55
|
-
kind: idea.kind,
|
|
56
|
-
fileUri: idea.fileUri,
|
|
57
|
-
summary: idea.summary,
|
|
58
|
-
lineStart: idea.lineStart,
|
|
59
|
-
score
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if (isCancelled?.()) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
return rankScoredIdeas(scored);
|
|
66
|
-
}
|
|
67
|
-
function scoreIdeas(ideas, query) {
|
|
68
|
-
const rawNeedle = query.trim().toLowerCase();
|
|
69
|
-
const needle = normalizeSearchSeparators(rawNeedle);
|
|
70
|
-
const queryTokens = splitSearchTokens(rawNeedle);
|
|
71
|
-
const scored = [];
|
|
72
|
-
for (const idea of ideas) {
|
|
73
|
-
if (idea.kind === 'ideaset') {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
const score = rawNeedle ? scoreIdeaMatch(idea, rawNeedle, needle, queryTokens) : 1;
|
|
77
|
-
if (score <= 0) {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
scored.push({
|
|
81
|
-
id: idea.id,
|
|
82
|
-
name: idea.name,
|
|
83
|
-
kind: idea.kind,
|
|
84
|
-
fileUri: idea.fileUri,
|
|
85
|
-
summary: idea.summary,
|
|
86
|
-
lineStart: idea.lineStart,
|
|
87
|
-
score
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
return scored;
|
|
91
|
-
}
|
|
92
|
-
function rankScoredIdeas(scored) {
|
|
93
|
-
return scored.sort((left, right) => right.score - left.score
|
|
94
|
-
|| left.name.localeCompare(right.name)
|
|
95
|
-
|| left.fileUri.localeCompare(right.fileUri));
|
|
96
|
-
}
|
|
97
|
-
function yieldEventLoop() {
|
|
98
|
-
return new Promise(resolve => {
|
|
99
|
-
setTimeout(resolve, 0);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
function scoreIdeaMatch(idea, rawNeedle, needle, queryTokens) {
|
|
103
|
-
const nameRaw = idea.name.toLowerCase();
|
|
104
|
-
const name = normalizeSearchSeparators(idea.name);
|
|
105
|
-
const summaryRaw = idea.summary.toLowerCase();
|
|
106
|
-
const summary = normalizeSearchSeparators(idea.summary);
|
|
107
|
-
let score = 0;
|
|
108
|
-
if (nameRaw === rawNeedle || name === needle) {
|
|
109
|
-
score = 100;
|
|
110
|
-
}
|
|
111
|
-
else if (nameRaw.startsWith(rawNeedle) || name.startsWith(needle)) {
|
|
112
|
-
score = 80;
|
|
113
|
-
}
|
|
114
|
-
else if (nameRaw.includes(rawNeedle) || name.includes(needle)) {
|
|
115
|
-
score = 50;
|
|
116
|
-
}
|
|
117
|
-
else if (fuzzySubsequence(nameRaw, rawNeedle) || fuzzySubsequence(name, needle)) {
|
|
118
|
-
score = 30;
|
|
119
|
-
}
|
|
120
|
-
const nameTokenKind = matchQueryTokens(splitSearchTokens(idea.name), queryTokens);
|
|
121
|
-
if (nameTokenKind === 'ordered') {
|
|
122
|
-
score = Math.max(score, 45);
|
|
123
|
-
}
|
|
124
|
-
else if (nameTokenKind === 'reordered') {
|
|
125
|
-
score = Math.max(score, 35);
|
|
126
|
-
}
|
|
127
|
-
if (summaryRaw.includes(rawNeedle) || (needle && summary.includes(needle))) {
|
|
128
|
-
score = Math.max(score, 20) + 5;
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
const summaryTokenKind = matchQueryTokens(splitSearchTokens(idea.summary), queryTokens);
|
|
132
|
-
if (summaryTokenKind === 'ordered') {
|
|
133
|
-
score = Math.max(score, 22);
|
|
134
|
-
}
|
|
135
|
-
else if (summaryTokenKind === 'reordered') {
|
|
136
|
-
score = Math.max(score, 18);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
for (const tag of idea.tags) {
|
|
140
|
-
const tagRaw = tag.toLowerCase();
|
|
141
|
-
const tagNorm = normalizeSearchSeparators(tag);
|
|
142
|
-
if (tagRaw.includes(rawNeedle) || (needle && tagNorm.includes(needle))) {
|
|
143
|
-
score = Math.max(score, 15) + 2;
|
|
144
|
-
}
|
|
145
|
-
else if (matchQueryTokens(splitSearchTokens(tag), queryTokens) !== null) {
|
|
146
|
-
score = Math.max(score, 15) + 2;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return score;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Match every query token against hay tokens.
|
|
153
|
-
* Prefers order-preserving matches; still accepts reordered tokens (missing
|
|
154
|
-
* intermediate hay words are fine either way).
|
|
155
|
-
*/
|
|
156
|
-
export function matchQueryTokens(hayTokens, queryTokens) {
|
|
157
|
-
if (queryTokens.length === 0 || hayTokens.length === 0) {
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
let hayIndex = 0;
|
|
161
|
-
let ordered = true;
|
|
162
|
-
for (const queryToken of queryTokens) {
|
|
163
|
-
let found = -1;
|
|
164
|
-
for (let index = hayIndex; index < hayTokens.length; index += 1) {
|
|
165
|
-
if (tokenMatches(hayTokens[index], queryToken)) {
|
|
166
|
-
found = index;
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (found < 0) {
|
|
171
|
-
ordered = false;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
hayIndex = found + 1;
|
|
175
|
-
}
|
|
176
|
-
if (ordered) {
|
|
177
|
-
return 'ordered';
|
|
178
|
-
}
|
|
179
|
-
const used = new Set();
|
|
180
|
-
for (const queryToken of queryTokens) {
|
|
181
|
-
let found = -1;
|
|
182
|
-
for (let index = 0; index < hayTokens.length; index += 1) {
|
|
183
|
-
if (used.has(index)) {
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (tokenMatches(hayTokens[index], queryToken)) {
|
|
187
|
-
found = index;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (found < 0) {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
used.add(found);
|
|
195
|
-
}
|
|
196
|
-
return 'reordered';
|
|
197
|
-
}
|
|
198
|
-
function tokenMatches(hayToken, queryToken) {
|
|
199
|
-
return hayToken === queryToken || hayToken.startsWith(queryToken);
|
|
200
|
-
}
|
|
201
|
-
/** True when needle characters appear in order inside hay (simple fuzzy). */
|
|
202
|
-
export function fuzzySubsequence(hay, needle) {
|
|
203
|
-
if (!needle) {
|
|
204
|
-
return true;
|
|
205
|
-
}
|
|
206
|
-
let index = 0;
|
|
207
|
-
for (const char of hay) {
|
|
208
|
-
if (char === needle[index]) {
|
|
209
|
-
index += 1;
|
|
210
|
-
if (index >= needle.length) {
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
//# sourceMappingURL=fuzzy-search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fuzzy-search.js","sourceRoot":"","sources":["../../src/analysis/fuzzy-search.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,MAAM,YAAY,GAAG,aAAa,CAA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,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC;AAED,SAAS,YAAY,CAAC,QAAgB,EAAE,UAAkB;IACtD,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AACtE,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,MAAc;IACxD,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACrB,IAAI,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,IAAI,CAAC,CAAC;YACX,IAAI,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Surfaces creation and last-modified dates for ideas via git history.
|
|
3
|
-
* Persists into the ideas index for silent background fill and Timeline consumers.
|
|
4
|
-
*
|
|
5
|
-
* rq:["../../../reqlan rq/extension/features-graph-analysers.rq".git_dates]
|
|
6
|
-
* rq:["../../../reqlan rq/extension/git-codelens.rq".git_idea_timeline_analysis]
|
|
7
|
-
* rq:["../../../reqlan rq/extension/git-codelens.rq".git_dates_background_indexing]
|
|
8
|
-
*/
|
|
9
|
-
import { URI } from 'langium';
|
|
10
|
-
import { execFile } from 'node:child_process';
|
|
11
|
-
import { promisify } from 'node:util';
|
|
12
|
-
import { resolveWorkspaceFileUri } from '../core/workspace-paths.js';
|
|
13
|
-
const execFileAsync = promisify(execFile);
|
|
14
|
-
const GIT_LOG_TIMEOUT_MS = 4000;
|
|
15
|
-
/** Keep background indexing gentle on the extension host. */
|
|
16
|
-
const LOOKUP_CONCURRENCY = 2;
|
|
17
|
-
export const gitDatesAnalyser = {
|
|
18
|
-
id: 'git_dates',
|
|
19
|
-
async run({ store, workspaceRoot }, { ideaIds }) {
|
|
20
|
-
const wanted = ideaIds ? new Set(ideaIds) : undefined;
|
|
21
|
-
const ideas = (await store.getAllIdeasRaw()).filter(idea => {
|
|
22
|
-
if (idea.kind === 'ideaset') {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
return wanted ? wanted.has(idea.id) : true;
|
|
26
|
-
});
|
|
27
|
-
const results = [];
|
|
28
|
-
for (let offset = 0; offset < ideas.length; offset += LOOKUP_CONCURRENCY) {
|
|
29
|
-
const batch = ideas.slice(offset, offset + LOOKUP_CONCURRENCY);
|
|
30
|
-
const batchResults = await Promise.all(batch.map(async (idea) => {
|
|
31
|
-
const dates = await lookupGitDates(idea.fileUri, idea.lineStart, idea.lineEnd, workspaceRoot);
|
|
32
|
-
if (dates.createdAt || dates.modifiedAt) {
|
|
33
|
-
await store.updateGitDates(idea.id, dates.createdAt, dates.modifiedAt);
|
|
34
|
-
}
|
|
35
|
-
return { ideaId: idea.id, ...dates };
|
|
36
|
-
}));
|
|
37
|
-
results.push(...batchResults);
|
|
38
|
-
}
|
|
39
|
-
return results;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
async function lookupGitDates(fileUri, lineStart, lineEnd, workspaceRoot) {
|
|
43
|
-
const resolvedUri = resolveWorkspaceFileUri(fileUri, workspaceRoot);
|
|
44
|
-
const filePath = resolvedUri.startsWith('file://') ? URI.parse(resolvedUri).fsPath : resolvedUri;
|
|
45
|
-
const cwd = workspaceRoot;
|
|
46
|
-
const start = Math.min(lineStart, lineEnd) + 1;
|
|
47
|
-
const end = Math.max(lineStart, lineEnd) + 1;
|
|
48
|
-
try {
|
|
49
|
-
const { stdout: lineStdout } = await execFileAsync('git', ['log', '-L', `${start},${end}:${filePath}`, '--format=%aI', '-n', '40'], { cwd, timeout: GIT_LOG_TIMEOUT_MS });
|
|
50
|
-
const lineDates = lineStdout
|
|
51
|
-
.trim()
|
|
52
|
-
.split('\n')
|
|
53
|
-
.map(line => line.trim())
|
|
54
|
-
.filter(Boolean);
|
|
55
|
-
if (lineDates.length > 0) {
|
|
56
|
-
return {
|
|
57
|
-
modifiedAt: lineDates[0],
|
|
58
|
-
createdAt: lineDates[lineDates.length - 1]
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
// Fall through to file-level dates.
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
const { stdout: createdStdout } = await execFileAsync('git', ['log', '--follow', '--diff-filter=A', '--format=%aI', '-1', '--', filePath], { cwd, timeout: GIT_LOG_TIMEOUT_MS });
|
|
67
|
-
const { stdout: modifiedStdout } = await execFileAsync('git', ['log', '--follow', '--format=%aI', '-1', '--', filePath], { cwd, timeout: GIT_LOG_TIMEOUT_MS });
|
|
68
|
-
return {
|
|
69
|
-
createdAt: createdStdout.trim() || undefined,
|
|
70
|
-
modifiedAt: modifiedStdout.trim() || undefined
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return {};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=git-dates-analyser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-dates-analyser.js","sourceRoot":"","sources":["../../src/analysis/git-dates-analyser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C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CAAC,EAAE,KAAK,EAAE;QACf,OAAO,KAAK,CAAC,YAAY,EAAE,CAAC;IAChC,CAAC;CACJ,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export const localGraphAnalyser = {
|
|
2
|
-
id: 'local_graph_analysis',
|
|
3
|
-
async run({ store }, { centerId, depth = 1 }) {
|
|
4
|
-
const center = await store.getIdea(centerId);
|
|
5
|
-
if (!center) {
|
|
6
|
-
return { centerId, depth, nodes: [], edges: [] };
|
|
7
|
-
}
|
|
8
|
-
const nodes = new Map();
|
|
9
|
-
const edges = new Map();
|
|
10
|
-
const visited = new Set();
|
|
11
|
-
const queue = [{ id: centerId, remaining: depth }];
|
|
12
|
-
while (queue.length > 0) {
|
|
13
|
-
const current = queue.shift();
|
|
14
|
-
if (visited.has(current.id)) {
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
visited.add(current.id);
|
|
18
|
-
const idea = await store.getIdea(current.id);
|
|
19
|
-
if (idea) {
|
|
20
|
-
nodes.set(idea.id, idea);
|
|
21
|
-
}
|
|
22
|
-
const outbound = await store.getEdgesFrom(current.id);
|
|
23
|
-
const inbound = await store.getEdgesTo(current.id);
|
|
24
|
-
for (const edge of [...outbound, ...inbound]) {
|
|
25
|
-
edges.set(edge.id, edge);
|
|
26
|
-
if (current.remaining > 0) {
|
|
27
|
-
const nextId = edge.sourceId === current.id ? edge.targetId : edge.sourceId;
|
|
28
|
-
if (nextId) {
|
|
29
|
-
queue.push({ id: nextId, remaining: current.remaining - 1 });
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
centerId,
|
|
36
|
-
depth,
|
|
37
|
-
nodes: [...nodes.values()],
|
|
38
|
-
edges: [...edges.values()]
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=local-graph-analyser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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,OAAO,CAAC,EAAE,CAAC,CAAC;YACtD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACnD,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;gBAC3C,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;gBACzB,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;oBACxB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;oBAC5E,IAAI,MAAM,EAAE,CAAC;wBACT,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC,CAAC;oBACjE,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO;YACH,QAAQ;YACR,KAAK;YACL,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC1B,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;SAC7B,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Analyser } from './analyser-registry.js';
|
|
2
|
-
import type { SemanticMatch } from '../core/types.js';
|
|
3
|
-
export interface SemanticSearchParams {
|
|
4
|
-
query: string;
|
|
5
|
-
ideaset?: string;
|
|
6
|
-
limit?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare const semanticSearchAnalyser: Analyser<SemanticSearchParams, SemanticMatch[]>;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export const semanticSearchAnalyser = {
|
|
2
|
-
id: 'semantic_analysis',
|
|
3
|
-
async run({ store }, { query, ideaset, limit = 20 }) {
|
|
4
|
-
const normalized = query.toLowerCase();
|
|
5
|
-
const tokens = normalized.split(/\s+/).filter(Boolean);
|
|
6
|
-
const candidates = await store.searchByNameOrSummary(query);
|
|
7
|
-
const matches = [];
|
|
8
|
-
for (const idea of candidates) {
|
|
9
|
-
if (ideaset && idea.kind === 'ideaset' && idea.name !== ideaset) {
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
const haystack = `${idea.name} ${idea.summary} ${idea.tags.join(' ')}`.toLowerCase();
|
|
13
|
-
const reasons = [];
|
|
14
|
-
let score = 0;
|
|
15
|
-
if (idea.name.toLowerCase().includes(normalized)) {
|
|
16
|
-
score += 3;
|
|
17
|
-
reasons.push('name match');
|
|
18
|
-
}
|
|
19
|
-
if (idea.summary.toLowerCase().includes(normalized)) {
|
|
20
|
-
score += 2;
|
|
21
|
-
reasons.push('summary match');
|
|
22
|
-
}
|
|
23
|
-
for (const token of tokens) {
|
|
24
|
-
if (haystack.includes(token)) {
|
|
25
|
-
score += 1;
|
|
26
|
-
reasons.push(`token:${token}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
for (const tag of idea.tags) {
|
|
30
|
-
if (tag.toLowerCase().includes(normalized)) {
|
|
31
|
-
score += 1;
|
|
32
|
-
reasons.push(`tag:${tag}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const relatedEdges = await store.getEdgesFrom(idea.id);
|
|
36
|
-
for (const edge of relatedEdges) {
|
|
37
|
-
if (edge.label?.toLowerCase().includes(normalized)) {
|
|
38
|
-
score += 1;
|
|
39
|
-
reasons.push('reference label');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (score > 0) {
|
|
43
|
-
matches.push({ idea, score, reasons: [...new Set(reasons)] });
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return matches
|
|
47
|
-
.sort((left, right) => right.score - left.score)
|
|
48
|
-
.slice(0, limit);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=semantic-search-analyser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-search-analyser.js","sourceRoot":"","sources":["../../src/analysis/semantic-search-analyser.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,sBAAsB,GAAoD;IACnF,EAAE,EAAE,mBAAmB;IACvB,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,GAAG,EAAE,EAAE;QAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAoB,EAAE,CAAC;QAEpC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC5B,IAAI,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC9D,SAAS;YACb,CAAC;YACD,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;YACrF,MAAM,OAAO,GAAa,EAAE,CAAC;YAC7B,IAAI,KAAK,GAAG,CAAC,CAAC;YAEd,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC/C,KAAK,IAAI,CAAC,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC/B,CAAC;YACD,IAAI,IAAI,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AE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC/C,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;CACJ,CAAC"}
|
package/out/analysis-api.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { exportHtml } from './export/export-html.js';
|
|
2
|
-
import { exportMarkdown } from './export/export-markdown.js';
|
|
3
|
-
import { exportJson } from './export/export-json.js';
|
|
4
|
-
import { exportCsv } from './export/export-csv.js';
|
|
5
|
-
export class AnalysisApi {
|
|
6
|
-
constructor(runtime) {
|
|
7
|
-
this.runtime = runtime;
|
|
8
|
-
}
|
|
9
|
-
async ensureReady() {
|
|
10
|
-
if (this.runtime.index.isReady) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
await this.runtime.index.syncWorkspace();
|
|
14
|
-
}
|
|
15
|
-
async searchRequirements(query, limit = 8) {
|
|
16
|
-
await this.ensureReady();
|
|
17
|
-
const matches = await this.runtime.analysers.run(this.runtime.makeContext(), 'semantic_analysis', { query, limit });
|
|
18
|
-
return matches.map(match => ({
|
|
19
|
-
idea: match.idea,
|
|
20
|
-
score: match.score,
|
|
21
|
-
reasons: match.reasons
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
async listRequirements(limit = 50) {
|
|
25
|
-
await this.ensureReady();
|
|
26
|
-
const ideas = await this.runtime.analysers.run(this.runtime.makeContext(), 'list_all_ideas', undefined);
|
|
27
|
-
return ideas.slice(0, limit);
|
|
28
|
-
}
|
|
29
|
-
async getFileContext(filePath) {
|
|
30
|
-
await this.ensureReady();
|
|
31
|
-
const fileUri = this.runtime.index.resolveFileUri(filePath);
|
|
32
|
-
return this.runtime.analysers.run(this.runtime.makeContext(), 'file_related_requirements', { fileUri });
|
|
33
|
-
}
|
|
34
|
-
async getLocalGraph(filePath, depth = 1) {
|
|
35
|
-
await this.ensureReady();
|
|
36
|
-
const fileUri = this.runtime.index.resolveFileUri(filePath);
|
|
37
|
-
const ideas = await this.runtime.index.indexStore.getIdeasInFile(fileUri);
|
|
38
|
-
if (ideas.length === 0) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
const center = ideas[0];
|
|
42
|
-
return this.runtime.analysers.run(this.runtime.makeContext(), 'local_graph_analysis', { centerId: center.id, depth });
|
|
43
|
-
}
|
|
44
|
-
async summarizeSubtree(requirementName, depth = 2) {
|
|
45
|
-
await this.ensureReady();
|
|
46
|
-
const matches = await this.searchRequirements(requirementName, 1);
|
|
47
|
-
const center = matches[0]?.idea;
|
|
48
|
-
if (!center) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
return this.runtime.analysers.run(this.runtime.makeContext(), 'local_graph_analysis', { centerId: center.id, depth });
|
|
52
|
-
}
|
|
53
|
-
async getCompletionStatus() {
|
|
54
|
-
await this.ensureReady();
|
|
55
|
-
return this.runtime.analysers.run(this.runtime.makeContext(), 'completion_tracking', undefined);
|
|
56
|
-
}
|
|
57
|
-
async getDeprecationImpact() {
|
|
58
|
-
await this.ensureReady();
|
|
59
|
-
return this.runtime.analysers.run(this.runtime.makeContext(), 'deprecation_impact_analysis', undefined);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Export the indexed requirement graph as a multi-file static HTML site.
|
|
63
|
-
* Headless entry point shared by CLI and site build.
|
|
64
|
-
*/
|
|
65
|
-
async exportHtml(request, onProgress) {
|
|
66
|
-
await this.ensureReady();
|
|
67
|
-
return exportHtml(this.runtime.index.indexStore, {
|
|
68
|
-
...request,
|
|
69
|
-
workspaceRoot: request.workspaceRoot ?? this.runtime.workspaceRoot
|
|
70
|
-
}, onProgress);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Export the indexed requirement graph as markdown (README + optional idea pages).
|
|
74
|
-
*/
|
|
75
|
-
async exportMarkdown(request, onProgress) {
|
|
76
|
-
await this.ensureReady();
|
|
77
|
-
return exportMarkdown(this.runtime.index.indexStore, {
|
|
78
|
-
...request,
|
|
79
|
-
format: 'markdown',
|
|
80
|
-
workspaceRoot: request.workspaceRoot ?? this.runtime.workspaceRoot
|
|
81
|
-
}, onProgress);
|
|
82
|
-
}
|
|
83
|
-
/** Export structured JSON for tooling and AI consumption. */
|
|
84
|
-
async exportJson(request, onProgress) {
|
|
85
|
-
await this.ensureReady();
|
|
86
|
-
return exportJson(this.runtime.index.indexStore, {
|
|
87
|
-
...request,
|
|
88
|
-
format: 'json',
|
|
89
|
-
workspaceRoot: request.workspaceRoot ?? this.runtime.workspaceRoot
|
|
90
|
-
}, onProgress);
|
|
91
|
-
}
|
|
92
|
-
/** Export ideas/references as CSV with flattened tags and attributes. */
|
|
93
|
-
async exportCsv(request, onProgress) {
|
|
94
|
-
await this.ensureReady();
|
|
95
|
-
return exportCsv(this.runtime.index.indexStore, {
|
|
96
|
-
...request,
|
|
97
|
-
format: 'csv',
|
|
98
|
-
workspaceRoot: request.workspaceRoot ?? this.runtime.workspaceRoot
|
|
99
|
-
}, onProgress);
|
|
100
|
-
}
|
|
101
|
-
async resolveRequirementReference(name) {
|
|
102
|
-
await this.ensureReady();
|
|
103
|
-
const query = name?.trim() ?? '';
|
|
104
|
-
if (query) {
|
|
105
|
-
const matches = await this.searchRequirements(query, 8);
|
|
106
|
-
return matches.map(match => match.idea);
|
|
107
|
-
}
|
|
108
|
-
return this.listRequirements(12);
|
|
109
|
-
}
|
|
110
|
-
async resolveFileReference(pathPrefix) {
|
|
111
|
-
await this.ensureReady();
|
|
112
|
-
const prefix = pathPrefix?.trim() ?? '';
|
|
113
|
-
const files = await this.runtime.index.listRqFiles(prefix).slice(0, 12);
|
|
114
|
-
const results = [];
|
|
115
|
-
for (const path of files) {
|
|
116
|
-
const related = await this.getFileContext(path).catch(() => undefined);
|
|
117
|
-
results.push({
|
|
118
|
-
path,
|
|
119
|
-
ideas: related?.ideasInFile.slice(0, 4) ?? []
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
return results;
|
|
123
|
-
}
|
|
124
|
-
listInteractions() {
|
|
125
|
-
return [
|
|
126
|
-
{
|
|
127
|
-
name: 'search_requirements',
|
|
128
|
-
description: 'Search requirements by keyword across names, summaries, tags, and references.',
|
|
129
|
-
parameters: { query: 'Search text', limit: 'Optional maximum number of matches' }
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: 'list_requirements',
|
|
133
|
-
description: 'List indexed requirements in the workspace.',
|
|
134
|
-
parameters: { limit: 'Optional maximum number of requirements' }
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: 'file_context',
|
|
138
|
-
description: 'Get requirements in, referencing, or comment-linked to a file.',
|
|
139
|
-
parameters: { filePath: 'Relative or absolute path to a .rq file' }
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: 'local_graph',
|
|
143
|
-
description: 'Get the local requirement graph around the first requirement in a file.',
|
|
144
|
-
parameters: { filePath: 'Relative or absolute path to a .rq file', depth: 'Optional hop depth' }
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: 'summarize_subtree',
|
|
148
|
-
description: 'Summarise a requirement subtree rooted at a named requirement.',
|
|
149
|
-
parameters: { requirementName: 'Requirement name or search text', depth: 'Optional hop depth' }
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: 'requirement_reference',
|
|
153
|
-
description: 'Resolve a requirement by name for compact chat or MCP context.',
|
|
154
|
-
parameters: { name: 'Optional requirement name or search text' }
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: 'file_reference',
|
|
158
|
-
description: 'Resolve requirements indexed in matching .rq files.',
|
|
159
|
-
parameters: { path: 'Optional path fragment filter' }
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'completion_status',
|
|
163
|
-
description: 'Summarise completion and deprecation status across the workspace graph.',
|
|
164
|
-
parameters: {}
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: 'export_html',
|
|
168
|
-
description: 'Export the requirement graph as a multi-file static HTML site.',
|
|
169
|
-
parameters: {
|
|
170
|
-
outputDir: 'Parent directory for the export folder',
|
|
171
|
-
exportName: 'Export folder name',
|
|
172
|
-
excludeSecretFiles: 'Optional: omit *.secret.rq files',
|
|
173
|
-
excludeIgnoredFiles: 'Optional: omit .rqignore-matched files'
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: 'list_interactions',
|
|
178
|
-
description: 'Discover available requirement graph interactions and parameters.',
|
|
179
|
-
parameters: {}
|
|
180
|
-
}
|
|
181
|
-
];
|
|
182
|
-
}
|
|
183
|
-
formatIdea(idea) {
|
|
184
|
-
const location = `${this.runtime.index.relativePath(idea.fileUri)}:${idea.lineStart + 1}`;
|
|
185
|
-
const tags = idea.tags.length > 0 ? `\nTags: ${idea.tags.join(', ')}` : '';
|
|
186
|
-
const status = idea.status ? `\nStatus: ${idea.status}` : '';
|
|
187
|
-
return `### ${idea.name} (${location})\n${idea.summary || '(no summary)'}${status}${tags}`;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
//# sourceMappingURL=analysis-api.js.map
|