@codefast/cli 0.10.0 → 0.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 (303) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +66 -41
  3. package/dist/arrange/command.js +99 -136
  4. package/dist/arrange/domain/ast/collectors-cn.d.ts +2 -2
  5. package/dist/arrange/domain/ast/collectors-cn.js +2 -2
  6. package/dist/arrange/domain/ast/collectors-jsx.d.ts +2 -2
  7. package/dist/arrange/domain/ast/collectors-jsx.js +1 -1
  8. package/dist/arrange/domain/ast/collectors-tv.d.ts +2 -2
  9. package/dist/arrange/domain/ast/collectors-tv.js +5 -5
  10. package/dist/arrange/domain/ast/helpers.d.ts +2 -2
  11. package/dist/arrange/domain/ast/helpers.js +3 -4
  12. package/dist/arrange/domain/ast/simplify-targets.d.ts +1 -1
  13. package/dist/arrange/domain/ast/simplify-targets.js +23 -28
  14. package/dist/arrange/domain/ast/targets.d.ts +2 -2
  15. package/dist/arrange/domain/ast/targets.js +9 -9
  16. package/dist/arrange/{typescript-ast-translator.d.ts → domain/ast/translator.d.ts} +6 -5
  17. package/dist/arrange/{typescript-ast-translator.js → domain/ast/translator.js} +20 -23
  18. package/dist/arrange/domain/constants.d.ts +1 -1
  19. package/dist/arrange/domain/grouping-service.d.ts +2 -2
  20. package/dist/arrange/domain/grouping-service.js +3 -3
  21. package/dist/arrange/domain/grouping.js +3 -3
  22. package/dist/arrange/domain/imports.d.ts +1 -1
  23. package/dist/arrange/domain/imports.js +2 -2
  24. package/dist/arrange/domain/source-text-formatters.js +1 -1
  25. package/dist/arrange/domain/tailwind-token.js +1 -1
  26. package/dist/arrange/domain/token-classifier.d.ts +1 -1
  27. package/dist/arrange/domain/token-classifier.js +2 -2
  28. package/dist/arrange/domain/types.d.ts +3 -3
  29. package/dist/arrange/group/cli-result.d.ts +7 -0
  30. package/dist/arrange/group/cli-result.js +12 -0
  31. package/dist/arrange/group/cli-schema.d.ts +17 -0
  32. package/dist/arrange/group/cli-schema.js +13 -0
  33. package/dist/arrange/group/output.d.ts +7 -0
  34. package/dist/arrange/group/output.js +10 -0
  35. package/dist/arrange/group/suggest.d.ts +8 -0
  36. package/dist/arrange/{suggest.js → group/suggest.js} +2 -2
  37. package/dist/arrange/inspect/cli-result.d.ts +7 -0
  38. package/dist/arrange/inspect/cli-result.js +8 -0
  39. package/dist/arrange/inspect/cli-schema.d.ts +15 -0
  40. package/dist/arrange/inspect/cli-schema.js +9 -0
  41. package/dist/arrange/{domain → inspect/domain}/analyze-service.d.ts +2 -2
  42. package/dist/arrange/{domain → inspect/domain}/analyze-service.js +7 -7
  43. package/dist/arrange/inspect/output.d.ts +7 -0
  44. package/dist/arrange/inspect/output.js +42 -0
  45. package/dist/arrange/inspect/run.d.ts +10 -0
  46. package/dist/arrange/{analyze.js → inspect/run.js} +7 -7
  47. package/dist/arrange/prepare.d.ts +13 -0
  48. package/dist/arrange/{workspace.js → prepare.js} +9 -12
  49. package/dist/arrange/regroup/cli-result.d.ts +13 -0
  50. package/dist/arrange/regroup/cli-result.js +23 -0
  51. package/dist/arrange/regroup/cli-schema.d.ts +20 -0
  52. package/dist/arrange/regroup/cli-schema.js +14 -0
  53. package/dist/arrange/regroup/output.d.ts +14 -0
  54. package/dist/arrange/regroup/output.js +72 -0
  55. package/dist/arrange/{process-file.d.ts → regroup/process-file.d.ts} +3 -3
  56. package/dist/arrange/{process-file.js → regroup/process-file.js} +3 -3
  57. package/dist/arrange/regroup/run.d.ts +11 -0
  58. package/dist/arrange/{sync.js → regroup/run.js} +5 -5
  59. package/dist/arrange/resolve-target.d.ts +2 -2
  60. package/dist/arrange/resolve-target.js +2 -2
  61. package/dist/arrange/scan-target.d.ts +2 -2
  62. package/dist/arrange/scan-target.js +3 -3
  63. package/dist/arrange/simplify/cli-result.d.ts +7 -0
  64. package/dist/arrange/simplify/cli-result.js +8 -0
  65. package/dist/arrange/simplify/cli-schema.d.ts +17 -0
  66. package/dist/arrange/simplify/cli-schema.js +11 -0
  67. package/dist/arrange/simplify/fold-targets.d.ts +13 -0
  68. package/dist/arrange/simplify/fold-targets.js +139 -0
  69. package/dist/arrange/simplify/output.d.ts +7 -0
  70. package/dist/arrange/simplify/output.js +15 -0
  71. package/dist/arrange/simplify/process-file.d.ts +13 -0
  72. package/dist/arrange/simplify/process-file.js +49 -0
  73. package/dist/arrange/simplify/run.d.ts +14 -0
  74. package/dist/arrange/simplify/run.js +38 -0
  75. package/dist/arrange/simplify/variant-classname-probe.d.ts +35 -0
  76. package/dist/arrange/simplify/variant-classname-probe.js +95 -0
  77. package/dist/arrange/source-parse.d.ts +1 -1
  78. package/dist/arrange/source-parse.js +3 -3
  79. package/dist/audit/command.js +152 -212
  80. package/dist/audit/comments/cli-result.d.ts +13 -0
  81. package/dist/audit/comments/cli-result.js +22 -0
  82. package/dist/audit/comments/cli-schema.d.ts +19 -0
  83. package/dist/audit/comments/cli-schema.js +13 -0
  84. package/dist/audit/comments/output.d.ts +7 -0
  85. package/dist/audit/comments/output.js +27 -0
  86. package/dist/audit/comments/prepare.d.ts +16 -0
  87. package/dist/audit/comments/prepare.js +12 -0
  88. package/dist/audit/{run-comments.d.ts → comments/run.d.ts} +5 -5
  89. package/dist/audit/{run-comments.js → comments/run.js} +9 -9
  90. package/dist/audit/display-names/cli-result.d.ts +13 -0
  91. package/dist/audit/display-names/cli-result.js +22 -0
  92. package/dist/audit/display-names/cli-schema.d.ts +18 -0
  93. package/dist/audit/display-names/cli-schema.js +12 -0
  94. package/dist/audit/{domain → display-names/domain}/display-names.d.ts +1 -1
  95. package/dist/audit/display-names/output.d.ts +7 -0
  96. package/dist/audit/display-names/output.js +21 -0
  97. package/dist/audit/display-names/prepare.d.ts +16 -0
  98. package/dist/audit/display-names/prepare.js +12 -0
  99. package/dist/audit/display-names/run.d.ts +14 -0
  100. package/dist/audit/{run-display-names.js → display-names/run.js} +5 -5
  101. package/dist/audit/domain/types.d.ts +43 -0
  102. package/dist/audit/imports/cli-result.d.ts +13 -0
  103. package/dist/audit/imports/cli-result.js +22 -0
  104. package/dist/audit/imports/cli-schema.d.ts +18 -0
  105. package/dist/audit/imports/cli-schema.js +12 -0
  106. package/dist/audit/{domain → imports/domain}/import-policy.d.ts +3 -3
  107. package/dist/audit/{domain → imports/domain}/import-policy.js +4 -11
  108. package/dist/audit/imports/output.d.ts +7 -0
  109. package/dist/audit/imports/output.js +21 -0
  110. package/dist/audit/imports/prepare.d.ts +16 -0
  111. package/dist/audit/imports/prepare.js +12 -0
  112. package/dist/audit/imports/run.d.ts +14 -0
  113. package/dist/audit/{run-imports.js → imports/run.js} +6 -6
  114. package/dist/audit/links/cli-result.d.ts +13 -0
  115. package/dist/audit/links/cli-result.js +22 -0
  116. package/dist/audit/links/cli-schema.d.ts +18 -0
  117. package/dist/audit/links/cli-schema.js +12 -0
  118. package/dist/audit/{domain → links/domain}/markdown-links.d.ts +3 -3
  119. package/dist/audit/{domain → links/domain}/markdown-links.js +22 -8
  120. package/dist/audit/links/output.d.ts +7 -0
  121. package/dist/audit/links/output.js +21 -0
  122. package/dist/audit/links/prepare.d.ts +16 -0
  123. package/dist/audit/links/prepare.js +12 -0
  124. package/dist/audit/links/run.d.ts +14 -0
  125. package/dist/audit/{run-links.js → links/run.js} +4 -4
  126. package/dist/audit/prepare.d.ts +13 -52
  127. package/dist/audit/prepare.js +13 -136
  128. package/dist/audit/publish/cli-result.d.ts +13 -0
  129. package/dist/audit/publish/cli-result.js +22 -0
  130. package/dist/audit/publish/cli-schema.d.ts +18 -0
  131. package/dist/audit/publish/cli-schema.js +12 -0
  132. package/dist/audit/publish/domain/legacy-subpath.d.ts +8 -0
  133. package/dist/audit/publish/domain/legacy-subpath.js +22 -0
  134. package/dist/audit/publish/output.d.ts +7 -0
  135. package/dist/audit/publish/output.js +24 -0
  136. package/dist/audit/publish/prepare.d.ts +16 -0
  137. package/dist/audit/publish/prepare.js +12 -0
  138. package/dist/audit/publish/run.d.ts +14 -0
  139. package/dist/audit/publish/run.js +62 -0
  140. package/dist/audit/rtl/cli-result.d.ts +13 -0
  141. package/dist/audit/rtl/cli-result.js +22 -0
  142. package/dist/audit/rtl/cli-schema.d.ts +18 -0
  143. package/dist/audit/rtl/cli-schema.js +12 -0
  144. package/dist/audit/{domain → rtl/domain}/audit-file.d.ts +1 -1
  145. package/dist/audit/{domain → rtl/domain}/audit-file.js +2 -2
  146. package/dist/audit/{domain → rtl/domain}/tokenize.d.ts +1 -1
  147. package/dist/audit/rtl/output.d.ts +7 -0
  148. package/dist/audit/rtl/output.js +21 -0
  149. package/dist/audit/rtl/prepare.d.ts +13 -0
  150. package/dist/audit/rtl/prepare.js +41 -0
  151. package/dist/audit/rtl/run.d.ts +14 -0
  152. package/dist/audit/{run.js → rtl/run.js} +4 -4
  153. package/dist/bin.js +1 -1
  154. package/dist/cli.js +5 -5
  155. package/dist/core/cli/command-pipeline.d.ts +90 -0
  156. package/dist/core/cli/command-pipeline.js +83 -0
  157. package/dist/core/cli/format-error.d.ts +1 -1
  158. package/dist/core/cli/global-options.d.ts +1 -1
  159. package/dist/core/cli/global-options.js +1 -1
  160. package/dist/core/cli/resolve-root.d.ts +9 -0
  161. package/dist/core/cli/resolve-root.js +16 -0
  162. package/dist/core/cli/result-handle.d.ts +3 -9
  163. package/dist/core/cli/result-handle.js +4 -17
  164. package/dist/core/config/define-config.d.ts +1 -1
  165. package/dist/core/config/loader.d.ts +3 -3
  166. package/dist/core/config/loader.js +2 -2
  167. package/dist/core/config/schema.d.ts +1 -1
  168. package/dist/core/config/schema.js +1 -1
  169. package/dist/core/config/warnings.js +1 -1
  170. package/dist/core/config.d.ts +5 -5
  171. package/dist/core/config.js +4 -4
  172. package/dist/core/filesystem/{port.d.ts → filesystem.d.ts} +1 -1
  173. package/dist/core/filesystem/node.d.ts +3 -3
  174. package/dist/core/filesystem/node.js +1 -1
  175. package/dist/core/schema-parse.d.ts +2 -2
  176. package/dist/core/schema-parse.js +2 -2
  177. package/dist/core/source-text-edit.d.ts +14 -0
  178. package/dist/core/source-text-edit.js +22 -0
  179. package/dist/core/workspace/markdown-walk.d.ts +2 -2
  180. package/dist/core/workspace/markdown-walk.js +1 -1
  181. package/dist/core/workspace/package-version.d.ts +2 -2
  182. package/dist/core/workspace/package-version.js +2 -2
  183. package/dist/core/workspace/resolver.d.ts +3 -3
  184. package/dist/core/workspace/resolver.js +5 -5
  185. package/dist/core/workspace/source-walk.d.ts +2 -2
  186. package/dist/core/workspace/source-walk.js +1 -1
  187. package/dist/core/workspace/typescript-walk.d.ts +2 -2
  188. package/dist/core/workspace/typescript-walk.js +1 -1
  189. package/dist/core/workspace/walk-files.d.ts +2 -2
  190. package/dist/core/workspace/walk-files.js +1 -1
  191. package/dist/index.d.ts +3 -3
  192. package/dist/index.js +2 -2
  193. package/dist/mirror/cli-result.d.ts +1 -1
  194. package/dist/mirror/cli-result.js +1 -1
  195. package/dist/mirror/cli-schema.d.ts +2 -2
  196. package/dist/mirror/cli-schema.js +1 -1
  197. package/dist/mirror/command.js +36 -65
  198. package/dist/mirror/dist-filesystem-node.d.ts +8 -0
  199. package/dist/mirror/{dist-filesystem-impl.js → dist-filesystem-node.js} +3 -3
  200. package/dist/mirror/domain/dirent-guard.d.ts +1 -1
  201. package/dist/mirror/domain/exports.d.ts +2 -2
  202. package/dist/mirror/domain/exports.js +1 -1
  203. package/dist/mirror/domain/types.d.ts +59 -2
  204. package/dist/mirror/output.d.ts +1 -3
  205. package/dist/mirror/output.js +127 -2
  206. package/dist/mirror/package-path.d.ts +5 -5
  207. package/dist/mirror/package-path.js +3 -3
  208. package/dist/mirror/prepare.d.ts +6 -6
  209. package/dist/mirror/prepare.js +8 -12
  210. package/dist/mirror/run.d.ts +12 -0
  211. package/dist/mirror/{sync.js → run.js} +7 -7
  212. package/dist/mirror/supplement-exports.d.ts +3 -3
  213. package/dist/mirror/supplement-exports.js +2 -2
  214. package/dist/mirror/sync-workspace-package.d.ts +4 -4
  215. package/dist/mirror/sync-workspace-package.js +11 -14
  216. package/dist/mirror/write-exports.d.ts +3 -3
  217. package/dist/mirror/write-exports.js +3 -3
  218. package/dist/pack-slim/cli-result.d.ts +1 -1
  219. package/dist/pack-slim/cli-result.js +1 -1
  220. package/dist/pack-slim/cli-schema.d.ts +1 -1
  221. package/dist/pack-slim/cli-schema.js +1 -1
  222. package/dist/pack-slim/command.js +36 -71
  223. package/dist/pack-slim/domain/transform.d.ts +22 -1
  224. package/dist/pack-slim/domain/transform.js +65 -8
  225. package/dist/pack-slim/output.d.ts +1 -1
  226. package/dist/pack-slim/output.js +1 -1
  227. package/dist/pack-slim/prepare.d.ts +21 -0
  228. package/dist/pack-slim/prepare.js +14 -0
  229. package/dist/pack-slim/{sync.d.ts → run.d.ts} +6 -6
  230. package/dist/pack-slim/{sync.js → run.js} +5 -5
  231. package/dist/pack-slim/working-tree.d.ts +2 -2
  232. package/dist/pack-slim/working-tree.js +2 -2
  233. package/dist/tag/cli-result.d.ts +8 -2
  234. package/dist/tag/cli-result.js +15 -2
  235. package/dist/tag/cli-schema.d.ts +4 -4
  236. package/dist/tag/cli-schema.js +3 -4
  237. package/dist/tag/command.js +34 -61
  238. package/dist/tag/domain/skip-filter.d.ts +13 -0
  239. package/dist/tag/domain/skip-filter.js +29 -0
  240. package/dist/tag/domain/types.d.ts +22 -2
  241. package/dist/tag/domain/version-summary.d.ts +13 -0
  242. package/dist/tag/domain/version-summary.js +24 -0
  243. package/dist/tag/output.d.ts +4 -4
  244. package/dist/tag/output.js +7 -10
  245. package/dist/tag/prepare.d.ts +5 -5
  246. package/dist/tag/prepare.js +5 -5
  247. package/dist/tag/run.d.ts +10 -0
  248. package/dist/tag/{sync.js → run.js} +23 -53
  249. package/dist/tag/target/candidates.d.ts +8 -0
  250. package/dist/tag/{target-candidates.js → target/candidates.js} +3 -3
  251. package/dist/tag/{resolve-target-path.d.ts → target/resolve-path.d.ts} +2 -2
  252. package/dist/tag/target/runner.d.ts +8 -0
  253. package/dist/tag/{target-runner.js → target/runner.js} +3 -3
  254. package/dist/tag/{since-writer.d.ts → writer/since-writer.d.ts} +3 -3
  255. package/dist/tag/{since-writer.js → writer/since-writer.js} +1 -1
  256. package/dist/tag/{version-resolver.d.ts → writer/version-resolver.d.ts} +2 -2
  257. package/dist/tag/{version-resolver.js → writer/version-resolver.js} +1 -1
  258. package/package.json +15 -7
  259. package/dist/arrange/analyze.d.ts +0 -10
  260. package/dist/arrange/cli-schema.d.ts +0 -50
  261. package/dist/arrange/cli-schema.js +0 -34
  262. package/dist/arrange/output.d.ts +0 -26
  263. package/dist/arrange/output.js +0 -127
  264. package/dist/arrange/simplify-process-file.d.ts +0 -11
  265. package/dist/arrange/simplify-process-file.js +0 -30
  266. package/dist/arrange/simplify-sync.d.ts +0 -13
  267. package/dist/arrange/simplify-sync.js +0 -30
  268. package/dist/arrange/suggest.d.ts +0 -8
  269. package/dist/arrange/sync.d.ts +0 -11
  270. package/dist/arrange/workspace.d.ts +0 -13
  271. package/dist/audit/cli-schema.d.ts +0 -93
  272. package/dist/audit/cli-schema.js +0 -66
  273. package/dist/audit/output.d.ts +0 -91
  274. package/dist/audit/output.js +0 -213
  275. package/dist/audit/run-display-names.d.ts +0 -14
  276. package/dist/audit/run-imports.d.ts +0 -14
  277. package/dist/audit/run-links.d.ts +0 -14
  278. package/dist/audit/run.d.ts +0 -14
  279. package/dist/mirror/dist-filesystem-impl.d.ts +0 -8
  280. package/dist/mirror/sync-reporter.d.ts +0 -60
  281. package/dist/mirror/sync-reporter.js +0 -128
  282. package/dist/mirror/sync-types.d.ts +0 -43
  283. package/dist/mirror/sync-types.js +0 -1
  284. package/dist/mirror/sync.d.ts +0 -12
  285. package/dist/tag/sync.d.ts +0 -42
  286. package/dist/tag/target-candidates.d.ts +0 -8
  287. package/dist/tag/target-runner.d.ts +0 -8
  288. /package/dist/audit/{domain → comments/domain}/comment-content.d.ts +0 -0
  289. /package/dist/audit/{domain → comments/domain}/comment-content.js +0 -0
  290. /package/dist/audit/{domain → comments/domain}/comment-dividers.d.ts +0 -0
  291. /package/dist/audit/{domain → comments/domain}/comment-dividers.js +0 -0
  292. /package/dist/audit/{domain → comments/domain}/link-references.d.ts +0 -0
  293. /package/dist/audit/{domain → comments/domain}/link-references.js +0 -0
  294. /package/dist/audit/{domain → comments/domain}/since-versions.d.ts +0 -0
  295. /package/dist/audit/{domain → comments/domain}/since-versions.js +0 -0
  296. /package/dist/audit/{domain → comments/domain}/tsdoc-syntax.d.ts +0 -0
  297. /package/dist/audit/{domain → comments/domain}/tsdoc-syntax.js +0 -0
  298. /package/dist/audit/{domain → display-names/domain}/display-names.js +0 -0
  299. /package/dist/audit/{domain → rtl/domain}/mappings.d.ts +0 -0
  300. /package/dist/audit/{domain → rtl/domain}/mappings.js +0 -0
  301. /package/dist/audit/{domain → rtl/domain}/tokenize.js +0 -0
  302. /package/dist/core/filesystem/{port.js → filesystem.js} +0 -0
  303. /package/dist/tag/{resolve-target-path.js → target/resolve-path.js} +0 -0
@@ -1,213 +0,0 @@
1
- import { CLI_EXIT_GENERAL_ERROR, CLI_EXIT_SUCCESS } from "#/core/exit-codes";
2
- import { logger } from "#/core/logger";
3
- /**
4
- * Exit `1` when any non-allowlisted violation remains.
5
- *
6
- * @since 0.5.0-canary.6
7
- */
8
- export function exitCodeForRtlAuditResult(result) {
9
- return result.violationCount > 0 ? CLI_EXIT_GENERAL_ERROR : CLI_EXIT_SUCCESS;
10
- }
11
- /**
12
- * Human-readable RTL audit report (matches the former packages/ui script shape).
13
- *
14
- * @since 0.5.0-canary.6
15
- */
16
- export function presentRtlAuditResult(result) {
17
- for (const file of result.files) {
18
- logger.out(`\n${file.relativePath}`);
19
- for (const { line, raw, suggestion } of file.violations) {
20
- logger.out(` ${line}: ${raw} → ${suggestion}`);
21
- }
22
- }
23
- const allowlistSuffix = result.allowlistedCount > 0 ? ` (${result.allowlistedCount} allowlisted)` : "";
24
- if (result.violationCount > 0) {
25
- logger.out(`\n✖ ${result.violationCount} RTL violation(s)${allowlistSuffix}`);
26
- }
27
- else {
28
- logger.out(`✓ No physical-direction classes outside the allowlist${allowlistSuffix}`);
29
- }
30
- }
31
- /**
32
- * Machine-readable RTL audit summary for `--json`.
33
- *
34
- * @since 0.5.0-canary.6
35
- */
36
- export function formatRtlAuditJsonOutput(result, rootDir) {
37
- return JSON.stringify({
38
- schemaVersion: 1,
39
- ok: result.violationCount === 0,
40
- cwd: rootDir,
41
- result,
42
- });
43
- }
44
- /**
45
- * Exit `1` when any non-allowlisted broken link remains.
46
- *
47
- * @since 0.5.0
48
- */
49
- export function exitCodeForLinkAuditResult(result) {
50
- return result.breakageCount > 0 ? CLI_EXIT_GENERAL_ERROR : CLI_EXIT_SUCCESS;
51
- }
52
- /**
53
- * Human-readable link audit report.
54
- *
55
- * @since 0.5.0
56
- */
57
- export function presentLinkAuditResult(result) {
58
- for (const file of result.files) {
59
- logger.out(`\n${file.relativePath}`);
60
- for (const { line, raw, reason } of file.breakages) {
61
- logger.out(` ${line}: ${raw} → ${reason}`);
62
- }
63
- }
64
- const allowlistSuffix = result.allowlistedCount > 0 ? ` (${result.allowlistedCount} allowlisted)` : "";
65
- if (result.breakageCount > 0) {
66
- logger.out(`\n✖ ${result.breakageCount} broken link(s)${allowlistSuffix}`);
67
- }
68
- else {
69
- logger.out(`✓ ${result.linkCount} repo-local link(s) across ${result.scannedFileCount} document(s) all resolve${allowlistSuffix}`);
70
- }
71
- }
72
- /**
73
- * Machine-readable link audit summary for `--json`.
74
- *
75
- * @since 0.5.0
76
- */
77
- export function formatLinkAuditJsonOutput(result, rootDir) {
78
- return JSON.stringify({
79
- schemaVersion: 1,
80
- ok: result.breakageCount === 0,
81
- cwd: rootDir,
82
- result,
83
- });
84
- }
85
- /**
86
- * Exit `1` when any non-allowlisted import-policy violation remains.
87
- *
88
- * @since 0.10.0
89
- */
90
- export function exitCodeForImportsAuditResult(result) {
91
- return result.violationCount > 0 ? CLI_EXIT_GENERAL_ERROR : CLI_EXIT_SUCCESS;
92
- }
93
- /**
94
- * Human-readable import-policy report.
95
- *
96
- * @since 0.10.0
97
- */
98
- export function presentImportsAuditResult(result) {
99
- for (const file of result.files) {
100
- logger.out(`\n${file.relativePath}`);
101
- for (const { line, raw, reason } of file.violations) {
102
- logger.out(` ${line}: ${raw} → ${reason}`);
103
- }
104
- }
105
- const allowlistSuffix = result.allowlistedCount > 0 ? ` (${result.allowlistedCount} allowlisted)` : "";
106
- if (result.violationCount > 0) {
107
- logger.out(`\n✖ ${result.violationCount} import-policy violation(s)${allowlistSuffix}`);
108
- }
109
- else {
110
- logger.out(`✓ No import-policy violations across ${result.scannedFileCount} file(s)${allowlistSuffix}`);
111
- }
112
- }
113
- /**
114
- * Machine-readable import-policy summary for `--json`.
115
- *
116
- * @since 0.10.0
117
- */
118
- export function formatImportsAuditJsonOutput(result, rootDir) {
119
- return JSON.stringify({
120
- schemaVersion: 1,
121
- ok: result.violationCount === 0,
122
- cwd: rootDir,
123
- result,
124
- });
125
- }
126
- /**
127
- * Exit `1` when any non-allowlisted divider still breaks the convention.
128
- *
129
- * @since 0.6.0
130
- */
131
- export function exitCodeForCommentAuditResult(result) {
132
- return result.breakageCount > 0 ? CLI_EXIT_GENERAL_ERROR : CLI_EXIT_SUCCESS;
133
- }
134
- /**
135
- * Human-readable comment-divider report.
136
- *
137
- * @since 0.6.0
138
- */
139
- export function presentCommentAuditResult(result) {
140
- for (const file of result.files) {
141
- logger.out(`\n${file.relativePath}`);
142
- for (const { line, raw, reason } of file.breakages) {
143
- logger.out(` ${line}: ${truncate(raw)} → ${reason}`);
144
- }
145
- }
146
- const allowlistSuffix = result.allowlistedCount > 0 ? ` (${result.allowlistedCount} allowlisted)` : "";
147
- if (result.fixedCount > 0) {
148
- logger.out(`\n✎ Rewrote ${result.fixedCount} divider(s)`);
149
- }
150
- if (result.breakageCount > 0) {
151
- logger.out(`\n✖ ${result.breakageCount} comment issue(s)${allowlistSuffix} — --fix rewrites divider forms`);
152
- }
153
- else {
154
- logger.out(`✓ ${result.dividerCount} divider(s) across ${result.scannedFileCount} file(s), no banned comment content${allowlistSuffix}`);
155
- }
156
- }
157
- /**
158
- * Machine-readable comment-divider summary for `--json`.
159
- *
160
- * @since 0.6.0
161
- */
162
- export function formatCommentAuditJsonOutput(result, rootDir) {
163
- return JSON.stringify({
164
- schemaVersion: 1,
165
- ok: result.breakageCount === 0,
166
- cwd: rootDir,
167
- result,
168
- });
169
- }
170
- function truncate(raw) {
171
- return raw.length <= 60 ? raw : `${raw.slice(0, 57)}…`;
172
- }
173
- /**
174
- * Exit `1` when any non-allowlisted display-name violation remains.
175
- *
176
- * @since 0.9.0
177
- */
178
- export function exitCodeForDisplayNameAuditResult(result) {
179
- return result.violationCount > 0 ? CLI_EXIT_GENERAL_ERROR : CLI_EXIT_SUCCESS;
180
- }
181
- /**
182
- * Human-readable display-name report.
183
- *
184
- * @since 0.9.0
185
- */
186
- export function presentDisplayNameAuditResult(result) {
187
- for (const file of result.files) {
188
- logger.out(`\n${file.relativePath}`);
189
- for (const { line, raw, reason } of file.violations) {
190
- logger.out(` ${line}: ${raw} → ${reason}`);
191
- }
192
- }
193
- const allowlistSuffix = result.allowlistedCount > 0 ? ` (${result.allowlistedCount} allowlisted)` : "";
194
- if (result.violationCount > 0) {
195
- logger.out(`\n✖ ${result.violationCount} display name(s) off the convention${allowlistSuffix}`);
196
- }
197
- else {
198
- logger.out(`✓ Every token, tag and module display name follows <namespace>:<Name> across ${result.scannedFileCount} file(s)${allowlistSuffix}`);
199
- }
200
- }
201
- /**
202
- * Machine-readable display-name summary for `--json`.
203
- *
204
- * @since 0.9.0
205
- */
206
- export function formatDisplayNameAuditJsonOutput(result, rootDir) {
207
- return JSON.stringify({
208
- schemaVersion: 1,
209
- ok: result.violationCount === 0,
210
- cwd: rootDir,
211
- result,
212
- });
213
- }
@@ -1,14 +0,0 @@
1
- import type { DisplayNameAuditResult } from "#/audit/domain/types";
2
- import { AppError } from "#/core/errors";
3
- import type { FilesystemPort } from "#/core/filesystem/port";
4
- import type { Result } from "#/core/result";
5
- /**
6
- * Scans a target path for `token()`, `tag()` and module display names that break the convention.
7
- *
8
- * @since 0.9.0
9
- */
10
- export declare function runDisplayNameAudit(fs: FilesystemPort, args: {
11
- readonly rootDir: string;
12
- readonly targetPath: string;
13
- readonly allowlist: ReadonlyArray<string>;
14
- }): Result<DisplayNameAuditResult, AppError>;
@@ -1,14 +0,0 @@
1
- import type { ImportsAuditResult } from "#/audit/domain/types";
2
- import { AppError } from "#/core/errors";
3
- import type { FilesystemPort } from "#/core/filesystem/port";
4
- import type { Result } from "#/core/result";
5
- /**
6
- * Scans a target path for import-policy violations, applying each rule only to files in its scope.
7
- *
8
- * @since 0.10.0
9
- */
10
- export declare function runImportsAudit(fs: FilesystemPort, args: {
11
- readonly rootDir: string;
12
- readonly targetPath: string;
13
- readonly allowlist: ReadonlyArray<string>;
14
- }): Result<ImportsAuditResult, AppError>;
@@ -1,14 +0,0 @@
1
- import type { LinkAuditResult } from "#/audit/domain/types";
2
- import { AppError } from "#/core/errors";
3
- import type { FilesystemPort } from "#/core/filesystem/port";
4
- import type { Result } from "#/core/result";
5
- /**
6
- * Reports markdown links that point at nothing — a missing path, or an anchor the target does not offer.
7
- *
8
- * @since 0.5.0
9
- */
10
- export declare function runLinkAudit(fs: FilesystemPort, args: {
11
- readonly rootDir: string;
12
- readonly targetPath: string;
13
- readonly allowlist: ReadonlyArray<string>;
14
- }): Result<LinkAuditResult, AppError>;
@@ -1,14 +0,0 @@
1
- import type { RtlAuditResult } from "#/audit/domain/types";
2
- import { AppError } from "#/core/errors";
3
- import type { FilesystemPort } from "#/core/filesystem/port";
4
- import type { Result } from "#/core/result";
5
- /**
6
- * Scans a target path for physical-direction Tailwind class violations.
7
- *
8
- * @since 0.5.0-canary.6
9
- */
10
- export declare function runRtlAudit(fs: FilesystemPort, args: {
11
- readonly rootDir: string;
12
- readonly targetPath: string;
13
- readonly allowlist: ReadonlyArray<string>;
14
- }): Result<RtlAuditResult, AppError>;
@@ -1,8 +0,0 @@
1
- import type { FilesystemPort } from "#/core/filesystem/port";
2
- import type { DistFilesystem } from "#/mirror/domain/dist-filesystem";
3
- /**
4
- * Creates the `DistFilesystem` the mirror scan uses, backed by a `FilesystemPort`.
5
- *
6
- * @since 0.3.16-canary.0
7
- */
8
- export declare function createMirrorDistFilesystem(fs: FilesystemPort): DistFilesystem;
@@ -1,60 +0,0 @@
1
- import type { GlobalStats, MirrorDistAssetCounts, PackageStats, WorkspaceMultiDiscoverySource } from "#/mirror/domain/types";
2
- /**
3
- * Whether a run targets a single package or the discovered workspace set.
4
- *
5
- * @since 0.3.16-canary.0
6
- */
7
- export type MirrorProcessingModeInput = {
8
- kind: "single";
9
- } | {
10
- kind: "multi";
11
- source: WorkspaceMultiDiscoverySource;
12
- };
13
- /**
14
- * The stdout/stderr line-writer shape the reporter prints through.
15
- *
16
- * @since 0.3.16-canary.0
17
- */
18
- export type CliLoggerLike = {
19
- out(line: string): void;
20
- err(line: string): void;
21
- };
22
- /**
23
- * The rendering surface for every message a mirror run prints.
24
- *
25
- * @since 0.3.16-canary.0
26
- */
27
- interface MirrorSyncReporterPort {
28
- configureMirrorColors(noColor: boolean): void;
29
- mirrorBanner(logger: CliLoggerLike): void;
30
- mirrorDryRunNotice(logger: CliLoggerLike): void;
31
- mirrorProcessingMode(logger: CliLoggerLike, mode: MirrorProcessingModeInput): void;
32
- mirrorNoPackages(logger: CliLoggerLike): void;
33
- logSkippedWorkspacePackage(logger: CliLoggerLike, index: number, total: number, displayName: string, reason: string): void;
34
- logPackageSuccess(logger: CliLoggerLike, index: number, total: number, pkgStats: PackageStats, generatedDistAssetCounts: MirrorDistAssetCounts, verbose: boolean): void;
35
- logPrunedStaleExport(logger: CliLoggerLike, exportSpecifier: string): void;
36
- logPackageError(logger: CliLoggerLike, index: number, total: number, displayName: string, errorValue: unknown, verbose: boolean): void;
37
- mirrorSummarySeparator(logger: CliLoggerLike): void;
38
- mirrorSummary(logger: CliLoggerLike, stats: GlobalStats, elapsedSeconds: number): void;
39
- }
40
- /**
41
- * Console implementation: ANSI styling and layout for the mirror command.
42
- *
43
- * @since 0.3.16-canary.0
44
- */
45
- export declare class MirrorSyncReporter implements MirrorSyncReporterPort {
46
- private colorsAreEnabled;
47
- configureMirrorColors(noColor: boolean): void;
48
- mirrorBanner(logger: CliLoggerLike): void;
49
- mirrorDryRunNotice(logger: CliLoggerLike): void;
50
- mirrorProcessingMode(logger: CliLoggerLike, mode: MirrorProcessingModeInput): void;
51
- mirrorNoPackages(logger: CliLoggerLike): void;
52
- logSkippedWorkspacePackage(logger: CliLoggerLike, index: number, total: number, displayName: string, reason: string): void;
53
- logPackageSuccess(logger: CliLoggerLike, index: number, total: number, pkgStats: PackageStats, generatedDistAssetCounts: MirrorDistAssetCounts, verbose: boolean): void;
54
- logPrunedStaleExport(logger: CliLoggerLike, exportSpecifier: string): void;
55
- logPackageError(logger: CliLoggerLike, index: number, total: number, displayName: string, errorValue: unknown, verbose: boolean): void;
56
- mirrorSummarySeparator(logger: CliLoggerLike): void;
57
- mirrorSummary(logger: CliLoggerLike, stats: GlobalStats, elapsedSeconds: number): void;
58
- private paint;
59
- }
60
- export {};
@@ -1,128 +0,0 @@
1
- import process from "node:process";
2
- import { messageFrom } from "#/core/errors";
3
- const ANSI = {
4
- reset: "\x1b[0m",
5
- bold: "\x1b[1m",
6
- dim: "\x1b[2m",
7
- green: "\x1b[32m",
8
- yellow: "\x1b[33m",
9
- cyan: "\x1b[36m",
10
- gray: "\x1b[90m",
11
- magenta: "\x1b[35m",
12
- brightGreen: "\x1b[92m",
13
- brightCyan: "\x1b[96m",
14
- };
15
- /**
16
- * Console implementation: ANSI styling and layout for the mirror command.
17
- *
18
- * @since 0.3.16-canary.0
19
- */
20
- export class MirrorSyncReporter {
21
- colorsAreEnabled = true;
22
- configureMirrorColors(noColor) {
23
- this.colorsAreEnabled = !!process.stdout.isTTY && !noColor;
24
- }
25
- mirrorBanner(logger) {
26
- logger.out(`\n${this.paint("📦 Mirror — package exports", ANSI.bold + ANSI.cyan)}`);
27
- logger.out(`${this.paint("═".repeat(60), ANSI.dim)}\n`);
28
- }
29
- mirrorDryRunNotice(logger) {
30
- logger.out(`${this.paint("Dry run — no files will be written.", ANSI.yellow)}\n`);
31
- }
32
- mirrorProcessingMode(logger, mode) {
33
- if (mode.kind === "single") {
34
- logger.out(`${this.paint("Processing single package...", ANSI.dim)}\n`);
35
- return;
36
- }
37
- if (mode.source === "default-patterns") {
38
- logger.out(`${this.paint("Discovering workspace packages using default patterns (packages/*)…", ANSI.dim)}\n`);
39
- return;
40
- }
41
- if (mode.source === "pnpm-workspace-yaml") {
42
- logger.out(`${this.paint("Discovering workspace packages from pnpm-workspace.yaml…", ANSI.dim)}\n`);
43
- return;
44
- }
45
- if (mode.source === "single-package") {
46
- logger.out(`${this.paint("No pnpm-workspace.yaml — processing the single package at the project root…", ANSI.dim)}\n`);
47
- return;
48
- }
49
- logger.out(`${this.paint("pnpm-workspace.yaml declares an empty workspace package list.", ANSI.dim)}\n`);
50
- }
51
- mirrorNoPackages(logger) {
52
- logger.out(this.paint("⚠ No packages found", ANSI.yellow));
53
- }
54
- logSkippedWorkspacePackage(logger, index, total, displayName, reason) {
55
- const progress = this.paint(`[${index}/${total}]`, ANSI.dim);
56
- logger.out(`${progress} ${this.paint("○", ANSI.gray)} ${this.paint(displayName, ANSI.dim)}`);
57
- logger.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Skipped: ${reason}`, ANSI.gray)}`);
58
- logger.out("");
59
- }
60
- logPackageSuccess(logger, index, total, pkgStats, generatedDistAssetCounts, verbose) {
61
- const progress = this.paint(`[${index}/${total}]`, ANSI.dim);
62
- logger.out(`${progress} ${this.paint("✓", ANSI.brightGreen)} ${this.paint(pkgStats.name, ANSI.bold)}`);
63
- if (verbose) {
64
- logger.out(` ${this.paint("├─", ANSI.dim)} Path: ${pkgStats.path}`);
65
- if (pkgStats.hasTransform) {
66
- logger.out(` ${this.paint("├─", ANSI.dim)} ${this.paint("Custom path transformation", ANSI.cyan)}`);
67
- }
68
- if (pkgStats.cssConfigStatus) {
69
- const status = pkgStats.cssConfigStatus === "disabled" ? "CSS disabled" : "CSS configured";
70
- logger.out(` ${this.paint("├─", ANSI.dim)} ${this.paint(status, ANSI.cyan)}`);
71
- }
72
- }
73
- const breakdown = [];
74
- if (generatedDistAssetCounts.jsCount > 0) {
75
- breakdown.push(this.paint(`${generatedDistAssetCounts.jsCount} modules`, ANSI.green));
76
- }
77
- if (generatedDistAssetCounts.cssCount > 0) {
78
- breakdown.push(this.paint(`${generatedDistAssetCounts.cssCount} CSS`, ANSI.magenta));
79
- }
80
- if (pkgStats.extraExports > 0) {
81
- breakdown.push(this.paint(`${pkgStats.extraExports} custom`, ANSI.yellow));
82
- }
83
- const totalExportsText = this.paint(`${pkgStats.totalExports} exports`, ANSI.brightCyan);
84
- if (breakdown.length === 0) {
85
- logger.out(` ${this.paint("└─", ANSI.dim)} ${totalExportsText}`);
86
- }
87
- else {
88
- logger.out(` ${this.paint("└─", ANSI.dim)} ${breakdown.join(" + ")} = ${totalExportsText}`);
89
- }
90
- logger.out("");
91
- }
92
- logPrunedStaleExport(logger, exportSpecifier) {
93
- logger.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Pruned stale export: ${exportSpecifier}`, ANSI.gray)}`);
94
- }
95
- logPackageError(logger, index, total, displayName, errorValue, verbose) {
96
- logger.out(`${this.paint(`[${index}/${total}]`, ANSI.dim)} ${this.paint("✗", ANSI.yellow)} ${this.paint(displayName, ANSI.bold)}`);
97
- logger.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Error: ${messageFrom(errorValue)}`, ANSI.yellow)}\n`);
98
- if (verbose) {
99
- logger.err(errorValue instanceof Error && errorValue.stack ? errorValue.stack : messageFrom(errorValue));
100
- }
101
- }
102
- mirrorSummarySeparator(logger) {
103
- logger.out(this.paint("═".repeat(60), ANSI.dim));
104
- }
105
- mirrorSummary(logger, stats, elapsedSeconds) {
106
- logger.out(`${this.paint("📊 Summary", ANSI.bold)} ${this.paint(`(completed in ${elapsedSeconds.toFixed(2)}s)`, ANSI.dim)}\n`);
107
- logger.out(` ${this.paint("Packages:", ANSI.bold)}`);
108
- logger.out(` ${this.paint("├─", ANSI.dim)} Processed: ${this.paint(String(stats.packagesProcessed), ANSI.green)}`);
109
- if (stats.packagesSkipped > 0) {
110
- logger.out(` ${this.paint("├─", ANSI.dim)} Skipped: ${this.paint(String(stats.packagesSkipped), ANSI.gray)}`);
111
- }
112
- if (stats.packagesErrored > 0) {
113
- logger.out(` ${this.paint("├─", ANSI.dim)} Errors: ${this.paint(String(stats.packagesErrored), ANSI.yellow)}`);
114
- }
115
- logger.out(` ${this.paint("└─", ANSI.dim)} Total found: ${stats.packagesFound}\n`);
116
- logger.out(` ${this.paint("Exports:", ANSI.bold)}`);
117
- logger.out(` ${this.paint("├─", ANSI.dim)} JS Modules: ${this.paint(String(stats.totalJsModules), ANSI.cyan)}`);
118
- logger.out(` ${this.paint("├─", ANSI.dim)} CSS Files: ${this.paint(String(stats.totalCssExports), ANSI.magenta)}`);
119
- logger.out(` ${this.paint("└─", ANSI.dim)} Total: ${this.paint(String(stats.totalExports), ANSI.brightCyan)}\n`);
120
- logger.out(`${this.paint("═".repeat(60), ANSI.dim)}\n`);
121
- }
122
- paint(text, openSequence) {
123
- if (!this.colorsAreEnabled) {
124
- return text;
125
- }
126
- return `${openSequence}${text}${ANSI.reset}`;
127
- }
128
- }
@@ -1,43 +0,0 @@
1
- import type { GlobalStats, PackageStats, WorkspaceMultiDiscoverySource } from "#/mirror/domain/types";
2
- /**
3
- * The inputs a mirror run is invoked with.
4
- *
5
- * @since 0.3.16-canary.0
6
- */
7
- export type MirrorSyncRunRequest = {
8
- rootDir: string;
9
- packageFilter?: string | undefined;
10
- config?: unknown;
11
- /** When false, compute and report changes without writing package.json. Defaults to true. */
12
- write?: boolean | undefined;
13
- };
14
- /**
15
- * Callbacks a mirror run invokes as it progresses through packages.
16
- *
17
- * @since 0.3.16-canary.0
18
- */
19
- export type MirrorSyncProgressListener = {
20
- configure(options: {
21
- readonly noColor: boolean;
22
- readonly verbose: boolean;
23
- readonly dryRun: boolean;
24
- }): void;
25
- onBanner(): void;
26
- onProcessingMode(mode: {
27
- readonly kind: "single";
28
- } | {
29
- readonly kind: "multi";
30
- readonly source: WorkspaceMultiDiscoverySource;
31
- }): void;
32
- onNoPackages(): void;
33
- onPackageComplete(pkgStats: PackageStats, ordinal: number, total: number): void;
34
- onComplete(stats: GlobalStats, elapsedSeconds: number): void;
35
- };
36
- /**
37
- * A run request paired with an optional progress listener.
38
- *
39
- * @since 0.3.16-canary.0
40
- */
41
- export type MirrorSyncExecutionInput = MirrorSyncRunRequest & {
42
- readonly listener?: MirrorSyncProgressListener | undefined;
43
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- import { AppError } from "#/core/errors";
2
- import type { FilesystemPort } from "#/core/filesystem/port";
3
- import type { Result } from "#/core/result";
4
- import type { GlobalStats } from "#/mirror/domain/types";
5
- import type { MirrorSyncExecutionInput } from "#/mirror/sync-types";
6
- export type { MirrorSyncExecutionInput } from "#/mirror/sync-types";
7
- /**
8
- * Runs the mirror sync across the targeted packages and returns the aggregate stats.
9
- *
10
- * @since 0.3.16-canary.0
11
- */
12
- export declare function runMirrorSync(fs: FilesystemPort, input: MirrorSyncExecutionInput): Promise<Result<GlobalStats, AppError>>;
@@ -1,42 +0,0 @@
1
- import { AppError } from "#/core/errors";
2
- import type { FilesystemPort } from "#/core/filesystem/port";
3
- import type { Result } from "#/core/result";
4
- import type { TagProgressListener, TagSyncResult, TagTargetCandidate } from "#/tag/domain/types";
5
- /**
6
- * The inputs a tag run is invoked with.
7
- *
8
- * @since 0.3.16-canary.0
9
- */
10
- export type TagSyncRunRequest = {
11
- rootDir: string;
12
- write: boolean;
13
- json?: boolean | undefined;
14
- targetPath?: string | undefined;
15
- skipPackages?: Array<string> | undefined;
16
- config?: unknown;
17
- };
18
- /**
19
- * A run request paired with an optional progress listener.
20
- *
21
- * @since 0.3.16-canary.0
22
- */
23
- export type TagSyncExecutionInput = TagSyncRunRequest & {
24
- readonly listener?: TagProgressListener | undefined;
25
- };
26
- /**
27
- * Runs the tag sync across the selected targets and returns the aggregate result.
28
- *
29
- * @since 0.3.16-canary.0
30
- */
31
- export declare function runTagSync(fs: FilesystemPort, input: TagSyncExecutionInput): Promise<Result<TagSyncResult, AppError>>;
32
- /**
33
- * Partition tag target candidates into those to tag and those to skip, matching
34
- * each candidate's package name against `skipPackages` as glob patterns.
35
- * Candidates without a package name (e.g. an explicit-target path) are never skipped.
36
- *
37
- * @since 0.5.0-canary.0
38
- */
39
- export declare function filterSkippedCandidates(targetCandidates: Array<TagTargetCandidate>, skipPackages: ReadonlyArray<string> | undefined): {
40
- includedCandidates: Array<TagTargetCandidate>;
41
- skippedPackages: Array<string>;
42
- };
@@ -1,8 +0,0 @@
1
- import type { FilesystemPort } from "#/core/filesystem/port";
2
- import type { TagTargetCandidate } from "#/tag/domain/types";
3
- /**
4
- * Resolves the candidate targets for a tag run: the explicit target, or the discovered workspace packages.
5
- *
6
- * @since 0.3.16-canary.0
7
- */
8
- export declare function resolveTagTargetCandidates(fs: FilesystemPort, rootDir: string, explicitTarget: string | undefined): Promise<Array<TagTargetCandidate>>;
@@ -1,8 +0,0 @@
1
- import type { FilesystemPort } from "#/core/filesystem/port";
2
- import type { TagRunOptions, TagRunResult } from "#/tag/domain/types";
3
- /**
4
- * Stamps `@since` tags across one target's TypeScript files and returns the run result.
5
- *
6
- * @since 0.3.16-canary.0
7
- */
8
- export declare function runTagOnTarget(fs: FilesystemPort, targetPath: string, opts: TagRunOptions): TagRunResult;
File without changes
File without changes
File without changes
File without changes