refactor(8.0): rename HNSWIndex class → JsHnswVectorIndex (scaffold step 3)

Step 3 of the brainy 8.0 rename scaffolding. The class name now matches
its role: the JS HNSW implementation of the VectorIndexProvider contract.
Per planning § 2.3: this is NOT cosmetic — leaving HNSWIndex when the
public contract is VectorIndexProvider creates a confusing read at the
implementation layer.

CHANGES

Repo-wide mechanical rename: HNSWIndex → JsHnswVectorIndex across 52
references in src/ + 5 references in tests/ via sed. Class declaration,
imports, JSDoc, comments, and identifiers all updated.

src/index.ts
- Primary public export: JsHnswVectorIndex (the new name).
- Backwards-compat alias: `export const HNSWIndex = JsHnswVectorIndex`
  with @deprecated note. Removed in the final 8.0 cleanup commit.

NO-OP scope

No behavioural change. The class is exactly the same; only the name
moved. Tests + build green.

VERIFICATION

- npx tsc --noEmit: clean
- npm test: 1468 / 1468 unit
This commit is contained in:
David Snelling 2026-06-09 13:07:56 -07:00
parent 8f87b35614
commit f39d420cb4
11 changed files with 80 additions and 70 deletions

View file

@ -296,10 +296,20 @@ import type {
StorageAdapter
} from './coreTypes.js'
// Export HNSW index
import { HNSWIndex } from './hnsw/hnswIndex.js'
// Export vector index implementation (the JS HNSW path)
import { JsHnswVectorIndex } from './hnsw/hnswIndex.js'
export { HNSWIndex }
export { JsHnswVectorIndex }
/**
* @deprecated Renamed to {@link JsHnswVectorIndex} in Brainy 8.0. The
* implementation is unchanged the new name disambiguates the JS HNSW
* path from any native vector-index provider (DiskANN, etc.) that may be
* loaded via the `'vector'` provider key. This alias is provided as a
* compatibility shim for code mid-migration and is removed in the 8.0
* final cleanup commit.
*/
export const HNSWIndex = JsHnswVectorIndex
export type {
Vector,