@claudinho/cli 0.8.4 → 0.8.6

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 -14
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -298,8 +298,8 @@ var ES = {
298
298
  "bracket.invalidStage": "La fase debe ser una de: R32, R16, QF, SF, 3P, F",
299
299
  "bracket.unknownStage": 'Fase desconocida "{stage}". Usa R32, R16, QF, SF, 3P o F.',
300
300
  "bracket.slot.groupWinner": "Ganador del grupo {group}",
301
- "bracket.slot.groupSecond": "2.\xBA del grupo {group}",
302
- "bracket.slot.third": "3.\xBA ({groups})",
301
+ "bracket.slot.groupSecond": "2\xBA del grupo {group}",
302
+ "bracket.slot.third": "3\xBA ({groups})",
303
303
  "bracket.slot.winner": "Ganador {stage} {n}",
304
304
  "bracket.slot.loser": "Perdedor {stage} {n}",
305
305
  "bracket.slot.tbd": "Por definir",
@@ -3049,6 +3049,18 @@ function hasGroupStarted(group, tables) {
3049
3049
  if (!table?.rows.length) return false;
3050
3050
  return table.rows.some((r) => r.played > 0);
3051
3051
  }
3052
+ function matchesPerTeamInGroup(teamCount) {
3053
+ return Math.max(0, teamCount - 1);
3054
+ }
3055
+ function isGroupStandingsComplete(table) {
3056
+ const n = table?.rows.length ?? 0;
3057
+ if (n < 2) return false;
3058
+ const required = matchesPerTeamInGroup(n);
3059
+ return table.rows.every((r) => r.played >= required);
3060
+ }
3061
+ function isGroupComplete(group, tables) {
3062
+ return isGroupStandingsComplete(tables.find((t2) => t2.group === group));
3063
+ }
3052
3064
  function resolveWinner(match) {
3053
3065
  if (!isFinished(match.status)) return void 0;
3054
3066
  if (match.winnerCode) {
@@ -3084,25 +3096,36 @@ function participant(team, status) {
3084
3096
  function tbd(label) {
3085
3097
  return { label, flag: "\u{1F3F3}\uFE0F", status: "tbd" };
3086
3098
  }
3099
+ function confirmedLiveParticipant(team) {
3100
+ if (!team || team.flag === "\u{1F3F3}\uFE0F") return void 0;
3101
+ return participant(team, "confirmed");
3102
+ }
3087
3103
  function winnerLabel(ctx, stage, index) {
3088
3104
  return t(ctx.lang, "bracket.slot.winner", {
3089
3105
  stage: stageLabelI18n(ctx.lang, stage),
3090
3106
  n: String(index)
3091
3107
  });
3092
3108
  }
3093
- function resolveSlot(ref, ctx) {
3109
+ function resolveSlot(ref, ctx, liveTeam) {
3110
+ const liveParticipant = confirmedLiveParticipant(liveTeam);
3094
3111
  switch (ref.kind) {
3095
3112
  case "seed":
3113
+ if (liveParticipant) return liveParticipant;
3096
3114
  return tbd(ref.label);
3097
3115
  case "group": {
3116
+ if (liveParticipant) return liveParticipant;
3098
3117
  if (!ctx.standingsDegraded && hasGroupStarted(ref.group, ctx.tables)) {
3099
3118
  const team = teamFromStandings(ref.group, ref.position, ctx.tables);
3100
- if (team) return participant(team, "projected");
3119
+ if (team) {
3120
+ const status = isGroupComplete(ref.group, ctx.tables) ? "confirmed" : "projected";
3121
+ return participant(team, status);
3122
+ }
3101
3123
  }
3102
3124
  const label = ref.position === 1 ? t(ctx.lang, "bracket.slot.groupWinner", { group: ref.group }) : t(ctx.lang, "bracket.slot.groupSecond", { group: ref.group });
3103
3125
  return tbd(label);
3104
3126
  }
3105
3127
  case "third":
3128
+ if (liveParticipant) return liveParticipant;
3106
3129
  return tbd(t(ctx.lang, "bracket.slot.third", { groups: ref.groups.join("/") }));
3107
3130
  case "winner": {
3108
3131
  const node = ctx.nodesByKey.get(matchKey(ref.stage, ref.index));
@@ -3111,6 +3134,7 @@ function resolveSlot(ref, ctx) {
3111
3134
  const winner = resolveWinner(match);
3112
3135
  if (winner) return participant(winner, "confirmed");
3113
3136
  }
3137
+ if (liveParticipant) return liveParticipant;
3114
3138
  return tbd(winnerLabel(ctx, ref.stage, ref.index));
3115
3139
  }
3116
3140
  case "loser": {
@@ -3120,6 +3144,7 @@ function resolveSlot(ref, ctx) {
3120
3144
  const loser = resolveLoser(match);
3121
3145
  if (loser) return participant(loser, "confirmed");
3122
3146
  }
3147
+ if (liveParticipant) return liveParticipant;
3123
3148
  return tbd(
3124
3149
  t(ctx.lang, "bracket.slot.loser", {
3125
3150
  stage: stageLabelI18n(ctx.lang, ref.stage),
@@ -3157,8 +3182,8 @@ function buildBracketView(topology, matches, tables, standingsDegraded, liveDegr
3157
3182
  stage: node.stage,
3158
3183
  index: node.index,
3159
3184
  kickoff: match.kickoff,
3160
- home: resolveSlot(node.home, ctx),
3161
- away: resolveSlot(node.away, ctx),
3185
+ home: resolveSlot(node.home, ctx, match.home),
3186
+ away: resolveSlot(node.away, ctx, match.away),
3162
3187
  match
3163
3188
  };
3164
3189
  });
@@ -4775,8 +4800,8 @@ function header(text, c) {
4775
4800
  function disclaimer(t2, c) {
4776
4801
  return c.dim(t2("disclaimer"));
4777
4802
  }
4778
- function dataSource(source, c) {
4779
- return source ? c.dim(`Live data: ${liveSourceLabel(source)}`) : "";
4803
+ function dataSource(source, lang, c) {
4804
+ return source ? c.dim(t(lang, "live.data", { source: liveSourceLabel(source) })) : "";
4780
4805
  }
4781
4806
 
4782
4807
  // src/marketCache.ts
@@ -5422,7 +5447,7 @@ async function cmdToday(date, ctx) {
5422
5447
  }
5423
5448
  out();
5424
5449
  if (degraded) out(c.dim(" " + t2("feed.degraded")));
5425
- const src = dataSource(source, c);
5450
+ const src = dataSource(source, cfg.lang, c);
5426
5451
  if (src) out(src);
5427
5452
  out(disclaimer(t2, c));
5428
5453
  }
@@ -5448,7 +5473,7 @@ async function cmdLive(ctx) {
5448
5473
  for (const m of matches) out(matchLine(m, cfg, t2, c, flags));
5449
5474
  }
5450
5475
  out();
5451
- const src = dataSource(source, c);
5476
+ const src = dataSource(source, cfg.lang, c);
5452
5477
  if (src) out(src);
5453
5478
  out(disclaimer(t2, c));
5454
5479
  }
@@ -5539,7 +5564,7 @@ async function cmdTable(group, ctx) {
5539
5564
  }
5540
5565
  out();
5541
5566
  if (degraded) out(c.dim(" " + t2("table.degraded")));
5542
- const src = dataSource(source, c);
5567
+ const src = dataSource(source, cfg.lang, c);
5543
5568
  if (src) out(src);
5544
5569
  out(disclaimer(t2, c));
5545
5570
  }
@@ -5590,7 +5615,7 @@ async function cmdBracket(stage, opts, ctx) {
5590
5615
  out();
5591
5616
  if (degraded) out(c.dim(` ${t(cfg.lang, "bracket.degraded")}`));
5592
5617
  else if (standingsDegraded) out(c.dim(` ${t(cfg.lang, "bracket.standingsDegraded")}`));
5593
- const src = dataSource(source, c);
5618
+ const src = dataSource(source, cfg.lang, c);
5594
5619
  if (src) out(src);
5595
5620
  out(disclaimer(t2, c));
5596
5621
  }
@@ -5730,7 +5755,7 @@ async function cmdMatch(id, ctx) {
5730
5755
  }
5731
5756
  out();
5732
5757
  if (degraded) out(c.dim(" " + t2("feed.degraded")));
5733
- const src = dataSource(liveSource, c);
5758
+ const src = dataSource(liveSource, cfg.lang, c);
5734
5759
  if (src) out(src);
5735
5760
  out(disclaimer(t2, c));
5736
5761
  }
@@ -6177,7 +6202,7 @@ function handlePipeError(stream) {
6177
6202
  }
6178
6203
  handlePipeError(process.stdout);
6179
6204
  handlePipeError(process.stderr);
6180
- var VERSION = "0.8.4";
6205
+ var VERSION = "0.8.6";
6181
6206
  var DISCLAIMER = "Claudinho is an independent fan project. Not affiliated with or endorsed by FIFA or Anthropic.";
6182
6207
  function ctxFrom(cmd) {
6183
6208
  let root = cmd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudinho/cli",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
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.4"
64
+ "@claudinho/core": "0.8.6"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "tsup",