@jacebenson/jsn 4.5.1-dev.117.1 → 4.5.1-dev.119.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/README.md +2 -2
- package/bin/jsn.js +0 -14
- package/package.json +1 -4
- package/src/commands/docs/docs.js +1 -1
- package/src/commands/setup.js +16 -11
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A command-line interface for ServiceNow. Read and update records, manage flows,
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Supports the current Node.js LTS release. Supports macOS, Linux, and Windows.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install -g @jacebenson/jsn
|
|
@@ -219,7 +219,7 @@ No ServiceNow connection is required. Hosted docs at `https://jsn.jace.pro` are
|
|
|
219
219
|
the default and download no database. `jsn setup` asks once for defaults for new
|
|
220
220
|
connections and whether to use hosted documentation. Decline hosted docs to let
|
|
221
221
|
JSN start a local server, or decline that too and enter your own service base URL.
|
|
222
|
-
Later changes live under **
|
|
222
|
+
Later changes live under **Defaults and documentation** in setup. Existing connections
|
|
223
223
|
keep their saved settings.
|
|
224
224
|
|
|
225
225
|
Local mode downloads the public documentation on first use and checks for updates
|
package/bin/jsn.js
CHANGED
|
@@ -7,20 +7,6 @@ process.stdout.on('error', (err) => {
|
|
|
7
7
|
throw err;
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
// Suppress the node:sqlite experimental warning on Node 22.x.
|
|
11
|
-
// SQLite is stable in Node 24+. The patch must be applied before any
|
|
12
|
-
// module imports node:sqlite, so we use a dynamic import after patching.
|
|
13
|
-
const originalEmitWarning = process.emitWarning;
|
|
14
|
-
process.emitWarning = function emitWarning(warning, ...args) {
|
|
15
|
-
const message = typeof warning === 'string'
|
|
16
|
-
? warning
|
|
17
|
-
: (warning?.message || '');
|
|
18
|
-
if (message.includes('SQLite')) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
return originalEmitWarning.apply(this, [warning, ...args]);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
10
|
import('../src/cli.js').then(async (m) => {
|
|
25
11
|
try {
|
|
26
12
|
await m.cli.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacebenson/jsn",
|
|
3
|
-
"version": "4.5.1-dev.
|
|
3
|
+
"version": "4.5.1-dev.119.1",
|
|
4
4
|
"description": "A command-line interface for ServiceNow that follows the Unix philosophy: simple, composable, and scriptable.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,9 +24,6 @@
|
|
|
24
24
|
"author": "Jace Benson",
|
|
25
25
|
"repository": "https://github.com/jacebenson/jsn",
|
|
26
26
|
"license": "MIT",
|
|
27
|
-
"engines": {
|
|
28
|
-
"node": ">=22.5.0"
|
|
29
|
-
},
|
|
30
27
|
"dependencies": {
|
|
31
28
|
"@inquirer/core": "^10.3.2",
|
|
32
29
|
"@inquirer/prompts": "^7.10.1",
|
|
@@ -78,7 +78,7 @@ export function docsCmd(wrap) {
|
|
|
78
78
|
const service = await documentationService(app.config);
|
|
79
79
|
const summary = 'Search ServiceNow documentation';
|
|
80
80
|
app.ok({ command: 'docs', service,
|
|
81
|
-
_formatted: `jsn docs "search terms"\njsn docs --path <exact-path>\n\nService: ${service}\nChange documentation preferences in jsn setup →
|
|
81
|
+
_formatted: `jsn docs "search terms"\njsn docs --path <exact-path>\n\nService: ${service}\nChange documentation preferences in jsn setup → Defaults and documentation.\nNo ServiceNow connection is needed. Hosted mode downloads no database.\n`,
|
|
82
82
|
}, { summary });
|
|
83
83
|
}),
|
|
84
84
|
};
|
package/src/commands/setup.js
CHANGED
|
@@ -9,14 +9,14 @@ import { declareCapabilities } from '../capabilities.js';
|
|
|
9
9
|
declareCapabilities('setup', { noInstance: true, skipContextHeader: true });
|
|
10
10
|
|
|
11
11
|
const HUB_CHOICES = [
|
|
12
|
-
{
|
|
13
|
-
{ name: '
|
|
14
|
-
{ name: '
|
|
15
|
-
{ name: '
|
|
16
|
-
{ name: 'Change settings', value: 'modify', command: 'jsn auth modify --profile <name> --read-only --confirm-deletes --no-include-counts' },
|
|
17
|
-
{
|
|
18
|
-
{ name: '
|
|
19
|
-
{ name: '
|
|
12
|
+
{ section: 'Connections', name: 'Check connections', value: 'status', command: 'jsn auth status --details --json (use --local to skip instance probes)' },
|
|
13
|
+
{ section: 'Connections', name: 'Choose default connection', value: 'switch', command: 'jsn auth switch <name>' },
|
|
14
|
+
{ section: 'Connections', name: 'Add a connection', value: 'add', command: 'jsn auth login <instance> --name <name> --basic' },
|
|
15
|
+
{ section: 'Connections', name: 'Sign in again', value: 'login', command: 'jsn auth login --profile <name> (with the authentication options below)' },
|
|
16
|
+
{ section: 'Connections', name: 'Change connection settings', value: 'modify', command: 'jsn auth modify --profile <name> --read-only --confirm-deletes --no-include-counts' },
|
|
17
|
+
{ section: 'JSN settings', name: 'Defaults and documentation', value: 'advanced', command: 'jsn setup' },
|
|
18
|
+
{ section: 'Cleanup', name: 'Sign out (keep connection)', value: 'logout', command: 'jsn auth logout --profile <name> --force (only after explicit approval)' },
|
|
19
|
+
{ section: 'Cleanup', name: 'Remove a connection', value: 'remove', command: 'jsn auth remove <name>' },
|
|
20
20
|
];
|
|
21
21
|
|
|
22
22
|
const setupHelp = () => [
|
|
@@ -62,9 +62,14 @@ export const authHubPrompt = async (...args) => {
|
|
|
62
62
|
const page = usePagination({
|
|
63
63
|
items: choices,
|
|
64
64
|
active,
|
|
65
|
-
|
|
65
|
+
// Pagination budgets terminal lines, including the section headings.
|
|
66
|
+
pageSize: choices.length + new Set(choices.map(choice => choice.section)).size * 2 - 1,
|
|
66
67
|
loop: false,
|
|
67
|
-
renderItem: ({ item, isActive }) =>
|
|
68
|
+
renderItem: ({ item, isActive }) => {
|
|
69
|
+
const index = choices.indexOf(item);
|
|
70
|
+
const heading = choices[index - 1]?.section !== item.section ? `${index ? '\n' : ''} ${item.section}\n` : '';
|
|
71
|
+
return `${heading}${isActive ? '❯' : ' '} ${item.name}`;
|
|
72
|
+
},
|
|
68
73
|
});
|
|
69
74
|
return `${config.message}\n${page}\n\n↑↓ navigate • ⏎ select • q/Esc exit`;
|
|
70
75
|
})(...args);
|
|
@@ -94,7 +99,7 @@ export async function dispatchSetupAction(app, argv, action) {
|
|
|
94
99
|
} else if (action === 'remove') {
|
|
95
100
|
return removeConnection(argv, app);
|
|
96
101
|
} else if (action === 'advanced') {
|
|
97
|
-
const setting = await select({ message: '
|
|
102
|
+
const setting = await select({ message: 'JSN settings', choices: [
|
|
98
103
|
{ name: 'Defaults for future connections', value: 'defaults' },
|
|
99
104
|
{ name: 'Documentation source', value: 'docs' },
|
|
100
105
|
{ name: 'Back', value: 'back' },
|