Skip to content

feat: add Font Squirrel and Fontshare providers - #14

Merged
Microck merged 1 commit into
mainfrom
feat/font-catalog-providers
Aug 9, 2026
Merged

Microck merged 1 commit into
mainfrom
feat/font-catalog-providers

Conversation

@Microck

@Microck Microck commented Aug 9, 2026 •

Copy link
Copy Markdown
Owner

what changed

  • added structured catalog providers for Font Squirrel and Fontshare
  • reused Moji's bounded archive inspection and download validation
  • kept Font Squirrel opt-in because its AWS WAF can challenge API clients
  • exposed Fontshare license metadata and documented both providers

testing

  • npm run verify
  • live Fontshare search and ZIP inspection
  • live Font Squirrel blocked-path check

Greptile Summary

The PR adds structured Font Squirrel and Fontshare catalog providers, including bounded archive inspection, provider configuration, caching, metadata, tests, and documentation.

  • Enables Fontshare by default and keeps Font Squirrel opt-in.
  • Adds endpoint-aware cache namespaces and canonical catalog query keys.
  • Makes cache-hit and live-result forwarding cancellation-aware and drains source streams after cancellation.
  • Documents provider behavior, configuration, defaults, and CLI selection.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
internal/provider/catalogs.go Adds both catalog providers with bounded catalog reads, archive resolution, endpoint-specific caching, license propagation, and cancellation-aware result sends.
internal/cache/cache.go Adds provider-specific cache identities and fixes cache-hit and live forwarding cancellation without stranding source senders.
internal/provider/discovery.go Reuses constrained HTTP handling for catalog requests and reports WAF challenges and HTTP failures through provider error categories.
internal/app/search.go Wires Font Squirrel and Fontshare into provider selection and caching.
internal/config/config.go Adds provider defaults and rate-limit policies, with Fontshare enabled and Font Squirrel disabled.
docs/content/docs/reference/providers.mdx Documents the new providers and now matches the runtime enablement defaults.
internal/provider/catalogs_test.go Covers archive resolution, format and license handling, error classification, network constraints, caching identity, and blocked-send cancellation.
internal/cache/cache_test.go Covers cancellation of blocked cache and live forwarding plus source-stream draining and cache namespace behavior.

Sequence Diagram

sequenceDiagram
  participant CLI
  participant Cache as CachedProvider
  participant Catalog as Fontshare / Font Squirrel
  participant API as Catalog API
  participant Archive as Official ZIP
  CLI->>Cache: Search(query, formats)
  alt Cache hit
    Cache-->>CLI: Cached results
  else Cache miss
    Cache->>Catalog: Search(query, formats)
    Catalog->>API: Fetch bounded catalog
    API-->>Catalog: Family metadata
    Catalog->>Archive: Download closest matching archives
    Archive-->>Catalog: Bounded archive bytes
    Catalog-->>Cache: Valid requested font members
    Cache-->>CLI: Results
    Cache->>Cache: Persist completed result set
  end
Loading

Reviews (8): Last reviewed commit: "feat: add Font Squirrel and Fontshare pr..." | Re-trigger Greptile

@vercel

vercel Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moji-docs Ready Ready Preview Aug 9, 2026 8:40pm

@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread internal/provider/catalogs.go Outdated
Comment thread docs/content/docs/reference/providers.mdx Outdated
@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

This PR adds Font Squirrel and Fontshare catalog providers with bounded archive inspection, license metadata, ranked matching, caching, and configurable enablement.

  • Fontshare is enabled by default; Font Squirrel is opt-in because AWS WAF may block API clients.
  • Providers now report blocked and rate-limited responses and restrict archive inspection.
  • Before release, run npm run verify and validate live Fontshare access and the Font Squirrel blocked path.

Walkthrough

This change adds Font Squirrel and Fontshare archive catalog providers. The providers fetch bounded catalogs, rank normalized family-name matches, resolve official archive downloads, and preserve source and license metadata. Cache identity and query normalization are provider-specific. Configuration, provider registration, CLI validation, help text, tests, and documentation now include both providers. WAF and HTTP responses return categorized errors. The package version is now 0.7.0.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant searchEvents
  participant Fontshare
  participant CatalogEndpoint
  participant OfficialArchive
  Client->>searchEvents: select fontshare provider
  searchEvents->>Fontshare: search query and formats
  Fontshare->>CatalogEndpoint: fetch bounded catalog
  Fontshare->>Fontshare: match and rank catalog entries
  Fontshare->>OfficialArchive: resolve archive URL
  Fontshare-->>searchEvents: emit result metadata
  searchEvents-->>Client: return search results
Loading

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/content/docs/reference/providers.mdx`:
- Around line 8-15: Update the provider defaults documented in the GetFonts and
Font Squirrel sections: mark GetFonts as enabled rather than disabled, and mark
Font Squirrel as disabled/opt-in rather than enabled. Keep the remaining
provider metadata unchanged and ensure both sections consistently describe the
runtime defaults.

In `@internal/provider/catalogs.go`:
- Around line 94-100: Update fetchArchiveCatalog to apply the same
safehttp.Constrain setup, private-network context handling, and HTTPS-only
redirect policy used by fetchDiscoveryContentWithType before issuing the
request. Replace the supplied client with the constrained client for client.Do,
preserving the existing request construction and error handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 99679c31-13f5-4547-a860-16379d02ff9e

📥 Commits

Reviewing files that changed from the base of the PR and between eed6bd4 and 795c63d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (16)
  • README.md
  • docs/content/docs/how-to/search-and-filter.mdx
  • docs/content/docs/reference/cli.mdx
  • docs/content/docs/reference/configuration.mdx
  • docs/content/docs/reference/providers.mdx
  • e2e/cli_test.go
  • internal/app/app_test.go
  • internal/app/output.go
  • internal/app/search.go
  • internal/config/config.go
  • internal/config/config_test.go
  • internal/provider/catalogs.go
  • internal/provider/catalogs_test.go
  • internal/provider/discovery.go
  • internal/provider/discovery_test.go
  • package.json

Comment thread docs/content/docs/reference/providers.mdx
Comment thread internal/provider/catalogs.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 795c63d355

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/config.go
Comment thread docs/content/docs/reference/providers.mdx Outdated
@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f9ec30ece

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/provider/catalogs.go Outdated
@Microck
Microck force-pushed the feat/font-catalog-providers branch from 1f9ec30 to 8a9a3ed Compare August 9, 2026 19:20
@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a9a3ed0a3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/provider/catalogs.go
Comment thread internal/provider/catalogs.go
@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread internal/cache/cache.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1023896f2d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/provider/catalogs.go
Comment thread internal/app/search.go
@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b4196c310

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/provider/catalogs.go
@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@Microck

Microck commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/cache/cache.go`:
- Around line 74-82: Update the cache-hit and done-handling paths in the cache
retrieval function to check ctx.Err() before forwarding results and before
returning normally, including empty cache hits and cases where done and
ctx.Done() are both ready. Preserve source errors when no cancellation exists,
return the context error after cancellation, and add a test covering a
pre-canceled context with a buffered cache hit.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5335e1b2-02f3-481a-96a2-ed47c2f19848

📥 Commits

Reviewing files that changed from the base of the PR and between 8a9a3ed and 6e9f578.

📒 Files selected for processing (5)
  • internal/cache/cache.go
  • internal/cache/cache_test.go
  • internal/provider/catalogs.go
  • internal/provider/catalogs_test.go
  • internal/provider/discovery.go

Comment thread internal/cache/cache.go
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 6e9f578c7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Search both structured catalogs and inspect official archives through the existing safety limits. Keep Font Squirrel opt-in when site protection blocks API clients and prepare v0.7.0.
@Microck
Microck force-pushed the feat/font-catalog-providers branch from 6e9f578 to 93d44bb Compare August 9, 2026 20:39
@Microck
Microck merged commit b92a5d1 into main Aug 9, 2026
4 checks passed
@Microck
Microck deleted the feat/font-catalog-providers branch August 9, 2026 20:41

This branch was successfully deployed

1 active deployment
Preview — 93d44bbc Deployed Aug 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant