@jacebenson/jsn 4.5.1-dev.117.1 → 4.5.1-dev.118.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 CHANGED
@@ -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 **Advanced settings** in setup. Existing connections
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "4.5.1-dev.117.1",
3
+ "version": "4.5.1-dev.118.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": {
@@ -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 → Advanced settings.\nNo ServiceNow connection is needed. Hosted mode downloads no database.\n`,
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
  };
@@ -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
- { name: 'Add a connection', value: 'add', command: 'jsn auth login <instance> --name <name> --basic' },
13
- { name: 'Sign in again', value: 'login', command: 'jsn auth login --profile <name> (with the authentication options below)' },
14
- { name: 'Check connections', value: 'status', command: 'jsn auth status --details --json (use --local to skip instance probes)' },
15
- { name: 'Choose the default profile', value: 'switch', command: 'jsn auth switch <name>' },
16
- { name: 'Change settings', value: 'modify', command: 'jsn auth modify --profile <name> --read-only --confirm-deletes --no-include-counts' },
17
- { name: 'Sign out (keep the profile)', value: 'logout', command: 'jsn auth logout --profile <name> --force (only after explicit approval)' },
18
- { name: 'Remove a connection', value: 'remove', command: 'jsn auth remove <name>' },
19
- { name: 'Advanced settings', value: 'advanced', command: 'jsn setup' },
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
- pageSize: choices.length,
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 }) => `${isActive ? '❯' : ' '} ${item.name}`,
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: 'Advanced settings', choices: [
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' },