@claudinho/cli 0.8.6 → 0.8.7

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/index.js +39 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -3842,6 +3842,22 @@ async function marketFixtureForTeam(adapter, code, now = /* @__PURE__ */ new Dat
3842
3842
  const next = nextFixtureForTeam(code, { from: now });
3843
3843
  return { match: next, degraded: false };
3844
3844
  }
3845
+ async function getNextFixtureForTeam(adapter, code, now = /* @__PURE__ */ new Date()) {
3846
+ const base = allFixtures();
3847
+ let matches = base;
3848
+ let degraded = true;
3849
+ let liveById;
3850
+ try {
3851
+ const live = adapter.fetchWindow ? await adapter.fetchWindow(KNOCKOUT_WINDOW_START, KNOCKOUT_WINDOW_END) : [];
3852
+ matches = mergeLive(base, live);
3853
+ degraded = false;
3854
+ liveById = new Set(live.map((m) => m.id));
3855
+ } catch {
3856
+ }
3857
+ const fixture = nextFixtureForTeam(code, { from: now, fixtures: matches });
3858
+ const source = fixture && liveById?.has(fixture.id) ? adapter.name : void 0;
3859
+ return { fixture, degraded, source };
3860
+ }
3845
3861
  async function getMatchById(adapter, id) {
3846
3862
  const base = allFixtures().find((m) => m.id === id);
3847
3863
  if (!base) return { match: void 0, degraded: false };
@@ -5477,19 +5493,24 @@ async function cmdLive(ctx) {
5477
5493
  if (src) out(src);
5478
5494
  out(disclaimer(t2, c));
5479
5495
  }
5480
- async function cmdNext(team, { cfg, t: t2, now }) {
5496
+ async function cmdNext(team, ctx) {
5497
+ const { cfg, t: t2, now } = ctx;
5481
5498
  precheck(cfg, t2);
5482
5499
  const code = resolveTeamArg(team, "Usage: claudinho next <team> (or set CLAUDINHO_TEAM)");
5483
- const fixture = nextFixtureForTeam(code, { from: now ?? /* @__PURE__ */ new Date() });
5500
+ const { fixture, degraded, source } = await getNextFixtureForTeam(
5501
+ adapterFor(ctx),
5502
+ code,
5503
+ now ?? /* @__PURE__ */ new Date()
5504
+ );
5484
5505
  if (cfg.json) {
5485
- emitJson({ team: code, fixture: fixture ?? null });
5506
+ emitJson({ team: code, fixture: fixture ?? null, degraded, source: source ?? null });
5486
5507
  return;
5487
5508
  }
5488
5509
  const c = painterFor(cfg);
5489
5510
  const flags = flagsEnabled();
5490
5511
  out();
5491
5512
  if (!fixture) {
5492
- out(c.dim(" " + t2("next.none", { team: code })));
5513
+ out(c.dim(" " + (degraded ? t2("live.degraded") : t2("next.none", { team: code }))));
5493
5514
  out();
5494
5515
  out(disclaimer(t2, c));
5495
5516
  return;
@@ -5504,6 +5525,8 @@ async function cmdNext(team, { cfg, t: t2, now }) {
5504
5525
  )
5505
5526
  );
5506
5527
  out();
5528
+ const src = dataSource(source, cfg.lang, c);
5529
+ if (src) out(src);
5507
5530
  out(disclaimer(t2, c));
5508
5531
  }
5509
5532
  async function cmdTable(group, ctx) {
@@ -6051,7 +6074,11 @@ async function cmdShare(target, team, opts, ctx) {
6051
6074
  if (target === "next") {
6052
6075
  precheck(cfg, t2);
6053
6076
  const code = resolveTeamArg(team, "Usage: claudinho share next <team> (or set CLAUDINHO_TEAM)");
6054
- const fixture = nextFixtureForTeam(code, { from: ctx.now ?? /* @__PURE__ */ new Date() });
6077
+ const { fixture, degraded: degraded2, source: source2 } = await getNextFixtureForTeam(
6078
+ adapterFor(ctx),
6079
+ code,
6080
+ ctx.now ?? /* @__PURE__ */ new Date()
6081
+ );
6055
6082
  const matches = fixture ? [fixture] : [];
6056
6083
  const signals2 = await reliableShareSignals(ctx, matches);
6057
6084
  const teamName = fixture ? fixture.home.code === code ? fixture.home.name : fixture.away.name : code;
@@ -6065,7 +6092,12 @@ async function cmdShare(target, team, opts, ctx) {
6065
6092
  title: `Next up for ${teamName}`,
6066
6093
  matches,
6067
6094
  marketSignals: signals2,
6068
- emptyNote: `No upcoming fixture found for ${code}.`,
6095
+ // Attribute the provider when the overlay resolved the tie (knockout);
6096
+ // undefined for a static group fixture — parity with CLI `next`.
6097
+ source: source2,
6098
+ degraded: degraded2,
6099
+ // Fail-closed: an outage must never paste as "no fixture" (eliminated).
6100
+ emptyNote: degraded2 ? `Couldn't reach the data provider \u2014 no upcoming fixture confirmed for ${code}.` : `No upcoming fixture found for ${code}.`,
6069
6101
  installLine: `npx @claudinho/cli next ${code}`,
6070
6102
  tz: cfg.tz,
6071
6103
  locale: cfg.lang
@@ -6202,7 +6234,7 @@ function handlePipeError(stream) {
6202
6234
  }
6203
6235
  handlePipeError(process.stdout);
6204
6236
  handlePipeError(process.stderr);
6205
- var VERSION = "0.8.6";
6237
+ var VERSION = "0.8.7";
6206
6238
  var DISCLAIMER = "Claudinho is an independent fan project. Not affiliated with or endorsed by FIFA or Anthropic.";
6207
6239
  function ctxFrom(cmd) {
6208
6240
  let root = cmd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudinho/cli",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
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.6"
64
+ "@claudinho/core": "0.8.7"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "tsup",