namespace-guard 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +14 -0
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -147,6 +147,19 @@ areConfusable("paypal", "pa\u0443pal"); // true
147
147
  confusableDistance("paypal", "pa\u0443pal"); // graded similarity + chainDepth + explainable steps
148
148
  ```
149
149
 
150
+ For measured visual scoring, pass the optional weights from confusable-vision (903 SSIM-scored pairs across 230 fonts). The `context` filter restricts to identifier-valid, domain-valid, or all pairs.
151
+
152
+ ```typescript
153
+ import { confusableDistance } from "namespace-guard";
154
+ import { CONFUSABLE_WEIGHTS } from "namespace-guard/confusable-weights";
155
+
156
+ const result = confusableDistance("paypal", "pa\u0443pal", {
157
+ weights: CONFUSABLE_WEIGHTS,
158
+ context: "identifier",
159
+ });
160
+ // result.similarity, result.steps (including "visual-weight" reason for novel pairs)
161
+ ```
162
+
150
163
  ## Adapter Support
151
164
 
152
165
  - Prisma
@@ -176,6 +189,7 @@ Migration guides per adapter: [docs/reference.md#canonical-uniqueness-migration-
176
189
  - Anti-spoofing pipeline and composability vectors: [docs/reference.md#how-the-anti-spoofing-pipeline-works](docs/reference.md#how-the-anti-spoofing-pipeline-works)
177
190
  - Benchmark corpus (`confusable-bench.v1`): [docs/reference.md#confusable-benchmark-corpus-artifact](docs/reference.md#confusable-benchmark-corpus-artifact)
178
191
  - Advanced primitives (`skeleton`, `areConfusable`, `confusableDistance`): [docs/reference.md#advanced-security-primitives](docs/reference.md#advanced-security-primitives)
192
+ - Confusable weights (SSIM-scored pairs): [docs/reference.md#confusable-weights-subpath](docs/reference.md#confusable-weights-subpath)
179
193
  - CLI reference: [docs/reference.md#cli](docs/reference.md#cli)
180
194
  - API reference: [docs/reference.md#api-reference](docs/reference.md#api-reference)
181
195
  - Framework integration (Next.js/Express/tRPC): [docs/reference.md#framework-integration](docs/reference.md#framework-integration)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "namespace-guard",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Check slug/handle uniqueness across multiple database tables with reserved name protection",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -82,6 +82,7 @@
82
82
  "build:profanity-data": "node scripts/generate-profanity-global.js",
83
83
  "build:composability-data": "node scripts/generate-composability-vectors.js",
84
84
  "build:confusable-bench": "node scripts/generate-confusable-bench.js",
85
+ "build:weights-global": "node scripts/generate-confusable-weights-global.js",
85
86
  "build": "tsup",
86
87
  "test": "vitest run",
87
88
  "test:watch": "vitest",