feat(04-01): curated KL gazetteer + lazy three-environment loader + GPL/ODbL licensing

- kl-gazetteer.json: 30 hand-curated KL-metro landmarks (10 required + 20
  more) with locals' aliases as native data (D-08) — canonical OSM names
  as name, shorthand ('KLCC', 'DUKE', 'Sg Wang') as aliases — plus the
  ODbL-1.0 attribution header traveling inside the JSON (D-06/D-07)
- gazetteer.ts: the three laws — lazy memoized index never at module
  scope (Workers startup, T-04-04), static JSON import surviving
  wrangler/Vite/bare-Node (D-07), zero logging/storage (D-15); aliases
  normalized once at index-build (D-09 symmetry)
- source.ts: the D-03 SearchSource — async search() + synchronous byId()
  (slug-validated, honest null); tiered admission (fuzzy only at sim
  >= 0.72) so 'Kuching'/'Penang' refuse as [] — never a fabricated pin
- index.ts: the named-export public API (no default, subpath+extension
  imports per the @araharah/theme precedent)
- LICENSE: the verbatim GPL-3.0 text (D-04); LICENSES.md: the dual-licence
  note (code GPL-3.0, data ODbL-1.0 + OSM attribution); README: corrected
  licence section + search/ in the layout, four-package table, commands

G1-G11 + L1-L3 green (39/39); typecheck clean; esbuild bundle carries the
suria-klcc marker; wrangler dry-run exits 0; bot + web suites unaffected.
This commit is contained in:
araharah-executor
2026-10-24 00:36:03 +08:00
parent f1b31ca7ed
commit 8579da9d71
7 changed files with 1188 additions and 6 deletions
+22
View File
@@ -0,0 +1,22 @@
/*
* index.ts — the public API surface of @araharah/search (D-03, D-07).
* -------------------------------------------------------------------
* Named exports ONLY (no default export). The package has NO exports /
* main field (the @araharah/theme precedent), so consumers import the
* EXPLICIT SUBPATH WITH EXTENSION —
* import { createGazetteerSource } from "@araharah/search/src/index.ts";
* (both tsconfigs carry allowImportingTsExtensions + bundler resolution;
* esbuild and Vite compile the .ts source; Node 24 type-stripping handles
* the corpus runner's relative form). A bare "@araharah/search" specifier
* resolves to NOTHING — never use it.
*
* The module reads NO environment, NO secrets, and NO network (D-04/D-15):
* the whole search stack is V8-native and dependency-free (D-07).
*/
export type { GazetteerEntry, SearchQuery, SearchHit, SearchSource } from "./types.ts";
export { normalize } from "./normalize.ts";
export { TIER, FUZZY_ADMIT_SIMILARITY } from "./score.ts";
export { damerau } from "./distance.ts";
export { getEntries, getEntryById, getIndex } from "./gazetteer.ts";
export { createGazetteerSource, search } from "./source.ts";