@prevalentware/opencode-goal-plugin 0.1.0 → 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 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("box", {
425
- children: [
426
- /* @__PURE__ */ jsxDEV("text", {
427
- fg: theme().text,
428
- children: /* @__PURE__ */ jsxDEV("b", {
429
- children: "Goal"
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
- }, undefined, false, undefined, this),
432
- /* @__PURE__ */ jsxDEV("text", {
433
- fg: theme().textMuted,
434
- children: [
435
- "Status: ",
436
- value().status
437
- ]
438
- }, undefined, true, undefined, this),
439
- /* @__PURE__ */ jsxDEV("text", {
440
- fg: theme().textMuted,
441
- children: [
442
- "Time: ",
443
- formatDuration(value().timeUsedSeconds)
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prevalentware/opencode-goal-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Codex-style long-running goal mode for OpenCode.",
5
5
  "keywords": [
6
6
  "opencode",
@@ -28,10 +28,6 @@
28
28
  "import": "./dist/tui.js"
29
29
  }
30
30
  },
31
- "main": "eslint.config.js",
32
- "directories": {
33
- "test": "test"
34
- },
35
31
  "files": [
36
32
  "dist",
37
33
  "LICENSE",
package/eslint.config.js DELETED
@@ -1,29 +0,0 @@
1
- import js from "@eslint/js"
2
- import tseslint from "typescript-eslint"
3
-
4
- export default tseslint.config(
5
- {
6
- ignores: ["dist/**", "node_modules/**", ".data/**"],
7
- },
8
- js.configs.recommended,
9
- ...tseslint.configs.recommended,
10
- {
11
- files: ["**/*.{ts,tsx}"],
12
- languageOptions: {
13
- parserOptions: {
14
- projectService: true,
15
- tsconfigRootDir: import.meta.dirname,
16
- },
17
- },
18
- rules: {
19
- "@typescript-eslint/no-explicit-any": "off",
20
- "@typescript-eslint/no-unused-vars": [
21
- "error",
22
- {
23
- argsIgnorePattern: "^_",
24
- varsIgnorePattern: "^_",
25
- },
26
- ],
27
- },
28
- },
29
- )