mne-docs-mcp 1.0.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/LICENSE +21 -0
- package/README.md +140 -0
- package/dist/cache/manager.d.ts +41 -0
- package/dist/cache/manager.d.ts.map +1 -0
- package/dist/cache/manager.js +123 -0
- package/dist/cache/manager.js.map +1 -0
- package/dist/config.d.ts +75 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +120 -0
- package/dist/config.js.map +1 -0
- package/dist/forum/client.d.ts +9 -0
- package/dist/forum/client.d.ts.map +1 -0
- package/dist/forum/client.js +48 -0
- package/dist/forum/client.js.map +1 -0
- package/dist/github/client.d.ts +33 -0
- package/dist/github/client.d.ts.map +1 -0
- package/dist/github/client.js +198 -0
- package/dist/github/client.js.map +1 -0
- package/dist/github/types.d.ts +238 -0
- package/dist/github/types.d.ts.map +1 -0
- package/dist/github/types.js +2 -0
- package/dist/github/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/bridge.d.ts +46 -0
- package/dist/parser/bridge.d.ts.map +1 -0
- package/dist/parser/bridge.js +225 -0
- package/dist/parser/bridge.js.map +1 -0
- package/dist/parser/types.d.ts +36 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js +2 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +218 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/findMneSymbol.d.ts +22 -0
- package/dist/tools/findMneSymbol.d.ts.map +1 -0
- package/dist/tools/findMneSymbol.js +74 -0
- package/dist/tools/findMneSymbol.js.map +1 -0
- package/dist/tools/getMneChangelog.d.ts +31 -0
- package/dist/tools/getMneChangelog.d.ts.map +1 -0
- package/dist/tools/getMneChangelog.js +233 -0
- package/dist/tools/getMneChangelog.js.map +1 -0
- package/dist/tools/getMneDoc.d.ts +19 -0
- package/dist/tools/getMneDoc.d.ts.map +1 -0
- package/dist/tools/getMneDoc.js +248 -0
- package/dist/tools/getMneDoc.js.map +1 -0
- package/dist/tools/getMneExample.d.ts +31 -0
- package/dist/tools/getMneExample.d.ts.map +1 -0
- package/dist/tools/getMneExample.js +212 -0
- package/dist/tools/getMneExample.js.map +1 -0
- package/dist/tools/getMneFile.d.ts +3 -0
- package/dist/tools/getMneFile.d.ts.map +1 -0
- package/dist/tools/getMneFile.js +60 -0
- package/dist/tools/getMneFile.js.map +1 -0
- package/dist/tools/getMneForumTopic.d.ts +33 -0
- package/dist/tools/getMneForumTopic.d.ts.map +1 -0
- package/dist/tools/getMneForumTopic.js +136 -0
- package/dist/tools/getMneForumTopic.js.map +1 -0
- package/dist/tools/getMneIssue.d.ts +7 -0
- package/dist/tools/getMneIssue.d.ts.map +1 -0
- package/dist/tools/getMneIssue.js +22 -0
- package/dist/tools/getMneIssue.js.map +1 -0
- package/dist/tools/getMneIssueComments.d.ts +10 -0
- package/dist/tools/getMneIssueComments.d.ts.map +1 -0
- package/dist/tools/getMneIssueComments.js +26 -0
- package/dist/tools/getMneIssueComments.js.map +1 -0
- package/dist/tools/getRelatedSymbols.d.ts +26 -0
- package/dist/tools/getRelatedSymbols.d.ts.map +1 -0
- package/dist/tools/getRelatedSymbols.js +120 -0
- package/dist/tools/getRelatedSymbols.js.map +1 -0
- package/dist/tools/getSymbolReferences.d.ts +11 -0
- package/dist/tools/getSymbolReferences.d.ts.map +1 -0
- package/dist/tools/getSymbolReferences.js +251 -0
- package/dist/tools/getSymbolReferences.js.map +1 -0
- package/dist/tools/listMneVersions.d.ts +8 -0
- package/dist/tools/listMneVersions.d.ts.map +1 -0
- package/dist/tools/listMneVersions.js +32 -0
- package/dist/tools/listMneVersions.js.map +1 -0
- package/dist/tools/lookupMneError.d.ts +59 -0
- package/dist/tools/lookupMneError.d.ts.map +1 -0
- package/dist/tools/lookupMneError.js +280 -0
- package/dist/tools/lookupMneError.js.map +1 -0
- package/dist/tools/searchMneDocs.d.ts +3 -0
- package/dist/tools/searchMneDocs.d.ts.map +1 -0
- package/dist/tools/searchMneDocs.js +58 -0
- package/dist/tools/searchMneDocs.js.map +1 -0
- package/dist/tools/searchMneForum.d.ts +9 -0
- package/dist/tools/searchMneForum.d.ts.map +1 -0
- package/dist/tools/searchMneForum.js +29 -0
- package/dist/tools/searchMneForum.js.map +1 -0
- package/dist/tools/searchMneIssues.d.ts +8 -0
- package/dist/tools/searchMneIssues.d.ts.map +1 -0
- package/dist/tools/searchMneIssues.js +23 -0
- package/dist/tools/searchMneIssues.js.map +1 -0
- package/dist/types.d.ts +140 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +35 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/docstring.d.ts +26 -0
- package/dist/utils/docstring.d.ts.map +1 -0
- package/dist/utils/docstring.js +261 -0
- package/dist/utils/docstring.js.map +1 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +73 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/metrics.d.ts +38 -0
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/utils/metrics.js +57 -0
- package/dist/utils/metrics.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +18 -0
- package/dist/version.js.map +1 -0
- package/package.json +71 -0
- package/python/ast_extractor.py +422 -0
- package/python/parser.py +68 -0
- package/python/requirements.txt +2 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for expanding MNE docstring placeholders.
|
|
3
|
+
* MNE uses %(param_name)s placeholders that reference shared documentation.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Expand %(placeholder)s patterns in a docstring using common expansions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function expandDocstring(docstring: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Check if a docstring has unexpanded placeholders.
|
|
11
|
+
*/
|
|
12
|
+
export declare function hasPlaceholders(docstring: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Get list of placeholder names in a docstring.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPlaceholders(docstring: string): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Extract "See Also" references from a numpy-style docstring.
|
|
19
|
+
* Returns an array of symbol names mentioned in the See Also section.
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractSeeAlso(docstring: string): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Format See Also references with links to MNE documentation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatSeeAlsoWithLinks(seeAlso: string[], version: string): string;
|
|
26
|
+
//# sourceMappingURL=docstring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docstring.d.ts","sourceRoot":"","sources":["../../src/utils/docstring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoMH;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAwBzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAc3D;AAGD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAqC1D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAUjF"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for expanding MNE docstring placeholders.
|
|
3
|
+
* MNE uses %(param_name)s placeholders that reference shared documentation.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Common parameter expansions for MNE docstrings.
|
|
7
|
+
* These are the most frequently used placeholders.
|
|
8
|
+
*/
|
|
9
|
+
const COMMON_EXPANSIONS = {
|
|
10
|
+
'verbose': `verbose : bool | str | int | None
|
|
11
|
+
Control verbosity of the logging output. If None, use the default
|
|
12
|
+
verbosity level. See the logging documentation and mne.verbose for
|
|
13
|
+
details. Should only be passed as a keyword argument.`,
|
|
14
|
+
'preload': `preload : bool | str
|
|
15
|
+
Preload data into memory for data manipulation and faster indexing.
|
|
16
|
+
If True, the data will be preloaded into memory (fast, requires
|
|
17
|
+
large amount of memory). If preload is a string, preload is the
|
|
18
|
+
file name of a memory-mapped file which is used to store the data
|
|
19
|
+
on the hard drive (slower, requires less memory).`,
|
|
20
|
+
'picks_all': `picks : str | array-like | slice | None
|
|
21
|
+
Channels to include. Slices and lists of integers will be interpreted as
|
|
22
|
+
channel indices. In lists, channel type strings (e.g., ['meg', 'eeg'])
|
|
23
|
+
will pick channels of those types, channel name strings will pick the
|
|
24
|
+
given channels. Can also be the string values "all" to pick all channels,
|
|
25
|
+
or "data" to pick data channels. None (default) will pick all channels.`,
|
|
26
|
+
'picks_nostr': `picks : list | slice | None
|
|
27
|
+
Channels to include. Slices and lists of integers will be interpreted as
|
|
28
|
+
channel indices. None (default) will pick all channels.`,
|
|
29
|
+
'n_jobs': `n_jobs : int | None
|
|
30
|
+
The number of jobs to run in parallel. If -1, it is set
|
|
31
|
+
to the number of CPU cores. Requires the joblib package.
|
|
32
|
+
None (default) is a marker for 'unset' that will be interpreted
|
|
33
|
+
as n_jobs=1 (sequential execution) unless the call is performed under
|
|
34
|
+
a joblib.parallel_config context manager that sets another value for
|
|
35
|
+
n_jobs.`,
|
|
36
|
+
'n_jobs_fir': `n_jobs : int | str
|
|
37
|
+
Number of jobs to run in parallel. Can be 'cuda' if cupy
|
|
38
|
+
is installed properly and method='fir'.`,
|
|
39
|
+
'random_state': `random_state : None | int | instance of RandomState
|
|
40
|
+
A seed for the NumPy random number generator (RNG). If None (default),
|
|
41
|
+
the global numpy.random.default_rng() is used.
|
|
42
|
+
If int, random_state is used to seed a new RNG.
|
|
43
|
+
If already a RandomState instance, the given instance is used.`,
|
|
44
|
+
'info_not_none': `info : mne.Info
|
|
45
|
+
The mne.Info object with information about the sensors and methods of measurement.`,
|
|
46
|
+
'baseline_epochs': `baseline : None | tuple of length 2
|
|
47
|
+
The time interval to consider as "baseline" when applying baseline
|
|
48
|
+
correction. If None, do not apply baseline correction.
|
|
49
|
+
If a tuple (a, b), the interval is between a and b (in seconds),
|
|
50
|
+
including the endpoints.
|
|
51
|
+
If a is None, the beginning of the data is used; and if b is None,
|
|
52
|
+
it is set to the end of the data.`,
|
|
53
|
+
'tmin': `tmin : float | None
|
|
54
|
+
Start time of selection in seconds.`,
|
|
55
|
+
'tmax': `tmax : float | None
|
|
56
|
+
End time of selection in seconds.`,
|
|
57
|
+
'reject_epochs': `reject : dict | None
|
|
58
|
+
Reject epochs based on maximum peak-to-peak signal amplitude (PTP),
|
|
59
|
+
i.e. the absolute difference between the lowest and the highest
|
|
60
|
+
signal value. In each individual epoch, the PTP is calculated for
|
|
61
|
+
every channel. If the PTP of any one channel exceeds the rejection
|
|
62
|
+
threshold, the respective epoch will be dropped.
|
|
63
|
+
|
|
64
|
+
The dictionary keys correspond to the different channel types;
|
|
65
|
+
valid keys can be any channel type present in the object.
|
|
66
|
+
|
|
67
|
+
Example::
|
|
68
|
+
|
|
69
|
+
reject = dict(grad=4000e-13, # T / m (gradiometers)
|
|
70
|
+
mag=4e-12, # T (magnetometers)
|
|
71
|
+
eeg=40e-6, # V (EEG channels)
|
|
72
|
+
eog=250e-6) # V (EOG channels)`,
|
|
73
|
+
'flat': `flat : dict | None
|
|
74
|
+
Reject epochs based on minimum peak-to-peak signal amplitude (PTP).
|
|
75
|
+
Valid keys can be any channel type present in the object. The values
|
|
76
|
+
are floats that set the minimum acceptable PTP. If the PTP is smaller
|
|
77
|
+
than this threshold, the epoch will be dropped. If None then no
|
|
78
|
+
rejection is performed based on flatness of the signal.`,
|
|
79
|
+
'proj_epochs': `proj : bool | 'delayed'
|
|
80
|
+
Apply SSP projection vectors. If proj is 'delayed' and reject is not
|
|
81
|
+
None the single epochs will be projected before the rejection
|
|
82
|
+
decision, but used in unprojected state if they are kept.
|
|
83
|
+
This way deciding which projection vectors are good can be postponed
|
|
84
|
+
to the average stage without resulting in lower epoch counts and
|
|
85
|
+
without producing results different from early SSP application
|
|
86
|
+
given comparable samples. Note that in this case baselining, detrending
|
|
87
|
+
and temporal decimation will be postponed.
|
|
88
|
+
If proj is False no projections will be applied which is the
|
|
89
|
+
recommended value if SSPs are not used for cleaning the data.`,
|
|
90
|
+
'decim': `decim : int
|
|
91
|
+
Factor by which to subsample the data.
|
|
92
|
+
|
|
93
|
+
.. warning:: Low-pass filtering is not performed, this simply selects
|
|
94
|
+
every Nth sample (where N is the value passed to decim),
|
|
95
|
+
i.e., it compresses the signal (see Notes).
|
|
96
|
+
If the data are not properly filtered, aliasing artifacts
|
|
97
|
+
may occur.`,
|
|
98
|
+
'method_fir': `method : str
|
|
99
|
+
'fir' will use overlap-add FIR filtering, 'iir' will use IIR
|
|
100
|
+
forward-backward filtering (via filtfilt).`,
|
|
101
|
+
'phase': `phase : str
|
|
102
|
+
Phase of the filter.
|
|
103
|
+
Symmetric linear-phase FIR filters are constructed, and if phase='zero'
|
|
104
|
+
(default), the delay of this filter is compensated for, making it
|
|
105
|
+
non-causal. If phase='zero-double', then this filter is applied
|
|
106
|
+
twice, once forward, and once backward (also making it non-causal).
|
|
107
|
+
If 'minimum', then a minimum-phase filter will be constructed and applied,
|
|
108
|
+
which is causal but has weaker stop-band suppression.`,
|
|
109
|
+
'l_freq': `l_freq : float | None
|
|
110
|
+
For FIR filters, the lower pass-band edge; for IIR filters, the lower
|
|
111
|
+
cutoff frequency. If None the data are only low-pass filtered.`,
|
|
112
|
+
'h_freq': `h_freq : float | None
|
|
113
|
+
For FIR filters, the upper pass-band edge; for IIR filters, the upper
|
|
114
|
+
cutoff frequency. If None the data are only high-pass filtered.`,
|
|
115
|
+
'filter_length': `filter_length : str | int
|
|
116
|
+
Length of the FIR filter to use (if applicable):
|
|
117
|
+
|
|
118
|
+
* 'auto' (default): The filter length is chosen based on the size
|
|
119
|
+
of the transition regions.
|
|
120
|
+
* str: A human-readable time in units of "s" or "ms".
|
|
121
|
+
* int: The specified number of samples.`,
|
|
122
|
+
'iir_params': `iir_params : dict | None
|
|
123
|
+
Dictionary of parameters to use for IIR filtering.
|
|
124
|
+
If iir_params is None and method="iir", 4th order Butterworth will be used.`,
|
|
125
|
+
'fir_window': `fir_window : str
|
|
126
|
+
The window to use in FIR design, can be "hamming" (default),
|
|
127
|
+
"hann", or "blackman".`,
|
|
128
|
+
'fir_design': `fir_design : str
|
|
129
|
+
Can be "firwin" (default) to use scipy.signal.firwin,
|
|
130
|
+
or "firwin2" to use scipy.signal.firwin2.`,
|
|
131
|
+
// Time-frequency related
|
|
132
|
+
'freqs_tfr_array': `freqs : array-like
|
|
133
|
+
The frequencies of interest in Hz.`,
|
|
134
|
+
'n_cycles_tfr': `n_cycles : int | array-like
|
|
135
|
+
Number of cycles in the wavelet, either a fixed number or one per frequency.
|
|
136
|
+
The number of cycles defines the time-frequency trade-off.`,
|
|
137
|
+
'decim_tfr': `decim : int | slice
|
|
138
|
+
To reduce memory usage, decimation factor during time-frequency decomposition.
|
|
139
|
+
Default is 1 (no decimation). If int, uses every Nth sample after convolution.
|
|
140
|
+
If slice, decimates using slice(start, stop, step).`,
|
|
141
|
+
'average_tfr': `average : bool
|
|
142
|
+
If True (default), return an AverageTFR instance. If False, return an EpochsTFR.`,
|
|
143
|
+
'morlet_reference': `The Morlet wavelet is a sinusoid windowed by a Gaussian.`,
|
|
144
|
+
'temporal_window_tfr_intro': `Time-frequency analysis uses wavelets to decompose the signal.`,
|
|
145
|
+
'temporal_window_tfr_morlet_notes': `The wavelet duration depends on the frequency and number of cycles.`,
|
|
146
|
+
// Info and data related
|
|
147
|
+
'info': `info : mne.Info
|
|
148
|
+
The mne.Info object with information about the sensors and methods of measurement.`,
|
|
149
|
+
'subjects_dir': `subjects_dir : path-like | None
|
|
150
|
+
The path to the directory containing the FreeSurfer subjects reconstructions.
|
|
151
|
+
If None, defaults to the SUBJECTS_DIR environment variable.`,
|
|
152
|
+
'subject': `subject : str
|
|
153
|
+
The FreeSurfer subject name.`,
|
|
154
|
+
'seed': `seed : None | int | instance of RandomState
|
|
155
|
+
A seed for the NumPy random number generator (RNG).`,
|
|
156
|
+
// Rank related
|
|
157
|
+
'rank_none': `rank : None | 'info' | 'full' | dict
|
|
158
|
+
This controls the rank computation that can be read from the measurement info
|
|
159
|
+
or estimated from the data. See Notes for details.`,
|
|
160
|
+
'rank_info': `rank : None | 'info' | 'full' | dict
|
|
161
|
+
This controls the rank computation. See Notes for details.`,
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Expand %(placeholder)s patterns in a docstring using common expansions.
|
|
165
|
+
*/
|
|
166
|
+
export function expandDocstring(docstring) {
|
|
167
|
+
if (!docstring)
|
|
168
|
+
return docstring;
|
|
169
|
+
// Find all %(name)s patterns
|
|
170
|
+
const placeholderPattern = /%\(([^)]+)\)s/g;
|
|
171
|
+
let expanded = docstring;
|
|
172
|
+
let match;
|
|
173
|
+
while ((match = placeholderPattern.exec(docstring)) !== null) {
|
|
174
|
+
const placeholder = match[0];
|
|
175
|
+
const paramName = match[1];
|
|
176
|
+
// Try to find expansion
|
|
177
|
+
const expansion = COMMON_EXPANSIONS[paramName];
|
|
178
|
+
if (expansion) {
|
|
179
|
+
expanded = expanded.replace(placeholder, expansion);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// Mark unexpanded placeholders for visibility
|
|
183
|
+
expanded = expanded.replace(placeholder, `[${paramName}: see MNE docs]`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return expanded;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Check if a docstring has unexpanded placeholders.
|
|
190
|
+
*/
|
|
191
|
+
export function hasPlaceholders(docstring) {
|
|
192
|
+
if (!docstring)
|
|
193
|
+
return false;
|
|
194
|
+
return /%\([^)]+\)s/.test(docstring);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get list of placeholder names in a docstring.
|
|
198
|
+
*/
|
|
199
|
+
export function getPlaceholders(docstring) {
|
|
200
|
+
if (!docstring)
|
|
201
|
+
return [];
|
|
202
|
+
const placeholders = [];
|
|
203
|
+
const pattern = /%\(([^)]+)\)s/g;
|
|
204
|
+
let match;
|
|
205
|
+
while ((match = pattern.exec(docstring)) !== null) {
|
|
206
|
+
if (!placeholders.includes(match[1])) {
|
|
207
|
+
placeholders.push(match[1]);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return placeholders;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Extract "See Also" references from a numpy-style docstring.
|
|
214
|
+
* Returns an array of symbol names mentioned in the See Also section.
|
|
215
|
+
*/
|
|
216
|
+
export function extractSeeAlso(docstring) {
|
|
217
|
+
if (!docstring)
|
|
218
|
+
return [];
|
|
219
|
+
const seeAlso = [];
|
|
220
|
+
const lines = docstring.split('\n');
|
|
221
|
+
let inSeeAlso = false;
|
|
222
|
+
for (const line of lines) {
|
|
223
|
+
const trimmed = line.trim();
|
|
224
|
+
// Check for See Also section header
|
|
225
|
+
if (trimmed === 'See Also' || trimmed === 'See also') {
|
|
226
|
+
inSeeAlso = true;
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
// Skip separator line
|
|
230
|
+
if (inSeeAlso && trimmed.startsWith('---')) {
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
// Check for end of See Also section (next section header)
|
|
234
|
+
if (inSeeAlso && /^[A-Z][a-z]+$/.test(trimmed) && !trimmed.includes('.')) {
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
if (inSeeAlso && trimmed) {
|
|
238
|
+
// Extract symbol names (typically in format: mne.symbol or just symbol)
|
|
239
|
+
// They can be followed by a colon and description
|
|
240
|
+
const match = trimmed.match(/^([a-zA-Z_][a-zA-Z0-9_.]*)/);
|
|
241
|
+
if (match) {
|
|
242
|
+
seeAlso.push(match[1]);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return seeAlso;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Format See Also references with links to MNE documentation.
|
|
250
|
+
*/
|
|
251
|
+
export function formatSeeAlsoWithLinks(seeAlso, version) {
|
|
252
|
+
if (seeAlso.length === 0)
|
|
253
|
+
return '';
|
|
254
|
+
const docsVersion = version === 'latest' ? 'stable' : version;
|
|
255
|
+
return seeAlso.map(symbol => {
|
|
256
|
+
// Construct docs URL
|
|
257
|
+
const docsUrl = `https://mne.tools/${docsVersion}/generated/${symbol}.html`;
|
|
258
|
+
return `- ${symbol}: ${docsUrl}`;
|
|
259
|
+
}).join('\n');
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=docstring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docstring.js","sourceRoot":"","sources":["../../src/utils/docstring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,iBAAiB,GAA2B;IAC9C,SAAS,EAAE;;;0DAG2C;IAEtD,SAAS,EAAE;;;;;sDAKuC;IAElD,WAAW,EAAE;;;;;4EAK2D;IAExE,aAAa,EAAE;;4DAEyC;IAExD,QAAQ,EAAE;;;;;;YAMF;IAER,YAAY,EAAE;;4CAE0B;IAExC,cAAc,EAAE;;;;mEAI+C;IAE/D,eAAe,EAAE;uFACkE;IAEnF,iBAAiB,EAAE;;;;;;sCAMe;IAElC,MAAM,EAAE;wCAC4B;IAEpC,MAAM,EAAE;sCAC0B;IAElC,eAAe,EAAE;;;;;;;;;;;;;;;yDAeoC;IAErD,MAAM,EAAE;;;;;4DAKgD;IAExD,aAAa,EAAE;;;;;;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CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Config } from '../config.js';
|
|
2
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
3
|
+
declare class Logger {
|
|
4
|
+
private level;
|
|
5
|
+
private json;
|
|
6
|
+
private useStderr;
|
|
7
|
+
constructor(level?: LogLevel, json?: boolean, useStderr?: boolean);
|
|
8
|
+
private shouldLog;
|
|
9
|
+
private format;
|
|
10
|
+
private log;
|
|
11
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
12
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
13
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
14
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function initLogger(config: Config): void;
|
|
17
|
+
export declare function getLogger(): Logger;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpD,cAAM,MAAM;IACR,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,SAAS,CAAU;gBAEf,KAAK,GAAE,QAAiB,EAAE,IAAI,GAAE,OAAe,EAAE,SAAS,GAAE,OAAe;IAMvF,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,GAAG;IAwBX,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIrD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIpD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIpD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGxD;AAID,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,QAIxC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAMlC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
class Logger {
|
|
2
|
+
level;
|
|
3
|
+
json;
|
|
4
|
+
useStderr;
|
|
5
|
+
constructor(level = 'info', json = false, useStderr = false) {
|
|
6
|
+
this.level = level;
|
|
7
|
+
this.json = json;
|
|
8
|
+
this.useStderr = useStderr;
|
|
9
|
+
}
|
|
10
|
+
shouldLog(level) {
|
|
11
|
+
const levels = ['debug', 'info', 'warn', 'error'];
|
|
12
|
+
return levels.indexOf(level) >= levels.indexOf(this.level);
|
|
13
|
+
}
|
|
14
|
+
format(level, message, meta) {
|
|
15
|
+
const timestamp = new Date().toISOString();
|
|
16
|
+
if (this.json) {
|
|
17
|
+
return JSON.stringify({ timestamp, level, message, ...meta });
|
|
18
|
+
}
|
|
19
|
+
const metaStr = meta ? ` ${JSON.stringify(meta)}` : '';
|
|
20
|
+
return `[${timestamp}] [${level.toUpperCase()}] ${message}${metaStr}`;
|
|
21
|
+
}
|
|
22
|
+
log(level, message, meta) {
|
|
23
|
+
if (!this.shouldLog(level))
|
|
24
|
+
return;
|
|
25
|
+
const formatted = this.format(level, message, meta);
|
|
26
|
+
// In stdio mode, always use stderr to avoid corrupting the MCP protocol
|
|
27
|
+
if (this.useStderr) {
|
|
28
|
+
process.stderr.write(formatted + '\n');
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
switch (level) {
|
|
32
|
+
case 'debug':
|
|
33
|
+
console.debug(formatted);
|
|
34
|
+
break;
|
|
35
|
+
case 'info':
|
|
36
|
+
console.info(formatted);
|
|
37
|
+
break;
|
|
38
|
+
case 'warn':
|
|
39
|
+
console.warn(formatted);
|
|
40
|
+
break;
|
|
41
|
+
case 'error':
|
|
42
|
+
console.error(formatted);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
debug(message, meta) {
|
|
48
|
+
this.log('debug', message, meta);
|
|
49
|
+
}
|
|
50
|
+
info(message, meta) {
|
|
51
|
+
this.log('info', message, meta);
|
|
52
|
+
}
|
|
53
|
+
warn(message, meta) {
|
|
54
|
+
this.log('warn', message, meta);
|
|
55
|
+
}
|
|
56
|
+
error(message, meta) {
|
|
57
|
+
this.log('error', message, meta);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
let loggerInstance = null;
|
|
61
|
+
export function initLogger(config) {
|
|
62
|
+
// Use stderr for logging when in stdio transport mode to avoid corrupting MCP protocol
|
|
63
|
+
const useStderr = config.transport === 'stdio';
|
|
64
|
+
loggerInstance = new Logger(config.logLevel, config.logJson, useStderr);
|
|
65
|
+
}
|
|
66
|
+
export function getLogger() {
|
|
67
|
+
if (!loggerInstance) {
|
|
68
|
+
// Fallback if not initialized
|
|
69
|
+
loggerInstance = new Logger();
|
|
70
|
+
}
|
|
71
|
+
return loggerInstance;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM;IACA,KAAK,CAAW;IAChB,IAAI,CAAU;IACd,SAAS,CAAU;IAE3B,YAAY,QAAkB,MAAM,EAAE,OAAgB,KAAK,EAAE,YAAqB,KAAK;QACnF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,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
+
interface MetricsData {
|
|
2
|
+
toolCalls: Record<string, number>;
|
|
3
|
+
cache: {
|
|
4
|
+
hits: number;
|
|
5
|
+
misses: number;
|
|
6
|
+
hitRate: number;
|
|
7
|
+
entries: number;
|
|
8
|
+
};
|
|
9
|
+
github: {
|
|
10
|
+
requestsTotal: number;
|
|
11
|
+
rateLimitRemaining: number;
|
|
12
|
+
};
|
|
13
|
+
parser: {
|
|
14
|
+
invocations: number;
|
|
15
|
+
averageLatencyMs: number;
|
|
16
|
+
};
|
|
17
|
+
uptimeSeconds: number;
|
|
18
|
+
}
|
|
19
|
+
declare class Metrics {
|
|
20
|
+
private startTime;
|
|
21
|
+
private toolCalls;
|
|
22
|
+
private cacheHits;
|
|
23
|
+
private cacheMisses;
|
|
24
|
+
private githubRequests;
|
|
25
|
+
private githubRateLimitRemaining;
|
|
26
|
+
private parserInvocations;
|
|
27
|
+
private parserTotalLatency;
|
|
28
|
+
constructor();
|
|
29
|
+
recordToolCall(toolName: string): void;
|
|
30
|
+
recordCacheHit(): void;
|
|
31
|
+
recordCacheMiss(): void;
|
|
32
|
+
recordGithubRequest(remaining?: number): void;
|
|
33
|
+
recordParserInvocation(latencyMs: number): void;
|
|
34
|
+
getMetrics(): MetricsData;
|
|
35
|
+
}
|
|
36
|
+
export declare const metrics: Metrics;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAAA,UAAU,WAAW;IACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,MAAM,EAAE;QACJ,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;KAC9B,CAAC;IACF,MAAM,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,cAAM,OAAO;IACT,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,wBAAwB,CAAK;IACrC,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,kBAAkB,CAAK;;IAM/B,cAAc,CAAC,QAAQ,EAAE,MAAM;IAI/B,cAAc;IAId,eAAe;IAIf,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM;IAOtC,sBAAsB,CAAC,SAAS,EAAE,MAAM;IAKxC,UAAU,IAAI,WAAW;CAwB5B;AAED,eAAO,MAAM,OAAO,SAAgB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
class Metrics {
|
|
2
|
+
startTime;
|
|
3
|
+
toolCalls = {};
|
|
4
|
+
cacheHits = 0;
|
|
5
|
+
cacheMisses = 0;
|
|
6
|
+
githubRequests = 0;
|
|
7
|
+
githubRateLimitRemaining = 0;
|
|
8
|
+
parserInvocations = 0;
|
|
9
|
+
parserTotalLatency = 0;
|
|
10
|
+
constructor() {
|
|
11
|
+
this.startTime = Date.now();
|
|
12
|
+
}
|
|
13
|
+
recordToolCall(toolName) {
|
|
14
|
+
this.toolCalls[toolName] = (this.toolCalls[toolName] || 0) + 1;
|
|
15
|
+
}
|
|
16
|
+
recordCacheHit() {
|
|
17
|
+
this.cacheHits++;
|
|
18
|
+
}
|
|
19
|
+
recordCacheMiss() {
|
|
20
|
+
this.cacheMisses++;
|
|
21
|
+
}
|
|
22
|
+
recordGithubRequest(remaining) {
|
|
23
|
+
this.githubRequests++;
|
|
24
|
+
if (remaining !== undefined) {
|
|
25
|
+
this.githubRateLimitRemaining = remaining;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
recordParserInvocation(latencyMs) {
|
|
29
|
+
this.parserInvocations++;
|
|
30
|
+
this.parserTotalLatency += latencyMs;
|
|
31
|
+
}
|
|
32
|
+
getMetrics() {
|
|
33
|
+
const totalCacheOps = this.cacheHits + this.cacheMisses;
|
|
34
|
+
const hitRate = totalCacheOps > 0 ? this.cacheHits / totalCacheOps : 0;
|
|
35
|
+
const avgParserLatency = this.parserInvocations > 0 ? this.parserTotalLatency / this.parserInvocations : 0;
|
|
36
|
+
return {
|
|
37
|
+
toolCalls: { ...this.toolCalls },
|
|
38
|
+
cache: {
|
|
39
|
+
hits: this.cacheHits,
|
|
40
|
+
misses: this.cacheMisses,
|
|
41
|
+
hitRate,
|
|
42
|
+
entries: 0 // To be filled by cache manager
|
|
43
|
+
},
|
|
44
|
+
github: {
|
|
45
|
+
requestsTotal: this.githubRequests,
|
|
46
|
+
rateLimitRemaining: this.githubRateLimitRemaining
|
|
47
|
+
},
|
|
48
|
+
parser: {
|
|
49
|
+
invocations: this.parserInvocations,
|
|
50
|
+
averageLatencyMs: avgParserLatency
|
|
51
|
+
},
|
|
52
|
+
uptimeSeconds: (Date.now() - this.startTime) / 1000
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export const metrics = new Metrics();
|
|
57
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAmBA,MAAM,OAAO;IACD,SAAS,CAAS;IAClB,SAAS,GAA2B,EAAE,CAAC;IACvC,SAAS,GAAG,CAAC,CAAC;IACd,WAAW,GAAG,CAAC,CAAC;IAChB,cAAc,GAAG,CAAC,CAAC;IACnB,wBAAwB,GAA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IAAI,CAAC,WAAW;gBACxB,OAAO;gBACP,OAAO,EAAE,CAAC,CAAC,gCAAgC;aAC9C;YACD,MAAM,EAAE;gBACJ,aAAa,EAAE,IAAI,CAAC,cAAc;gBAClC,kBAAkB,EAAE,IAAI,CAAC,wBAAwB;aACpD;YACD,MAAM,EAAE;gBACJ,WAAW,EAAE,IAAI,CAAC,iBAAiB;gBACnC,gBAAgB,EAAE,gBAAgB;aACrC;YACD,aAAa,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI;SACtD,CAAC;IACN,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAMA,wBAAgB,UAAU,IAAI,MAAM,CAWnC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { dirname, resolve } from 'path';
|
|
4
|
+
let version = '';
|
|
5
|
+
export function getVersion() {
|
|
6
|
+
if (!version) {
|
|
7
|
+
try {
|
|
8
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const pkg = JSON.parse(readFileSync(resolve(dir, '../package.json'), 'utf-8'));
|
|
10
|
+
version = pkg.version || '2.0.0';
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
version = '2.0.0';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return version;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAExC,IAAI,OAAO,GAAG,EAAE,CAAC;AAEjB,MAAM,UAAU,UAAU;IACtB,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,IAAI,CAAC;YACD,MAAM,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;YAC/E,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,GAAG,OAAO,CAAC;QACtB,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mne-docs-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"mcpName": "io.github.weiyongxu/mne-docs",
|
|
5
|
+
"description": "MCP server providing access to MNE-Python documentation, source code, GitHub issues, and community forum",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mne-docs-mcp": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"python/*.py",
|
|
14
|
+
"python/requirements.txt",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"start": "node dist/index.js",
|
|
21
|
+
"dev": "tsx watch src/index.ts",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"test:coverage": "vitest run --coverage",
|
|
25
|
+
"lint": "eslint src/",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"mcp",
|
|
31
|
+
"model-context-protocol",
|
|
32
|
+
"mne",
|
|
33
|
+
"mne-python",
|
|
34
|
+
"neuroscience",
|
|
35
|
+
"eeg",
|
|
36
|
+
"meg",
|
|
37
|
+
"documentation",
|
|
38
|
+
"ai-assistant",
|
|
39
|
+
"claude",
|
|
40
|
+
"llm"
|
|
41
|
+
],
|
|
42
|
+
"author": "weiyongxu",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/weiyongxu/mne-docs-mcp.git"
|
|
47
|
+
},
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/weiyongxu/mne-docs-mcp/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/weiyongxu/mne-docs-mcp#readme",
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
54
|
+
"express": "^4.18.2",
|
|
55
|
+
"zod": "^3.22.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/express": "^4.17.21",
|
|
59
|
+
"@types/node": "^20.10.0",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
61
|
+
"@typescript-eslint/parser": "^8.48.0",
|
|
62
|
+
"@vitest/coverage-v8": "^4.0.14",
|
|
63
|
+
"eslint": "^8.55.0",
|
|
64
|
+
"tsx": "^4.6.0",
|
|
65
|
+
"typescript": "^5.3.0",
|
|
66
|
+
"vitest": "^4.0.14"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=20.0.0"
|
|
70
|
+
}
|
|
71
|
+
}
|