recker 1.0.15-next.dac946a → 1.0.15-next.eb07368
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/dist/bench/generator.d.ts.map +1 -1
- package/dist/bench/generator.js +2 -1
- package/dist/bench/stats.d.ts +15 -1
- package/dist/bench/stats.d.ts.map +1 -1
- package/dist/bench/stats.js +84 -5
- package/dist/cli/index.js +100 -0
- package/dist/cli/tui/load-dashboard.d.ts.map +1 -1
- package/dist/cli/tui/load-dashboard.js +62 -8
- package/dist/cli/tui/scroll-buffer.d.ts +43 -0
- package/dist/cli/tui/scroll-buffer.d.ts.map +1 -0
- package/dist/cli/tui/scroll-buffer.js +162 -0
- package/dist/cli/tui/search-panel.d.ts +41 -0
- package/dist/cli/tui/search-panel.d.ts.map +1 -0
- package/dist/cli/tui/search-panel.js +419 -0
- package/dist/cli/tui/shell.d.ts +11 -0
- package/dist/cli/tui/shell.d.ts.map +1 -1
- package/dist/cli/tui/shell.js +262 -46
- package/dist/contract/index.js +3 -2
- package/dist/dns/index.d.ts +1 -0
- package/dist/dns/index.d.ts.map +1 -1
- package/dist/dns/index.js +1 -0
- package/dist/dns/propagation.d.ts +19 -0
- package/dist/dns/propagation.d.ts.map +1 -0
- package/dist/dns/propagation.js +129 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +8 -1
- package/dist/transport/undici.d.ts.map +1 -1
- package/dist/transport/undici.js +72 -52
- package/dist/utils/colors.d.ts +16 -0
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/colors.js +16 -0
- package/dist/utils/ip-intel.d.ts +15 -0
- package/dist/utils/ip-intel.d.ts.map +1 -0
- package/dist/utils/ip-intel.js +30 -0
- package/dist/utils/security-grader.d.ts +14 -0
- package/dist/utils/security-grader.d.ts.map +1 -0
- package/dist/utils/security-grader.js +132 -0
- package/dist/utils/tls-inspector.d.ts +6 -0
- package/dist/utils/tls-inspector.d.ts.map +1 -1
- package/dist/utils/tls-inspector.js +35 -1
- package/package.json +1 -1
package/dist/cli/tui/shell.js
CHANGED
|
@@ -12,6 +12,8 @@ import { rdap } from '../../utils/rdap.js';
|
|
|
12
12
|
import { ScrapeDocument } from '../../scrape/document.js';
|
|
13
13
|
import colors from '../../utils/colors.js';
|
|
14
14
|
import { getShellSearch } from './shell-search.js';
|
|
15
|
+
import { openSearchPanel } from './search-panel.js';
|
|
16
|
+
import { ScrollBuffer, parseScrollKey, parseMouseScroll, enableMouseReporting, disableMouseReporting } from './scroll-buffer.js';
|
|
15
17
|
let highlight;
|
|
16
18
|
async function initDependencies() {
|
|
17
19
|
if (!highlight) {
|
|
@@ -36,11 +38,16 @@ export class RekShell {
|
|
|
36
38
|
initialized = false;
|
|
37
39
|
currentDoc = null;
|
|
38
40
|
currentDocUrl = '';
|
|
41
|
+
scrollBuffer;
|
|
42
|
+
originalStdoutWrite = null;
|
|
43
|
+
inScrollMode = false;
|
|
39
44
|
constructor() {
|
|
40
45
|
this.client = createClient({
|
|
41
46
|
baseUrl: 'http://localhost',
|
|
42
|
-
checkHooks: false
|
|
47
|
+
checkHooks: false,
|
|
48
|
+
http2: true
|
|
43
49
|
});
|
|
50
|
+
this.scrollBuffer = new ScrollBuffer({ maxLines: 10000 });
|
|
44
51
|
}
|
|
45
52
|
async ensureInitialized() {
|
|
46
53
|
if (this.initialized)
|
|
@@ -85,7 +92,7 @@ export class RekShell {
|
|
|
85
92
|
const commands = [
|
|
86
93
|
'get', 'post', 'put', 'delete', 'patch', 'head', 'options',
|
|
87
94
|
'ws', 'udp', 'load', 'chat', 'ai',
|
|
88
|
-
'whois', 'tls', 'ssl', 'dns', 'rdap', 'ping',
|
|
95
|
+
'whois', 'tls', 'ssl', 'dns', 'dns:propagate', 'rdap', 'ping',
|
|
89
96
|
'scrap', '$', '$text', '$attr', '$html', '$links', '$images', '$scripts', '$css', '$sourcemaps', '$unmap', '$unmap:view', '$unmap:save', '$beautify', '$beautify:save', '$table',
|
|
90
97
|
'?', 'search', 'suggest', 'example',
|
|
91
98
|
'help', 'clear', 'exit', 'set', 'url', 'vars', 'env'
|
|
@@ -95,9 +102,11 @@ export class RekShell {
|
|
|
95
102
|
}
|
|
96
103
|
async start() {
|
|
97
104
|
await this.ensureInitialized();
|
|
105
|
+
this.setupScrollCapture();
|
|
98
106
|
console.clear();
|
|
99
107
|
console.log(colors.bold(colors.cyan('Rek Console')));
|
|
100
108
|
console.log(colors.gray('Chat with your APIs. Type "help" for magic.'));
|
|
109
|
+
console.log(colors.gray('Page Up/Down or mouse scroll to view history.'));
|
|
101
110
|
console.log(colors.gray('--------------------------------------------\n'));
|
|
102
111
|
this.prompt();
|
|
103
112
|
this.rl.on('line', async (line) => {
|
|
@@ -112,15 +121,185 @@ export class RekShell {
|
|
|
112
121
|
this.rl.close();
|
|
113
122
|
});
|
|
114
123
|
this.rl.on('close', () => {
|
|
124
|
+
this.cleanupScrollCapture();
|
|
115
125
|
console.log(colors.gray('\nSee ya.'));
|
|
116
126
|
process.exit(0);
|
|
117
127
|
});
|
|
128
|
+
process.stdout.on('resize', () => {
|
|
129
|
+
this.scrollBuffer.updateViewport();
|
|
130
|
+
});
|
|
131
|
+
this.setupScrollKeyHandler();
|
|
132
|
+
}
|
|
133
|
+
setupScrollCapture() {
|
|
134
|
+
this.originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
135
|
+
const self = this;
|
|
136
|
+
process.stdout.write = function (chunk, encodingOrCallback, callback) {
|
|
137
|
+
const content = typeof chunk === 'string' ? chunk : chunk.toString();
|
|
138
|
+
self.scrollBuffer.write(content);
|
|
139
|
+
if (!self.inScrollMode && self.originalStdoutWrite) {
|
|
140
|
+
return self.originalStdoutWrite(chunk, encodingOrCallback, callback);
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
cleanupScrollCapture() {
|
|
146
|
+
if (this.originalStdoutWrite) {
|
|
147
|
+
process.stdout.write = this.originalStdoutWrite;
|
|
148
|
+
this.originalStdoutWrite = null;
|
|
149
|
+
}
|
|
150
|
+
disableMouseReporting();
|
|
151
|
+
}
|
|
152
|
+
setupScrollKeyHandler() {
|
|
153
|
+
enableMouseReporting();
|
|
154
|
+
if (process.stdin.isTTY) {
|
|
155
|
+
const originalEmit = process.stdin.emit.bind(process.stdin);
|
|
156
|
+
const self = this;
|
|
157
|
+
process.stdin.emit = function (event, ...args) {
|
|
158
|
+
if (event === 'data') {
|
|
159
|
+
const data = args[0];
|
|
160
|
+
const str = data.toString();
|
|
161
|
+
if (str.includes('\x1b[<')) {
|
|
162
|
+
const mouseScroll = parseMouseScroll(data);
|
|
163
|
+
if (mouseScroll) {
|
|
164
|
+
self.handleScrollKey(mouseScroll);
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
if (data.length >= 6 && data[0] === 0x1b && data[1] === 0x5b && data[2] === 0x4d) {
|
|
169
|
+
const mouseScroll = parseMouseScroll(data);
|
|
170
|
+
if (mouseScroll) {
|
|
171
|
+
self.handleScrollKey(mouseScroll);
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
const scrollKey = parseScrollKey(data);
|
|
176
|
+
if (scrollKey) {
|
|
177
|
+
if (scrollKey === 'quit') {
|
|
178
|
+
if (self.inScrollMode) {
|
|
179
|
+
self.exitScrollMode();
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return originalEmit(event, ...args);
|
|
183
|
+
}
|
|
184
|
+
self.handleScrollKey(scrollKey);
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
if (self.inScrollMode) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return originalEmit(event, ...args);
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
handleScrollKey(key) {
|
|
196
|
+
let needsRedraw = false;
|
|
197
|
+
switch (key) {
|
|
198
|
+
case 'pageUp':
|
|
199
|
+
if (!this.inScrollMode) {
|
|
200
|
+
this.enterScrollMode();
|
|
201
|
+
}
|
|
202
|
+
needsRedraw = this.scrollBuffer.pageUp();
|
|
203
|
+
break;
|
|
204
|
+
case 'pageDown':
|
|
205
|
+
needsRedraw = this.scrollBuffer.pageDown();
|
|
206
|
+
if (!this.scrollBuffer.isScrolledUp && this.inScrollMode) {
|
|
207
|
+
this.exitScrollMode();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
case 'scrollUp':
|
|
212
|
+
if (!this.inScrollMode) {
|
|
213
|
+
this.enterScrollMode();
|
|
214
|
+
}
|
|
215
|
+
needsRedraw = this.scrollBuffer.scrollUp(3);
|
|
216
|
+
break;
|
|
217
|
+
case 'scrollDown':
|
|
218
|
+
needsRedraw = this.scrollBuffer.scrollDown(3);
|
|
219
|
+
if (!this.scrollBuffer.isScrolledUp && this.inScrollMode) {
|
|
220
|
+
this.exitScrollMode();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
case 'home':
|
|
225
|
+
if (!this.inScrollMode) {
|
|
226
|
+
this.enterScrollMode();
|
|
227
|
+
}
|
|
228
|
+
this.scrollBuffer.scrollToTop();
|
|
229
|
+
needsRedraw = true;
|
|
230
|
+
break;
|
|
231
|
+
case 'end':
|
|
232
|
+
this.scrollBuffer.scrollToBottom();
|
|
233
|
+
if (this.inScrollMode) {
|
|
234
|
+
this.exitScrollMode();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
case 'quit':
|
|
239
|
+
if (this.inScrollMode) {
|
|
240
|
+
this.exitScrollMode();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
if (needsRedraw && this.inScrollMode) {
|
|
246
|
+
this.renderScrollView();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
enterScrollMode() {
|
|
250
|
+
if (this.inScrollMode)
|
|
251
|
+
return;
|
|
252
|
+
this.inScrollMode = true;
|
|
253
|
+
this.rl.pause();
|
|
254
|
+
if (this.originalStdoutWrite) {
|
|
255
|
+
this.originalStdoutWrite('\x1b[?25l');
|
|
256
|
+
}
|
|
257
|
+
this.renderScrollView();
|
|
258
|
+
}
|
|
259
|
+
exitScrollMode() {
|
|
260
|
+
if (!this.inScrollMode)
|
|
261
|
+
return;
|
|
262
|
+
this.inScrollMode = false;
|
|
263
|
+
if (this.originalStdoutWrite) {
|
|
264
|
+
this.originalStdoutWrite('\x1b[?25h');
|
|
265
|
+
this.originalStdoutWrite('\x1b[2J\x1b[H');
|
|
266
|
+
}
|
|
267
|
+
const recentLines = this.scrollBuffer.getVisibleLines();
|
|
268
|
+
if (this.originalStdoutWrite) {
|
|
269
|
+
this.originalStdoutWrite(recentLines.join('\n') + '\n');
|
|
270
|
+
}
|
|
271
|
+
this.rl.resume();
|
|
272
|
+
this.prompt();
|
|
273
|
+
}
|
|
274
|
+
renderScrollView() {
|
|
275
|
+
if (!this.originalStdoutWrite)
|
|
276
|
+
return;
|
|
277
|
+
const rows = process.stdout.rows || 24;
|
|
278
|
+
const cols = process.stdout.columns || 80;
|
|
279
|
+
const visibleLines = this.scrollBuffer.getVisibleLines();
|
|
280
|
+
const info = this.scrollBuffer.getScrollInfo();
|
|
281
|
+
this.originalStdoutWrite('\x1b[2J\x1b[H');
|
|
282
|
+
for (let i = 0; i < visibleLines.length && i < rows - 1; i++) {
|
|
283
|
+
const line = visibleLines[i] || '';
|
|
284
|
+
const truncated = line.length > cols ? line.slice(0, cols - 1) + '…' : line;
|
|
285
|
+
this.originalStdoutWrite(truncated + '\n');
|
|
286
|
+
}
|
|
287
|
+
const scrollInfo = this.scrollBuffer.isScrolledUp
|
|
288
|
+
? colors.yellow(`↑ ${this.scrollBuffer.position} lines | ${info.percent}% | `)
|
|
289
|
+
: '';
|
|
290
|
+
const helpText = colors.gray('Page Up/Down • Home/End • Q to exit');
|
|
291
|
+
const statusBar = `\x1b[${rows};1H\x1b[7m ${scrollInfo}${helpText} \x1b[0m`;
|
|
292
|
+
this.originalStdoutWrite(statusBar);
|
|
118
293
|
}
|
|
119
294
|
prompt() {
|
|
120
295
|
this.rl.setPrompt(this.getPrompt());
|
|
121
296
|
this.rl.prompt();
|
|
122
297
|
}
|
|
123
298
|
async handleCommand(input) {
|
|
299
|
+
if (input.endsWith('?') && !input.startsWith('?') && input.length > 1) {
|
|
300
|
+
await this.runSearch(input.slice(0, -1).trim());
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
124
303
|
if (input.includes('=') && !input.includes(' ') && !input.startsWith('http')) {
|
|
125
304
|
}
|
|
126
305
|
const parts = this.parseLine(input);
|
|
@@ -165,6 +344,9 @@ export class RekShell {
|
|
|
165
344
|
case 'dns':
|
|
166
345
|
await this.runDNS(parts[1]);
|
|
167
346
|
return;
|
|
347
|
+
case 'dns:propagate':
|
|
348
|
+
await this.runDNSPropagation(parts[1], parts[2]);
|
|
349
|
+
return;
|
|
168
350
|
case 'rdap':
|
|
169
351
|
await this.runRDAP(parts[1]);
|
|
170
352
|
return;
|
|
@@ -650,25 +832,56 @@ export class RekShell {
|
|
|
650
832
|
const duration = Math.round(performance.now() - startTime);
|
|
651
833
|
const statusIcon = info.valid ? colors.green('✔') : colors.red('✖');
|
|
652
834
|
const statusText = info.valid ? colors.green('Valid') : colors.red('Invalid/Expired');
|
|
653
|
-
console.log(`${statusIcon} Certificate ${statusText}` + colors.gray(` (${duration}ms)\n`));
|
|
654
|
-
console.log(colors.bold(' Certificate:'));
|
|
655
|
-
console.log(` ${colors.cyan('Subject')}: ${info.subject?.CN || info.subject?.O || 'N/A'}`);
|
|
656
|
-
console.log(` ${colors.cyan('Issuer')}: ${info.issuer?.CN || info.issuer?.O || 'N/A'}`);
|
|
657
|
-
console.log(` ${colors.cyan('Valid From')}: ${info.validFrom.toISOString()}`);
|
|
658
|
-
console.log(` ${colors.cyan('Valid To')}: ${info.validTo.toISOString()}`);
|
|
659
835
|
const daysColor = info.daysRemaining < 30 ? colors.red : info.daysRemaining < 90 ? colors.yellow : colors.green;
|
|
660
|
-
console.log(
|
|
661
|
-
console.log(colors.
|
|
662
|
-
console.log(
|
|
663
|
-
console.log(`
|
|
664
|
-
|
|
836
|
+
console.log(`\n${colors.bold(colors.cyan('🔒 TLS/SSL Report'))}`);
|
|
837
|
+
console.log(`${statusIcon} Certificate ${statusText}` + colors.gray(` (${duration}ms)\n`));
|
|
838
|
+
console.log(colors.bold('Certificate:'));
|
|
839
|
+
console.log(` ${colors.gray('Subject:')}`);
|
|
840
|
+
for (const key of Object.keys(info.subject || {})) {
|
|
841
|
+
console.log(` ${colors.gray(key.padEnd(10))}: ${info.subject[key]}`);
|
|
842
|
+
}
|
|
843
|
+
console.log(` ${colors.gray('Issuer:')}`);
|
|
844
|
+
for (const key of Object.keys(info.issuer || {})) {
|
|
845
|
+
console.log(` ${colors.gray(key.padEnd(10))}: ${info.issuer[key]}`);
|
|
846
|
+
}
|
|
847
|
+
console.log(` ${colors.gray('Expires:')} ${daysColor(info.daysRemaining + ' days')} (${info.validTo.toISOString().split('T')[0]})`);
|
|
848
|
+
console.log(` ${colors.gray('Valid From:')} ${info.validFrom.toISOString().split('T')[0]}`);
|
|
849
|
+
console.log(` ${colors.gray('Valid To:')} ${info.validTo.toISOString().split('T')[0]}`);
|
|
850
|
+
console.log(` ${colors.gray('Valid:')} ${info.valid ? colors.green('Yes') : colors.red('No')}`);
|
|
851
|
+
if (info.altNames && info.altNames.length > 0) {
|
|
852
|
+
console.log(colors.bold('\nSubject Alternative Names (SANs):'));
|
|
853
|
+
for (const name of info.altNames) {
|
|
854
|
+
console.log(` ${colors.cyan('→')} ${name}`);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
console.log(colors.bold('\nPublic Key:'));
|
|
858
|
+
if (info.pubkey) {
|
|
859
|
+
console.log(` ${colors.gray('Algorithm:')} ${info.pubkey.algo}`);
|
|
860
|
+
console.log(` ${colors.gray('Size:')} ${info.pubkey.size} bits`);
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
console.log(' Not available');
|
|
864
|
+
}
|
|
865
|
+
console.log(colors.bold('\nExtended Key Usage:'));
|
|
866
|
+
if (info.extKeyUsage && info.extKeyUsage.length > 0) {
|
|
867
|
+
for (const oid of info.extKeyUsage) {
|
|
868
|
+
console.log(` ${colors.cyan('→')} ${oid}`);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
console.log(' None');
|
|
873
|
+
}
|
|
874
|
+
console.log(colors.bold('\nConnection:'));
|
|
875
|
+
console.log(` ${colors.gray('Protocol:')} ${info.protocol || 'N/A'}`);
|
|
876
|
+
console.log(` ${colors.gray('Cipher:')} ${info.cipher?.name || 'N/A'}`);
|
|
877
|
+
console.log(` ${colors.gray('Auth:')} ${info.authorized ? colors.green('Trusted') : colors.red('Untrusted')}`);
|
|
665
878
|
if (info.authorizationError) {
|
|
666
|
-
console.log(`
|
|
879
|
+
console.log(` ${colors.gray('Auth Error:')} ${colors.red(String(info.authorizationError))}`);
|
|
667
880
|
}
|
|
668
|
-
console.log(colors.bold('\
|
|
669
|
-
console.log(`
|
|
670
|
-
console.log(`
|
|
671
|
-
console.log(`
|
|
881
|
+
console.log(colors.bold('\nFingerprints:'));
|
|
882
|
+
console.log(` ${colors.gray('SHA1:')} ${info.fingerprint}`);
|
|
883
|
+
console.log(` ${colors.gray('SHA256:')} ${info.fingerprint256}`);
|
|
884
|
+
console.log(` ${colors.gray('Serial:')} ${info.serialNumber}`);
|
|
672
885
|
this.lastResponse = info;
|
|
673
886
|
}
|
|
674
887
|
catch (error) {
|
|
@@ -736,6 +949,27 @@ export class RekShell {
|
|
|
736
949
|
}
|
|
737
950
|
console.log('');
|
|
738
951
|
}
|
|
952
|
+
async runDNSPropagation(domain, type = 'A') {
|
|
953
|
+
if (!domain) {
|
|
954
|
+
domain = this.getBaseDomain() || '';
|
|
955
|
+
if (!domain) {
|
|
956
|
+
console.log(colors.yellow('Usage: dns:propagate <domain> [type]'));
|
|
957
|
+
console.log(colors.gray(' Examples: dns:propagate google.com | dns:propagate github.com TXT'));
|
|
958
|
+
console.log(colors.gray(' Or set a base URL first: url https://example.com'));
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
console.log(colors.gray(`Checking DNS propagation for ${domain} (${type})...`));
|
|
963
|
+
try {
|
|
964
|
+
const { checkPropagation, formatPropagationReport } = await import('../../dns/propagation.js');
|
|
965
|
+
const results = await checkPropagation(domain, type);
|
|
966
|
+
console.log(formatPropagationReport(results, domain, type));
|
|
967
|
+
this.lastResponse = results;
|
|
968
|
+
}
|
|
969
|
+
catch (error) {
|
|
970
|
+
console.error(colors.red(`Propagation check failed: ${error.message}`));
|
|
971
|
+
}
|
|
972
|
+
}
|
|
739
973
|
async runRDAP(domain) {
|
|
740
974
|
if (!domain) {
|
|
741
975
|
domain = this.getRootDomain() || '';
|
|
@@ -1660,38 +1894,14 @@ export class RekShell {
|
|
|
1660
1894
|
console.log('');
|
|
1661
1895
|
}
|
|
1662
1896
|
async runSearch(query) {
|
|
1663
|
-
if (!query.trim()) {
|
|
1664
|
-
console.log(colors.yellow('Usage: ? <query> or search <query>'));
|
|
1665
|
-
console.log(colors.gray(' Examples:'));
|
|
1666
|
-
console.log(colors.gray(' ? retry exponential backoff'));
|
|
1667
|
-
console.log(colors.gray(' search cache configuration'));
|
|
1668
|
-
return;
|
|
1669
|
-
}
|
|
1670
|
-
console.log(colors.gray('Searching documentation...'));
|
|
1671
1897
|
try {
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
console.log(colors.yellow(`No results for: "${query}"`));
|
|
1676
|
-
console.log(colors.gray('Try different keywords like: retry, cache, streaming, websocket, pagination'));
|
|
1677
|
-
return;
|
|
1678
|
-
}
|
|
1679
|
-
console.log(colors.bold(colors.cyan(`\nFound ${results.length} results for "${query}":\n`)));
|
|
1680
|
-
for (let i = 0; i < results.length; i++) {
|
|
1681
|
-
const result = results[i];
|
|
1682
|
-
const score = Math.round(result.score * 100);
|
|
1683
|
-
console.log(` ${colors.green(`${i + 1}.`)} ${colors.bold(result.title)} ${colors.gray(`(${score}%)`)}`);
|
|
1684
|
-
console.log(` ${colors.gray(result.path)}`);
|
|
1685
|
-
if (result.snippet) {
|
|
1686
|
-
const snippet = result.snippet.slice(0, 120).replace(/\n/g, ' ');
|
|
1687
|
-
console.log(` ${colors.gray(snippet)}${result.snippet.length > 120 ? '...' : ''}`);
|
|
1688
|
-
}
|
|
1689
|
-
console.log('');
|
|
1690
|
-
}
|
|
1691
|
-
console.log(colors.gray(' Tip: Use "get_doc <path>" to read full documentation'));
|
|
1898
|
+
this.rl.pause();
|
|
1899
|
+
await openSearchPanel(query.trim() || undefined);
|
|
1900
|
+
this.rl.resume();
|
|
1692
1901
|
}
|
|
1693
1902
|
catch (error) {
|
|
1694
1903
|
console.error(colors.red(`Search failed: ${error.message}`));
|
|
1904
|
+
this.rl.resume();
|
|
1695
1905
|
}
|
|
1696
1906
|
}
|
|
1697
1907
|
async runSuggest(useCase) {
|
|
@@ -1834,6 +2044,12 @@ export class RekShell {
|
|
|
1834
2044
|
${colors.green('suggest <use-case>')} Get implementation suggestions.
|
|
1835
2045
|
${colors.green('example <feature>')} Get code examples for a feature.
|
|
1836
2046
|
|
|
2047
|
+
${colors.bold('Navigation:')}
|
|
2048
|
+
${colors.green('Page Up/Down')} Scroll through command history.
|
|
2049
|
+
${colors.green('Home/End')} Jump to top/bottom of history.
|
|
2050
|
+
${colors.green('Mouse Scroll')} Scroll with mouse wheel.
|
|
2051
|
+
${colors.green('Escape')} Exit scroll mode.
|
|
2052
|
+
|
|
1837
2053
|
${colors.bold('Examples:')}
|
|
1838
2054
|
› url httpbin.org
|
|
1839
2055
|
› get /json
|
package/dist/contract/index.js
CHANGED
|
@@ -49,14 +49,15 @@ export function createContract(client, contract) {
|
|
|
49
49
|
if (endpoint.errors && err instanceof HttpError && err.response) {
|
|
50
50
|
const schema = endpoint.errors[err.status];
|
|
51
51
|
if (schema) {
|
|
52
|
+
let parsedError;
|
|
52
53
|
try {
|
|
53
54
|
const errorBody = await err.response.json();
|
|
54
|
-
|
|
55
|
-
throw new ContractError(err.status, parsedError, err);
|
|
55
|
+
parsedError = schema.parse(errorBody);
|
|
56
56
|
}
|
|
57
57
|
catch (parseErr) {
|
|
58
58
|
throw err;
|
|
59
59
|
}
|
|
60
|
+
throw new ContractError(err.status, parsedError, err);
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
throw err;
|
package/dist/dns/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type DnsSecurityRecords } from '../utils/dns-toolkit.js';
|
|
|
2
2
|
export { createLookupFunction, customDNSLookup } from '../utils/dns.js';
|
|
3
3
|
export { createDoHLookup } from '../utils/doh.js';
|
|
4
4
|
export { getSecurityRecords, type DnsSecurityRecords } from '../utils/dns-toolkit.js';
|
|
5
|
+
export { checkPropagation, type PropagationResult, type DnsRecord, formatPropagationReport } from './propagation.js';
|
|
5
6
|
export type { DNSOptions } from '../types/index.js';
|
|
6
7
|
export type RecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS' | 'SOA' | 'SRV' | 'CAA' | 'PTR';
|
|
7
8
|
export type DoHProvider = 'cloudflare' | 'google' | 'quad9' | 'system';
|
package/dist/dns/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dns/index.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAgD,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGhH,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,KAAK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|
3
3
|
export { createLookupFunction, customDNSLookup } from '../utils/dns.js';
|
|
4
4
|
export { createDoHLookup } from '../utils/doh.js';
|
|
5
5
|
export { getSecurityRecords } from '../utils/dns-toolkit.js';
|
|
6
|
+
export { checkPropagation, formatPropagationReport } from './propagation.js';
|
|
6
7
|
export class DNSClient {
|
|
7
8
|
options;
|
|
8
9
|
constructor(options = {}) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface DnsRecord {
|
|
2
|
+
name: string;
|
|
3
|
+
type: number;
|
|
4
|
+
TTL: number;
|
|
5
|
+
data: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PropagationResult {
|
|
8
|
+
id: string;
|
|
9
|
+
provider: string;
|
|
10
|
+
status: 'ok' | 'error';
|
|
11
|
+
records: string[];
|
|
12
|
+
rawRecords: DnsRecord[];
|
|
13
|
+
latency: number;
|
|
14
|
+
error?: string;
|
|
15
|
+
location?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function checkPropagation(domain: string, type?: string): Promise<PropagationResult[]>;
|
|
18
|
+
export declare function formatPropagationReport(results: PropagationResult[], domain: string, type: string): string;
|
|
19
|
+
//# sourceMappingURL=propagation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagation.d.ts","sourceRoot":"","sources":["../../src/dns/propagation.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA8BD,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAyEvG;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAqD1G"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { request } from 'undici';
|
|
2
|
+
import pc from '../utils/colors.js';
|
|
3
|
+
const PROVIDERS = [
|
|
4
|
+
{ id: 'google', name: 'Google DNS', url: 'https://dns.google/resolve' },
|
|
5
|
+
{ id: 'cloudflare', name: 'Cloudflare', url: 'https://cloudflare-dns.com/dns-query' },
|
|
6
|
+
{ id: 'quad9', name: 'Quad9', url: 'https://dns.quad9.net:5053/dns-query' },
|
|
7
|
+
{ id: 'alidns', name: 'AliDNS (China)', url: 'https://dns.alidns.com/resolve' },
|
|
8
|
+
];
|
|
9
|
+
const TYPE_MAP = {
|
|
10
|
+
'A': '1',
|
|
11
|
+
'AAAA': '28',
|
|
12
|
+
'CNAME': '5',
|
|
13
|
+
'MX': '15',
|
|
14
|
+
'NS': '2',
|
|
15
|
+
'TXT': '16',
|
|
16
|
+
'PTR': '12',
|
|
17
|
+
'SRV': '33',
|
|
18
|
+
'SOA': '6',
|
|
19
|
+
'CAA': '257'
|
|
20
|
+
};
|
|
21
|
+
const TYPE_ID_MAP = Object.entries(TYPE_MAP).reduce((acc, [k, v]) => {
|
|
22
|
+
acc[Number(v)] = k;
|
|
23
|
+
return acc;
|
|
24
|
+
}, {});
|
|
25
|
+
export async function checkPropagation(domain, type = 'A') {
|
|
26
|
+
const typeId = TYPE_MAP[type.toUpperCase()] || type;
|
|
27
|
+
const queries = PROVIDERS.map(async (provider) => {
|
|
28
|
+
const start = performance.now();
|
|
29
|
+
try {
|
|
30
|
+
const url = new URL(provider.url);
|
|
31
|
+
url.searchParams.set('name', domain);
|
|
32
|
+
url.searchParams.set('type', typeId);
|
|
33
|
+
const { body, statusCode } = await request(url, {
|
|
34
|
+
method: 'GET',
|
|
35
|
+
headers: { 'Accept': 'application/dns-json' }
|
|
36
|
+
});
|
|
37
|
+
if (statusCode !== 200) {
|
|
38
|
+
throw new Error(`HTTP ${statusCode}`);
|
|
39
|
+
}
|
|
40
|
+
const json = await body.json();
|
|
41
|
+
const duration = performance.now() - start;
|
|
42
|
+
if (json.Status !== 0) {
|
|
43
|
+
const statusMap = {
|
|
44
|
+
1: 'FormErr', 2: 'ServFail', 3: 'NXDomain', 4: 'NotImp', 5: 'Refused'
|
|
45
|
+
};
|
|
46
|
+
const errorName = statusMap[json.Status] || `Code ${json.Status}`;
|
|
47
|
+
return {
|
|
48
|
+
id: provider.id,
|
|
49
|
+
provider: provider.name,
|
|
50
|
+
status: 'error',
|
|
51
|
+
records: [],
|
|
52
|
+
rawRecords: [],
|
|
53
|
+
latency: duration,
|
|
54
|
+
error: errorName
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const answers = (json.Answer || []);
|
|
58
|
+
const records = answers.map(r => r.data);
|
|
59
|
+
return {
|
|
60
|
+
id: provider.id,
|
|
61
|
+
provider: provider.name,
|
|
62
|
+
status: 'ok',
|
|
63
|
+
records,
|
|
64
|
+
rawRecords: answers,
|
|
65
|
+
latency: duration
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
return {
|
|
70
|
+
id: provider.id,
|
|
71
|
+
provider: provider.name,
|
|
72
|
+
status: 'error',
|
|
73
|
+
records: [],
|
|
74
|
+
rawRecords: [],
|
|
75
|
+
latency: performance.now() - start,
|
|
76
|
+
error: err.message
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return Promise.all(queries);
|
|
81
|
+
}
|
|
82
|
+
export function formatPropagationReport(results, domain, type) {
|
|
83
|
+
let output = '';
|
|
84
|
+
output += `
|
|
85
|
+
${pc.bold(pc.cyan('🌍 Global DNS Propagation Check'))}
|
|
86
|
+
`;
|
|
87
|
+
output += `${pc.gray('Domain:')} ${pc.white(domain)} ${pc.gray('Type:')} ${pc.white(type.toUpperCase())}
|
|
88
|
+
|
|
89
|
+
`;
|
|
90
|
+
const consensus = {};
|
|
91
|
+
results.forEach(res => {
|
|
92
|
+
const key = res.status === 'ok' ? res.records.sort().join(', ') : `Error: ${res.error}`;
|
|
93
|
+
consensus[key] = (consensus[key] || 0) + 1;
|
|
94
|
+
const statusIcon = res.status === 'ok' ? pc.green('✔') : pc.red('✖');
|
|
95
|
+
const latencyColor = res.latency < 50 ? pc.green : res.latency < 200 ? pc.yellow : pc.red;
|
|
96
|
+
const latencyText = latencyColor(`${Math.round(res.latency)}ms`.padStart(5));
|
|
97
|
+
const providerName = pc.bold(res.provider.padEnd(15));
|
|
98
|
+
let recordsText = '';
|
|
99
|
+
if (res.status === 'ok') {
|
|
100
|
+
if (res.records.length === 0) {
|
|
101
|
+
recordsText = pc.yellow('(No records)');
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
recordsText = res.records.join(', ');
|
|
105
|
+
if (recordsText.length > 60)
|
|
106
|
+
recordsText = recordsText.substring(0, 57) + '...';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
recordsText = pc.red(res.error || 'Unknown Error');
|
|
111
|
+
}
|
|
112
|
+
output += ` ${statusIcon} ${providerName} ${latencyText} ${recordsText}
|
|
113
|
+
`;
|
|
114
|
+
});
|
|
115
|
+
output += '\n';
|
|
116
|
+
const distinctAnswers = Object.keys(consensus);
|
|
117
|
+
if (distinctAnswers.length === 1) {
|
|
118
|
+
if (distinctAnswers[0].startsWith('Error')) {
|
|
119
|
+
output += pc.red('❌ All providers returned error.\n');
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
output += pc.green('✅ All providers returned the same records. Propagation is complete.\n');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else if (distinctAnswers.length > 1) {
|
|
126
|
+
output += pc.yellow('⚠ Inconsistent results detected (Propagation in progress or Split-Horizon DNS).\n');
|
|
127
|
+
}
|
|
128
|
+
return output;
|
|
129
|
+
}
|
package/dist/mcp/server.d.ts
CHANGED
package/dist/mcp/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAMhB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AA0CD,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,MAAM,CAAC,CAAkC;IACjD,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,WAAW,CAAS;gBAEhB,OAAO,GAAE,gBAAqB;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[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AAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,OAAO;IAyBf,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,QAAQ;IAkHhB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,UAAU;IA0ElB,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,MAAM;IAmCd,OAAO,CAAC,eAAe;IAgDvB,OAAO,CAAC,YAAY;IAmEpB,OAAO,CAAC,cAAc;IAmFtB,OAAO,CAAC,gBAAgB;IA+DxB,OAAO,CAAC,iBAAiB;IAuCzB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,eAAe;IA8DnD,OAAO,CAAC,gBAAgB;YAOV,UAAU;YAgCV,SAAS;YA8CT,QAAQ;IAuFhB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3B,OAAO,IAAI,MAAM;IAIjB,YAAY,IAAI,MAAM;IAItB,gBAAgB,IAAI,MAAM;IAI1B,aAAa,IAAI,MAAM;IAIvB,YAAY,IAAI,gBAAgB;CAGjC;AAoBD,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAErE"}
|
package/dist/mcp/server.js
CHANGED
|
@@ -26,7 +26,13 @@ export class MCPServer {
|
|
|
26
26
|
toolsFilter: options.toolsFilter || [],
|
|
27
27
|
};
|
|
28
28
|
this.hybridSearch = createHybridSearch({ debug: this.options.debug });
|
|
29
|
-
|
|
29
|
+
}
|
|
30
|
+
indexReady = null;
|
|
31
|
+
async ensureIndexReady() {
|
|
32
|
+
if (!this.indexReady) {
|
|
33
|
+
this.indexReady = this.buildIndex();
|
|
34
|
+
}
|
|
35
|
+
await this.indexReady;
|
|
30
36
|
}
|
|
31
37
|
log(message, data) {
|
|
32
38
|
if (this.options.debug) {
|
|
@@ -1112,6 +1118,7 @@ const client = createClient({
|
|
|
1112
1118
|
});
|
|
1113
1119
|
}
|
|
1114
1120
|
async start() {
|
|
1121
|
+
await this.ensureIndexReady();
|
|
1115
1122
|
switch (this.options.transport) {
|
|
1116
1123
|
case 'stdio':
|
|
1117
1124
|
return this.startStdio();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undici.d.ts","sourceRoot":"","sources":["../../src/transport/undici.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,aAAa,EAAE,cAAc,EAAW,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAgB,UAAU,EAAkD,MAAM,mBAAmB,CAAC;AAOxN,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAwNzD,UAAU,sBAAsB;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAMtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAqDD,qBAAa,eAAgB,YAAW,SAAS;IAC/C,OAAO,CAAC,MA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