# npm-original

Find the **likely original** npm package among same or near-name results (including scoped forks).

This is **not** a typosquat / spelling-fuzz scanner. Competitors answer “was this name misspelled?” — this tool answers Theo’s question: **among same/near-name packages, which is the original?**

## Human UI

Open `/npm-original/` and enter a package name (default example: `tsc-rs`).

Columns: name, weekly downloads, created, GitHub repo, classification, short reason.

## Agent / JSON

```
GET /npm-original/?q=tsc-rs&format=json
```

Also accepts `json=1`. Runs in the browser (static page). The page replaces itself with a JSON document after fetches complete. Pure `curl` of the HTML shell will **not** execute the logic — use a JS runtime or headless browser.

Machine contracts: `agents.json`, `llms.txt`.

## Judgment order

1. **GitHub fork parent** (strongest): if `repo.fork` and `parent` maps to another candidate → `fork of X`
2. **Same GitHub repo** as a higher-ranked package → `same-project` (platform binaries / scoped companions)
3. **Download order-of-magnitude** gap among non-forks
4. **Repo ownership** / dominant repo among candidates
5. **Publish time** — weak signal only (never “earliest = original”; `@bext-stack/tsc-rs` is older than `tsc-rs` but a different project)
6. **Independent same-name** — similar name, different non-fork repo → labeled separately (not typosquat, not fork)

## Search variants

Exact name, spaces instead of `-`, stripped separators (`tscrs`), light suffix stripping (`-rs` / `-rust`), then npm search for each. Deduped by package name.

## APIs (browser, CORS OK)

- `https://registry.npmjs.org/-/v1/search?text=…&size=25`
- `https://registry.npmjs.org/<pkg>` for `time.created`
- `https://api.github.com/repos/{owner}/{repo}` for fork/parent (sessionStorage cache; max 8 repos per query; unauth 60/hr)

## Catalog status

Listed on Agent home (`AGENT_SLUGS`) and in `projects.json`.

## Local preview

```bash
cd /workspace/dev.luling.xyz/public
python3 -m http.server 8765
# open http://127.0.0.1:8765/npm-original/?q=tsc-rs
# JSON:  http://127.0.0.1:8765/npm-original/?q=tsc-rs&format=json
```
