@jacebenson/jsn 5.5.1-dev.168.1 → 5.5.1-dev.170.1
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/package.json +1 -1
- package/src/cli.js +4 -5
- package/src/commands/_generic.js +10 -2
- package/src/commands/_ticket.js +10 -2
- package/src/commands/auth.js +10 -5
- package/src/commands/records.js +10 -2
- package/src/commands/setup.js +3 -4
- package/src/commands/tickets.js +10 -2
- package/src/helpers.js +16 -0
- package/src/output.js +6 -0
- package/src/welcome.js +26 -13
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import { App } from './app.js';
|
|
|
10
10
|
import { resolveSession, applySession } from './session.js';
|
|
11
11
|
import { renderHelp, renderTips } from './help.js';
|
|
12
12
|
import { isMutationCommand, refreshMutationCommands } from './mutations.js';
|
|
13
|
-
import {
|
|
13
|
+
import { maybeShowHome } from './welcome.js';
|
|
14
14
|
import { skippedUpdatesCmd } from './commands/skipped-updates.js';
|
|
15
15
|
import { isLocalPreview, noInstanceCommands, dailyCheckSkipCommands, contextHeaderSkipCommands } from './capabilities.js';
|
|
16
16
|
import { guardExit, exitWithError, AppError, CodeUsage } from './errors.js';
|
|
@@ -601,11 +601,10 @@ export function buildCLI() {
|
|
|
601
601
|
}
|
|
602
602
|
process.exit(0);
|
|
603
603
|
}
|
|
604
|
-
//
|
|
605
|
-
//
|
|
606
|
-
// format, no configured profile, and not shown before.
|
|
604
|
+
// Human terminals always get the compact local home. Machine and
|
|
605
|
+
// non-interactive discovery retain their existing reference output.
|
|
607
606
|
const config = loadConfig(formatArgv);
|
|
608
|
-
const welcome =
|
|
607
|
+
const welcome = maybeShowHome({ argv: formatArgv, requestedFormat, cfg: config });
|
|
609
608
|
if (!welcome) process.stdout.write(renderHelp(config, visibleCommandRegistry(cliInstance.commandRegistry(), config, formatArgv)) + '\n');
|
|
610
609
|
process.exit(0);
|
|
611
610
|
}
|
package/src/commands/_generic.js
CHANGED
|
@@ -2,7 +2,7 @@ import { constrainQuery, constrainedQueryHelp } from '../constrained-query.js';
|
|
|
2
2
|
import { enrichRelatedLists, relatedListOptions } from '../related-lists.js';
|
|
3
3
|
// Generic table-based CRUD command builder
|
|
4
4
|
|
|
5
|
-
import { formatRecordForDisplay, getStringField, buildRecordPayload, confirmDelete, interactiveList, canPrompt } from '../helpers.js';
|
|
5
|
+
import { formatRecordForDisplay, findOmittedColumns, getStringField, buildRecordPayload, confirmDelete, interactiveList, canPrompt } from '../helpers.js';
|
|
6
6
|
import { getRecord, listRecords, recordListParams, createRecord, updateRecord, deleteRecord, recordOptions } from '../records-engine.js';
|
|
7
7
|
import { unwrapSysId } from '../resolve-record.js';
|
|
8
8
|
import { getCurrentUser, getCurrentApplication } from '../context.js';
|
|
@@ -171,11 +171,19 @@ export function buildDevCmd(name, table, aliases, defaultColumns, wrap, opts = {
|
|
|
171
171
|
const q = `${constrainedQuery}${constrainedQuery ? '^' : ''}ORDERBYDESCsys_updated_on`;
|
|
172
172
|
const params = recordListParams({ limit, fields: ['sys_id', ...columns], query: q });
|
|
173
173
|
const records = await listRecords(app.sdk, { table, params, displayValues: argv.displayValues ?? opts.referenceMode });
|
|
174
|
+
const missingColumns = findOmittedColumns(records, columns);
|
|
175
|
+
const presentColumns = missingColumns.length ? columns.filter(c => !missingColumns.includes(c)) : columns;
|
|
174
176
|
app.ok({
|
|
175
177
|
table,
|
|
176
178
|
count: records.length,
|
|
177
179
|
columns,
|
|
178
|
-
|
|
180
|
+
...(missingColumns.length ? {
|
|
181
|
+
missing_columns: missingColumns,
|
|
182
|
+
warnings: [
|
|
183
|
+
`Column(s) not returned by ServiceNow (non-existent or restricted on ${table}): ${missingColumns.join(', ')}. Run \`jsn columns --table ${table}\` to inspect valid fields.`,
|
|
184
|
+
],
|
|
185
|
+
} : {}),
|
|
186
|
+
records: argv.displayValues || opts.listProjection === 'full' ? records : records.map(r => formatRecordForDisplay(r, presentColumns)),
|
|
179
187
|
context: { instance_url: app.getEffectiveInstance() },
|
|
180
188
|
}, {
|
|
181
189
|
summary: `${records.length} ${name}(s)`,
|
package/src/commands/_ticket.js
CHANGED
|
@@ -2,7 +2,7 @@ import { enrichRelatedLists, relatedListOptions } from '../related-lists.js';
|
|
|
2
2
|
// Generic command builder for CRUD operations on a ServiceNow table
|
|
3
3
|
// Used by incidents, changes, requests, tasks, and most dev subcommands
|
|
4
4
|
|
|
5
|
-
import { getStringField, formatRecordForDisplay, buildQuerySuffix, resolveFieldsParam, confirmDelete, interactiveList, canPrompt, buildRecordPayload } from '../helpers.js';
|
|
5
|
+
import { getStringField, formatRecordForDisplay, findOmittedColumns, buildQuerySuffix, resolveFieldsParam, confirmDelete, interactiveList, canPrompt, buildRecordPayload } from '../helpers.js';
|
|
6
6
|
import { getRecord, listRecords, recordListParams, createRecord, updateRecord, deleteRecord, recordOptions } from '../records-engine.js';
|
|
7
7
|
import { resolveSysId } from '../resolve-record.js';
|
|
8
8
|
import { FormatAuto } from '../output.js';
|
|
@@ -88,7 +88,9 @@ export function buildTicketCommands(table, displayName, alias, defaultColumns, s
|
|
|
88
88
|
const params = recordListParams({ limit, offset, fields, query: q });
|
|
89
89
|
|
|
90
90
|
const records = await listRecords(app.sdk, { table, params, displayValues: argv.displayValues ?? opts.referenceMode });
|
|
91
|
-
const
|
|
91
|
+
const missingColumns = fields ? findOmittedColumns(records, columns) : [];
|
|
92
|
+
const presentColumns = missingColumns.length ? columns.filter(c => !missingColumns.includes(c)) : columns;
|
|
93
|
+
const displayRecords = fields && !argv.displayValues && opts.listProjection !== 'full' ? records.map(r => formatRecordForDisplay(r, presentColumns)) : records;
|
|
92
94
|
|
|
93
95
|
const breadcrumbs = [
|
|
94
96
|
{ action: 'create', cmd: `jsn ${alias} create --description "..."`, description: `Create a new ${displayName}` },
|
|
@@ -114,6 +116,12 @@ export function buildTicketCommands(table, displayName, alias, defaultColumns, s
|
|
|
114
116
|
table,
|
|
115
117
|
count: records.length,
|
|
116
118
|
columns,
|
|
119
|
+
...(missingColumns.length ? {
|
|
120
|
+
missing_columns: missingColumns,
|
|
121
|
+
warnings: [
|
|
122
|
+
`Column(s) not returned by ServiceNow (non-existent or restricted on ${table}): ${missingColumns.join(', ')}. Run \`jsn columns --table ${table}\` to inspect valid fields.`,
|
|
123
|
+
],
|
|
124
|
+
} : {}),
|
|
117
125
|
records: displayRecords,
|
|
118
126
|
pagination: { limit, offset, hasMore: records.length === limit },
|
|
119
127
|
context: { instance_url: app.getEffectiveInstance() },
|
package/src/commands/auth.js
CHANGED
|
@@ -299,7 +299,7 @@ async function readBrowserSessionFile(file) {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
/** Collect human answers, then call the same login operation as auth login. */
|
|
302
|
-
export async function loginWizard(app, argv = {}) {
|
|
302
|
+
export async function loginWizard(app, argv = {}, { concise = false } = {}) {
|
|
303
303
|
const { input, select, confirm, password } = await import('../prompts.js');
|
|
304
304
|
const explicitInstance = resolveWizardInstance(app, argv);
|
|
305
305
|
const instance = resolveInstanceArg(explicitInstance || await input({
|
|
@@ -333,8 +333,8 @@ export async function loginWizard(app, argv = {}) {
|
|
|
333
333
|
request['include-counts'] = settings.include_counts;
|
|
334
334
|
request.makeDefault = argv.makeDefault ?? (Object.keys(app.config.profiles || {}).length === 0 && !app.config.defaultProfile
|
|
335
335
|
? true : await confirm({ message: 'Use this profile by default?', default: !app.config.defaultProfile }));
|
|
336
|
-
const result = await loginProfile(request, app);
|
|
337
|
-
if (result.authenticated) {
|
|
336
|
+
const result = await loginProfile(request, app, { concise });
|
|
337
|
+
if (result.authenticated && !concise) {
|
|
338
338
|
process.stdout.write(`Connection preset: ${settings.read_only ? 'read-only' : 'writes allowed'} · deletes ${settings.skip_confirmations ? 'without confirmation' : 'ask first'} · totals ${settings.include_counts ? 'on' : 'off'}\nChange with: jsn auth modify ${result.profile} --read-only\n`);
|
|
339
339
|
}
|
|
340
340
|
return { instanceURL: instance, profileName: result.profile, loggedIn: result.authenticated };
|
|
@@ -552,7 +552,7 @@ function canLogoutBareProfile(app, instance, target, explicitlySelected) {
|
|
|
552
552
|
return sameInstance.length <= 1;
|
|
553
553
|
}
|
|
554
554
|
|
|
555
|
-
export async function loginProfile(argv, app) {
|
|
555
|
+
export async function loginProfile(argv, app, { concise = false } = {}) {
|
|
556
556
|
argv = profileSettingValues(argv);
|
|
557
557
|
validateLoginSelectors(argv);
|
|
558
558
|
if (argv.name !== undefined) {
|
|
@@ -810,7 +810,12 @@ Find your instance URL in your browser's address bar when logged into ServiceNow
|
|
|
810
810
|
description: 'Set these at login; --skip-confirmations disables delete prompts',
|
|
811
811
|
},
|
|
812
812
|
] : [];
|
|
813
|
-
|
|
813
|
+
if (concise && canUsePicker(app, argv)) {
|
|
814
|
+
const next = setDefault ? 'jsn incidents list' : `jsn --profile ${quoteShellArg(profileName)} incidents list`;
|
|
815
|
+
app.ok(result, { summary: `${summary}\nNext: ${next}`, breadcrumbs: [] });
|
|
816
|
+
} else {
|
|
817
|
+
app.ok(result, { summary, breadcrumbs });
|
|
818
|
+
}
|
|
814
819
|
return result;
|
|
815
820
|
}
|
|
816
821
|
|
package/src/commands/records.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatCommandList, formatRecordForDisplay, buildQuerySuffix, buildRecordPayload, getStringField, interactiveList, resolveFieldsParam, checkDerivedFields, confirmDelete, verifyWriteBack } from '../helpers.js';
|
|
1
|
+
import { formatCommandList, formatRecordForDisplay, findOmittedColumns, buildQuerySuffix, buildRecordPayload, getStringField, interactiveList, resolveFieldsParam, checkDerivedFields, confirmDelete, verifyWriteBack } from '../helpers.js';
|
|
2
2
|
import { listRecords, recordListParams, getRecord, createRecord, updateRecord, deleteRecord } from '../records-engine.js';
|
|
3
3
|
import { resolveRecord, unwrapSysId } from '../resolve-record.js';
|
|
4
4
|
import { errUsage } from '../errors.js';
|
|
@@ -149,7 +149,9 @@ export function recordsCmd(wrap) {
|
|
|
149
149
|
const fields = resolveFieldsParam(columns);
|
|
150
150
|
const params = recordListParams({ limit: argv['sys-id'] ? 1 : argv.limit, offset: argv.offset, fields, query });
|
|
151
151
|
const records = await listRecords(app.sdk, { table, params, displayValues: argv.displayValues });
|
|
152
|
-
const
|
|
152
|
+
const missingColumns = fields ? findOmittedColumns(records, columns) : [];
|
|
153
|
+
const presentColumns = missingColumns.length ? columns.filter(c => !missingColumns.includes(c)) : columns;
|
|
154
|
+
const displayRecords = fields && !argv.displayValues ? records.map(r => formatRecordForDisplay(r, presentColumns)) : records;
|
|
153
155
|
|
|
154
156
|
// include_counts: default opt-in on every list. Opt out per-profile
|
|
155
157
|
// (config include_counts:false) or per-invocation (--no-count).
|
|
@@ -190,6 +192,12 @@ export function recordsCmd(wrap) {
|
|
|
190
192
|
table,
|
|
191
193
|
count: records.length,
|
|
192
194
|
columns,
|
|
195
|
+
...(missingColumns.length ? {
|
|
196
|
+
missing_columns: missingColumns,
|
|
197
|
+
warnings: [
|
|
198
|
+
`Column(s) not returned by ServiceNow (non-existent or restricted on ${table}): ${missingColumns.join(', ')}. Run \`jsn columns --table ${table}\` to inspect valid fields.`,
|
|
199
|
+
],
|
|
200
|
+
} : {}),
|
|
193
201
|
records: displayRecords,
|
|
194
202
|
pagination: { limit: argv.limit, offset: argv.offset, ...(total != null ? { total, hasMore: argv.offset + argv.limit < total } : {}) },
|
|
195
203
|
context: { instance_url: app.getEffectiveInstance() },
|
package/src/commands/setup.js
CHANGED
|
@@ -89,7 +89,7 @@ export async function authHubMenu({ promptFn = authHubPrompt, input, output, has
|
|
|
89
89
|
*/
|
|
90
90
|
export async function dispatchSetupAction(app, argv, action) {
|
|
91
91
|
if (action === 'add') {
|
|
92
|
-
return loginWizard(app, argv);
|
|
92
|
+
return loginWizard(app, argv, { concise: true });
|
|
93
93
|
} else if (action === 'login') {
|
|
94
94
|
return loginProfile(argv, app);
|
|
95
95
|
} else if (action === 'status') {
|
|
@@ -147,14 +147,13 @@ export function setupCmd(wrap) {
|
|
|
147
147
|
await saveConfig(app.config);
|
|
148
148
|
}
|
|
149
149
|
if (profileNames.length === 0 && firstSetup) {
|
|
150
|
-
|
|
151
|
-
await showAuthStatus({ ...argv, profile: result.profileName }, app);
|
|
150
|
+
await loginWizard(app, argv, { concise: true });
|
|
152
151
|
return;
|
|
153
152
|
}
|
|
154
153
|
const action = await authHubMenu({ hasProfiles: profileNames.length > 0 });
|
|
155
154
|
if (action === undefined) return;
|
|
156
155
|
const result = await dispatchSetupAction(app, argv, action);
|
|
157
|
-
if (!['status', 'advanced'].includes(action)) await showAuthStatus({ ...argv, profile: result?.profile || result?.profileName }, app);
|
|
156
|
+
if (!['add', 'status', 'advanced'].includes(action)) await showAuthStatus({ ...argv, profile: result?.profile || result?.profileName }, app);
|
|
158
157
|
}),
|
|
159
158
|
};
|
|
160
159
|
}
|
package/src/commands/tickets.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { enrichRelatedLists, relatedListOptions } from '../related-lists.js';
|
|
2
|
-
import { formatRecordForDisplay, getStringField, buildQuerySuffix, resolveFieldsParam, buildRecordPayload, confirmDelete } from '../helpers.js';
|
|
2
|
+
import { formatRecordForDisplay, findOmittedColumns, getStringField, buildQuerySuffix, resolveFieldsParam, buildRecordPayload, confirmDelete } from '../helpers.js';
|
|
3
3
|
import { getRecord, listRecords, recordListParams, createRecord, updateRecord, deleteRecord, recordOptions } from '../records-engine.js';
|
|
4
4
|
import { resolveSysId } from '../resolve-record.js';
|
|
5
5
|
import { declareCapabilities } from '../capabilities.js';
|
|
@@ -28,7 +28,9 @@ export function ticketsCmd(wrap) {
|
|
|
28
28
|
const q = argv.query ? argv.query + '^ORDERBYDESCsys_updated_on' : 'ORDERBYDESCsys_updated_on';
|
|
29
29
|
const params = recordListParams({ limit: argv.limit, offset: argv.offset, fields, query: q });
|
|
30
30
|
const records = await listRecords(app.sdk, { table: 'task', params, displayValues: argv.displayValues });
|
|
31
|
-
const
|
|
31
|
+
const missingColumns = fields ? findOmittedColumns(records, columns) : [];
|
|
32
|
+
const presentColumns = missingColumns.length ? columns.filter(c => !missingColumns.includes(c)) : columns;
|
|
33
|
+
const displayRecords = fields && !argv.displayValues ? records.map(r => formatRecordForDisplay(r, presentColumns)) : records;
|
|
32
34
|
const breadcrumbs = [
|
|
33
35
|
{ action: 'create', cmd: 'jsn tickets create -f short_description=New ticket', description: 'Create a new ticket' },
|
|
34
36
|
];
|
|
@@ -50,6 +52,12 @@ export function ticketsCmd(wrap) {
|
|
|
50
52
|
table: 'task',
|
|
51
53
|
count: records.length,
|
|
52
54
|
columns,
|
|
55
|
+
...(missingColumns.length ? {
|
|
56
|
+
missing_columns: missingColumns,
|
|
57
|
+
warnings: [
|
|
58
|
+
`Column(s) not returned by ServiceNow (non-existent or restricted on task): ${missingColumns.join(', ')}. Run \`jsn columns --table task\` to inspect valid fields.`,
|
|
59
|
+
],
|
|
60
|
+
} : {}),
|
|
53
61
|
records: displayRecords,
|
|
54
62
|
pagination: { limit: argv.limit, offset: argv.offset, hasMore: records.length === argv.limit },
|
|
55
63
|
context: { instance_url: app.getEffectiveInstance() },
|
package/src/helpers.js
CHANGED
|
@@ -298,6 +298,22 @@ export function formatRecordForDisplay(record, columns) {
|
|
|
298
298
|
return result;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Identify requested columns that ServiceNow omitted from every returned row
|
|
303
|
+
* (because the field does not exist on the table or is blocked by ACLs).
|
|
304
|
+
* An existing empty column is still present as a key (`col in row === true`).
|
|
305
|
+
*
|
|
306
|
+
* @param {Array<object>} records — raw records from ServiceNow Table API
|
|
307
|
+
* @param {string[]} columns — requested column names
|
|
308
|
+
* @returns {string[]} columns absent from all returned records
|
|
309
|
+
*/
|
|
310
|
+
export function findOmittedColumns(records, columns) {
|
|
311
|
+
if (!Array.isArray(records) || records.length === 0 || !Array.isArray(columns) || columns.includes('*')) {
|
|
312
|
+
return [];
|
|
313
|
+
}
|
|
314
|
+
return columns.filter(col => col && col !== '*' && !records.some(r => r && typeof r === 'object' && col in r));
|
|
315
|
+
}
|
|
316
|
+
|
|
301
317
|
export function truncateString(str, maxLen) {
|
|
302
318
|
if (!str || str.length <= maxLen) return str;
|
|
303
319
|
return str.slice(0, maxLen - 3) + '...';
|
package/src/output.js
CHANGED
|
@@ -364,6 +364,12 @@ export class OutputWriter {
|
|
|
364
364
|
this.writeFormattedRecord(data, tableName);
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
+
if (Array.isArray(data.warnings) && data.warnings.length > 0 && !data._formatted) {
|
|
368
|
+
for (const w of data.warnings) {
|
|
369
|
+
this.writer.write(colorYellow(`⚠ ${w}\n`));
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
367
373
|
if (Array.isArray(data.records) && data.records.length > 0) {
|
|
368
374
|
// A _formatted visual (e.g. cmdb relationship tree) replaces the
|
|
369
375
|
// flat table in styled mode — showing both is noise.
|
package/src/welcome.js
CHANGED
|
@@ -116,12 +116,12 @@ function configLabels(env, configDir) {
|
|
|
116
116
|
* @param {number} width
|
|
117
117
|
* @returns {string[]}
|
|
118
118
|
*/
|
|
119
|
-
function renderSteps(width) {
|
|
120
|
-
const commandWidth = Math.max(...
|
|
119
|
+
function renderSteps(width, steps = STEPS) {
|
|
120
|
+
const commandWidth = Math.max(...steps.map((step) => step.command.length));
|
|
121
121
|
const alignedColumn = 4 + commandWidth + 2;
|
|
122
|
-
const oneLine =
|
|
122
|
+
const oneLine = steps.every((step) => alignedColumn + step.detail.length <= width);
|
|
123
123
|
const lines = [];
|
|
124
|
-
for (const step of
|
|
124
|
+
for (const step of steps) {
|
|
125
125
|
if (oneLine) {
|
|
126
126
|
lines.push(` ${step.command.padEnd(commandWidth)} ${step.detail}`);
|
|
127
127
|
continue;
|
|
@@ -289,16 +289,29 @@ export function markWelcomeSeen(configDir = globalConfigDir()) {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
* The marker is claimed before anything is printed, so an interrupted run
|
|
296
|
-
* (Ctrl-C) can leave the note unshown but never printed twice.
|
|
297
|
-
*
|
|
298
|
-
* @param {object} [opts] — same inputs as shouldShowWelcome, plus the
|
|
299
|
-
* welcomeText inputs (columns, version)
|
|
300
|
-
* @returns {string}
|
|
292
|
+
* Every human bare invocation gets a local-only home. The legacy welcome
|
|
293
|
+
* marker controls only the greeting, never whether the catalog is selected.
|
|
301
294
|
*/
|
|
295
|
+
export function maybeShowHome({ argv = {}, requestedFormat = '', cfg = {}, env = process.env,
|
|
296
|
+
configDir = globalConfigDir(), interactive = canPrompt(), columns = process.stdout?.columns } = {}) {
|
|
297
|
+
if (env.JSN_NO_WELCOME === '1' || !interactive || argv.get || !HUMAN_FORMATS.has(requestedFormat || '')) return '';
|
|
298
|
+
const width = layoutWidth(columns);
|
|
299
|
+
const selected = cfg.activeProfile || cfg.defaultProfile;
|
|
300
|
+
const profile = selected && cfg.profiles?.[selected] ? selected : undefined;
|
|
301
|
+
const steps = profile ? [
|
|
302
|
+
{ command: 'jsn incidents list', detail: 'browse incidents' },
|
|
303
|
+
{ command: 'jsn setup', detail: 'manage connections' },
|
|
304
|
+
{ command: 'jsn --help', detail: 'every command and flag' },
|
|
305
|
+
] : STEPS;
|
|
306
|
+
const greeting = shouldShowWelcome({ argv, requestedFormat, cfg, env, configDir, interactive })
|
|
307
|
+
&& claimWelcome(configDir) !== 'taken';
|
|
308
|
+
const heading = profile ? `Profile: ${profile}` : greeting ? 'Welcome to jsn' : 'Get started';
|
|
309
|
+
const text = [...wrapText(heading, width), '', ...renderSteps(width, steps)].join('\n');
|
|
310
|
+
process.stdout.write(`${text}\n\n`);
|
|
311
|
+
return text;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** Legacy once-only note API; bare CLI discovery uses maybeShowHome. */
|
|
302
315
|
export function maybeShowWelcome(opts = {}) {
|
|
303
316
|
if (!shouldShowWelcome(opts)) return '';
|
|
304
317
|
const configDir = opts.configDir || globalConfigDir();
|