@hardfin/cli 0.1.0-dev.25 → 0.1.0-dev.27
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 +30 -0
- package/dist/cli.js +25 -5
- package/dist/completion-tree.json +9 -0
- package/dist/{program-b3uLLsYy.js → program-C3SGdPbf.js} +3514 -3122
- package/dist/scrub-VtQmxap1.js +108 -0
- package/dist/sentry-D5lKx0nm.js +4384 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -310,6 +310,7 @@ hardfin status --offline # no network calls at all
|
|
|
310
310
|
| `credential` | Whether you are signed in, where the refresh token is kept, and when it was issued and last renewed |
|
|
311
311
|
| `authorizationServer` | Whether discovery worked, and every endpoint it named |
|
|
312
312
|
| `api` | Whether the API accepted the credential, when the access token expires, and its scopes |
|
|
313
|
+
| `telemetry` | Whether defects are reported, the setting that decided it, and where reports go |
|
|
313
314
|
|
|
314
315
|
Nothing secret is printed. An API key and a refresh token are each reported as a
|
|
315
316
|
`sha256:` fingerprint, which identifies a credential across two machines without disclosing
|
|
@@ -319,6 +320,35 @@ it.
|
|
|
319
320
|
the server reported one falls back to Hardfin's 90-day rule, and `refreshExpiryIsEstimated`
|
|
320
321
|
says which of the two you are looking at.
|
|
321
322
|
|
|
323
|
+
## Error reports
|
|
324
|
+
|
|
325
|
+
When the CLI fails because of a defect in the CLI itself, it reports the error to the Hardfin
|
|
326
|
+
team through Sentry. It then tells you it did, with a reference to quote.
|
|
327
|
+
|
|
328
|
+
Only defects are reported. None of these are:
|
|
329
|
+
|
|
330
|
+
- an error the API answered, including a 500, which the server records itself
|
|
331
|
+
- a network failure, or a server that cannot be reached
|
|
332
|
+
- a mistake on the command line or in a settings file
|
|
333
|
+
- being signed out, or a sign in that was cancelled or refused
|
|
334
|
+
- the machine refusing a file, such as a full disk or a missing permission
|
|
335
|
+
|
|
336
|
+
A report carries the error, its stack trace, and what `hardfin status` would print at that
|
|
337
|
+
moment. The command is named, and its flags are listed by name without their values.
|
|
338
|
+
|
|
339
|
+
A report never carries tokens, API keys, argument or flag values, request or response bodies,
|
|
340
|
+
people's or organizations' names, your hostname, or your home directory. A person and an
|
|
341
|
+
organization appear only as their Hardfin keys.
|
|
342
|
+
|
|
343
|
+
| To | Set |
|
|
344
|
+
| ------------------------------------------------- | ------------------------------------------ |
|
|
345
|
+
| Stop reporting | `DO_NOT_TRACK=1`, or `HARDFIN_TELEMETRY=0` |
|
|
346
|
+
| Report from a checkout, which does not by default | `HARDFIN_TELEMETRY=1` |
|
|
347
|
+
| Send reports to another Sentry project | `HARDFIN_SENTRY_DSN` |
|
|
348
|
+
|
|
349
|
+
`hardfin status` shows which of these is in effect. `hardfin __crash` fails on purpose, to
|
|
350
|
+
check that a report arrives.
|
|
351
|
+
|
|
322
352
|
## Local configuration
|
|
323
353
|
|
|
324
354
|
A local build reaches a local server without editing code. Four layers supply the same
|
package/dist/cli.js
CHANGED
|
@@ -6,11 +6,31 @@ process.stdout.on("error", (error) => {
|
|
|
6
6
|
if (error.code === "EPIPE") process.exit(0);
|
|
7
7
|
throw error;
|
|
8
8
|
});
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
let isCrashing = false;
|
|
10
|
+
process.on("uncaughtException", (error) => void toCrash(error));
|
|
11
|
+
process.on("unhandledRejection", (error) => void toCrash(error));
|
|
12
|
+
try {
|
|
13
|
+
const answer = await toQuickAnswer(process.argv.slice(2));
|
|
14
|
+
if (answer === void 0) {
|
|
15
|
+
const { toCli, wasReportAttempted } = await import("./program-C3SGdPbf.js");
|
|
16
|
+
await toCli().parseAsync(process.argv);
|
|
17
|
+
if (wasReportAttempted()) process.exit();
|
|
18
|
+
} else process.stdout.write(`${answer}\n`);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
await toCrash(error);
|
|
21
|
+
}
|
|
22
|
+
/** toCrash ends the process for an error nothing caught, once it has been reported. */
|
|
23
|
+
async function toCrash(error) {
|
|
24
|
+
if (isCrashing) return;
|
|
25
|
+
isCrashing = true;
|
|
26
|
+
process.stderr.write(`error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
27
|
+
try {
|
|
28
|
+
const { toReported } = await import("./program-C3SGdPbf.js");
|
|
29
|
+
await toReported(error, false, void 0, "fatal");
|
|
30
|
+
} finally {
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
14
34
|
/**
|
|
15
35
|
* toQuickAnswer answers a completion script without loading zod or the commands, which is
|
|
16
36
|
* most of what a start costs, because a Tab starts the CLI every time.
|
|
@@ -2565,6 +2565,15 @@
|
|
|
2565
2565
|
}
|
|
2566
2566
|
],
|
|
2567
2567
|
"subcommands": []
|
|
2568
|
+
},
|
|
2569
|
+
{
|
|
2570
|
+
"name": "__crash",
|
|
2571
|
+
"summary": "Fail on purpose, to check that defects are reported",
|
|
2572
|
+
"hidden": true,
|
|
2573
|
+
"runs": true,
|
|
2574
|
+
"flags": [],
|
|
2575
|
+
"arguments": [],
|
|
2576
|
+
"subcommands": []
|
|
2568
2577
|
}
|
|
2569
2578
|
]
|
|
2570
2579
|
}
|