movehat 0.1.1 → 0.1.2

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 (71) hide show
  1. package/dist/commands/compile.d.ts +13 -0
  2. package/dist/commands/compile.d.ts.map +1 -1
  3. package/dist/commands/compile.js +31 -11
  4. package/dist/commands/compile.js.map +1 -1
  5. package/dist/commands/fork/create.d.ts +20 -1
  6. package/dist/commands/fork/create.d.ts.map +1 -1
  7. package/dist/commands/fork/create.js +54 -20
  8. package/dist/commands/fork/create.js.map +1 -1
  9. package/dist/commands/fork/list.d.ts +12 -1
  10. package/dist/commands/fork/list.d.ts.map +1 -1
  11. package/dist/commands/fork/list.js +50 -22
  12. package/dist/commands/fork/list.js.map +1 -1
  13. package/dist/commands/init.d.ts +19 -0
  14. package/dist/commands/init.d.ts.map +1 -1
  15. package/dist/commands/init.js +64 -29
  16. package/dist/commands/init.js.map +1 -1
  17. package/dist/commands/update.d.ts +11 -1
  18. package/dist/commands/update.d.ts.map +1 -1
  19. package/dist/commands/update.js +44 -18
  20. package/dist/commands/update.js.map +1 -1
  21. package/dist/helpers/banner.d.ts +17 -0
  22. package/dist/helpers/banner.d.ts.map +1 -1
  23. package/dist/helpers/banner.js +38 -23
  24. package/dist/helpers/banner.js.map +1 -1
  25. package/dist/helpers/version-check.d.ts +12 -1
  26. package/dist/helpers/version-check.d.ts.map +1 -1
  27. package/dist/helpers/version-check.js +17 -7
  28. package/dist/helpers/version-check.js.map +1 -1
  29. package/dist/ui/colors.d.ts +77 -0
  30. package/dist/ui/colors.d.ts.map +1 -0
  31. package/dist/ui/colors.js +121 -0
  32. package/dist/ui/colors.js.map +1 -0
  33. package/dist/ui/formatters.d.ts +171 -0
  34. package/dist/ui/formatters.d.ts.map +1 -0
  35. package/dist/ui/formatters.js +186 -0
  36. package/dist/ui/formatters.js.map +1 -0
  37. package/dist/ui/index.d.ts +58 -0
  38. package/dist/ui/index.d.ts.map +1 -0
  39. package/dist/ui/index.js +60 -0
  40. package/dist/ui/index.js.map +1 -0
  41. package/dist/ui/logger.d.ts +160 -0
  42. package/dist/ui/logger.d.ts.map +1 -0
  43. package/dist/ui/logger.js +206 -0
  44. package/dist/ui/logger.js.map +1 -0
  45. package/dist/ui/spinner.d.ts +106 -0
  46. package/dist/ui/spinner.d.ts.map +1 -0
  47. package/dist/ui/spinner.js +120 -0
  48. package/dist/ui/spinner.js.map +1 -0
  49. package/dist/ui/symbols.d.ts +50 -0
  50. package/dist/ui/symbols.d.ts.map +1 -0
  51. package/dist/ui/symbols.js +64 -0
  52. package/dist/ui/symbols.js.map +1 -0
  53. package/dist/ui/table.d.ts +67 -0
  54. package/dist/ui/table.d.ts.map +1 -0
  55. package/dist/ui/table.js +143 -0
  56. package/dist/ui/table.js.map +1 -0
  57. package/package.json +8 -1
  58. package/src/commands/compile.ts +32 -11
  59. package/src/commands/fork/create.ts +59 -20
  60. package/src/commands/fork/list.ts +52 -22
  61. package/src/commands/init.ts +111 -74
  62. package/src/commands/update.ts +52 -19
  63. package/src/helpers/banner.ts +45 -29
  64. package/src/helpers/version-check.ts +20 -8
  65. package/src/ui/colors.ts +141 -0
  66. package/src/ui/formatters.ts +246 -0
  67. package/src/ui/index.ts +62 -0
  68. package/src/ui/logger.ts +226 -0
  69. package/src/ui/spinner.ts +171 -0
  70. package/src/ui/symbols.ts +74 -0
  71. package/src/ui/table.ts +191 -0
@@ -0,0 +1,206 @@
1
+ import { colors } from './colors.js';
2
+ import { coloredSymbol, symbols } from './symbols.js';
3
+ /**
4
+ * Internal logger state
5
+ */
6
+ let config = {
7
+ silent: false,
8
+ level: 'info',
9
+ timestamp: false,
10
+ };
11
+ /**
12
+ * Configure logger globally
13
+ *
14
+ * @param newConfig - Partial configuration to merge with current config
15
+ *
16
+ * @example
17
+ * // Silence all logs for testing
18
+ * configureLogger({ silent: true });
19
+ *
20
+ * // Enable timestamps
21
+ * configureLogger({ timestamp: true });
22
+ */
23
+ export const configureLogger = (newConfig) => {
24
+ config = { ...config, ...newConfig };
25
+ };
26
+ /**
27
+ * Format message with optional indentation
28
+ */
29
+ const formatMessage = (message, indent = 0) => {
30
+ const prefix = ' '.repeat(indent);
31
+ return message.split('\n').map(line => prefix + line).join('\n');
32
+ };
33
+ /**
34
+ * Info message (cyan)
35
+ * Use for general information and status updates
36
+ *
37
+ * @param message - Message to log
38
+ * @param indent - Number of spaces to indent (default: 0)
39
+ *
40
+ * @example
41
+ * logger.info('Starting compilation...');
42
+ * logger.info('Network: testnet', 2);
43
+ */
44
+ export const info = (message, indent = 0) => {
45
+ if (config.silent)
46
+ return;
47
+ const formatted = formatMessage(message, indent);
48
+ console.log(`${coloredSymbol('info')} ${formatted}`);
49
+ };
50
+ /**
51
+ * Success message (green)
52
+ * Use for completed operations and positive outcomes
53
+ *
54
+ * @param message - Message to log
55
+ * @param indent - Number of spaces to indent (default: 0)
56
+ *
57
+ * @example
58
+ * logger.success('Compilation finished!');
59
+ * logger.success('All tests passed', 2);
60
+ */
61
+ export const success = (message, indent = 0) => {
62
+ if (config.silent)
63
+ return;
64
+ const formatted = formatMessage(message, indent);
65
+ console.log(`${coloredSymbol('success')} ${formatted}`);
66
+ };
67
+ /**
68
+ * Error message (red)
69
+ * Use for errors and failures
70
+ *
71
+ * @param message - Message to log
72
+ * @param indent - Number of spaces to indent (default: 0)
73
+ *
74
+ * @example
75
+ * logger.error('Compilation failed');
76
+ * logger.error('File not found: config.ts', 2);
77
+ */
78
+ export const error = (message, indent = 0) => {
79
+ if (config.silent)
80
+ return;
81
+ const formatted = formatMessage(message, indent);
82
+ console.error(`${coloredSymbol('error')} ${formatted}`);
83
+ };
84
+ /**
85
+ * Warning message (yellow)
86
+ * Use for warnings and deprecated features
87
+ *
88
+ * @param message - Message to log
89
+ * @param indent - Number of spaces to indent (default: 0)
90
+ *
91
+ * @example
92
+ * logger.warning('Deprecated API used');
93
+ * logger.warning('This feature will be removed in v2.0', 2);
94
+ */
95
+ export const warning = (message, indent = 0) => {
96
+ if (config.silent)
97
+ return;
98
+ const formatted = formatMessage(message, indent);
99
+ console.warn(`${coloredSymbol('warning')} ${formatted}`);
100
+ };
101
+ /**
102
+ * Plain message without symbol
103
+ * Use for continuation lines or when symbol is not appropriate
104
+ *
105
+ * @param message - Message to log
106
+ *
107
+ * @example
108
+ * logger.info('Fork Details:');
109
+ * logger.plain(' Chain ID: 126');
110
+ * logger.plain(' Network: testnet');
111
+ */
112
+ export const plain = (message) => {
113
+ if (config.silent)
114
+ return;
115
+ console.log(message);
116
+ };
117
+ /**
118
+ * Empty line
119
+ * Use for visual spacing between sections
120
+ *
121
+ * @example
122
+ * logger.success('Build complete');
123
+ * logger.newline();
124
+ * logger.info('Next steps:');
125
+ */
126
+ export const newline = () => {
127
+ if (config.silent)
128
+ return;
129
+ console.log();
130
+ };
131
+ /**
132
+ * Section header (bold, brand color)
133
+ * Use for major section dividers
134
+ *
135
+ * @param title - Section title
136
+ *
137
+ * @example
138
+ * logger.section('Fork Details');
139
+ * logger.kv('Chain ID', '126', 2);
140
+ * logger.kv('Network', 'testnet', 2);
141
+ */
142
+ export const section = (title) => {
143
+ if (config.silent)
144
+ return;
145
+ console.log(`\n${colors.brandBright(title)}`);
146
+ };
147
+ /**
148
+ * Key-value pair
149
+ * Use for displaying structured data
150
+ *
151
+ * @param key - The key/label
152
+ * @param value - The value
153
+ * @param indent - Number of spaces to indent (default: 0)
154
+ *
155
+ * @example
156
+ * logger.kv('Network', 'testnet', 2);
157
+ * logger.kv('Chain ID', '126', 2);
158
+ */
159
+ export const kv = (key, value, indent = 0) => {
160
+ if (config.silent)
161
+ return;
162
+ const prefix = ' '.repeat(indent);
163
+ console.log(`${prefix}${colors.dim(key)}: ${value}`);
164
+ };
165
+ /**
166
+ * List item with bullet
167
+ * Use for lists and enumerated items
168
+ *
169
+ * @param text - Item text
170
+ * @param indent - Number of spaces to indent (default: 0)
171
+ *
172
+ * @example
173
+ * logger.info('Next steps:');
174
+ * logger.item('cd my-project', 2);
175
+ * logger.item('npm install', 2);
176
+ * logger.item('npm test', 2);
177
+ */
178
+ export const item = (text, indent = 0) => {
179
+ if (config.silent)
180
+ return;
181
+ const prefix = ' '.repeat(indent);
182
+ console.log(`${prefix}${symbols.bullet} ${text}`);
183
+ };
184
+ /**
185
+ * Logger namespace export
186
+ * Provides all logging functions in a single namespace
187
+ *
188
+ * @example
189
+ * import { logger } from './ui/index.js';
190
+ *
191
+ * logger.info('Starting...');
192
+ * logger.success('Done!');
193
+ */
194
+ export const logger = {
195
+ configure: configureLogger,
196
+ info,
197
+ success,
198
+ error,
199
+ warning,
200
+ plain,
201
+ newline,
202
+ section,
203
+ kv,
204
+ item,
205
+ };
206
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/ui/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAmBtD;;GAEG;AACH,IAAI,MAAM,GAAiB;IACzB,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,KAAK;CACjB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAgC,EAAQ,EAAE;IACxE,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,SAAiB,CAAC,EAAU,EAAE;IACpE,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE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IAClC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,SAAS,EAAE,eAAe;IAC1B,IAAI;IACJ,OAAO;IACP,KAAK;IACL,OAAO;IACP,KAAK;IACL,OAAO;IACP,OAAO;IACP,EAAE;IACF,IAAI;CACL,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { type Ora, type Options as OraOptions } from 'ora';
2
+ /**
3
+ * Spinner color options
4
+ */
5
+ export type SpinnerColor = 'yellow' | 'green' | 'cyan' | 'red' | 'blue' | 'magenta' | 'white' | 'gray';
6
+ /**
7
+ * Spinner configuration options
8
+ */
9
+ export interface SpinnerOptions {
10
+ /** Text to display next to the spinner */
11
+ text: string;
12
+ /** Spinner color (default: 'yellow' for Movehat brand) */
13
+ color?: SpinnerColor;
14
+ /** Spinner animation type (default: 'dots') */
15
+ spinner?: OraOptions['spinner'];
16
+ /** Number of spaces to indent (default: 0) */
17
+ indent?: number;
18
+ }
19
+ /**
20
+ * Create and start a spinner
21
+ * Automatically disabled in non-TTY environments (CI, pipes)
22
+ *
23
+ * @param options - Spinner configuration
24
+ * @returns Ora spinner instance
25
+ *
26
+ * @example
27
+ * const spin = spinner({ text: 'Compiling contracts...' });
28
+ * await longRunningTask();
29
+ * spin.succeed('Compilation complete!');
30
+ *
31
+ * @example
32
+ * const spin = spinner({ text: 'Fetching data...', color: 'cyan' });
33
+ * try {
34
+ * await fetchData();
35
+ * spin.succeed('Data fetched!');
36
+ * } catch (error) {
37
+ * spin.fail('Failed to fetch data');
38
+ * }
39
+ */
40
+ export declare const spinner: (options: SpinnerOptions) => Ora;
41
+ /**
42
+ * Execute async task with spinner
43
+ * Handles success/error automatically and always cleans up
44
+ *
45
+ * @param startText - Initial spinner text
46
+ * @param task - Async function to execute
47
+ * @param successText - Text to show on success (optional, defaults to startText without '...')
48
+ * @param errorText - Text to show on error (optional, defaults to error message)
49
+ * @param indent - Number of spaces to indent (default: 0)
50
+ * @returns Promise resolving to task result
51
+ *
52
+ * @example
53
+ * const data = await withSpinner(
54
+ * 'Fetching network data...',
55
+ * async () => await fetchData(),
56
+ * 'Data fetched successfully'
57
+ * );
58
+ *
59
+ * @example
60
+ * await withSpinner(
61
+ * 'Creating fork...',
62
+ * async () => await createFork(),
63
+ * 'Fork created!',
64
+ * 'Failed to create fork'
65
+ * );
66
+ */
67
+ export declare const withSpinner: <T>(startText: string, task: () => Promise<T>, successText?: string, errorText?: string, indent?: number) => Promise<T>;
68
+ /**
69
+ * Spinner chain for sequential operations
70
+ * Manages multiple spinners in sequence
71
+ */
72
+ export interface SpinnerChain {
73
+ /**
74
+ * Add and execute a step in the chain
75
+ */
76
+ add<T>(text: string, task: () => Promise<T>, indent?: number): Promise<T>;
77
+ /**
78
+ * Complete the chain (cleanup)
79
+ */
80
+ complete(): void;
81
+ }
82
+ /**
83
+ * Create a sequential spinner chain
84
+ * Useful for multi-step processes like initialization
85
+ *
86
+ * @returns SpinnerChain interface
87
+ *
88
+ * @example
89
+ * const steps = createSpinnerChain();
90
+ *
91
+ * await steps.add('Creating directories...', async () => {
92
+ * await mkdir(projectPath);
93
+ * });
94
+ *
95
+ * await steps.add('Copying templates...', async () => {
96
+ * await copyFiles();
97
+ * });
98
+ *
99
+ * await steps.add('Installing dependencies...', async () => {
100
+ * await npmInstall();
101
+ * });
102
+ *
103
+ * steps.complete();
104
+ */
105
+ export declare const createSpinnerChain: () => SpinnerChain;
106
+ //# sourceMappingURL=spinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/ui/spinner.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,KAAK,GAAG,EAAE,KAAK,OAAO,IAAI,UAAU,EAAE,MAAM,KAAK,CAAC;AAGhE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEvG;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAChC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,OAAO,GAAI,SAAS,cAAc,KAAG,GAcjD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,EACjC,WAAW,MAAM,EACjB,MAAM,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,cAAc,MAAM,EACpB,YAAY,MAAM,EAClB,SAAQ,MAAU,KACjB,OAAO,CAAC,CAAC,CAYX,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAE1E;;OAEG;IACH,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,kBAAkB,QAAO,YA0BrC,CAAC"}
@@ -0,0 +1,120 @@
1
+ import ora from 'ora';
2
+ import { shouldUseColor } from './colors.js';
3
+ /**
4
+ * Create and start a spinner
5
+ * Automatically disabled in non-TTY environments (CI, pipes)
6
+ *
7
+ * @param options - Spinner configuration
8
+ * @returns Ora spinner instance
9
+ *
10
+ * @example
11
+ * const spin = spinner({ text: 'Compiling contracts...' });
12
+ * await longRunningTask();
13
+ * spin.succeed('Compilation complete!');
14
+ *
15
+ * @example
16
+ * const spin = spinner({ text: 'Fetching data...', color: 'cyan' });
17
+ * try {
18
+ * await fetchData();
19
+ * spin.succeed('Data fetched!');
20
+ * } catch (error) {
21
+ * spin.fail('Failed to fetch data');
22
+ * }
23
+ */
24
+ export const spinner = (options) => {
25
+ const { text, color = 'yellow', spinner = 'dots', indent = 0 } = options;
26
+ const prefixSpaces = ' '.repeat(indent);
27
+ const oraOptions = {
28
+ text: prefixSpaces + text,
29
+ color,
30
+ spinner,
31
+ // Disable spinner if not TTY (CI environments, piped output)
32
+ isEnabled: shouldUseColor() && Boolean(process.stdout.isTTY),
33
+ };
34
+ return ora(oraOptions).start();
35
+ };
36
+ /**
37
+ * Execute async task with spinner
38
+ * Handles success/error automatically and always cleans up
39
+ *
40
+ * @param startText - Initial spinner text
41
+ * @param task - Async function to execute
42
+ * @param successText - Text to show on success (optional, defaults to startText without '...')
43
+ * @param errorText - Text to show on error (optional, defaults to error message)
44
+ * @param indent - Number of spaces to indent (default: 0)
45
+ * @returns Promise resolving to task result
46
+ *
47
+ * @example
48
+ * const data = await withSpinner(
49
+ * 'Fetching network data...',
50
+ * async () => await fetchData(),
51
+ * 'Data fetched successfully'
52
+ * );
53
+ *
54
+ * @example
55
+ * await withSpinner(
56
+ * 'Creating fork...',
57
+ * async () => await createFork(),
58
+ * 'Fork created!',
59
+ * 'Failed to create fork'
60
+ * );
61
+ */
62
+ export const withSpinner = async (startText, task, successText, errorText, indent = 0) => {
63
+ const spin = spinner({ text: startText, indent });
64
+ try {
65
+ const result = await task();
66
+ spin.succeed(successText || startText.replace(/\.\.\.?$/, ''));
67
+ return result;
68
+ }
69
+ catch (error) {
70
+ const errMsg = error instanceof Error ? error.message : String(error);
71
+ spin.fail(errorText || `Failed: ${errMsg}`);
72
+ throw error;
73
+ }
74
+ };
75
+ /**
76
+ * Create a sequential spinner chain
77
+ * Useful for multi-step processes like initialization
78
+ *
79
+ * @returns SpinnerChain interface
80
+ *
81
+ * @example
82
+ * const steps = createSpinnerChain();
83
+ *
84
+ * await steps.add('Creating directories...', async () => {
85
+ * await mkdir(projectPath);
86
+ * });
87
+ *
88
+ * await steps.add('Copying templates...', async () => {
89
+ * await copyFiles();
90
+ * });
91
+ *
92
+ * await steps.add('Installing dependencies...', async () => {
93
+ * await npmInstall();
94
+ * });
95
+ *
96
+ * steps.complete();
97
+ */
98
+ export const createSpinnerChain = () => {
99
+ let currentSpinner = null;
100
+ return {
101
+ async add(text, task, indent = 0) {
102
+ currentSpinner = spinner({ text, indent });
103
+ try {
104
+ const result = await task();
105
+ currentSpinner.succeed();
106
+ return result;
107
+ }
108
+ catch (error) {
109
+ currentSpinner.fail();
110
+ throw error;
111
+ }
112
+ },
113
+ complete() {
114
+ if (currentSpinner) {
115
+ currentSpinner.stop();
116
+ }
117
+ },
118
+ };
119
+ };
120
+ //# sourceMappingURL=spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/ui/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,GAA6C,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAqB7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAuB,EAAO,EAAE;IACtD,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;IAEzE,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAExC,MAAM,UAAU,GAAe;QAC7B,IAAI,EAAE,YAAY,GAAG,IAAI;QACzB,KAAK;QACL,OAAO;QACP,6DAA6D;QAC7D,SAAS,EAAE,cAAc,EAAE,IAAI,OAAO,CAAC,OAAO,C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O,EAAE,CAAC;gBACzB,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,cAAc,CAAC,IAAI,EAAE,CAAC;gBACtB,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QAED,QAAQ;YACN,IAAI,cAAc,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,CAAC;YACxB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Platform-aware symbols using the figures library
3
+ * Automatically falls back to ASCII on unsupported terminals
4
+ *
5
+ * @example
6
+ * console.log(`${symbols.success} Task completed`);
7
+ * console.log(`${symbols.error} Task failed`);
8
+ */
9
+ export declare const symbols: {
10
+ success: string;
11
+ error: string;
12
+ warning: string;
13
+ info: string;
14
+ pointer: string;
15
+ checkboxOn: string;
16
+ checkboxOff: string;
17
+ bullet: string;
18
+ ellipsis: string;
19
+ line: string;
20
+ arrow: string;
21
+ boxTop: string;
22
+ boxBottom: string;
23
+ boxLeft: string;
24
+ boxRight: string;
25
+ boxTopLeft: string;
26
+ boxTopRight: string;
27
+ boxBottomLeft: string;
28
+ boxBottomRight: string;
29
+ check: string;
30
+ cross: string;
31
+ radioOn: string;
32
+ radioOff: string;
33
+ };
34
+ /**
35
+ * Symbol types for colored symbol function
36
+ */
37
+ export type SymbolType = 'success' | 'error' | 'warning' | 'info';
38
+ /**
39
+ * Get a symbol with appropriate semantic color
40
+ * Automatically applies the correct color based on symbol type
41
+ *
42
+ * @param type - The type of symbol ('success', 'error', 'warning', 'info')
43
+ * @returns Colored symbol ready for console output
44
+ *
45
+ * @example
46
+ * console.log(`${coloredSymbol('success')} Build successful`);
47
+ * console.log(`${coloredSymbol('error')} Build failed`);
48
+ */
49
+ export declare const coloredSymbol: (type: SymbolType) => string;
50
+ //# sourceMappingURL=symbols.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../../src/ui/symbols.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAiCnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAElE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,UAAU,KAAG,MAWhD,CAAC"}
@@ -0,0 +1,64 @@
1
+ import figures from 'figures';
2
+ import { colors } from './colors.js';
3
+ /**
4
+ * Platform-aware symbols using the figures library
5
+ * Automatically falls back to ASCII on unsupported terminals
6
+ *
7
+ * @example
8
+ * console.log(`${symbols.success} Task completed`);
9
+ * console.log(`${symbols.error} Task failed`);
10
+ */
11
+ export const symbols = {
12
+ // Status symbols
13
+ success: figures.tick, // ✔ or √
14
+ error: figures.cross, // ✖ or ×
15
+ warning: figures.warning, // ⚠ or ‼
16
+ info: figures.info, // ℹ or i
17
+ // Action symbols
18
+ pointer: figures.pointer, // ❯ or >
19
+ checkboxOn: figures.checkboxOn, // ☑ or [×]
20
+ checkboxOff: figures.checkboxOff, // ☐ or [ ]
21
+ // UI symbols
22
+ bullet: figures.bullet, // ● or *
23
+ ellipsis: figures.ellipsis, // … or ...
24
+ line: figures.line, // ─ or -
25
+ arrow: figures.arrowRight, // → or ->
26
+ // Box drawing characters
27
+ boxTop: '─',
28
+ boxBottom: '─',
29
+ boxLeft: '│',
30
+ boxRight: '│',
31
+ boxTopLeft: '┌',
32
+ boxTopRight: '┐',
33
+ boxBottomLeft: '└',
34
+ boxBottomRight: '┘',
35
+ // Semantic aliases for better code readability
36
+ check: figures.tick,
37
+ cross: figures.cross,
38
+ radioOn: figures.radioOn,
39
+ radioOff: figures.radioOff,
40
+ };
41
+ /**
42
+ * Get a symbol with appropriate semantic color
43
+ * Automatically applies the correct color based on symbol type
44
+ *
45
+ * @param type - The type of symbol ('success', 'error', 'warning', 'info')
46
+ * @returns Colored symbol ready for console output
47
+ *
48
+ * @example
49
+ * console.log(`${coloredSymbol('success')} Build successful`);
50
+ * console.log(`${coloredSymbol('error')} Build failed`);
51
+ */
52
+ export const coloredSymbol = (type) => {
53
+ switch (type) {
54
+ case 'success':
55
+ return colors.success(symbols.success);
56
+ case 'error':
57
+ return colors.error(symbols.error);
58
+ case 'warning':
59
+ return colors.warning(symbols.warning);
60
+ case 'info':
61
+ return colors.info(symbols.info);
62
+ }
63
+ };
64
+ //# sourceMappingURL=symbols.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/ui/symbols.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,iBAAiB;IACjB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAW,SAAS;IACzC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAY,SAAS;IACzC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAQ,SAAS;IACzC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAc,SAAS;IAEzC,iBAAiB;IACjB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAQ,SAAS;IACzC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,WAAW;IAC3C,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW;IAE7C,aAAa;IACb,MAAM,EAAE,OAAO,CAAC,MAAM,EAAU,SAAS;IACzC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAM,WAAW;IAC3C,IAAI,EAAE,OAAO,CAAC,IAAI,EAAc,SAAS;IACzC,KAAK,EAAE,OAAO,CAAC,UAAU,EAAO,UAAU;IAE1C,yBAAyB;IACzB,MAAM,EAAE,GAAG;IACX,SAAS,EAAE,GAAG;IACd,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,GAAG;IACb,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,GAAG;IAChB,aAAa,EAAE,GAAG;IAClB,cAAc,EAAE,GAAG;IAEnB,+CAA+C;IAC/C,KAAK,EAAE,OAAO,CAAC,IAAI;IACnB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,OAAO,EAAE,OAAO,CAAC,OAAO;IACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;CAC3B,CAAC;AAOF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAgB,EAAU,EAAE;IACxD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACzC,KAAK,OAAO;YACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrC,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACzC,KAAK,MAAM;YACT,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,67 @@
1
+ import Table from 'cli-table3';
2
+ /**
3
+ * Table preset types for different use cases
4
+ */
5
+ export type TablePreset = 'default' | 'compact' | 'markdown' | 'borderless';
6
+ /**
7
+ * Column alignment options
8
+ */
9
+ export type Alignment = 'left' | 'center' | 'right';
10
+ /**
11
+ * Table configuration options
12
+ */
13
+ export interface TableConfig {
14
+ /** Column headers */
15
+ head?: string[];
16
+ /** Preset style (default: 'default') */
17
+ preset?: TablePreset;
18
+ /** Column widths (optional) */
19
+ colWidths?: number[];
20
+ /** Column alignments (optional) */
21
+ colAligns?: Alignment[];
22
+ /** Custom style overrides */
23
+ style?: {
24
+ head?: string[];
25
+ border?: string[];
26
+ };
27
+ }
28
+ /**
29
+ * Create a table with preset configuration
30
+ * Wrapper around cli-table3 with Movehat-specific styling
31
+ *
32
+ * @param config - Table configuration
33
+ * @returns cli-table3 Table instance
34
+ *
35
+ * @example
36
+ * const table = createTable({
37
+ * head: ['Name', 'Network', 'Chain ID', 'Accounts'],
38
+ * preset: 'compact'
39
+ * });
40
+ *
41
+ * table.push(['testnet-fork', 'testnet', '126', '5']);
42
+ * table.push(['mainnet-fork', 'mainnet', '1', '3']);
43
+ *
44
+ * console.log(table.toString());
45
+ */
46
+ export declare const createTable: (config?: TableConfig) => Table.Table;
47
+ /**
48
+ * Create a simple key-value table
49
+ * Perfect for displaying metadata and configuration
50
+ *
51
+ * @param data - Object with key-value pairs
52
+ * @param preset - Table preset to use (default: 'borderless')
53
+ * @returns cli-table3 Table instance ready for display
54
+ *
55
+ * @example
56
+ * const metadata = {
57
+ * 'Chain ID': '126',
58
+ * 'Network': 'testnet',
59
+ * 'Ledger Version': '12345',
60
+ * 'Created At': new Date().toLocaleString()
61
+ * };
62
+ *
63
+ * const table = createKVTable(metadata);
64
+ * console.log(table.toString());
65
+ */
66
+ export declare const createKVTable: (data: Record<string, string | number>, preset?: TablePreset) => Table.Table;
67
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/ui/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAG/B;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,wCAAwC;IACxC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,mCAAmC;IACnC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IACxB,6BAA6B;IAC7B,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACH;AAqFD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,GAAI,SAAQ,WAAgB,KAAG,KAAK,CAAC,KAyB5D,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACrC,SAAQ,WAA0B,KACjC,KAAK,CAAC,KAQR,CAAC"}