@sonisoft/now-sdk-ext-cli 3.0.0 → 5.0.0
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 +500 -164
- package/bin/credstore-boot.js +67 -0
- package/bin/dev.js +4 -0
- package/bin/run.js +4 -0
- package/dist/commands/auth/delete.d.ts +17 -0
- package/dist/commands/auth/delete.d.ts.map +1 -0
- package/dist/commands/auth/delete.js +34 -0
- package/dist/commands/auth/delete.js.map +1 -0
- package/dist/commands/auth/doctor.d.ts +23 -0
- package/dist/commands/auth/doctor.d.ts.map +1 -0
- package/dist/commands/auth/doctor.js +75 -0
- package/dist/commands/auth/doctor.js.map +1 -0
- package/dist/commands/auth/list.d.ts +15 -0
- package/dist/commands/auth/list.d.ts.map +1 -0
- package/dist/commands/auth/list.js +42 -0
- package/dist/commands/auth/list.js.map +1 -0
- package/dist/commands/auth/use.d.ts +16 -0
- package/dist/commands/auth/use.d.ts.map +1 -0
- package/dist/commands/auth/use.js +20 -0
- package/dist/commands/auth/use.js.map +1 -0
- package/dist/common/authenticated-command.d.ts +10 -0
- package/dist/common/authenticated-command.d.ts.map +1 -1
- package/dist/common/authenticated-command.js +65 -12
- package/dist/common/authenticated-command.js.map +1 -1
- package/dist/common/cred-store-flag.d.ts +17 -0
- package/dist/common/cred-store-flag.d.ts.map +1 -0
- package/dist/common/cred-store-flag.js +23 -0
- package/dist/common/cred-store-flag.js.map +1 -0
- package/dist/common/scope-autocomplete.d.ts.map +1 -1
- package/dist/common/scope-autocomplete.js +8 -0
- package/dist/common/scope-autocomplete.js.map +1 -1
- package/oclif.manifest.json +1627 -902
- package/package.json +3 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* eslint-disable n/no-process-exit, unicorn/no-process-exit -- this runs before
|
|
2
|
+
oclif exists, so there is no error handler to throw into; an uncaught rejection
|
|
3
|
+
here would print a stack trace instead of the remediation. */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Opt in to headless-safe credential storage.
|
|
7
|
+
*
|
|
8
|
+
* By default `nex` uses the ServiceNow SDK exactly as it ships: credentials come
|
|
9
|
+
* from the OS keyring, `now-sdk auth --add` still manages them, and this file
|
|
10
|
+
* does nothing. That default is deliberate — `nex` must behave identically for
|
|
11
|
+
* someone who has never heard of sn-credstore.
|
|
12
|
+
*
|
|
13
|
+
* Pass `--cred-store` (or set SN_CRED_STORE_ENABLE=1) to redirect the SDK's
|
|
14
|
+
* credential storage to @sonisoft/sn-credstore instead. That matters when the
|
|
15
|
+
* keyring cannot be unlocked: over SSH, from a systemd unit, in CI, or from an
|
|
16
|
+
* agent. In those sessions `KeyChain.getPassword()` swallows the failure and
|
|
17
|
+
* returns null, so the SDK reports "Default Credential has not been set" — which
|
|
18
|
+
* is indistinguishable from genuinely having no credentials.
|
|
19
|
+
*
|
|
20
|
+
* Imported for its side effect by bin/run.js and bin/dev.js, before oclif.
|
|
21
|
+
*
|
|
22
|
+
* The import stays dynamic even though sn-credstore is now a declared
|
|
23
|
+
* dependency, because it must NOT run unless asked: importing
|
|
24
|
+
* '@sonisoft/sn-credstore/register' installs the shim as a side effect, so a
|
|
25
|
+
* static import would install it on every invocation regardless of the flag.
|
|
26
|
+
*
|
|
27
|
+
* argv is read directly rather than through oclif's parser because the shim has
|
|
28
|
+
* to be installed before AuthenticatedCommand.init() resolves credentials, and
|
|
29
|
+
* that runs before any flag this file cares about has been parsed. The flag is
|
|
30
|
+
* still declared in AuthenticatedCommand.baseFlags so it appears in --help and
|
|
31
|
+
* is not rejected as unknown.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* True when the user asked for the credential store.
|
|
36
|
+
*
|
|
37
|
+
* SN_CRED_STORE_DISABLE wins over everything, so there is always one variable
|
|
38
|
+
* that switches the shim off no matter what else is set — including in a shell
|
|
39
|
+
* where SN_CRED_STORE_ENABLE is exported globally.
|
|
40
|
+
*/
|
|
41
|
+
function credStoreRequested() {
|
|
42
|
+
if (process.env.SN_CRED_STORE_DISABLE) return false
|
|
43
|
+
if (process.env.SN_CRED_STORE_ENABLE) return true
|
|
44
|
+
return process.argv.includes('--cred-store')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (credStoreRequested()) {
|
|
48
|
+
try {
|
|
49
|
+
await import('@sonisoft/sn-credstore/register')
|
|
50
|
+
} catch (error) {
|
|
51
|
+
// sn-credstore is a declared dependency now, so there is no "not
|
|
52
|
+
// installed" case left to tolerate — a failure here is a real failure.
|
|
53
|
+
//
|
|
54
|
+
// Continuing would silently fall back to the keyring, which is both the
|
|
55
|
+
// one thing the user just said not to do and actively unsafe: the SDK's
|
|
56
|
+
// next credential write reseeds from a failed read, wiping every other
|
|
57
|
+
// alias. Refusing to start is the safe outcome.
|
|
58
|
+
process.stderr.write(
|
|
59
|
+
`nex: the credential store failed to initialise: ${error?.message ?? error}\n` +
|
|
60
|
+
`${error?.remediation ? `\nRemediation: ${error.remediation}\n` : ''}` +
|
|
61
|
+
`\nTo run against the OS keyring instead, drop --cred-store.\n`,
|
|
62
|
+
)
|
|
63
|
+
process.exit(1)
|
|
64
|
+
}
|
|
65
|
+
} else if (process.env.SN_CRED_STORE_DEBUG) {
|
|
66
|
+
process.stderr.write('nex: credential store not requested — using the SDK keyring\n')
|
|
67
|
+
}
|
package/bin/dev.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
|
|
2
2
|
|
|
3
|
+
// FIRST, deliberately: redirect SDK credential storage off the OS keyring
|
|
4
|
+
// before anything can read credentials. See bin/credstore-boot.js.
|
|
3
5
|
// eslint-disable-next-line n/shebang
|
|
6
|
+
import './credstore-boot.js'
|
|
7
|
+
|
|
4
8
|
import {execute} from '@oclif/core'
|
|
5
9
|
|
|
6
10
|
await execute({development: true, dir: import.meta.url})
|
package/bin/run.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// FIRST, deliberately: redirect SDK credential storage off the OS keyring
|
|
4
|
+
// before anything can read credentials. See bin/credstore-boot.js.
|
|
5
|
+
import './credstore-boot.js'
|
|
6
|
+
|
|
3
7
|
import {execute} from '@oclif/core'
|
|
4
8
|
|
|
5
9
|
await execute({dir: import.meta.url})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export declare class AuthDelete extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
alias: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: {
|
|
8
|
+
command: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}[];
|
|
11
|
+
static flags: {
|
|
12
|
+
all: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
13
|
+
'cred-store': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAQ,MAAM,aAAa,CAAA;AAKhD,qBAAa,UAAW,SAAQ,OAAO;IACrC,MAAM,CAAC,IAAI;;MAEV;IACH,MAAM,CAAC,WAAW,SAEsE;IACxF,MAAM,CAAC,QAAQ;;;QAGZ;IACH,MAAM,CAAC,KAAK;;;MAGT;IAEK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAmB3B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { deleteAlias, deleteAllAliases } from '@sonisoft/sn-credstore';
|
|
3
|
+
import { credStoreFlag } from '../../common/cred-store-flag.js';
|
|
4
|
+
export class AuthDelete extends Command {
|
|
5
|
+
static args = {
|
|
6
|
+
alias: Args.string({ description: 'Alias to remove', required: false }),
|
|
7
|
+
};
|
|
8
|
+
static description = 'Remove a credential from the store.\n\n' +
|
|
9
|
+
'This does not touch the OS keyring — a copy stored there before migrating remains.';
|
|
10
|
+
static examples = [
|
|
11
|
+
{ command: '<%= config.bin %> <%= command.id %> dev206299', description: 'Remove one alias' },
|
|
12
|
+
{ command: '<%= config.bin %> <%= command.id %> --all', description: 'Remove every stored credential' },
|
|
13
|
+
];
|
|
14
|
+
static flags = {
|
|
15
|
+
...credStoreFlag,
|
|
16
|
+
all: Flags.boolean({ description: 'Remove every stored credential', required: false }),
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { args, flags } = await this.parse(AuthDelete);
|
|
20
|
+
if (flags.all) {
|
|
21
|
+
await deleteAllAliases();
|
|
22
|
+
this.log('Removed all stored credentials.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!args.alias) {
|
|
26
|
+
this.error('An alias is required, or --all to remove every credential.');
|
|
27
|
+
}
|
|
28
|
+
if (!(await deleteAlias(args.alias))) {
|
|
29
|
+
this.error(`No such alias "${args.alias}".`, { suggestions: ['Run "nex auth list" to see stored aliases.'] });
|
|
30
|
+
}
|
|
31
|
+
this.log(`Removed "${args.alias}".`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/auth/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAA;AAEpE,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAi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,KAAK,IAAI,CAAC,CAAA;IACtC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* Diagnose credential storage.
|
|
4
|
+
*
|
|
5
|
+
* The failure this exists for is silent: a locked keyring makes
|
|
6
|
+
* `KeyChain.getPassword()` return null, which the SDK reports as "Default
|
|
7
|
+
* Credential has not been set" — indistinguishable from having no credentials.
|
|
8
|
+
* So the first thing to report is whether the shim actually installed.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AuthDoctor extends Command {
|
|
11
|
+
static args: {};
|
|
12
|
+
static description: string;
|
|
13
|
+
static enableJsonFlag: boolean;
|
|
14
|
+
static examples: {
|
|
15
|
+
command: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}[];
|
|
18
|
+
static flags: {
|
|
19
|
+
'cred-store': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
20
|
+
};
|
|
21
|
+
run(): Promise<unknown>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAKnC;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,OAAO;IACrC,MAAM,CAAC,IAAI,KAAK;IAChB,MAAM,CAAC,WAAW,SAC2F;IAC7G,MAAM,CAAC,cAAc,UAAO;IAC5B,MAAM,CAAC,QAAQ;;;QAGd;IACH,MAAM,CAAC,KAAK;;MAAqB;IAGzB,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CA0D9B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { listAliases, loadConfig, PATCHED_ENV_VAR, probeAll } from '@sonisoft/sn-credstore';
|
|
3
|
+
import { credStoreFlag } from '../../common/cred-store-flag.js';
|
|
4
|
+
/**
|
|
5
|
+
* Diagnose credential storage.
|
|
6
|
+
*
|
|
7
|
+
* The failure this exists for is silent: a locked keyring makes
|
|
8
|
+
* `KeyChain.getPassword()` return null, which the SDK reports as "Default
|
|
9
|
+
* Credential has not been set" — indistinguishable from having no credentials.
|
|
10
|
+
* So the first thing to report is whether the shim actually installed.
|
|
11
|
+
*/
|
|
12
|
+
export class AuthDoctor extends Command {
|
|
13
|
+
static args = {};
|
|
14
|
+
static description = 'Diagnose credential storage: whether the SDK shim is active, which backend is in use, and what is stored.';
|
|
15
|
+
static enableJsonFlag = true;
|
|
16
|
+
static examples = [
|
|
17
|
+
{ command: '<%= config.bin %> <%= command.id %>', description: 'Check credential storage health' },
|
|
18
|
+
{ command: '<%= config.bin %> <%= command.id %> --json', description: 'Machine-readable output for CI' },
|
|
19
|
+
];
|
|
20
|
+
static flags = { ...credStoreFlag };
|
|
21
|
+
async run() {
|
|
22
|
+
await this.parse(AuthDoctor);
|
|
23
|
+
const config = loadConfig();
|
|
24
|
+
const shimActive = process.env[PATCHED_ENV_VAR] === '1';
|
|
25
|
+
const backends = await probeAll(config);
|
|
26
|
+
// listAliases reads the active backend, so it can legitimately fail (no
|
|
27
|
+
// systemd in a container, an undecryptable blob after a reimage). That is a
|
|
28
|
+
// finding to report, not a crash.
|
|
29
|
+
let summary;
|
|
30
|
+
let readError;
|
|
31
|
+
try {
|
|
32
|
+
summary = await listAliases(config);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
readError = error instanceof Error ? error.message : String(error);
|
|
36
|
+
}
|
|
37
|
+
const report = {
|
|
38
|
+
aliases: summary?.aliases ?? [],
|
|
39
|
+
backends,
|
|
40
|
+
path: config.blobPath,
|
|
41
|
+
shimActive,
|
|
42
|
+
store: config.store,
|
|
43
|
+
...(readError ? { readError } : {}),
|
|
44
|
+
};
|
|
45
|
+
if (this.jsonEnabled())
|
|
46
|
+
return report;
|
|
47
|
+
this.log(`shim active : ${shimActive ? 'yes' : 'NO'}`);
|
|
48
|
+
if (!shimActive) {
|
|
49
|
+
this.log('');
|
|
50
|
+
this.log(' The SDK is reading the OS keyring, which non-interactive sessions cannot unlock.');
|
|
51
|
+
this.log(' If this is unexpected, check that SN_CRED_STORE_DISABLE is unset.');
|
|
52
|
+
}
|
|
53
|
+
this.log(`store : ${config.store}`);
|
|
54
|
+
this.log(`path : ${config.blobPath}`);
|
|
55
|
+
this.log('');
|
|
56
|
+
this.log('backends:');
|
|
57
|
+
for (const backend of backends) {
|
|
58
|
+
const state = backend.available ? 'available' : 'unavailable';
|
|
59
|
+
this.log(` ${backend.id.padEnd(14)} ${state}${backend.error ? ` — ${backend.error}` : ''}`);
|
|
60
|
+
this.log(` ${''.padEnd(14)} ${backend.description}`);
|
|
61
|
+
}
|
|
62
|
+
this.log('');
|
|
63
|
+
if (readError) {
|
|
64
|
+
this.log(`credentials : COULD NOT READ — ${readError}`);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.log(`credentials : ${report.aliases.length} stored`);
|
|
68
|
+
for (const info of report.aliases) {
|
|
69
|
+
this.log(` ${info.isDefault ? '*' : ' '} ${info.alias} (${info.type}) ${info.instanceUrl}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return report;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/commands/auth/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAEzF,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAA;AAE7D;;;;;;;GAOG;AACH,MAAM,OAAO,UA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oC,SAAS,EAAE,CAAC,CAAA;QAC3D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,OAAO,CAAC,MAAM,SAAS,CAAC,CAAA;YAC3D,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;YAChG,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export declare class AuthList extends Command {
|
|
3
|
+
static args: {};
|
|
4
|
+
static description: string;
|
|
5
|
+
static enableJsonFlag: boolean;
|
|
6
|
+
static examples: {
|
|
7
|
+
command: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}[];
|
|
10
|
+
static flags: {
|
|
11
|
+
'cred-store': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAKnC,qBAAa,QAAS,SAAQ,OAAO;IACnC,MAAM,CAAC,IAAI,KAAK;IAChB,MAAM,CAAC,WAAW,SAIY;IAC9B,MAAM,CAAC,cAAc,UAAO;IAC5B,MAAM,CAAC,QAAQ;;;QAGd;IACH,MAAM,CAAC,KAAK;;MAAqB;IAGzB,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAiC9B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { listAliases } from '@sonisoft/sn-credstore';
|
|
3
|
+
import { credStoreFlag } from '../../common/cred-store-flag.js';
|
|
4
|
+
export class AuthList extends Command {
|
|
5
|
+
static args = {};
|
|
6
|
+
static description = 'List credentials in the headless-safe credential store.\n\n' +
|
|
7
|
+
'These are the credentials the ServiceNow SDK reads via the sn-credstore shim, ' +
|
|
8
|
+
'which works in non-interactive sessions where the OS keyring cannot be unlocked.\n\n' +
|
|
9
|
+
'Secrets are never printed.';
|
|
10
|
+
static enableJsonFlag = true;
|
|
11
|
+
static examples = [
|
|
12
|
+
{ command: '<%= config.bin %> <%= command.id %>', description: 'List stored credentials' },
|
|
13
|
+
{ command: '<%= config.bin %> <%= command.id %> --json', description: 'List as JSON for scripting' },
|
|
14
|
+
];
|
|
15
|
+
static flags = { ...credStoreFlag };
|
|
16
|
+
async run() {
|
|
17
|
+
await this.parse(AuthList);
|
|
18
|
+
const summary = await listAliases();
|
|
19
|
+
if (this.jsonEnabled())
|
|
20
|
+
return summary;
|
|
21
|
+
this.log(summary.description);
|
|
22
|
+
this.log('');
|
|
23
|
+
if (summary.aliases.length === 0) {
|
|
24
|
+
this.log('No credentials stored.');
|
|
25
|
+
this.log('');
|
|
26
|
+
this.log('Import existing ones: sn-credstore import --from keyring');
|
|
27
|
+
this.log('Or add a new one: now-sdk-x auth --add <instance>');
|
|
28
|
+
return summary;
|
|
29
|
+
}
|
|
30
|
+
for (const info of summary.aliases) {
|
|
31
|
+
this.log(`${info.isDefault ? '*' : ' '} ${info.alias}`);
|
|
32
|
+
this.log(` host = ${info.instanceUrl}`);
|
|
33
|
+
this.log(` type = ${info.type}`);
|
|
34
|
+
this.log(info.type === 'basic'
|
|
35
|
+
? ` username = ${info.username}`
|
|
36
|
+
: // Expired is not an error worth flagging red: the next use refreshes it.
|
|
37
|
+
` expires = ${new Date(info.expiresAt * 1000).toISOString()}${info.expired ? ' (EXPIRED — refreshes on next use)' : ''}`);
|
|
38
|
+
}
|
|
39
|
+
return summary;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/auth/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA;AAElD,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAA;AAE7D,MAAM,OAAO,QAAS,SAAQ,OAAO;IACnC,MAAM,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,MAAM,CAAC,WAAW,GAChB,6DAA6D;QAC7D,gFAAgF;QAChF,sFAAsF;QACtF,4BAA4B,CAAA;IAC9B,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAC5B,MAAM,CAAC,QAAQ,GAAG;QAChB,EAAC,OAAO,EAAE,qCAAqC,EAAE,WAAW,EAAE,yBAAyB,EAAC;QACxF,EAAC,OAAO,EAAE,4CAA4C,EAAE,WAAW,EAAE,4BAA4B,EAAC;KACnG,CAAA;IACH,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,aAAa,EAAC,CAAA;IAG/B,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC1B,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAA;QAEnC,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO,OAAO,CAAA;QAEtC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAC7B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAEZ,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;YAClC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YACZ,IAAI,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAA;YACrE,IAAI,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAA;YAClE,OAAO,OAAO,CAAA;QAChB,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACnC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;YACvD,IAAI,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;YAC5C,IAAI,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;YACrC,IAAI,CAAC,GAAG,CACN,IAAI,CAAC,IAAI,KAAK,OAAO;gBACnB,CAAC,CAAC,oBAAoB,IAAI,CAAC,QAAQ,EAAE;gBACrC,CAAC,CAAC,yEAAyE;oBACzE,mBAAmB,IAAI,IAAI,CAAC,IAAI,CAAC,SAAU,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,GAC/D,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,EACzD,EAAE,CACP,CAAA;QACH,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export declare class AuthUse extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
alias: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: {
|
|
8
|
+
command: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}[];
|
|
11
|
+
static flags: {
|
|
12
|
+
'cred-store': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=use.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAC,MAAM,aAAa,CAAA;AAKzC,qBAAa,OAAQ,SAAQ,OAAO;IAClC,MAAM,CAAC,IAAI;;MAEV;IACH,MAAM,CAAC,WAAW,SAE+B;IACjD,MAAM,CAAC,QAAQ;;;QAA0G;IACzH,MAAM,CAAC,KAAK;;MAAqB;IAEzB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAS3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import { setDefaultAlias } from '@sonisoft/sn-credstore';
|
|
3
|
+
import { credStoreFlag } from '../../common/cred-store-flag.js';
|
|
4
|
+
export class AuthUse extends Command {
|
|
5
|
+
static args = {
|
|
6
|
+
alias: Args.string({ description: 'Alias to make the default', required: true }),
|
|
7
|
+
};
|
|
8
|
+
static description = 'Set the default credential alias.\n\n' +
|
|
9
|
+
'Commands run without --auth use this alias.';
|
|
10
|
+
static examples = [{ command: '<%= config.bin %> <%= command.id %> dev206299', description: 'Make dev206299 the default' }];
|
|
11
|
+
static flags = { ...credStoreFlag };
|
|
12
|
+
async run() {
|
|
13
|
+
const { args } = await this.parse(AuthUse);
|
|
14
|
+
if (!(await setDefaultAlias(args.alias))) {
|
|
15
|
+
this.error(`No such alias "${args.alias}".`, { suggestions: ['Run "nex auth list" to see stored aliases.'] });
|
|
16
|
+
}
|
|
17
|
+
this.log(`Default alias is now "${args.alias}"`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=use.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/commands/auth/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAA;AAEtD,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAA;AAE7D,MAAM,OAAO,OAAQ,SAAQ,OAAO;IAClC,MAAM,CAAC,IAAI,GAAG;QACZ,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,2BAA2B,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;KAC/E,CAAA;IACH,MAAM,CAAC,WAAW,GACd,uCAAuC;QACvC,6CAA6C,CAAA;IACjD,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAC,OAAO,EAAE,+CAA+C,EAAE,WAAW,EAAE,4BAA4B,EAAC,CAAC,CAAA;IACzH,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,aAAa,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAExC,IAAI,CAAC,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,KAAK,IAAI,EAAE,EAAC,WAAW,EAAE,CAAC,4CAA4C,CAAC,EAAC,CAAC,CAAA;QAC7G,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,yBAAyB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;IAClD,CAAC"}
|
|
@@ -5,6 +5,7 @@ export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
|
|
|
5
5
|
export declare abstract class AuthenticatedCommand<T extends typeof Command> extends Command {
|
|
6
6
|
static baseFlags: {
|
|
7
7
|
auth: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
8
|
+
'cred-store': Interfaces.BooleanFlag<boolean>;
|
|
8
9
|
'log-level': Interfaces.OptionFlag<"info" | "debug" | "warn" | "error" | "trace", Interfaces.CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
static enableJsonFlag: boolean;
|
|
@@ -20,5 +21,14 @@ export declare abstract class AuthenticatedCommand<T extends typeof Command> ext
|
|
|
20
21
|
}): Promise<any>;
|
|
21
22
|
protected finally(_: Error | undefined): Promise<any>;
|
|
22
23
|
init(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Fail with remediation the user can act on.
|
|
26
|
+
*
|
|
27
|
+
* The keyring failure mode this guards against is silent: in a non-interactive
|
|
28
|
+
* session the keyring cannot be unlocked, `KeyChain.getPassword()` swallows the
|
|
29
|
+
* error and returns null, and the SDK reports it as "no credentials" — which is
|
|
30
|
+
* indistinguishable from genuinely having none. So say which of the two it is.
|
|
31
|
+
*/
|
|
32
|
+
private failAuth;
|
|
23
33
|
}
|
|
24
34
|
//# sourceMappingURL=authenticated-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticated-command.d.ts","sourceRoot":"","sources":["../../src/common/authenticated-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAS,UAAU,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAA8B,MAAM,4BAA4B,CAAC;AAMpG,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,OAAO,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAA;AAC7H,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE/E,8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,OAAO,CAAC,GAAG,CAAC;IAK9C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAuDlC;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;CA0BjB"}
|
|
@@ -6,6 +6,16 @@ export class AuthenticatedCommand extends Command {
|
|
|
6
6
|
// // define flags that can be inherited by any command that extends BaseCommand
|
|
7
7
|
static baseFlags = {
|
|
8
8
|
'auth': Flags.string({ char: 'a', description: 'Auth alias to use.', required: false }),
|
|
9
|
+
// Declared so it appears in --help and is not rejected as unknown. It is
|
|
10
|
+
// ACTED ON in bin/credstore-boot.js, which reads argv directly: the shim has
|
|
11
|
+
// to be installed before init() resolves credentials, and that runs before
|
|
12
|
+
// oclif has parsed anything.
|
|
13
|
+
'cred-store': Flags.boolean({
|
|
14
|
+
description: 'Read credentials from @sonisoft/sn-credstore instead of the OS keyring. ' +
|
|
15
|
+
'Use this in headless sessions (SSH, systemd, CI, agents) where the keyring cannot be unlocked.',
|
|
16
|
+
helpGroup: 'GLOBAL',
|
|
17
|
+
required: false,
|
|
18
|
+
}),
|
|
9
19
|
'log-level': Flags.option({
|
|
10
20
|
default: 'info',
|
|
11
21
|
helpGroup: 'GLOBAL',
|
|
@@ -27,9 +37,11 @@ export class AuthenticatedCommand extends Command {
|
|
|
27
37
|
this._logger = logger;
|
|
28
38
|
}
|
|
29
39
|
async catch(err) {
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
|
|
40
|
+
// authLogger is assigned partway through init(), so anything that throws
|
|
41
|
+
// before that point — a missing required flag, for instance — arrived here
|
|
42
|
+
// with it still undefined and produced "Cannot read properties of undefined
|
|
43
|
+
// (reading 'error')", hiding the actual usage error behind a TypeError.
|
|
44
|
+
this.authLogger?.error("Globally caught exception occurred.", err);
|
|
33
45
|
return super.catch(err);
|
|
34
46
|
}
|
|
35
47
|
async finally(_) {
|
|
@@ -57,21 +69,62 @@ export class AuthenticatedCommand extends Command {
|
|
|
57
69
|
// const credential:Creds = await (flags.auth ? wrapper.getStoredCredentialsByAlias(flags.auth) : wrapper.getStoredCredentialsByAlias( 'fluent-default'));
|
|
58
70
|
// const credentialArgs = {"_": "get-credentials", auth: flags.auth || "fluent-default"};
|
|
59
71
|
const alias = flags.auth || "fluent-default";
|
|
60
|
-
|
|
72
|
+
let credential;
|
|
73
|
+
try {
|
|
74
|
+
credential = await getCredentials(alias);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
// getCredentials throws for an unknown alias, but it also throws when the
|
|
78
|
+
// store itself is unreachable. Those need different remediation, and
|
|
79
|
+
// sn-credstore's errors carry their own — so pass it through rather than
|
|
80
|
+
// replacing it with a generic "check your alias".
|
|
81
|
+
this.failAuth(alias, error);
|
|
82
|
+
}
|
|
61
83
|
// Never log `credential` or any object containing it (e.g. snSettings) — it
|
|
62
84
|
// holds the ServiceNow password/token, and these lines run at --log-level
|
|
63
85
|
// debug, which would write it to the terminal and to CI logs.
|
|
64
86
|
this.authLogger.debug("Credential lookup complete.", { alias, found: Boolean(credential) });
|
|
65
|
-
if (credential) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.instance = new ServiceNowInstance(snSettings);
|
|
87
|
+
if (!credential) {
|
|
88
|
+
// Previously this only logged, leaving this.instance undefined so the
|
|
89
|
+
// command failed later with an unrelated TypeError. An unusable command
|
|
90
|
+
// must not start.
|
|
91
|
+
this.failAuth(alias);
|
|
71
92
|
}
|
|
72
|
-
|
|
73
|
-
|
|
93
|
+
const snSettings = {
|
|
94
|
+
alias: flags.auth,
|
|
95
|
+
credential
|
|
96
|
+
};
|
|
97
|
+
this.instance = new ServiceNowInstance(snSettings);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Fail with remediation the user can act on.
|
|
101
|
+
*
|
|
102
|
+
* The keyring failure mode this guards against is silent: in a non-interactive
|
|
103
|
+
* session the keyring cannot be unlocked, `KeyChain.getPassword()` swallows the
|
|
104
|
+
* error and returns null, and the SDK reports it as "no credentials" — which is
|
|
105
|
+
* indistinguishable from genuinely having none. So say which of the two it is.
|
|
106
|
+
*/
|
|
107
|
+
failAuth(alias, cause) {
|
|
108
|
+
const shimActive = process.env.NOW_SDK_KEYCHAIN_PATCHED === '1';
|
|
109
|
+
const suggestions = [
|
|
110
|
+
'Run "nex auth list" to see stored credentials.',
|
|
111
|
+
'Run "nex auth doctor" to check credential storage.',
|
|
112
|
+
];
|
|
113
|
+
if (!shimActive) {
|
|
114
|
+
// Not necessarily wrong — the keyring is the default and works fine in a
|
|
115
|
+
// desktop session. But it is the likeliest explanation for "no credentials"
|
|
116
|
+
// when there is no terminal to unlock the keyring from, and that is exactly
|
|
117
|
+
// when nobody is around to reason it out.
|
|
118
|
+
suggestions.unshift('If this is a headless session (SSH, systemd, CI, an agent), the OS keyring cannot be ' +
|
|
119
|
+
'unlocked and will report no credentials regardless of what is stored. Pass --cred-store ' +
|
|
120
|
+
'to read from @sonisoft/sn-credstore instead.');
|
|
74
121
|
}
|
|
122
|
+
// sn-credstore errors carry actionable remediation; a bare message loses it.
|
|
123
|
+
const remediation = cause?.remediation;
|
|
124
|
+
if (remediation)
|
|
125
|
+
suggestions.unshift(remediation);
|
|
126
|
+
const detail = cause instanceof Error ? cause.message : `No credentials found for alias "${alias}".`;
|
|
127
|
+
this.error(detail, { suggestions });
|
|
75
128
|
}
|
|
76
129
|
}
|
|
77
130
|
//# sourceMappingURL=authenticated-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticated-command.js","sourceRoot":"","sources":["../../src/common/authenticated-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAc,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAU,kBAAkB,EAA8B,MAAM,4BAA4B,CAAC;AAEpG,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAOpD,MAA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is what
|
|
5
|
+
* they are for — so the flag is redundant on them. But it is a global flag on
|
|
6
|
+
* every authenticated command, and people reasonably type it here too. Rejecting
|
|
7
|
+
* it with "Nonexistent flag: --cred-store" reads like the feature is missing
|
|
8
|
+
* rather than already implied.
|
|
9
|
+
*
|
|
10
|
+
* Declared, not acted on. The one place it has an effect is
|
|
11
|
+
* bin/credstore-boot.js, which reads process.argv directly because the shim must
|
|
12
|
+
* be installed before oclif parses anything.
|
|
13
|
+
*/
|
|
14
|
+
export declare const credStoreFlag: {
|
|
15
|
+
'cred-store': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=cred-store-flag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cred-store-flag.d.ts","sourceRoot":"","sources":["../../src/common/cred-store-flag.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;CAQzB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* `--cred-store`, accepted and ignored.
|
|
4
|
+
*
|
|
5
|
+
* The `auth` commands always operate on the sn-credstore store — that is what
|
|
6
|
+
* they are for — so the flag is redundant on them. But it is a global flag on
|
|
7
|
+
* every authenticated command, and people reasonably type it here too. Rejecting
|
|
8
|
+
* it with "Nonexistent flag: --cred-store" reads like the feature is missing
|
|
9
|
+
* rather than already implied.
|
|
10
|
+
*
|
|
11
|
+
* Declared, not acted on. The one place it has an effect is
|
|
12
|
+
* bin/credstore-boot.js, which reads process.argv directly because the shim must
|
|
13
|
+
* be installed before oclif parses anything.
|
|
14
|
+
*/
|
|
15
|
+
export const credStoreFlag = {
|
|
16
|
+
'cred-store': Flags.boolean({
|
|
17
|
+
description: 'Accepted for symmetry with other commands and ignored — the auth commands always ' +
|
|
18
|
+
'use @sonisoft/sn-credstore.',
|
|
19
|
+
helpGroup: 'GLOBAL',
|
|
20
|
+
required: false,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=cred-store-flag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cred-store-flag.js","sourceRoot":"","sources":["../../src/common/cred-store-flag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AAEjC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;QAC1B,WAAW,EACT,mFAAmF;YACnF,6BAA6B;QAC/B,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-autocomplete.d.ts","sourceRoot":"","sources":["../../src/common/scope-autocomplete.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AA6BD;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"scope-autocomplete.d.ts","sourceRoot":"","sources":["../../src/common/scope-autocomplete.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AA6BD;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiEvG;AAQD;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAY3G"}
|
|
@@ -26,6 +26,14 @@ export async function queryScopes(authAlias, prefix = '') {
|
|
|
26
26
|
// Get credentials
|
|
27
27
|
const credential = await getCredentials(authAlias || "fluent-default");
|
|
28
28
|
if (!credential) {
|
|
29
|
+
// Returning no completions is the only sane behaviour here — a shell
|
|
30
|
+
// completion hook cannot print an error without corrupting the candidate
|
|
31
|
+
// list. But "no scopes" and "credentials unreadable" look identical, so
|
|
32
|
+
// leave a breadcrumb for anyone debugging why completion went quiet.
|
|
33
|
+
if (process.env.SN_CRED_STORE_DEBUG) {
|
|
34
|
+
process.stderr.write(`[nex] scope completion: no credentials for "${authAlias || 'fluent-default'}"` +
|
|
35
|
+
`${process.env.NOW_SDK_KEYCHAIN_PATCHED === '1' ? '' : ' (credential shim NOT active)'}\n`);
|
|
36
|
+
}
|
|
29
37
|
return [];
|
|
30
38
|
}
|
|
31
39
|
// Create ServiceNow instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-autocomplete.js","sourceRoot":"","sources":["../../src/common/scope-autocomplete.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAA8B,MAAM,4BAA4B,CAAC;AAgB5F;;;;;GAKG;AACH,SAAS,aAAa,CAAC,UAAiB,EAAE,QAAgB;IACxD,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,IAAI,UAAU,IAAI,UAAU,EAAE,CAAC;QAC5D,OAAO,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;IACzF,CAAC;IAEF,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,IAAI,cAAc,IAAI,UAAU,EAAE,CAAC;QAC/D,OAAO,UAAU,UAAU,CAAC,Y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