@claudinho/cli 0.6.1 → 0.6.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 (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +28 -11
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -166,6 +166,7 @@ network** (<150ms). When several matches are live it shows them all inline:
166
166
  - `CLAUDINHO_TEAM=MEX` — show only your team's match; also the default team for `next`, `markets next`, and `share next` when the argument is omitted
167
167
  - `CLAUDINHO_MAX=2` — cap how many live matches show inline (rest collapse to `+N`; default: all)
168
168
  - `CLAUDINHO_COMPACT=0` — show 3-letter codes alongside flags
169
+ - `CLAUDINHO_FLAGS=off` — drop emoji flags for 3-letter codes (statusline) / plain names (hook); already automatic on terminals that can't render flag emoji, e.g. Warp
169
170
 
170
171
  Use the same `claudinho prompt` in **tmux** (`set -g status-right '#(claudinho prompt)'`)
171
172
  or a **Starship** custom command — it works in any shell.
package/dist/index.js CHANGED
@@ -3979,6 +3979,13 @@ function releaseLock() {
3979
3979
 
3980
3980
  // src/statusline.ts
3981
3981
  var DISPLAY_STALE_MS = 5 * 6e4;
3982
+ var FLAGLESS_TERMINALS = /* @__PURE__ */ new Set(["WarpTerminal"]);
3983
+ function flagsEnabled(env = process.env) {
3984
+ const v = (env.CLAUDINHO_FLAGS ?? "").trim().toLowerCase();
3985
+ if (v === "off" || v === "0" || v === "no" || v === "false") return false;
3986
+ if (v === "on" || v === "1" || v === "yes" || v === "true") return true;
3987
+ return !FLAGLESS_TERMINALS.has(env.TERM_PROGRAM ?? "");
3988
+ }
3982
3989
  var LIVE_TTL_MS = 15e3;
3983
3990
  function inLiveWindow(now = Date.now(), fixtures = allFixtures()) {
3984
3991
  return fixturesInLiveWindow(now, fixtures).length > 0;
@@ -3986,8 +3993,14 @@ function inLiveWindow(now = Date.now(), fixtures = allFixtures()) {
3986
3993
  function nextOverall(now, fixtures = allFixtures()) {
3987
3994
  return [...fixtures].sort(byKickoff).find((m) => Date.parse(m.kickoff) >= now);
3988
3995
  }
3989
- function matchSegment(m, compact) {
3996
+ function teamTok(t, flags) {
3997
+ return flags ? t.flag : t.code;
3998
+ }
3999
+ function matchSegment(m, compact, flags) {
3990
4000
  const minute = m.status === "HT" ? "HT" : m.minute ? `${m.minute}'` : "LIVE";
4001
+ if (!flags) {
4002
+ return `${m.home.code} ${scoreline(m)} ${m.away.code} ${minute}`;
4003
+ }
3991
4004
  const home = compact ? m.home.flag : `${m.home.flag} ${m.home.code}`;
3992
4005
  const away = compact ? m.away.flag : `${m.away.code} ${m.away.flag}`;
3993
4006
  return `${home} ${scoreline(m)} ${away} ${minute}`;
@@ -4003,15 +4016,16 @@ function renderPrompt(state, opts = {}) {
4003
4016
  const now = opts.now ?? /* @__PURE__ */ new Date();
4004
4017
  const nowMs = now.getTime();
4005
4018
  const compact = opts.compact ?? true;
4019
+ const flags = opts.flags ?? true;
4006
4020
  const team = opts.team?.toUpperCase();
4007
4021
  const live = liveMatchesFromCache(state, nowMs);
4008
4022
  if (team) {
4009
4023
  const mine = live.find((m) => m.home?.code === team || m.away?.code === team);
4010
- if (mine) return `\u26BD ${matchSegment(mine, compact)}`;
4024
+ if (mine) return `\u26BD ${matchSegment(mine, compact, flags)}`;
4011
4025
  } else if (live.length > 0) {
4012
4026
  const max = opts.max && opts.max > 0 ? opts.max : live.length;
4013
4027
  const shown = live.slice(0, max);
4014
- let line2 = "\u26BD " + shown.map((m) => matchSegment(m, compact)).join(" \xB7 ");
4028
+ let line2 = "\u26BD " + shown.map((m) => matchSegment(m, compact, flags)).join(" \xB7 ");
4015
4029
  const overflow = live.length - shown.length;
4016
4030
  if (overflow > 0) line2 += ` +${overflow}`;
4017
4031
  return line2;
@@ -4024,24 +4038,27 @@ function renderPrompt(state, opts = {}) {
4024
4038
  const first = win[0];
4025
4039
  if (first) {
4026
4040
  const more = win.length - 1;
4027
- return `\u26BD ${first.home.flag} vs ${first.away.flag} live \xB7 syncing\u2026` + (more > 0 ? ` +${more}` : "");
4041
+ return `\u26BD ${teamTok(first.home, flags)} vs ${teamTok(first.away, flags)} live \xB7 syncing\u2026` + (more > 0 ? ` +${more}` : "");
4028
4042
  }
4029
4043
  }
4030
4044
  const next = team ? nextFixtureForTeam(team, { from: now }) : nextOverall(nowMs);
4031
4045
  if (next) {
4032
- return `${next.home.flag} vs ${next.away.flag} in ${countdown(next.kickoff, now)}`;
4046
+ return `${teamTok(next.home, flags)} vs ${teamTok(next.away, flags)} in ${countdown(next.kickoff, now)}`;
4033
4047
  }
4034
4048
  return "\u26BD \u2014";
4035
4049
  }
4036
4050
 
4037
4051
  // src/hook.ts
4038
- function line(m) {
4052
+ function line(m, flags) {
4039
4053
  const minute = m.status === "HT" ? "half-time" : m.minute ? `${m.minute}'` : "live";
4040
- return `${m.home.flag} ${m.home.name} ${scoreline(m)} ${m.away.name} ${m.away.flag} (${minute})`;
4054
+ const home = flags ? `${m.home.flag} ${m.home.name}` : m.home.name;
4055
+ const away = flags ? `${m.away.name} ${m.away.flag}` : m.away.name;
4056
+ return `${home} ${scoreline(m)} ${away} (${minute})`;
4041
4057
  }
4042
4058
  function renderHook(state, opts = {}) {
4043
4059
  const now = opts.now ?? /* @__PURE__ */ new Date();
4044
4060
  const team = opts.team?.toUpperCase();
4061
+ const flags = opts.flags ?? true;
4045
4062
  let live = liveMatchesFromCache(state, now.getTime());
4046
4063
  if (live.length === 0) return "";
4047
4064
  if (team) {
@@ -4051,7 +4068,7 @@ function renderHook(state, opts = {}) {
4051
4068
  return aHas - bHas;
4052
4069
  });
4053
4070
  }
4054
- const lines = live.map(line).join("\n");
4071
+ const lines = live.map((mm) => line(mm, flags)).join("\n");
4055
4072
  return `[Claudinho \u2014 live football scores right now]
4056
4073
  ${lines}`;
4057
4074
  }
@@ -4536,7 +4553,7 @@ function cmdPrompt({ cfg }) {
4536
4553
  const maxRaw = Number.parseInt(process.env.CLAUDINHO_MAX ?? "", 10);
4537
4554
  const max = Number.isFinite(maxRaw) && maxRaw > 0 ? maxRaw : void 0;
4538
4555
  const state = readCurrentState(cfg.source, resolveCompetition());
4539
- const scoreLine = renderPrompt(state, { team, compact, max });
4556
+ const scoreLine = renderPrompt(state, { team, compact, max, flags: flagsEnabled() });
4540
4557
  out(renderPromptOutput(scoreLine, payload));
4541
4558
  if (!state || shouldRefresh()) spawnRefresh(cfg.source);
4542
4559
  } catch {
@@ -4547,7 +4564,7 @@ function cmdHook({ cfg }) {
4547
4564
  try {
4548
4565
  const team = process.env.CLAUDINHO_TEAM;
4549
4566
  const state = readCurrentState(cfg.source, resolveCompetition());
4550
- const ctx = renderHook(state, { team });
4567
+ const ctx = renderHook(state, { team, flags: flagsEnabled() });
4551
4568
  if (ctx) out(ctx);
4552
4569
  if (!state || shouldRefresh()) spawnRefresh(cfg.source);
4553
4570
  } catch {
@@ -5047,7 +5064,7 @@ function handlePipeError(stream) {
5047
5064
  }
5048
5065
  handlePipeError(process.stdout);
5049
5066
  handlePipeError(process.stderr);
5050
- var VERSION = "0.6.1";
5067
+ var VERSION = "0.6.2";
5051
5068
  var DISCLAIMER = "Claudinho is an independent fan project. Not affiliated with or endorsed by FIFA or Anthropic.";
5052
5069
  function ctxFrom(cmd) {
5053
5070
  let root = cmd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudinho/cli",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Live scores, fixtures, group tables, and read-only prediction-market signals for the 2026 men's football tournament — in your terminal, Claude Code, and Cursor CLI statusline. No API keys. Not affiliated with FIFA or Anthropic.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "tsup": "^8.0.0",
62
62
  "typescript": "^5.7.0",
63
63
  "vitest": "^4.1.0",
64
- "@claudinho/core": "0.6.1"
64
+ "@claudinho/core": "0.6.2"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "tsup",