@wbern/obscene 1.0.0 → 1.0.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/dist/cli.js +23 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -348,8 +348,29 @@ function getNestingDepths(filePaths) {
348
348
  // src/color.ts
349
349
  import pc from "picocolors";
350
350
  var ANSI_RE = /\x1b\[[0-9;]*m/g;
351
+ function isWide(cp) {
352
+ return (
353
+ // CJK Radicals through Katakana (U+2E80–U+30FF) + CJK Symbols (U+3000–U+303F)
354
+ cp >= 11904 && cp <= 12543 || // Enclosed CJK Letters + CJK Compatibility (U+3200–U+33FF)
355
+ cp >= 12800 && cp <= 13311 || // CJK Extension A (U+3400–U+4DBF) + CJK Unified Ideographs (U+4E00–U+9FFF)
356
+ cp >= 13312 && cp <= 40959 || // Hangul Syllables (U+AC00–U+D7AF)
357
+ cp >= 44032 && cp <= 55215 || // CJK Compatibility Ideographs (U+F900–U+FAFF)
358
+ cp >= 63744 && cp <= 64255 || // Fullwidth Forms (U+FF01–U+FF60, U+FFE0–U+FFE6)
359
+ cp >= 65281 && cp <= 65376 || cp >= 65504 && cp <= 65510 || // Emoji and symbol blocks in supplementary planes (U+1F300–U+1FAFF)
360
+ cp >= 127744 && cp <= 129791 || // CJK Extension B+ and supplementary ideographs (U+20000–U+2FA1F)
361
+ cp >= 131072 && cp <= 195103
362
+ );
363
+ }
351
364
  function visualWidth(s) {
352
- return s.replace(ANSI_RE, "").length;
365
+ const stripped = s.replace(ANSI_RE, "");
366
+ let width = 0;
367
+ for (const ch of stripped) {
368
+ const cp = ch.codePointAt(0);
369
+ if (cp !== void 0) {
370
+ width += isWide(cp) ? 2 : 1;
371
+ }
372
+ }
373
+ return width;
353
374
  }
354
375
  function padRight(s, n) {
355
376
  const w = visualWidth(s);
@@ -572,7 +593,7 @@ function formatCouplingTable(output) {
572
593
 
573
594
  // src/cli.ts
574
595
  var program = new Command();
575
- program.name("obscene").description("Identify hotspot files \u2014 complex code that changes frequently").version("1.0.0");
596
+ program.name("obscene").description("Identify hotspot files \u2014 complex code that changes frequently").version("1.0.1");
576
597
  var REPORT_GUIDE = {
577
598
  complexity: "Cyclomatic complexity (branch/loop count). NOT a quality judgment \u2014 a 500-line parser will naturally score high. Compare density, not raw values.",
578
599
  complexityDensity: "Complexity per line of code. Normalizes for file size. >0.25 suggests dense logic worth reviewing; <0.10 is typical for straightforward code.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wbern/obscene",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Identify hotspot files — complex code that changes frequently. Churn × complexity analysis for any git repo.",
5
5
  "type": "module",
6
6
  "bin": {