@claudinho/cli 0.8.16 → 0.8.17
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 +44 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4149,7 +4149,8 @@ var PolymarketProvider = class {
|
|
|
4149
4149
|
opts;
|
|
4150
4150
|
name = "polymarket";
|
|
4151
4151
|
async findSignal(match, options) {
|
|
4152
|
-
|
|
4152
|
+
const deadline = options?.deadlineMs != null ? Date.now() + options.deadlineMs : Number.POSITIVE_INFINITY;
|
|
4153
|
+
return (await this.resolveOne(match, options, deadline)).signal;
|
|
4153
4154
|
}
|
|
4154
4155
|
async findSignals(matches, options) {
|
|
4155
4156
|
const signals = /* @__PURE__ */ new Map();
|
|
@@ -4157,7 +4158,7 @@ var PolymarketProvider = class {
|
|
|
4157
4158
|
const deadline = options?.deadlineMs != null ? Date.now() + options.deadlineMs : Number.POSITIVE_INFINITY;
|
|
4158
4159
|
for (const m of matches) {
|
|
4159
4160
|
if (Date.now() >= deadline) break;
|
|
4160
|
-
const r = await this.resolveOne(m, options);
|
|
4161
|
+
const r = await this.resolveOne(m, options, deadline);
|
|
4161
4162
|
if (r.checked) checked.add(m.id);
|
|
4162
4163
|
if (r.signal) signals.set(m.id, r.signal);
|
|
4163
4164
|
}
|
|
@@ -4169,13 +4170,16 @@ var PolymarketProvider = class {
|
|
|
4169
4170
|
* provider/network error — so transient failures are retried, not
|
|
4170
4171
|
* negative-cached.
|
|
4171
4172
|
*/
|
|
4172
|
-
async resolveOne(match, options) {
|
|
4173
|
+
async resolveOne(match, options, deadline = Number.POSITIVE_INFINITY) {
|
|
4173
4174
|
const entry = (this.opts.mapping ?? BUNDLED_MAPPING)[match.id];
|
|
4174
4175
|
const slugs = entry?.eventSlug ? [entry.eventSlug] : deriveEventSlugs(match);
|
|
4175
4176
|
if (slugs.length === 0) return { checked: true };
|
|
4177
|
+
const configured = options?.timeoutMs ?? this.opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
4176
4178
|
try {
|
|
4177
4179
|
for (const slug of slugs) {
|
|
4178
|
-
const
|
|
4180
|
+
const remaining = deadline - Date.now();
|
|
4181
|
+
if (remaining <= 0) return { checked: false };
|
|
4182
|
+
const event = await this.fetchEvent(slug, Math.min(configured, remaining));
|
|
4179
4183
|
const signal = event ? this.toSignal(match, slug, event, options) : void 0;
|
|
4180
4184
|
if (signal) return { signal, checked: true };
|
|
4181
4185
|
}
|
|
@@ -4255,6 +4259,27 @@ var PolymarketProvider = class {
|
|
|
4255
4259
|
return signal.ambiguous ? void 0 : signal;
|
|
4256
4260
|
}
|
|
4257
4261
|
};
|
|
4262
|
+
var POLYMARKET_TOKEN = {
|
|
4263
|
+
SUI: "che",
|
|
4264
|
+
// Switzerland
|
|
4265
|
+
NED: "nld",
|
|
4266
|
+
// Netherlands
|
|
4267
|
+
URU: "ury",
|
|
4268
|
+
// Uruguay
|
|
4269
|
+
POR: "prt",
|
|
4270
|
+
// Portugal
|
|
4271
|
+
CRO: "hrv",
|
|
4272
|
+
// Croatia
|
|
4273
|
+
COD: "cdr",
|
|
4274
|
+
// DR Congo
|
|
4275
|
+
CPV: "cvi"
|
|
4276
|
+
// Cabo Verde
|
|
4277
|
+
};
|
|
4278
|
+
function pmTokens(code) {
|
|
4279
|
+
const c = code.toLowerCase();
|
|
4280
|
+
const alias = POLYMARKET_TOKEN[code.toUpperCase()];
|
|
4281
|
+
return alias && alias !== c ? [alias, c] : [c];
|
|
4282
|
+
}
|
|
4258
4283
|
function deriveEventSlugs(match) {
|
|
4259
4284
|
const home = match.home.code.toLowerCase();
|
|
4260
4285
|
const away = match.away.code.toLowerCase();
|
|
@@ -4262,10 +4287,18 @@ function deriveEventSlugs(match) {
|
|
|
4262
4287
|
if (!/^[a-z]{3}$/.test(home) || !/^[a-z]{3}$/.test(away)) return [];
|
|
4263
4288
|
const utcDate = match.kickoff.slice(0, 10);
|
|
4264
4289
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(utcDate)) return [];
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
];
|
|
4290
|
+
const dates = [utcDate, shiftUtcDate(utcDate, -1)];
|
|
4291
|
+
const homeToks = pmTokens(match.home.code);
|
|
4292
|
+
const awayToks = pmTokens(match.away.code);
|
|
4293
|
+
const slugs = [];
|
|
4294
|
+
for (const d of dates) {
|
|
4295
|
+
for (const h of homeToks) {
|
|
4296
|
+
for (const a of awayToks) {
|
|
4297
|
+
slugs.push(`fifwc-${h}-${a}-${d}`);
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
return [...new Set(slugs)];
|
|
4269
4302
|
}
|
|
4270
4303
|
function slugToken(m) {
|
|
4271
4304
|
return (m.slug ?? "").toLowerCase().split("-").pop() ?? "";
|
|
@@ -4274,10 +4307,10 @@ function isDrawMarket(m) {
|
|
|
4274
4307
|
return slugToken(m) === "draw" || (m.groupItemTitle ?? "").trim().toLowerCase().startsWith("draw");
|
|
4275
4308
|
}
|
|
4276
4309
|
function pickMarket(markets, teamCode, teamName) {
|
|
4277
|
-
const
|
|
4310
|
+
const tokens = pmTokens(teamCode);
|
|
4278
4311
|
const name = teamName.trim().toLowerCase();
|
|
4279
4312
|
const teamMarkets = markets.filter((m) => !isDrawMarket(m));
|
|
4280
|
-
const bySlug = teamMarkets.find((m) => slugToken(m)
|
|
4313
|
+
const bySlug = teamMarkets.find((m) => tokens.includes(slugToken(m)));
|
|
4281
4314
|
if (bySlug) return bySlug;
|
|
4282
4315
|
return teamMarkets.find((m) => (m.groupItemTitle ?? "").trim().toLowerCase() === name);
|
|
4283
4316
|
}
|
|
@@ -6423,7 +6456,7 @@ function handlePipeError(stream) {
|
|
|
6423
6456
|
}
|
|
6424
6457
|
handlePipeError(process.stdout);
|
|
6425
6458
|
handlePipeError(process.stderr);
|
|
6426
|
-
var VERSION = "0.8.
|
|
6459
|
+
var VERSION = "0.8.17";
|
|
6427
6460
|
var DISCLAIMER = "Claudinho is an independent fan project. Not affiliated with or endorsed by FIFA or Anthropic.";
|
|
6428
6461
|
function ctxFrom(cmd) {
|
|
6429
6462
|
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.17",
|
|
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.17"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsup",
|