@jacebenson/jsn 0.0.3 → 0.0.5
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 +49 -7
- package/package.json +2 -2
- package/src/auth.js +5 -5
package/README.md
CHANGED
|
@@ -2,17 +2,28 @@
|
|
|
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
|
+
|
|
5
14
|
## Installation
|
|
6
15
|
|
|
7
|
-
### npm (
|
|
16
|
+
### npm (Node.js version — cross-platform)
|
|
8
17
|
|
|
9
18
|
```bash
|
|
10
|
-
npm install -g @jacebenson/jsn
|
|
19
|
+
npm install -g @jacebenson/jsn@node
|
|
11
20
|
```
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
> **Note:** The `@node` dist-tag is required. The `latest` tag currently points to the Go shim wrapper (v1.0.1).
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
No compilation needed. Works on macOS, Linux, and Windows with Node.js 18+.
|
|
25
|
+
|
|
26
|
+
### Download Binary (Go version)
|
|
16
27
|
|
|
17
28
|
```bash
|
|
18
29
|
# Download the latest release
|
|
@@ -21,7 +32,7 @@ chmod +x jsn
|
|
|
21
32
|
sudo mv jsn /usr/local/bin/
|
|
22
33
|
```
|
|
23
34
|
|
|
24
|
-
### Go Install
|
|
35
|
+
### Go Install (Go version)
|
|
25
36
|
|
|
26
37
|
```bash
|
|
27
38
|
go install github.com/jacebenson/jsn/cmd/jsn@latest
|
|
@@ -307,7 +318,7 @@ jsn auth status
|
|
|
307
318
|
jsn auth logout
|
|
308
319
|
```
|
|
309
320
|
|
|
310
|
-
Credentials are
|
|
321
|
+
Credentials are stored in `~/.config/servicenow/credentials/` (file-based, OS keychain coming soon).
|
|
311
322
|
|
|
312
323
|
## Environment Variables
|
|
313
324
|
|
|
@@ -331,6 +342,8 @@ jsn incidents list
|
|
|
331
342
|
|
|
332
343
|
## Shell Completion
|
|
333
344
|
|
|
345
|
+
> **Note:** Shell completion is available in the Go version only.
|
|
346
|
+
|
|
334
347
|
```bash
|
|
335
348
|
# Bash
|
|
336
349
|
source <(jsn completion bash)
|
|
@@ -381,10 +394,39 @@ Error (usage): Instance URL required. Set via --instance flag, SERVICENOW_INSTAN
|
|
|
381
394
|
- `--instance` flag
|
|
382
395
|
- `SERVICENOW_INSTANCE_URL` environment variable
|
|
383
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
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Releasing
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# From nodejs branch — creates node-v* tag and publishes to npm
|
|
420
|
+
npm run release -- patch
|
|
421
|
+
|
|
422
|
+
# From main branch — creates go-v* tag and builds binaries
|
|
423
|
+
npm run release -- patch
|
|
424
|
+
```
|
|
425
|
+
|
|
384
426
|
## Contributing
|
|
385
427
|
|
|
386
428
|
1. Fork the repository
|
|
387
|
-
2. Create a feature branch
|
|
429
|
+
2. Create a feature branch (target the appropriate branch: `main` or `nodejs`)
|
|
388
430
|
3. Make your changes
|
|
389
431
|
4. Add tests
|
|
390
432
|
5. Submit a pull request
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacebenson/jsn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
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": {
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"node": ">=18.0.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@inquirer/prompts": "^7.5.1",
|
|
29
30
|
"chalk": "^5.4.1",
|
|
30
31
|
"cli-table3": "^0.6.5",
|
|
31
32
|
"yargs": "^17.7.2"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@eslint/js": "^10.0.1",
|
|
35
|
-
"@inquirer/prompts": "^7.5.1",
|
|
36
36
|
"globals": "^17.6.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
package/src/auth.js
CHANGED
|
@@ -178,11 +178,11 @@ export class AuthManager {
|
|
|
178
178
|
const open = (await import('node:child_process')).spawn;
|
|
179
179
|
const platform = process.platform;
|
|
180
180
|
const cmd = platform === 'darwin' ? 'open' : platform === 'win32' ? 'start' : 'xdg-open';
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
const child = open(cmd, [authURL], { detached: true, stdio: 'ignore' });
|
|
182
|
+
child.on('error', () => {
|
|
183
|
+
// xdg-open not installed — user will open the URL manually
|
|
184
|
+
});
|
|
185
|
+
child.unref();
|
|
186
186
|
|
|
187
187
|
console.log('After authenticating in the browser, copy the authorization code shown on the page.');
|
|
188
188
|
console.log('(input is hidden for security — just paste and press Enter)');
|