@agentuity/cli 0.1.11 → 0.1.12
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/auth.d.ts.map +1 -1
- package/dist/auth.js +6 -10
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +89 -41
- package/dist/cli.js.map +1 -1
- package/dist/cmd/auth/login.d.ts.map +1 -1
- package/dist/cmd/auth/login.js +49 -5
- package/dist/cmd/auth/login.js.map +1 -1
- package/dist/cmd/build/patch/_util.d.ts.map +1 -1
- package/dist/cmd/build/patch/_util.js +6 -2
- package/dist/cmd/build/patch/_util.js.map +1 -1
- package/dist/cmd/cloud/agent/get.d.ts.map +1 -1
- package/dist/cmd/cloud/agent/get.js +10 -6
- package/dist/cmd/cloud/agent/get.js.map +1 -1
- package/dist/cmd/cloud/db/create.d.ts.map +1 -1
- package/dist/cmd/cloud/db/create.js +14 -3
- package/dist/cmd/cloud/db/create.js.map +1 -1
- package/dist/cmd/cloud/db/get.d.ts.map +1 -1
- package/dist/cmd/cloud/db/get.js +13 -3
- package/dist/cmd/cloud/db/get.js.map +1 -1
- package/dist/cmd/cloud/db/list.d.ts.map +1 -1
- package/dist/cmd/cloud/db/list.js +17 -25
- package/dist/cmd/cloud/db/list.js.map +1 -1
- package/dist/cmd/cloud/deployment/show.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/show.js +50 -37
- package/dist/cmd/cloud/deployment/show.js.map +1 -1
- package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/create.js +19 -2
- package/dist/cmd/cloud/sandbox/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/get.js +14 -11
- package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +48 -39
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/list.js +6 -1
- package/dist/cmd/cloud/sandbox/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/run.js +5 -1
- package/dist/cmd/cloud/sandbox/run.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +39 -23
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.js +2 -0
- package/dist/cmd/cloud/sandbox/snapshot/generate.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +10 -7
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/session/get.d.ts.map +1 -1
- package/dist/cmd/cloud/session/get.js +24 -23
- package/dist/cmd/cloud/session/get.js.map +1 -1
- package/dist/cmd/cloud/session/list.d.ts.map +1 -1
- package/dist/cmd/cloud/session/list.js +7 -2
- package/dist/cmd/cloud/session/list.js.map +1 -1
- package/dist/cmd/cloud/thread/get.d.ts.map +1 -1
- package/dist/cmd/cloud/thread/get.js +11 -8
- package/dist/cmd/cloud/thread/get.js.map +1 -1
- package/dist/cmd/cloud/thread/list.d.ts.map +1 -1
- package/dist/cmd/cloud/thread/list.js +6 -1
- package/dist/cmd/cloud/thread/list.js.map +1 -1
- package/dist/cmd/dev/file-watcher.d.ts.map +1 -1
- package/dist/cmd/dev/file-watcher.js +2 -0
- package/dist/cmd/dev/file-watcher.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +62 -4
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +15 -1
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/cmd/setup/index.d.ts.map +1 -1
- package/dist/cmd/setup/index.js +40 -3
- package/dist/cmd/setup/index.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -2
- package/dist/config.js.map +1 -1
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +4 -2
- package/dist/steps.js.map +1 -1
- package/dist/tui.d.ts +11 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +47 -12
- package/dist/tui.js.map +1 -1
- package/package.json +6 -6
- package/src/auth.ts +12 -11
- package/src/cli.ts +121 -43
- package/src/cmd/auth/login.ts +57 -5
- package/src/cmd/build/patch/_util.ts +6 -2
- package/src/cmd/cloud/agent/get.ts +14 -6
- package/src/cmd/cloud/db/create.ts +15 -3
- package/src/cmd/cloud/db/get.ts +14 -3
- package/src/cmd/cloud/db/list.ts +16 -26
- package/src/cmd/cloud/deployment/show.ts +53 -47
- package/src/cmd/cloud/sandbox/create.ts +20 -2
- package/src/cmd/cloud/sandbox/execution/get.ts +16 -13
- package/src/cmd/cloud/sandbox/get.ts +48 -38
- package/src/cmd/cloud/sandbox/list.ts +6 -1
- package/src/cmd/cloud/sandbox/run.ts +5 -1
- package/src/cmd/cloud/sandbox/snapshot/build.ts +51 -24
- package/src/cmd/cloud/sandbox/snapshot/generate.ts +2 -0
- package/src/cmd/cloud/sandbox/snapshot/get.ts +11 -7
- package/src/cmd/cloud/session/get.ts +25 -29
- package/src/cmd/cloud/session/list.ts +7 -2
- package/src/cmd/cloud/thread/get.ts +12 -8
- package/src/cmd/cloud/thread/list.ts +6 -1
- package/src/cmd/dev/file-watcher.ts +2 -0
- package/src/cmd/dev/index.ts +76 -4
- package/src/cmd/project/template-flow.ts +15 -1
- package/src/cmd/setup/index.ts +41 -3
- package/src/config.ts +3 -2
- package/src/steps.ts +4 -2
- package/src/tui.ts +61 -12
|
@@ -342,11 +342,25 @@ export async function runCreateFlow(options: CreateFlowOptions): Promise<void> {
|
|
|
342
342
|
}
|
|
343
343
|
switch (choices.db_action) {
|
|
344
344
|
case 'Create New': {
|
|
345
|
+
const dbName = await prompt.text({
|
|
346
|
+
message: 'Database name',
|
|
347
|
+
hint: 'Optional - press Enter to auto-generate',
|
|
348
|
+
});
|
|
349
|
+
const dbDescription = await prompt.text({
|
|
350
|
+
message: 'Database description',
|
|
351
|
+
hint: 'Optional - press Enter to skip',
|
|
352
|
+
});
|
|
345
353
|
const created = await tui.spinner({
|
|
346
354
|
message: 'Provisioning New SQL Database',
|
|
347
355
|
clearOnSuccess: true,
|
|
348
356
|
callback: async () => {
|
|
349
|
-
return createResources(catalystClient, orgId, region!, [
|
|
357
|
+
return createResources(catalystClient, orgId, region!, [
|
|
358
|
+
{
|
|
359
|
+
type: 'db',
|
|
360
|
+
name: dbName || undefined,
|
|
361
|
+
description: dbDescription || undefined,
|
|
362
|
+
},
|
|
363
|
+
]);
|
|
350
364
|
},
|
|
351
365
|
});
|
|
352
366
|
// Collect env vars from newly created resource
|
package/src/cmd/setup/index.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../types';
|
|
3
|
+
import { hasLoggedInBefore } from '../../auth';
|
|
3
4
|
import { showBanner } from '../../banner';
|
|
4
5
|
import * as tui from '../../tui';
|
|
5
6
|
import { getCommand } from '../../command-prefix';
|
|
6
7
|
|
|
8
|
+
const validateToken = /[\d]{7,}\.[\w-_.]{22}/;
|
|
9
|
+
|
|
7
10
|
export const command = createCommand({
|
|
8
11
|
name: 'setup',
|
|
9
12
|
description: 'Display first-run setup information (internal use)',
|
|
@@ -11,22 +14,57 @@ export const command = createCommand({
|
|
|
11
14
|
skipUpgradeCheck: true,
|
|
12
15
|
skipSkill: true,
|
|
13
16
|
tags: ['read-only', 'fast'],
|
|
14
|
-
optional: { auth: true },
|
|
15
17
|
schema: {
|
|
16
18
|
options: z.object({
|
|
17
19
|
nonInteractive: z.boolean().optional().describe('Run in non-interactive mode'),
|
|
20
|
+
setupToken: z.string().optional().describe('Use a one-time use setup token'),
|
|
18
21
|
}),
|
|
19
22
|
},
|
|
20
23
|
|
|
21
24
|
async handler(ctx) {
|
|
22
|
-
const { opts
|
|
25
|
+
const { opts } = ctx;
|
|
23
26
|
const _nonInteractive = opts.nonInteractive ?? false;
|
|
24
27
|
|
|
28
|
+
// validate the one time setup token if provided
|
|
29
|
+
if (opts?.setupToken && opts.setupToken !== '-' && validateToken.test(opts.setupToken)) {
|
|
30
|
+
const [hours] = opts.setupToken.split('.');
|
|
31
|
+
const tokenInterval = Number(hours);
|
|
32
|
+
if (!Number.isNaN(tokenInterval)) {
|
|
33
|
+
const now = Math.round(Date.now() / (60_000 * 5));
|
|
34
|
+
if (tokenInterval === now || tokenInterval === now - 1) {
|
|
35
|
+
const ok = await tui.spinner({
|
|
36
|
+
message: 'Validating your identity',
|
|
37
|
+
clearOnSuccess: true,
|
|
38
|
+
callback: async () => {
|
|
39
|
+
const newargs = process.argv.map((x) => (x === 'setup' ? 'login' : x));
|
|
40
|
+
const r = Bun.spawn({
|
|
41
|
+
cmd: newargs.concat('--json'),
|
|
42
|
+
stdout: 'pipe',
|
|
43
|
+
stderr: 'inherit',
|
|
44
|
+
});
|
|
45
|
+
await r.exited;
|
|
46
|
+
try {
|
|
47
|
+
const res = JSON.parse(await r.stdout.text()) as { success: boolean };
|
|
48
|
+
return res.success;
|
|
49
|
+
} catch {
|
|
50
|
+
/* fall through */
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
if (ok) {
|
|
56
|
+
/* TODO */
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
25
63
|
tui.newline();
|
|
26
64
|
showBanner();
|
|
27
65
|
tui.newline();
|
|
28
66
|
|
|
29
|
-
if (!
|
|
67
|
+
if (!(await hasLoggedInBefore())) {
|
|
30
68
|
tui.output(`${tui.muted('To get started, run:')}`);
|
|
31
69
|
tui.newline();
|
|
32
70
|
tui.output(
|
package/src/config.ts
CHANGED
|
@@ -298,11 +298,12 @@ export async function saveAuth(auth: AuthData): Promise<void> {
|
|
|
298
298
|
try {
|
|
299
299
|
await saveAuthToKeychain(profileName, authData);
|
|
300
300
|
|
|
301
|
-
// Successfully stored in keychain, remove from config if present
|
|
301
|
+
// Successfully stored in keychain, remove auth from config if present
|
|
302
|
+
// but always save config to ensure profile file exists
|
|
302
303
|
if (config.auth) {
|
|
303
304
|
delete config.auth;
|
|
304
|
-
await saveConfig(config);
|
|
305
305
|
}
|
|
306
|
+
await saveConfig(config);
|
|
306
307
|
return;
|
|
307
308
|
} catch (error) {
|
|
308
309
|
// Keychain failed, fall back to config file
|
package/src/steps.ts
CHANGED
|
@@ -518,7 +518,8 @@ async function runStepsTUI(steps: Step[]): Promise<void> {
|
|
|
518
518
|
// Handle errors
|
|
519
519
|
if (stepState.status === 'error') {
|
|
520
520
|
const errorColor = getColor('red');
|
|
521
|
-
|
|
521
|
+
const errorMsg = stepState.errorMessage || 'An unknown error occurred';
|
|
522
|
+
console.error(`\n${errorColor}Error: ${errorMsg}${COLORS.reset}`);
|
|
522
523
|
if (
|
|
523
524
|
stepState.errorCause instanceof ValidationInputError ||
|
|
524
525
|
stepState.errorCause instanceof ValidationOutputError
|
|
@@ -611,7 +612,8 @@ async function runStepsPlain(steps: Step[]): Promise<void> {
|
|
|
611
612
|
console.log('');
|
|
612
613
|
}
|
|
613
614
|
const errorColor = getColor('red');
|
|
614
|
-
|
|
615
|
+
const errorMsg = outcome.message || 'An unknown error occurred';
|
|
616
|
+
console.error(`\n${errorColor}Error: ${errorMsg}${COLORS.reset}`);
|
|
615
617
|
if (
|
|
616
618
|
outcome.cause instanceof ValidationInputError ||
|
|
617
619
|
outcome.cause instanceof ValidationOutputError
|
package/src/tui.ts
CHANGED
|
@@ -807,19 +807,26 @@ export function showSignupBenefits(): void {
|
|
|
807
807
|
|
|
808
808
|
/**
|
|
809
809
|
* Display a message when unauthenticated to let the user know certain capabilities are disabled
|
|
810
|
+
* @param hasProfile - If true, user has logged in before so only show "Login" instead of "Sign up / Login"
|
|
810
811
|
*/
|
|
811
|
-
export function showLoggedOutMessage(): void {
|
|
812
|
+
export function showLoggedOutMessage(appBaseUrl: string, hasProfile = false): void {
|
|
812
813
|
const YELLOW = Bun.color('yellow', 'ansi-16m');
|
|
813
814
|
const TEXT =
|
|
814
815
|
currentColorScheme === 'dark' ? Bun.color('white', 'ansi') : Bun.color('black', 'ansi');
|
|
815
816
|
const RESET = '\x1b[0m';
|
|
816
817
|
|
|
817
|
-
const signupTitle = 'Sign up / Login';
|
|
818
|
+
const signupTitle = hasProfile ? 'Login' : 'Sign up / Login';
|
|
819
|
+
const signupURL = hasProfile
|
|
820
|
+
? `${appBaseUrl}/sign-in`
|
|
821
|
+
: `${appBaseUrl}/sign-up`;
|
|
818
822
|
const showInline = supportsHyperlinks();
|
|
819
|
-
const signupURL = 'https://app-v1.agentuity.com/sign-up';
|
|
820
823
|
const signupLink = showInline
|
|
821
824
|
? link(signupURL, signupTitle)
|
|
822
825
|
: ' '.repeat(stringWidth(signupTitle));
|
|
826
|
+
// Box inner width is 46 chars, "unauthenticated. " = 17 chars
|
|
827
|
+
// Padding needed: 46 - 17 - signupTitle.length - 1 (space before link) = 28 - signupTitle.length
|
|
828
|
+
const paddingLength = 28 - signupTitle.length;
|
|
829
|
+
const padding = ' '.repeat(paddingLength);
|
|
823
830
|
const showNewLine = showInline ? '' : `║ ${RESET}${link(signupURL)}${YELLOW} ║`;
|
|
824
831
|
|
|
825
832
|
const lines = [
|
|
@@ -828,7 +835,7 @@ export function showLoggedOutMessage(): void {
|
|
|
828
835
|
'║ ║',
|
|
829
836
|
`║ ${TEXT}Certain capabilities such as the AI services${YELLOW} ║`,
|
|
830
837
|
`║ ${TEXT}and devmode remote are unavailable when${YELLOW} ║`,
|
|
831
|
-
`║ ${TEXT}unauthenticated.${YELLOW} ${signupLink}${YELLOW}
|
|
838
|
+
`║ ${TEXT}unauthenticated.${YELLOW} ${signupLink}${YELLOW}${padding}║`,
|
|
832
839
|
showNewLine,
|
|
833
840
|
'╚══════════════════════════════════════════════╝',
|
|
834
841
|
];
|
|
@@ -837,6 +844,36 @@ export function showLoggedOutMessage(): void {
|
|
|
837
844
|
lines.filter(Boolean).map((line) => console.log(YELLOW + line + RESET));
|
|
838
845
|
}
|
|
839
846
|
|
|
847
|
+
/**
|
|
848
|
+
* Display a warning when running in local-only mode (no agentuity.json project config)
|
|
849
|
+
* This is shown during `agentuity dev` when the project hasn't been registered with Agentuity Cloud
|
|
850
|
+
*/
|
|
851
|
+
export function showLocalOnlyWarning(): void {
|
|
852
|
+
const YELLOW = Bun.color('yellow', 'ansi-16m');
|
|
853
|
+
const TEXT =
|
|
854
|
+
currentColorScheme === 'dark' ? Bun.color('white', 'ansi') : Bun.color('black', 'ansi');
|
|
855
|
+
const RESET = '\x1b[0m';
|
|
856
|
+
|
|
857
|
+
const lines = [
|
|
858
|
+
'╔═══════════════════════════════════════════════════════════════╗',
|
|
859
|
+
`║ ⨺ Local-only mode ║`,
|
|
860
|
+
'║ ║',
|
|
861
|
+
`║ ${TEXT}This project is not registered with Agentuity Cloud.${YELLOW} ║`,
|
|
862
|
+
`║ ${TEXT}The following features are disabled:${YELLOW} ║`,
|
|
863
|
+
`║ ${TEXT}• AI Gateway (LLM calls require provider API keys)${YELLOW} ║`,
|
|
864
|
+
`║ ${TEXT}• Public URL / Remote access${YELLOW} ║`,
|
|
865
|
+
`║ ${TEXT}• Dashboard / Tracing / Observability${YELLOW} ║`,
|
|
866
|
+
'║ ║',
|
|
867
|
+
`║ ${TEXT}To enable cloud features, create a project and login.${YELLOW} ║`,
|
|
868
|
+
`║ ${TEXT}Or set provider API keys (e.g. OPENAI_API_KEY) in .env${YELLOW} ║`,
|
|
869
|
+
'╚═══════════════════════════════════════════════════════════════╝',
|
|
870
|
+
];
|
|
871
|
+
|
|
872
|
+
console.log('');
|
|
873
|
+
lines.map((line) => console.log(YELLOW + line + RESET));
|
|
874
|
+
console.log('');
|
|
875
|
+
}
|
|
876
|
+
|
|
840
877
|
/**
|
|
841
878
|
* Copy text to clipboard
|
|
842
879
|
* Returns true if successful, false otherwise
|
|
@@ -1675,11 +1712,14 @@ export async function selectOrganization(
|
|
|
1675
1712
|
);
|
|
1676
1713
|
}
|
|
1677
1714
|
|
|
1715
|
+
// Find the index of the initial org to pre-select it in the list
|
|
1716
|
+
const initialIndex = initial ? orgs.findIndex((o) => o.id === initial) : -1;
|
|
1717
|
+
|
|
1678
1718
|
const response = await enquirer.prompt<{ action: string }>({
|
|
1679
1719
|
type: 'select',
|
|
1680
1720
|
name: 'action',
|
|
1681
1721
|
message: 'Select an organization',
|
|
1682
|
-
initial:
|
|
1722
|
+
initial: initialIndex >= 0 ? initialIndex : 0,
|
|
1683
1723
|
choices: orgs.map((o) => ({ message: o.name, name: o.id })),
|
|
1684
1724
|
});
|
|
1685
1725
|
|
|
@@ -1830,6 +1870,11 @@ export interface TableOptions {
|
|
|
1830
1870
|
* - 'auto': Automatically choose based on terminal width (default)
|
|
1831
1871
|
*/
|
|
1832
1872
|
layout?: 'horizontal' | 'vertical' | 'auto';
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* the padding before any label
|
|
1876
|
+
*/
|
|
1877
|
+
padStart?: string;
|
|
1833
1878
|
}
|
|
1834
1879
|
|
|
1835
1880
|
/**
|
|
@@ -1838,10 +1883,11 @@ export interface TableOptions {
|
|
|
1838
1883
|
*/
|
|
1839
1884
|
function calculateTableWidth<T extends Record<string, unknown>>(
|
|
1840
1885
|
data: T[],
|
|
1841
|
-
columnNames: string[]
|
|
1886
|
+
columnNames: string[],
|
|
1887
|
+
padStart = ''
|
|
1842
1888
|
): number {
|
|
1843
1889
|
const columnWidths = columnNames.map((colName) => {
|
|
1844
|
-
let maxWidth = getDisplayWidth(colName);
|
|
1890
|
+
let maxWidth = getDisplayWidth(padStart + colName);
|
|
1845
1891
|
for (const row of data) {
|
|
1846
1892
|
const value = row[colName];
|
|
1847
1893
|
const valueStr = value !== undefined && value !== null ? String(value) : '';
|
|
@@ -1866,14 +1912,17 @@ function calculateTableWidth<T extends Record<string, unknown>>(
|
|
|
1866
1912
|
*/
|
|
1867
1913
|
function renderVerticalTable<T extends Record<string, unknown>>(
|
|
1868
1914
|
data: T[],
|
|
1869
|
-
columnNames: string[]
|
|
1915
|
+
columnNames: string[],
|
|
1916
|
+
padStart = ''
|
|
1870
1917
|
): string {
|
|
1871
1918
|
const lines: string[] = [];
|
|
1872
1919
|
const mutedColor = getColor('muted');
|
|
1873
1920
|
const reset = getColor('reset');
|
|
1874
1921
|
|
|
1875
1922
|
// Calculate max column name width for alignment
|
|
1876
|
-
const maxLabelWidth = Math.max(
|
|
1923
|
+
const maxLabelWidth = Math.max(
|
|
1924
|
+
...columnNames.map((name) => 1 + getDisplayWidth(padStart + name))
|
|
1925
|
+
);
|
|
1877
1926
|
|
|
1878
1927
|
for (let i = 0; i < data.length; i++) {
|
|
1879
1928
|
const row = data[i];
|
|
@@ -1881,7 +1930,7 @@ function renderVerticalTable<T extends Record<string, unknown>>(
|
|
|
1881
1930
|
for (const colName of columnNames) {
|
|
1882
1931
|
const value = row[colName];
|
|
1883
1932
|
const valueStr = value !== undefined && value !== null ? String(value) : '';
|
|
1884
|
-
const paddedLabel = `${colName}:`.padEnd(maxLabelWidth);
|
|
1933
|
+
const paddedLabel = `${padStart}${colName}:`.padEnd(maxLabelWidth);
|
|
1885
1934
|
lines.push(`${mutedColor}${paddedLabel}${reset} ${valueStr}`);
|
|
1886
1935
|
}
|
|
1887
1936
|
|
|
@@ -1942,13 +1991,13 @@ export function table<T extends Record<string, unknown>>(
|
|
|
1942
1991
|
// Determine layout mode
|
|
1943
1992
|
const layout = options?.layout ?? 'auto';
|
|
1944
1993
|
const termWidth = getTerminalWidth(80);
|
|
1945
|
-
const tableWidth = calculateTableWidth(data, columnNames);
|
|
1994
|
+
const tableWidth = calculateTableWidth(data, columnNames, options?.padStart);
|
|
1946
1995
|
const useVertical = layout === 'vertical' || (layout === 'auto' && tableWidth > termWidth);
|
|
1947
1996
|
|
|
1948
1997
|
let output: string;
|
|
1949
1998
|
|
|
1950
1999
|
if (useVertical) {
|
|
1951
|
-
output = renderVerticalTable(data, columnNames);
|
|
2000
|
+
output = renderVerticalTable(data, columnNames, options?.padStart);
|
|
1952
2001
|
} else {
|
|
1953
2002
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1954
2003
|
const Table = require('cli-table3') as new (options?: {
|