Skip to content

Adapters

Each data source has a dedicated adapter in the adapters/ directory. An adapter’s job is to:

  1. Fetch raw data from the source
  2. Handle pagination, authentication, and rate limits
  3. Normalize each record to the canonical star schema
  4. Return a standard Nushell table

The storage layer receives normalized data and doesn’t need to know which source it came from.

File: adapters/github.nu

The GitHub adapter is the primary (and currently only implemented) adapter. It uses the gh CLI for all API calls.

FunctionDescription
fetchFetch all starred repos with pagination
normalize-repoTransform a GitHub API response to internal schema
get-authenticated-userGet the current gh user’s login
check-authVerify gh CLI is installed and authenticated

The fetch function uses Nushell’s generate for stateful pagination:

Page 1 → 100 stars → normalize → check if done → next state
Page 2 → 100 stars → normalize → check if done → next state
...
Page N → <100 stars → normalize → done

Pagination stops when:

  • A page returns fewer than per_page items (last page)
  • A page returns zero items
  • For incremental sync: the oldest starred_at on a page is older than the --since cutoff

The adapter always requests application/vnd.github.star+json, which wraps each repo in an envelope:

{
"starred_at": "2026-02-20T14:30:00Z",
"repo": {
"id": 12345,
"name": "example",
"full_name": "owner/example",
...
}
}

The process-page function extracts repo and attaches starred_at during normalization.

normalize-repo maps GitHub’s API fields to the internal schema:

GitHub API fieldInternal fieldNotes
ididDirect mapping
owner.loginownerExtracted from nested object
namenameDirect
full_namefull_nameDirect
html_urlhtml_urlKept as html_url (not renamed to url)
descriptiondescriptionNullable
languagelanguageNullable
topicstopicsConverted from list to JSON string
stargazers_countstargazers_countDirect
forks_countforks_countDirect
open_issues_countopen_issues_countDirect
license.namelicenseExtracted from nested object
archivedarchivedBoolean
forkforkBoolean
pushed_atpushed_atISO-8601 string
(generated)sourceAlways "github"
(generated)synced_atCurrent timestamp
(from envelope)starred_atWhen you starred it

The adapter supports gh api --cache for built-in HTTP caching:

Terminal window
fetch --use-cache --cache-duration "1h"

This is especially useful during development or repeated queries.

API errors produce structured Nushell errors with contextual help:

  • 401/authentication errors → “Run ‘gh auth login’ to authenticate”
  • 403/rate limit → “Wait a few minutes or use —use-cache”
  • 404/not found → “Check the username or repository”
  • Other errors → “Check network connection and gh CLI configuration”

Will parse Firefox’s places.sqlite database or exported HTML bookmarks to import GitHub repository bookmarks.

Will parse Chrome’s Bookmarks JSON file to import GitHub repository bookmarks.

Awesome list adapter (adapters/awesome.nu)

Section titled “Awesome list adapter (adapters/awesome.nu)”

Will parse awesome list Markdown files (following the awesome list format) to extract and import repository links.