@mailwoman/locale-gate 4.10.0 → 4.12.0

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 +60 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @mailwoman/locale-gate
2
+
3
+ **Stage 2 of the Mailwoman runtime pipeline** — rule-based locale detection.
4
+
5
+ Derives a `LocaleHint` from the structural fingerprint computed by
6
+ `@mailwoman/query-shape`. Uses only universal cues — script class, postcode
7
+ patterns, known-format hits — never place-name dictionaries. Returns a ranked
8
+ list of candidates so the coordinator can surface disagreement when the
9
+ caller's explicit `--locale` hint differs from what the input shape implies.
10
+
11
+ ```ts
12
+ import { detectLocale } from "@mailwoman/locale-gate"
13
+
14
+ const hint = detectLocale(queryShape, {})
15
+ // hint.primary → "en-US"
16
+ // hint.alternatives → [{tag: "en-GB", confidence: 0.3}, ...]
17
+ // hint.detectorDisagreement → false
18
+ ```
19
+
20
+ ## API
21
+
22
+ ```ts
23
+ detectLocale(shape: QueryShapeLike, opts?: DetectLocaleOpts): LocaleHint
24
+ detectLocaleSync(shape: QueryShapeLike, opts?: DetectLocaleOpts): LocaleHint
25
+
26
+ // Individual scorers (for custom composition)
27
+ scoreByScript(shape: QueryShapeLike): LocaleCandidate[]
28
+ scoreByPostcode(shape: QueryShapeLike): LocaleCandidate[]
29
+ scoreFallback(shape: QueryShapeLike): LocaleCandidate[]
30
+ ```
31
+
32
+ ## Pipeline position
33
+
34
+ ```
35
+ query-shape → locale-gate → kind-classifier → phrase-grouper → classifier → ...
36
+ ```
37
+
38
+ Stage 2 in the [Staged Pipeline Contract](https://mailwoman.sister.software/articles/plan/reference/STAGES/).
39
+
40
+ ## Design
41
+
42
+ - **Rule-based v1.** The locale gate scores candidate locales by composing
43
+ deterministic rules over the `QueryShape`. A trained character-level model
44
+ is deferred to a future release.
45
+ - **Bitter-lesson-safe:** script class, postcode regex patterns, known-format
46
+ hits. No place-name memorization.
47
+ - **Surfaces disagreement.** When the caller passes an explicit `--locale`
48
+ hint and the gate disagrees, the hint carries `detectorDisagreement: true`
49
+ so the coordinator can decide.
50
+
51
+ ## Related
52
+
53
+ - [`@mailwoman/query-shape`](../query-shape) — feeds `QueryShape` into this stage
54
+ - [`@mailwoman/kind-classifier`](../kind-classifier) — Stage 2.5, also consumes `QueryShape`
55
+ - [`@mailwoman/core`](../core) — `LocaleTag` type and pipeline infrastructure
56
+ - [Staged Pipeline Contract](https://mailwoman.sister.software/articles/plan/reference/STAGES/)
57
+
58
+ ## License
59
+
60
+ [AGPL-3.0-only](https://www.gnu.org/licenses/agpl-3.0.html)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/locale-gate",
3
- "version": "4.10.0",
3
+ "version": "4.12.0",
4
4
  "description": "Stage 2 of the runtime pipeline — derive a LocaleHint from QueryShape (script + known-format hits). Rule-based v1; trained classifier deferred to v0.6.0.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  ".": "./out/index.js"
15
15
  },
16
16
  "dependencies": {
17
- "@mailwoman/core": "4.10.0"
17
+ "@mailwoman/core": "4.12.0"
18
18
  },
19
19
  "files": [
20
20
  "out/**/*.js",