@smoothbricks/nx-plugin 0.5.7 → 0.6.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 (432) hide show
  1. package/README.md +1086 -360
  2. package/dist/.build-inputs.json +138 -0
  3. package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
  4. package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
  5. package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
  6. package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
  7. package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
  8. package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
  9. package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
  10. package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
  11. package/dist/bin/smoo-nx-nextest-timings.js +28 -0
  12. package/dist/bounded-test-policy.d.ts +1 -1
  13. package/dist/bounded-test-policy.d.ts.map +1 -1
  14. package/dist/bounded-test-policy.js +14 -15
  15. package/dist/build-state-output-policy.d.ts +95 -1
  16. package/dist/build-state-output-policy.d.ts.map +1 -1
  17. package/dist/build-state-output-policy.js +368 -30
  18. package/dist/bun-lock-scope.d.ts +44 -0
  19. package/dist/bun-lock-scope.d.ts.map +1 -0
  20. package/dist/bun-lock-scope.js +97 -0
  21. package/dist/cargo-build-script-env.d.ts +49 -0
  22. package/dist/cargo-build-script-env.d.ts.map +1 -0
  23. package/dist/cargo-build-script-env.js +324 -0
  24. package/dist/cargo-closure-input.d.ts +31 -4
  25. package/dist/cargo-closure-input.d.ts.map +1 -1
  26. package/dist/cargo-closure-input.js +66 -6
  27. package/dist/cargo-retention-hook.d.ts +17 -0
  28. package/dist/cargo-retention-hook.d.ts.map +1 -0
  29. package/dist/cargo-retention-hook.js +85 -0
  30. package/dist/cargo-source-hash.d.ts +25 -7
  31. package/dist/cargo-source-hash.d.ts.map +1 -1
  32. package/dist/cargo-source-hash.js +108 -43
  33. package/dist/cargo-toolchain-paths.d.ts +40 -0
  34. package/dist/cargo-toolchain-paths.d.ts.map +1 -0
  35. package/dist/cargo-toolchain-paths.js +84 -0
  36. package/dist/cargo-toolchain-policy.d.ts +25 -8
  37. package/dist/cargo-toolchain-policy.d.ts.map +1 -1
  38. package/dist/cargo-toolchain-policy.js +39 -5
  39. package/dist/cargo-workspace.d.ts +10 -4
  40. package/dist/cargo-workspace.d.ts.map +1 -1
  41. package/dist/cargo-workspace.js +65 -95
  42. package/dist/cross-check-policy.d.ts +9 -9
  43. package/dist/cross-check-policy.d.ts.map +1 -1
  44. package/dist/cross-check-policy.js +11 -11
  45. package/dist/disk-command-policy.d.ts.map +1 -1
  46. package/dist/disk-command-policy.js +1 -0
  47. package/dist/ensure-built-receipt.d.ts +13 -5
  48. package/dist/ensure-built-receipt.d.ts.map +1 -1
  49. package/dist/ensure-built-receipt.js +126 -47
  50. package/dist/ensure-built-witness.d.ts +27 -8
  51. package/dist/ensure-built-witness.d.ts.map +1 -1
  52. package/dist/ensure-built-witness.js +45 -15
  53. package/dist/ensure-built.d.ts.map +1 -1
  54. package/dist/ensure-built.js +9 -1
  55. package/dist/eslint-config-closure.d.ts +7 -0
  56. package/dist/eslint-config-closure.d.ts.map +1 -0
  57. package/dist/eslint-config-closure.js +346 -0
  58. package/dist/executors/bounded-exec/bounds.d.ts +56 -0
  59. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
  60. package/dist/executors/bounded-exec/bounds.js +43 -0
  61. package/dist/executors/bounded-exec/cpu-pool.d.ts +33 -36
  62. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  63. package/dist/executors/bounded-exec/cpu-pool.js +54 -119
  64. package/dist/executors/bounded-exec/executor.d.ts +19 -12
  65. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  66. package/dist/executors/bounded-exec/executor.js +371 -239
  67. package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
  68. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
  69. package/dist/executors/bounded-exec/gateway-lease.js +81 -28
  70. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
  71. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  72. package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
  73. package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
  74. package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
  75. package/dist/executors/bounded-exec/lease-wait.js +68 -0
  76. package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
  77. package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
  78. package/dist/executors/bounded-exec/lock-wait.js +108 -0
  79. package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
  80. package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
  81. package/dist/executors/bounded-exec/owned-subtree.js +178 -0
  82. package/dist/executors/bounded-exec/progress.d.ts +4 -1
  83. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  84. package/dist/executors/bounded-exec/progress.js +5 -2
  85. package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
  86. package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
  87. package/dist/executors/bounded-exec/ram-attach.js +207 -0
  88. package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
  89. package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
  90. package/dist/executors/bounded-exec/ram-detach.js +207 -0
  91. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
  92. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
  93. package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
  94. package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
  95. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  96. package/dist/executors/bounded-exec/ram-temp.js +1213 -399
  97. package/dist/executors/bounded-exec/run-cpu-pool.d.ts +4 -4
  98. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
  99. package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
  100. package/dist/executors/bounded-exec/runner-hook.js +14 -5
  101. package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
  102. package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
  103. package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
  104. package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
  105. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
  106. package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
  107. package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
  108. package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
  109. package/dist/executors/bounded-exec/runtime-pin.js +167 -0
  110. package/dist/executors/bounded-exec/schema.d.ts +18 -1
  111. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  112. package/dist/executors/bounded-exec/verdict.d.ts +40 -11
  113. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  114. package/dist/executors/bounded-exec/verdict.js +88 -19
  115. package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
  116. package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
  117. package/dist/executors/cargo-zigbuild/executor.js +67 -12
  118. package/dist/executors/clean-outputs/executor.js +1 -0
  119. package/dist/executors/scriptc-native/executor.d.ts +79 -0
  120. package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
  121. package/dist/executors/scriptc-native/executor.js +367 -0
  122. package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
  123. package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
  124. package/dist/executors/scriptc-native/ffi-paths.js +25 -0
  125. package/dist/executors/scriptc-native/schema.d.ts +34 -0
  126. package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
  127. package/dist/executors/scriptc-native/schema.js +1 -0
  128. package/dist/executors/typescript-emit/executor.d.ts +3 -1
  129. package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
  130. package/dist/executors/typescript-emit/executor.js +164 -33
  131. package/dist/forbidden-spelling-policy.d.ts +56 -0
  132. package/dist/forbidden-spelling-policy.d.ts.map +1 -0
  133. package/dist/forbidden-spelling-policy.js +176 -0
  134. package/dist/generators/create-package/generator.d.ts.map +1 -1
  135. package/dist/generators/create-package/generator.js +3 -4
  136. package/dist/graph-input-contract.d.ts +14 -0
  137. package/dist/graph-input-contract.d.ts.map +1 -1
  138. package/dist/graph-input-contract.js +67 -2
  139. package/dist/index.d.ts +23 -6
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +672 -214
  142. package/dist/managed-assets.d.ts +2 -0
  143. package/dist/managed-assets.d.ts.map +1 -1
  144. package/dist/managed-files/files.d.ts +3 -3
  145. package/dist/managed-files/files.d.ts.map +1 -1
  146. package/dist/managed-files/files.js +28 -3
  147. package/dist/managed-files/managed-format.d.ts.map +1 -1
  148. package/dist/managed-files/managed-format.js +1 -0
  149. package/dist/nextest-code-bound.js +1 -0
  150. package/dist/nextest-timings.d.ts +35 -0
  151. package/dist/nextest-timings.d.ts.map +1 -0
  152. package/dist/nextest-timings.js +168 -0
  153. package/dist/owned-installation.d.ts +6 -5
  154. package/dist/owned-installation.d.ts.map +1 -1
  155. package/dist/owned-installation.js +150 -26
  156. package/dist/package-target-policy.d.ts.map +1 -1
  157. package/dist/package-target-policy.js +2 -3
  158. package/dist/process-children.d.ts +7 -0
  159. package/dist/process-children.d.ts.map +1 -0
  160. package/dist/process-children.darwin.d.ts +7 -0
  161. package/dist/process-children.darwin.d.ts.map +1 -0
  162. package/dist/process-children.darwin.js +13 -0
  163. package/dist/process-children.js +14 -0
  164. package/dist/process-children.linux.d.ts +8 -0
  165. package/dist/process-children.linux.d.ts.map +1 -0
  166. package/dist/process-children.linux.js +25 -0
  167. package/dist/process-group.d.ts +108 -0
  168. package/dist/process-group.d.ts.map +1 -0
  169. package/dist/process-group.js +171 -0
  170. package/dist/process-listing.d.ts +7 -0
  171. package/dist/process-listing.d.ts.map +1 -0
  172. package/dist/process-listing.js +51 -0
  173. package/dist/producer-receipts.d.ts +8 -2
  174. package/dist/producer-receipts.d.ts.map +1 -1
  175. package/dist/producer-receipts.js +75 -48
  176. package/dist/task-graph-policy.d.ts +21 -0
  177. package/dist/task-graph-policy.d.ts.map +1 -0
  178. package/dist/task-graph-policy.js +91 -0
  179. package/dist/test-timings.js +4 -4
  180. package/dist/test-walk-policy.d.ts +14 -5
  181. package/dist/test-walk-policy.d.ts.map +1 -1
  182. package/dist/test-walk-policy.js +8 -2
  183. package/dist/testing.d.ts +73 -28
  184. package/dist/testing.d.ts.map +1 -1
  185. package/dist/testing.js +217 -223
  186. package/dist/tool-bins.d.ts +33 -0
  187. package/dist/tool-bins.d.ts.map +1 -0
  188. package/dist/tool-bins.js +72 -0
  189. package/dist/typecheck-test-policy.d.ts.map +1 -1
  190. package/dist/typecheck-test-policy.js +3 -4
  191. package/dist/wait-why-policy.d.ts +28 -0
  192. package/dist/wait-why-policy.d.ts.map +1 -0
  193. package/dist/wait-why-policy.js +223 -0
  194. package/dist/workspace-config-policy.d.ts +14 -8
  195. package/dist/workspace-config-policy.d.ts.map +1 -1
  196. package/dist/workspace-config-policy.js +60 -16
  197. package/dist/workspace-manifest.d.ts +41 -6
  198. package/dist/workspace-manifest.d.ts.map +1 -1
  199. package/dist/workspace-manifest.js +57 -0
  200. package/executors.json +16 -1
  201. package/loader.js +2 -0
  202. package/managed/raw/envrc +11 -0
  203. package/managed/raw/patches/nx@23.2.1.patch +2840 -199
  204. package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
  205. package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
  206. package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
  207. package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
  208. package/managed/raw/tooling/direnv/developer-links.ts +464 -25
  209. package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
  210. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
  211. package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
  212. package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
  213. package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
  214. package/managed/raw/tooling/direnv/repo-path +68 -6
  215. package/managed/raw/tooling/direnv/secret-references.ts +13 -4
  216. package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
  217. package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
  218. package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
  219. package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
  220. package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
  221. package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
  222. package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
  223. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
  224. package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
  225. package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
  226. package/package.json +77 -13
  227. package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
  228. package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
  229. package/src/bin/smoo-nx-nextest-timings.ts +31 -0
  230. package/src/bounded-test-policy.ts +12 -14
  231. package/src/build-state-output-policy.ts +458 -34
  232. package/src/bun-lock-scope.ts +108 -0
  233. package/src/cargo-build-script-env.ts +265 -0
  234. package/src/cargo-closure-input.ts +74 -7
  235. package/src/cargo-retention-hook.ts +94 -0
  236. package/src/cargo-source-hash.ts +138 -41
  237. package/src/cargo-toolchain-paths.ts +95 -0
  238. package/src/cargo-toolchain-policy.ts +49 -5
  239. package/src/cargo-workspace.ts +72 -123
  240. package/src/cross-check-policy.ts +12 -10
  241. package/src/disk-command-policy.ts +1 -0
  242. package/src/ensure-built-receipt.ts +132 -39
  243. package/src/ensure-built-witness.ts +62 -10
  244. package/src/ensure-built.ts +11 -1
  245. package/src/eslint-config-closure.ts +357 -0
  246. package/src/executors/bounded-exec/bounds.ts +76 -0
  247. package/src/executors/bounded-exec/cpu-pool.ts +51 -117
  248. package/src/executors/bounded-exec/executor.ts +423 -259
  249. package/src/executors/bounded-exec/gateway-lease.ts +82 -33
  250. package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
  251. package/src/executors/bounded-exec/lease-wait.ts +89 -0
  252. package/src/executors/bounded-exec/lock-wait.ts +141 -0
  253. package/src/executors/bounded-exec/owned-subtree.ts +235 -0
  254. package/src/executors/bounded-exec/progress.ts +9 -3
  255. package/src/executors/bounded-exec/ram-attach.ts +238 -0
  256. package/src/executors/bounded-exec/ram-detach.ts +226 -0
  257. package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
  258. package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
  259. package/src/executors/bounded-exec/ram-temp.ts +1497 -460
  260. package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
  261. package/src/executors/bounded-exec/runner-hook.ts +14 -6
  262. package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
  263. package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
  264. package/src/executors/bounded-exec/runtime-pin.ts +232 -0
  265. package/src/executors/bounded-exec/schema.json +11 -2
  266. package/src/executors/bounded-exec/schema.ts +19 -1
  267. package/src/executors/bounded-exec/verdict.ts +137 -34
  268. package/src/executors/cargo-zigbuild/executor.ts +82 -8
  269. package/src/executors/clean-outputs/executor.ts +1 -0
  270. package/src/executors/scriptc-native/executor.ts +394 -0
  271. package/src/executors/scriptc-native/ffi-paths.ts +29 -0
  272. package/src/executors/scriptc-native/schema.json +60 -0
  273. package/src/executors/scriptc-native/schema.ts +34 -0
  274. package/src/executors/typescript-emit/executor.ts +205 -38
  275. package/src/forbidden-spelling-policy.ts +226 -0
  276. package/src/generators/create-package/generator.ts +7 -7
  277. package/src/graph-input-contract.ts +61 -2
  278. package/src/index.ts +788 -224
  279. package/src/managed-assets.ts +3 -0
  280. package/src/managed-files/files.ts +28 -3
  281. package/src/managed-files/managed-format.ts +1 -0
  282. package/src/nextest-code-bound.ts +1 -0
  283. package/src/nextest-timings.ts +106 -0
  284. package/src/owned-installation.ts +150 -23
  285. package/src/package-target-policy.ts +2 -3
  286. package/src/process-children.darwin.ts +14 -0
  287. package/src/process-children.linux.ts +33 -0
  288. package/src/process-children.ts +22 -0
  289. package/src/process-group.ts +209 -0
  290. package/src/process-listing.ts +54 -0
  291. package/src/producer-receipts.ts +68 -45
  292. package/src/task-graph-policy.ts +98 -0
  293. package/src/test-walk-policy.ts +23 -8
  294. package/src/testing.ts +240 -232
  295. package/src/tool-bins.ts +108 -0
  296. package/src/typecheck-test-policy.ts +2 -3
  297. package/src/wait-why-policy.ts +226 -0
  298. package/src/workspace-config-policy.ts +63 -15
  299. package/src/workspace-manifest.ts +89 -6
  300. package/test-timings.json +122 -98
  301. package/dist/bin/smoo-nx-failures.d.ts +0 -3
  302. package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
  303. package/dist/bin/smoo-nx-failures.js +0 -3
  304. package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
  305. package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
  306. package/dist/bin/smoo-nx-nextest-extract.js +0 -42
  307. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
  308. package/dist/failure-summary.d.ts +0 -5
  309. package/dist/failure-summary.d.ts.map +0 -1
  310. package/dist/failure-summary.js +0 -118
  311. package/dist/nextest-extraction.d.ts +0 -117
  312. package/dist/nextest-extraction.d.ts.map +0 -1
  313. package/dist/nextest-extraction.js +0 -303
  314. package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
  315. package/src/__tests__/cargo-closure-filesets.ts +0 -94
  316. package/src/__tests__/cargo-closure-fixture.ts +0 -113
  317. package/src/__tests__/counted-cargo-process.ts +0 -286
  318. package/src/__tests__/counted-cargo.ts +0 -713
  319. package/src/__tests__/directory-change.ts +0 -27
  320. package/src/__tests__/fixture-cargo-home.ts +0 -36
  321. package/src/__tests__/fixture-nx-env.ts +0 -193
  322. package/src/__tests__/owned-installation.ts +0 -13
  323. package/src/__tests__/past-tick.ts +0 -12
  324. package/src/__tests__/progress-clock.ts +0 -43
  325. package/src/__tests__/runtime-input.ts +0 -23
  326. package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
  327. package/src/bin/smoo-nx-failures.ts +0 -4
  328. package/src/bin/smoo-nx-nextest-extract.ts +0 -44
  329. package/src/bounded-test-policy.test.ts +0 -1029
  330. package/src/build-state-output-policy.test.ts +0 -115
  331. package/src/bun-bootstrap.test.ts +0 -102
  332. package/src/bun-file-packages.test.ts +0 -47
  333. package/src/cargo-closure-filesets.test.ts +0 -63
  334. package/src/cargo-closure-input.property.test.ts +0 -50
  335. package/src/cargo-closure-input.test.ts +0 -506
  336. package/src/cargo-closure-key.test.ts +0 -240
  337. package/src/cargo-resolve-cache.test.ts +0 -1181
  338. package/src/cargo-source-hash.test.ts +0 -707
  339. package/src/cargo-workspace.test.ts +0 -615
  340. package/src/cross-check-policy.test.ts +0 -316
  341. package/src/disk-command-policy.test.ts +0 -61
  342. package/src/ensure-built-receipt.test.ts +0 -279
  343. package/src/ensure-built-witness.test.ts +0 -688
  344. package/src/ensure-built.test.ts +0 -1462
  345. package/src/executors/all-verdicts/executor.test.ts +0 -135
  346. package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
  347. package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
  348. package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
  349. package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
  350. package/src/executors/bounded-exec/executor-host.test.ts +0 -800
  351. package/src/executors/bounded-exec/executor.test.ts +0 -1819
  352. package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
  353. package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
  354. package/src/executors/bounded-exec/progress.test.ts +0 -139
  355. package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
  356. package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
  357. package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
  358. package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
  359. package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
  360. package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
  361. package/src/executors/bounded-exec/verdict.test.ts +0 -545
  362. package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
  363. package/src/executors/clean-outputs/executor.test.ts +0 -20
  364. package/src/executors/typescript-emit/executor.test.ts +0 -83
  365. package/src/failure-summary.ts +0 -119
  366. package/src/generators/bounded-test-targets/generator.test.ts +0 -138
  367. package/src/generators/bun-test-tracing/generator.test.ts +0 -250
  368. package/src/generators/create-package/generator.test.ts +0 -190
  369. package/src/generators/make-public/generator.test.ts +0 -137
  370. package/src/graph-input-contract.test.ts +0 -379
  371. package/src/host-controller-wiring.test.ts +0 -31
  372. package/src/index.test.ts +0 -3321
  373. package/src/linked-snapshots.nx.test.ts +0 -254
  374. package/src/managed-files/forgejo-artifact.test.ts +0 -395
  375. package/src/managed-files/generator.test.ts +0 -243
  376. package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
  377. package/src/managed-files/json-edit.test.ts +0 -216
  378. package/src/managed-files/managed-content.test.ts +0 -166
  379. package/src/managed-files/managed-format-json.test.ts +0 -308
  380. package/src/managed-files/repo-path.test.ts +0 -172
  381. package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
  382. package/src/managed-files/trace-db-artifact.test.ts +0 -7
  383. package/src/managed-files/tree-permissions.test.ts +0 -109
  384. package/src/managed-files/tree.test.ts +0 -123
  385. package/src/manifest-hash.test.ts +0 -219
  386. package/src/nextest-code-bound.test.ts +0 -161
  387. package/src/nextest-extraction.test.ts +0 -216
  388. package/src/nextest-extraction.ts +0 -371
  389. package/src/nextest-partitions.test.ts +0 -501
  390. package/src/nx-cache-bound.test.ts +0 -109
  391. package/src/nx-cache-restore-mtime.test.ts +0 -170
  392. package/src/nx-daemon-claim.test.ts +0 -279
  393. package/src/nx-daemon-idle-cpu.test.ts +0 -80
  394. package/src/nx-daemon-idle-policy.test.ts +0 -111
  395. package/src/nx-daemon-ignore-files.test.ts +0 -210
  396. package/src/nx-daemon-root-normalization.test.ts +0 -105
  397. package/src/nx-daemon-start-never.test.ts +0 -292
  398. package/src/nx-daemon-validity.test.ts +0 -1055
  399. package/src/nx-dot-input-policy.test.ts +0 -353
  400. package/src/nx-failure-life-cycles.test.ts +0 -207
  401. package/src/nx-files-archive-racy.test.ts +0 -97
  402. package/src/nx-foreign-workspace-env.test.ts +0 -329
  403. package/src/nx-incomplete-run-summary.test.ts +0 -70
  404. package/src/nx-plugin-load-errors.test.ts +0 -120
  405. package/src/nx-project-graph-errors.test.ts +0 -70
  406. package/src/nx-project-resolution-cache.test.ts +0 -176
  407. package/src/nx-raw-inputs.test.ts +0 -166
  408. package/src/nx-resident-graph-workers.test.ts +0 -112
  409. package/src/nx-run-information.test.ts +0 -118
  410. package/src/nx-skipped-task-exit.test.ts +0 -180
  411. package/src/nx-state-location.test.ts +0 -63
  412. package/src/nx-store-resolution.test.ts +0 -81
  413. package/src/nx-task-graph-cycles.test.ts +0 -148
  414. package/src/nx-task-output-lease.test.ts +0 -550
  415. package/src/nx-use-local.test.ts +0 -105
  416. package/src/owned-installation.test.ts +0 -105
  417. package/src/package-target-policy.test.ts +0 -1014
  418. package/src/producer-receipts.test.ts +0 -285
  419. package/src/release-config-policy.test.ts +0 -311
  420. package/src/runtime-input.test.ts +0 -393
  421. package/src/serial-group-wiring.test.ts +0 -326
  422. package/src/task-history-namespace.test.ts +0 -181
  423. package/src/task-results.test.ts +0 -228
  424. package/src/test-clock-policy.test.ts +0 -338
  425. package/src/test-program.test.ts +0 -303
  426. package/src/test-timings.test.ts +0 -240
  427. package/src/test-walk-policy.test.ts +0 -620
  428. package/src/testing.test.ts +0 -509
  429. package/src/typecheck-test-policy.test.ts +0 -1468
  430. package/src/typescript-resolution.test.ts +0 -76
  431. package/src/version-actions.test.ts +0 -80
  432. package/src/workspace-config-policy.test.ts +0 -737
@@ -1,166 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
- import fc from 'fast-check';
3
- import {
4
- extractInlineLocalBlocks,
5
- INLINE_LOCAL_BEGIN,
6
- INLINE_LOCAL_END,
7
- LOCAL_SECTION_MARKER,
8
- reinsertInlineLocalBlocks,
9
- splitLocalSection,
10
- } from './managed-content.js';
11
-
12
- const MANAGED = '# managed content\npath merge=driver\n';
13
-
14
- describe('managed-file local sections', () => {
15
- it('content without a marker is entirely managed', () => {
16
- const { managed, localTail } = splitLocalSection(MANAGED);
17
- expect(managed).toBe(MANAGED);
18
- expect(localTail).toBe('');
19
- });
20
-
21
- it('everything from the marker onward is the repo-owned tail', () => {
22
- const tail = `${LOCAL_SECTION_MARKER}\ncustom/*.jsonl merge=custom-log\n`;
23
- const { managed, localTail } = splitLocalSection(`${MANAGED}\n${tail}`);
24
- expect(managed).toBe(`${MANAGED}\n`);
25
- expect(localTail).toBe(tail);
26
- });
27
-
28
- it('a tail directly after the managed content tolerates the separating newline', () => {
29
- // The compare rule accepts `managed === content + '\n'` when a tail exists,
30
- // so update → check round-trips as unchanged.
31
- const written = `${MANAGED}\n${LOCAL_SECTION_MARKER}\nextra\n`;
32
- const { managed, localTail } = splitLocalSection(written);
33
- expect(managed).toBe(`${MANAGED}\n`);
34
- expect(localTail.startsWith(LOCAL_SECTION_MARKER)).toBe(true);
35
- });
36
- });
37
-
38
- describe('managed-file inline local blocks', () => {
39
- it('content with no inline markers extracts as fully managed, no blocks', () => {
40
- const { withoutInline, blocks } = extractInlineLocalBlocks(MANAGED);
41
- expect(withoutInline).toBe(MANAGED);
42
- expect(blocks).toEqual([]);
43
- });
44
-
45
- it('a wrapped block is extracted and removed, anchored on the preceding line', () => {
46
- const current = ['a:', ' - one', ' - two', INLINE_LOCAL_BEGIN, ' - repo-owned', INLINE_LOCAL_END, 'b:'].join(
47
- '\n',
48
- );
49
- const { withoutInline, blocks } = extractInlineLocalBlocks(current);
50
- expect(withoutInline).toBe(['a:', ' - one', ' - two', 'b:'].join('\n'));
51
- expect(blocks).toEqual([{ anchor: ' - two', lines: ' - repo-owned' }]);
52
- });
53
-
54
- it('multiple blocks each anchor to their own preceding line', () => {
55
- const current = [
56
- 'x',
57
- INLINE_LOCAL_BEGIN,
58
- 'first',
59
- INLINE_LOCAL_END,
60
- 'y',
61
- INLINE_LOCAL_BEGIN,
62
- 'second',
63
- INLINE_LOCAL_END,
64
- 'z',
65
- ].join('\n');
66
- const { withoutInline, blocks } = extractInlineLocalBlocks(current);
67
- expect(withoutInline).toBe(['x', 'y', 'z'].join('\n'));
68
- expect(blocks).toEqual([
69
- { anchor: 'x', lines: 'first' },
70
- { anchor: 'y', lines: 'second' },
71
- ]);
72
- });
73
-
74
- it('a begin marker with no preceding line throws rather than silently dropping content', () => {
75
- const current = [INLINE_LOCAL_BEGIN, 'orphan', INLINE_LOCAL_END].join('\n');
76
- expect(() => extractInlineLocalBlocks(current)).toThrow(/no preceding anchor/);
77
- });
78
-
79
- it('an unterminated begin marker throws rather than silently dropping content', () => {
80
- const current = ['a', INLINE_LOCAL_BEGIN, 'unterminated'].join('\n');
81
- expect(() => extractInlineLocalBlocks(current)).toThrow(/no matching/);
82
- });
83
-
84
- it('reinserting into fresh content with no blocks is a no-op', () => {
85
- expect(reinsertInlineLocalBlocks(MANAGED, [])).toBe(MANAGED);
86
- });
87
-
88
- it('reinserting splices the block back after its anchor in freshly rendered content', () => {
89
- const fresh = ['a:', ' - one', ' - two', 'b:'].join('\n');
90
- const result = reinsertInlineLocalBlocks(fresh, [{ anchor: ' - two', lines: ' - repo-owned' }]);
91
- expect(result).toBe(
92
- ['a:', ' - one', ' - two', INLINE_LOCAL_BEGIN, ' - repo-owned', INLINE_LOCAL_END, 'b:'].join('\n'),
93
- );
94
- });
95
-
96
- it('fences a TypeScript managed file with // markers and re-emits the same prefix', () => {
97
- // setup-environment.ts is a managed TypeScript file; `# smoo-local-begin`
98
- // is not a comment there. A repo-owned block (the dev-links re-link after
99
- // install) used `//` fences that the update never recognised and dropped.
100
- const current = [
101
- 'const a = 1;',
102
- '// smoo-local-begin',
103
- 'linkDevPackages();',
104
- '// smoo-local-end',
105
- 'const b = 2;',
106
- ].join('\n');
107
- const { withoutInline, blocks } = extractInlineLocalBlocks(current);
108
- expect(withoutInline).toBe(['const a = 1;', 'const b = 2;'].join('\n'));
109
- expect(blocks).toEqual([{ anchor: 'const a = 1;', lines: 'linkDevPackages();', markerPrefix: '//' }]);
110
- expect(reinsertInlineLocalBlocks(['const a = 1;', 'const b = 3;'].join('\n'), blocks)).toBe(
111
- ['const a = 1;', '// smoo-local-begin', 'linkDevPackages();', '// smoo-local-end', 'const b = 3;'].join('\n'),
112
- );
113
- });
114
-
115
- it('preserves marker indentation when refreshing nested configuration', () => {
116
- const markerIndent = ' ';
117
- const current = [
118
- 'patterns:',
119
- " - '*.html'",
120
- `${markerIndent}${INLINE_LOCAL_BEGIN}`,
121
- " - '!**/templates/*.html'",
122
- `${markerIndent}${INLINE_LOCAL_END}`,
123
- ].join('\n');
124
- const { withoutInline, blocks } = extractInlineLocalBlocks(current);
125
- expect(reinsertInlineLocalBlocks(withoutInline, blocks)).toBe(current);
126
- });
127
-
128
- it("reinserting refuses when the anchor no longer appears — never silently drops the repo's customization", () => {
129
- const fresh = ['a:', ' - one', 'b:'].join('\n'); // ' - two' is gone
130
- expect(() => reinsertInlineLocalBlocks(fresh, [{ anchor: ' - two', lines: ' - repo-owned' }])).toThrow(
131
- /matches no line/,
132
- );
133
- });
134
-
135
- it('reinserting refuses an ambiguous multiply occurring anchor', () => {
136
- const fresh = ['anchor', 'middle', 'anchor'].join('\n');
137
- expect(() => reinsertInlineLocalBlocks(fresh, [{ anchor: 'anchor', lines: 'repo-owned' }])).toThrow(
138
- /matches 2 lines/,
139
- );
140
- });
141
-
142
- it('property: extract then reinsert round-trips to the original for unique, single-occurrence anchors', () => {
143
- // Lines that can serve as anchors: non-empty, not a marker, and each drawn
144
- // from a small alphabet so uniqueness is checkable — the round-trip only
145
- // holds when an anchor line occurs exactly once in the managed section
146
- // because ambiguous anchors are rejected rather than selecting one.
147
- const linePool = fc.constantFrom('alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta');
148
- fc.assert(
149
- fc.property(
150
- fc.uniqueArray(linePool, { minLength: 1, maxLength: 6 }),
151
- fc.array(fc.string(), { maxLength: 3 }),
152
- (anchors, blockLinesFlat) => {
153
- const blockLines = blockLinesFlat.length > 0 ? [blockLinesFlat.join('|') || 'x'] : ['x'];
154
- const fresh = anchors.join('\n');
155
- const withBlocks = anchors
156
- .map((anchor) => [anchor, INLINE_LOCAL_BEGIN, ...blockLines, INLINE_LOCAL_END].join('\n'))
157
- .join('\n');
158
- const { withoutInline, blocks } = extractInlineLocalBlocks(withBlocks);
159
- expect(withoutInline).toBe(fresh);
160
- const reinserted = reinsertInlineLocalBlocks(fresh, blocks);
161
- expect(reinserted).toBe(withBlocks);
162
- },
163
- ),
164
- );
165
- });
166
- });
@@ -1,308 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
- import { spawnSync } from 'node:child_process';
3
- import { chmod, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
4
- import { tmpdir } from 'node:os';
5
- import { dirname, join } from 'node:path';
6
- import { FsTree, flushChanges } from 'nx/src/generators/tree.js';
7
- import typia from 'typia';
8
- import { applyWorkspaceBoundedTestTargetPolicy } from '../bounded-test-policy.js';
9
- import { managedAssetsRoot } from '../managed-assets.js';
10
- import { applyPackageTargetPolicy } from '../package-target-policy.js';
11
- import { applyReleaseConfigPolicy } from '../release-config-policy.js';
12
- import { renderTypecheckTestFiles } from '../typecheck-test-policy.js';
13
- import { applyWorkspaceConfigPolicy } from '../workspace-config-policy.js';
14
- import { biomeHookArguments, formatJsonWithBiome, jsonFileText, writeJsonFile } from './managed-format.js';
15
- import { inspectManagedPaths } from './paths.js';
16
- import { assertNoManagedConflicts, stageManagedFiles } from './tree.js';
17
-
18
- /** What a consumer's repository formats JSON as: the shape this repository's own biome.json declares. */
19
- const SPACED_BIOME_CONFIG = {
20
- formatter: { enabled: true, indentStyle: 'space', indentWidth: 2, lineWidth: 120, lineEnding: 'lf' },
21
- };
22
-
23
- async function makeRepo(config: object = SPACED_BIOME_CONFIG): Promise<string> {
24
- const root = await mkdtemp(join(tmpdir(), 'smoo-managed-json-'));
25
- await writeFile(join(root, 'biome.json'), `${JSON.stringify(config)}\n`);
26
- return root;
27
- }
28
-
29
- async function writeSourceJson(path: string, value: unknown): Promise<void> {
30
- await mkdir(dirname(path), { recursive: true });
31
- await writeFile(path, `${JSON.stringify(value, null, 2)}\n`);
32
- }
33
-
34
- /**
35
- * The exact command `.git-format-staged.yml` runs on commit for a `*.json` file,
36
- * read from the managed config and run as a subprocess, so the oracle is the
37
- * commit hook itself rather than a second call into the code under test.
38
- */
39
- async function hookCommand(): Promise<string> {
40
- const config = typia.assert<{ formatters: { biome: { command: string } } }>(
41
- Bun.YAML.parse(await readFile(join(managedAssetsRoot, 'raw', 'git-format-staged.yml'), 'utf8')),
42
- );
43
- return config.formatters.biome.command;
44
- }
45
-
46
- async function hookOutput(root: string, path: string, text: string): Promise<string> {
47
- const command = (await hookCommand()).replaceAll('{}', path);
48
- const child = spawnSync('sh', ['-c', command], { cwd: root, input: text, encoding: 'utf8' });
49
- expect(child.status).toBe(0);
50
- return child.stdout;
51
- }
52
-
53
- async function theHookWouldRewrite(root: string, path: string): Promise<boolean> {
54
- const text = await readFile(join(root, path), 'utf8');
55
- return (await hookOutput(root, path, text)) !== text;
56
- }
57
-
58
- describe('JSON that smoo writes into a managed repository', () => {
59
- it('keeps a short array on one line, the way the commit hook leaves it', async () => {
60
- const root = await makeRepo();
61
- try {
62
- const text = jsonFileText(join(root, 'tsconfig.test.json'), { compilerOptions: { types: ['bun'] } });
63
-
64
- expect(text).toBe('{\n "compilerOptions": {\n "types": ["bun"]\n }\n}\n');
65
- } finally {
66
- await rm(root, { recursive: true, force: true });
67
- }
68
- });
69
-
70
- it('is a fixed point of the commit hook', async () => {
71
- const root = await makeRepo();
72
- try {
73
- const value = {
74
- extends: '../tsconfig.base.json',
75
- compilerOptions: { types: ['bun'], lib: ['es2024', 'dom'] },
76
- include: ['src/**/*.test.ts', 'src/**/*.spec.ts', 'src/**/__tests__/**/*.ts', 'src/**/__tests__/**/*.tsx'],
77
- references: [{ path: '../packages/cli/tsconfig.lib.json' }],
78
- };
79
- const text = jsonFileText(join(root, 'tooling/tsconfig.test.json'), value);
80
-
81
- expect(await hookOutput(root, 'tooling/tsconfig.test.json', text)).toBe(text);
82
- expect(JSON.parse(text)).toEqual(value);
83
- } finally {
84
- await rm(root, { recursive: true, force: true });
85
- }
86
- });
87
-
88
- it("obeys the consumer's own Biome configuration", async () => {
89
- const root = await makeRepo({ formatter: { indentStyle: 'tab', lineWidth: 20 } });
90
- try {
91
- const text = jsonFileText(join(root, 'package.json'), { files: ['dist', 'src', 'README.md'] });
92
-
93
- expect(text).toBe('{\n\t"files": [\n\t\t"dist",\n\t\t"src",\n\t\t"README.md"\n\t]\n}\n');
94
- } finally {
95
- await rm(root, { recursive: true, force: true });
96
- }
97
- });
98
-
99
- it('formats a file whose directory does not exist yet', async () => {
100
- const root = await makeRepo();
101
- try {
102
- const text = jsonFileText(join(root, 'packages/new/deep/tsconfig.json'), { include: ['src'] });
103
-
104
- expect(text).toBe('{\n "include": ["src"]\n}\n');
105
- } finally {
106
- await rm(root, { recursive: true, force: true });
107
- }
108
- });
109
-
110
- it('writes the formatted bytes to the file', async () => {
111
- const root = await makeRepo();
112
- try {
113
- writeJsonFile(join(root, 'nx.json'), { plugins: ['@smoothbricks/nx-plugin'] });
114
-
115
- expect(await readFile(join(root, 'nx.json'), 'utf8')).toBe('{\n "plugins": ["@smoothbricks/nx-plugin"]\n}\n');
116
- expect(await theHookWouldRewrite(root, 'nx.json')).toBe(false);
117
- } finally {
118
- await rm(root, { recursive: true, force: true });
119
- }
120
- });
121
-
122
- it('runs the command the managed commit hook runs', async () => {
123
- expect(`biome ${biomeHookArguments('{}').join(' ')}`).toBe((await hookCommand()).replaceAll("'", ''));
124
- });
125
-
126
- it('refuses to write what a Biome that rejects the repository configuration returned', async () => {
127
- const root = await makeRepo({ formatter: { lineWidth: 'wide' } });
128
- try {
129
- expect(() => jsonFileText(join(root, 'package.json'), { name: 'x' })).toThrow(/lineWidth/);
130
- } finally {
131
- await rm(root, { recursive: true, force: true });
132
- }
133
- });
134
-
135
- it('passes the text through where no Biome is installed: that tree has no hook output to agree with', async () => {
136
- const root = await makeRepo();
137
- const path = process.env.PATH;
138
- try {
139
- process.env.PATH = '';
140
- const text = '{"a":[1]}\n';
141
-
142
- expect(formatJsonWithBiome(join(root, 'a.json'), text)).toBe(text);
143
- } finally {
144
- if (path === undefined) delete process.env.PATH;
145
- else process.env.PATH = path;
146
- await rm(root, { recursive: true, force: true });
147
- }
148
- });
149
- });
150
-
151
- describe('every update step that rewrites a JSON file leaves it as the commit hook would', () => {
152
- it('nx.json through the workspace config policy', async () => {
153
- const root = await makeRepo();
154
- try {
155
- await writeSourceJson(join(root, 'nx.json'), {
156
- plugins: [],
157
- targetDefaults: { build: { cache: false, dependsOn: ['^build'] } },
158
- namedInputs: { default: ['{projectRoot}/**/*'] },
159
- });
160
-
161
- expect(applyWorkspaceConfigPolicy(root)).toBe(true);
162
- expect(await theHookWouldRewrite(root, 'nx.json')).toBe(false);
163
- } finally {
164
- await rm(root, { recursive: true, force: true });
165
- }
166
- });
167
-
168
- it('nx.json through the release config policy', async () => {
169
- const root = await makeRepo();
170
- try {
171
- await writeSourceJson(join(root, 'nx.json'), { namedInputs: { default: ['{projectRoot}/**/*'] } });
172
-
173
- expect(applyReleaseConfigPolicy(root)).toBe(true);
174
- expect(await theHookWouldRewrite(root, 'nx.json')).toBe(false);
175
- } finally {
176
- await rm(root, { recursive: true, force: true });
177
- }
178
- });
179
-
180
- it('package.json through the package target policy', async () => {
181
- const root = await makeRepo();
182
- try {
183
- await writeSourceJson(join(root, 'package.json'), {
184
- name: '@scope/root',
185
- private: true,
186
- workspaces: ['packages/*'],
187
- });
188
- await writeSourceJson(join(root, 'packages/lib/package.json'), {
189
- name: '@scope/lib',
190
- files: ['dist'],
191
- scripts: { 'build:ts': 'nx run lib:build:ts' },
192
- nx: {
193
- name: 'lib',
194
- targets: {
195
- 'build:ts': {
196
- executor: 'nx:run-commands',
197
- options: { command: 'tsc --build tsconfig.lib.json', cwd: '{projectRoot}' },
198
- },
199
- build: { executor: 'nx:noop', dependsOn: ['^build', 'build:ts'] },
200
- },
201
- },
202
- });
203
-
204
- expect(applyPackageTargetPolicy(root)).toBe(true);
205
- expect(await theHookWouldRewrite(root, 'packages/lib/package.json')).toBe(false);
206
- } finally {
207
- await rm(root, { recursive: true, force: true });
208
- }
209
- });
210
-
211
- it('package.json through the bounded test target policy', async () => {
212
- const root = await makeRepo();
213
- try {
214
- await writeSourceJson(join(root, 'package.json'), {
215
- name: '@scope/root',
216
- private: true,
217
- workspaces: ['packages/*'],
218
- });
219
- await writeSourceJson(join(root, 'packages/app/package.json'), {
220
- name: '@scope/app',
221
- files: ['dist'],
222
- scripts: { test: 'bun test --pass-with-no-tests' },
223
- nx: { name: 'app' },
224
- });
225
-
226
- expect(applyWorkspaceBoundedTestTargetPolicy(root)).toBe(true);
227
- expect(await theHookWouldRewrite(root, 'packages/app/package.json')).toBe(false);
228
- } finally {
229
- await rm(root, { recursive: true, force: true });
230
- }
231
- });
232
- });
233
-
234
- describe('tsconfig.test.json the managed generator writes', () => {
235
- it('is what the commit hook would leave, so the workflow commit lints clean without the hook', async () => {
236
- const root = await makeRepo();
237
- try {
238
- await writeSourceJson(join(root, 'package.json'), {
239
- name: '@scope/root',
240
- private: true,
241
- workspaces: ['packages/*'],
242
- });
243
- await writeSourceJson(join(root, 'tsconfig.base.json'), { compilerOptions: {} });
244
- await writeSourceJson(join(root, 'packages/app/package.json'), {
245
- name: '@scope/app',
246
- scripts: { test: 'bun test' },
247
- });
248
- await mkdir(join(root, 'packages/app/src'), { recursive: true });
249
- await writeFile(join(root, 'packages/app/src/app.test.ts'), 'export {};\n');
250
-
251
- const tree = new FsTree(root, false);
252
- const files = renderTypecheckTestFiles(tree);
253
- assertNoManagedConflicts(
254
- stageManagedFiles(
255
- tree,
256
- files,
257
- inspectManagedPaths(
258
- root,
259
- files.map((file) => file.target),
260
- ),
261
- ),
262
- );
263
- flushChanges(root, tree.listChanges());
264
-
265
- expect(await readFile(join(root, 'packages/app/tsconfig.test.json'), 'utf8')).toContain('"types": ["bun"]');
266
- expect(await theHookWouldRewrite(root, 'packages/app/tsconfig.test.json')).toBe(false);
267
- } finally {
268
- await rm(root, { recursive: true, force: true });
269
- }
270
- });
271
- });
272
-
273
- describe('the Biome smoo runs', () => {
274
- async function repoWithBiome(script: string): Promise<string> {
275
- const root = await makeRepo();
276
- await mkdir(join(root, 'node_modules/.bin'), { recursive: true });
277
- await writeFile(join(root, 'node_modules/.bin/biome'), `#!/bin/sh\n${script}\n`);
278
- await chmod(join(root, 'node_modules/.bin/biome'), 0o755);
279
- return root;
280
- }
281
-
282
- it("is the repository's own, found above the file, before the one on PATH", async () => {
283
- const root = await repoWithBiome('echo LOCAL');
284
- try {
285
- expect(formatJsonWithBiome(join(root, 'packages/app/package.json'), '{}\n')).toBe('LOCAL\n');
286
- } finally {
287
- await rm(root, { recursive: true, force: true });
288
- }
289
- });
290
-
291
- it('is an error when it exits non-zero, with what it said', async () => {
292
- const root = await repoWithBiome('echo broken config >&2; exit 3');
293
- try {
294
- expect(() => formatJsonWithBiome(join(root, 'a.json'), '{}\n')).toThrow(/exited 3[\s\S]*broken config/);
295
- } finally {
296
- await rm(root, { recursive: true, force: true });
297
- }
298
- });
299
-
300
- it('is an error when it answers nothing to real input, never an empty file', async () => {
301
- const root = await repoWithBiome('exit 0');
302
- try {
303
- expect(() => formatJsonWithBiome(join(root, 'a.json'), '{}\n')).toThrow(/returned no content/);
304
- } finally {
305
- await rm(root, { recursive: true, force: true });
306
- }
307
- });
308
- });
@@ -1,172 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
- import { spawnSync } from 'node:child_process';
3
- import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises';
4
- import { tmpdir, userInfo } from 'node:os';
5
- import { dirname, join } from 'node:path';
6
- import { managedAssetsRoot } from '../managed-assets.js';
7
-
8
- interface RepoPathFixture {
9
- readonly root: string;
10
- readonly helper: string;
11
- readonly home: string;
12
- readonly venv: string;
13
- readonly installed: string;
14
- readonly tools: string;
15
- readonly entries: string[];
16
- }
17
-
18
- async function executable(path: string, marker: string): Promise<void> {
19
- await mkdir(dirname(path), { recursive: true });
20
- await writeFile(path, `#!/bin/sh\nprintf '%s\\n' '${marker}'\n`, { mode: 0o755 });
21
- }
22
-
23
- async function withRepoPath(run: (fixture: RepoPathFixture) => Promise<void>): Promise<void> {
24
- const root = await mkdtemp(join(tmpdir(), 'smoo-repo-path-'));
25
- try {
26
- const helper = join(root, 'tooling/direnv/repo-path');
27
- await mkdir(dirname(helper), { recursive: true });
28
- await writeFile(helper, await readFile(join(managedAssetsRoot, 'raw/tooling/direnv/repo-path')), { mode: 0o755 });
29
- const tools = join(root, 'system-bin');
30
- await mkdir(tools);
31
- // Resolve the script's tools before scrubbing PATH; /usr/bin:/bin is not
32
- // a coreutils installation on NixOS.
33
- for (const tool of ['bash', 'dirname']) {
34
- const resolved = Bun.which(tool);
35
- if (resolved === null) throw new Error(`${tool} must be on PATH`);
36
- await symlink(resolved, join(tools, tool));
37
- }
38
- const home = join(root, 'private home');
39
- const venv = join(root, 'active venv');
40
- const installed = join(home, 'Library/Application Support/dev.cowshed/bin');
41
- const entries = [
42
- join(root, 'tooling/direnv/.devenv/profile/bin'),
43
- join(root, 'tooling/git-hooks'),
44
- join(root, 'tooling'),
45
- join(root, 'tooling/node_modules/.bin'),
46
- join(root, 'node_modules/.bin'),
47
- ];
48
- await executable(join(entries[0], 'python3'), 'profile-python');
49
- await executable(join(entries[0], 'cargo'), 'profile-cargo');
50
- await executable(join(venv, 'bin/python3'), 'venv-python');
51
- await executable(join(venv, 'bin/cargo'), 'venv-cargo');
52
- await executable(join(installed, 'cargo'), 'installed-cargo');
53
- await run({ root, helper, home, venv, installed, tools, entries });
54
- } finally {
55
- await rm(root, { recursive: true, force: true });
56
- }
57
- }
58
-
59
- function helper(fixture: RepoPathFixture, args: readonly string[], virtualEnv?: string, path = fixture.tools) {
60
- const result = spawnSync(join(fixture.tools, 'bash'), [fixture.helper, ...args], {
61
- encoding: 'utf8',
62
- env: { HOME: fixture.home, PATH: path, ...(virtualEnv === undefined ? {} : { VIRTUAL_ENV: virtualEnv }) },
63
- });
64
- expect(result.status).toBe(0);
65
- expect(result.stderr).toBe('');
66
- return result.stdout;
67
- }
68
-
69
- async function expectModes(fixture: RepoPathFixture, entries: string[], virtualEnv?: string): Promise<void> {
70
- expect(helper(fixture, ['--print'], virtualEnv)).toBe(`${entries.join('\n')}\n`);
71
- const githubPath = join(fixture.root, 'github-path');
72
- await writeFile(githubPath, 'existing-entry\n');
73
- const result = spawnSync(join(fixture.tools, 'bash'), [fixture.helper, '--github-path'], {
74
- encoding: 'utf8',
75
- env: {
76
- HOME: fixture.home,
77
- PATH: fixture.tools,
78
- GITHUB_PATH: githubPath,
79
- ...(virtualEnv === undefined ? {} : { VIRTUAL_ENV: virtualEnv }),
80
- },
81
- });
82
- expect(result.status).toBe(0);
83
- expect(result.stderr).toBe('');
84
- expect(await readFile(githubPath, 'utf8')).toBe(`existing-entry\n${[...entries].reverse().join('\n')}\n`);
85
- }
86
-
87
- describe('managed repo-path', () => {
88
- it.each([undefined, ''])('preserves the exact legacy ordering without an active venv (%p)', async (virtualEnv) => {
89
- await withRepoPath(async (fixture) => {
90
- await expectModes(fixture, fixture.entries, virtualEnv);
91
- expect(helper(fixture, [], virtualEnv)).toBe(
92
- `${[fixture.installed, ...fixture.entries].join(':')}:${fixture.tools}\n`,
93
- );
94
- });
95
- });
96
-
97
- it.each([false, true])(
98
- 'keeps active Python ahead of the profile and installed Cargo first (served=%p)',
99
- async (served) => {
100
- await withRepoPath(async (fixture) => {
101
- if (served) {
102
- await mkdir(join(fixture.root, '.cowshed'), { recursive: true });
103
- await writeFile(
104
- join(fixture.root, '.cowshed/env'),
105
- `export COWSHED_RUNTIME_LINK=fixture\nexport PATH=${JSON.stringify(fixture.installed)}:$PATH\n`,
106
- );
107
- }
108
- const entries = [join(fixture.venv, 'bin'), ...fixture.entries];
109
- await expectModes(fixture, entries, fixture.venv);
110
- const incoming = `${join(fixture.venv, 'bin')}:${fixture.tools}`;
111
- const path = helper(fixture, [], fixture.venv, incoming).trimEnd();
112
- expect(path).toBe(`${[fixture.installed, ...entries].join(':')}:${incoming}`);
113
- const selected = spawnSync(
114
- join(fixture.tools, 'bash'),
115
- ['-c', 'command -v python3; python3; command -v cargo; cargo'],
116
- {
117
- encoding: 'utf8',
118
- env: { HOME: fixture.home, PATH: path },
119
- },
120
- );
121
- expect(selected.status).toBe(0);
122
- expect(selected.stderr).toBe('');
123
- expect(selected.stdout).toBe(
124
- `${join(fixture.venv, 'bin/python3')}\nvenv-python\n${join(fixture.installed, 'cargo')}\ninstalled-cargo\n`,
125
- );
126
- });
127
- },
128
- );
129
-
130
- it("names this checkout's own shell's evaluated profile, never the checkout's re-pointable link", async () => {
131
- await withRepoPath(async (fixture) => {
132
- // The link is what any activation of the checkout last pointed it at; the shell evaluated another profile.
133
- const evaluated = join(fixture.root, 'evaluated-profile');
134
- await executable(join(evaluated, 'bin/bun'), 'evaluated-bun');
135
- await executable(join(fixture.entries[0], 'bun'), 'link-bun');
136
- const run = (args: readonly string[], devenvRoot: string) => {
137
- const result = spawnSync(join(fixture.tools, 'bash'), [fixture.helper, ...args], {
138
- encoding: 'utf8',
139
- env: { HOME: fixture.home, PATH: fixture.tools, DEVENV_ROOT: devenvRoot, DEVENV_PROFILE: evaluated },
140
- });
141
- expect(result.stderr).toBe('');
142
- expect(result.status).toBe(0);
143
- return result.stdout;
144
- };
145
- const own = join(fixture.root, 'tooling/direnv');
146
- expect(run(['--print'], own).split('\n')[0]).toBe(join(evaluated, 'bin'));
147
- // Another checkout's shell, inherited by a hook run here, does not name this checkout's profile.
148
- expect(run(['--print'], join(fixture.root, 'system-bin')).split('\n')[0]).toBe(fixture.entries[0]);
149
-
150
- const selected = spawnSync(join(fixture.tools, 'bash'), ['-c', 'bun'], {
151
- encoding: 'utf8',
152
- env: { HOME: fixture.home, PATH: run([], own).trimEnd() },
153
- });
154
- expect(selected.stderr).toBe('');
155
- expect(selected.stdout).toBe('evaluated-bun\n');
156
- });
157
- });
158
-
159
- it("reaches the installed cowshed through the real uid's passwd home when the caller passes only PATH", async () => {
160
- await withRepoPath(async (fixture) => {
161
- // A formatter or hook that passes { PATH } alone leaves HOME unset; it is not the helper's to require.
162
- const result = spawnSync(join(fixture.tools, 'bash'), [fixture.helper], {
163
- encoding: 'utf8',
164
- env: { PATH: fixture.tools },
165
- });
166
- expect(result.stderr).toBe('');
167
- expect(result.status).toBe(0);
168
- const installed = join(userInfo().homedir, 'Library/Application Support/dev.cowshed/bin');
169
- expect(result.stdout).toBe(`${[installed, ...fixture.entries].join(':')}:${fixture.tools}\n`);
170
- });
171
- });
172
- });