@dev-pi2pie/word-counter 0.1.5-canary.4 → 0.1.5-canary.5

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.
package/README.md CHANGED
@@ -4,7 +4,7 @@ Locale-aware word counting powered by the Web API [`Intl.Segmenter`](https://dev
4
4
 
5
5
  ## Quick Start (npx)
6
6
 
7
- Runtime requirement: Node.js `>=20`.
7
+ Runtime requirement: Node.js `>=22.18.0`.
8
8
 
9
9
  Run without installing:
10
10
 
@@ -110,7 +110,7 @@ Inspect detector behavior without count output:
110
110
 
111
111
  ```bash
112
112
  word-counter inspect "こんにちは、世界!これはテストです。"
113
- word-counter inspect --view engine "This sentence should clearly be detected as English for the wasm detector path."
113
+ word-counter inspect --detector wasm --view engine "This sentence should clearly be detected as English for the wasm detector path."
114
114
  word-counter inspect --detector regex -f json "こんにちは、世界!これはテストです。"
115
115
  word-counter inspect --detector regex -f json --pretty "こんにちは、世界!これはテストです。"
116
116
  word-counter inspect --detector wasm --content-gate off "mode: debug\ntee: true\npath: logs\nUse this for testing."
@@ -157,6 +157,57 @@ Detector mode notes:
157
157
  - no inspect `--per-file`
158
158
  - no inspect `--jobs`
159
159
 
160
+ ### Config Files
161
+
162
+ `word-counter` supports config files in these canonical names:
163
+
164
+ - `wc-intl-seg.config.toml`
165
+ - `wc-intl-seg.config.json`
166
+ - `wc-intl-seg.config.jsonc`
167
+
168
+ Config precedence is:
169
+
170
+ ```text
171
+ built-in defaults
172
+ < user config dir / wc-intl-seg.config.{toml|jsonc|json}
173
+ < cwd / wc-intl-seg.config.{toml|jsonc|json}
174
+ < environment variables
175
+ < flag options
176
+ ```
177
+
178
+ Same-scope file priority is `toml > jsonc > json`.
179
+ If lower-priority sibling config files are ignored, the CLI emits a warning.
180
+
181
+ Detector config notes:
182
+
183
+ - counting defaults to `regex`
184
+ - `inspect` also defaults to `regex`
185
+ - root `detector` controls normal counting
186
+ - optional `inspect.detector` overrides inspect-only behavior
187
+ - root `contentGate.mode` controls detector-policy defaults for counting
188
+ - optional `inspect.contentGate.mode` overrides inspect-only detector-policy behavior
189
+ - `WORD_COUNTER_CONTENT_GATE` overrides config-derived content-gate defaults
190
+ - `--content-gate` stays the highest-precedence detector-policy override
191
+ - `inspect --detector` only affects the current inspect invocation
192
+
193
+ Examples:
194
+
195
+ ```bash
196
+ word-counter -d wasm "This sentence should clearly be detected as English for the wasm detector path."
197
+ word-counter --content-gate strict "Internationalization documentation remains understandable."
198
+ word-counter inspect -d regex -f json "こんにちは、世界!これはテストです。"
199
+ word-counter inspect --content-gate off "mode: debug\ntee: true\npath: logs\nUse this for testing."
200
+ word-counter --path ./examples/test-case-multi-files-support --format json
201
+ ```
202
+
203
+ Default-reference config examples live under:
204
+
205
+ - `examples/wc-config/wc-intl-seg.config.toml`
206
+ - `examples/wc-config/wc-intl-seg.config.json`
207
+ - `examples/wc-config/wc-intl-seg.config.jsonc`
208
+
209
+ For full config behavior, platform-specific user config locations, merge rules, and examples, see [`docs/config-usage-guide.md`](docs/config-usage-guide.md).
210
+
160
211
  ### Detector Subpath (`@dev-pi2pie/word-counter/detector`)
161
212
 
162
213
  Use the detector subpath when you need async detector-aware APIs directly in library code.
@@ -216,6 +267,7 @@ Directory scans are recursive by default:
216
267
 
217
268
  ```bash
218
269
  word-counter --path ./examples/test-case-multi-files-support
270
+ word-counter --path ./examples/test-case-multi-files-support --recursive
219
271
  word-counter --path ./examples/test-case-multi-files-support --no-recursive
220
272
  ```
221
273
 
@@ -229,6 +281,7 @@ Progress behavior in standard batch mode:
229
281
 
230
282
  ```bash
231
283
  word-counter --path ./examples/test-case-multi-files-support
284
+ word-counter --path ./examples/test-case-multi-files-support --progress
232
285
  word-counter --path ./examples/test-case-multi-files-support --no-progress
233
286
  word-counter --path ./examples/test-case-multi-files-support --keep-progress
234
287
  ```
@@ -250,7 +303,7 @@ Quick policy:
250
303
  - `--jobs 1`: async main-thread `load+count` baseline.
251
304
  - `--jobs > 1`: worker `load+count` with async fallback when workers are unavailable.
252
305
  - if requested `--jobs` exceeds host `suggestedMaxJobs` (from `--print-jobs-limit`), the CLI warns and runs with the suggested limit as a safety cap.
253
- - use `--quiet-warnings` to suppress non-fatal warning lines (for example jobs-limit advisory and worker-fallback warning).
306
+ - use `--quiet-warnings` to suppress non-fatal warning lines (for example config discovery notes, jobs-limit advisory, and worker-fallback warning).
254
307
 
255
308
  Inspect host jobs diagnostics:
256
309
 
@@ -272,7 +325,7 @@ word-counter doctor --format json --pretty
272
325
 
273
326
  Doctor scope in v1:
274
327
 
275
- - checks runtime support policy against Node.js `>=20`
328
+ - checks runtime support policy against Node.js `>=22.18.0`
276
329
  - verifies `Intl.Segmenter` availability plus word/grapheme constructor health
277
330
  - reports batch jobs host limits using the same heuristics as `--print-jobs-limit`
278
331
  - reports worker-route preflight signals and the worker-disable env toggle that affects worker availability
@@ -292,7 +345,9 @@ For full policy details, JSON parity expectations (`--misc`, `--total-of whitesp
292
345
  ### Stable Path Resolution Contract
293
346
 
294
347
  - Repeated `--path` values are accepted as mixed inputs (file + directory).
295
- - In `--path-mode auto` (default), directory inputs are expanded to files (recursive unless `--no-recursive`).
348
+ - In `--path-mode auto` (default), directory inputs are expanded to files.
349
+ `--recursive` explicitly enables recursive traversal and overrides non-recursive config/env defaults.
350
+ `--no-recursive` explicitly disables recursive traversal for the current invocation.
296
351
  - In `--path-mode manual`, `--path` values are treated as literal file inputs; `--path <dir>` is not supported and is skipped as `not a regular file`.
297
352
  - Extension and regex filters apply only to files discovered from directory expansion.
298
353
  - Direct file inputs are always considered regardless of `--include-ext` / `--exclude-ext` / `--regex`.