ticketlens 0.38.0 → 0.38.2
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
CHANGED
|
@@ -281,6 +281,10 @@ export async function run(args, envOrOpts = process.env, fetcher = globalThis.fe
|
|
|
281
281
|
return;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
+
// The real resolved profile name (ticket-prefix / cwd / config.default), not just the
|
|
285
|
+
// explicit --profile= arg — used for triage-history labeling regardless of how it resolved.
|
|
286
|
+
const resolvedProfileName = conn.profileName ?? 'default';
|
|
287
|
+
|
|
284
288
|
const adapter = resolveAdapter(conn, { fetcher });
|
|
285
289
|
|
|
286
290
|
// Status resolution: --status flag > profile triageStatuses > defaults
|
|
@@ -432,7 +436,7 @@ export async function run(args, envOrOpts = process.env, fetcher = globalThis.fe
|
|
|
432
436
|
// Always save a daily snapshot for history tracking (non-fatal)
|
|
433
437
|
try {
|
|
434
438
|
const { saveTriageSnapshot } = await import('./lib/triage-history.mjs');
|
|
435
|
-
saveTriageSnapshot(scored, { profile:
|
|
439
|
+
saveTriageSnapshot(scored, { profile: resolvedProfileName, configDir });
|
|
436
440
|
} catch { /* non-fatal */ }
|
|
437
441
|
|
|
438
442
|
// Track this triage run (best-effort, non-fatal)
|
|
@@ -453,7 +457,7 @@ export async function run(args, envOrOpts = process.env, fetcher = globalThis.fe
|
|
|
453
457
|
try {
|
|
454
458
|
const { loadYesterdaySnapshot, diffSnapshots, buildDeltaSection } =
|
|
455
459
|
await import('./lib/triage-history.mjs');
|
|
456
|
-
const yesterday = loadYesterdaySnapshot({ profile:
|
|
460
|
+
const yesterday = loadYesterdaySnapshot({ profile: resolvedProfileName, configDir });
|
|
457
461
|
if (yesterday) {
|
|
458
462
|
const deltas = diffSnapshots(sorted, yesterday.tickets);
|
|
459
463
|
delta = buildDeltaSection(deltas) || null;
|
|
@@ -461,7 +465,7 @@ export async function run(args, envOrOpts = process.env, fetcher = globalThis.fe
|
|
|
461
465
|
} catch { /* non-fatal — digest still sends */ }
|
|
462
466
|
|
|
463
467
|
await deliverer({
|
|
464
|
-
profile:
|
|
468
|
+
profile: resolvedProfileName,
|
|
465
469
|
staleDays,
|
|
466
470
|
summary: (() => {
|
|
467
471
|
let needsResponse = 0, aging = 0;
|
|
@@ -481,7 +485,7 @@ export async function run(args, envOrOpts = process.env, fetcher = globalThis.fe
|
|
|
481
485
|
if (exportArg) {
|
|
482
486
|
const { exportTriage } = await import('./lib/triage-exporter.mjs');
|
|
483
487
|
const exporterFn = opts.exporter ?? exportTriage;
|
|
484
|
-
const outputPath = await Promise.resolve(exporterFn({ tickets: sorted, format: exportArg, profile:
|
|
488
|
+
const outputPath = await Promise.resolve(exporterFn({ tickets: sorted, format: exportArg, profile: resolvedProfileName, configDir }));
|
|
485
489
|
const printFn = opts.print ?? ((msg) => process.stdout.write(msg + '\n'));
|
|
486
490
|
printFn(`Export written to ${outputPath}`);
|
|
487
491
|
return;
|
|
@@ -503,7 +507,7 @@ export async function run(args, envOrOpts = process.env, fetcher = globalThis.fe
|
|
|
503
507
|
await pushFn({
|
|
504
508
|
sorted: pushable,
|
|
505
509
|
rawTicketMap,
|
|
506
|
-
profile:
|
|
510
|
+
profile: resolvedProfileName,
|
|
507
511
|
baseUrl: conn.baseUrl,
|
|
508
512
|
cliToken,
|
|
509
513
|
gitBranches: scanFn(),
|
|
@@ -521,7 +525,7 @@ export async function run(args, envOrOpts = process.env, fetcher = globalThis.fe
|
|
|
521
525
|
await shareFn({
|
|
522
526
|
sorted,
|
|
523
527
|
rawTicketMap,
|
|
524
|
-
profile:
|
|
528
|
+
profile: resolvedProfileName,
|
|
525
529
|
baseUrl: conn.baseUrl,
|
|
526
530
|
cliToken,
|
|
527
531
|
fetcher,
|
|
@@ -564,7 +568,7 @@ export async function run(args, envOrOpts = process.env, fetcher = globalThis.fe
|
|
|
564
568
|
metrics = metricsInjector();
|
|
565
569
|
} else {
|
|
566
570
|
const { computeResponseMetrics } = await import('./lib/triage-history.mjs');
|
|
567
|
-
metrics = computeResponseMetrics(
|
|
571
|
+
metrics = computeResponseMetrics(resolvedProfileName, { days: 7, configDir });
|
|
568
572
|
}
|
|
569
573
|
// Only show footer when there's a meaningful metric to display
|
|
570
574
|
const hasAvg = metrics && metrics.avgResponseHours !== null;
|
|
@@ -110,7 +110,7 @@ function plural(n, word) {
|
|
|
110
110
|
* Prompts the user to pick a profile when the ticket's prefix isn't
|
|
111
111
|
* configured in any profile. The resolved profile is pre-selected.
|
|
112
112
|
*
|
|
113
|
-
* @param {string} ticketKey e.g. "
|
|
113
|
+
* @param {string} ticketKey e.g. "PROJ-123"
|
|
114
114
|
* @param {string} currentProfile name of the auto-resolved profile
|
|
115
115
|
* @param {Array<{name:string, baseUrl:string|null}>} profiles all known profiles
|
|
116
116
|
* @param {{ stream?: NodeJS.WriteStream }} [opts]
|