@claudinho/cli 0.8.8 → 0.8.10
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/index.js +26 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -509,7 +509,11 @@ function isFinished(status) {
|
|
|
509
509
|
}
|
|
510
510
|
function scoreline(match) {
|
|
511
511
|
if (!match.score) return "vs";
|
|
512
|
-
|
|
512
|
+
const { home, away } = match.score;
|
|
513
|
+
if (match.shootout) {
|
|
514
|
+
return `${home}(${match.shootout.home})\u2013${away}(${match.shootout.away})`;
|
|
515
|
+
}
|
|
516
|
+
return `${home}\u2013${away}`;
|
|
513
517
|
}
|
|
514
518
|
function matchLocation(match) {
|
|
515
519
|
return [match.venue, match.city, match.country].filter(Boolean).join(", ");
|
|
@@ -2864,7 +2868,7 @@ function stageFromSlug(slug) {
|
|
|
2864
2868
|
}
|
|
2865
2869
|
function toInt(s) {
|
|
2866
2870
|
if (s == null || s === "") return void 0;
|
|
2867
|
-
const n = parseInt(s, 10);
|
|
2871
|
+
const n = parseInt(String(s), 10);
|
|
2868
2872
|
return Number.isFinite(n) ? n : void 0;
|
|
2869
2873
|
}
|
|
2870
2874
|
function toTeam(t2) {
|
|
@@ -2893,6 +2897,9 @@ function mapEspnEvent(ev, ctx = {}) {
|
|
|
2893
2897
|
if (homeC?.winner) winnerCode = home.code;
|
|
2894
2898
|
else if (awayC?.winner) winnerCode = away.code;
|
|
2895
2899
|
}
|
|
2900
|
+
const hShoot = toInt(homeC?.shootoutScore);
|
|
2901
|
+
const aShoot = toInt(awayC?.shootoutScore);
|
|
2902
|
+
const shootout = hasScore && hShoot !== void 0 && aShoot !== void 0 ? { home: hShoot, away: aShoot } : void 0;
|
|
2896
2903
|
return {
|
|
2897
2904
|
id: ev.id,
|
|
2898
2905
|
stage,
|
|
@@ -2904,6 +2911,7 @@ function mapEspnEvent(ev, ctx = {}) {
|
|
|
2904
2911
|
home,
|
|
2905
2912
|
away,
|
|
2906
2913
|
score: hasScore ? { home: hs, away: as } : void 0,
|
|
2914
|
+
shootout,
|
|
2907
2915
|
minute: parseMinute(ev.status ?? comp?.status),
|
|
2908
2916
|
status,
|
|
2909
2917
|
winnerCode,
|
|
@@ -5081,6 +5089,8 @@ function renderPrompt(state, opts = {}) {
|
|
|
5081
5089
|
const flags = opts.flags ?? true;
|
|
5082
5090
|
const team = opts.team?.toUpperCase();
|
|
5083
5091
|
const live = liveMatchesFromCache(state, nowMs);
|
|
5092
|
+
const cachedFixtures = Array.isArray(state?.fixtures) ? state.fixtures : [];
|
|
5093
|
+
const schedule = cachedFixtures.length ? mergeLive(allFixtures(), cachedFixtures) : void 0;
|
|
5084
5094
|
if (team) {
|
|
5085
5095
|
const mine = live.find((m) => m.home?.code === team || m.away?.code === team);
|
|
5086
5096
|
if (mine) return `\u26BD ${matchSegment(mine, compact, flags)}`;
|
|
@@ -5094,17 +5104,16 @@ function renderPrompt(state, opts = {}) {
|
|
|
5094
5104
|
}
|
|
5095
5105
|
const cacheFresh = !!state && state.degraded !== true && ageMs(state, nowMs) < DISPLAY_STALE_MS;
|
|
5096
5106
|
if (!cacheFresh) {
|
|
5097
|
-
const win = fixturesInLiveWindow(nowMs).filter(
|
|
5107
|
+
const win = fixturesInLiveWindow(nowMs, schedule).filter(
|
|
5098
5108
|
(m) => !team || m.home.code === team || m.away.code === team
|
|
5099
5109
|
);
|
|
5100
5110
|
const first = win[0];
|
|
5101
5111
|
if (first) {
|
|
5102
5112
|
const more = win.length - 1;
|
|
5103
|
-
|
|
5113
|
+
const matchup = isResolvedFixture(first) ? `${teamTok(first.home, flags)} vs ${teamTok(first.away, flags)} ` : "";
|
|
5114
|
+
return `\u26BD ${matchup}live \xB7 syncing\u2026` + (more > 0 ? ` +${more}` : "");
|
|
5104
5115
|
}
|
|
5105
5116
|
}
|
|
5106
|
-
const cachedFixtures = Array.isArray(state?.fixtures) ? state.fixtures : [];
|
|
5107
|
-
const schedule = cachedFixtures.length ? mergeLive(allFixtures(), cachedFixtures) : void 0;
|
|
5108
5117
|
const next = team ? nextFixtureForTeam(team, { from: now, fixtures: schedule }) : nextOverall(nowMs, schedule);
|
|
5109
5118
|
if (next && isResolvedFixture(next)) {
|
|
5110
5119
|
return `${teamTok(next.home, flags)} vs ${teamTok(next.away, flags)} in ${countdown(next.kickoff, now)}`;
|
|
@@ -5141,6 +5150,11 @@ ${lines}`;
|
|
|
5141
5150
|
import { spawn } from "child_process";
|
|
5142
5151
|
var MIN_REFRESH_MS = 12e3;
|
|
5143
5152
|
var FIXTURES_TTL_MS = 15 * 6e4;
|
|
5153
|
+
var FIXTURES_EMPTY_TTL_MS = 6e4;
|
|
5154
|
+
function fixturesStale(state, now) {
|
|
5155
|
+
const ttl = (state?.fixtures?.length ?? 0) > 0 ? FIXTURES_TTL_MS : FIXTURES_EMPTY_TTL_MS;
|
|
5156
|
+
return fixturesAgeMs(state, now) > ttl;
|
|
5157
|
+
}
|
|
5144
5158
|
function nextStaticUpcoming(nowMs) {
|
|
5145
5159
|
return [...allFixtures()].sort(byKickoff).find((m) => Date.parse(m.kickoff) >= nowMs);
|
|
5146
5160
|
}
|
|
@@ -5169,7 +5183,7 @@ async function runRefresh(opts = {}) {
|
|
|
5169
5183
|
const sameScope = !!cached && cached.source === source && cached.competition === competition;
|
|
5170
5184
|
const base = sameScope ? cached : void 0;
|
|
5171
5185
|
const needLive = liveWindowActive(nowMs) && (!base || ageMs(base, nowMs) >= MIN_REFRESH_MS);
|
|
5172
|
-
const needFixtures = inKnockoutPhase(nowMs) && (
|
|
5186
|
+
const needFixtures = inKnockoutPhase(nowMs) && fixturesStale(base, nowMs);
|
|
5173
5187
|
if (!needLive && !needFixtures) return;
|
|
5174
5188
|
if (!acquireLock()) return;
|
|
5175
5189
|
try {
|
|
@@ -5219,7 +5233,7 @@ function shouldRefresh(now = Date.now()) {
|
|
|
5219
5233
|
function shouldRefreshFixtures(now = Date.now(), state = readState()) {
|
|
5220
5234
|
if (!inKnockoutPhase(now)) return false;
|
|
5221
5235
|
if (isLockFresh(now)) return false;
|
|
5222
|
-
return
|
|
5236
|
+
return fixturesStale(state, now);
|
|
5223
5237
|
}
|
|
5224
5238
|
function spawnRefresh(source) {
|
|
5225
5239
|
try {
|
|
@@ -5734,7 +5748,9 @@ function cmdHook({ cfg }) {
|
|
|
5734
5748
|
const state = readCurrentState(cfg.source, resolveCompetition());
|
|
5735
5749
|
const ctx = renderHook(state, { team, flags: flagsEnabled() });
|
|
5736
5750
|
if (ctx) out(ctx);
|
|
5737
|
-
if (!state || shouldRefresh()
|
|
5751
|
+
if (!state || shouldRefresh() || shouldRefreshFixtures(Date.now(), state)) {
|
|
5752
|
+
spawnRefresh(cfg.source);
|
|
5753
|
+
}
|
|
5738
5754
|
} catch {
|
|
5739
5755
|
}
|
|
5740
5756
|
}
|
|
@@ -6303,7 +6319,7 @@ function handlePipeError(stream) {
|
|
|
6303
6319
|
}
|
|
6304
6320
|
handlePipeError(process.stdout);
|
|
6305
6321
|
handlePipeError(process.stderr);
|
|
6306
|
-
var VERSION = "0.8.
|
|
6322
|
+
var VERSION = "0.8.10";
|
|
6307
6323
|
var DISCLAIMER = "Claudinho is an independent fan project. Not affiliated with or endorsed by FIFA or Anthropic.";
|
|
6308
6324
|
function ctxFrom(cmd) {
|
|
6309
6325
|
let root = cmd;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claudinho/cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
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.9",
|
|
64
|
-
"@claudinho/core": "0.8.
|
|
64
|
+
"@claudinho/core": "0.8.10"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsup",
|