Skip to content

Add Fotcast extension - #30979

Closed
fcarysnyder wants to merge 8 commits into
raycast:mainfrom
fcarysnyder:ext/fotcast
Closed

fcarysnyder wants to merge 8 commits into
raycast:mainfrom
fcarysnyder:ext/fotcast

Conversation

@fcarysnyder

Copy link
Copy Markdown
Contributor

Description

Adds Fotcast, an extension for daily football matches and scores from
FotMob.

  • Matches: every league's fixtures for a day, grouped by competition.
    Each row's subtitle is the kickoff time before the match starts, then the
    live match clock (minute, HT, FT) once it starts. The right side shows the
    home crest, a score badge, and the away crest, with the badge coloured by
    your favorite club's result once the match finishes.
  • Favorite any number of teams and leagues from the Favorites command.
    Favorite-team matches are pinned to a ★ Teams section, favorite leagues
    each get a ★ <league> section, and an All Leagues / Favorites dropdown
    switches between the full day and just your pinned sections.
  • Day navigation (⌘], ⌘[, ⌘T, and a calendar picker) and a footer showing the
    current day.
  • Pressing Enter on a match opens a full-screen view: a scoreboard with both
    crests, score, goals and red cards, a pitch chart of both starting lineups
    with formations, substitutions, player ratings in FotMob's own colour
    scale, and a sidebar with kickoff, competition, stadium, referee,
    attendance and top match stats.
  • Live matches refresh automatically every 60 seconds.

The extension calls FotMob's public web endpoints, which are undocumented
and unofficial; there's no API key, no sign-in, and no preferences to
configure. Runs on macOS and Windows.

Screencast

Screenshots in metadata/:

  1. fotcast-1.png — Matches command, All Leagues view, showing the ★ Teams
    pin and multiple Champions League fixtures with live clocks and scores.
  2. fotcast-2.png — Match detail view: scoreboard, score, and goal-scorer
    list for Manchester United vs Sabah FK.
  3. fotcast-3.png — Match detail view: pitch chart of both starting
    lineups with formations and substitutions.
  4. fotcast-4.png — Match detail view: full player ratings table for both
    sides.
  5. fotcast-5.png — Favorites command listing a favorited team and two
    favorited leagues.

Checklist

🤖 Generated with Claude Code

Daily football matches from FotMob: favorite teams and leagues, day navigation,
live scores, and a match view with scoreboard, lineups, substitutions, ratings
and stats.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@raycastbot

Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@greptile-apps

greptile-apps Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds the Fotcast Raycast extension for browsing football fixtures and live scores, managing favorite teams and leagues, and viewing detailed match information.

  • Integrates FotMob match, lineup, search, and image endpoints.
  • Adds grouped match lists, date navigation, filters, favorites, live refresh, and detailed lineup/stat views.
  • Includes extension metadata, screenshots, documentation, tests, and package configuration.
  • Updates favorite mutations to read LocalStorage immediately before writing, although this does not make concurrent read-modify-write operations atomic.

Confidence Score: 3/5

The PR does not yet appear safe to merge because favorite mutations can still discard concurrent updates and some later substitution events can still disappear.

The favorite change is only a partial fix: reading LocalStorage immediately before each write narrows the stale-cache window, but two overlapping toggles can still both read the same value and the later write can overwrite the earlier one. The previous substitution finding also remains unresolved because fallback filtering still excludes a player solely when their ID appeared in any complete swap, without considering the later event’s time and direction.

Files Needing Attention: extensions/fotcast/src/store.ts, extensions/fotcast/src/schedule.ts

Important Files Changed

Filename Overview
extensions/fotcast/src/store.ts Replaces render-cached favorite updates with read-before-write mutations, but overlapping operations can still read the same value and overwrite one another.
extensions/fotcast/src/schedule.ts Implements league grouping and substitution pairing; the previous unresolved filtering defect remains in the current code.
extensions/fotcast/src/matches.tsx Implements the match list, navigation, refresh, detail actions, and parent-aware league favorite toggling.
extensions/fotcast/src/detail.tsx Renders match scoreboards, lineups, substitutions, ratings, and metadata using the shared scheduling logic.
extensions/fotcast/src/fotmob.ts Defines FotMob response models and the extension’s remote data boundary.
extensions/fotcast/package.json Declares the extension metadata, supported platforms, commands, scripts, and dependencies.

Reviews (8): Last reviewed commit: "Close the cross-window gap in the favori..." | Re-trigger Greptile

Comment thread extensions/fotcast/src/store.ts Outdated
Comment on lines +22 to +35
toggleTeam: (team: Favorites["teams"][number]) =>
setValue({
...favorites,
teams: favorites.teams.some((t) => t.id === team.id)
? favorites.teams.filter((t) => t.id !== team.id)
: [...favorites.teams, team],
}),
toggleLeague: (league: Favorites["leagues"][number]) =>
setValue({
...favorites,
leagues: favorites.leagues.some((l) => l.id === league.id)
? favorites.leagues.filter((l) => l.id !== league.id)
: [...favorites.leagues, league],
}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Favorite updates overwrite each other

Rapid or concurrent favorite changes can overwrite each other because both setters build the entire next value from the favorites captured during the current render. useLocalStorage does not support functional updates or synchronize separate hook instances, so two quick toggles—or writes from the Matches and Favorites commands while both are open—can start from the same stale value. The later write then silently discards the earlier favorite change.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/fotcast/src/store.ts
Line: 22-35

Comment:
**Favorite updates overwrite each other**

Rapid or concurrent favorite changes can overwrite each other because both setters build the entire next value from the `favorites` captured during the current render. `useLocalStorage` does not support functional updates or synchronize separate hook instances, so two quick toggles—or writes from the Matches and Favorites commands while both are open—can start from the same stale value. The later write then silently discards the earlier favorite change.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread extensions/fotcast/src/matches.tsx Resolved
Comment thread extensions/fotcast/src/detail.tsx Resolved
@pernielsentikaer pernielsentikaer self-assigned this Sep 10, 2026

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fcarysnyder 👋

Thanks for contributing Fotcast! We already have Fotmob in the Store by @sonla58, covering schedules, scores, match details, and favorites on macOS and Windows.

The pinned favorites and graphical match presentation look like useful enhancements. Would you be open to contributing them to the existing extension instead? If there’s a reason that wouldn’t work, could you explain it here? 🙂


I’ll convert this PR into a draft after submitting this review. Please press Ready for review when it’s ready and we’ll have a look 😊

@pernielsentikaer
pernielsentikaer marked this pull request as draft September 10, 2026 21:01
Comment thread extensions/fotcast/matches.tsx Resolved
Greptile flagged this in review: it lives outside src/, is excluded from
tsconfig's src/**/* project, and isn't the file Raycast actually runs for
the matches command.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fcarysnyder

Copy link
Copy Markdown
Contributor Author

hi @pernielsentikaer - thanks for getting back so quick!

I built this as a separate app because the two products have different scope. The Fotmob app you shared is 10 entity-focused commands (search teams, search players, team detail, player detail, league table, match detail by ID, etc.), which is a general browsing tool. Fotcast is two commands built around one flow: a day's schedule with your favorite teams/leagues pinned to the top.

This one is more of a "fotmob companion" that lets you do two things:

  1. follow your favorite teams/leagues
  2. see the schedule for any given day, prioritizing your favorite teams and leagues (but showing all games on a given day).

My app also goes deeper on the match view itself: their Match Detail is a separate command you launch with a typed-in match ID, and it shows text stat bars and formation names but no lineups or ratings. Mine opens straight from a match row and renders a pitch chart of both starting elevens, substitutions with minutes, and color-coded player ratings. If I were to bring that level of detail to their app across league tables, teams, and matchdays too, that's more surface area than I'm willing to take on.

I figured all the above warrant a different application but I'm open to contacting the other dev and seeing if I can contribute to their repo if necessary.

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fcarysnyder 👋 Thanks for explaining! The favorites-first flow and graphical lineups are useful improvements. We’d prefer bringing those into Fotmob by @sonla58 rather than adding another integration for the same service.

That wouldn’t need to mean expanding every existing command. Would you be open to discussing a focused contribution with @sonla58? 🙂

@fcarysnyder

Copy link
Copy Markdown
Contributor Author

Hi @pernielsentikaer

Contributing this back to the Fotmob app really means one of two things:

  1. rewrite Matchday and Match Detail to match this UX, which risks breaking behavior existing users rely on and leaves the app half-rewritten, or
  2. I adapt my features to their existing patterns, which means re-building what already works for me inside a codebase I didn't design.

Neither is worth it to me.

If you're saying Fotcast can't stand alone as its own extension, I'm happy to close this out. I appreciate your time either way.

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fcarysnyder 👋

Thanks for explaining—we’re happy to allow Fotcast as a separate extension.

Could you address the remaining Greptile feedback? I verified that overlapping favorite updates can discard changes, parent-league favorites aren’t consistently handled by match-row actions, and same-minute substitutions can pair the wrong players.

Please preserve overlapping favorite changes, make league toggles consistent with the parent-aware grouping, and use actual substitution pairings—or display incoming/outgoing players separately when pairing data isn’t available. 🙂

Addresses the three remaining Greptile P1 findings on PR raycast#30979:

- useFavorites now tracks the latest value in a ref so two toggles fired
  before a re-render chain instead of the second clobbering the first
  (useLocalStorage's setValue has no functional-updater form).
- Match rows now resolve a league's favorite status and toggle target
  through favoriteLeagueEntry (shared with buildSections), so a league
  favorited by parentLeagueId no longer shows "Favorite" and creates a
  duplicate entry keyed by primaryId.
- Substitution lines use FotMob's actual [in, out] swap pairing from
  matchFacts.events instead of pairing independently-sorted in/out lists
  by index, which could cross wires on same-minute multi-subs. Falls back
  to unpaired in/out lines, never a guess, when swap data is missing.

pairSubstitutions and favoriteLeagueEntry are extracted to schedule.ts
(pure logic, per the existing file split) with tests covering both the
paired and fallback paths.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Comment thread extensions/fotcast/src/schedule.ts Resolved
- Delete fetchAllLeagues, AllLeagues, LeagueRef (zero callers anywhere).
- Trim Team/MatchStatus/Match/MatchDayLeague/lineup type fields that
  mirror FotMob's API but nothing in src/ ever reads.
- Extract toggleFavorite(wasFavorite, name, run) to store.ts, shared by
  matches.tsx and favorites.tsx instead of two near-identical
  toggle-then-toast blocks.
- Delete isFavoriteMatch, exported from schedule.ts but only ever called
  by the test; the test now inlines hasFavoriteTeam || isFavoriteLeague.
- Drop the unused export on MatchState and SubLine (never imported
  outside schedule.ts).

Net -51 lines. typecheck/lint/tests clean.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Addresses a Greptile P1 on schedule.ts:75-84. The old branch treated
'any complete swap pair present' as all-or-nothing: if even one
substitution had a full [in, out] pair, the function returned only the
paired subs and silently dropped any other substitution whose swap event
was missing or incomplete, even though it was still available from the
roster's own subIn/subOut records.

Now pairs by substitution instead of branching on the array as a whole:
each sub with a complete swap pair renders paired, and any sub not
covered by a pair (tracked by player id) falls back to its own unpaired
in/out line instead of disappearing.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Comment on lines +85 to +90
...ins
.filter((e) => !pairedIds.has(e.id))
.map((e) => ({ ...e, direction: "in" as const })),
...outs
.filter((e) => !pairedIds.has(e.id))
.map((e) => ({ ...e, direction: "out" as const })),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Later Substitution Disappears

If a substitute enters in a complete swap and later leaves in an incomplete swap, pairedIds already contains that player's ID. The fallback therefore removes the later subOut event even though it has a different time and direction, so the match details omit that substitution. Match paired events by time and direction as well as player ID.

Knowledge Base Used: Extension command implementation patterns

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/fotcast/src/schedule.ts
Line: 85-90

Comment:
**Later Substitution Disappears**

If a substitute enters in a complete swap and later leaves in an incomplete swap, `pairedIds` already contains that player's ID. The fallback therefore removes the later `subOut` event even though it has a different time and direction, so the match details omit that substitution. Match paired events by time and direction as well as player ID.

**Knowledge Base Used:** [Extension command implementation patterns](https://app.greptile.com/raycast/-/custom-context/knowledge-base/raycast/extensions/-/docs/extension-command-implementation.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

The earlier fix (a useRef tracking the latest value) only solved toggles
racing within one command window; the ref is per-instance, so it did
nothing for the other scenario the original Greptile comment named:
writes from the Matches and Favorites commands while both are open. The
review thread on store.ts stayed unresolved because that gap was real.

useLocalStorage just wraps LocalStorage.getItem/setItem with a plain
JSON round-trip (confirmed against its own source — no reviver needed
for a Date/Buffer-free type like Favorites), so toggles now read
LocalStorage directly right before writing instead of trusting any
cached snapshot, React state or ref. Not a true compare-and-swap —
Raycast's LocalStorage has no locking primitive for that — but it
removes the stale-cache window that made overlapping writes a coin
flip. Simpler than the ref version too: no extra hook, no manual cache
tracking.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fcarysnyder
fcarysnyder deleted the ext/fotcast branch September 11, 2026 18:56
@fcarysnyder

Copy link
Copy Markdown
Contributor Author

apologies - I ran ray publish on my local and it closed this branch and opened a new PR here

@fcarysnyder fcarysnyder mentioned this pull request Sep 11, 2026
5 tasks done
@fcarysnyder

Copy link
Copy Markdown
Contributor Author

Continued in #31030. ray publish recreated the branch, which closed this PR. All the requested fixes are in the new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants