recker 1.0.66 → 1.0.67

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.
@@ -1,44 +1,46 @@
1
- export declare const reset: (s: string) => string;
2
- export declare const bold: (s: string | number) => string;
3
- export declare const black: (s: string | number) => string;
4
- export declare const red: (s: string | number) => string;
5
- export declare const green: (s: string | number) => string;
6
- export declare const yellow: (s: string | number) => string;
7
- export declare const blue: (s: string | number) => string;
8
- export declare const magenta: (s: string | number) => string;
9
- export declare const cyan: (s: string | number) => string;
10
- export declare const white: (s: string | number) => string;
11
- export declare const gray: (s: string | number) => string;
12
- export declare const orange: (s: string | number) => string;
13
- export declare const bgBlack: (s: string | number) => string;
14
- export declare const bgRed: (s: string | number) => string;
15
- export declare const bgGreen: (s: string | number) => string;
16
- export declare const bgYellow: (s: string | number) => string;
17
- export declare const bgBlue: (s: string | number) => string;
18
- export declare const bgMagenta: (s: string | number) => string;
19
- export declare const bgCyan: (s: string | number) => string;
20
- export declare const bgWhite: (s: string | number) => string;
1
+ import { type ColorFn, black, red, green, yellow, blue, magenta, cyan, white, gray, grey, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgGrey, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, strike, rgb, bgRgb, hex, bgHex, ansi256, bgAnsi256, compose, styled, c, stripAnsi, hasAnsi, visibleLength, success, error, warning, info, muted, primary, secondary, supportsColor, supportsTrueColor, getColorLevel, tpl, theme as tuiuiuTheme, tw, styles } from 'tuiuiu.js/colors';
2
+ export { type ColorFn, black, red, green, yellow, blue, magenta, cyan, white, gray, grey, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgGrey, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, strike, rgb, bgRgb, hex, bgHex, ansi256, bgAnsi256, compose, styled, c, stripAnsi, hasAnsi, visibleLength, success, error, warning, info, muted, primary, secondary, supportsColor, supportsTrueColor, getColorLevel, tpl, tuiuiuTheme, tw, styles, };
3
+ export declare const orange: ColorFn;
4
+ export declare const lightOrange: ColorFn;
5
+ export declare const darkOrange: ColorFn;
6
+ export declare const burntOrange: ColorFn;
7
+ export declare const lightGray: ColorFn;
8
+ export declare const mediumGray: ColorFn;
9
+ export declare const orangeBold: ColorFn;
10
+ export declare const whiteBold: (s: string) => string;
11
+ export declare const grayDim: ColorFn;
21
12
  declare const colors: {
22
- reset: (s: string) => string;
23
- bold: (s: string | number) => string;
24
- black: (s: string | number) => string;
25
- red: (s: string | number) => string;
26
- green: (s: string | number) => string;
27
- yellow: (s: string | number) => string;
28
- blue: (s: string | number) => string;
29
- magenta: (s: string | number) => string;
30
- cyan: (s: string | number) => string;
31
- white: (s: string | number) => string;
32
- gray: (s: string | number) => string;
33
- orange: (s: string | number) => string;
34
- bgBlack: (s: string | number) => string;
35
- bgRed: (s: string | number) => string;
36
- bgGreen: (s: string | number) => string;
37
- bgYellow: (s: string | number) => string;
38
- bgBlue: (s: string | number) => string;
39
- bgMagenta: (s: string | number) => string;
40
- bgCyan: (s: string | number) => string;
41
- bgWhite: (s: string | number) => string;
42
- grey: (s: string | number) => string;
13
+ reset: ColorFn;
14
+ bold: ColorFn;
15
+ dim: ColorFn;
16
+ italic: ColorFn;
17
+ underline: ColorFn;
18
+ black: ColorFn;
19
+ red: ColorFn;
20
+ green: ColorFn;
21
+ yellow: ColorFn;
22
+ blue: ColorFn;
23
+ magenta: ColorFn;
24
+ cyan: ColorFn;
25
+ white: ColorFn;
26
+ gray: ColorFn;
27
+ orange: ColorFn;
28
+ lightOrange: ColorFn;
29
+ darkOrange: ColorFn;
30
+ burntOrange: ColorFn;
31
+ lightGray: ColorFn;
32
+ mediumGray: ColorFn;
33
+ orangeBold: ColorFn;
34
+ whiteBold: (s: string) => string;
35
+ grayDim: ColorFn;
36
+ bgBlack: ColorFn;
37
+ bgRed: ColorFn;
38
+ bgGreen: ColorFn;
39
+ bgYellow: ColorFn;
40
+ bgBlue: ColorFn;
41
+ bgMagenta: ColorFn;
42
+ bgCyan: ColorFn;
43
+ bgWhite: ColorFn;
44
+ grey: ColorFn;
43
45
  };
44
46
  export default colors;
@@ -1,52 +1,20 @@
1
- const hasColors = (() => {
2
- if ('NO_COLOR' in process.env)
3
- return false;
4
- if ('FORCE_COLOR' in process.env)
5
- return true;
6
- if (process.env.TERM === 'dumb')
7
- return false;
8
- if (process.stdout?.isTTY)
9
- return true;
10
- if (process.env.CI)
11
- return true;
12
- return false;
13
- })();
14
- const code = (open, close) => {
15
- if (!hasColors)
16
- return (s) => String(s);
17
- const openCode = `\x1b[${open}m`;
18
- const closeCode = `\x1b[${close}m`;
19
- return (s) => {
20
- const str = String(s);
21
- const closeRe = new RegExp(`\\x1b\\[${close}m`, 'g');
22
- return openCode + str.replace(closeRe, openCode) + closeCode;
23
- };
24
- };
25
- export const reset = hasColors ? (s) => `\x1b[0m${s}\x1b[0m` : (s) => s;
26
- export const bold = code(1, 22);
27
- export const black = code(30, 39);
28
- export const red = code(31, 39);
29
- export const green = code(32, 39);
30
- export const yellow = code(33, 39);
31
- export const blue = code(34, 39);
32
- export const magenta = code(35, 39);
33
- export const cyan = code(36, 39);
34
- export const white = code(37, 39);
35
- export const gray = code(90, 39);
36
- export const orange = hasColors
37
- ? (s) => `\x1b[38;5;208m${String(s)}\x1b[39m`
38
- : (s) => String(s);
39
- export const bgBlack = code(40, 49);
40
- export const bgRed = code(41, 49);
41
- export const bgGreen = code(42, 49);
42
- export const bgYellow = code(43, 49);
43
- export const bgBlue = code(44, 49);
44
- export const bgMagenta = code(45, 49);
45
- export const bgCyan = code(46, 49);
46
- export const bgWhite = code(47, 49);
1
+ import { black, red, green, yellow, blue, magenta, cyan, white, gray, grey, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgGrey, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, strike, rgb, bgRgb, hex, bgHex, ansi256, bgAnsi256, compose, styled, c, stripAnsi, hasAnsi, visibleLength, success, error, warning, info, muted, primary, secondary, supportsColor, supportsTrueColor, getColorLevel, tpl, theme as tuiuiuTheme, tw, styles, } from 'tuiuiu.js/colors';
2
+ export { black, red, green, yellow, blue, magenta, cyan, white, gray, grey, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgGrey, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, strike, rgb, bgRgb, hex, bgHex, ansi256, bgAnsi256, compose, styled, c, stripAnsi, hasAnsi, visibleLength, success, error, warning, info, muted, primary, secondary, supportsColor, supportsTrueColor, getColorLevel, tpl, tuiuiuTheme, tw, styles, };
3
+ export const orange = ansi256(208);
4
+ export const lightOrange = ansi256(214);
5
+ export const darkOrange = ansi256(202);
6
+ export const burntOrange = ansi256(166);
7
+ export const lightGray = ansi256(252);
8
+ export const mediumGray = ansi256(245);
9
+ export const orangeBold = compose(orange, bold);
10
+ export const whiteBold = (s) => c.bold.white(s);
11
+ export const grayDim = compose(gray, dim);
47
12
  const colors = {
48
13
  reset,
49
14
  bold,
15
+ dim,
16
+ italic,
17
+ underline,
50
18
  black,
51
19
  red,
52
20
  green,
@@ -57,6 +25,14 @@ const colors = {
57
25
  white,
58
26
  gray,
59
27
  orange,
28
+ lightOrange,
29
+ darkOrange,
30
+ burntOrange,
31
+ lightGray,
32
+ mediumGray,
33
+ orangeBold,
34
+ whiteBold,
35
+ grayDim,
60
36
  bgBlack,
61
37
  bgRed,
62
38
  bgGreen,
@@ -88,7 +88,7 @@ export async function handleRequest(options) {
88
88
  return;
89
89
  }
90
90
  const statusColor = response.ok ? colors.green : colors.red;
91
- console.log(`${statusColor(colors.bold(response.status))} ${statusColor(response.statusText)} ` +
91
+ console.log(`${statusColor(colors.bold(String(response.status)))} ${statusColor(response.statusText)} ` +
92
92
  `${colors.gray(`(${duration}ms)`)}`);
93
93
  if (options.verbose) {
94
94
  console.log(colors.gray('\n--- Request ---'));
package/dist/cli/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { RekCommand } from './router.js';
2
2
  import colors from '../utils/colors.js';
3
+ import { theme } from './theme.js';
3
4
  import { formatColumns } from '../utils/columns.js';
4
5
  import { getVersion, formatVersionInfo } from '../version.js';
5
6
  import { registerHlsCommand } from './commands/hls.js';
@@ -124,13 +125,13 @@ async function main() {
124
125
  .option('-j, --json', 'Force JSON content-type')
125
126
  .option('-e, --env [path]', 'Load .env file')
126
127
  .addHelpText('after', () => `
127
- ${colors.bold(colors.yellow('Examples:'))}
128
- ${colors.green('$ rek httpbin.org/json')}
129
- ${colors.green('$ rek post api.com/users name="Cyber"')}
130
- ${colors.green('$ rek @github/user')}
128
+ ${theme.header('Examples:')}
129
+ ${theme.example('$ rek httpbin.org/json')}
130
+ ${theme.example('$ rek post api.com/users name="Cyber"')}
131
+ ${theme.example('$ rek @github/user')}
131
132
 
132
- ${colors.bold(colors.yellow('Available Presets:'))}
133
- ${formatColumns(PRESET_NAMES, { prefix: '@', indent: 2, minWidth: 16, transform: colors.cyan })}
133
+ ${theme.header('Available Presets:')}
134
+ ${formatColumns(PRESET_NAMES, { prefix: '@', indent: 2, minWidth: 16, transform: colors.lightOrange })}
134
135
  `)
135
136
  .action(async (args, options) => {
136
137
  if (args.length === 0) {
@@ -169,7 +170,7 @@ ${formatColumns(PRESET_NAMES, { prefix: '@', indent: 2, minWidth: 16, transform:
169
170
  }
170
171
  }
171
172
  else {
172
- console.error(colors.red(`Error: Preset '@${presetName}' not found.`));
173
+ console.error(theme.error(`Error: Preset '@${presetName}' not found.`));
173
174
  process.exit(1);
174
175
  }
175
176
  }
@@ -213,32 +214,32 @@ ${formatColumns(PRESET_NAMES, { prefix: '@', indent: 2, minWidth: 16, transform:
213
214
  else {
214
215
  payload = Buffer.from(JSON.stringify(bodyData));
215
216
  }
216
- console.log(colors.gray(`Sending ${payload.length} bytes to ${host}:${port}...`));
217
+ console.log(theme.muted(`Sending ${payload.length} bytes to ${host}:${port}...`));
217
218
  client.on('message', (msg, rinfo) => {
218
219
  if (!options.quiet) {
219
- console.log(colors.green(`\nResponse from ${rinfo.address}:${rinfo.port}:`));
220
+ console.log(theme.success(`\nResponse from ${rinfo.address}:${rinfo.port}:`));
220
221
  }
221
222
  console.log(msg.toString());
222
223
  client.close();
223
224
  });
224
225
  client.on('error', (err) => {
225
- console.error(colors.red(`UDP Error: ${err.message}`));
226
+ console.error(theme.error(`UDP Error: ${err.message}`));
226
227
  client.close();
227
228
  process.exit(1);
228
229
  });
229
230
  client.send(payload, port, host, (err) => {
230
231
  if (err) {
231
- console.error(colors.red(`Send Error: ${err.message}`));
232
+ console.error(theme.error(`Send Error: ${err.message}`));
232
233
  client.close();
233
234
  process.exit(1);
234
235
  }
235
236
  if (!options.quiet) {
236
- console.log(colors.gray('Message sent. Waiting for response (2s timeout)...'));
237
+ console.log(theme.muted('Message sent. Waiting for response (2s timeout)...'));
237
238
  }
238
239
  });
239
240
  setTimeout(() => {
240
241
  if (!options.quiet) {
241
- console.log(colors.gray('\nNo response received (timeout).'));
242
+ console.log(theme.muted('\nNo response received (timeout).'));
242
243
  }
243
244
  client.close();
244
245
  process.exit(0);
@@ -270,7 +271,7 @@ ${formatColumns(PRESET_NAMES, { prefix: '@', indent: 2, minWidth: 16, transform:
270
271
  }
271
272
  catch (error) {
272
273
  if (!options.quiet) {
273
- console.error(colors.red(`\nError: ${error.message}`));
274
+ console.error(theme.error(`\nError: ${error.message}`));
274
275
  if (options.verbose && error.cause) {
275
276
  console.error(error.cause);
276
277
  }
@@ -280,8 +281,8 @@ ${formatColumns(PRESET_NAMES, { prefix: '@', indent: 2, minWidth: 16, transform:
280
281
  });
281
282
  program.command('version').alias('info').action(async () => {
282
283
  const versionInfo = await formatVersionInfo(true);
283
- console.log(colors.bold(colors.cyan('recker')) + ' ' + colors.green(version));
284
- console.log(colors.gray(versionInfo));
284
+ console.log(theme.brand('recker') + ' ' + theme.version(version));
285
+ console.log(theme.muted(versionInfo));
285
286
  });
286
287
  program.command('shell').alias('repl')
287
288
  .description('Interactive HTTP shell (tuiuiu-based)')
@@ -1,4 +1,4 @@
1
- import colors from '../utils/colors.js';
1
+ import { theme } from './theme.js';
2
2
  import { z } from 'zod';
3
3
  let globalPresets = [];
4
4
  const KEYWORD_MAP = {
@@ -279,7 +279,7 @@ export class RekCommand {
279
279
  await this.dispatch(args);
280
280
  }
281
281
  catch (err) {
282
- console.error(colors.red(`\nError: ${err.message}\n`));
282
+ console.error(theme.error(`\nError: ${err.message}\n`));
283
283
  process.exit(1);
284
284
  }
285
285
  }
@@ -341,8 +341,8 @@ export class RekCommand {
341
341
  return;
342
342
  }
343
343
  if (args.length > 0) {
344
- console.error(colors.red(`Unknown command: '${args[0]}'`));
345
- console.log(colors.gray(`Run 'rek --help' for available commands.`));
344
+ console.error(theme.error(`Unknown command: '${args[0]}'`));
345
+ console.log(theme.muted(`Run 'rek --help' for available commands.`));
346
346
  process.exit(1);
347
347
  }
348
348
  this.showHelp();
@@ -566,9 +566,9 @@ export class RekCommand {
566
566
  this.resolvedArguments = resolveArguments(this.smartArguments);
567
567
  }
568
568
  console.log(`
569
- ${colors.bold(this.name)} - ${this._description}`);
569
+ ${theme.brand(this.name)} - ${theme.text(this._description)}`);
570
570
  console.log(`
571
- ${colors.yellow('Usage:')}
571
+ ${theme.header('Usage:')}
572
572
  ${this.name} ${this.argsDefinition.join(' ')} [options] [command]`);
573
573
  const allExamples = [...this._examples];
574
574
  let cmdPrefix = '';
@@ -600,26 +600,26 @@ ${colors.yellow('Usage:')}
600
600
  }
601
601
  if (allExamples.length > 0) {
602
602
  console.log(`
603
- ${colors.yellow('Examples:')}`);
603
+ ${theme.header('Examples:')}`);
604
604
  for (const ex of allExamples) {
605
605
  if (ex.desc) {
606
- console.log(` ${colors.green(ex.cmd)}`);
607
- console.log(` ${colors.gray(ex.desc)}`);
606
+ console.log(` ${theme.example(ex.cmd)}`);
607
+ console.log(` ${theme.exampleDesc(ex.desc)}`);
608
608
  }
609
609
  else {
610
- console.log(` ${colors.green(ex.cmd)}`);
610
+ console.log(` ${theme.example(ex.cmd)}`);
611
611
  }
612
612
  }
613
613
  }
614
614
  if (this.resolvedArguments.length > 0) {
615
615
  console.log(`
616
- ${colors.yellow('Arguments:')}`);
616
+ ${theme.header('Arguments:')}`);
617
617
  for (const arg of this.resolvedArguments) {
618
618
  const marker = arg.required ? '<' : '[';
619
619
  const endMarker = arg.required ? '>' : ']';
620
620
  const variadicSuffix = arg.variadic ? '...' : '';
621
621
  const argName = `${marker}${arg.name}${variadicSuffix}${endMarker}`;
622
- let line = ` ${colors.cyan(argName.padEnd(16))} ${arg.description}`;
622
+ let line = ` ${theme.positional(argName.padEnd(16))} ${arg.description}`;
623
623
  const meta = [];
624
624
  if (arg.enumValues)
625
625
  meta.push(arg.enumValues.join('|'));
@@ -630,24 +630,24 @@ ${colors.yellow('Arguments:')}`);
630
630
  if (arg.example && !arg.enumValues)
631
631
  meta.push(`e.g. ${arg.example}`);
632
632
  if (meta.length > 0) {
633
- line += ` ${colors.gray(`(${meta.join(', ')})`)}`;
633
+ line += ` ${theme.dimmed(`(${meta.join(', ')})`)}`;
634
634
  }
635
635
  console.log(line);
636
636
  }
637
637
  }
638
638
  if (this.subcommands.length > 0) {
639
639
  console.log(`
640
- ${colors.yellow('Commands:')}`);
640
+ ${theme.header('Commands:')}`);
641
641
  for (const c of this.subcommands) {
642
- console.log(` ${colors.cyan(c.name.padEnd(12))} ${c._description}`);
642
+ console.log(` ${theme.command(c.name.padEnd(12))} ${c._description}`);
643
643
  }
644
644
  }
645
645
  const hasOptions = this.options.length > 0 || this.resolvedOptions.length > 0;
646
646
  if (hasOptions) {
647
647
  console.log(`
648
- ${colors.yellow('Options:')}`);
648
+ ${theme.header('Options:')}`);
649
649
  for (const o of this.options) {
650
- console.log(` ${colors.green(o.flags.padEnd(24))} ${o.description}`);
650
+ console.log(` ${theme.flag(o.flags.padEnd(24))} ${o.description}`);
651
651
  }
652
652
  for (const opt of this.resolvedOptions) {
653
653
  let typeIndicator = '';
@@ -664,9 +664,9 @@ ${colors.yellow('Options:')}`);
664
664
  const flags = parts.join(', ');
665
665
  let desc = opt.description;
666
666
  if (opt.defaultValue !== undefined && !opt.enumValues) {
667
- desc += ` ${colors.gray(`(default: ${opt.defaultValue})`)}`;
667
+ desc += ` ${theme.dimmed(`(default: ${opt.defaultValue})`)}`;
668
668
  }
669
- console.log(` ${colors.green(flags.padEnd(28))} ${desc}`);
669
+ console.log(` ${theme.flag(flags.padEnd(28))} ${desc}`);
670
670
  }
671
671
  }
672
672
  if (this.helpTextAfter) {
@@ -0,0 +1,43 @@
1
+ import colors from '../utils/colors.js';
2
+ type ColorFn = (s: string) => string;
3
+ export type Formatter = Partial<Record<string, ColorFn>>;
4
+ export declare const theme: {
5
+ brand: (s: string) => string;
6
+ version: import("../utils/colors.js").ColorFn;
7
+ header: (s: string) => string;
8
+ text: import("../utils/colors.js").ColorFn;
9
+ muted: import("../utils/colors.js").ColorFn;
10
+ dimmed: (s: string) => string;
11
+ command: import("../utils/colors.js").ColorFn;
12
+ alias: import("../utils/colors.js").ColorFn;
13
+ flag: import("../utils/colors.js").ColorFn;
14
+ type: import("../utils/colors.js").ColorFn;
15
+ positional: import("../utils/colors.js").ColorFn;
16
+ default: (s: string) => string;
17
+ success: import("../utils/colors.js").ColorFn;
18
+ error: import("../utils/colors.js").ColorFn;
19
+ warning: (s: string) => string;
20
+ successBadge: (s: string) => string;
21
+ errorBadge: (s: string) => string;
22
+ warningBadge: (s: string) => string;
23
+ infoBadge: (s: string) => string;
24
+ example: import("../utils/colors.js").ColorFn;
25
+ exampleDesc: import("../utils/colors.js").ColorFn;
26
+ preset: (s: string) => string;
27
+ url: import("../utils/colors.js").ColorFn;
28
+ method: (s: string) => string;
29
+ statusOk: import("../utils/colors.js").ColorFn;
30
+ statusError: import("../utils/colors.js").ColorFn;
31
+ statusRedirect: import("../utils/colors.js").ColorFn;
32
+ };
33
+ export declare const reckerFormatter: Formatter;
34
+ export declare function formatUrl(url: string): string;
35
+ export declare function formatStatus(status: number): string;
36
+ export declare function formatMethod(method: string): string;
37
+ export declare function formatMethodBadge(method: string): string;
38
+ export declare function formatTiming(ms: number): string;
39
+ export declare function formatPreset(preset: string): string;
40
+ export declare function banner(text: string, width?: number): string;
41
+ export declare function formatStatusBadge(status: number): string;
42
+ export { colors };
43
+ export default theme;
@@ -0,0 +1,145 @@
1
+ import colors, { c, gray, red, green, orange, lightOrange, darkOrange, burntOrange, lightGray, mediumGray, } from '../utils/colors.js';
2
+ export const theme = {
3
+ brand: (s) => c.bold(orange(s)),
4
+ version: lightOrange,
5
+ header: (s) => c.bold.white(s),
6
+ text: lightGray,
7
+ muted: mediumGray,
8
+ dimmed: (s) => c.dim.gray(s),
9
+ command: orange,
10
+ alias: gray,
11
+ flag: lightOrange,
12
+ type: burntOrange,
13
+ positional: darkOrange,
14
+ default: (s) => c.dim.gray(s),
15
+ success: green,
16
+ error: red,
17
+ warning: (s) => c.bold(orange(s)),
18
+ successBadge: (s) => c.bgGreen.black.bold(` ${s} `),
19
+ errorBadge: (s) => c.bgRed.white.bold(` ${s} `),
20
+ warningBadge: (s) => c.bgYellow.black.bold(` ${s} `),
21
+ infoBadge: (s) => c.bgBlue.white.bold(` ${s} `),
22
+ example: green,
23
+ exampleDesc: gray,
24
+ preset: (s) => c.bold(lightOrange(s)),
25
+ url: lightOrange,
26
+ method: (s) => c.bold(orange(s)),
27
+ statusOk: green,
28
+ statusError: red,
29
+ statusRedirect: lightOrange,
30
+ };
31
+ export const reckerFormatter = {
32
+ 'section-header': s => c.bold.white(s),
33
+ 'program-name': s => c.bold(orange(s)),
34
+ 'version': s => lightOrange(s),
35
+ 'description': s => lightGray(s),
36
+ 'command-name': s => orange(s),
37
+ 'command-alias': s => gray(s),
38
+ 'command-description': s => lightGray(s),
39
+ 'option-flag': s => lightOrange(s),
40
+ 'option-type': s => burntOrange(s),
41
+ 'option-default': s => c.dim.gray(s),
42
+ 'option-description': s => lightGray(s),
43
+ 'positional-name': s => darkOrange(s),
44
+ 'positional-optional': s => gray(s),
45
+ 'usage-text': s => lightGray(s),
46
+ 'error-header': s => c.bgRed.white.bold(` ${s} `),
47
+ 'error-message': s => red(s),
48
+ 'error-option': s => orange(s),
49
+ 'error-value': s => lightOrange(s),
50
+ 'error-command': s => orange(s),
51
+ 'error-bullet': s => red(s),
52
+ 'text': s => s,
53
+ 'newline': s => s,
54
+ 'indent': s => s,
55
+ };
56
+ export function formatUrl(url) {
57
+ const match = url.match(/^(https?|wss?|ftp|sftp):\/\//);
58
+ if (match) {
59
+ const protocol = match[1];
60
+ const rest = url.slice(match[0].length);
61
+ return `${gray(protocol + '://')}${lightOrange(rest)}`;
62
+ }
63
+ return lightOrange(url);
64
+ }
65
+ export function formatStatus(status) {
66
+ if (status >= 200 && status < 300) {
67
+ return green(String(status));
68
+ }
69
+ else if (status >= 300 && status < 400) {
70
+ return lightOrange(String(status));
71
+ }
72
+ else if (status >= 400) {
73
+ return red(String(status));
74
+ }
75
+ return gray(String(status));
76
+ }
77
+ export function formatMethod(method) {
78
+ const upper = method.toUpperCase();
79
+ switch (upper) {
80
+ case 'GET':
81
+ return green(upper);
82
+ case 'POST':
83
+ return c.bold(orange(upper));
84
+ case 'PUT':
85
+ case 'PATCH':
86
+ return lightOrange(upper);
87
+ case 'DELETE':
88
+ return red(upper);
89
+ default:
90
+ return gray(upper);
91
+ }
92
+ }
93
+ export function formatMethodBadge(method) {
94
+ const upper = method.toUpperCase();
95
+ const text = ` ${upper} `;
96
+ switch (upper) {
97
+ case 'GET':
98
+ return c.bgGreen.black.bold(text);
99
+ case 'POST':
100
+ return c.bgYellow.black.bold(text);
101
+ case 'PUT':
102
+ case 'PATCH':
103
+ return c.bgCyan.black.bold(text);
104
+ case 'DELETE':
105
+ return c.bgRed.white.bold(text);
106
+ default:
107
+ return c.bgGray.white(text);
108
+ }
109
+ }
110
+ export function formatTiming(ms) {
111
+ if (ms < 100) {
112
+ return green(`${ms}ms`);
113
+ }
114
+ else if (ms < 500) {
115
+ return lightOrange(`${ms}ms`);
116
+ }
117
+ else if (ms < 1000) {
118
+ return orange(`${ms}ms`);
119
+ }
120
+ else {
121
+ return red(`${(ms / 1000).toFixed(2)}s`);
122
+ }
123
+ }
124
+ export function formatPreset(preset) {
125
+ return c.bold(lightOrange(`@${preset}`));
126
+ }
127
+ export function banner(text, width = 60) {
128
+ const padding = Math.max(0, Math.floor((width - text.length) / 2));
129
+ return ' '.repeat(padding) + c.bold(orange(text));
130
+ }
131
+ export function formatStatusBadge(status) {
132
+ const text = ` ${status} `;
133
+ if (status >= 200 && status < 300) {
134
+ return c.bgGreen.black.bold(text);
135
+ }
136
+ else if (status >= 300 && status < 400) {
137
+ return c.bgYellow.black.bold(text);
138
+ }
139
+ else if (status >= 400) {
140
+ return c.bgRed.white.bold(text);
141
+ }
142
+ return c.bgGray.white(text);
143
+ }
144
+ export { colors };
145
+ export default theme;
@@ -490,7 +490,7 @@ export async function runHar(ctx, args) {
490
490
  delay,
491
491
  overrideHeaders: headers,
492
492
  onProgress: (progress) => {
493
- process.stdout.write(`\r ${colors.cyan(progress.completed)}/${progress.total} requests completed`);
493
+ process.stdout.write(`\r ${colors.cyan(String(progress.completed))}/${progress.total} requests completed`);
494
494
  },
495
495
  });
496
496
  process.stdout.write('\r' + ' '.repeat(80) + '\r');
@@ -1,44 +1,46 @@
1
- export declare const reset: (s: string) => string;
2
- export declare const bold: (s: string | number) => string;
3
- export declare const black: (s: string | number) => string;
4
- export declare const red: (s: string | number) => string;
5
- export declare const green: (s: string | number) => string;
6
- export declare const yellow: (s: string | number) => string;
7
- export declare const blue: (s: string | number) => string;
8
- export declare const magenta: (s: string | number) => string;
9
- export declare const cyan: (s: string | number) => string;
10
- export declare const white: (s: string | number) => string;
11
- export declare const gray: (s: string | number) => string;
12
- export declare const orange: (s: string | number) => string;
13
- export declare const bgBlack: (s: string | number) => string;
14
- export declare const bgRed: (s: string | number) => string;
15
- export declare const bgGreen: (s: string | number) => string;
16
- export declare const bgYellow: (s: string | number) => string;
17
- export declare const bgBlue: (s: string | number) => string;
18
- export declare const bgMagenta: (s: string | number) => string;
19
- export declare const bgCyan: (s: string | number) => string;
20
- export declare const bgWhite: (s: string | number) => string;
1
+ import { type ColorFn, black, red, green, yellow, blue, magenta, cyan, white, gray, grey, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgGrey, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, strike, rgb, bgRgb, hex, bgHex, ansi256, bgAnsi256, compose, styled, c, stripAnsi, hasAnsi, visibleLength, success, error, warning, info, muted, primary, secondary, supportsColor, supportsTrueColor, getColorLevel, tpl, theme as tuiuiuTheme, tw, styles } from 'tuiuiu.js/colors';
2
+ export { type ColorFn, black, red, green, yellow, blue, magenta, cyan, white, gray, grey, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgGrey, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, strike, rgb, bgRgb, hex, bgHex, ansi256, bgAnsi256, compose, styled, c, stripAnsi, hasAnsi, visibleLength, success, error, warning, info, muted, primary, secondary, supportsColor, supportsTrueColor, getColorLevel, tpl, tuiuiuTheme, tw, styles, };
3
+ export declare const orange: ColorFn;
4
+ export declare const lightOrange: ColorFn;
5
+ export declare const darkOrange: ColorFn;
6
+ export declare const burntOrange: ColorFn;
7
+ export declare const lightGray: ColorFn;
8
+ export declare const mediumGray: ColorFn;
9
+ export declare const orangeBold: ColorFn;
10
+ export declare const whiteBold: (s: string) => string;
11
+ export declare const grayDim: ColorFn;
21
12
  declare const colors: {
22
- reset: (s: string) => string;
23
- bold: (s: string | number) => string;
24
- black: (s: string | number) => string;
25
- red: (s: string | number) => string;
26
- green: (s: string | number) => string;
27
- yellow: (s: string | number) => string;
28
- blue: (s: string | number) => string;
29
- magenta: (s: string | number) => string;
30
- cyan: (s: string | number) => string;
31
- white: (s: string | number) => string;
32
- gray: (s: string | number) => string;
33
- orange: (s: string | number) => string;
34
- bgBlack: (s: string | number) => string;
35
- bgRed: (s: string | number) => string;
36
- bgGreen: (s: string | number) => string;
37
- bgYellow: (s: string | number) => string;
38
- bgBlue: (s: string | number) => string;
39
- bgMagenta: (s: string | number) => string;
40
- bgCyan: (s: string | number) => string;
41
- bgWhite: (s: string | number) => string;
42
- grey: (s: string | number) => string;
13
+ reset: ColorFn;
14
+ bold: ColorFn;
15
+ dim: ColorFn;
16
+ italic: ColorFn;
17
+ underline: ColorFn;
18
+ black: ColorFn;
19
+ red: ColorFn;
20
+ green: ColorFn;
21
+ yellow: ColorFn;
22
+ blue: ColorFn;
23
+ magenta: ColorFn;
24
+ cyan: ColorFn;
25
+ white: ColorFn;
26
+ gray: ColorFn;
27
+ orange: ColorFn;
28
+ lightOrange: ColorFn;
29
+ darkOrange: ColorFn;
30
+ burntOrange: ColorFn;
31
+ lightGray: ColorFn;
32
+ mediumGray: ColorFn;
33
+ orangeBold: ColorFn;
34
+ whiteBold: (s: string) => string;
35
+ grayDim: ColorFn;
36
+ bgBlack: ColorFn;
37
+ bgRed: ColorFn;
38
+ bgGreen: ColorFn;
39
+ bgYellow: ColorFn;
40
+ bgBlue: ColorFn;
41
+ bgMagenta: ColorFn;
42
+ bgCyan: ColorFn;
43
+ bgWhite: ColorFn;
44
+ grey: ColorFn;
43
45
  };
44
46
  export default colors;
@@ -1,52 +1,20 @@
1
- const hasColors = (() => {
2
- if ('NO_COLOR' in process.env)
3
- return false;
4
- if ('FORCE_COLOR' in process.env)
5
- return true;
6
- if (process.env.TERM === 'dumb')
7
- return false;
8
- if (process.stdout?.isTTY)
9
- return true;
10
- if (process.env.CI)
11
- return true;
12
- return false;
13
- })();
14
- const code = (open, close) => {
15
- if (!hasColors)
16
- return (s) => String(s);
17
- const openCode = `\x1b[${open}m`;
18
- const closeCode = `\x1b[${close}m`;
19
- return (s) => {
20
- const str = String(s);
21
- const closeRe = new RegExp(`\\x1b\\[${close}m`, 'g');
22
- return openCode + str.replace(closeRe, openCode) + closeCode;
23
- };
24
- };
25
- export const reset = hasColors ? (s) => `\x1b[0m${s}\x1b[0m` : (s) => s;
26
- export const bold = code(1, 22);
27
- export const black = code(30, 39);
28
- export const red = code(31, 39);
29
- export const green = code(32, 39);
30
- export const yellow = code(33, 39);
31
- export const blue = code(34, 39);
32
- export const magenta = code(35, 39);
33
- export const cyan = code(36, 39);
34
- export const white = code(37, 39);
35
- export const gray = code(90, 39);
36
- export const orange = hasColors
37
- ? (s) => `\x1b[38;5;208m${String(s)}\x1b[39m`
38
- : (s) => String(s);
39
- export const bgBlack = code(40, 49);
40
- export const bgRed = code(41, 49);
41
- export const bgGreen = code(42, 49);
42
- export const bgYellow = code(43, 49);
43
- export const bgBlue = code(44, 49);
44
- export const bgMagenta = code(45, 49);
45
- export const bgCyan = code(46, 49);
46
- export const bgWhite = code(47, 49);
1
+ import { black, red, green, yellow, blue, magenta, cyan, white, gray, grey, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgGrey, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, strike, rgb, bgRgb, hex, bgHex, ansi256, bgAnsi256, compose, styled, c, stripAnsi, hasAnsi, visibleLength, success, error, warning, info, muted, primary, secondary, supportsColor, supportsTrueColor, getColorLevel, tpl, theme as tuiuiuTheme, tw, styles, } from 'tuiuiu.js/colors';
2
+ export { black, red, green, yellow, blue, magenta, cyan, white, gray, grey, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgGrey, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, strike, rgb, bgRgb, hex, bgHex, ansi256, bgAnsi256, compose, styled, c, stripAnsi, hasAnsi, visibleLength, success, error, warning, info, muted, primary, secondary, supportsColor, supportsTrueColor, getColorLevel, tpl, tuiuiuTheme, tw, styles, };
3
+ export const orange = ansi256(208);
4
+ export const lightOrange = ansi256(214);
5
+ export const darkOrange = ansi256(202);
6
+ export const burntOrange = ansi256(166);
7
+ export const lightGray = ansi256(252);
8
+ export const mediumGray = ansi256(245);
9
+ export const orangeBold = compose(orange, bold);
10
+ export const whiteBold = (s) => c.bold.white(s);
11
+ export const grayDim = compose(gray, dim);
47
12
  const colors = {
48
13
  reset,
49
14
  bold,
15
+ dim,
16
+ italic,
17
+ underline,
50
18
  black,
51
19
  red,
52
20
  green,
@@ -57,6 +25,14 @@ const colors = {
57
25
  white,
58
26
  gray,
59
27
  orange,
28
+ lightOrange,
29
+ darkOrange,
30
+ burntOrange,
31
+ lightGray,
32
+ mediumGray,
33
+ orangeBold,
34
+ whiteBold,
35
+ grayDim,
60
36
  bgBlack,
61
37
  bgRed,
62
38
  bgGreen,
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const VERSION = '1.0.66';
1
+ const VERSION = '1.0.67';
2
2
  let _version = null;
3
3
  export async function getVersion() {
4
4
  if (_version)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recker",
3
- "version": "1.0.66",
3
+ "version": "1.0.67",
4
4
  "description": "Multi-Protocol SDK for the AI Era - HTTP, WebSocket, DNS, FTP, SFTP, Telnet, HLS unified with AI providers and MCP tools",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -225,7 +225,7 @@
225
225
  "css-select": "^6.0.0",
226
226
  "fuse.js": "^7.1.0",
227
227
  "he": "^1.2.0",
228
- "tuiuiu.js": "^1.0.50",
228
+ "tuiuiu.js": "^1.0.51",
229
229
  "undici": "^7.18.2",
230
230
  "zod": "^4.3.5"
231
231
  },