This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
iOS/macOS widgets for the Scriptable app. The entire project is a single JavaScript file (UniversalDataWidget.js) that runs inside Scriptable on device. There is no build system, package manager, or test runner — development is editing the JS file directly and testing inside the Scriptable app.
The widget is structured as a class hierarchy inside one file (~1565 lines):
defaultSource— which data source to use if no widget parameter is setapiBaseUrl— points tohttps://api.michi.onl/api(custom backend)sizing— per-size (small/medium/large) layout constantscolors— iOS dynamic color palettesources— per-source config: endpoint, icon, refresh interval, URL scheme, and source-specific settings (profiles, repos, credentials)
APIClient— wraps Scriptable'sRequestfor GET/POST with URL buildingImageCache— in-memory cache for remote images loaded during a widget renderCacheManager— persists fetched data to iCloud/local file system as JSON underwidget-cache/cache_<source>.json; serves stale data when offline (48h max)CredentialManager— stores sensitive credentials (Wikipedia tokens) in iOS Keychain viaKeychain.set/getFormatUtils— shared string/number/date formatting helpers
Each data source extends the abstract DataSource base class and must implement:
fetchData(widgetSize)— fetches and normalizes data, returns a plain objectisEmpty(data)— returns true when data has no displayable contentrenderWidget(widget, data, widgetSize)— builds the ScriptableListWidgetUI
Implemented sources: BillboardDataSource, IMDbDataSource, SteamDataSource, HackerNewsDataSource, GitHubDataSource, WikipediaDataSource, TimelineDataSource, BookmarksDataSource, BooksDataSource.
DataSourceFactory.create(sourceName, apiClient) handles the "source:extra" parameter syntax (e.g., "timeline:contributions", "books:9780099518471").
- Reads
args.widgetParameter(or falls back toCONFIG.defaultSource) - Instantiates the correct
DataSourcevia factory - Calls
fetchData→ caches result → callsrenderWidget - Falls back to
CacheManageron network failure - Adds a footer with timestamp (large widgets only) and offline indicator
| Parameter | Effect |
|---|---|
billboard |
Billboard 200 chart |
imdb |
IMDb popular movies & TV |
steam |
Steam recent games |
hackernews |
Hacker News top stories |
github |
GitHub releases for tracked repos |
wikipedia |
Wikipedia watchlist edits |
timeline |
Full timeline |
timeline:contributions |
Filtered: contributions only |
timeline:media |
Filtered: media only |
bookmarks |
Recent Linkding bookmarks |
books |
Currently reading (default ISBN) |
books:9780099518471 |
Currently reading (specific ISBN) |
Edit CONFIG.sources at the top of the file:
- Steam:
profilesarray — add Steam usernames - GitHub:
reposarray — add"owner/repo"strings - Wikipedia:
usernames,tokens, andhours(1-720), or use the in-app setup wizard (run the script directly in Scriptable) - Books:
defaultIsbn— fallback ISBN when none is passed as parameter
The file relies on Scriptable globals (ListWidget, Stack, SFSymbol, Font, Color, Request, FileManager, Keychain, Script, config, args). These are not available outside of Scriptable — the file cannot be linted or executed in a standard Node.js environment.
