@hardfin/cli 0.1.0-dev.37 → 0.1.1-dev.39

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
@@ -432,6 +432,11 @@ Only defects are reported. None of these are:
432
432
  - a mistake on the command line or in a settings file
433
433
  - being signed out, or a sign in that was cancelled or refused
434
434
  - the machine refusing a file, such as a full disk or a missing permission
435
+ - anything from a run with no API key and no stored sign in, except a defect in `hardfin login`
436
+
437
+ The last rule is there because package scanners install the CLI and run it in sandboxes. They
438
+ never sign in, and their reports would bury the real ones. A defect while signing in is still
439
+ reported, because that is the one thing a signed-out person is doing.
435
440
 
436
441
  A report carries the error, its stack trace, and what `hardfin status` would print at that
437
442
  moment. The command is named, and its flags are listed by name without their values.
@@ -447,7 +452,7 @@ organization appear only as their Hardfin keys.
447
452
  | Send reports to another Sentry project | `HARDFIN_SENTRY_DSN` |
448
453
 
449
454
  `hardfin status` shows which of these is in effect. `hardfin __crash` fails on purpose, to
450
- check that a report arrives.
455
+ check that a report arrives. It reports only when signed in or given an API key.
451
456
 
452
457
  ## Local configuration
453
458
 
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b1580db0-6822-5a25-b000-03705726eaf6")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ee01278c-9a53-5677-8abd-c28911112932")}catch(e){}}();
4
4
  import module from "node:module";
5
5
  //#region src/cli.ts
6
6
  module.enableCompileCache?.();
@@ -14,7 +14,7 @@ process.on("unhandledRejection", (error) => void toCrash(error));
14
14
  try {
15
15
  const answer = await toQuickAnswer(process.argv.slice(2));
16
16
  if (answer === void 0) {
17
- const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-CjKwnPeY.js");
17
+ const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-d7dXAbE4.js");
18
18
  try {
19
19
  await toCli().parseAsync(process.argv);
20
20
  } catch (error) {
@@ -33,7 +33,7 @@ async function toCrash(error) {
33
33
  isCrashing = true;
34
34
  process.stderr.write(`error: ${error instanceof Error ? error.message : String(error)}\n`);
35
35
  try {
36
- const { toReported } = await import("./program-CjKwnPeY.js");
36
+ const { toReported } = await import("./program-d7dXAbE4.js");
37
37
  await toReported(error, false, void 0, "fatal");
38
38
  } finally {
39
39
  process.exit(1);
@@ -51,4 +51,4 @@ async function toQuickAnswer(args) {
51
51
  export {};
52
52
 
53
53
  //# sourceMappingURL=cli.js.map
54
- //# debugId=b1580db0-6822-5a25-b000-03705726eaf6
54
+ //# debugId=ee01278c-9a53-5677-8abd-c28911112932
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5a591d32-0d31-5357-b447-e33420753351")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="18ff3f0f-09fd-501c-9ccd-2c32855efa8b")}catch(e){}}();
4
4
  import { a as defineCommand, i as GLOBAL_FLAGS, r as ExitCode, t as toInvocation } from "./scrub-BN3gyBpR.js";
5
5
  import { n as toCompletion, t as toAnswer$1 } from "./completion-tree-rR_Rmeij.js";
6
6
  import { createRequire } from "node:module";
@@ -2939,9 +2939,10 @@ async function report(error, occasion, resolved) {
2939
2939
  if (!isReportable(error)) return;
2940
2940
  const telemetry = toTelemetry();
2941
2941
  if (!telemetry.enabled) return;
2942
+ const settings = resolved ?? toResolved();
2943
+ if (!isSignedIn(settings) && occasion.invocation.command !== "login") return;
2942
2944
  isAttempted = true;
2943
2945
  try {
2944
- const settings = resolved ?? toResolved();
2945
2946
  const status = settings ? await toStatus(settings) : void 0;
2946
2947
  const secrets = [settings?.settings.apiKey, settings ? toCredential(settings.settings.issuerUrl)?.refreshToken : void 0];
2947
2948
  return await (await import("./sentry-BM9Rvhhy.js")).send({
@@ -2955,6 +2956,16 @@ async function report(error, occasion, resolved) {
2955
2956
  return;
2956
2957
  }
2957
2958
  }
2959
+ /** isSignedIn reports whether this run holds an API key or a stored sign in. */
2960
+ function isSignedIn(resolved) {
2961
+ if (!resolved) return false;
2962
+ if (resolved.settings.apiKey) return true;
2963
+ try {
2964
+ return toCredential(resolved.settings.issuerUrl) !== void 0;
2965
+ } catch {
2966
+ return false;
2967
+ }
2968
+ }
2958
2969
  /**
2959
2970
  * toResolved reads the settings again for a crash that happened before a command held them.
2960
2971
  * The global options are read from the command line, so the report describes the host the
@@ -6534,5 +6545,5 @@ async function toReported(error, isJSON, resolved, level = "error") {
6534
6545
  //#endregion
6535
6546
  export { toCli, toParseExitCode, toReported, wasReportAttempted };
6536
6547
 
6537
- //# sourceMappingURL=program-CjKwnPeY.js.map
6538
- //# debugId=5a591d32-0d31-5357-b447-e33420753351
6548
+ //# sourceMappingURL=program-d7dXAbE4.js.map
6549
+ //# debugId=18ff3f0f-09fd-501c-9ccd-2c32855efa8b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardfin/cli",
3
- "version": "0.1.0-dev.37",
3
+ "version": "0.1.1-dev.39",
4
4
  "description": "Command line interface for the Hardfin API",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hardfin, Inc.",