@claudinho/cli 0.8.8 → 0.8.9
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 +16 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5081,6 +5081,8 @@ function renderPrompt(state, opts = {}) {
|
|
|
5081
5081
|
const flags = opts.flags ?? true;
|
|
5082
5082
|
const team = opts.team?.toUpperCase();
|
|
5083
5083
|
const live = liveMatchesFromCache(state, nowMs);
|
|
5084
|
+
const cachedFixtures = Array.isArray(state?.fixtures) ? state.fixtures : [];
|
|
5085
|
+
const schedule = cachedFixtures.length ? mergeLive(allFixtures(), cachedFixtures) : void 0;
|
|
5084
5086
|
if (team) {
|
|
5085
5087
|
const mine = live.find((m) => m.home?.code === team || m.away?.code === team);
|
|
5086
5088
|
if (mine) return `\u26BD ${matchSegment(mine, compact, flags)}`;
|
|
@@ -5094,17 +5096,16 @@ function renderPrompt(state, opts = {}) {
|
|
|
5094
5096
|
}
|
|
5095
5097
|
const cacheFresh = !!state && state.degraded !== true && ageMs(state, nowMs) < DISPLAY_STALE_MS;
|
|
5096
5098
|
if (!cacheFresh) {
|
|
5097
|
-
const win = fixturesInLiveWindow(nowMs).filter(
|
|
5099
|
+
const win = fixturesInLiveWindow(nowMs, schedule).filter(
|
|
5098
5100
|
(m) => !team || m.home.code === team || m.away.code === team
|
|
5099
5101
|
);
|
|
5100
5102
|
const first = win[0];
|
|
5101
5103
|
if (first) {
|
|
5102
5104
|
const more = win.length - 1;
|
|
5103
|
-
|
|
5105
|
+
const matchup = isResolvedFixture(first) ? `${teamTok(first.home, flags)} vs ${teamTok(first.away, flags)} ` : "";
|
|
5106
|
+
return `\u26BD ${matchup}live \xB7 syncing\u2026` + (more > 0 ? ` +${more}` : "");
|
|
5104
5107
|
}
|
|
5105
5108
|
}
|
|
5106
|
-
const cachedFixtures = Array.isArray(state?.fixtures) ? state.fixtures : [];
|
|
5107
|
-
const schedule = cachedFixtures.length ? mergeLive(allFixtures(), cachedFixtures) : void 0;
|
|
5108
5109
|
const next = team ? nextFixtureForTeam(team, { from: now, fixtures: schedule }) : nextOverall(nowMs, schedule);
|
|
5109
5110
|
if (next && isResolvedFixture(next)) {
|
|
5110
5111
|
return `${teamTok(next.home, flags)} vs ${teamTok(next.away, flags)} in ${countdown(next.kickoff, now)}`;
|
|
@@ -5141,6 +5142,11 @@ ${lines}`;
|
|
|
5141
5142
|
import { spawn } from "child_process";
|
|
5142
5143
|
var MIN_REFRESH_MS = 12e3;
|
|
5143
5144
|
var FIXTURES_TTL_MS = 15 * 6e4;
|
|
5145
|
+
var FIXTURES_EMPTY_TTL_MS = 6e4;
|
|
5146
|
+
function fixturesStale(state, now) {
|
|
5147
|
+
const ttl = (state?.fixtures?.length ?? 0) > 0 ? FIXTURES_TTL_MS : FIXTURES_EMPTY_TTL_MS;
|
|
5148
|
+
return fixturesAgeMs(state, now) > ttl;
|
|
5149
|
+
}
|
|
5144
5150
|
function nextStaticUpcoming(nowMs) {
|
|
5145
5151
|
return [...allFixtures()].sort(byKickoff).find((m) => Date.parse(m.kickoff) >= nowMs);
|
|
5146
5152
|
}
|
|
@@ -5169,7 +5175,7 @@ async function runRefresh(opts = {}) {
|
|
|
5169
5175
|
const sameScope = !!cached && cached.source === source && cached.competition === competition;
|
|
5170
5176
|
const base = sameScope ? cached : void 0;
|
|
5171
5177
|
const needLive = liveWindowActive(nowMs) && (!base || ageMs(base, nowMs) >= MIN_REFRESH_MS);
|
|
5172
|
-
const needFixtures = inKnockoutPhase(nowMs) && (
|
|
5178
|
+
const needFixtures = inKnockoutPhase(nowMs) && fixturesStale(base, nowMs);
|
|
5173
5179
|
if (!needLive && !needFixtures) return;
|
|
5174
5180
|
if (!acquireLock()) return;
|
|
5175
5181
|
try {
|
|
@@ -5219,7 +5225,7 @@ function shouldRefresh(now = Date.now()) {
|
|
|
5219
5225
|
function shouldRefreshFixtures(now = Date.now(), state = readState()) {
|
|
5220
5226
|
if (!inKnockoutPhase(now)) return false;
|
|
5221
5227
|
if (isLockFresh(now)) return false;
|
|
5222
|
-
return
|
|
5228
|
+
return fixturesStale(state, now);
|
|
5223
5229
|
}
|
|
5224
5230
|
function spawnRefresh(source) {
|
|
5225
5231
|
try {
|
|
@@ -5734,7 +5740,9 @@ function cmdHook({ cfg }) {
|
|
|
5734
5740
|
const state = readCurrentState(cfg.source, resolveCompetition());
|
|
5735
5741
|
const ctx = renderHook(state, { team, flags: flagsEnabled() });
|
|
5736
5742
|
if (ctx) out(ctx);
|
|
5737
|
-
if (!state || shouldRefresh()
|
|
5743
|
+
if (!state || shouldRefresh() || shouldRefreshFixtures(Date.now(), state)) {
|
|
5744
|
+
spawnRefresh(cfg.source);
|
|
5745
|
+
}
|
|
5738
5746
|
} catch {
|
|
5739
5747
|
}
|
|
5740
5748
|
}
|
|
@@ -6303,7 +6311,7 @@ function handlePipeError(stream) {
|
|
|
6303
6311
|
}
|
|
6304
6312
|
handlePipeError(process.stdout);
|
|
6305
6313
|
handlePipeError(process.stderr);
|
|
6306
|
-
var VERSION = "0.8.
|
|
6314
|
+
var VERSION = "0.8.9";
|
|
6307
6315
|
var DISCLAIMER = "Claudinho is an independent fan project. Not affiliated with or endorsed by FIFA or Anthropic.";
|
|
6308
6316
|
function ctxFrom(cmd) {
|
|
6309
6317
|
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.9",
|
|
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.9"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsup",
|