recker 1.0.20-next.963881c → 1.0.20-next.b961eae

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli/index.js +1 -290
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -724,7 +724,7 @@ ${colors.gray('Status:')} ${statusIcon}
724
724
  .command('generate-dmarc')
725
725
  .description('Generate a DMARC record interactively')
726
726
  .option('-p, --policy <policy>', 'Policy: none, quarantine, reject', 'none')
727
- .option('--subdomain-policy <policy>', 'Subdomain policy')
727
+ .option('-sp, --subdomain-policy <policy>', 'Subdomain policy')
728
728
  .option('--pct <percent>', 'Percentage of emails to apply policy', '100')
729
729
  .option('--rua <emails>', 'Aggregate report email(s), comma-separated')
730
730
  .option('--ruf <emails>', 'Forensic report email(s), comma-separated')
@@ -879,295 +879,6 @@ ${colors.bold(colors.yellow('Examples:'))}
879
879
  const { startLoadDashboard } = await import('./tui/load-dashboard.js');
880
880
  await startLoadDashboard({ url, users, duration, mode, http2, rampUp });
881
881
  });
882
- const serve = program.command('serve').description('Start mock servers for testing protocols');
883
- serve
884
- .command('http')
885
- .description('Start a mock HTTP server')
886
- .option('-p, --port <number>', 'Port to listen on', '3000')
887
- .option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
888
- .option('--echo', 'Echo request body back in response')
889
- .option('--delay <ms>', 'Add delay to responses (milliseconds)', '0')
890
- .option('--cors', 'Enable CORS', true)
891
- .addHelpText('after', `
892
- ${colors.bold(colors.yellow('Examples:'))}
893
- ${colors.green('$ rek serve http')} ${colors.gray('Start on port 3000')}
894
- ${colors.green('$ rek serve http -p 8080')} ${colors.gray('Start on port 8080')}
895
- ${colors.green('$ rek serve http --echo')} ${colors.gray('Echo mode')}
896
- ${colors.green('$ rek serve http --delay 500')} ${colors.gray('Add 500ms delay')}
897
- `)
898
- .action(async (options) => {
899
- const { MockHttpServer } = await import('../testing/mock-http-server.js');
900
- const server = await MockHttpServer.create({
901
- port: parseInt(options.port),
902
- host: options.host,
903
- delay: parseInt(options.delay),
904
- cors: options.cors,
905
- });
906
- if (options.echo) {
907
- server.any('/*', (req) => ({
908
- status: 200,
909
- body: {
910
- method: req.method,
911
- path: req.path,
912
- query: req.query,
913
- headers: req.headers,
914
- body: req.body,
915
- },
916
- }));
917
- }
918
- console.log(colors.green(`
919
- ┌─────────────────────────────────────────────┐
920
- │ ${colors.bold('Recker Mock HTTP Server')} │
921
- ├─────────────────────────────────────────────┤
922
- │ URL: ${colors.cyan(server.url.padEnd(37))}│
923
- │ Mode: ${colors.yellow((options.echo ? 'Echo' : 'Default').padEnd(36))}│
924
- │ Delay: ${colors.gray((options.delay + 'ms').padEnd(35))}│
925
- ├─────────────────────────────────────────────┤
926
- │ Press ${colors.bold('Ctrl+C')} to stop │
927
- └─────────────────────────────────────────────┘
928
- `));
929
- server.on('request', (req) => {
930
- console.log(colors.gray(`${new Date().toISOString()} `) + colors.cyan(req.method.padEnd(7)) + req.path);
931
- });
932
- process.on('SIGINT', async () => {
933
- console.log(colors.yellow('\nShutting down...'));
934
- await server.stop();
935
- process.exit(0);
936
- });
937
- });
938
- serve
939
- .command('websocket')
940
- .alias('ws')
941
- .description('Start a mock WebSocket server')
942
- .option('-p, --port <number>', 'Port to listen on', '8080')
943
- .option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
944
- .option('--echo', 'Echo messages back (default: true)', true)
945
- .option('--no-echo', 'Disable echo mode')
946
- .option('--delay <ms>', 'Add delay to responses (milliseconds)', '0')
947
- .addHelpText('after', `
948
- ${colors.bold(colors.yellow('Examples:'))}
949
- ${colors.green('$ rek serve websocket')} ${colors.gray('Start on port 8080')}
950
- ${colors.green('$ rek serve ws -p 9000')} ${colors.gray('Start on port 9000')}
951
- ${colors.green('$ rek serve ws --no-echo')} ${colors.gray('Disable echo')}
952
- `)
953
- .action(async (options) => {
954
- const { MockWebSocketServer } = await import('../testing/mock-websocket-server.js');
955
- const server = await MockWebSocketServer.create({
956
- port: parseInt(options.port),
957
- host: options.host,
958
- echo: options.echo,
959
- delay: parseInt(options.delay),
960
- });
961
- console.log(colors.green(`
962
- ┌─────────────────────────────────────────────┐
963
- │ ${colors.bold('Recker Mock WebSocket Server')} │
964
- ├─────────────────────────────────────────────┤
965
- │ URL: ${colors.cyan(server.url.padEnd(37))}│
966
- │ Echo: ${colors.yellow((options.echo ? 'Enabled' : 'Disabled').padEnd(36))}│
967
- │ Delay: ${colors.gray((options.delay + 'ms').padEnd(35))}│
968
- ├─────────────────────────────────────────────┤
969
- │ Press ${colors.bold('Ctrl+C')} to stop │
970
- └─────────────────────────────────────────────┘
971
- `));
972
- server.on('connection', (client) => {
973
- console.log(colors.green(`+ Connected: ${client.id}`));
974
- });
975
- server.on('message', (msg, client) => {
976
- const data = msg.data.toString().slice(0, 50);
977
- console.log(colors.gray(`${new Date().toISOString()} `) + colors.cyan(client.id) + ` ${data}${msg.data.toString().length > 50 ? '...' : ''}`);
978
- });
979
- server.on('disconnect', (client) => {
980
- console.log(colors.red(`- Disconnected: ${client.id}`));
981
- });
982
- process.on('SIGINT', async () => {
983
- console.log(colors.yellow('\nShutting down...'));
984
- await server.stop();
985
- process.exit(0);
986
- });
987
- });
988
- serve
989
- .command('sse')
990
- .description('Start a mock SSE (Server-Sent Events) server')
991
- .option('-p, --port <number>', 'Port to listen on', '8081')
992
- .option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
993
- .option('--path <string>', 'SSE endpoint path', '/events')
994
- .option('--heartbeat <ms>', 'Send heartbeat every N ms (0 = disabled)', '0')
995
- .addHelpText('after', `
996
- ${colors.bold(colors.yellow('Examples:'))}
997
- ${colors.green('$ rek serve sse')} ${colors.gray('Start on port 8081')}
998
- ${colors.green('$ rek serve sse -p 9000')} ${colors.gray('Start on port 9000')}
999
- ${colors.green('$ rek serve sse --heartbeat 5000')} ${colors.gray('Send heartbeat every 5s')}
1000
-
1001
- ${colors.bold(colors.yellow('Interactive Commands:'))}
1002
- Type a message and press Enter to broadcast it to all clients.
1003
- `)
1004
- .action(async (options) => {
1005
- const { MockSSEServer } = await import('../testing/mock-sse-server.js');
1006
- const readline = await import('node:readline');
1007
- const server = await MockSSEServer.create({
1008
- port: parseInt(options.port),
1009
- host: options.host,
1010
- path: options.path,
1011
- });
1012
- if (parseInt(options.heartbeat) > 0) {
1013
- server.startPeriodicEvents('heartbeat', parseInt(options.heartbeat));
1014
- }
1015
- console.log(colors.green(`
1016
- ┌─────────────────────────────────────────────┐
1017
- │ ${colors.bold('Recker Mock SSE Server')} │
1018
- ├─────────────────────────────────────────────┤
1019
- │ URL: ${colors.cyan(server.url.padEnd(37))}│
1020
- │ Heartbeat: ${colors.yellow((options.heartbeat === '0' ? 'Disabled' : options.heartbeat + 'ms').padEnd(31))}│
1021
- ├─────────────────────────────────────────────┤
1022
- │ Type message + Enter to broadcast │
1023
- │ Press ${colors.bold('Ctrl+C')} to stop │
1024
- └─────────────────────────────────────────────┘
1025
- `));
1026
- server.on('connection', (client) => {
1027
- console.log(colors.green(`+ Connected: ${client.id}`));
1028
- });
1029
- server.on('disconnect', (client) => {
1030
- console.log(colors.red(`- Disconnected: ${client.id}`));
1031
- });
1032
- const rl = readline.createInterface({
1033
- input: process.stdin,
1034
- output: process.stdout,
1035
- });
1036
- rl.on('line', (line) => {
1037
- if (line.trim()) {
1038
- const sent = server.sendData(line.trim());
1039
- console.log(colors.gray(`Broadcast to ${sent} client(s): ${line.trim()}`));
1040
- }
1041
- });
1042
- process.on('SIGINT', async () => {
1043
- console.log(colors.yellow('\nShutting down...'));
1044
- rl.close();
1045
- await server.stop();
1046
- process.exit(0);
1047
- });
1048
- });
1049
- serve
1050
- .command('hls')
1051
- .description('Start a mock HLS streaming server')
1052
- .option('-p, --port <number>', 'Port to listen on', '8082')
1053
- .option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
1054
- .option('--mode <type>', 'Stream mode: vod, live, event', 'vod')
1055
- .option('--segments <number>', 'Number of segments (VOD mode)', '10')
1056
- .option('--duration <seconds>', 'Segment duration in seconds', '6')
1057
- .option('--qualities <list>', 'Comma-separated quality variants', '720p,480p,360p')
1058
- .addHelpText('after', `
1059
- ${colors.bold(colors.yellow('Examples:'))}
1060
- ${colors.green('$ rek serve hls')} ${colors.gray('Start VOD server')}
1061
- ${colors.green('$ rek serve hls --mode live')} ${colors.gray('Start live stream')}
1062
- ${colors.green('$ rek serve hls --segments 20')} ${colors.gray('VOD with 20 segments')}
1063
- ${colors.green('$ rek serve hls --qualities 1080p,720p,480p')}
1064
-
1065
- ${colors.bold(colors.yellow('Endpoints:'))}
1066
- ${colors.cyan('/master.m3u8')} Master playlist (multi-quality)
1067
- ${colors.cyan('/playlist.m3u8')} Single quality playlist
1068
- ${colors.cyan('/<quality>/playlist.m3u8')} Quality-specific playlist
1069
- `)
1070
- .action(async (options) => {
1071
- const { MockHlsServer } = await import('../testing/mock-hls-server.js');
1072
- const http = await import('node:http');
1073
- const port = parseInt(options.port);
1074
- const host = options.host;
1075
- const qualities = options.qualities.split(',').map(q => q.trim());
1076
- const resolutions = ['1920x1080', '1280x720', '854x480', '640x360', '426x240'];
1077
- const bandwidths = [5000000, 2500000, 1400000, 800000, 500000];
1078
- const variants = qualities.map((name, i) => ({
1079
- name,
1080
- bandwidth: bandwidths[i] || 500000,
1081
- resolution: resolutions[i] || '640x360',
1082
- }));
1083
- const baseUrl = `http://${host}:${port}`;
1084
- const hlsServer = await MockHlsServer.create({
1085
- baseUrl,
1086
- mode: options.mode,
1087
- segmentCount: parseInt(options.segments),
1088
- segmentDuration: parseInt(options.duration),
1089
- multiQuality: variants.length > 1,
1090
- variants: variants.length > 1 ? variants : undefined,
1091
- });
1092
- const httpServer = http.createServer(async (req, res) => {
1093
- const url = `${baseUrl}${req.url}`;
1094
- try {
1095
- const response = await hlsServer.transport.dispatch({ url, method: req.method || 'GET' });
1096
- res.statusCode = response.status;
1097
- response.headers.forEach((value, key) => {
1098
- res.setHeader(key, value);
1099
- });
1100
- const body = await response.arrayBuffer();
1101
- res.end(Buffer.from(body));
1102
- }
1103
- catch {
1104
- res.statusCode = 404;
1105
- res.end('Not Found');
1106
- }
1107
- });
1108
- httpServer.listen(port, host, () => {
1109
- console.log(colors.green(`
1110
- ┌─────────────────────────────────────────────┐
1111
- │ ${colors.bold('Recker Mock HLS Server')} │
1112
- ├─────────────────────────────────────────────┤
1113
- │ Master: ${colors.cyan((hlsServer.manifestUrl).padEnd(34))}│
1114
- │ Mode: ${colors.yellow(options.mode.padEnd(36))}│
1115
- │ Segments: ${colors.gray(options.segments.padEnd(32))}│
1116
- │ Duration: ${colors.gray((options.duration + 's').padEnd(32))}│
1117
- │ Qualities: ${colors.cyan(qualities.join(', ').padEnd(31))}│
1118
- ├─────────────────────────────────────────────┤
1119
- │ Press ${colors.bold('Ctrl+C')} to stop │
1120
- └─────────────────────────────────────────────┘
1121
- `));
1122
- });
1123
- process.on('SIGINT', async () => {
1124
- console.log(colors.yellow('\nShutting down...'));
1125
- httpServer.close();
1126
- await hlsServer.stop();
1127
- process.exit(0);
1128
- });
1129
- });
1130
- serve
1131
- .command('udp')
1132
- .description('Start a mock UDP server')
1133
- .option('-p, --port <number>', 'Port to listen on', '9000')
1134
- .option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
1135
- .option('--echo', 'Echo messages back (default: true)', true)
1136
- .option('--no-echo', 'Disable echo mode')
1137
- .addHelpText('after', `
1138
- ${colors.bold(colors.yellow('Examples:'))}
1139
- ${colors.green('$ rek serve udp')} ${colors.gray('Start on port 9000')}
1140
- ${colors.green('$ rek serve udp -p 5353')} ${colors.gray('Start on port 5353')}
1141
- ${colors.green('$ rek serve udp --no-echo')} ${colors.gray('Disable echo')}
1142
- `)
1143
- .action(async (options) => {
1144
- const { MockUDPServer } = await import('../testing/mock-udp-server.js');
1145
- const server = new MockUDPServer({
1146
- port: parseInt(options.port),
1147
- host: options.host,
1148
- echo: options.echo,
1149
- });
1150
- await server.start();
1151
- console.log(colors.green(`
1152
- ┌─────────────────────────────────────────────┐
1153
- │ ${colors.bold('Recker Mock UDP Server')} │
1154
- ├─────────────────────────────────────────────┤
1155
- │ Address: ${colors.cyan(`${options.host}:${options.port}`.padEnd(33))}│
1156
- │ Echo: ${colors.yellow((options.echo ? 'Enabled' : 'Disabled').padEnd(36))}│
1157
- ├─────────────────────────────────────────────┤
1158
- │ Press ${colors.bold('Ctrl+C')} to stop │
1159
- └─────────────────────────────────────────────┘
1160
- `));
1161
- server.on('message', (msg) => {
1162
- const data = msg.data.toString().slice(0, 50);
1163
- console.log(colors.gray(`${new Date().toISOString()} `) + colors.cyan(`${msg.rinfo.address}:${msg.rinfo.port}`) + ` ${data}${msg.data.toString().length > 50 ? '...' : ''}`);
1164
- });
1165
- process.on('SIGINT', async () => {
1166
- console.log(colors.yellow('\nShutting down...'));
1167
- await server.stop();
1168
- process.exit(0);
1169
- });
1170
- });
1171
882
  program
1172
883
  .command('mcp')
1173
884
  .description('Start MCP server for AI agents to access Recker documentation')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recker",
3
- "version": "1.0.20-next.963881c",
3
+ "version": "1.0.20-next.b961eae",
4
4
  "description": "AI & DevX focused HTTP client for Node.js 18+",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",