@jacebenson/jsn 0.0.10 → 0.1.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 +193 -282
- package/package.json +3 -1
- package/skills/servicenow/SKILL.md +137 -0
- package/src/app.js +1 -1
- package/src/auth.js +139 -2
- package/src/cli.js +18 -8
- package/src/commands/_ticket.js +7 -3
- package/src/commands/auth.js +182 -32
- package/src/commands/dev/_generic.js +128 -11
- package/src/commands/dev/eval.js +27 -6
- package/src/commands/dev/flows.js +46 -1
- package/src/commands/dev/logs.js +15 -2
- package/src/commands/dev/scopes.js +62 -2
- package/src/commands/dev/updatesets.js +45 -2
- package/src/commands/groupmembers.js +114 -1
- package/src/commands/grouproles.js +114 -1
- package/src/commands/groups.js +87 -3
- package/src/commands/profiles.js +14 -2
- package/src/commands/records.js +41 -7
- package/src/commands/requests.js +53 -1
- package/src/commands/skill.js +109 -0
- package/src/commands/users.js +90 -3
- package/src/commands/version.js +58 -2
- package/src/help.js +85 -0
- package/src/helpers.js +84 -0
- package/src/output.js +30 -0
- package/src/sdk.js +258 -0
package/README.md
CHANGED
|
@@ -2,82 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
A command-line interface for ServiceNow that follows the Unix philosophy: simple, composable, and scriptable.
|
|
4
4
|
|
|
5
|
-
## Versions
|
|
6
|
-
|
|
7
|
-
| Version | Language | Branch | Install | Status |
|
|
8
|
-
|---------|----------|--------|---------|--------|
|
|
9
|
-
| Go | Go | `main` | Binary / `go install` | Stable |
|
|
10
|
-
| Node.js | JavaScript (Node 18+) | `nodejs` | `npm install -g` | Active development |
|
|
11
|
-
|
|
12
|
-
Both versions share the same CLI interface and are tested against the same ServiceNow PDI.
|
|
13
|
-
|
|
14
5
|
## Installation
|
|
15
6
|
|
|
16
|
-
### npm (
|
|
7
|
+
### npm (recommended — cross-platform)
|
|
17
8
|
|
|
18
9
|
```bash
|
|
19
|
-
npm install -g @jacebenson/jsn
|
|
10
|
+
npm install -g @jacebenson/jsn
|
|
20
11
|
```
|
|
21
12
|
|
|
22
|
-
> **Note:** The `@node` dist-tag is required. The `latest` tag currently points to the Go shim wrapper (v1.0.1).
|
|
23
|
-
|
|
24
13
|
No compilation needed. Works on macOS, Linux, and Windows with Node.js 18+.
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
> **Note:** As of v0.1.0, the `latest` dist-tag points to the Node.js implementation. This is the version you get with `npm install -g @jacebenson/jsn`.
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
# Download the latest release
|
|
30
|
-
curl -L https://github.com/jacebenson/jsn/releases/latest/download/jsn-linux-amd64 -o jsn
|
|
31
|
-
chmod +x jsn
|
|
32
|
-
sudo mv jsn /usr/local/bin/
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Go Install (Go version)
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
go install github.com/jacebenson/jsn/cmd/jsn@latest
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Quick Start
|
|
42
|
-
|
|
43
|
-
### 1. Setup
|
|
44
|
-
|
|
45
|
-
Run the interactive setup to configure your first ServiceNow instance:
|
|
17
|
+
### Quick Start
|
|
46
18
|
|
|
47
19
|
```bash
|
|
20
|
+
# Interactive setup
|
|
48
21
|
jsn setup
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
This will:
|
|
52
|
-
1. Ask for your ServiceNow instance URL
|
|
53
|
-
2. Open a browser for OAuth authentication
|
|
54
|
-
3. Set the instance as your default
|
|
55
22
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```bash
|
|
23
|
+
# Check auth status
|
|
59
24
|
jsn auth status
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### 3. Start Using
|
|
63
25
|
|
|
64
|
-
|
|
65
|
-
# List all incidents
|
|
26
|
+
# List incidents
|
|
66
27
|
jsn incidents
|
|
67
28
|
|
|
68
|
-
#
|
|
69
|
-
jsn
|
|
70
|
-
|
|
71
|
-
# Create a new incident
|
|
72
|
-
jsn incidents create --description "Server down" --priority 1
|
|
73
|
-
|
|
74
|
-
# List change requests
|
|
75
|
-
jsn changes
|
|
76
|
-
|
|
77
|
-
# Query any table
|
|
78
|
-
jsn records list --table incident --query "priority=1^active=true"
|
|
29
|
+
# Check for updates
|
|
30
|
+
jsn version --check
|
|
79
31
|
```
|
|
80
32
|
|
|
33
|
+
## What's New in v0.1.0
|
|
34
|
+
|
|
35
|
+
Full feature parity — 128 tests, lint clean:
|
|
36
|
+
|
|
37
|
+
| Feature | Status |
|
|
38
|
+
|---------|--------|
|
|
39
|
+
| Incident management (CRUD) | ✅ |
|
|
40
|
+
| Change request management (CRUD) | ✅ |
|
|
41
|
+
| Service catalog requests (with attachments + variables) | ✅ |
|
|
42
|
+
| Catalog tasks, generic tickets | ✅ |
|
|
43
|
+
| User management (CRUD) | ✅ |
|
|
44
|
+
| Group management (CRUD) | ✅ |
|
|
45
|
+
| Group memberships and roles | ✅ |
|
|
46
|
+
| Generic Table API (`jsn records`) | ✅ |
|
|
47
|
+
| OAuth PKCE with keychain (shared auth store) | ✅ |
|
|
48
|
+
| Bot/CI/CD auth flags (`--code`, `--print-url`) | ✅ |
|
|
49
|
+
| Dev commands: flows, actions, includes, rules, ACLs, etc. | ✅ |
|
|
50
|
+
| Script execution (`jsn dev eval`) via OAuth session flow | ✅ |
|
|
51
|
+
| Interactive search-as-you-type pickers | ✅ |
|
|
52
|
+
| Output formats: JSON, styled, markdown, quiet | ✅ |
|
|
53
|
+
| Enriched `requests show` with attachments + variables | ✅ |
|
|
54
|
+
| Categorized help system (CORE, DATA, DEV, CONFIG) | ✅ |
|
|
55
|
+
|
|
56
|
+
### New Commands
|
|
57
|
+
|
|
58
|
+
- **`jsn version --check`** — Check npm registry for newer versions
|
|
59
|
+
- **`jsn skill`** — Manage the jsn AI agent skill file (for Hermes, Claude Code, etc.)
|
|
60
|
+
- `jsn skill show` — Display the bundled skill
|
|
61
|
+
- `jsn skill fetch` — Download latest skill from GitHub
|
|
62
|
+
- `jsn skill path` — Show skill file locations
|
|
63
|
+
- `jsn skill install` — Download + save to Hermes skills directory
|
|
64
|
+
|
|
81
65
|
## Configuration
|
|
82
66
|
|
|
83
67
|
JSN uses a layered configuration system:
|
|
@@ -92,8 +76,6 @@ JSN uses a layered configuration system:
|
|
|
92
76
|
|
|
93
77
|
### Profiles
|
|
94
78
|
|
|
95
|
-
Work with multiple ServiceNow instances using profiles:
|
|
96
|
-
|
|
97
79
|
```bash
|
|
98
80
|
# Login to a new instance
|
|
99
81
|
jsn auth login https://dev12345.service-now.com
|
|
@@ -110,7 +92,7 @@ jsn profiles show
|
|
|
110
92
|
|
|
111
93
|
## Commands
|
|
112
94
|
|
|
113
|
-
###
|
|
95
|
+
### CORE
|
|
114
96
|
|
|
115
97
|
| Command | Aliases | Description |
|
|
116
98
|
|---------|---------|-------------|
|
|
@@ -118,207 +100,154 @@ jsn profiles show
|
|
|
118
100
|
| `changes` | `change`, `chg` | Manage change requests |
|
|
119
101
|
| `requests` | `request`, `req`, `ritm` | Manage service catalog requests |
|
|
120
102
|
| `tasks` | `task`, `sctask` | Manage service catalog tasks |
|
|
103
|
+
| `tickets` | `ticket` | Query generic tickets |
|
|
104
|
+
|
|
105
|
+
### DATA & ADMIN
|
|
106
|
+
|
|
107
|
+
| Command | Aliases | Description |
|
|
108
|
+
|---------|---------|-------------|
|
|
109
|
+
| `records` | - | Generic Table API for any table |
|
|
121
110
|
| `users` | `user` | Manage users |
|
|
122
111
|
| `groups` | `group` | Manage user groups |
|
|
123
|
-
| `
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
|
131
|
-
|
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
112
|
+
| `groupmembers` | `gm` | Manage group memberships |
|
|
113
|
+
| `grouproles` | `gr` | Manage group roles |
|
|
114
|
+
|
|
115
|
+
### DEVELOPMENT
|
|
116
|
+
|
|
117
|
+
| Command | Description |
|
|
118
|
+
|---------|-------------|
|
|
119
|
+
| `dev flows` | Manage Flow Designer flows |
|
|
120
|
+
| `dev actions` | Manage action definitions |
|
|
121
|
+
| `dev includes` | Manage script includes |
|
|
122
|
+
| `dev rules` | Manage business rules |
|
|
123
|
+
| `dev clientscripts` | Manage client scripts |
|
|
124
|
+
| `dev uiactions` | Manage UI actions |
|
|
125
|
+
| `dev uipolicies` | Manage UI policies |
|
|
126
|
+
| `dev tables` | View table definitions |
|
|
127
|
+
| `dev columns` | Manage column definitions |
|
|
128
|
+
| `dev import` | Manage import sets |
|
|
129
|
+
| `dev acls` | Manage access controls |
|
|
130
|
+
| `dev roles` | Manage roles |
|
|
131
|
+
| `dev updatesets` | Manage update sets |
|
|
132
|
+
| `dev scopes` | Manage application scopes |
|
|
133
|
+
| `dev properties` | Manage system properties |
|
|
134
|
+
| `dev logs` | Query system logs |
|
|
135
|
+
| `dev rest` | Raw REST API calls |
|
|
136
|
+
| `dev eval` | Execute background scripts |
|
|
137
|
+
|
|
138
|
+
### CONFIGURATION
|
|
139
|
+
|
|
140
|
+
| Command | Description |
|
|
141
|
+
|---------|-------------|
|
|
142
|
+
| `setup` | Interactive first-time setup |
|
|
143
|
+
| `auth` | Manage OAuth authentication |
|
|
144
|
+
| `profiles` | Manage instance profiles |
|
|
145
|
+
|
|
146
|
+
### UTILITY
|
|
147
|
+
|
|
148
|
+
| Command | Description |
|
|
149
|
+
|---------|-------------|
|
|
150
|
+
| `version` | Show version (use `--check` for update check) |
|
|
151
|
+
| `skill` | Manage the jsn AI agent skill file |
|
|
147
152
|
|
|
148
153
|
## Usage Examples
|
|
149
154
|
|
|
150
155
|
### Incidents
|
|
151
156
|
|
|
152
157
|
```bash
|
|
153
|
-
# List all
|
|
154
|
-
jsn incidents
|
|
155
|
-
|
|
156
|
-
# List critical incidents
|
|
157
|
-
jsn incidents list --query "priority=1"
|
|
158
|
-
|
|
159
|
-
# Show specific incident
|
|
160
|
-
jsn incidents INC0010001
|
|
161
|
-
|
|
162
|
-
# Create incident
|
|
158
|
+
jsn incidents # List all
|
|
159
|
+
jsn incidents list --query "priority=1" # Critical only
|
|
160
|
+
jsn incidents INC0010001 # Show specific
|
|
163
161
|
jsn incidents create --description "Server down" --priority 1
|
|
164
|
-
|
|
165
|
-
# Update incident
|
|
166
162
|
jsn incidents update INC0010001 --data '{"state": "6"}'
|
|
167
|
-
|
|
168
|
-
# Delete incident
|
|
169
|
-
jsn incidents delete INC0010001
|
|
170
163
|
```
|
|
171
164
|
|
|
172
|
-
###
|
|
165
|
+
### Requests (with enriched details)
|
|
173
166
|
|
|
174
167
|
```bash
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
#
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
#
|
|
182
|
-
jsn changes create --description "Deploy feature" --risk medium
|
|
183
|
-
|
|
184
|
-
# Update change
|
|
185
|
-
jsn changes update CHG0010001 --data '{"state": "3"}'
|
|
186
|
-
|
|
187
|
-
# Delete change
|
|
188
|
-
jsn changes delete CHG0010001
|
|
168
|
+
jsn requests show RITM0010001
|
|
169
|
+
# Output includes attachments + catalog variables:
|
|
170
|
+
# ─ Attachments ─
|
|
171
|
+
# onboarding_form.pdf (by John Smith, 2026-05-15 14:23:10)
|
|
172
|
+
# ─ Catalog Variables ─
|
|
173
|
+
# Department: Engineering
|
|
174
|
+
# Urgency: High
|
|
189
175
|
```
|
|
190
176
|
|
|
191
|
-
### Development
|
|
177
|
+
### Development
|
|
192
178
|
|
|
193
179
|
```bash
|
|
194
|
-
#
|
|
195
|
-
#
|
|
196
|
-
jsn dev
|
|
197
|
-
|
|
198
|
-
#
|
|
199
|
-
jsn dev actions
|
|
200
|
-
|
|
201
|
-
# SCRIPTS
|
|
202
|
-
# List script includes
|
|
203
|
-
jsn dev includes
|
|
204
|
-
|
|
205
|
-
# Get a specific script include
|
|
206
|
-
jsn dev includes MyScriptInclude
|
|
207
|
-
|
|
208
|
-
# List business rules
|
|
209
|
-
jsn dev rules
|
|
210
|
-
|
|
211
|
-
# List client scripts
|
|
212
|
-
jsn dev clientscripts
|
|
213
|
-
|
|
214
|
-
# List UI actions
|
|
215
|
-
jsn dev uiactions
|
|
216
|
-
|
|
217
|
-
# List UI policies
|
|
218
|
-
jsn dev uipolicies
|
|
219
|
-
|
|
220
|
-
# DATA
|
|
221
|
-
# View table definition
|
|
222
|
-
jsn dev tables incident
|
|
223
|
-
|
|
224
|
-
# List table columns
|
|
225
|
-
jsn dev columns --table incident
|
|
226
|
-
|
|
227
|
-
# SECURITY
|
|
228
|
-
# List access controls (ACLs)
|
|
229
|
-
jsn dev acls
|
|
230
|
-
|
|
231
|
-
# List roles
|
|
232
|
-
jsn dev roles
|
|
233
|
-
|
|
234
|
-
# PLATFORM
|
|
235
|
-
# List update sets
|
|
236
|
-
jsn dev updatesets
|
|
237
|
-
|
|
238
|
-
# Set current update set
|
|
239
|
-
jsn dev updatesets set "My Update Set"
|
|
240
|
-
|
|
241
|
-
# List application scopes
|
|
242
|
-
jsn dev scopes
|
|
243
|
-
|
|
244
|
-
# Query system properties
|
|
245
|
-
jsn dev properties
|
|
246
|
-
|
|
247
|
-
# Query system logs
|
|
248
|
-
jsn dev logs --level error
|
|
249
|
-
jsn dev logs --source "Business Rule" --level warn
|
|
250
|
-
|
|
251
|
-
# Execute background script
|
|
252
|
-
jsn dev eval "gs.info('Hello World')"
|
|
180
|
+
jsn dev flows # List flows
|
|
181
|
+
jsn dev includes MyScriptInclude # Show a script include
|
|
182
|
+
jsn dev rules # List business rules
|
|
183
|
+
jsn dev updatesets set "My Update Set" # Set current updateset
|
|
184
|
+
jsn dev eval "gs.info('Hello World')" # Run background script
|
|
253
185
|
```
|
|
254
186
|
|
|
255
187
|
### Generic Table API
|
|
256
188
|
|
|
257
189
|
```bash
|
|
258
|
-
# List any table
|
|
259
190
|
jsn records list --table incident --limit 10
|
|
260
|
-
|
|
261
|
-
# Query with encoded query
|
|
262
191
|
jsn records list --table incident --query "priority=1^active=true"
|
|
263
|
-
|
|
264
|
-
# Show specific columns
|
|
265
|
-
jsn records list --table incident --columns "number,short_description,priority"
|
|
266
|
-
|
|
267
|
-
# Get a record by sys_id
|
|
268
192
|
jsn records get --table incident --sys-id abc123
|
|
269
|
-
|
|
270
|
-
# Create a record
|
|
271
193
|
jsn records create --table incident --data '{"short_description": "Test"}'
|
|
272
|
-
|
|
273
|
-
# Update a record
|
|
274
|
-
jsn records update --table incident --sys-id abc123 --data '{"priority": "1"}'
|
|
275
|
-
|
|
276
|
-
# Delete a record
|
|
277
|
-
jsn records delete --table incident --sys-id abc123
|
|
278
194
|
```
|
|
279
195
|
|
|
280
196
|
## Output Formats
|
|
281
197
|
|
|
282
|
-
JSN supports multiple output formats:
|
|
283
|
-
|
|
284
198
|
| Format | Flag | Description |
|
|
285
199
|
|--------|------|-------------|
|
|
286
200
|
| Auto (default) | `--format=auto` | JSON for pipes, styled for TTY |
|
|
287
201
|
| JSON | `--json` or `--format=json` | Machine-readable JSON |
|
|
288
|
-
| Styled | `--styled` | ANSI-styled tables
|
|
202
|
+
| Styled | `--styled` | ANSI-styled tables |
|
|
289
203
|
| Markdown | `--markdown` | Markdown tables |
|
|
290
204
|
| Quiet | `--quiet` or `-q` | Data only, no envelope |
|
|
291
205
|
|
|
292
206
|
```bash
|
|
293
|
-
|
|
294
|
-
jsn incidents --json
|
|
295
|
-
|
|
296
|
-
# Styled table output
|
|
207
|
+
jsn incidents --json | jq '.[].number'
|
|
297
208
|
jsn incidents --styled
|
|
298
|
-
|
|
299
|
-
# Markdown output for documentation
|
|
300
|
-
jsn incidents --markdown
|
|
301
|
-
|
|
302
|
-
# Quiet mode for piping
|
|
303
209
|
jsn incidents -q | jq '.[].number'
|
|
304
210
|
```
|
|
305
211
|
|
|
306
212
|
## Authentication
|
|
307
213
|
|
|
308
|
-
|
|
214
|
+
OAuth 2.0 with PKCE. Credentials stored in `~/.config/servicenow/credentials/`.
|
|
309
215
|
|
|
310
216
|
```bash
|
|
311
|
-
# Login to an instance
|
|
312
217
|
jsn auth login https://dev12345.service-now.com
|
|
313
218
|
|
|
314
|
-
#
|
|
315
|
-
jsn auth
|
|
219
|
+
# Bot-friendly: print auth URL instead of opening a browser
|
|
220
|
+
jsn auth login https://dev12345.service-now.com --print-url
|
|
316
221
|
|
|
317
|
-
#
|
|
318
|
-
jsn auth
|
|
222
|
+
# Paste code from browser
|
|
223
|
+
jsn auth login https://dev12345.service-now.com --code ABC123
|
|
319
224
|
```
|
|
320
225
|
|
|
321
|
-
|
|
226
|
+
### CI/CD Integration
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
export SERVICENOW_INSTANCE_URL="https://dev12345.service-now.com"
|
|
230
|
+
export SERVICENOW_OAUTH_TOKEN="***"
|
|
231
|
+
jsn incidents list # No interactive auth needed
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## AI Agent Integration
|
|
235
|
+
|
|
236
|
+
JSN includes a built-in skill file for AI agents:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# View the skill file
|
|
240
|
+
jsn skill show
|
|
241
|
+
|
|
242
|
+
# Download the latest skill from GitHub
|
|
243
|
+
jsn skill fetch | head -30
|
|
244
|
+
|
|
245
|
+
# Install to Hermes skills directory
|
|
246
|
+
jsn skill install
|
|
247
|
+
|
|
248
|
+
# Install to a custom location
|
|
249
|
+
jsn skill install /path/to/skills/
|
|
250
|
+
```
|
|
322
251
|
|
|
323
252
|
## Environment Variables
|
|
324
253
|
|
|
@@ -327,114 +256,96 @@ Credentials are stored in `~/.config/servicenow/credentials/` (file-based, OS ke
|
|
|
327
256
|
| `SERVICENOW_INSTANCE_URL` | Default instance URL |
|
|
328
257
|
| `SERVICENOW_FORMAT` | Default output format |
|
|
329
258
|
| `SERVICENOW_OAUTH_TOKEN` | OAuth token (for CI/CD) |
|
|
259
|
+
| `JSN_NO_HEADER` | Suppress context header |
|
|
330
260
|
|
|
331
|
-
##
|
|
332
|
-
|
|
333
|
-
For automated environments, use the OAuth token:
|
|
261
|
+
## Getting Help
|
|
334
262
|
|
|
335
263
|
```bash
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
jsn incidents list
|
|
264
|
+
jsn # Categorized help with command groups
|
|
265
|
+
jsn incidents --help # Command details
|
|
266
|
+
jsn version # Show version
|
|
267
|
+
jsn version --check # Check for npm updates
|
|
341
268
|
```
|
|
342
269
|
|
|
343
|
-
##
|
|
344
|
-
|
|
345
|
-
> **Note:** Shell completion is available in the Go version only.
|
|
270
|
+
## Development
|
|
346
271
|
|
|
347
272
|
```bash
|
|
348
|
-
|
|
349
|
-
|
|
273
|
+
git clone https://github.com/jacebenson/jsn.git
|
|
274
|
+
cd jsn
|
|
275
|
+
git checkout nodejs
|
|
276
|
+
npm install
|
|
277
|
+
npm test # 128+ tests
|
|
278
|
+
npm run lint # ESLint
|
|
279
|
+
npm run start # Run CLI locally
|
|
280
|
+
```
|
|
350
281
|
|
|
351
|
-
|
|
352
|
-
source <(jsn completion zsh)
|
|
282
|
+
### Project Structure
|
|
353
283
|
|
|
354
|
-
|
|
355
|
-
|
|
284
|
+
```
|
|
285
|
+
├── src/
|
|
286
|
+
│ ├── cli.js # Root CLI (yargs setup)
|
|
287
|
+
│ ├── app.js # App context
|
|
288
|
+
│ ├── auth.js # OAuth PKCE manager
|
|
289
|
+
│ ├── sdk.js # ServiceNow REST API client
|
|
290
|
+
│ ├── output.js # Output formatting
|
|
291
|
+
│ ├── config.js # Configuration loader
|
|
292
|
+
│ ├── context.js # Runtime context
|
|
293
|
+
│ ├── errors.js # Structured error types
|
|
294
|
+
│ ├── helpers.js # Shared utilities
|
|
295
|
+
│ ├── help.js # Custom grouped help renderer
|
|
296
|
+
│ └── commands/ # CLI command modules
|
|
297
|
+
├── skills/
|
|
298
|
+
│ └── servicenow/
|
|
299
|
+
│ └── SKILL.md # AI agent skill file
|
|
300
|
+
├── test/ # Test suite
|
|
301
|
+
└── package.json
|
|
356
302
|
```
|
|
357
303
|
|
|
358
|
-
|
|
304
|
+
### Releasing
|
|
359
305
|
|
|
360
306
|
```bash
|
|
361
|
-
#
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
# Command help
|
|
365
|
-
jsn incidents --help
|
|
366
|
-
|
|
367
|
-
# Subcommand help
|
|
368
|
-
jsn incidents create --help
|
|
307
|
+
npm run release -- patch # or minor, major
|
|
308
|
+
# Creates node-v* tag, pushes to GitHub, publishes to npm
|
|
369
309
|
```
|
|
370
310
|
|
|
371
311
|
## Troubleshooting
|
|
372
312
|
|
|
373
313
|
### Not authenticated
|
|
374
314
|
|
|
375
|
-
```
|
|
315
|
+
```
|
|
376
316
|
⚠️ Not authenticated to https://dev12345.service-now.com
|
|
377
317
|
|
|
378
318
|
To get started, run:
|
|
379
|
-
jsn setup
|
|
380
|
-
jsn auth login
|
|
319
|
+
jsn setup
|
|
320
|
+
jsn auth login
|
|
381
321
|
```
|
|
382
322
|
|
|
383
|
-
**Solution**: Run `jsn setup` or `jsn auth login <instance>`
|
|
384
|
-
|
|
385
323
|
### Instance URL required
|
|
386
324
|
|
|
387
|
-
```bash
|
|
388
|
-
Error (usage): Instance URL required. Set via --instance flag, SERVICENOW_INSTANCE_URL env, or config file.
|
|
389
325
|
```
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
- `jsn setup`
|
|
393
|
-
- `jsn auth login <instance>`
|
|
394
|
-
- `--instance` flag
|
|
395
|
-
- `SERVICENOW_INSTANCE_URL` environment variable
|
|
396
|
-
|
|
397
|
-
## Development
|
|
398
|
-
|
|
399
|
-
This repository maintains two parallel implementations:
|
|
400
|
-
|
|
401
|
-
- **`main`** — Go implementation (stable)
|
|
402
|
-
- **`nodejs`** — Node.js implementation (active development)
|
|
403
|
-
|
|
404
|
-
Both branches share the same CLI interface and are kept in sync for feature parity.
|
|
405
|
-
|
|
406
|
-
### Node.js version
|
|
407
|
-
|
|
408
|
-
```bash
|
|
409
|
-
git checkout nodejs
|
|
410
|
-
npm install
|
|
411
|
-
npm test # Run tests
|
|
412
|
-
npm run lint # Run ESLint
|
|
413
|
-
npm run start # Run CLI locally
|
|
326
|
+
Error (usage): Instance URL required. Set via --instance flag,
|
|
327
|
+
SERVICENOW_INSTANCE_URL env, or config file.
|
|
414
328
|
```
|
|
415
329
|
|
|
416
|
-
###
|
|
330
|
+
### Outdated version
|
|
417
331
|
|
|
418
332
|
```bash
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
# From main branch — creates go-v* tag and builds binaries
|
|
423
|
-
npm run release -- patch
|
|
333
|
+
jsn version --check
|
|
334
|
+
# → jsn 0.0.10 — newer version 0.1.0 available
|
|
335
|
+
npm install -g @jacebenson/jsn
|
|
424
336
|
```
|
|
425
337
|
|
|
426
|
-
## Contributing
|
|
427
|
-
|
|
428
|
-
1. Fork the repository
|
|
429
|
-
2. Create a feature branch (target the appropriate branch: `main` or `nodejs`)
|
|
430
|
-
3. Make your changes
|
|
431
|
-
4. Add tests
|
|
432
|
-
5. Submit a pull request
|
|
433
|
-
|
|
434
338
|
## License
|
|
435
339
|
|
|
436
|
-
MIT License
|
|
340
|
+
MIT License — see LICENSE file for details
|
|
437
341
|
|
|
438
342
|
## Acknowledgments
|
|
439
343
|
|
|
440
|
-
This project follows
|
|
344
|
+
This project follows architectural patterns from [basecamp-cli](https://github.com/basecamp/basecamp-cli).
|
|
345
|
+
|
|
346
|
+
| Project | What we learned |
|
|
347
|
+
|---------|----------------|
|
|
348
|
+
| [Abey's `sn` CLI](https://github.com/tehubersheezy/servicenow-cli) (Rust) | Table API patterns, aggregate stats, raw REST passthrough |
|
|
349
|
+
| [ServiceNow `now-sdk`](https://www.npmjs.com/package/@servicenow/sdk) | OAuth session flow for UI pages |
|
|
350
|
+
| [ServiceNow VS Code Extension](https://marketplace.visualstudio.com/items?itemName=ServiceNow.now-vscode) | `sys.scripts.do` CSRF extraction |
|
|
351
|
+
| [Getting Real](https://basecamp.com/gettingreal) by Basecamp | Build less, start with no, embrace constraints |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacebenson/jsn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.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": {
|
|
@@ -33,11 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/js": "^10.0.1",
|
|
36
|
+
"@inquirer/search": "^4.2.0",
|
|
36
37
|
"globals": "^17.6.0"
|
|
37
38
|
},
|
|
38
39
|
"files": [
|
|
39
40
|
"bin/jsn.js",
|
|
40
41
|
"src/",
|
|
42
|
+
"skills/",
|
|
41
43
|
"README.md",
|
|
42
44
|
"LICENSE"
|
|
43
45
|
]
|