@prevalentware/opencode-goal-plugin 0.1.1 → 0.1.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/dist/tui.js +65 -41
- package/package.json +1 -1
package/dist/tui.js
CHANGED
|
@@ -388,6 +388,16 @@ function formatDuration(seconds) {
|
|
|
388
388
|
return `${minutes}m ${secs}s`;
|
|
389
389
|
return `${secs}s`;
|
|
390
390
|
}
|
|
391
|
+
function formatDurationBadge(seconds) {
|
|
392
|
+
const total = Math.max(0, Math.floor(seconds));
|
|
393
|
+
const hours = Math.floor(total / 3600);
|
|
394
|
+
const minutes = Math.floor(total % 3600 / 60);
|
|
395
|
+
if (hours > 0)
|
|
396
|
+
return `${hours}h${minutes > 0 ? ` ${minutes}m` : ""}`;
|
|
397
|
+
if (minutes > 0)
|
|
398
|
+
return `${minutes}m`;
|
|
399
|
+
return `${total}s`;
|
|
400
|
+
}
|
|
391
401
|
function compactNumber(value) {
|
|
392
402
|
if (value >= 1e6)
|
|
393
403
|
return `${(value / 1e6).toFixed(1)}M`;
|
|
@@ -421,48 +431,62 @@ function GoalSidebar(props) {
|
|
|
421
431
|
});
|
|
422
432
|
return /* @__PURE__ */ jsxDEV(Show, {
|
|
423
433
|
when: goal(),
|
|
424
|
-
children: (value) => /* @__PURE__ */ jsxDEV(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
434
|
+
children: (value) => /* @__PURE__ */ jsxDEV(Show, {
|
|
435
|
+
when: value().status === "complete",
|
|
436
|
+
fallback: /* @__PURE__ */ jsxDEV("box", {
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
439
|
+
fg: theme().text,
|
|
440
|
+
children: /* @__PURE__ */ jsxDEV("b", {
|
|
441
|
+
children: "Goal"
|
|
442
|
+
}, undefined, false, undefined, this)
|
|
443
|
+
}, undefined, false, undefined, this),
|
|
444
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
445
|
+
fg: theme().textMuted,
|
|
446
|
+
children: [
|
|
447
|
+
"Status: ",
|
|
448
|
+
value().status
|
|
449
|
+
]
|
|
450
|
+
}, undefined, true, undefined, this),
|
|
451
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
452
|
+
fg: theme().textMuted,
|
|
453
|
+
children: [
|
|
454
|
+
"Time: ",
|
|
455
|
+
formatDuration(value().timeUsedSeconds)
|
|
456
|
+
]
|
|
457
|
+
}, undefined, true, undefined, this),
|
|
458
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
459
|
+
fg: theme().textMuted,
|
|
460
|
+
children: [
|
|
461
|
+
"Tokens: ",
|
|
462
|
+
tokens()
|
|
463
|
+
]
|
|
464
|
+
}, undefined, true, undefined, this),
|
|
465
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
466
|
+
fg: theme().textMuted,
|
|
467
|
+
children: [
|
|
468
|
+
"Remaining: ",
|
|
469
|
+
remaining()
|
|
470
|
+
]
|
|
471
|
+
}, undefined, true, undefined, this),
|
|
472
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
473
|
+
fg: theme().textMuted,
|
|
474
|
+
children: objective()
|
|
430
475
|
}, undefined, false, undefined, this)
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}, undefined, true, undefined, this),
|
|
446
|
-
/* @__PURE__ */ jsxDEV("text", {
|
|
447
|
-
fg: theme().textMuted,
|
|
448
|
-
children: [
|
|
449
|
-
"Tokens: ",
|
|
450
|
-
tokens()
|
|
451
|
-
]
|
|
452
|
-
}, undefined, true, undefined, this),
|
|
453
|
-
/* @__PURE__ */ jsxDEV("text", {
|
|
454
|
-
fg: theme().textMuted,
|
|
455
|
-
children: [
|
|
456
|
-
"Remaining: ",
|
|
457
|
-
remaining()
|
|
458
|
-
]
|
|
459
|
-
}, undefined, true, undefined, this),
|
|
460
|
-
/* @__PURE__ */ jsxDEV("text", {
|
|
461
|
-
fg: theme().textMuted,
|
|
462
|
-
children: objective()
|
|
463
|
-
}, undefined, false, undefined, this)
|
|
464
|
-
]
|
|
465
|
-
}, undefined, true, undefined, this)
|
|
476
|
+
]
|
|
477
|
+
}, undefined, true, undefined, this),
|
|
478
|
+
children: /* @__PURE__ */ jsxDEV("text", {
|
|
479
|
+
fg: theme().primary,
|
|
480
|
+
children: [
|
|
481
|
+
/* @__PURE__ */ jsxDEV("b", {
|
|
482
|
+
children: "Goal achieved"
|
|
483
|
+
}, undefined, false, undefined, this),
|
|
484
|
+
" (",
|
|
485
|
+
formatDurationBadge(value().timeUsedSeconds),
|
|
486
|
+
")"
|
|
487
|
+
]
|
|
488
|
+
}, undefined, true, undefined, this)
|
|
489
|
+
}, undefined, false, undefined, this)
|
|
466
490
|
}, undefined, false, undefined, this);
|
|
467
491
|
}
|
|
468
492
|
var tui = async (api) => {
|