tokmon 0.14.1 → 0.14.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.
Files changed (2) hide show
  1. package/dist/cli.js +35 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -609,7 +609,7 @@ function glyphs() {
609
609
 
610
610
  // src/app.tsx
611
611
  import { useState as useState3, useEffect as useEffect3, useCallback, useRef as useRef2, useMemo } from "react";
612
- import { Box as Box7, Text as Text7, useInput, useStdout, useApp } from "ink";
612
+ import { Box as Box7, Text as Text7, Transform, useInput, useStdout, useApp } from "ink";
613
613
  import { useMouse } from "@zenobius/ink-mouse";
614
614
 
615
615
  // src/http.ts
@@ -3883,6 +3883,27 @@ var CURSOR_SORTS = [
3883
3883
  { label: "model", dir: null }
3884
3884
  ];
3885
3885
  var IS_TTY = process.stdin.isTTY === true;
3886
+ var REPO_URL = "https://github.com/DavidIlie/tokmon";
3887
+ function detectHyperlinks(env, isTTY) {
3888
+ const force = env.FORCE_HYPERLINK;
3889
+ if (force != null && force !== "") return force !== "0" && force.toLowerCase() !== "false";
3890
+ if (!isTTY || env.TERM === "dumb" || env.NO_HYPERLINK) return false;
3891
+ if (env.WT_SESSION || env.ConEmuANSI === "ON" || env.KITTY_WINDOW_ID || env.TERM === "xterm-kitty") return true;
3892
+ if (env.KONSOLE_VERSION || env.TERMINAL_EMULATOR === "JetBrains-JediTerm") return true;
3893
+ if (env.VTE_VERSION && Number(env.VTE_VERSION) >= 5e3) return true;
3894
+ const tp = env.TERM_PROGRAM;
3895
+ if (tp) {
3896
+ const [maj, min] = (env.TERM_PROGRAM_VERSION ?? "").split(".").map((n) => Number(n) || 0);
3897
+ if (tp === "iTerm.app") return maj > 3 || maj === 3 && min >= 1;
3898
+ if (tp === "vscode" || tp === "WezTerm" || tp === "ghostty" || tp === "Hyper" || tp === "Tabby" || tp === "rio") return true;
3899
+ }
3900
+ return false;
3901
+ }
3902
+ var HYPERLINKS = detectHyperlinks(process.env, process.stdout.isTTY === true);
3903
+ function osc8(text, url) {
3904
+ if (!HYPERLINKS) return text;
3905
+ return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
3906
+ }
3886
3907
  var DEBOUNCE_MS = 300;
3887
3908
  var LOADER_GRACE_MS = 600;
3888
3909
  var LOADER_MAX_MS = 8e3;
@@ -4904,9 +4925,9 @@ function Footer({ hasAccounts, paginated, cols }) {
4904
4925
  const showPage = paginated && inner >= BASE2 + (showJump ? JUMP : 0) + PAGE;
4905
4926
  return /* @__PURE__ */ jsxs7(Box7, { marginTop: 1, flexWrap: "nowrap", children: [
4906
4927
  /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "by " }),
4907
- /* @__PURE__ */ jsx7(Text7, { children: "David Ilie" }),
4928
+ /* @__PURE__ */ jsx7(Transform, { transform: (s) => osc8(s, REPO_URL), children: /* @__PURE__ */ jsx7(Text7, { children: "David Ilie" }) }),
4908
4929
  /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: " (" }),
4909
- /* @__PURE__ */ jsx7(Text7, { color: "cyan", children: "davidilie.com" }),
4930
+ /* @__PURE__ */ jsx7(Transform, { transform: (s) => osc8(s, "https://davidilie.com"), children: /* @__PURE__ */ jsx7(Text7, { color: "cyan", children: "davidilie.com" }) }),
4910
4931
  /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
4911
4932
  ") ",
4912
4933
  glyphs().middot,
@@ -5002,8 +5023,16 @@ for (let i = 0; i < args.length; i++) {
5002
5023
  }
5003
5024
  }
5004
5025
  var config = await loadConfig();
5005
- if (config.clearScreen && process.stdout.isTTY) {
5006
- process.stdout.write("\x1B[2J\x1B[H");
5026
+ var altScreen = config.clearScreen && process.stdout.isTTY === true;
5027
+ var leaveAltScreen = () => {
5028
+ try {
5029
+ process.stdout.write("\x1B[?1049l");
5030
+ } catch {
5031
+ }
5032
+ };
5033
+ if (altScreen) {
5034
+ process.stdout.write("\x1B[?1049h\x1B[H");
5035
+ process.once("exit", leaveAltScreen);
5007
5036
  }
5008
5037
  setGlyphs(resolveGlyphs({
5009
5038
  flag: asciiFlag,
@@ -5015,3 +5044,4 @@ setGlyphs(resolveGlyphs({
5015
5044
  var { waitUntilExit } = render(/* @__PURE__ */ jsx8(MouseProvider, { children: /* @__PURE__ */ jsx8(App, { interval, initialConfig: config }) }));
5016
5045
  await waitUntilExit();
5017
5046
  await flushDisk();
5047
+ if (altScreen) leaveAltScreen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokmon",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "Terminal dashboard for Claude Code, Codex, and Cursor usage, limits, and costs",
5
5
  "type": "module",
6
6
  "bin": {