midnight-mcp 0.1.40 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +10764 -0
- package/dist/index.d.ts +205 -3
- package/dist/index.js +10722 -15
- package/package.json +16 -6
- package/dist/config/compact-version.d.ts +0 -183
- package/dist/config/compact-version.js +0 -423
- package/dist/db/index.d.ts +0 -3
- package/dist/db/index.js +0 -2
- package/dist/db/vectorStore.d.ts +0 -69
- package/dist/db/vectorStore.js +0 -196
- package/dist/pipeline/embeddings.d.ts +0 -25
- package/dist/pipeline/embeddings.js +0 -103
- package/dist/pipeline/github.d.ts +0 -84
- package/dist/pipeline/github.js +0 -399
- package/dist/pipeline/index.d.ts +0 -11
- package/dist/pipeline/index.js +0 -6
- package/dist/pipeline/indexer.d.ts +0 -41
- package/dist/pipeline/indexer.js +0 -254
- package/dist/pipeline/parser.d.ts +0 -46
- package/dist/pipeline/parser.js +0 -436
- package/dist/pipeline/releases.d.ts +0 -112
- package/dist/pipeline/releases.js +0 -298
- package/dist/pipeline/repository.d.ts +0 -372
- package/dist/pipeline/repository.js +0 -520
- package/dist/prompts/index.d.ts +0 -3
- package/dist/prompts/index.js +0 -2
- package/dist/prompts/templates.d.ts +0 -26
- package/dist/prompts/templates.js +0 -443
- package/dist/resources/code.d.ts +0 -15
- package/dist/resources/code.js +0 -122
- package/dist/resources/content/code-content.d.ts +0 -6
- package/dist/resources/content/code-content.js +0 -802
- package/dist/resources/content/docs-content.d.ts +0 -14
- package/dist/resources/content/docs-content.js +0 -1202
- package/dist/resources/content/index.d.ts +0 -6
- package/dist/resources/content/index.js +0 -6
- package/dist/resources/docs.d.ts +0 -15
- package/dist/resources/docs.js +0 -98
- package/dist/resources/index.d.ts +0 -6
- package/dist/resources/index.js +0 -13
- package/dist/resources/schemas.d.ts +0 -16
- package/dist/resources/schemas.js +0 -407
- package/dist/scripts/index-repos.d.ts +0 -12
- package/dist/scripts/index-repos.js +0 -53
- package/dist/server.d.ts +0 -43
- package/dist/server.js +0 -693
- package/dist/services/index.d.ts +0 -6
- package/dist/services/index.js +0 -6
- package/dist/services/sampling.d.ts +0 -62
- package/dist/services/sampling.js +0 -277
- package/dist/tools/analyze.d.ts +0 -106
- package/dist/tools/analyze.js +0 -431
- package/dist/tools/generation.d.ts +0 -9
- package/dist/tools/generation.js +0 -285
- package/dist/tools/health.d.ts +0 -120
- package/dist/tools/health.js +0 -362
- package/dist/tools/index.d.ts +0 -14
- package/dist/tools/index.js +0 -22
- package/dist/tools/meta.d.ts +0 -61
- package/dist/tools/meta.js +0 -282
- package/dist/tools/repository/constants.d.ts +0 -19
- package/dist/tools/repository/constants.js +0 -324
- package/dist/tools/repository/handlers.d.ts +0 -373
- package/dist/tools/repository/handlers.js +0 -724
- package/dist/tools/repository/index.d.ts +0 -9
- package/dist/tools/repository/index.js +0 -13
- package/dist/tools/repository/schemas.d.ts +0 -153
- package/dist/tools/repository/schemas.js +0 -106
- package/dist/tools/repository/tools.d.ts +0 -7
- package/dist/tools/repository/tools.js +0 -484
- package/dist/tools/repository/validation.d.ts +0 -106
- package/dist/tools/repository/validation.js +0 -820
- package/dist/tools/repository.d.ts +0 -6
- package/dist/tools/repository.js +0 -7
- package/dist/tools/search.d.ts +0 -76
- package/dist/tools/search.js +0 -423
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.js +0 -2
- package/dist/types/mcp.d.ts +0 -187
- package/dist/types/mcp.js +0 -6
- package/dist/utils/cache.d.ts +0 -77
- package/dist/utils/cache.js +0 -172
- package/dist/utils/config.d.ts +0 -70
- package/dist/utils/config.js +0 -294
- package/dist/utils/errors.d.ts +0 -111
- package/dist/utils/errors.js +0 -165
- package/dist/utils/health.d.ts +0 -29
- package/dist/utils/health.js +0 -132
- package/dist/utils/hosted-api.d.ts +0 -67
- package/dist/utils/hosted-api.js +0 -119
- package/dist/utils/index.d.ts +0 -16
- package/dist/utils/index.js +0 -15
- package/dist/utils/logger.d.ts +0 -48
- package/dist/utils/logger.js +0 -124
- package/dist/utils/rate-limit.d.ts +0 -61
- package/dist/utils/rate-limit.js +0 -148
- package/dist/utils/validation.d.ts +0 -52
- package/dist/utils/validation.js +0 -255
package/dist/pipeline/parser.js
DELETED
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import { logger } from "../utils/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Parse Compact smart contract files
|
|
4
|
-
*/
|
|
5
|
-
export function parseCompactFile(path, content) {
|
|
6
|
-
const lines = content.split("\n");
|
|
7
|
-
const codeUnits = [];
|
|
8
|
-
const imports = [];
|
|
9
|
-
const exports = [];
|
|
10
|
-
let hasLedger = false;
|
|
11
|
-
let hasCircuits = false;
|
|
12
|
-
let hasWitnesses = false;
|
|
13
|
-
// Extract imports
|
|
14
|
-
const importRegex = /^include\s+["']([^"']+)["'];?/gm;
|
|
15
|
-
let importMatch;
|
|
16
|
-
while ((importMatch = importRegex.exec(content)) !== null) {
|
|
17
|
-
imports.push(importMatch[1]);
|
|
18
|
-
}
|
|
19
|
-
// Parse ledger block
|
|
20
|
-
const ledgerRegex = /ledger\s*\{([^}]*(?:\{[^}]*\}[^}]*)*)\}/gs;
|
|
21
|
-
let ledgerMatch;
|
|
22
|
-
while ((ledgerMatch = ledgerRegex.exec(content)) !== null) {
|
|
23
|
-
hasLedger = true;
|
|
24
|
-
const ledgerContent = ledgerMatch[1];
|
|
25
|
-
const startLine = content.substring(0, ledgerMatch.index).split("\n").length;
|
|
26
|
-
const endLine = startLine + ledgerMatch[0].split("\n").length - 1;
|
|
27
|
-
codeUnits.push({
|
|
28
|
-
type: "ledger",
|
|
29
|
-
name: "ledger",
|
|
30
|
-
code: ledgerMatch[0],
|
|
31
|
-
startLine,
|
|
32
|
-
endLine,
|
|
33
|
-
isPublic: true,
|
|
34
|
-
isPrivate: false,
|
|
35
|
-
});
|
|
36
|
-
// Parse individual ledger fields
|
|
37
|
-
const fieldRegex = /(@private\s+)?(\w+)\s*:\s*([^;]+);/g;
|
|
38
|
-
let fieldMatch;
|
|
39
|
-
while ((fieldMatch = fieldRegex.exec(ledgerContent)) !== null) {
|
|
40
|
-
const isPrivate = !!fieldMatch[1];
|
|
41
|
-
codeUnits.push({
|
|
42
|
-
type: "ledger",
|
|
43
|
-
name: fieldMatch[2],
|
|
44
|
-
code: fieldMatch[0].trim(),
|
|
45
|
-
startLine: startLine,
|
|
46
|
-
endLine: startLine,
|
|
47
|
-
isPublic: !isPrivate,
|
|
48
|
-
isPrivate,
|
|
49
|
-
returnType: fieldMatch[3].trim(),
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// Parse circuit definitions
|
|
54
|
-
const circuitRegex = /(export\s+)?circuit\s+(\w+)\s*\(([^)]*)\)\s*(?::\s*(\w+))?\s*\{/g;
|
|
55
|
-
let circuitMatch;
|
|
56
|
-
while ((circuitMatch = circuitRegex.exec(content)) !== null) {
|
|
57
|
-
hasCircuits = true;
|
|
58
|
-
const isExport = !!circuitMatch[1];
|
|
59
|
-
const name = circuitMatch[2];
|
|
60
|
-
const params = circuitMatch[3];
|
|
61
|
-
const returnType = circuitMatch[4] || "Void";
|
|
62
|
-
// Find the matching closing brace
|
|
63
|
-
const startIndex = circuitMatch.index;
|
|
64
|
-
let braceCount = 1;
|
|
65
|
-
let endIndex = content.indexOf("{", startIndex) + 1;
|
|
66
|
-
while (braceCount > 0 && endIndex < content.length) {
|
|
67
|
-
if (content[endIndex] === "{")
|
|
68
|
-
braceCount++;
|
|
69
|
-
if (content[endIndex] === "}")
|
|
70
|
-
braceCount--;
|
|
71
|
-
endIndex++;
|
|
72
|
-
}
|
|
73
|
-
const circuitCode = content.substring(startIndex, endIndex);
|
|
74
|
-
const startLine = content.substring(0, startIndex).split("\n").length;
|
|
75
|
-
const endLine = startLine + circuitCode.split("\n").length - 1;
|
|
76
|
-
// Parse parameters
|
|
77
|
-
const parameters = params
|
|
78
|
-
.split(",")
|
|
79
|
-
.filter((p) => p.trim())
|
|
80
|
-
.map((p) => {
|
|
81
|
-
const parts = p.trim().split(":");
|
|
82
|
-
return {
|
|
83
|
-
name: parts[0]?.trim() || "",
|
|
84
|
-
type: parts[1]?.trim() || "unknown",
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
if (isExport) {
|
|
88
|
-
exports.push(name);
|
|
89
|
-
}
|
|
90
|
-
codeUnits.push({
|
|
91
|
-
type: "circuit",
|
|
92
|
-
name,
|
|
93
|
-
code: circuitCode,
|
|
94
|
-
startLine,
|
|
95
|
-
endLine,
|
|
96
|
-
isPublic: isExport,
|
|
97
|
-
isPrivate: false,
|
|
98
|
-
parameters,
|
|
99
|
-
returnType,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
// Parse witness functions
|
|
103
|
-
const witnessRegex = /witness\s+(\w+)\s*\(([^)]*)\)\s*(?::\s*([^{]+))?\s*\{/g;
|
|
104
|
-
let witnessMatch;
|
|
105
|
-
while ((witnessMatch = witnessRegex.exec(content)) !== null) {
|
|
106
|
-
hasWitnesses = true;
|
|
107
|
-
const name = witnessMatch[1];
|
|
108
|
-
const params = witnessMatch[2];
|
|
109
|
-
const returnType = witnessMatch[3]?.trim() || "unknown";
|
|
110
|
-
// Find the matching closing brace
|
|
111
|
-
const startIndex = witnessMatch.index;
|
|
112
|
-
let braceCount = 1;
|
|
113
|
-
let endIndex = content.indexOf("{", startIndex) + 1;
|
|
114
|
-
while (braceCount > 0 && endIndex < content.length) {
|
|
115
|
-
if (content[endIndex] === "{")
|
|
116
|
-
braceCount++;
|
|
117
|
-
if (content[endIndex] === "}")
|
|
118
|
-
braceCount--;
|
|
119
|
-
endIndex++;
|
|
120
|
-
}
|
|
121
|
-
const witnessCode = content.substring(startIndex, endIndex);
|
|
122
|
-
const startLine = content.substring(0, startIndex).split("\n").length;
|
|
123
|
-
const endLine = startLine + witnessCode.split("\n").length - 1;
|
|
124
|
-
// Parse parameters
|
|
125
|
-
const parameters = params
|
|
126
|
-
.split(",")
|
|
127
|
-
.filter((p) => p.trim())
|
|
128
|
-
.map((p) => {
|
|
129
|
-
const parts = p.trim().split(":");
|
|
130
|
-
return {
|
|
131
|
-
name: parts[0]?.trim() || "",
|
|
132
|
-
type: parts[1]?.trim() || "unknown",
|
|
133
|
-
};
|
|
134
|
-
});
|
|
135
|
-
codeUnits.push({
|
|
136
|
-
type: "witness",
|
|
137
|
-
name,
|
|
138
|
-
code: witnessCode,
|
|
139
|
-
startLine,
|
|
140
|
-
endLine,
|
|
141
|
-
isPublic: false,
|
|
142
|
-
isPrivate: true,
|
|
143
|
-
parameters,
|
|
144
|
-
returnType,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
// Parse type definitions
|
|
148
|
-
const typeRegex = /(export\s+)?type\s+(\w+)\s*=\s*([^;]+);/g;
|
|
149
|
-
let typeMatch;
|
|
150
|
-
while ((typeMatch = typeRegex.exec(content)) !== null) {
|
|
151
|
-
const isExport = !!typeMatch[1];
|
|
152
|
-
const name = typeMatch[2];
|
|
153
|
-
const startLine = content.substring(0, typeMatch.index).split("\n").length;
|
|
154
|
-
if (isExport) {
|
|
155
|
-
exports.push(name);
|
|
156
|
-
}
|
|
157
|
-
codeUnits.push({
|
|
158
|
-
type: "type",
|
|
159
|
-
name,
|
|
160
|
-
code: typeMatch[0],
|
|
161
|
-
startLine,
|
|
162
|
-
endLine: startLine,
|
|
163
|
-
isPublic: isExport,
|
|
164
|
-
isPrivate: false,
|
|
165
|
-
returnType: typeMatch[3].trim(),
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
path,
|
|
170
|
-
language: "compact",
|
|
171
|
-
content,
|
|
172
|
-
codeUnits,
|
|
173
|
-
imports,
|
|
174
|
-
exports,
|
|
175
|
-
metadata: {
|
|
176
|
-
hasLedger,
|
|
177
|
-
hasCircuits,
|
|
178
|
-
hasWitnesses,
|
|
179
|
-
lineCount: lines.length,
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Parse TypeScript files
|
|
185
|
-
*/
|
|
186
|
-
export function parseTypeScriptFile(path, content) {
|
|
187
|
-
const lines = content.split("\n");
|
|
188
|
-
const codeUnits = [];
|
|
189
|
-
const imports = [];
|
|
190
|
-
const exports = [];
|
|
191
|
-
// Extract imports
|
|
192
|
-
const importRegex = /import\s+(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)\s+from\s+["']([^"']+)["']/g;
|
|
193
|
-
let importMatch;
|
|
194
|
-
while ((importMatch = importRegex.exec(content)) !== null) {
|
|
195
|
-
imports.push(importMatch[1]);
|
|
196
|
-
}
|
|
197
|
-
// Parse function declarations
|
|
198
|
-
const functionRegex = /(export\s+)?(async\s+)?function\s+(\w+)\s*(?:<[^>]+>)?\s*\(([^)]*)\)\s*(?::\s*([^{]+))?\s*\{/g;
|
|
199
|
-
let funcMatch;
|
|
200
|
-
while ((funcMatch = functionRegex.exec(content)) !== null) {
|
|
201
|
-
const isExport = !!funcMatch[1];
|
|
202
|
-
const isAsync = !!funcMatch[2];
|
|
203
|
-
const name = funcMatch[3];
|
|
204
|
-
const params = funcMatch[4];
|
|
205
|
-
const returnType = funcMatch[5]?.trim() || (isAsync ? "Promise<void>" : "void");
|
|
206
|
-
// Find the matching closing brace
|
|
207
|
-
const startIndex = funcMatch.index;
|
|
208
|
-
let braceCount = 1;
|
|
209
|
-
let endIndex = content.indexOf("{", startIndex) + 1;
|
|
210
|
-
while (braceCount > 0 && endIndex < content.length) {
|
|
211
|
-
if (content[endIndex] === "{")
|
|
212
|
-
braceCount++;
|
|
213
|
-
if (content[endIndex] === "}")
|
|
214
|
-
braceCount--;
|
|
215
|
-
endIndex++;
|
|
216
|
-
}
|
|
217
|
-
const funcCode = content.substring(startIndex, endIndex);
|
|
218
|
-
const startLine = content.substring(0, startIndex).split("\n").length;
|
|
219
|
-
const endLine = startLine + funcCode.split("\n").length - 1;
|
|
220
|
-
// Parse parameters
|
|
221
|
-
const parameters = params
|
|
222
|
-
.split(",")
|
|
223
|
-
.filter((p) => p.trim())
|
|
224
|
-
.map((p) => {
|
|
225
|
-
const parts = p.trim().split(":");
|
|
226
|
-
return {
|
|
227
|
-
name: parts[0]?.trim().replace(/\?$/, "") || "",
|
|
228
|
-
type: parts[1]?.trim() || "any",
|
|
229
|
-
};
|
|
230
|
-
});
|
|
231
|
-
if (isExport) {
|
|
232
|
-
exports.push(name);
|
|
233
|
-
}
|
|
234
|
-
codeUnits.push({
|
|
235
|
-
type: "function",
|
|
236
|
-
name,
|
|
237
|
-
code: funcCode,
|
|
238
|
-
startLine,
|
|
239
|
-
endLine,
|
|
240
|
-
isPublic: isExport,
|
|
241
|
-
isPrivate: false,
|
|
242
|
-
parameters,
|
|
243
|
-
returnType,
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
// Parse class declarations
|
|
247
|
-
const classRegex = /(export\s+)?(abstract\s+)?class\s+(\w+)(?:\s+extends\s+\w+)?(?:\s+implements\s+[^{]+)?\s*\{/g;
|
|
248
|
-
let classMatch;
|
|
249
|
-
while ((classMatch = classRegex.exec(content)) !== null) {
|
|
250
|
-
const isExport = !!classMatch[1];
|
|
251
|
-
const isAbstract = !!classMatch[2];
|
|
252
|
-
const name = classMatch[3];
|
|
253
|
-
// Find the matching closing brace
|
|
254
|
-
const startIndex = classMatch.index;
|
|
255
|
-
let braceCount = 1;
|
|
256
|
-
let endIndex = content.indexOf("{", startIndex) + 1;
|
|
257
|
-
while (braceCount > 0 && endIndex < content.length) {
|
|
258
|
-
if (content[endIndex] === "{")
|
|
259
|
-
braceCount++;
|
|
260
|
-
if (content[endIndex] === "}")
|
|
261
|
-
braceCount--;
|
|
262
|
-
endIndex++;
|
|
263
|
-
}
|
|
264
|
-
const classCode = content.substring(startIndex, endIndex);
|
|
265
|
-
const startLine = content.substring(0, startIndex).split("\n").length;
|
|
266
|
-
const endLine = startLine + classCode.split("\n").length - 1;
|
|
267
|
-
if (isExport) {
|
|
268
|
-
exports.push(name);
|
|
269
|
-
}
|
|
270
|
-
codeUnits.push({
|
|
271
|
-
type: "class",
|
|
272
|
-
name,
|
|
273
|
-
code: classCode,
|
|
274
|
-
startLine,
|
|
275
|
-
endLine,
|
|
276
|
-
isPublic: isExport,
|
|
277
|
-
isPrivate: false,
|
|
278
|
-
documentation: isAbstract ? "abstract class" : undefined,
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
// Parse interface declarations
|
|
282
|
-
const interfaceRegex = /(export\s+)?interface\s+(\w+)(?:\s+extends\s+[^{]+)?\s*\{/g;
|
|
283
|
-
let ifaceMatch;
|
|
284
|
-
while ((ifaceMatch = interfaceRegex.exec(content)) !== null) {
|
|
285
|
-
const isExport = !!ifaceMatch[1];
|
|
286
|
-
const name = ifaceMatch[2];
|
|
287
|
-
// Find the matching closing brace
|
|
288
|
-
const startIndex = ifaceMatch.index;
|
|
289
|
-
let braceCount = 1;
|
|
290
|
-
let endIndex = content.indexOf("{", startIndex) + 1;
|
|
291
|
-
while (braceCount > 0 && endIndex < content.length) {
|
|
292
|
-
if (content[endIndex] === "{")
|
|
293
|
-
braceCount++;
|
|
294
|
-
if (content[endIndex] === "}")
|
|
295
|
-
braceCount--;
|
|
296
|
-
endIndex++;
|
|
297
|
-
}
|
|
298
|
-
const ifaceCode = content.substring(startIndex, endIndex);
|
|
299
|
-
const startLine = content.substring(0, startIndex).split("\n").length;
|
|
300
|
-
const endLine = startLine + ifaceCode.split("\n").length - 1;
|
|
301
|
-
if (isExport) {
|
|
302
|
-
exports.push(name);
|
|
303
|
-
}
|
|
304
|
-
codeUnits.push({
|
|
305
|
-
type: "interface",
|
|
306
|
-
name,
|
|
307
|
-
code: ifaceCode,
|
|
308
|
-
startLine,
|
|
309
|
-
endLine,
|
|
310
|
-
isPublic: isExport,
|
|
311
|
-
isPrivate: false,
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
// Parse type definitions
|
|
315
|
-
const typeRegex = /(export\s+)?type\s+(\w+)(?:<[^>]+>)?\s*=\s*([^;]+);/g;
|
|
316
|
-
let typeMatch;
|
|
317
|
-
while ((typeMatch = typeRegex.exec(content)) !== null) {
|
|
318
|
-
const isExport = !!typeMatch[1];
|
|
319
|
-
const name = typeMatch[2];
|
|
320
|
-
const startLine = content.substring(0, typeMatch.index).split("\n").length;
|
|
321
|
-
if (isExport) {
|
|
322
|
-
exports.push(name);
|
|
323
|
-
}
|
|
324
|
-
codeUnits.push({
|
|
325
|
-
type: "type",
|
|
326
|
-
name,
|
|
327
|
-
code: typeMatch[0],
|
|
328
|
-
startLine,
|
|
329
|
-
endLine: startLine,
|
|
330
|
-
isPublic: isExport,
|
|
331
|
-
isPrivate: false,
|
|
332
|
-
returnType: typeMatch[3].trim(),
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
path,
|
|
337
|
-
language: "typescript",
|
|
338
|
-
content,
|
|
339
|
-
codeUnits,
|
|
340
|
-
imports,
|
|
341
|
-
exports,
|
|
342
|
-
metadata: {
|
|
343
|
-
hasLedger: false,
|
|
344
|
-
hasCircuits: false,
|
|
345
|
-
hasWitnesses: false,
|
|
346
|
-
lineCount: lines.length,
|
|
347
|
-
},
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Parse Markdown documentation files
|
|
352
|
-
*/
|
|
353
|
-
export function parseMarkdownFile(path, content) {
|
|
354
|
-
const lines = content.split("\n");
|
|
355
|
-
const codeUnits = [];
|
|
356
|
-
// Parse headings as sections
|
|
357
|
-
const headingRegex = /^(#{1,6})\s+(.+)$/gm;
|
|
358
|
-
let headingMatch;
|
|
359
|
-
const headings = [];
|
|
360
|
-
while ((headingMatch = headingRegex.exec(content)) !== null) {
|
|
361
|
-
headings.push({
|
|
362
|
-
level: headingMatch[1].length,
|
|
363
|
-
title: headingMatch[2],
|
|
364
|
-
index: headingMatch.index,
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
// Create sections between headings
|
|
368
|
-
for (let i = 0; i < headings.length; i++) {
|
|
369
|
-
const heading = headings[i];
|
|
370
|
-
const nextHeading = headings[i + 1];
|
|
371
|
-
const startIndex = heading.index;
|
|
372
|
-
const endIndex = nextHeading ? nextHeading.index : content.length;
|
|
373
|
-
const sectionContent = content.substring(startIndex, endIndex).trim();
|
|
374
|
-
const startLine = content.substring(0, startIndex).split("\n").length;
|
|
375
|
-
const endLine = startLine + sectionContent.split("\n").length - 1;
|
|
376
|
-
codeUnits.push({
|
|
377
|
-
type: "function", // Using function type for documentation sections
|
|
378
|
-
name: heading.title.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase(),
|
|
379
|
-
code: sectionContent,
|
|
380
|
-
startLine,
|
|
381
|
-
endLine,
|
|
382
|
-
isPublic: true,
|
|
383
|
-
isPrivate: false,
|
|
384
|
-
documentation: heading.title,
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
return {
|
|
388
|
-
path,
|
|
389
|
-
language: "markdown",
|
|
390
|
-
content,
|
|
391
|
-
codeUnits,
|
|
392
|
-
imports: [],
|
|
393
|
-
exports: [],
|
|
394
|
-
metadata: {
|
|
395
|
-
hasLedger: false,
|
|
396
|
-
hasCircuits: false,
|
|
397
|
-
hasWitnesses: false,
|
|
398
|
-
lineCount: lines.length,
|
|
399
|
-
},
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Parse a file based on its extension
|
|
404
|
-
*/
|
|
405
|
-
export function parseFile(path, content) {
|
|
406
|
-
const extension = path.split(".").pop()?.toLowerCase();
|
|
407
|
-
switch (extension) {
|
|
408
|
-
case "compact":
|
|
409
|
-
return parseCompactFile(path, content);
|
|
410
|
-
case "ts":
|
|
411
|
-
case "tsx":
|
|
412
|
-
case "js":
|
|
413
|
-
case "jsx":
|
|
414
|
-
return parseTypeScriptFile(path, content);
|
|
415
|
-
case "md":
|
|
416
|
-
case "mdx":
|
|
417
|
-
return parseMarkdownFile(path, content);
|
|
418
|
-
default:
|
|
419
|
-
logger.warn(`Unknown file extension: ${extension} for ${path}`);
|
|
420
|
-
return {
|
|
421
|
-
path,
|
|
422
|
-
language: "typescript",
|
|
423
|
-
content,
|
|
424
|
-
codeUnits: [],
|
|
425
|
-
imports: [],
|
|
426
|
-
exports: [],
|
|
427
|
-
metadata: {
|
|
428
|
-
hasLedger: false,
|
|
429
|
-
hasCircuits: false,
|
|
430
|
-
hasWitnesses: false,
|
|
431
|
-
lineCount: content.split("\n").length,
|
|
432
|
-
},
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
//# sourceMappingURL=parser.js.map
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
export interface Release {
|
|
2
|
-
tag: string;
|
|
3
|
-
name: string;
|
|
4
|
-
body: string;
|
|
5
|
-
publishedAt: string;
|
|
6
|
-
url: string;
|
|
7
|
-
isPrerelease: boolean;
|
|
8
|
-
assets: Array<{
|
|
9
|
-
name: string;
|
|
10
|
-
downloadUrl: string;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
|
-
export interface ChangelogEntry {
|
|
14
|
-
version: string;
|
|
15
|
-
date: string;
|
|
16
|
-
changes: {
|
|
17
|
-
breaking: string[];
|
|
18
|
-
features: string[];
|
|
19
|
-
fixes: string[];
|
|
20
|
-
deprecations: string[];
|
|
21
|
-
};
|
|
22
|
-
rawBody: string;
|
|
23
|
-
}
|
|
24
|
-
export interface VersionInfo {
|
|
25
|
-
repository: string;
|
|
26
|
-
latestRelease: Release | null;
|
|
27
|
-
latestStableRelease: Release | null;
|
|
28
|
-
recentReleases: Release[];
|
|
29
|
-
changelog: ChangelogEntry[];
|
|
30
|
-
lastChecked: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Fetches and tracks releases from GitHub repositories
|
|
34
|
-
*/
|
|
35
|
-
export declare class ReleaseTracker {
|
|
36
|
-
private octokit;
|
|
37
|
-
private cache;
|
|
38
|
-
private cacheMaxAge;
|
|
39
|
-
constructor(token?: string);
|
|
40
|
-
/**
|
|
41
|
-
* Get all releases for a repository
|
|
42
|
-
*/
|
|
43
|
-
getReleases(owner: string, repo: string, limit?: number): Promise<Release[]>;
|
|
44
|
-
/**
|
|
45
|
-
* Parse a release body to extract structured changelog info
|
|
46
|
-
*/
|
|
47
|
-
parseChangelog(releaseBody: string, version: string, date: string): ChangelogEntry;
|
|
48
|
-
/**
|
|
49
|
-
* Get version info for a repository with caching
|
|
50
|
-
*/
|
|
51
|
-
getVersionInfo(owner: string, repo: string): Promise<VersionInfo>;
|
|
52
|
-
/**
|
|
53
|
-
* Get breaking changes since a specific version
|
|
54
|
-
*/
|
|
55
|
-
getBreakingChangesSince(owner: string, repo: string, sinceVersion: string): Promise<string[]>;
|
|
56
|
-
/**
|
|
57
|
-
* Check if a version is outdated
|
|
58
|
-
*/
|
|
59
|
-
isOutdated(owner: string, repo: string, currentVersion: string): Promise<{
|
|
60
|
-
isOutdated: boolean;
|
|
61
|
-
latestVersion: string | null;
|
|
62
|
-
versionsBehind: number;
|
|
63
|
-
hasBreakingChanges: boolean;
|
|
64
|
-
}>;
|
|
65
|
-
/**
|
|
66
|
-
* Get migration guide between two versions
|
|
67
|
-
*/
|
|
68
|
-
getMigrationGuide(owner: string, repo: string, fromVersion: string, toVersion?: string): Promise<{
|
|
69
|
-
from: string;
|
|
70
|
-
to: string;
|
|
71
|
-
breakingChanges: string[];
|
|
72
|
-
deprecations: string[];
|
|
73
|
-
newFeatures: string[];
|
|
74
|
-
migrationSteps: string[];
|
|
75
|
-
}>;
|
|
76
|
-
/**
|
|
77
|
-
* Get version-specific documentation hints
|
|
78
|
-
*/
|
|
79
|
-
getVersionContext(versionInfo: VersionInfo): string;
|
|
80
|
-
/**
|
|
81
|
-
* Fetch a file at a specific version/tag
|
|
82
|
-
* This is critical for ensuring code recommendations match the user's version
|
|
83
|
-
*/
|
|
84
|
-
getFileAtVersion(owner: string, repo: string, filePath: string, version: string): Promise<{
|
|
85
|
-
content: string;
|
|
86
|
-
version: string;
|
|
87
|
-
} | null>;
|
|
88
|
-
/**
|
|
89
|
-
* Compare syntax between two versions of a file
|
|
90
|
-
* Useful for showing what changed in API/syntax
|
|
91
|
-
*/
|
|
92
|
-
compareSyntax(owner: string, repo: string, filePath: string, oldVersion: string, newVersion: string): Promise<{
|
|
93
|
-
oldVersion: string;
|
|
94
|
-
newVersion: string;
|
|
95
|
-
oldContent: string | null;
|
|
96
|
-
newContent: string | null;
|
|
97
|
-
hasDifferences: boolean;
|
|
98
|
-
}>;
|
|
99
|
-
/**
|
|
100
|
-
* Get the grammar/syntax reference files at the latest version
|
|
101
|
-
* These are the source of truth for valid Compact syntax
|
|
102
|
-
*/
|
|
103
|
-
getLatestSyntaxReference(owner: string, repo: string): Promise<{
|
|
104
|
-
version: string;
|
|
105
|
-
syntaxFiles: Array<{
|
|
106
|
-
path: string;
|
|
107
|
-
content: string;
|
|
108
|
-
}>;
|
|
109
|
-
} | null>;
|
|
110
|
-
}
|
|
111
|
-
export declare const releaseTracker: ReleaseTracker;
|
|
112
|
-
//# sourceMappingURL=releases.d.ts.map
|