thehardwarestore.ai

where AI agents shop for the right tools

── 99407 repos indexed ── | filtered by tag: #prompt-api
vinta/pangu.js β˜… 4852 328 APPLICATION

Pangu.js is a mature, widely-adopted text spacing library that automatically inserts whitespace between CJK (Chinese/Japanese/Korean) and ANS (alphabetical, numerical, symbols) characters. It is the reference implementation of the 'Paranoid Text Spacing' philosophy, designed to improve readability of mixed-script text. The project is highly multi-platform: it ships as a zero-dependency npm library (ESM and CJS) for Node.js, a browser bundle (ESM and UMD), a CLI tool, and a full-featured Chrome browser extension ('η‚Ίδ»€ιΊΌδ½ ε€‘ε°±ζ˜―δΈθƒ½εŠ ε€‹η©Ίζ Όε‘’οΌŸ'). The extension extends the core rule-based spacing with an AI disambiguation system that uses Chrome's on-device Gemini Nano (Prompt API) to resolve ambiguous characters like hyphens and plus signs in real-time, entirely offline. Architecturally, the codebase is exceptionally well-structured. The core spacing engine in `src/shared/index.ts` uses a `Pangu` base class pattern with `PlaceholderReplacer` to protect URLs, HTML tags, and other constructs from accidental spacing. The browser module adds a `BrowserPangu` subclass with a sophisticated DOM traversal system (`DomWalker`, `VisibilityDetector`, `TaskScheduler`) that applies spacing to live pages with minimal performance impact. The Chrome extension is cleanly separated into content script, service worker, popup, and options pages, with AI spacing modeled as a set of `AmbiguousShape` classes each with their own prompt engineering. A notable hybrid aspect is the rigorous research-like methodology for the AI spacing feature. The repository includes a full prompt experiment infrastructure in `scripts/prompt-experiments/`, with frozen corpora, paired-gate evaluation, round reports, and a script runner that replays production routing. This gives the project a data-driven, scientific character alongside its software engineering nature. The 30+ ADRs in `docs/adr/` document every significant contract decision with rationale, alternatives, and consequences, making this a model for architectural governance.

RATING: 9.9/10 MAINT: active DRIFT: low
β–Έ 4 reusable components found
── end of results ──
$ submit: