@lorekit/cli 1.30.0 → 1.30.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.
- package/package.json +1 -1
- package/src/deeplink-pure.mjs +12 -4
- package/src/telemetry.mjs +23 -3
package/package.json
CHANGED
package/src/deeplink-pure.mjs
CHANGED
|
@@ -29,7 +29,15 @@ export const LORE_PARAM_DEFAULTS = {
|
|
|
29
29
|
q: '', // string search query
|
|
30
30
|
range: null, // { from, to } | null (DateRange, "YYYY-MM-DD")
|
|
31
31
|
owner: 'all', // 'all' | 'personal' | { orgId }
|
|
32
|
-
|
|
32
|
+
// Filter[] | null — the Explorer's multi-dimension filter bar (label / agent /
|
|
33
|
+
// trigger / repo / branch / pr). `null`, NOT `[]`, is the default on purpose:
|
|
34
|
+
// the app has to tell "the param is absent" from "the bar is explicitly
|
|
35
|
+
// empty", because an absent `filters` falls back to the legacy `tags`
|
|
36
|
+
// shorthand while an empty one deliberately does not. Encoding `[]` here
|
|
37
|
+
// would emit the param (it is not the default) and mean the opposite of
|
|
38
|
+
// "unfiltered".
|
|
39
|
+
filters: null,
|
|
40
|
+
tags: [], // string[] — legacy label filter (AND across labels); [] means "no filter". Still READ by the app, superseded by `filters`
|
|
33
41
|
view: 'scope', // 'scope' | 'time'
|
|
34
42
|
archived: false, // boolean
|
|
35
43
|
lesson: null, // { scope, key } | null — opens the detail sheet
|
|
@@ -37,9 +45,9 @@ export const LORE_PARAM_DEFAULTS = {
|
|
|
37
45
|
|
|
38
46
|
// A stable, readable param order (also makes URLs deterministic for tests).
|
|
39
47
|
// Mirrors the `useUrlState` call order in `LoreExplorer.tsx` (+ the `lesson`
|
|
40
|
-
// param last), so `tags`
|
|
41
|
-
// `lesson` so a lesson link reads `?scope=…&lesson=…`.
|
|
42
|
-
const PARAM_ORDER = ['scope', 'q', 'range', 'owner', 'tags', 'view', 'archived', 'lesson'];
|
|
48
|
+
// param last), so `filters` and `tags` sit between `owner` and `view`. `scope`
|
|
49
|
+
// precedes `lesson` so a lesson link reads `?scope=…&lesson=…`.
|
|
50
|
+
const PARAM_ORDER = ['scope', 'q', 'range', 'owner', 'filters', 'tags', 'view', 'archived', 'lesson'];
|
|
43
51
|
|
|
44
52
|
// Strip trailing slashes from a base URL, falling back to the default when the
|
|
45
53
|
// input is empty/absent. Pure.
|
package/src/telemetry.mjs
CHANGED
|
@@ -483,6 +483,11 @@ function normalizeExitCode(result) {
|
|
|
483
483
|
* counter point. Returns the command's exit code unchanged. Telemetry failures
|
|
484
484
|
* are swallowed — the command result is never affected.
|
|
485
485
|
*
|
|
486
|
+
* The span carries an ERROR status only when the command CRASHED. A command
|
|
487
|
+
* that ran to completion and exited non-zero (a failing `doctor` check, a
|
|
488
|
+
* `lint` finding) reports `lorekit.cli.outcome=failure` on a span the exporter
|
|
489
|
+
* emits as STATUS_CODE_OK — never ERROR.
|
|
490
|
+
*
|
|
486
491
|
* @param {string} command bounded: install | uninstall | doctor | list | search | show | stats | scopes | diff | tree | lint | dedupe | link | migrate
|
|
487
492
|
* @param {object} args parsed CLI args (read for allow-listed flags only)
|
|
488
493
|
* @param {string} version CLI version (from package.json)
|
|
@@ -525,6 +530,10 @@ export async function traceCommand(command, args, version, run) {
|
|
|
525
530
|
|
|
526
531
|
const startMs = Date.now();
|
|
527
532
|
let exitCode = 0;
|
|
533
|
+
// `outcome` is the command's VERDICT (ok | failure | error); `status` is the
|
|
534
|
+
// SPAN status, and only a crash sets it to error. See the note above the
|
|
535
|
+
// non-zero-exit branch below.
|
|
536
|
+
let outcome = 'ok';
|
|
528
537
|
let status = 'ok';
|
|
529
538
|
let statusMessage;
|
|
530
539
|
let extraAttrs = {};
|
|
@@ -543,11 +552,22 @@ export async function traceCommand(command, args, version, run) {
|
|
|
543
552
|
}
|
|
544
553
|
}
|
|
545
554
|
if (typeof exitCode === 'number' && exitCode !== 0) {
|
|
546
|
-
|
|
547
|
-
|
|
555
|
+
// A non-zero exit is a REPORTED VERDICT, not a fault: `doctor` exits 1
|
|
556
|
+
// because a check it ran came back failing, and `lint` exits 1 because it
|
|
557
|
+
// found what it was asked to look for. Both commands did their job. Only
|
|
558
|
+
// a crash (the catch below) is an error, so `status` stays `'ok'` here —
|
|
559
|
+
// which `buildTracePayload` emits as STATUS_CODE_OK (1), the same status
|
|
560
|
+
// a zero-exit run gets — and the verdict is carried by
|
|
561
|
+
// `lorekit.cli.outcome=failure` +
|
|
562
|
+
// `lorekit.cli.exit_code` — which keeps the CLI's error rate a measure of
|
|
563
|
+
// the CLI being broken rather than of the user's environment being
|
|
564
|
+
// unhealthy. Query the failure verdicts on those attributes, never on the
|
|
565
|
+
// span status.
|
|
566
|
+
outcome = 'failure';
|
|
548
567
|
}
|
|
549
568
|
return exitCode;
|
|
550
569
|
} catch (e) {
|
|
570
|
+
outcome = 'error';
|
|
551
571
|
status = 'error';
|
|
552
572
|
// Record only a bounded, non-PII identifier — NEVER e.message. Node fs /
|
|
553
573
|
// network error messages embed absolute paths (e.g. "ENOENT: ... open
|
|
@@ -566,7 +586,7 @@ export async function traceCommand(command, args, version, run) {
|
|
|
566
586
|
const attributes = commandAttributes({
|
|
567
587
|
command,
|
|
568
588
|
args,
|
|
569
|
-
outcome
|
|
589
|
+
outcome,
|
|
570
590
|
exitCode: typeof exitCode === 'number' ? exitCode : undefined,
|
|
571
591
|
extraAttrs,
|
|
572
592
|
});
|