The NEIS compatibility path was treating mark-only graphemes as Hangul,
and the CLI accepted repeated input flags by silently overwriting earlier
values. Tighten the Hangul branch to require an actual Hangul-script code
point and reject any second input-source flag, then lock both fixes with
helper and CLI regressions.
Constraint: Must preserve the published default and NEIS counting contracts without new dependencies
Rejected: Doc-only clarification | would leave the shipped behavior incorrect
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep the NEIS 3-byte branch limited to graphemes that actually contain Hangul script code points
Tested: node --test scripts/skill-docs.test.js scripts/test_korean_character_count.js; node scripts/korean_character_count.js --text '가나다' --format json; node scripts/korean_character_count.js --file <tmpfile> --profile neis --format text; printf '한\r\n나' | node scripts/korean_character_count.js --stdin --format json; mark-only NEIS and duplicate-input repros; npm test; npm run ci
Not-tested: repeated --stdin as a separate committed regression case
Issue #65 needs deterministic Korean character, line, and byte counting for self-intros and similar forms, so this adds a bundled helper plus skill/docs/tests around a fixed grapheme/UTF-8 contract with an explicit NEIS compatibility profile.
Constraint: Must avoid LLM estimation and keep results deterministic across repeated runs
Constraint: No new dependencies; rely on Node 18+ Intl.Segmenter and Buffer.byteLength
Rejected: Per-request ad hoc scripts only | contract drift would make repeated counts inconsistent
Rejected: Legacy encoding heuristics as the default | modern UTF-8 contract is safer unless the target explicitly says otherwise
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep and profile semantics in sync with docs/tests before changing counting rules
Tested: node --test scripts/skill-docs.test.js scripts/test_korean_character_count.js; helper smoke via text/file/stdin; npm test; npm run ci; LSP diagnostics on changed JS files
Not-tested: Proprietary site-specific counters beyond the documented default/NEIS contracts