@stacksjs/cli 0.65.0 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.d.ts CHANGED
@@ -1,100 +1,92 @@
1
- export { isCancel } from "@clack/core";
2
- export interface TextOptions {
3
- message: string;
4
- placeholder?: string;
5
- defaultValue?: string;
6
- initialValue?: string;
7
- validate?: (value: string) => string | void;
1
+ export { isCancel } from '@clack/core'
2
+ declare type State,
3
+ TextPrompt,
4
+ } from '@clack/core'
5
+ declare const unicode: (...args: any[]) => unknown;
6
+ declare const S_BAR_START: unknown;
7
+ declare const S_RADIO_ACTIVE: unknown;
8
+ declare const S_BAR_H: unknown;
9
+ declare function symbol(state: State): void;
10
+ declare interface LimitOptionsParams<TOption> {
11
+ options: TOption[]
12
+ maxItems: number | undefined
13
+ cursor: number
14
+ style: (option: TOption, active: boolean) => string
8
15
  }
9
- export declare function text(opts: TextOptions): Promise<string | symbol>;
10
- export interface PasswordOptions {
11
- message: string;
12
- mask?: string;
13
- validate?: (value: string) => string | void;
16
+ declare function limitOptions<TOption>(params: LimitOptionsParams<TOption>): string[];
17
+ export declare function text(opts: TextOptions): void;
18
+ export declare interface PasswordOptions {
19
+ message: string
20
+ mask?: string
21
+ validate?: (value: string) => string | void
14
22
  }
15
- export declare function password(opts: PasswordOptions): Promise<string | symbol>;
16
- export interface ConfirmOptions {
17
- message: string;
18
- active?: string;
19
- inactive?: string;
20
- initialValue?: boolean;
23
+ export declare function password(opts: PasswordOptions): void;
24
+ export declare interface ConfirmOptions {
25
+ message: string
26
+ active?: string
27
+ inactive?: string
28
+ initialValue?: boolean
21
29
  }
22
- export declare function confirm(opts: ConfirmOptions): Promise<boolean | symbol>;
23
- type Primitive = Readonly<string | boolean | number>;
24
- type Option<Value> = Value extends Primitive ? {
25
- value: Value;
26
- label?: string;
27
- hint?: string;
28
- } : {
29
- value: Value;
30
- label: string;
31
- hint?: string;
32
- };
33
- export interface SelectOptions<Value> {
34
- message: string;
35
- options: Option<Value>[];
36
- initialValue?: Value;
37
- maxItems?: number;
30
+ export declare function confirm(opts: ConfirmOptions): void;
31
+ declare type Primitive = Readonly<string | boolean | number>
32
+
33
+ type Option<Value> = Value extends Primitive
34
+ ? { value: Value, label?: string, hint?: string }
35
+ export declare interface SelectOptions<Value> {
36
+ message: string
37
+ options: Option<Value>[]
38
+ initialValue?: Value
39
+ maxItems?: number
38
40
  }
39
- export declare function select<Value>(opts: SelectOptions<Value>): Promise<Value | symbol>;
40
- export declare function selectKey<Value extends string>(opts: SelectOptions<Value>): Promise<Value | symbol>;
41
- export interface MultiSelectOptions<Value> {
42
- message: string;
43
- options: Option<Value>[];
44
- initialValues?: Value[];
45
- maxItems?: number;
46
- required?: boolean;
47
- cursorAt?: Value;
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 interface MultiSelectOptions<Value> {
44
+ message: string
45
+ options: Option<Value>[]
46
+ initialValues?: Value[]
47
+ maxItems?: number
48
+ required?: boolean
49
+ cursorAt?: Value
48
50
  }
49
- export declare function multiselect<Value>(opts: MultiSelectOptions<Value>): Promise<Value[] | symbol>;
50
- export interface GroupMultiSelectOptions<Value> {
51
- message: string;
52
- options: Record<string, Option<Value>[]>;
53
- initialValues?: Value[];
54
- required?: boolean;
55
- cursorAt?: Value;
51
+ export declare function multiselect<Value>(opts: MultiSelectOptions<Value>): void;
52
+ export declare interface GroupMultiSelectOptions<Value> {
53
+ message: string
54
+ options: Record<string, Option<Value>[]>
55
+ initialValues?: Value[]
56
+ required?: boolean
57
+ cursorAt?: Value
56
58
  }
57
- export declare function groupMultiselect<Value>(opts: GroupMultiSelectOptions<Value>): Promise<Value[] | symbol>;
58
- export declare function note(message?: string, title?: string): void;
59
- export declare function cancel(message?: string): void;
60
- export declare function intro(title?: string): void;
61
- export declare function outro(message?: string): void;
62
- interface Spinner {
63
- start: (msg: string) => void;
64
- stop: (msg: string, code: number) => void;
65
- message: (msg: string) => void;
59
+ export declare function groupMultiselect<Value>(opts: GroupMultiSelectOptions<Value>): void;
60
+ declare const strip: (str: string) => unknown;
61
+ export declare function cancel(message = ''): void;
62
+ export declare function intro(title = ''): void;
63
+ export declare function outro(message = ''): void;
64
+ declare interface Spinner {
65
+ start: (msg: string) => void
66
+ stop: (msg: string, code: number) => void
67
+ message: (msg: string) => void
66
68
  }
67
69
  export declare function spinner(): Spinner;
68
- export type PromptGroupAwaitedReturn<T> = { [P in keyof T] : Exclude<Awaited<T[P]>, symbol> };
69
- export interface PromptGroupOptions<T> {
70
- /**
71
- * Control how the group can be canceled
72
- * if one of the prompts is canceled.
73
- */
74
- onCancel?: (opts: { results: Prettify<Partial<PromptGroupAwaitedReturn<T>>> }) => void;
70
+ declare function ansiRegex(): void;
71
+ export declare type PromptGroupAwaitedReturn<T> = {
72
+ [P in keyof T]: Exclude<Awaited<T[P]>, symbol>
73
+ }
74
+ export declare interface PromptGroupOptions<T> {
75
+ onCancel?: (opts: { results: Prettify<Partial<PromptGroupAwaitedReturn<T>>> }) => void
76
+ }
77
+ declare type Prettify<T> = {
78
+ [P in keyof T]: T[P]
79
+ } & {}
80
+ export declare type PromptGroup<T> = {
81
+ [P in keyof T]: (opts: {
82
+ results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>
83
+ }) => void | Promise<T[P] | void>
75
84
  }
76
- type Prettify<T> = { [P in keyof T] : T[P] } & {};
77
- export type PromptGroup<T> = { [P in keyof T] : (opts: { results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>> }) => void | Promise<T[P] | void> };
78
- /**
79
- * Define a group of prompts to be displayed
80
- * and return a results of objects within the group
81
- */
82
85
  export declare function group<T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>): Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
83
- export interface Task {
84
- /**
85
- * Task title
86
- */
87
- title: string;
88
- /**
89
- * Task function
90
- */
91
- task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
92
- /**
93
- * If enabled === false the task will be skipped
94
- */
95
- enabled?: boolean;
86
+ export declare interface Task {
87
+ title: string
88
+ task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>
89
+
90
+ enabled?: boolean
96
91
  }
97
- /**
98
- * Define a group of tasks to be executed
99
- */
100
- export declare function tasks(tasks: Task[]): Promise<void>;
92
+ export declare function tasks(tasks: Task[]): Promise<void>;
package/dist/cli.d.ts CHANGED
@@ -1,10 +1,14 @@
1
- import { CAC } from "cac";
2
- export interface ParsedArgv {
3
- args: ReadonlyArray<string>;
4
- options: { [k: string]: any };
1
+ import type { CliOptions } from '@stacksjs/types';
2
+ import { CAC } from 'cac';
3
+
4
+ export { CAC }
5
+ export declare interface ParsedArgv {
6
+ args: ReadonlyArray<string>
7
+ options: {
8
+ [k: string]: any
9
+ }
5
10
  }
6
- interface CliOptions {
7
- name?: string;
11
+ declare interface CliOptions {
12
+ name?: string
8
13
  }
9
- export declare function cli(name?: string | CliOptions, options?: CliOptions): CAC;
10
- export { CAC };
14
+ export declare function cli(name?: string | CliOptions, options?: CliOptions): CAC;
package/dist/command.d.ts CHANGED
@@ -1,32 +1,40 @@
1
- import type { Result } from "@stacksjs/error-handling";
2
- import type { CliOptions, Readable, Subprocess, Writable } from "@stacksjs/types";
3
- type CommandOptionTuple = [string, string, { default: boolean }];
1
+ import type { CliOptions, Readable } from '@stacksjs/types';
2
+
3
+ declare type CommandOptionTuple = [string, string, { default: boolean }]
4
4
  interface CommandOptionObject {
5
- name: string;
6
- description: string;
7
- default: boolean | string;
5
+ name: string
6
+ description: string
7
+ default: boolean | string
8
8
  }
9
- type CommandOptions = CommandOptionTuple | CommandOptionObject[];
9
+ declare type CommandOptions = CommandOptionTuple | CommandOptionObject[]
10
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;
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
18
  }
19
19
  export declare class Command {
20
- name: Options["name"];
21
- description: Options["description"];
22
- options: Options["options"];
23
- run: Options["run"];
24
- onFail: Options["onFail"];
25
- onSuccess: Options["onSuccess"];
26
- constructor({ name, description, options, run, onFail, onSuccess }: Options);
20
+ name: Options['name']
21
+ description: Options['description']
22
+ options: Options['options']
23
+ run: Options['run']
24
+ onFail: Options['onFail']
25
+ onSuccess: Options['onSuccess']
26
+
27
+ constructor({ name, description, options, run, onFail, onSuccess }: Options) {
28
+ this.name = name
29
+ this.description = description
30
+ this.options = options
31
+ this.run = run
32
+ this.onFail = onFail
33
+ this.onSuccess = onSuccess
34
+ }
27
35
  }
28
36
  export declare const command: {
29
- run: (command: string, options?: CliOptions) => Promise<Result<Subprocess<Writable, Readable, Readable>, Error>>;
30
- runSync: (command: string, options?: CliOptions) => Promise<Result<Subprocess<Writable, Readable, Readable>, Error>>;
31
- };
32
- export {};
37
+ run: unknown;
38
+ Readable, Readable>, Error>> => {
39
+ return await runCommand: () => unknown
40
+ };
package/dist/console.d.ts CHANGED
@@ -1,3 +1,15 @@
1
- import { log } from "@stacksjs/logging";
2
- import prompts from "prompts";
3
- export { log, prompts };
1
+ import { log } from '@stacksjs/logging';
2
+
3
+ export { log, prompts }
4
+
5
+ export default function terminalLink(text: string, url: string, { target = 'stdout', ...options }: { target?: string, fallback?: boolean | Function }): string {
6
+ if (!supportsHyperlinks[target]) {
7
+ if (options.fallback === false) {
8
+ return text
9
+ }
10
+
11
+ return typeof options.fallback === 'function' ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`
12
+ }
13
+
14
+ return ansiEscapes.link(text, url)
15
+ };
package/dist/exec.d.ts CHANGED
@@ -1,40 +1,5 @@
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
- */
1
+ import type { CliOptions, Subprocess } from '@stacksjs/types';
2
+
23
3
  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
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 CHANGED
@@ -1,9 +1,4 @@
1
- import type { IntroOptions, OutroOptions } from "@stacksjs/types";
2
- /**
3
- * Prints the intro message.
4
- */
1
+ import type { IntroOptions, OutroOptions } from '@stacksjs/types';
2
+
5
3
  export declare function intro(command: string, options?: IntroOptions): Promise<number>;
6
- /**
7
- * Prints the outro message.
8
- */
9
- export declare function outro(text: string, options?: OutroOptions, error?: Error | string): Promise<number>;
4
+ export declare function outro(text: string, options?: OutroOptions, error?: Error | string): Promise<number>;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
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";
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'