@macrulez/devtoolz 0.1.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 (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +262 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +330 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/case-check/core.d.ts +17 -0
  7. package/dist/commands/case-check/core.js +46 -0
  8. package/dist/commands/case-check/core.js.map +1 -0
  9. package/dist/commands/case-check/parse.d.ts +10 -0
  10. package/dist/commands/case-check/parse.js +52 -0
  11. package/dist/commands/case-check/parse.js.map +1 -0
  12. package/dist/commands/case-check/report.d.ts +3 -0
  13. package/dist/commands/case-check/report.js +38 -0
  14. package/dist/commands/case-check/report.js.map +1 -0
  15. package/dist/commands/case-check/resolve-case.d.ts +14 -0
  16. package/dist/commands/case-check/resolve-case.js +163 -0
  17. package/dist/commands/case-check/resolve-case.js.map +1 -0
  18. package/dist/commands/case-check/run.d.ts +31 -0
  19. package/dist/commands/case-check/run.js +72 -0
  20. package/dist/commands/case-check/run.js.map +1 -0
  21. package/dist/commands/case-check/tsconfig-paths.d.ts +19 -0
  22. package/dist/commands/case-check/tsconfig-paths.js +119 -0
  23. package/dist/commands/case-check/tsconfig-paths.js.map +1 -0
  24. package/dist/commands/case-check/vue.d.ts +8 -0
  25. package/dist/commands/case-check/vue.js +26 -0
  26. package/dist/commands/case-check/vue.js.map +1 -0
  27. package/dist/commands/console-strip/core.d.ts +23 -0
  28. package/dist/commands/console-strip/core.js +104 -0
  29. package/dist/commands/console-strip/core.js.map +1 -0
  30. package/dist/commands/console-strip/report.d.ts +3 -0
  31. package/dist/commands/console-strip/report.js +47 -0
  32. package/dist/commands/console-strip/report.js.map +1 -0
  33. package/dist/commands/console-strip/run.d.ts +30 -0
  34. package/dist/commands/console-strip/run.js +55 -0
  35. package/dist/commands/console-strip/run.js.map +1 -0
  36. package/dist/commands/console-strip/vue.d.ts +8 -0
  37. package/dist/commands/console-strip/vue.js +28 -0
  38. package/dist/commands/console-strip/vue.js.map +1 -0
  39. package/dist/commands/dead-exports/core.d.ts +19 -0
  40. package/dist/commands/dead-exports/core.js +136 -0
  41. package/dist/commands/dead-exports/core.js.map +1 -0
  42. package/dist/commands/dead-exports/entry.d.ts +2 -0
  43. package/dist/commands/dead-exports/entry.js +93 -0
  44. package/dist/commands/dead-exports/entry.js.map +1 -0
  45. package/dist/commands/dead-exports/parse.d.ts +30 -0
  46. package/dist/commands/dead-exports/parse.js +174 -0
  47. package/dist/commands/dead-exports/parse.js.map +1 -0
  48. package/dist/commands/dead-exports/report.d.ts +3 -0
  49. package/dist/commands/dead-exports/report.js +27 -0
  50. package/dist/commands/dead-exports/report.js.map +1 -0
  51. package/dist/commands/dead-exports/resolve.d.ts +10 -0
  52. package/dist/commands/dead-exports/resolve.js +58 -0
  53. package/dist/commands/dead-exports/resolve.js.map +1 -0
  54. package/dist/commands/dead-exports/run.d.ts +21 -0
  55. package/dist/commands/dead-exports/run.js +51 -0
  56. package/dist/commands/dead-exports/run.js.map +1 -0
  57. package/dist/commands/dead-exports/workspace.d.ts +14 -0
  58. package/dist/commands/dead-exports/workspace.js +99 -0
  59. package/dist/commands/dead-exports/workspace.js.map +1 -0
  60. package/dist/commands/exports-doctor/core.d.ts +13 -0
  61. package/dist/commands/exports-doctor/core.js +85 -0
  62. package/dist/commands/exports-doctor/core.js.map +1 -0
  63. package/dist/commands/exports-doctor/parse.d.ts +20 -0
  64. package/dist/commands/exports-doctor/parse.js +80 -0
  65. package/dist/commands/exports-doctor/parse.js.map +1 -0
  66. package/dist/commands/exports-doctor/report.d.ts +3 -0
  67. package/dist/commands/exports-doctor/report.js +36 -0
  68. package/dist/commands/exports-doctor/report.js.map +1 -0
  69. package/dist/commands/exports-doctor/resolve-path.d.ts +10 -0
  70. package/dist/commands/exports-doctor/resolve-path.js +46 -0
  71. package/dist/commands/exports-doctor/resolve-path.js.map +1 -0
  72. package/dist/commands/exports-doctor/run.d.ts +13 -0
  73. package/dist/commands/exports-doctor/run.js +25 -0
  74. package/dist/commands/exports-doctor/run.js.map +1 -0
  75. package/dist/commands/readme-check/core.d.ts +22 -0
  76. package/dist/commands/readme-check/core.js +92 -0
  77. package/dist/commands/readme-check/core.js.map +1 -0
  78. package/dist/commands/readme-check/extract.d.ts +9 -0
  79. package/dist/commands/readme-check/extract.js +48 -0
  80. package/dist/commands/readme-check/extract.js.map +1 -0
  81. package/dist/commands/readme-check/lang.d.ts +8 -0
  82. package/dist/commands/readme-check/lang.js +21 -0
  83. package/dist/commands/readme-check/lang.js.map +1 -0
  84. package/dist/commands/readme-check/report.d.ts +3 -0
  85. package/dist/commands/readme-check/report.js +31 -0
  86. package/dist/commands/readme-check/report.js.map +1 -0
  87. package/dist/commands/readme-check/run.d.ts +19 -0
  88. package/dist/commands/readme-check/run.js +34 -0
  89. package/dist/commands/readme-check/run.js.map +1 -0
  90. package/dist/commands/readme-check/tsconfig.d.ts +9 -0
  91. package/dist/commands/readme-check/tsconfig.js +26 -0
  92. package/dist/commands/readme-check/tsconfig.js.map +1 -0
  93. package/dist/commands/readme-check/typecheck.d.ts +31 -0
  94. package/dist/commands/readme-check/typecheck.js +82 -0
  95. package/dist/commands/readme-check/typecheck.js.map +1 -0
  96. package/dist/commands/strip-comments/apply-deletions.d.ts +17 -0
  97. package/dist/commands/strip-comments/apply-deletions.js +74 -0
  98. package/dist/commands/strip-comments/apply-deletions.js.map +1 -0
  99. package/dist/commands/strip-comments/core.d.ts +15 -0
  100. package/dist/commands/strip-comments/core.js +111 -0
  101. package/dist/commands/strip-comments/core.js.map +1 -0
  102. package/dist/commands/strip-comments/report.d.ts +6 -0
  103. package/dist/commands/strip-comments/report.js +30 -0
  104. package/dist/commands/strip-comments/report.js.map +1 -0
  105. package/dist/commands/strip-comments/run.d.ts +28 -0
  106. package/dist/commands/strip-comments/run.js +50 -0
  107. package/dist/commands/strip-comments/run.js.map +1 -0
  108. package/dist/commands/strip-comments/vue.d.ts +6 -0
  109. package/dist/commands/strip-comments/vue.js +65 -0
  110. package/dist/commands/strip-comments/vue.js.map +1 -0
  111. package/dist/format/colors.d.ts +8 -0
  112. package/dist/format/colors.js +14 -0
  113. package/dist/format/colors.js.map +1 -0
  114. package/dist/format/diff-render.d.ts +2 -0
  115. package/dist/format/diff-render.js +35 -0
  116. package/dist/format/diff-render.js.map +1 -0
  117. package/dist/format/file-list.d.ts +14 -0
  118. package/dist/format/file-list.js +26 -0
  119. package/dist/format/file-list.js.map +1 -0
  120. package/dist/format/findings-list.d.ts +14 -0
  121. package/dist/format/findings-list.js +23 -0
  122. package/dist/format/findings-list.js.map +1 -0
  123. package/dist/format/vibes.d.ts +10 -0
  124. package/dist/format/vibes.js +67 -0
  125. package/dist/format/vibes.js.map +1 -0
  126. package/dist/index.d.ts +47 -0
  127. package/dist/index.js +29 -0
  128. package/dist/index.js.map +1 -0
  129. package/dist/utils/diff.d.ts +1 -0
  130. package/dist/utils/diff.js +13 -0
  131. package/dist/utils/diff.js.map +1 -0
  132. package/dist/utils/walk.d.ts +19 -0
  133. package/dist/utils/walk.js +96 -0
  134. package/dist/utils/walk.js.map +1 -0
  135. package/package.json +57 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Danil Lisin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,262 @@
1
+ # **DevToolz**
2
+
3
+ ![DevToolz](https://github.com/macrulezru/assets/blob/master/packages-images/devtoolz.webp?raw=true)
4
+
5
+ A small toolbox of CLI commands that automate routine dev chores — the
6
+ kind of thing you'd otherwise do with a half-remembered regex or by hand,
7
+ right before a commit. One binary, one subcommand per chore, each safe by
8
+ default (preview first, `-y` to actually write anything).
9
+
10
+ Real AST parsing where it matters, not naive regex — a string, template
11
+ literal, or regex literal that happens to _contain_ the text a command is
12
+ looking for is never touched.
13
+
14
+ ## Features
15
+
16
+ - **`strip-comments`** — removes `//`, `/* */`, `/** */`, and `<!-- -->`
17
+ comments from source files in place. `--keep-jsdoc` leaves a `/** */`
18
+ directly above an exported declaration alone (so exported types/props
19
+ keep their IDE tooltips); everything else goes. Handles `.vue` files —
20
+ the `<script>` block through the same parser, `<!-- -->` in `<template>`
21
+ through a line-aware scan.
22
+ - **`console-strip`** — removes `console.log`/`console.debug`/`debugger`
23
+ statements left in by mistake. `console.warn`/`console.error` are
24
+ deliberately _not_ touched by default — often legitimate production
25
+ logging, not debug leftovers (`--methods` overrides the list). Only
26
+ ever deletes a call that's a whole statement on its own — one that's
27
+ part of a larger expression (`const r = console.log(x) || y`) or sits
28
+ inside a brace-less `if`/`while`/`for` body is left alone and reported
29
+ separately, never guessed at.
30
+ - **`dead-exports`** — finds named exports nothing in the project
31
+ imports. Aware of what "dead" actually means for a published library:
32
+ a package's own public entry points (auto-detected from
33
+ `package.json`'s `exports`/`main`/`module`/`bin`) are exempt by default
34
+ — being unused _inside the repo_ isn't the same as being unused,
35
+ that's the whole point of exporting it. Traces re-export chains
36
+ (`export { x } from './y'`, `export * from './y'`) back to where a
37
+ symbol is really declared, and auto-detects a pnpm/npm/yarn workspace
38
+ so a sibling package importing your export doesn't read as dead either.
39
+ `--strict` checks the entry points too, for when you actually want that.
40
+ - **`case-check`** — finds imports whose case doesn't match the real
41
+ file on disk. Windows and macOS are case-insensitive by default, so
42
+ `import './foo'` against a real `Foo.ts` works fine right up until it
43
+ hits Linux CI. Checks every path segment, not just the file name;
44
+ resolves `tsconfig.json` path aliases (`@/...`) too. `--fix` rewrites
45
+ the mismatched specifier to its real case (alias-resolved ones excluded
46
+ — see `--help`).
47
+ - **`exports-doctor`** — resolves every path `package.json` declares
48
+ (`main`/`module`/`types`/`typings`/`bin`/`exports`, including nested
49
+ condition objects, subpath maps, and fallback arrays) against what's
50
+ actually on disk. Catches a file that doesn't exist, one that exists
51
+ under a different case, a `bin` entry missing its `#!/usr/bin/env node`
52
+ shebang, and — the sneaky one — a subpath whose runtime conditions
53
+ resolve fine but that never declares `types` at all anywhere under it,
54
+ so a TypeScript consumer silently gets no types with no error anywhere.
55
+ - **`readme-check`** — extracts fenced `ts` code blocks from README/docs
56
+ and actually typechecks them with the TypeScript Compiler API against
57
+ the package's own `tsconfig.json` — never executes anything, only
58
+ compiles. The virtual file lives at the package root, so both relative
59
+ imports and a self-referencing import of the package's own published
60
+ name (`import { x } from 'my-package'`) resolve exactly as they would
61
+ for a real consumer. Each block is checked independently; "Cannot find
62
+ name" from a block that assumes context set up elsewhere in the doc,
63
+ and a handful of other structurally-unreliable diagnostic codes, are
64
+ dropped rather than reported as noise (see `--help`/features.md for
65
+ exactly which). `--lang` opts into `tsx`/`js`/`jsx` (default: `ts`
66
+ only — `tsx` needs the package to actually configure JSX itself).
67
+
68
+ `strip-comments`, `console-strip`, and `case-check` share the same safety
69
+ model: `--dry-run` (or just running with neither `--dry-run` nor `-y`)
70
+ only previews, `-y`/`--yes` is required to actually write anything,
71
+ `--diff` shows a real unified diff per file. `dead-exports` is read-only,
72
+ it never writes anything — there's nothing to preview. Every command
73
+ supports `--json` for machine-readable output.
74
+
75
+ ## Tone
76
+
77
+ Not dead silent, not relentlessly jokey either — a small banner and some
78
+ personality when everything comes back clean, nothing cute mixed into the
79
+ actual findings list, which stays in aligned, colored columns (file in
80
+ white, count/tag in dim grey) for quick scanning. Auto-disables (banner,
81
+ color, celebration copy) the moment output isn't a real interactive
82
+ terminal — piped, `CI` set, `NO_COLOR` set — on top of the explicit
83
+ `--quiet`/`--plain` flags.
84
+
85
+ ## Requirements
86
+
87
+ - Node.js 20+
88
+
89
+ ## Installation
90
+
91
+ ```bash
92
+ npm install -g @macrulez/devtoolz
93
+ ```
94
+
95
+ Or run it without installing:
96
+
97
+ ```bash
98
+ npx @macrulez/devtoolz strip-comments src --dry-run
99
+ ```
100
+
101
+ ## Quick start
102
+
103
+ ```bash
104
+ devtoolz strip-comments src --dry-run --diff # preview, see exactly what would change
105
+ devtoolz strip-comments src -y # actually strip
106
+
107
+ devtoolz console-strip src --dry-run # same idea, for console.log/debugger
108
+ devtoolz console-strip src -y
109
+
110
+ devtoolz dead-exports src # report-only, nothing to apply
111
+
112
+ devtoolz case-check src --fix --diff --dry-run # preview a case fix
113
+ devtoolz case-check src --fix -y # apply it
114
+
115
+ devtoolz exports-doctor # check package.json in the current directory
116
+ devtoolz exports-doctor path/to/package # or a specific package directory
117
+
118
+ devtoolz readme-check # typecheck ts blocks in ./README.md
119
+ devtoolz readme-check --file docs/guide.md # check another doc instead/as well
120
+ ```
121
+
122
+ Every command has built-in `--help` — `devtoolz --help` lists every
123
+ command with its own flags inline (plus a "Common options" block for the
124
+ handful genuinely shared by every command); `devtoolz <command> --help`
125
+ for one command's full flag list with defaults.
126
+
127
+ ## Example output
128
+
129
+ `devtoolz console-strip src --dry-run --diff` against a file with a mix of
130
+ cases:
131
+
132
+ ```
133
+ 🧰 devtoolz, reporting for duty
134
+
135
+ Scanned 1 file.
136
+
137
+ Would strip console/debugger statements in 1 file(s):
138
+ src/example.ts 3 statements
139
+
140
+ (nothing written — pass -y to apply, or --dry-run to keep previewing)
141
+
142
+ ── src/example.ts (3 statements) ─────────────────────────────────────
143
+ @@ -1,13 +1,7 @@
144
+ const s = 'console.log(fooled ya)'
145
+ -console.log('leftover debug')
146
+ function f(x) {
147
+ if (x) console.log('braceless, left alone')
148
+ const r = console.log(x) || 42
149
+ console.warn('kept by default')
150
+ - debugger
151
+ return x
152
+ }
153
+ -console.log(
154
+ - 'multi',
155
+ - 'line',
156
+ -)
157
+
158
+ 2 left in place, needs a manual look:
159
+ - src/example.ts:4:10 — inside a single-statement body without braces — console.log('braceless, left alone')
160
+ - src/example.ts:5:13 — part of a larger expression, not its own statement — console.log(x)
161
+ ```
162
+
163
+ Note what _didn't_ change: the string literal that happens to contain the
164
+ text `console.log(`, and `console.warn` (not in the default method list).
165
+
166
+ `devtoolz dead-exports src` against a small package:
167
+
168
+ ```
169
+ 🧰 devtoolz, reporting for duty
170
+
171
+ Scanned 3 files.
172
+
173
+ 2 dead exports found:
174
+ src/helpers.ts:1 unusedHelper
175
+ src/types.ts:1 Options (type)
176
+ ```
177
+
178
+ `devtoolz case-check src --fix --diff --dry-run` after a file got renamed
179
+ `Helper.ts` → `helper.ts` on someone's Mac, with the import never updated:
180
+
181
+ ```
182
+ 🧰 devtoolz — chores, automated
183
+
184
+ Scanned 2 files.
185
+
186
+ 1 case mismatch found:
187
+ src/main.ts:1:23 ./helper.js → ./Helper.js
188
+
189
+ Would fix 1 import(s) in 1 file(s) — pass -y to apply.
190
+
191
+ ── src/main.ts (1 import) ────────────────────────────────────────────
192
+ @@ -1,2 +1,2 @@
193
+ -import { greet } from './helper.js'
194
+ +import { greet } from './Helper.js'
195
+ console.log(greet())
196
+ ```
197
+
198
+ `devtoolz exports-doctor` against a package whose `./cdn` subpath has an
199
+ `import` condition but nobody ever added a `types` one (the exact bug
200
+ class this was built to catch — a build that "works" while TypeScript
201
+ consumers get nothing):
202
+
203
+ ```
204
+ 🧰 devtoolz — chores, automated
205
+
206
+ Checked demo-pkg's declared exports.
207
+
208
+ 1 problem found:
209
+ exports["./cdn"] ./dist/cdn/index.js runtime resolves fine, but no types declared for this entry at all
210
+ ```
211
+
212
+ `devtoolz readme-check` against a README whose example doesn't actually
213
+ match the package's own types:
214
+
215
+ ```
216
+ 🧰 devtoolz
217
+
218
+ Typechecked 1 code block across 1 file.
219
+
220
+ 1 problem found:
221
+ README.md:6:7 ts Type 'string' is not assignable to type 'number'.
222
+ ```
223
+
224
+ ## Development
225
+
226
+ ```bash
227
+ npm install
228
+ npm run build # tsc -> dist/
229
+ npm test # vitest
230
+ npm run lint # eslint .
231
+ npm run format # prettier --check .
232
+ npm run typecheck # tsc --noEmit
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Documentation & links
238
+
239
+ - 📖 **Full documentation:** [npm.vuecraft.ru/en/packages/devtoolz](https://npm.vuecraft.ru/en/packages/devtoolz/guide/overview.html)
240
+ - 🌐 **VueCraft:** [vuecraft.ru/en](https://vuecraft.ru/en)
241
+ - 👤 **Author:** [macrulez.ru/en](https://macrulez.ru/en)
242
+ - 💻 **GitHub:** [macrulezru/devtoolz](https://github.com/macrulezru/devtoolz)
243
+ - 📦 **NPM:** [@macrulez/devtoolz](https://www.npmjs.com/package/@macrulez/devtoolz)
244
+ - 🐛 **Issues:** [github.com/macrulezru/devtoolz/issues](https://github.com/macrulezru/devtoolz/issues)
245
+
246
+ ---
247
+
248
+ ## License
249
+
250
+ MIT
251
+
252
+ ---
253
+
254
+ ## 💖 Support the project
255
+
256
+ Open source takes time and effort. If this library saves you time or brings value, consider supporting further development.
257
+
258
+ <a href="https://donate.cryptocloud.plus/M6O34NIN" target="_blank">
259
+ <img src="https://img.shields.io/badge/Donate-CryptoCloud-8A2BE2?style=for-the-badge&logo=cryptocurrency&logoColor=white" alt="Donate via CryptoCloud">
260
+ </a>
261
+
262
+ Thank you for being part of this journey. ❤️
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,330 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { resolve } from 'node:path';
4
+ import { runStripComments } from './commands/strip-comments/run.js';
5
+ import { renderStripCommentsReport } from './commands/strip-comments/report.js';
6
+ import { runConsoleStrip } from './commands/console-strip/run.js';
7
+ import { renderConsoleStripReport } from './commands/console-strip/report.js';
8
+ import { runDeadExports } from './commands/dead-exports/run.js';
9
+ import { renderDeadExportsReport } from './commands/dead-exports/report.js';
10
+ import { runCaseCheck } from './commands/case-check/run.js';
11
+ import { renderCaseCheckReport } from './commands/case-check/report.js';
12
+ import { runExportsDoctor } from './commands/exports-doctor/run.js';
13
+ import { renderExportsDoctorReport } from './commands/exports-doctor/report.js';
14
+ import { runReadmeCheck } from './commands/readme-check/run.js';
15
+ import { renderReadmeCheckReport } from './commands/readme-check/report.js';
16
+ function wrapText(text, width) {
17
+ const words = text.split(' ');
18
+ const lines = [];
19
+ let current = '';
20
+ for (const word of words) {
21
+ const candidate = current ? `${current} ${word}` : word;
22
+ if (current && candidate.length > width) {
23
+ lines.push(current);
24
+ current = word;
25
+ }
26
+ else {
27
+ current = candidate;
28
+ }
29
+ }
30
+ if (current)
31
+ lines.push(current);
32
+ return lines;
33
+ }
34
+ /**
35
+ * Commander's own one-line-per-command "Commands:" list puts a command's
36
+ * own flags inline after its name (`strip-comments [options]`) and leaves
37
+ * their descriptions for a separate `<command> --help` run — fine for a
38
+ * CLI with one or two flags per command, but it means the top-level
39
+ * `--help` never actually shows what any flag does. This builds a
40
+ * two-level list instead (command, then each of its own options indented
41
+ * below it with its own description), used in place of commander's
42
+ * default via `configureHelp({ visibleCommands: () => [] })` +
43
+ * `addHelpText('after')` — same technique as lintsync's/polyrepo-cli's
44
+ * own `formatCommandsHelp`.
45
+ *
46
+ * A flag present on EVERY command, with the exact same `flags` string and
47
+ * description (not just the same name coincidentally meaning something
48
+ * slightly different per command), is pulled out into a "Common options"
49
+ * block instead of being repeated under each one. A flag shared by only
50
+ * SOME commands stays listed under each of those commands directly —
51
+ * tried hoisting those into their own labeled sub-group too, but it's
52
+ * harder to keep in your head which commands a "Common options (a, b)"
53
+ * block actually applies to than to just see the flag where it's used.
54
+ * This only changes how the help text is RENDERED — every flag is still
55
+ * fully declared on its own command for real parsing, so
56
+ * `devtoolz <command> --cwd x` keeps working exactly as before; nothing
57
+ * here is a true commander-level global option.
58
+ */
59
+ function formatCommandsHelp(commands) {
60
+ const real = commands.filter((cmd) => cmd.name() !== 'help');
61
+ // Which commands (by name) share the exact same flags+description for
62
+ // a given option, keyed on that pair so two different flags spelled
63
+ // the same but described differently never get merged.
64
+ const owners = new Map();
65
+ for (const cmd of real) {
66
+ for (const opt of cmd.options) {
67
+ const key = `${opt.flags}\u0000${opt.description}`;
68
+ const entry = owners.get(key) ?? { flags: opt.flags, desc: opt.description, commandCount: 0 };
69
+ entry.commandCount++;
70
+ owners.set(key, entry);
71
+ }
72
+ }
73
+ const universalRows = [];
74
+ const hoistedKeys = new Set();
75
+ for (const [key, entry] of owners) {
76
+ if (entry.commandCount !== real.length)
77
+ continue; // not on every command — stays with each one below
78
+ universalRows.push({ indent: 1, label: entry.flags, desc: entry.desc });
79
+ hoistedKeys.add(key);
80
+ }
81
+ const commandGroups = real.map((cmd) => {
82
+ const aliases = cmd.aliases();
83
+ const label = aliases.length > 0 ? `${cmd.name()}, ${aliases.join(', ')}` : cmd.name();
84
+ const ownRows = cmd.options
85
+ .filter((opt) => !hoistedKeys.has(`${opt.flags}\u0000${opt.description}`))
86
+ .map((opt) => ({ indent: 1, label: opt.flags, desc: opt.description }));
87
+ return [{ indent: 0, label, desc: cmd.description() }, ...ownRows];
88
+ });
89
+ const allRows = [universalRows, ...commandGroups].flat();
90
+ const labelWidth = Math.max(...allRows.map((r) => r.indent * 4 + r.label.length));
91
+ const totalWidth = (process.stdout.isTTY && process.stdout.columns) || 96;
92
+ const descWidth = Math.max(totalWidth - (2 + labelWidth + 2), 30);
93
+ function renderRow(row, lines) {
94
+ const fullLabel = ' '.repeat(row.indent * 4) + row.label;
95
+ const [firstLine, ...restLines] = wrapText(row.desc, descWidth);
96
+ lines.push(` ${fullLabel.padEnd(labelWidth)} ${firstLine ?? ''}`);
97
+ for (const cont of restLines) {
98
+ lines.push(` ${' '.repeat(labelWidth)} ${cont}`);
99
+ }
100
+ }
101
+ const lines = [];
102
+ if (universalRows.length > 0) {
103
+ lines.push('Common options (all commands):');
104
+ for (const row of universalRows)
105
+ renderRow(row, lines);
106
+ lines.push('');
107
+ }
108
+ lines.push('Commands:');
109
+ commandGroups.forEach((group, i) => {
110
+ if (i > 0)
111
+ lines.push('');
112
+ for (const row of group)
113
+ renderRow(row, lines);
114
+ });
115
+ return lines.join('\n');
116
+ }
117
+ const program = new Command();
118
+ program
119
+ .name('devtoolz')
120
+ .description('A small toolbox of CLI commands that automate routine dev chores')
121
+ // Hide commander's own one-line-per-command list (see formatCommandsHelp
122
+ // above for why) — the "after" text below replaces it with the
123
+ // two-level version instead of showing both.
124
+ .configureHelp({ visibleCommands: () => [] })
125
+ .addHelpText('after', () => `\n${formatCommandsHelp(program.commands)}`);
126
+ program
127
+ .command('strip-comments')
128
+ .description('Remove //, /* */, /** */ and <!-- --> comments from source files, without touching code')
129
+ .argument('[paths...]', 'files/directories to process', [])
130
+ .option('--cwd <path>', 'root paths are resolved against', process.cwd())
131
+ .option('--ext <list>', 'comma-separated extensions to include', '.ts,.tsx,.js,.jsx,.cjs,.mjs,.vue')
132
+ .option('--ignore <glob>', 'extra ignore pattern (repeatable), on top of the built-in defaults', (val, prev) => [...prev, val], [])
133
+ .option('--no-respect-gitignore', "don't also honor the project's .gitignore")
134
+ .option('--keep-jsdoc', "don't remove a /** */ comment directly above an exported declaration", false)
135
+ .option('--dry-run', 'preview changes without writing anything', false)
136
+ .option('-y, --yes', 'apply the changes (without this, it only previews)', false)
137
+ .option('--diff', 'include a unified diff per changed file', false)
138
+ .option('--json', 'machine-readable output', false)
139
+ .option('--quiet', 'suppress output when there is nothing to report', false)
140
+ .option('--plain', 'disable color/banner/celebration copy, even in a real terminal', false)
141
+ .action((paths, options) => {
142
+ const report = runStripComments({
143
+ paths,
144
+ cwd: resolve(options.cwd),
145
+ extensions: options.ext.split(',').map((e) => e.trim()),
146
+ ignoreGlobs: options.ignore,
147
+ respectGitignore: options.respectGitignore,
148
+ keepJsdoc: options.keepJsdoc,
149
+ dryRun: options.dryRun,
150
+ yes: options.yes,
151
+ diff: options.diff,
152
+ });
153
+ if (options.json) {
154
+ console.log(JSON.stringify(report, null, 2));
155
+ }
156
+ else {
157
+ const text = renderStripCommentsReport(report, {
158
+ quiet: options.quiet,
159
+ plain: options.plain,
160
+ dryRun: options.dryRun,
161
+ });
162
+ if (text)
163
+ console.log(text);
164
+ }
165
+ process.exitCode = report.exitCode;
166
+ });
167
+ program
168
+ .command('console-strip')
169
+ .description('Remove console.log/console.debug/debugger statements left in by mistake')
170
+ .argument('[paths...]', 'files/directories to process', [])
171
+ .option('--cwd <path>', 'root paths are resolved against', process.cwd())
172
+ .option('--ext <list>', 'comma-separated extensions to include', '.ts,.tsx,.js,.jsx,.cjs,.mjs,.vue')
173
+ .option('--ignore <glob>', 'extra ignore pattern (repeatable), on top of the built-in defaults', (val, prev) => [...prev, val], [])
174
+ .option('--no-respect-gitignore', "don't also honor the project's .gitignore")
175
+ .option('--methods <list>', 'comma-separated console methods to remove (warn/error are deliberately not in the default — often legitimate)', 'log,debug')
176
+ .option('--no-debugger', "don't remove bare debugger; statements")
177
+ .option('--dry-run', 'preview changes without writing anything', false)
178
+ .option('-y, --yes', 'apply the changes (without this, it only previews)', false)
179
+ .option('--diff', 'include a unified diff per changed file', false)
180
+ .option('--json', 'machine-readable output', false)
181
+ .option('--quiet', 'suppress output when there is nothing to report', false)
182
+ .option('--plain', 'disable color/banner/celebration copy, even in a real terminal', false)
183
+ .action((paths, options) => {
184
+ const report = runConsoleStrip({
185
+ paths,
186
+ cwd: resolve(options.cwd),
187
+ extensions: options.ext.split(',').map((e) => e.trim()),
188
+ ignoreGlobs: options.ignore,
189
+ respectGitignore: options.respectGitignore,
190
+ methods: options.methods.split(',').map((m) => m.trim()),
191
+ debugger: options.debugger,
192
+ dryRun: options.dryRun,
193
+ yes: options.yes,
194
+ diff: options.diff,
195
+ });
196
+ if (options.json) {
197
+ console.log(JSON.stringify(report, null, 2));
198
+ }
199
+ else {
200
+ const text = renderConsoleStripReport(report, {
201
+ quiet: options.quiet,
202
+ plain: options.plain,
203
+ });
204
+ if (text)
205
+ console.log(text);
206
+ }
207
+ process.exitCode = report.exitCode;
208
+ });
209
+ program
210
+ .command('dead-exports')
211
+ .description("Find named exports nothing in the project imports — a library's own public entry points are exempt by default")
212
+ .argument('[paths...]', 'files/directories to process', [])
213
+ .option('--cwd <path>', 'root paths are resolved against', process.cwd())
214
+ .option('--ext <list>', 'comma-separated extensions to include', '.ts,.tsx,.js,.jsx,.cjs,.mjs')
215
+ .option('--ignore <glob>', 'extra ignore pattern (repeatable), on top of the built-in defaults', (val, prev) => [...prev, val], [])
216
+ .option('--no-respect-gitignore', "don't also honor the project's .gitignore")
217
+ .option('--entry <path>', 'extra public-entry file (repeatable) — exports from it are exempt, same as auto-detected ones', (val, prev) => [...prev, val], [])
218
+ .option('--strict', 'also flag exports from public entry points, not just internal files', false)
219
+ .option('--no-workspace', "don't auto-detect a pnpm/npm/yarn workspace for cross-package resolution")
220
+ .option('--json', 'machine-readable output', false)
221
+ .option('--quiet', 'suppress output when there is nothing to report', false)
222
+ .option('--plain', 'disable color/banner/celebration copy, even in a real terminal', false)
223
+ .action((paths, options) => {
224
+ const report = runDeadExports({
225
+ paths,
226
+ cwd: resolve(options.cwd),
227
+ extensions: options.ext.split(',').map((e) => e.trim()),
228
+ ignoreGlobs: options.ignore,
229
+ respectGitignore: options.respectGitignore,
230
+ entry: options.entry,
231
+ strict: options.strict,
232
+ workspace: options.workspace,
233
+ });
234
+ if (options.json) {
235
+ console.log(JSON.stringify(report, null, 2));
236
+ }
237
+ else {
238
+ const text = renderDeadExportsReport(report, { quiet: options.quiet, plain: options.plain });
239
+ if (text)
240
+ console.log(text);
241
+ }
242
+ process.exitCode = report.exitCode;
243
+ });
244
+ program
245
+ .command('case-check')
246
+ .description("Find imports whose case doesn't match the real file on disk — works on Windows/Mac, breaks on Linux CI")
247
+ .argument('[paths...]', 'files/directories to process', [])
248
+ .option('--cwd <path>', 'root paths are resolved against', process.cwd())
249
+ .option('--ext <list>', 'comma-separated extensions to include', '.ts,.tsx,.js,.jsx,.cjs,.mjs,.vue')
250
+ .option('--ignore <glob>', 'extra ignore pattern (repeatable), on top of the built-in defaults', (val, prev) => [...prev, val], [])
251
+ .option('--no-respect-gitignore', "don't also honor the project's .gitignore")
252
+ .option('--tsconfig <path>', 'tsconfig.json to read path aliases from (auto-detected by default)')
253
+ .option('--fix', 'rewrite mismatched specifiers to their real case (alias-resolved ones excluded)', false)
254
+ .option('--dry-run', 'preview changes without writing anything', false)
255
+ .option('-y, --yes', 'apply the changes (without this, it only previews)', false)
256
+ .option('--diff', 'include a unified diff per changed file', false)
257
+ .option('--json', 'machine-readable output', false)
258
+ .option('--quiet', 'suppress output when there is nothing to report', false)
259
+ .option('--plain', 'disable color/banner/celebration copy, even in a real terminal', false)
260
+ .action((paths, options) => {
261
+ const report = runCaseCheck({
262
+ paths,
263
+ cwd: resolve(options.cwd),
264
+ extensions: options.ext.split(',').map((e) => e.trim()),
265
+ ignoreGlobs: options.ignore,
266
+ respectGitignore: options.respectGitignore,
267
+ ...(options.tsconfig ? { tsconfig: options.tsconfig } : {}),
268
+ fix: options.fix,
269
+ dryRun: options.dryRun,
270
+ yes: options.yes,
271
+ diff: options.diff,
272
+ });
273
+ if (options.json) {
274
+ console.log(JSON.stringify(report, null, 2));
275
+ }
276
+ else {
277
+ const text = renderCaseCheckReport(report, { quiet: options.quiet, plain: options.plain });
278
+ if (text)
279
+ console.log(text);
280
+ }
281
+ process.exitCode = report.exitCode;
282
+ });
283
+ program
284
+ .command('exports-doctor')
285
+ .description("Verify package.json's declared main/module/types/bin/exports paths actually resolve on disk")
286
+ .argument('[dir]', 'package directory to check', '.')
287
+ .option('--json', 'machine-readable output', false)
288
+ .option('--quiet', 'suppress output when there is nothing to report', false)
289
+ .option('--plain', 'disable color/banner/celebration copy, even in a real terminal', false)
290
+ .action((dir, options) => {
291
+ const report = runExportsDoctor({ dir: resolve(dir) });
292
+ if (options.json) {
293
+ console.log(JSON.stringify(report, null, 2));
294
+ }
295
+ else {
296
+ const text = renderExportsDoctorReport(report, { quiet: options.quiet, plain: options.plain });
297
+ if (text)
298
+ console.log(text);
299
+ }
300
+ process.exitCode = report.exitCode;
301
+ });
302
+ program
303
+ .command('readme-check')
304
+ .description('Typecheck fenced ts/tsx code blocks in README/docs against the real, built package')
305
+ .argument('[dir]', 'package directory to check against', '.')
306
+ .option('--file <path>', 'markdown file to check, relative to [dir] (repeatable) — default: README.md', (val, prev) => [...prev, val], [])
307
+ .option('--lang <list>', 'comma-separated fenced-block languages to check', 'ts')
308
+ .option('--tsconfig <path>', 'tsconfig.json to read compiler options from (auto-detected by default)')
309
+ .option('--json', 'machine-readable output', false)
310
+ .option('--quiet', 'suppress output when there is nothing to report', false)
311
+ .option('--plain', 'disable color/banner/celebration copy, even in a real terminal', false)
312
+ .action((dir, options) => {
313
+ const report = runReadmeCheck({
314
+ dir: resolve(dir),
315
+ files: options.file,
316
+ langs: options.lang.split(',').map((l) => l.trim().toLowerCase()),
317
+ ...(options.tsconfig ? { tsconfig: options.tsconfig } : {}),
318
+ });
319
+ if (options.json) {
320
+ console.log(JSON.stringify(report, null, 2));
321
+ }
322
+ else {
323
+ const text = renderReadmeCheckReport(report, { quiet: options.quiet, plain: options.plain });
324
+ if (text)
325
+ console.log(text);
326
+ }
327
+ process.exitCode = report.exitCode;
328
+ });
329
+ program.parse(process.argv);
330
+ //# sourceMappingURL=cli.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
+ correctedSpecifier: string;
5
+ /**
6
+ * true for a specifier resolved through a tsconfig path alias — its
7
+ * `correctedSpecifier` is shown in resolved relative form (there's no
8
+ * reliable way back to an alias-shaped fix, see tsconfig-paths.ts), so
9
+ * it's reported but never rewritten by --fix, only relative ones are.
10
+ */
11
+ isAlias: boolean;
12
+ start: number;
13
+ end: number;
14
+ line: number;
15
+ column: number;
16
+ }
17
+ export declare function checkFile(text: string, file: string, paths: TsconfigPaths | null): CaseCheckFinding[];