@stacksjs/cli 0.70.23 → 0.70.25
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/README.md +2 -2
- package/dist/index.js +884 -23228
- package/dist/src/actions/index.d.ts +1 -0
- package/dist/src/actions/install.d.ts +24 -0
- package/dist/src/cli.d.ts +14 -0
- package/dist/src/exec.d.ts +40 -0
- package/dist/src/helpers.d.ts +14 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/{parse.d.ts → src/parse.d.ts} +14 -9
- package/dist/src/prompts.d.ts +44 -0
- package/dist/src/run.d.ts +63 -0
- package/dist/src/signals.d.ts +29 -0
- package/dist/src/spinner.d.ts +17 -0
- package/dist/src/utils.d.ts +137 -0
- package/package.json +23 -22
- package/dist/app.d.ts +0 -52
- package/dist/cli.d.ts +0 -15
- package/dist/command.d.ts +0 -52
- package/dist/console.d.ts +0 -17
- package/dist/exec.d.ts +0 -5
- package/dist/helpers.d.ts +0 -4
- package/dist/index.d.ts +0 -10
- package/dist/install.d.ts +0 -11
- package/dist/run.d.ts +0 -6
- package/dist/spinner.d.ts +0 -1
- package/dist/utils.d.ts +0 -65
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './install';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install an npm package.
|
|
3
|
+
*
|
|
4
|
+
* @param name - The package name to install.
|
|
5
|
+
* @param options - The options to pass to the install.
|
|
6
|
+
* @returns The result of the install.
|
|
7
|
+
*/
|
|
8
|
+
export declare function installPackage(name: string, options?: InstallPackageOptions): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Install a Stack into your project.
|
|
11
|
+
*
|
|
12
|
+
* @param name - The Stack name to install.
|
|
13
|
+
* @param options - The options to pass to the install.
|
|
14
|
+
* @returns The result of the install.
|
|
15
|
+
*/
|
|
16
|
+
export declare function installStack(name: string, options?: InstallPackageOptions): Promise<void>;
|
|
17
|
+
declare interface InstallPackageOptions {
|
|
18
|
+
cwd?: string
|
|
19
|
+
dev?: boolean
|
|
20
|
+
silent?: boolean
|
|
21
|
+
packageManager?: string
|
|
22
|
+
preferOffline?: boolean
|
|
23
|
+
additionalArgs?: string[]
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CLI, onUnknownSubcommand } from '@stacksjs/clapp';
|
|
2
|
+
export declare function cli(name?: string | CliOptions, options?: CliOptions): CLI;
|
|
3
|
+
// Note: applyTheme and getAvailableThemes will be available after @stacksjs/clapp npm package is updated
|
|
4
|
+
// import { applyTheme, getAvailableThemes } from '@stacksjs/clapp'
|
|
5
|
+
export declare interface ParsedArgv {
|
|
6
|
+
args: ReadonlyArray<string>
|
|
7
|
+
options: {
|
|
8
|
+
[k: string]: any
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
declare interface CliOptions {
|
|
12
|
+
name?: string
|
|
13
|
+
}
|
|
14
|
+
export { CLI, onUnknownSubcommand };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CliOptions, Subprocess } from '@stacksjs/types';
|
|
2
|
+
import type { Result } from '@stacksjs/error-handling';
|
|
3
|
+
/**
|
|
4
|
+
* Execute a command.
|
|
5
|
+
*
|
|
6
|
+
* @param command The command to execute.
|
|
7
|
+
* @param options The options to pass to the command.
|
|
8
|
+
* @returns The result of the command.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const result = await exec('ls')
|
|
12
|
+
*
|
|
13
|
+
* if (result.isErr)
|
|
14
|
+
* console.error(result.error)
|
|
15
|
+
* else
|
|
16
|
+
* console.log(result)
|
|
17
|
+
* ```
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const result = await exec('ls', { cwd: '/home' })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function exec(command: string | string[], options?: CliOptions): Promise<Result<Subprocess, Error>>;
|
|
24
|
+
/**
|
|
25
|
+
* Execute a command and return result.
|
|
26
|
+
*
|
|
27
|
+
* @param command The command to execute.
|
|
28
|
+
* @returns The result of the command.
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const output = execSync('ls')
|
|
32
|
+
*
|
|
33
|
+
* console.log(output)
|
|
34
|
+
* ```
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const output = execSync('ls', { cwd: '/home' })
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function execSync(command: string | string[], options?: CliOptions): Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { bold, cyan, dim, gray, green, italic } from './utils';
|
|
2
|
+
import { log } from '@stacksjs/logging';
|
|
3
|
+
import type { IntroOptions, OutroOptions } from '@stacksjs/types';
|
|
4
|
+
/**
|
|
5
|
+
* Prints the intro message.
|
|
6
|
+
*/
|
|
7
|
+
export declare function intro(command: string, options?: IntroOptions): Promise<number>;
|
|
8
|
+
/**
|
|
9
|
+
* Prints the outro message.
|
|
10
|
+
*/
|
|
11
|
+
export declare function outro(text: string, options?: OutroOptions, error?: Error | string): Promise<number>;
|
|
12
|
+
// Re-export commonly used CLI utilities
|
|
13
|
+
export { log };
|
|
14
|
+
export { italic, bold, cyan, dim, gray, green } from './utils';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './actions';
|
|
2
|
+
export * from './cli';
|
|
3
|
+
export * from './exec';
|
|
4
|
+
export * from './helpers';
|
|
5
|
+
export * from './parse';
|
|
6
|
+
export * from './prompts';
|
|
7
|
+
export * from './run';
|
|
8
|
+
export * from './signals';
|
|
9
|
+
export * from './spinner';
|
|
10
|
+
export * from './utils';
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
export declare function parseArgv(argv?: string[]): ParsedArgv;
|
|
2
|
+
export declare function parseArgs(argv?: string[]): string[];
|
|
3
|
+
export declare function parseOptions(options?: CliOptions): CliOptions;
|
|
4
|
+
// interface BuddyOptions {
|
|
5
|
+
// dryRun?: boolean
|
|
6
|
+
// verbose?: boolean
|
|
7
|
+
// }
|
|
8
|
+
export declare function buddyOptions(options?: string[] | Record<string, any>): string;
|
|
1
9
|
declare interface ParsedArgv {
|
|
2
10
|
args: string[]
|
|
3
11
|
options: {
|
|
4
12
|
[k: string]: string | boolean | number
|
|
5
13
|
}
|
|
6
14
|
}
|
|
7
|
-
declare
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare function parseArgs(argv?: string[]): string[];
|
|
14
|
-
export declare function parseOptions(options?: CliOptions): CliOptions;
|
|
15
|
-
export declare function buddyOptions(options?: string[] | Record<string, any>): string;
|
|
15
|
+
declare interface CliOptions {
|
|
16
|
+
dryRun?: boolean
|
|
17
|
+
quiet?: boolean
|
|
18
|
+
verbose?: boolean
|
|
19
|
+
[k: string]: string | boolean | number | undefined
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple confirm prompt
|
|
3
|
+
*/
|
|
4
|
+
declare function confirm(options: ConfirmOptions | string): Promise<boolean>;
|
|
5
|
+
/**
|
|
6
|
+
* Simple text prompt
|
|
7
|
+
*/
|
|
8
|
+
declare function text(options: TextOptions | string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Simple select prompt (basic implementation)
|
|
11
|
+
*/
|
|
12
|
+
declare function select(options: SelectOptions): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Multiselect prompt (basic implementation)
|
|
15
|
+
*/
|
|
16
|
+
declare function multiselect(options: SelectOptions): Promise<any[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Password prompt (hidden input)
|
|
19
|
+
*/
|
|
20
|
+
declare function password(options: PasswordOptions | string): Promise<string>;
|
|
21
|
+
export declare const prompts: {
|
|
22
|
+
|
|
23
|
+
};
|
|
24
|
+
declare interface ConfirmOptions {
|
|
25
|
+
message: string
|
|
26
|
+
initial?: boolean
|
|
27
|
+
}
|
|
28
|
+
declare interface TextOptions {
|
|
29
|
+
message: string
|
|
30
|
+
initial?: string
|
|
31
|
+
placeholder?: string
|
|
32
|
+
validate?: (value: string) => boolean | string
|
|
33
|
+
}
|
|
34
|
+
declare interface PasswordOptions {
|
|
35
|
+
message: string
|
|
36
|
+
validate?: (value: string) => boolean | string
|
|
37
|
+
}
|
|
38
|
+
declare interface SelectOptions {
|
|
39
|
+
message: string
|
|
40
|
+
choices: Array<{ value: any, label: string }>
|
|
41
|
+
initial?: number
|
|
42
|
+
}
|
|
43
|
+
// Also export individual functions
|
|
44
|
+
export { confirm, text, select, multiselect, password };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { CliOptions, CommandError, Readable, Subprocess, Writable } from '@stacksjs/types';
|
|
2
|
+
import type { Ok, Result } from '@stacksjs/error-handling';
|
|
3
|
+
/**
|
|
4
|
+
* Run a command.
|
|
5
|
+
*
|
|
6
|
+
* @param command The command to run.
|
|
7
|
+
* @param options The options to pass to the command.
|
|
8
|
+
* @returns The result of the command.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const result = await runCommand('ls')
|
|
12
|
+
*
|
|
13
|
+
* if (result.isErr)
|
|
14
|
+
* console.error(result.error)
|
|
15
|
+
* else
|
|
16
|
+
* console.log(result)
|
|
17
|
+
* ```
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const result = await runCommand('ls', { cwd: '/home' })
|
|
21
|
+
*
|
|
22
|
+
* if (result.isErr)
|
|
23
|
+
* console.error(result.error)
|
|
24
|
+
* else
|
|
25
|
+
* console.log(result)
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function runCommand(command: string, options?: CliOptions): Promise<Result<Subprocess, CommandError>>;
|
|
29
|
+
export declare function runProcess(command: string, options?: CliOptions): Promise<Result<Subprocess, CommandError>>;
|
|
30
|
+
/**
|
|
31
|
+
* Run a command.
|
|
32
|
+
*
|
|
33
|
+
* @param command The command to run.
|
|
34
|
+
* @param options The options to pass to the command.
|
|
35
|
+
* @returns The result of the command.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const result = runCommandSync('ls')
|
|
39
|
+
*
|
|
40
|
+
* if (result.isErr)
|
|
41
|
+
* console.error(result.error)
|
|
42
|
+
* else
|
|
43
|
+
* console.log(result)
|
|
44
|
+
* ```
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const result = runCommandSync('ls', { cwd: '/home' })
|
|
48
|
+
*
|
|
49
|
+
* if (result.isErr)
|
|
50
|
+
* console.error(result.error)
|
|
51
|
+
* else
|
|
52
|
+
* console.log(result)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function runCommandSync(command: string, options?: CliOptions): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Run many commands.
|
|
58
|
+
*
|
|
59
|
+
* @param commands The command to run.
|
|
60
|
+
* @param options The options to pass to the command.
|
|
61
|
+
* @returns The result of the command.
|
|
62
|
+
*/
|
|
63
|
+
export declare function runCommands(commands: string[], options?: CliOptions): Promise<Ok<Subprocess<Writable, Readable, Readable>, Error>[]>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register or replace the cleanup for `name`. Returns a disposer that
|
|
3
|
+
* un-registers this specific cleanup; useful in tests to avoid leaking
|
|
4
|
+
* across spec files.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { onSignal } from '@stacksjs/cli'
|
|
9
|
+
*
|
|
10
|
+
* const dispose = onSignal('queue-worker', async () => {
|
|
11
|
+
* await worker.drain()
|
|
12
|
+
* })
|
|
13
|
+
*
|
|
14
|
+
* // Later, if the worker stops on its own:
|
|
15
|
+
* dispose()
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function onSignal(name: string, cleanup: () => void | Promise<void>): () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Drop a registered handler by name. Equivalent to invoking the disposer
|
|
21
|
+
* returned by `onSignal`, but useful when the disposer wasn't kept.
|
|
22
|
+
*/
|
|
23
|
+
export declare function offSignal(name: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Snapshot of currently-registered handler names — primarily for tests
|
|
26
|
+
* that want to assert cleanup wiring is in place.
|
|
27
|
+
*/
|
|
28
|
+
export declare function listSignalHandlers(): string[];
|
|
29
|
+
declare type Signal = 'SIGINT' | 'SIGTERM' | 'SIGHUP';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function spinner(message?: string): Spinner;
|
|
2
|
+
/**
|
|
3
|
+
* Run an async operation with a spinner
|
|
4
|
+
*/
|
|
5
|
+
export declare function withSpinner<T>(message: string, operation: () => Promise<T>, options?: { successMessage?: string; failMessage?: string }): Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Spinner utilities for CLI with reactive terminal output
|
|
8
|
+
*/
|
|
9
|
+
export declare interface Spinner {
|
|
10
|
+
start: (message?: string) => void
|
|
11
|
+
stop: (message?: string) => void
|
|
12
|
+
succeed: (message?: string) => void
|
|
13
|
+
fail: (message?: string) => void
|
|
14
|
+
update: (message: string) => void
|
|
15
|
+
text: string
|
|
16
|
+
isSpinning: boolean
|
|
17
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export declare function stripAnsi(text: string): string;
|
|
2
|
+
export declare function ansi256(code: number): ColorFn;
|
|
3
|
+
export declare function ansi256Bg(code: number): ColorFn;
|
|
4
|
+
export declare function trueColor(r: number, g: number, b: number): ColorFn;
|
|
5
|
+
export declare function trueColorBg(r: number, g: number, b: number): ColorFn;
|
|
6
|
+
export declare function link(url: string): ColorFn;
|
|
7
|
+
export declare function link(text: ColorInput, url: string): string;
|
|
8
|
+
export declare function getColor(colorName: string): ColorFn;
|
|
9
|
+
export declare function colorize(text: ColorInput, colorOrFn: ColorLike): string;
|
|
10
|
+
declare function supportsColor(): boolean;
|
|
11
|
+
export declare function align(text: string, width?: number, alignMode?: Alignment): string;
|
|
12
|
+
export declare function align(text: string, options?: AlignOptions): string;
|
|
13
|
+
export declare function leftAlign(text: string, width?: number): string;
|
|
14
|
+
export declare function rightAlign(text: string, width?: number): string;
|
|
15
|
+
export declare function centerAlign(text: string, width?: number): string;
|
|
16
|
+
export declare function box(text: string, options?: BoxOptions): string;
|
|
17
|
+
export declare const stripColors: typeof stripAnsi;
|
|
18
|
+
export declare const black: ColorFn;
|
|
19
|
+
export declare const red: ColorFn;
|
|
20
|
+
export declare const green: ColorFn;
|
|
21
|
+
export declare const yellow: ColorFn;
|
|
22
|
+
export declare const blue: ColorFn;
|
|
23
|
+
export declare const magenta: ColorFn;
|
|
24
|
+
export declare const cyan: ColorFn;
|
|
25
|
+
export declare const white: ColorFn;
|
|
26
|
+
export declare const gray: ColorFn;
|
|
27
|
+
export declare const lightRed: ColorFn;
|
|
28
|
+
export declare const lightGreen: ColorFn;
|
|
29
|
+
export declare const lightYellow: ColorFn;
|
|
30
|
+
export declare const lightBlue: ColorFn;
|
|
31
|
+
export declare const lightMagenta: ColorFn;
|
|
32
|
+
export declare const lightCyan: ColorFn;
|
|
33
|
+
export declare const lightGray: ColorFn;
|
|
34
|
+
export declare const bgBlack: ColorFn;
|
|
35
|
+
export declare const bgRed: ColorFn;
|
|
36
|
+
export declare const bgGreen: ColorFn;
|
|
37
|
+
export declare const bgYellow: ColorFn;
|
|
38
|
+
export declare const bgBlue: ColorFn;
|
|
39
|
+
export declare const bgMagenta: ColorFn;
|
|
40
|
+
export declare const bgCyan: ColorFn;
|
|
41
|
+
export declare const bgWhite: ColorFn;
|
|
42
|
+
export declare const bgGray: ColorFn;
|
|
43
|
+
export declare const bgLightRed: ColorFn;
|
|
44
|
+
export declare const bgLightGreen: ColorFn;
|
|
45
|
+
export declare const bgLightYellow: ColorFn;
|
|
46
|
+
export declare const bgLightBlue: ColorFn;
|
|
47
|
+
export declare const bgLightMagenta: ColorFn;
|
|
48
|
+
export declare const bgLightCyan: ColorFn;
|
|
49
|
+
export declare const bgLightGray: ColorFn;
|
|
50
|
+
export declare const bold: ColorFn;
|
|
51
|
+
export declare const dim: ColorFn;
|
|
52
|
+
export declare const italic: ColorFn;
|
|
53
|
+
export declare const underline: ColorFn;
|
|
54
|
+
export declare const inverse: ColorFn;
|
|
55
|
+
export declare const hidden: ColorFn;
|
|
56
|
+
export declare const strikethrough: ColorFn;
|
|
57
|
+
export declare const reset: ColorFn;
|
|
58
|
+
export declare const colors: ColorsApi;
|
|
59
|
+
export declare const kolorist: KoloristApi;
|
|
60
|
+
export declare const quotes: any;
|
|
61
|
+
declare interface AlignOptions {
|
|
62
|
+
width?: number
|
|
63
|
+
align?: Alignment
|
|
64
|
+
padChar?: string
|
|
65
|
+
}
|
|
66
|
+
declare interface BoxOptions {
|
|
67
|
+
align?: Alignment
|
|
68
|
+
borderColor?: ColorLike
|
|
69
|
+
borderStyle?: 'single' | 'double' | 'round'
|
|
70
|
+
margin?: number
|
|
71
|
+
padding?: number
|
|
72
|
+
title?: string
|
|
73
|
+
}
|
|
74
|
+
declare type ColorInput = string | number;
|
|
75
|
+
declare type ColorFn = (_text: ColorInput) => string;
|
|
76
|
+
declare type ColorLike = ColorFn | string;
|
|
77
|
+
declare type Alignment = 'left' | 'center' | 'right';
|
|
78
|
+
declare type NamedColorMap = {
|
|
79
|
+
black: ColorFn
|
|
80
|
+
red: ColorFn
|
|
81
|
+
green: ColorFn
|
|
82
|
+
yellow: ColorFn
|
|
83
|
+
blue: ColorFn
|
|
84
|
+
magenta: ColorFn
|
|
85
|
+
cyan: ColorFn
|
|
86
|
+
white: ColorFn
|
|
87
|
+
gray: ColorFn
|
|
88
|
+
|
|
89
|
+
lightRed: ColorFn
|
|
90
|
+
lightGreen: ColorFn
|
|
91
|
+
lightYellow: ColorFn
|
|
92
|
+
lightBlue: ColorFn
|
|
93
|
+
lightMagenta: ColorFn
|
|
94
|
+
lightCyan: ColorFn
|
|
95
|
+
lightGray: ColorFn
|
|
96
|
+
|
|
97
|
+
bgBlack: ColorFn
|
|
98
|
+
bgRed: ColorFn
|
|
99
|
+
bgGreen: ColorFn
|
|
100
|
+
bgYellow: ColorFn
|
|
101
|
+
bgBlue: ColorFn
|
|
102
|
+
bgMagenta: ColorFn
|
|
103
|
+
bgCyan: ColorFn
|
|
104
|
+
bgWhite: ColorFn
|
|
105
|
+
bgGray: ColorFn
|
|
106
|
+
|
|
107
|
+
bgLightRed: ColorFn
|
|
108
|
+
bgLightGreen: ColorFn
|
|
109
|
+
bgLightYellow: ColorFn
|
|
110
|
+
bgLightBlue: ColorFn
|
|
111
|
+
bgLightMagenta: ColorFn
|
|
112
|
+
bgLightCyan: ColorFn
|
|
113
|
+
bgLightGray: ColorFn
|
|
114
|
+
|
|
115
|
+
bold: ColorFn
|
|
116
|
+
dim: ColorFn
|
|
117
|
+
italic: ColorFn
|
|
118
|
+
underline: ColorFn
|
|
119
|
+
inverse: ColorFn
|
|
120
|
+
hidden: ColorFn
|
|
121
|
+
strikethrough: ColorFn
|
|
122
|
+
reset: ColorFn
|
|
123
|
+
}
|
|
124
|
+
declare type ColorsApi = NamedColorMap & {
|
|
125
|
+
ansi256: typeof ansi256
|
|
126
|
+
ansi256Bg: typeof ansi256Bg
|
|
127
|
+
trueColor: typeof trueColor
|
|
128
|
+
trueColorBg: typeof trueColorBg
|
|
129
|
+
link: typeof link
|
|
130
|
+
stripColors: typeof stripColors
|
|
131
|
+
}
|
|
132
|
+
declare type KoloristApi = ColorsApi & {
|
|
133
|
+
grey: ColorFn
|
|
134
|
+
lightGrey: ColorFn
|
|
135
|
+
bgLightGrey: ColorFn
|
|
136
|
+
supportsColor: () => boolean
|
|
137
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
4
|
+
"version": "0.70.25",
|
|
5
5
|
"description": "TypeScript framework for CLI artisans. Build beautiful console apps with ease.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
|
-
"contributors": [
|
|
7
|
+
"contributors": [
|
|
8
|
+
"Chris Breuer <chris@stacksjs.com>"
|
|
9
|
+
],
|
|
8
10
|
"license": "MIT",
|
|
9
11
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
10
12
|
"homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/cli#readme",
|
|
@@ -34,40 +36,39 @@
|
|
|
34
36
|
],
|
|
35
37
|
"exports": {
|
|
36
38
|
".": {
|
|
39
|
+
"bun": "./src/index.ts",
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
37
41
|
"import": "./dist/index.js"
|
|
38
42
|
},
|
|
39
43
|
"./*": {
|
|
44
|
+
"bun": "./src/*",
|
|
40
45
|
"import": "./dist/*"
|
|
41
46
|
}
|
|
42
47
|
},
|
|
43
48
|
"module": "dist/index.js",
|
|
44
49
|
"types": "dist/index.d.ts",
|
|
45
|
-
"files": [
|
|
50
|
+
"files": [
|
|
51
|
+
"README.md",
|
|
52
|
+
"dist"
|
|
53
|
+
],
|
|
46
54
|
"scripts": {
|
|
47
55
|
"build": "bun build.ts",
|
|
48
56
|
"typecheck": "bun tsc --noEmit",
|
|
49
57
|
"test": "bun test",
|
|
50
58
|
"prepublishOnly": "bun run build"
|
|
51
59
|
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@stacksjs/clapp": "^0.2.8"
|
|
62
|
+
},
|
|
52
63
|
"devDependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"
|
|
56
|
-
"@stacksjs/
|
|
57
|
-
"@stacksjs/
|
|
58
|
-
"@stacksjs/
|
|
59
|
-
"@stacksjs/
|
|
60
|
-
"@stacksjs/
|
|
61
|
-
"@stacksjs/
|
|
62
|
-
"@stacksjs/utils": "0.70.22",
|
|
63
|
-
"@stacksjs/validation": "0.70.22",
|
|
64
|
-
"@types/prompts": "^2.4.9",
|
|
65
|
-
"ansi-escapes": "^7.0.0",
|
|
66
|
-
"cac": "^6.7.14",
|
|
67
|
-
"consola": "^3.4.2",
|
|
68
|
-
"kolorist": "1.8.0",
|
|
69
|
-
"ora": "^8.2.0",
|
|
70
|
-
"prompts": "^2.4.2",
|
|
71
|
-
"supports-hyperlinks": "^4.0.0"
|
|
64
|
+
"@stacksjs/collections": "0.70.23",
|
|
65
|
+
"@stacksjs/config": "0.70.23",
|
|
66
|
+
"better-dx": "^0.2.12",
|
|
67
|
+
"@stacksjs/error-handling": "0.70.23",
|
|
68
|
+
"@stacksjs/logging": "0.70.23",
|
|
69
|
+
"@stacksjs/path": "0.70.23",
|
|
70
|
+
"@stacksjs/types": "0.70.23",
|
|
71
|
+
"@stacksjs/utils": "0.70.23",
|
|
72
|
+
"@stacksjs/validation": "0.70.23"
|
|
72
73
|
}
|
|
73
74
|
}
|
package/dist/app.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { State } from '@clack/core';
|
|
2
|
-
|
|
3
|
-
declare const unicode: (...args: any[]) => unknown;
|
|
4
|
-
declare const S_BAR_START: unknown;
|
|
5
|
-
declare const S_RADIO_ACTIVE: unknown;
|
|
6
|
-
declare const S_BAR_H: unknown;
|
|
7
|
-
declare function symbol(state: State): void;
|
|
8
|
-
declare interface LimitOptionsParams<TOption> {
|
|
9
|
-
options: TOption[]
|
|
10
|
-
maxItems: number | undefined
|
|
11
|
-
cursor: number
|
|
12
|
-
style: (option: TOption, active: boolean) => string
|
|
13
|
-
}
|
|
14
|
-
declare function limitOptions<TOption>(params: LimitOptionsParams<TOption>): string[];
|
|
15
|
-
export declare function text(opts: TextOptions): void;
|
|
16
|
-
export declare interface PasswordOptions {
|
|
17
|
-
message: string
|
|
18
|
-
mask?: string
|
|
19
|
-
validate?: (value: string) => string | void
|
|
20
|
-
}
|
|
21
|
-
export declare function password(opts: PasswordOptions): void;
|
|
22
|
-
export declare interface ConfirmOptions {
|
|
23
|
-
message: string
|
|
24
|
-
active?: string
|
|
25
|
-
inactive?: string
|
|
26
|
-
initialValue?: boolean
|
|
27
|
-
}
|
|
28
|
-
export declare function confirm(opts: ConfirmOptions): void;
|
|
29
|
-
declare type Primitive = Readonly<string | boolean | number>
|
|
30
|
-
|
|
31
|
-
type Option<Value> = Value extends Primitive
|
|
32
|
-
? { value: Value, label?: string, hint?: string }
|
|
33
|
-
: { value: Value, label: string, hint?: string }
|
|
34
|
-
|
|
35
|
-
export interface SelectOptions<Value> {
|
|
36
|
-
message: string
|
|
37
|
-
options: Option<Value>[]
|
|
38
|
-
initialValue?: Value
|
|
39
|
-
maxItems?: number
|
|
40
|
-
}
|
|
41
|
-
export declare function select<Value>(opts: SelectOptions<Value>): void;
|
|
42
|
-
export declare function selectKey<Value extends string>(opts: SelectOptions<Value>): void;
|
|
43
|
-
export declare function multiselect<Value>(opts: MultiSelectOptions<Value>): void;
|
|
44
|
-
export declare function groupMultiselect<Value>(opts: GroupMultiSelectOptions<Value>): void;
|
|
45
|
-
export declare function note(message, title): void;
|
|
46
|
-
export declare function cancel(message): void;
|
|
47
|
-
export declare function intro(title): void;
|
|
48
|
-
export declare function outro(message): void;
|
|
49
|
-
export declare function spinner(): Spinner;
|
|
50
|
-
declare function ansiRegex(): void;
|
|
51
|
-
|
|
52
|
-
export { isCancel } from '@clack/core'
|
package/dist/cli.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CliOptions } from '@stacksjs/types';
|
|
2
|
-
import { CAC } from 'cac';
|
|
3
|
-
|
|
4
|
-
export declare interface ParsedArgv {
|
|
5
|
-
args: ReadonlyArray<string>
|
|
6
|
-
options: {
|
|
7
|
-
[k: string]: any
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
declare interface CliOptions {
|
|
11
|
-
name?: string
|
|
12
|
-
}
|
|
13
|
-
export declare function cli(name?: string | CliOptions, options?: CliOptions): CAC;
|
|
14
|
-
|
|
15
|
-
export { CAC }
|
package/dist/command.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { CliOptions, Readable, Subprocess } from '@stacksjs/types';
|
|
2
|
-
|
|
3
|
-
declare type CommandOptionTuple = [string, string, { default: boolean }]
|
|
4
|
-
interface CommandOptionObject {
|
|
5
|
-
name: string
|
|
6
|
-
description: string
|
|
7
|
-
default: boolean | string
|
|
8
|
-
}
|
|
9
|
-
type CommandOptions = CommandOptionTuple | CommandOptionObject[]
|
|
10
|
-
interface Options {
|
|
11
|
-
name: string
|
|
12
|
-
description: string
|
|
13
|
-
active: boolean
|
|
14
|
-
options: CommandOptions
|
|
15
|
-
run: (options?: CliOptions) => Promise<any>
|
|
16
|
-
onFail: (error: Error) => void
|
|
17
|
-
onSuccess: () => void
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class Command {
|
|
21
|
-
name: Options['name']
|
|
22
|
-
description: Options['description']
|
|
23
|
-
options: Options['options']
|
|
24
|
-
run: Options['run']
|
|
25
|
-
onFail: Options['onFail']
|
|
26
|
-
onSuccess: Options['onSuccess']
|
|
27
|
-
|
|
28
|
-
constructor({ name, description, options, run, onFail, onSuccess }: Options) {
|
|
29
|
-
this.name = name
|
|
30
|
-
this.description = description
|
|
31
|
-
this.options = options
|
|
32
|
-
this.run = run
|
|
33
|
-
this.onFail = onFail
|
|
34
|
-
this.onSuccess = onSuccess
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const command = {
|
|
39
|
-
run: async (
|
|
40
|
-
command: string,
|
|
41
|
-
options?: CliOptions,
|
|
42
|
-
): Promise<Result<Subprocess<Writable, Readable, Readable>, Error>> => {
|
|
43
|
-
return await runCommand(command, options)
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
runSync: async (
|
|
47
|
-
command: string,
|
|
48
|
-
options?: CliOptions,
|
|
49
|
-
): Promise<Result<Subprocess<Writable, Readable, Readable>, Error>> => {
|
|
50
|
-
return await runCommand(command, options)
|
|
51
|
-
},
|
|
52
|
-
}
|
package/dist/console.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import prompts from 'prompts';
|
|
2
|
-
import { log } from '@stacksjs/logging';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { log, prompts }
|
|
6
|
-
|
|
7
|
-
export default function terminalLink(text: string, url: string, { target = 'stdout', ...options }: { target?: string, fallback?: boolean | Function }): string {
|
|
8
|
-
if (!supportsHyperlinks[target]) {
|
|
9
|
-
if (options.fallback === false) {
|
|
10
|
-
return text
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return typeof options.fallback === 'function' ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return ansiEscapes.link(text, url)
|
|
17
|
-
};
|
package/dist/exec.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { CliOptions, Subprocess } from '@stacksjs/types';
|
|
2
|
-
|
|
3
|
-
export declare function exec(command: string | string[], options?: CliOptions): Promise<Result<Subprocess, Error>>;
|
|
4
|
-
export declare function execSync(command: string | string[], options?: CliOptions): Promise<string>;
|
|
5
|
-
declare function exitHandler(type: 'spawn' | 'spawnSync', subprocess: Subprocess, exitCode: number | null, signalCode: number | null, error?: Error): void;
|
package/dist/helpers.d.ts
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './actions'
|
|
2
|
-
export * from './cli'
|
|
3
|
-
export * from './command'
|
|
4
|
-
export * from './console'
|
|
5
|
-
export * from './exec'
|
|
6
|
-
export * from './helpers'
|
|
7
|
-
export * from './parse'
|
|
8
|
-
export * from './run'
|
|
9
|
-
export * from './spinner'
|
|
10
|
-
export * from './utils'
|