@sonisoft/now-sdk-ext-cli 3.0.0 → 5.0.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.
Files changed (35) hide show
  1. package/README.md +500 -164
  2. package/bin/argv-guard.js +25 -0
  3. package/bin/argv-secrets.js +103 -0
  4. package/bin/credstore-boot.js +67 -0
  5. package/bin/dev.js +8 -0
  6. package/bin/run.js +8 -0
  7. package/dist/commands/auth/delete.d.ts +17 -0
  8. package/dist/commands/auth/delete.d.ts.map +1 -0
  9. package/dist/commands/auth/delete.js +34 -0
  10. package/dist/commands/auth/delete.js.map +1 -0
  11. package/dist/commands/auth/doctor.d.ts +23 -0
  12. package/dist/commands/auth/doctor.d.ts.map +1 -0
  13. package/dist/commands/auth/doctor.js +87 -0
  14. package/dist/commands/auth/doctor.js.map +1 -0
  15. package/dist/commands/auth/list.d.ts +15 -0
  16. package/dist/commands/auth/list.d.ts.map +1 -0
  17. package/dist/commands/auth/list.js +42 -0
  18. package/dist/commands/auth/list.js.map +1 -0
  19. package/dist/commands/auth/use.d.ts +16 -0
  20. package/dist/commands/auth/use.d.ts.map +1 -0
  21. package/dist/commands/auth/use.js +20 -0
  22. package/dist/commands/auth/use.js.map +1 -0
  23. package/dist/common/authenticated-command.d.ts +10 -0
  24. package/dist/common/authenticated-command.d.ts.map +1 -1
  25. package/dist/common/authenticated-command.js +65 -12
  26. package/dist/common/authenticated-command.js.map +1 -1
  27. package/dist/common/cred-store-flag.d.ts +17 -0
  28. package/dist/common/cred-store-flag.d.ts.map +1 -0
  29. package/dist/common/cred-store-flag.js +23 -0
  30. package/dist/common/cred-store-flag.js.map +1 -0
  31. package/dist/common/scope-autocomplete.d.ts.map +1 -1
  32. package/dist/common/scope-autocomplete.js +8 -0
  33. package/dist/common/scope-autocomplete.js.map +1 -1
  34. package/oclif.manifest.json +1550 -825
  35. package/package.json +3 -2
@@ -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
- // add any custom logic to handle errors from the command
31
- // or simply return the parent class error handling
32
- this.authLogger.error("Globally caught exception occurred.", err);
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
- const credential = await getCredentials(alias);
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
- const snSettings = {
67
- alias: flags.auth,
68
- credential
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
- else {
73
- this.authLogger.error("Either credential not found or no credentials created.", { alias });
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,MAAM,OAAgB,oBAA+C,SAAQ,OAAO;IACpF,kFAAkF;IAChF,MAAM,CAAC,SAAS,GAAG;QACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC;QACrF,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;YACxB,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAU;YAC7D,OAAO,EAAE,4BAA4B;SAEtC,CAAC,EAAE;KACL,CAAA;IACH,sBAAsB;IAClB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IACtB,OAAO,CAAU;IACb,IAAI,CAAW;IACf,UAAU,CAAS;IACnB,KAAK,CAAY;IACrB,QAAQ,CAAqB;IAEnC,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,GAAgC;QACpD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EAAE,KAAK,CAAC,IAAI;YACjB,UAAU;SACX,CAAA;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;OAOG;IACK,QAAQ,CAAC,KAAa,EAAE,KAAe;QAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,KAAK,GAAG,CAAC;QAChE,MAAM,WAAW,GAAG;YAClB,gDAAgD;YAChD,oDAAoD;SACrD,CAAC;QAEF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,yEAAyE;YACzE,4EAA4E;YAC5E,4EAA4E;YAC5E,0CAA0C;YAC1C,WAAW,CAAC,OAAO,CACjB,uFAAuF;gBACvF,0FAA0F;gBAC1F,8CAA8C,CAC/C,CAAC;QACJ,CAAC;QAED,6EAA6E;QAC7E,MAAM,WAAW,GAAI,KAA4C,EAAE,WAAW,CAAC;QAC/E,IAAI,WAAW;YAAE,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,mCAAmC,KAAK,IAAI,CAAC;QACrG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAC,WAAW,EAAC,CAAC,CAAC;IACpC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `--cred-store`, accepted and ignored.
3
+ *
4
+ * The `auth` commands always operate on the sn-credstore store — that 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,CAsDvG;AAQD;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAY3G"}
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,YAAY,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,SAA6B,EAAE,SAAiB,EAAE;IAClF,IAAI,CAAC;QACH,kBAAkB;QAElB,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,SAAS,IAAI,gBAAgB,CAAC,CAAC;QAEvE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,6BAA6B;QAC7B,MAAM,UAAU,GAA+B;YAC7C,KAAK,EAAE,SAAS;YAChB,UAAU;SACX,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAEpD,qCAAqC;QACrC,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,OAA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