@visulima/vis 1.0.0-alpha.4 → 1.0.0-alpha.41

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 (347) hide show
  1. package/CHANGELOG.md +1243 -78
  2. package/LICENSE.md +13068 -6
  3. package/README.md +388 -26
  4. package/dashboard/dist/index.html +152 -0
  5. package/dist/bin.js +1 -853
  6. package/dist/binx.js +3 -0
  7. package/dist/config/index.d.ts +3276 -0
  8. package/dist/config/index.js +1 -0
  9. package/dist/generate/index.d.ts +157 -0
  10. package/dist/generate/index.js +1 -0
  11. package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -0
  12. package/dist/packem_chunks/bin.js +1198 -0
  13. package/dist/packem_chunks/bloom-status.js +2 -0
  14. package/dist/packem_chunks/bloom-sync.js +2 -0
  15. package/dist/packem_chunks/cache-attestation.js +1 -0
  16. package/dist/packem_chunks/catalog-detector.js +1 -0
  17. package/dist/packem_chunks/config.js +21 -0
  18. package/dist/packem_chunks/detect.js +3 -0
  19. package/dist/packem_chunks/detect2.js +8 -0
  20. package/dist/packem_chunks/devtools.js +81 -0
  21. package/dist/packem_chunks/discord.js +4 -0
  22. package/dist/packem_chunks/doctor-probe.js +2 -0
  23. package/dist/packem_chunks/dynamic-import.js +1 -0
  24. package/dist/packem_chunks/extra-files.js +3 -0
  25. package/dist/packem_chunks/fix.js +11 -0
  26. package/dist/packem_chunks/git.js +3 -0
  27. package/dist/packem_chunks/handler.js +1 -0
  28. package/dist/packem_chunks/handler10.js +1 -0
  29. package/dist/packem_chunks/handler11.js +5 -0
  30. package/dist/packem_chunks/handler12.js +1 -0
  31. package/dist/packem_chunks/handler13.js +27 -0
  32. package/dist/packem_chunks/handler14.js +5 -0
  33. package/dist/packem_chunks/handler15.js +1 -0
  34. package/dist/packem_chunks/handler16.js +1 -0
  35. package/dist/packem_chunks/handler17.js +1 -0
  36. package/dist/packem_chunks/handler18.js +1 -0
  37. package/dist/packem_chunks/handler19.js +1 -0
  38. package/dist/packem_chunks/handler2.js +4 -0
  39. package/dist/packem_chunks/handler20.js +5 -0
  40. package/dist/packem_chunks/handler21.js +2 -0
  41. package/dist/packem_chunks/handler22.js +2 -0
  42. package/dist/packem_chunks/handler23.js +1 -0
  43. package/dist/packem_chunks/handler24.js +1 -0
  44. package/dist/packem_chunks/handler25.js +1 -0
  45. package/dist/packem_chunks/handler26.js +5 -0
  46. package/dist/packem_chunks/handler27.js +1 -0
  47. package/dist/packem_chunks/handler28.js +3 -0
  48. package/dist/packem_chunks/handler29.js +1 -0
  49. package/dist/packem_chunks/handler3.js +4 -0
  50. package/dist/packem_chunks/handler30.js +1 -0
  51. package/dist/packem_chunks/handler31.js +2 -0
  52. package/dist/packem_chunks/handler32.js +2 -0
  53. package/dist/packem_chunks/handler33.js +2 -0
  54. package/dist/packem_chunks/handler34.js +3 -0
  55. package/dist/packem_chunks/handler35.js +6 -0
  56. package/dist/packem_chunks/handler36.js +1 -0
  57. package/dist/packem_chunks/handler37.js +42 -0
  58. package/dist/packem_chunks/handler38.js +8 -0
  59. package/dist/packem_chunks/handler39.js +9 -0
  60. package/dist/packem_chunks/handler4.js +6 -0
  61. package/dist/packem_chunks/handler40.js +75 -0
  62. package/dist/packem_chunks/handler41.js +5 -0
  63. package/dist/packem_chunks/handler42.js +4 -0
  64. package/dist/packem_chunks/handler43.js +3 -0
  65. package/dist/packem_chunks/handler44.js +2 -0
  66. package/dist/packem_chunks/handler45.js +1 -0
  67. package/dist/packem_chunks/handler46.js +1 -0
  68. package/dist/packem_chunks/handler47.js +1 -0
  69. package/dist/packem_chunks/handler48.js +3 -0
  70. package/dist/packem_chunks/handler49.js +1 -0
  71. package/dist/packem_chunks/handler5.js +8 -0
  72. package/dist/packem_chunks/handler50.js +7 -0
  73. package/dist/packem_chunks/handler51.js +33 -0
  74. package/dist/packem_chunks/handler52.js +3 -0
  75. package/dist/packem_chunks/handler53.js +8 -0
  76. package/dist/packem_chunks/handler54.js +4 -0
  77. package/dist/packem_chunks/handler55.js +1 -0
  78. package/dist/packem_chunks/handler56.js +12 -0
  79. package/dist/packem_chunks/handler57.js +7 -0
  80. package/dist/packem_chunks/handler58.js +5 -0
  81. package/dist/packem_chunks/handler59.js +11 -0
  82. package/dist/packem_chunks/handler6.js +1 -0
  83. package/dist/packem_chunks/handler60.js +3 -0
  84. package/dist/packem_chunks/handler61.js +22 -0
  85. package/dist/packem_chunks/handler62.js +61 -0
  86. package/dist/packem_chunks/handler63.js +3 -0
  87. package/dist/packem_chunks/handler64.js +6 -0
  88. package/dist/packem_chunks/handler65.js +708 -0
  89. package/dist/packem_chunks/handler66.js +24 -0
  90. package/dist/packem_chunks/handler67.js +25 -0
  91. package/dist/packem_chunks/handler68.js +153 -0
  92. package/dist/packem_chunks/handler69.js +10 -0
  93. package/dist/packem_chunks/handler7.js +1 -0
  94. package/dist/packem_chunks/handler70.js +24 -0
  95. package/dist/packem_chunks/handler71.js +322 -0
  96. package/dist/packem_chunks/handler72.js +48 -0
  97. package/dist/packem_chunks/handler73.js +27 -0
  98. package/dist/packem_chunks/handler74.js +3 -0
  99. package/dist/packem_chunks/handler75.js +190 -0
  100. package/dist/packem_chunks/handler76.js +38 -0
  101. package/dist/packem_chunks/handler8.js +1 -0
  102. package/dist/packem_chunks/handler9.js +1 -0
  103. package/dist/packem_chunks/heal-accept.js +10 -0
  104. package/dist/packem_chunks/heal.js +14 -0
  105. package/dist/packem_chunks/help-command.js +31 -0
  106. package/dist/packem_chunks/index.js +1 -0
  107. package/dist/packem_chunks/index2.js +7 -0
  108. package/dist/packem_chunks/interface.js +2 -0
  109. package/dist/packem_chunks/keys-refresh.js +4 -0
  110. package/dist/packem_chunks/list.js +3 -0
  111. package/dist/packem_chunks/loader.js +4 -0
  112. package/dist/packem_chunks/loader2.js +1 -0
  113. package/dist/packem_chunks/orchestrator.js +39 -0
  114. package/dist/packem_chunks/pre-mode.js +2 -0
  115. package/dist/packem_chunks/print-config.js +2 -0
  116. package/dist/packem_chunks/prompts.js +7 -0
  117. package/dist/packem_chunks/prune.js +3 -0
  118. package/dist/packem_chunks/publish-guards.js +1 -0
  119. package/dist/packem_chunks/registry.js +48 -0
  120. package/dist/packem_chunks/resolveFormatter.js +9 -0
  121. package/dist/packem_chunks/run.js +1 -0
  122. package/dist/packem_chunks/security.js +1 -0
  123. package/dist/packem_chunks/shell-runner.js +1 -0
  124. package/dist/packem_chunks/slack.js +2 -0
  125. package/dist/packem_chunks/snapshot.js +2 -0
  126. package/dist/packem_chunks/stage-publisher.js +1 -0
  127. package/dist/packem_chunks/staged-registry.js +2 -0
  128. package/dist/packem_chunks/state.js +3 -0
  129. package/dist/packem_chunks/status.js +2 -0
  130. package/dist/packem_chunks/success-walk.js +8 -0
  131. package/dist/packem_chunks/sync.js +2 -0
  132. package/dist/packem_chunks/sync2.js +2 -0
  133. package/dist/packem_chunks/tar.js +3 -0
  134. package/dist/packem_chunks/tripwire.js +2 -0
  135. package/dist/packem_chunks/verify-lockfile.js +2 -0
  136. package/dist/packem_chunks/version-resolver.js +2 -0
  137. package/dist/packem_chunks/webhook.js +1 -0
  138. package/dist/packem_chunks/workflow-templates.js +167 -0
  139. package/dist/packem_chunks/workspace.js +2 -0
  140. package/dist/packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js +1 -0
  141. package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +1 -0
  142. package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
  143. package/dist/packem_shared/ReleaseClient-YHzBIxYS.js +1 -0
  144. package/dist/packem_shared/Table-CcVkyULl-B_ef6zfS.js +35 -0
  145. package/dist/packem_shared/VisReleaseError-DMGRBTNO.js +1 -0
  146. package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
  147. package/dist/packem_shared/advisories-DLeO5KMN.js +1 -0
  148. package/dist/packem_shared/affected-shas-cVnX8-zs.js +1 -0
  149. package/dist/packem_shared/ai-analysis-BUeX2J2H.js +68 -0
  150. package/dist/packem_shared/ai-fix-9Vzlp6XU.js +43 -0
  151. package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
  152. package/dist/packem_shared/api.d-BPftyU9r.d.ts +27 -0
  153. package/dist/packem_shared/build-scripts-CCCi8U66.js +1 -0
  154. package/dist/packem_shared/command-runtime-CR70qSUM.js +1 -0
  155. package/dist/packem_shared/createAdapter-bU4DIP3F.js +1 -0
  156. package/dist/packem_shared/createVersionActions-BK43SNDH.js +1 -0
  157. package/dist/packem_shared/cyclonedx-Cadls41z.js +4 -0
  158. package/dist/packem_shared/defineFormatter-D5dCp6Kv.js +1 -0
  159. package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
  160. package/dist/packem_shared/dependency-scan-DnTgYleU.js +1 -0
  161. package/dist/packem_shared/docker-BMLrNtWm.js +59 -0
  162. package/dist/packem_shared/failure-log-CEWP3bP0.js +2 -0
  163. package/dist/packem_shared/giget-DHY1sQZC.js +2 -0
  164. package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +1 -0
  165. package/dist/packem_shared/index-3jMNqQom.js +1 -0
  166. package/dist/packem_shared/index-BDmTbWX1.js +19 -0
  167. package/dist/packem_shared/index-Bt521H5J.js +30 -0
  168. package/dist/packem_shared/index-DGSsjmpV.js +1 -0
  169. package/dist/packem_shared/interface.d-B7VK2rcH.d.ts +148 -0
  170. package/dist/packem_shared/interface.d-Cezzifoh.d.ts +106 -0
  171. package/dist/packem_shared/license-t5KnNX6v.js +1 -0
  172. package/dist/packem_shared/lifecycle-4z9hHE5b.js +2 -0
  173. package/dist/packem_shared/lockfile-C8Q1_4KK.js +1 -0
  174. package/dist/packem_shared/manifests-Dj3pRKBT.js +1 -0
  175. package/dist/packem_shared/min-release-age-D1alDE3K.js +34 -0
  176. package/dist/packem_shared/missing-package-json-8vNHwbqw.js +1 -0
  177. package/dist/packem_shared/native-config-sync-BEkJW7g3.js +21 -0
  178. package/dist/packem_shared/osv-bloom-B03tUWf3.js +2 -0
  179. package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
  180. package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
  181. package/dist/packem_shared/pm-runner-BKZQo7Ts.js +1 -0
  182. package/dist/packem_shared/provenance-BFEwKgI3.js +1 -0
  183. package/dist/packem_shared/public-api-WqUCiyIe.js +131 -0
  184. package/dist/packem_shared/registry-keys-BfFto6vI.js +1 -0
  185. package/dist/packem_shared/resolve-explicit-C6WM-I2u.js +5 -0
  186. package/dist/packem_shared/runtime-check-Stc9AI78.js +1 -0
  187. package/dist/packem_shared/s1ngularity-DCPmPE5M.js +1 -0
  188. package/dist/packem_shared/scan-progress-CFhc0CMj.js +2 -0
  189. package/dist/packem_shared/selectors-GCJIe342.js +3 -0
  190. package/dist/packem_shared/signatures-Xpd6HjG_.js +2 -0
  191. package/dist/packem_shared/slug-DoueYuLo.js +1 -0
  192. package/dist/packem_shared/spinner-CV3WVJLv.js +1 -0
  193. package/dist/packem_shared/sticky-comment-D6_7-w8T.js +1 -0
  194. package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
  195. package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
  196. package/dist/packem_shared/tabs-BuTy5gPV.js +1 -0
  197. package/dist/packem_shared/toolchain-pR7AJ-tB.js +5 -0
  198. package/dist/packem_shared/typosquats-DN78xx1x.js +1 -0
  199. package/dist/packem_shared/use-measured-height-_eVGWtWt.js +1 -0
  200. package/dist/packem_shared/utils-Cxree603.js +1 -0
  201. package/dist/packem_shared/verify-6WCmFmy8.js +1 -0
  202. package/dist/packem_shared/vis-update-app-k3fDxech.js +1 -0
  203. package/dist/packem_shared/watch-BvIwLG4N.js +1 -0
  204. package/dist/packem_shared/watch-loop-DWkvv2tK.js +11 -0
  205. package/dist/release/core/changelog/index.d.ts +5 -0
  206. package/dist/release/core/changelog/index.js +1 -0
  207. package/dist/release/core/package-managers/index.d.ts +6 -0
  208. package/dist/release/core/package-managers/index.js +1 -0
  209. package/dist/release/core/version-actions/index.d.ts +14 -0
  210. package/dist/release/core/version-actions/index.js +1 -0
  211. package/dist/release/index.d.ts +196 -0
  212. package/dist/release/index.js +1 -0
  213. package/dist/release/plugin-sdk.d.ts +127 -0
  214. package/dist/release/plugin-sdk.js +1 -0
  215. package/dist/release/presets.d.ts +225 -0
  216. package/dist/release/presets.js +1 -0
  217. package/dist/release/types.d.ts +1377 -0
  218. package/dist/release/types.js +1 -0
  219. package/index.d.ts +436 -0
  220. package/index.js +80 -57
  221. package/package.json +109 -45
  222. package/schemas/project.schema.json +991 -0
  223. package/schemas/vis-config.schema.json +6389 -0
  224. package/schemas/vis-release-config.schema.json +1390 -0
  225. package/skills/vis/SKILL.md +96 -0
  226. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  227. package/templates/buildkite-ci/template.yml +20 -0
  228. package/dist/ai-analysis.d.ts +0 -40
  229. package/dist/ai-cache.d.ts +0 -21
  230. package/dist/audit-config.d.ts +0 -24
  231. package/dist/bin.d.ts +0 -1
  232. package/dist/catalog.d.ts +0 -118
  233. package/dist/commands/add.d.ts +0 -3
  234. package/dist/commands/affected.d.ts +0 -3
  235. package/dist/commands/ai.d.ts +0 -3
  236. package/dist/commands/analyze.d.ts +0 -3
  237. package/dist/commands/approve-builds.d.ts +0 -3
  238. package/dist/commands/audit.d.ts +0 -23
  239. package/dist/commands/check.d.ts +0 -3
  240. package/dist/commands/clean.d.ts +0 -3
  241. package/dist/commands/create/discovery.d.ts +0 -42
  242. package/dist/commands/create/index.d.ts +0 -13
  243. package/dist/commands/create/prompts.d.ts +0 -31
  244. package/dist/commands/create/random-name.d.ts +0 -15
  245. package/dist/commands/create/templates/builtin.d.ts +0 -15
  246. package/dist/commands/create/templates/generator.d.ts +0 -14
  247. package/dist/commands/create/templates/index.d.ts +0 -13
  248. package/dist/commands/create/templates/monorepo.d.ts +0 -16
  249. package/dist/commands/create/templates/remote.d.ts +0 -41
  250. package/dist/commands/create/templates/types.d.ts +0 -46
  251. package/dist/commands/create/utils.d.ts +0 -42
  252. package/dist/commands/dedupe.d.ts +0 -3
  253. package/dist/commands/devcontainer.d.ts +0 -3
  254. package/dist/commands/dlx.d.ts +0 -3
  255. package/dist/commands/doctor.d.ts +0 -15
  256. package/dist/commands/exec.d.ts +0 -3
  257. package/dist/commands/graph.d.ts +0 -3
  258. package/dist/commands/hook/constants.d.ts +0 -8
  259. package/dist/commands/hook/index.d.ts +0 -3
  260. package/dist/commands/hook/install.d.ts +0 -7
  261. package/dist/commands/hook/migrate.d.ts +0 -27
  262. package/dist/commands/hook/uninstall.d.ts +0 -3
  263. package/dist/commands/implode.d.ts +0 -3
  264. package/dist/commands/init.d.ts +0 -14
  265. package/dist/commands/install.d.ts +0 -3
  266. package/dist/commands/link.d.ts +0 -3
  267. package/dist/commands/migrate/constants.d.ts +0 -12
  268. package/dist/commands/migrate/deps.d.ts +0 -32
  269. package/dist/commands/migrate/index.d.ts +0 -3
  270. package/dist/commands/migrate/json.d.ts +0 -20
  271. package/dist/commands/migrate/lint-staged.d.ts +0 -62
  272. package/dist/commands/migrate/types.d.ts +0 -20
  273. package/dist/commands/optimize.d.ts +0 -38
  274. package/dist/commands/pm.d.ts +0 -3
  275. package/dist/commands/remove.d.ts +0 -3
  276. package/dist/commands/run.d.ts +0 -3
  277. package/dist/commands/sort-package-json.d.ts +0 -3
  278. package/dist/commands/staged.d.ts +0 -3
  279. package/dist/commands/unlink.d.ts +0 -3
  280. package/dist/commands/update.d.ts +0 -3
  281. package/dist/commands/upgrade.d.ts +0 -3
  282. package/dist/commands/why.d.ts +0 -3
  283. package/dist/config.d.ts +0 -67
  284. package/dist/config.js +0 -1
  285. package/dist/native-binding.d.ts +0 -151
  286. package/dist/output.d.ts +0 -40
  287. package/dist/overrides.d.ts +0 -82
  288. package/dist/package-manager.d.ts +0 -23
  289. package/dist/plugins/config-loader.d.ts +0 -3
  290. package/dist/plugins/post-command.d.ts +0 -3
  291. package/dist/plugins/security-enforcement.d.ts +0 -3
  292. package/dist/pm-runner.d.ts +0 -23
  293. package/dist/security.d.ts +0 -64
  294. package/dist/socket-security.d.ts +0 -129
  295. package/dist/tips.d.ts +0 -41
  296. package/dist/tui/components/CheckProgressApp.d.ts +0 -6
  297. package/dist/tui/components/CommandSummary.d.ts +0 -17
  298. package/dist/tui/components/Header.d.ts +0 -13
  299. package/dist/tui/components/OutputPanel.d.ts +0 -16
  300. package/dist/tui/components/QuitDialog.d.ts +0 -15
  301. package/dist/tui/components/TaskListPanel.d.ts +0 -19
  302. package/dist/tui/components/TaskRow.d.ts +0 -12
  303. package/dist/tui/components/TaskStore.d.ts +0 -80
  304. package/dist/tui/components/VisTaskRunnerApp.d.ts +0 -17
  305. package/dist/tui/components/devcontainer/DevcontainerStore.d.ts +0 -66
  306. package/dist/tui/components/devcontainer/VisDevcontainerApp.d.ts +0 -9
  307. package/dist/tui/components/devcontainer/catalogs/extensions.d.ts +0 -8
  308. package/dist/tui/components/devcontainer/catalogs/features.d.ts +0 -8
  309. package/dist/tui/components/devcontainer/catalogs/filters.d.ts +0 -4
  310. package/dist/tui/components/devcontainer/catalogs/mount-suggestions.d.ts +0 -19
  311. package/dist/tui/components/devcontainer/catalogs/templates.d.ts +0 -8
  312. package/dist/tui/components/devcontainer/devcontainer-io.d.ts +0 -14
  313. package/dist/tui/components/devcontainer/sections/DockerComposeSection.d.ts +0 -11
  314. package/dist/tui/components/devcontainer/sections/EnvironmentSection.d.ts +0 -16
  315. package/dist/tui/components/devcontainer/sections/ExtensionsSection.d.ts +0 -11
  316. package/dist/tui/components/devcontainer/sections/FeaturesSection.d.ts +0 -11
  317. package/dist/tui/components/devcontainer/sections/GeneralSection.d.ts +0 -12
  318. package/dist/tui/components/devcontainer/sections/LifecycleSection.d.ts +0 -13
  319. package/dist/tui/components/devcontainer/sections/MountsSection.d.ts +0 -16
  320. package/dist/tui/components/devcontainer/sections/PortsSection.d.ts +0 -10
  321. package/dist/tui/components/devcontainer/sections/PreviewPanel.d.ts +0 -11
  322. package/dist/tui/components/devcontainer/types.d.ts +0 -53
  323. package/dist/tui/components/devcontainer/validate.d.ts +0 -16
  324. package/dist/tui/components/graph/GraphStore.d.ts +0 -42
  325. package/dist/tui/components/graph/ProjectDetailPanel.d.ts +0 -10
  326. package/dist/tui/components/graph/ProjectListPanel.d.ts +0 -20
  327. package/dist/tui/components/graph/VisGraphApp.d.ts +0 -8
  328. package/dist/tui/components/optimize/OptimizeDetailPanel.d.ts +0 -9
  329. package/dist/tui/components/optimize/OptimizeListPanel.d.ts +0 -16
  330. package/dist/tui/components/optimize/OptimizeStore.d.ts +0 -50
  331. package/dist/tui/components/optimize/VisOptimizeApp.d.ts +0 -8
  332. package/dist/tui/components/optimize/constants.d.ts +0 -7
  333. package/dist/tui/components/update/PackageDetailPanel.d.ts +0 -12
  334. package/dist/tui/components/update/PackageListPanel.d.ts +0 -18
  335. package/dist/tui/components/update/UpdateStore.d.ts +0 -62
  336. package/dist/tui/components/update/VisUpdateApp.d.ts +0 -11
  337. package/dist/tui/dynamic-life-cycle.d.ts +0 -21
  338. package/dist/tui/formatting-utils.d.ts +0 -17
  339. package/dist/tui/pretty-time.d.ts +0 -8
  340. package/dist/tui/static-life-cycle.d.ts +0 -22
  341. package/dist/tui/status-utils.d.ts +0 -20
  342. package/dist/tui/symbols.d.ts +0 -7
  343. package/dist/tui/types.d.ts +0 -11
  344. package/dist/typosquats.d.ts +0 -70
  345. package/dist/upgrade-check.d.ts +0 -30
  346. package/dist/utils.d.ts +0 -22
  347. package/dist/workspace.d.ts +0 -315
@@ -0,0 +1,4 @@
1
+ import{expandNotificationTemplate as h}from"./interface.js";const p=4096,l=3800,d=i=>i.url?`• [\`${i.name}@${i.version}\`](${i.url})`:`• \`${i.name}@${i.version}\``,f=i=>{const t=i.published.map(n=>d(n));let s=t.join(`
2
+ `);if(s.length>l){let n=0;const e=[];for(const r of t){if(n+r.length+1>l){e.push(`*… +${t.length-e.length} more*`);break}e.push(r),n+=r.length+1}s=e.join(`
3
+ `)}return s.slice(0,p)};class g{constructor(t){this.config=t,this.id=t.id?`discord:${t.id}`:"discord"}config;id;async send(t){const s=this.config.title?h(this.config.title,t):`🚀 Released ${t.published.length} package${t.published.length===1?"":"s"}`,n={color:this.config.color??3900150,description:f(t),fields:[],timestamp:t.completedAt,title:s},e=[];if(t.channel&&e.push({inline:!0,name:"Channel",value:`\`${t.channel}\``}),t.repo&&e.push({inline:!0,name:"Repository",value:`[${t.repo}](https://github.com/${t.repo})`}),t.skipped.length>0&&this.config.includeSkipped!==!1){const o=t.skipped.map(c=>`\`${c.name}\` — ${c.reason}`).join(`
4
+ `).slice(0,1024);e.push({inline:!1,name:`Skipped (${t.skipped.length})`,value:o})}e.length>0&&(n.fields=e);const r={...this.config.username?{username:this.config.username}:{},...this.config.avatarUrl?{avatar_url:this.config.avatarUrl}:{},embeds:[n]};let a;try{a=await fetch(this.config.webhook,{body:JSON.stringify(r),headers:{"Content-Type":"application/json"},method:"POST"})}catch(o){const c=o instanceof Error?o.name:"NetworkError";throw new Error(`Discord webhook fetch failed (${c})`,{cause:o})}if(!a.ok){const o=await a.text().catch(()=>"");throw new Error(`Discord webhook returned ${a.status} ${a.statusText}${o?`: ${o.slice(0,200)}`:""}`)}}}export{g as DiscordNotificationChannel};
@@ -0,0 +1,2 @@
1
+ import{I as p,V as u,j as l,E as i,q as h,s as g}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{resolveTurboEnvCompat as d,ReapiRemoteCache as m}from"@visulima/task-runner";import{p as b}from"./bin.js";const f=(t,r)=>r==="http"||r==="reapi"?r:t.startsWith("grpc://")||t.startsWith("grpcs://")?"reapi":"http",$=async(t,r)=>{const o=Date.now(),a=new AbortController,e=setTimeout(()=>{a.abort()},r);try{const s=await fetch(t,{method:"HEAD",signal:a.signal});return{backend:"http",durationMs:Date.now()-o,httpStatus:s.status,ok:!0,url:t}}catch(s){return{backend:"http",durationMs:Date.now()-o,error:s instanceof Error?s.message:String(s),ok:!1,url:t}}finally{clearTimeout(e)}},k=async(t,r)=>{const o=Date.now(),a=new m({...t,timeout:r});try{return{backend:"reapi",capabilities:await a.probeCapabilities(),durationMs:Date.now()-o,ok:!0,url:t.url}}catch(e){return{backend:"reapi",durationMs:Date.now()-o,error:e instanceof Error?e.message:String(e),ok:!1,url:t.url}}finally{try{await a.close()}catch{}}},w=t=>{const r=[],o=t.ok?p("OK"):u("FAIL");if(r.push(`${l("Remote cache")} ${o}`),r.push(` ${i("URL:")} ${h(t.url)}`),r.push(` ${i("Backend:")} ${t.backend}`),r.push(` ${i("Latency:")} ${String(t.durationMs)}ms`),t.httpStatus!==void 0&&r.push(` ${i("Status:")} ${String(t.httpStatus)}`),t.capabilities){const a=t.capabilities.digestFunctions.length>0?t.capabilities.digestFunctions.join(", "):g("(none advertised)");r.push(` ${i("Digests:")} ${a}`),r.push(` ${i("Batch:")} ${String(t.capabilities.maxBatchTotalSizeBytes)} bytes`)}return t.error&&r.push(` ${i("Error:")} ${u(t.error)}`),r.join(`
2
+ `)},D=async({logger:t,options:r,visConfig:o})=>{const a=d((o??{}).taskRunner?.remoteCache),e=r.url??a?.url,s=r.format??"table",c=r.timeout??5e3;if(!e){b.error("No remote cache configured. Set taskRunner.remoteCache.url in vis.config.ts, pass --url=..., or export TURBO_API."),process.exitCode=1;return}const n=f(e,r.backend)==="reapi"?await k({...a??{url:e},backend:"reapi",url:e},c):await $(e,c);s==="json"?t.log(JSON.stringify(n,null,2)):t.log(w(n)),n.ok||(process.exitCode=1)};export{D as cacheDoctorExecute};
@@ -0,0 +1 @@
1
+ const o=async m=>import(m);export{o as dynamicEsmImport};
@@ -0,0 +1,3 @@
1
+ import{createRequire as N}from"node:module";import{VisReleaseError as b}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const A=N(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[o,s]=d.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return d.getBuiltinModule(e)}return A(e)},{readFile:I}=y("node:fs/promises"),{isAbsolute:x,join:w}=y("node:path"),R="x-release-please-version",_=e=>e.type==="annotation",O=e=>!_(e),j=(e,o)=>{if(!O(e))throw new b({code:"CONFIG_INVALID",message:`extra-files rule at ${o} has type="${e.type}" — compileRule is regex-only.`});try{return new RegExp(e.search,e.flags??"g")}catch(s){throw new b({cause:s,code:"CONFIG_INVALID",message:`Invalid extra-files regex at ${o}.search: ${s.message}`})}},E=(e,o,s)=>e.replaceAll("{version}",o).replaceAll("{name}",s).replaceAll("{packageName}",s),F=/\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?/,v=(e,o)=>{let s=0;if(o!==void 0){const h=e.indexOf(o);if(h===-1)return;s=h+o.length}const u=e.slice(s),r=F.exec(u);if(r)return{index:s+r.index,match:r[0]}},T=(e,o,s,u,r)=>{const h=e.marker??R,i=[],c=o.split(`
2
+ `);let n=!1,a=!1;for(let t=0;t<c.length;t++){const l=c[t];if(l.includes(h))if(n=!0,l.slice(0,l.indexOf(h)).replace(/^\s*(?:#|\/\/|\/\*|--|<!--)\s*$/,"").trim()===""){const p=t+1,f=c[p];if(f===void 0){i.push(`extra-files: ${u}[${e.path}] annotation marker on the last line of ${r} (no following line to update).`);continue}const g=v(f,e.anchor);if(!g){i.push(e.anchor===void 0?`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but no semver-shaped substring on the following line.`:`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but anchor "${e.anchor}" / no semver-shaped substring after it on the following line.`);continue}c[p]=f.slice(0,g.index)+s+f.slice(g.index+g.match.length),a=!0}else{const p=v(l,e.anchor);if(!p){i.push(e.anchor===void 0?`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but no semver-shaped substring on the marked line.`:`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but anchor "${e.anchor}" / no semver-shaped substring after it on the marked line.`);continue}c[t]=l.slice(0,p.index)+s+l.slice(p.index+p.match.length),a=!0}}return n?a?{content:c.join(`
3
+ `),warnings:i}:{warnings:i}:(i.push(`extra-files: ${u}[${e.path}] annotation marker "${h}" not found in ${r}; rule may be stale.`),{warnings:i})},M=async(e,o,s,u,r)=>{let h;try{h=await I(e,"utf8")}catch(n){return n.code==="ENOENT"?{warnings:[`extra-files: ${r} → ${e} does not exist; skipping ${o.length} rule(s).`]}:{warnings:[`extra-files: ${r} → could not read ${e}: ${n.message}`]}}let i=h;const c=[];for(const n of o){if(_(n)){const f=T(n,i,s,r,e);c.push(...f.warnings),f.content!==void 0&&(i=f.content);continue}const a=j(n,`${r}[${n.path}]`),t=n.replace===void 0?s:E(n.replace,s,u);let l=!1;const p=i.replace(a,(f,...g)=>(l=!0,n.replace===void 0?t:t.replaceAll(/\$([&$1-9])/g,(q,$)=>{if($==="&")return f;if($==="$")return"$";const k=Number.parseInt($,10)-1,m=g[k];return typeof m=="string"?m:""})));if(!l){c.push(`extra-files: ${r}[${n.path}] regex /${n.search}/${n.flags??"g"} matched nothing in ${e}; rule may be stale.`);continue}i=p}return i===h?{warnings:c}:{content:i,warnings:c}},V=async(e,o,s,u,r=[],h=[])=>{const i=[],c=[],n=new Map;for(const a of r){const t=x(a.path)?a.path:w(e,a.path),l=n.get(t)??{label:"workspace",rules:[]};l.rules.push(a),n.set(t,l)}for(const a of h){const t=x(a.path)?a.path:w(o,a.path),l=n.get(t)??{label:"per-package",rules:[]};l.rules.push(a),n.set(t,l)}for(const[a,t]of n){const l=t.rules[0],p=await M(a,t.rules,s,u,t.label);c.push(...p.warnings),p.content!==void 0&&i.push({content:p.content,path:a,rule:l})}return{warnings:c,writes:i}};export{R as DEFAULT_ANNOTATION_MARKER,V as applyExtraFilesForRelease,j as compileRule};
@@ -0,0 +1,11 @@
1
+ import{createRequire as F}from"node:module";import{j as w,E as k,s as b,q as T,V as I,I as j}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{y as R}from"../packem_shared/index-BDmTbWX1.js";import{a as J,r as D,b as m,c as E}from"../packem_shared/ai-fix-9Vzlp6XU.js";import{p}from"./bin.js";import{l as N}from"../packem_shared/failure-log-CEWP3bP0.js";const A=F(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=o=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,r]=h.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return h.getBuiltinModule(o)}return A(o)},{createInterface:q}=O("node:readline"),B={"ambiguous-match":"ambiguous match",applied:"applied",error:"error","missing-file":"missing file","no-match":"no match","outside-workspace":"outside workspace"},S=(o,t,r)=>{const e=E(o,t,r),s=R(o,e);return s===""||s.startsWith("..")?e:s},L=(o,t,r)=>{const e=[w(`Fix proposal (${o.provider}, confidence: ${o.confidence})`),"",o.explanation||k("<no explanation>")];if(o.cannotFix)return e.push(""),e.push(b(`Cannot fix automatically: ${o.cannotFix}`)),e.join(`
2
+ `);if(o.patches.length===0)return e.push(""),e.push(b("No patches were proposed.")),e.join(`
3
+ `);e.push(""),e.push(w(`Patches (${String(o.patches.length)}):`));for(const[s,i]of o.patches.entries()){const a=S(t,r,i.file);e.push(""),e.push(T(`[${String(s+1)}] ${a}`)),i.reason&&e.push(k(` reason: ${i.reason}`));for(const u of i.oldString.split(`
4
+ `))e.push(I(` - ${u}`));for(const u of i.newString.split(`
5
+ `))e.push(j(` + ${u}`))}return e.join(`
6
+ `)},C=(o,t,r)=>{const e=[];for(const s of o){const i=s.absolutePath?R(t,s.absolutePath)||s.absolutePath:S(t,r,s.patch.file),a=B[s.status];s.status==="applied"?e.push(j(` ✓ ${i}: ${a}`)):e.push(I(` ✗ ${i}: ${a}${s.error?` (${s.error})`:""}`))}return e.join(`
7
+ `)},y=o=>{let t=0,r=0;for(const e of o)e.status==="applied"?t+=1:r+=1;return{applied:t,failed:r}},M=o=>new Promise(t=>{const r=q({input:process.stdin,output:process.stderr});r.question(`${o} (y/N) `,e=>{r.close();const s=e.trim().toLowerCase();t(s==="y"||s==="yes")})}),U=o=>o??process.cwd(),Q=async({argument:o,logger:t,options:r,visConfig:e,workspaceRoot:s})=>{const i=o[0],a=U(s),u=(r.format??"text")==="json";if(!i){if(u){const l=N(a);process.stdout.write(`${JSON.stringify({availableTasks:l,error:"No task ID specified"},void 0,2)}
8
+ `)}else{p.error("No task ID specified. Usage: vis ai fix <project>:<target>");const l=N(a);if(l.length>0){p.info("Tasks with captured failure logs:");for(const f of l)p.info(` - ${f}`)}else p.notice("No failure logs found. Re-run a failing task with `vis run` to capture logs.")}process.exitCode=1;return}const n=await J(a,i,{runId:r.run});if(!n){u?process.stdout.write(`${JSON.stringify({error:"No failure log or run summary found",taskId:i},void 0,2)}
9
+ `):(p.error(`No failure log or run summary found for task "${i}".`),p.notice("Re-run the task with `vis run` so its terminal output and run metadata are captured.")),process.exitCode=1;return}n.terminalOutputCaptured||p.warn(`No captured terminal output for "${i}". Re-run with \`vis run\` for a better fix proposal.`);const _=e?.ai,c=await D(n,t,{cache:r.cache!==!1,config:_});if(!c){u&&process.stdout.write(`${JSON.stringify({error:"AI fix proposal failed or no provider available",taskId:i},void 0,2)}
10
+ `),process.exitCode=1;return}const g=r.apply===!0;if(u){const l=g?void 0:await m(a,n.cwd,c,{dryRun:!0}),f=g?await m(a,n.cwd,c):void 0;if(process.stdout.write(`${JSON.stringify({appliedResults:f,dryRunResults:l,failureContext:{cwd:n.cwd,hash:n.hash,runId:n.runId,taskId:n.taskId,terminalOutputCaptured:n.terminalOutputCaptured},proposal:c},void 0,2)}
11
+ `),g&&f){const{failed:P}=y(f);P>0&&(process.exitCode=1)}return}if(t.info(L(c,a,n.cwd)),c.cannotFix||c.patches.length===0)return;const x=await m(a,n.cwd,c,{dryRun:!0}),$=y(x);if(t.info(""),t.info(w("Patch validation:")),t.info(C(x,a,n.cwd)),!g){t.info(""),p.info("Re-run with --apply to write these patches to disk.");return}if($.applied===0){p.error("No patches can be applied (every patch failed validation)."),process.exitCode=1;return}if(r.yes!==!0&&(t.info(""),!await M(`Apply ${String($.applied)} patch${$.applied===1?"":"es"} to disk?`))){p.notice("Aborted. Nothing written.");return}const v=await m(a,n.cwd,c),d=y(v);t.info(""),t.info(w("Apply results:")),t.info(C(v,a,n.cwd)),t.info(""),d.failed===0?p.success(`Applied ${String(d.applied)} patch${d.applied===1?"":"es"}.`):(p.warn(`${String(d.applied)} applied, ${String(d.failed)} failed.`),process.exitCode=1)};export{Q as aiFix};
@@ -0,0 +1,3 @@
1
+ import{VisReleaseError as d}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const u=async(t,e,i=!0)=>t.runner.run("git",e,{cwd:t.cwd,silent:i}),h=async t=>{const e=await u(t,["rev-parse","--abbrev-ref","HEAD"]);if(e.exitCode!==0)return;const i=e.stdout.trim();return i==="HEAD"||i===""?void 0:i},w=async t=>{const e=await u(t,["rev-parse","HEAD"]);return e.exitCode===0?e.stdout.trim():void 0},E=async t=>{const e=await u(t,["rev-parse","--short","HEAD"]);return e.exitCode===0?e.stdout.trim():void 0},_=async t=>{const e=await u(t,["status","--porcelain"]);return e.exitCode===0&&e.stdout.trim()!==""},f=async(t,e)=>(await u(t,["rev-parse","--verify","--quiet",`refs/tags/${e}`])).exitCode===0,p=async(t,e,i="origin")=>{const s=await u(t,["ls-remote","--tags",i,e]);return s.exitCode===0&&s.stdout.trim()!==""},C=async(t,e,i,s={})=>{if(e.length===0&&!s.allowEmpty)throw new d({code:"CONFIG_INVALID",message:"stageAndCommit called with no files (and allowEmpty=false)."});if(e.length>0){const o=await t.runner.run("git",["add","--",...e],{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git add failed: ${o.stderr||o.stdout}`})}const a={...process.env};s.author&&(a.GIT_AUTHOR_NAME=s.author.name,a.GIT_AUTHOR_EMAIL=s.author.email,a.GIT_COMMITTER_NAME=s.author.name,a.GIT_COMMITTER_EMAIL=s.author.email);const r=["commit","-m",i];s.allowEmpty&&r.push("--allow-empty");const n=await t.runner.run("git",r,{cwd:t.cwd,env:a,silent:!0});if(n.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git commit failed: ${n.stderr||n.stdout}`});const c=await w(t);if(!c)throw new d({code:"GIT_OPERATION_FAILED",message:"git commit succeeded but HEAD is not resolvable."});return c},A=6e4;let g;const l=async t=>{const e=Date.now();if(g!==void 0&&e-g.cachedAtMs<A)return g.value;const i=await t.runner.run("gitsign",["--version"],{cwd:t.cwd,silent:!0});return g={cachedAtMs:e,value:i.exitCode===0},g.value},$=async(t,e,i,s={})=>{if(await f(t,e))throw new d({code:"TAG_COLLISION",message:`Tag "${e}" already exists locally. Resolve manually before re-running.`});if(!s.skipRemoteCheck&&await p(t,e,s.remote??"origin"))throw new d({code:"TAG_COLLISION",message:`Tag "${e}" already exists on remote "${s.remote??"origin"}". A previous run may have pushed tags but failed mid-publish — inspect the remote and either re-use the existing tag or delete it before re-running.`});const{signing:a}=s;if(a?.mode==="sigstore"){if(await l(t)){const c=["tag","-a",e];i&&c.push("-m",i);const o=await t.runner.run("gitsign",c,{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`gitsign tag ${e} failed: ${o.stderr||o.stdout}`});return}process.stderr.write(`[vis release] Warning: signing.mode is "sigstore" but \`gitsign\` is not on PATH; falling back to GPG signing for tag ${e}.
2
+ `)}const r=["tag"];a&&(a.key&&a.mode==="gpg"?r.push("-u",a.key):r.push("-s")),i?r.push("-a",e,"-m",i):r.push(e);const n=await u(t,r);if(n.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git tag ${e} failed: ${n.stderr||n.stdout}`})},O=async(t,e={})=>{const i=["push",e.remote??"origin","--tags"];e.atomic&&i.splice(1,0,"--atomic");const s=await u(t,i,!1);if(s.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --tags failed: ${s.stderr||s.stdout}`})},v=async(t,e,i={})=>{const{signing:s}=i;if(s?.mode==="sigstore"){if(await l(t)){const c=["tag","-f","-a","-m",`Floating tag ${e}`,e],o=await t.runner.run("gitsign",c,{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`gitsign tag -f ${e} failed: ${o.stderr||o.stdout}`});if(i.push===!1)return;const m=await u(t,["push",i.remote??"origin","--force",`refs/tags/${e}:refs/tags/${e}`],!1);if(m.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --force refs/tags/${e} failed: ${m.stderr||m.stdout}`});return}process.stderr.write(`[vis release] Warning: signing.mode is "sigstore" but \`gitsign\` is not on PATH; falling back to GPG signing for floating tag ${e}.
3
+ `)}const a=["tag","-f"];s&&(s.key&&s.mode==="gpg"?a.push("-u",s.key):a.push("-s")),a.push(e);const r=await u(t,a);if(r.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git tag -f ${e} failed: ${r.stderr||r.stdout}`});if(i.push===!1)return;const n=await u(t,["push",i.remote??"origin","--force",`refs/tags/${e}:refs/tags/${e}`],!1);if(n.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --force refs/tags/${e} failed: ${n.stderr||n.stdout}`})},y=async(t,e,i,s={})=>{const a=await t.runner.run("git",["add","-A","--",e],{cwd:t.cwd,silent:!0});if(a.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git add ${e} failed: ${a.stderr||a.stdout}`});if((await t.runner.run("git",["diff","--cached","--quiet","--",e],{cwd:t.cwd,silent:!0})).exitCode===0)return{committed:!1,pushed:!1};const r={...process.env};s.author&&(r.GIT_AUTHOR_NAME=s.author.name,r.GIT_AUTHOR_EMAIL=s.author.email,r.GIT_COMMITTER_NAME=s.author.name,r.GIT_COMMITTER_EMAIL=s.author.email);const n=["commit","-m",i];s.sign&&n.push("-S");const c=await t.runner.run("git",n,{cwd:t.cwd,env:r,silent:!0});if(c.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git commit failed: ${c.stderr||c.stdout}`});if(!s.push)return{committed:!0,pushed:!1};const o=s.branch??await h(t);return o?{committed:!0,pushed:(await t.runner.run("git",["push",s.remote??"origin",`HEAD:${o}`],{cwd:t.cwd,silent:!1})).exitCode===0}:{committed:!0,pushed:!1}},G=async(t,e,i={})=>{const s=["push",i.remote??"origin",`HEAD:${e}`];i.force&&s.push("--force-with-lease");const a=await u(t,s,!1);if(a.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",message:`git push ${e} failed: ${a.stderr||a.stdout}`})},x=(t,e)=>`${t}@${e}`,I=/\{(name|unscopedName|version|major|minor|patch|date|channel)\}/g,D=(t,e)=>{const i=e.version??"",[s="",a="",r=""]=i.split(/[-+]/,1)[0].split("."),n={channel:e.channel??"",date:e.date??new Date().toISOString().slice(0,10),major:s,minor:a,name:e.name??"",patch:r,unscopedName:e.name?e.name.replace(/^@[^/]+\//,""):"",version:i};return t.replaceAll(I,(c,o)=>n[o]??"")};export{v as createOrUpdateFloatingTag,$ as createTag,x as defaultTagFor,h as getCurrentBranch,w as getCurrentSha,E as getShortSha,l as gitsignAvailable,_ as hasUncommittedChanges,G as pushBranch,O as pushTags,D as renderTagPattern,C as stageAndCommit,y as stageAndCommitFile,f as tagExists,p as tagExistsRemote};
@@ -0,0 +1 @@
1
+ import{createTaskGraph as v}from"@visulima/task-runner";import{b as y,O as b}from"./bin.js";import{r as E,f as R}from"../packem_shared/selectors-GCJIe342.js";const C=(p,o,a)=>{const n=[],t=new Set,c=(e,l)=>{if(t.has(e))return;t.add(e);const m=o[e]??[];for(const g of m)c(g,l+1);const r=a[e],d=" ".repeat(l);n.push(`${d}${e}${r?.cache===!1?" (no-cache)":""}`)};for(const e of p)c(e,0);return n},S=(p,o,a)=>({roots:p,tasks:Object.fromEntries(Object.entries(a).map(([n,t])=>[n,{cache:t.cache,dependsOn:o[n]??[],outputs:t.outputs,parallelism:t.parallelism,projectRoot:t.projectRoot,target:t.target}]))}),J=async({argument:p,logger:o,options:a,process:n,visConfig:t,workspaceRoot:c})=>{const e=p[0];if(!e)throw new Error("Missing selector. Usage: vis action-graph <selector>");if(!c)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{config:l,packageJsons:m,workspace:r}=y(c,t),d=b(c,r,m),g=await E(e,r,n.cwd,c),{target:f}=g;let h=g.projects;a.query&&(h=R(h,r,a.query));const j=h.filter(i=>r.projects[i]?.targets?.[f]!==void 0);if(j.length===0){o.info(`No projects have a "${f}" target.`);return}const w=j.map(i=>{const k=r.projects[i],u=k.targets?.[f],$={project:i,target:f};return{cache:u?.cache,id:`${i}:${f}`,outputs:u?.outputs??[],overrides:{command:u?.command},parallelism:u?.parallelism,projectRoot:k.root,target:$}}),s=v(w,{projectGraph:d,targetDefaults:l.tasks,workspace:r});if(a.json){o.info(JSON.stringify(S(s.roots,s.dependencies,s.tasks),null,2));return}const O=C(s.roots,s.dependencies,s.tasks);o.info(`Execution plan (${Object.keys(s.tasks).length} task(s), ${s.roots.length} root(s)):`),o.info("");for(const i of O)o.info(i)};export{J as default};
@@ -0,0 +1 @@
1
+ import{I as p,W as d}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{r as g,a as k}from"../packem_shared/command-runtime-CR70qSUM.js";import{i as v}from"../packem_shared/utils-Cxree603.js";const h=async({argument:l,logger:a,options:e,visConfig:o,workspaceRoot:c})=>{const s=l;if(!s||s.length===0)throw new Error("No command specified. Usage: vis exec <command> [args...]");const[i,...t]=s,r=c??process.cwd(),m=g({logger:a,options:e,visConfig:o},r),f=p(r,{backend:k(m),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),n=d(f,{args:t,command:i,filter:v(e.filter),parallel:e.parallel||!1,recursive:e.recursive||!1,reverse:e.reverse||!1,shellMode:e.shellMode||!1,workspaceRoot:e.workspaceRoot||!1},r,a);n!==0&&(process.exitCode=n)};export{h as default};
@@ -0,0 +1,5 @@
1
+ import{createRequire as v}from"node:module";import{f as l,v as d,m as r,T as w}from"../packem_shared/index-BDmTbWX1.js";import{v as y}from"./bin.js";const g=v(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=o=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[n,i]=t.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return t.getBuiltinModule(o)}return g(o)},{homedir:s}=u("node:os"),{createInterface:_}=u("node:readline"),c=y(),m=[r(s(),".zshrc"),r(s(),".zshenv"),r(s(),".bashrc"),r(s(),".bash_profile"),r(s(),".profile"),r(s(),".config","fish","config.fish")],b=o=>{const n=[];for(const i of m)if(l(i))try{const f=d(i).split(`
2
+ `),a=f.filter(e=>!e.includes(".vis/bin")&&!e.includes("VIS_HOME")&&!e.includes("# vis "));a.length!==f.length&&(w(i,a.join(`
3
+ `)),n.push(i))}catch{o.warn(`warning: could not clean ${i}`)}return n},q=async({fs:o,logger:n,options:i})=>{if(!l(c)){n.info("vis is not installed (no ~/.vis directory found).");return}n.info("This will remove:"),n.info(` ${c}/`);const f=m.filter(e=>l(e)&&d(e).includes(".vis"));for(const e of f)n.info(` Lines in ${e}`);if(!i.yes){if(!process.stdin.isTTY)throw new Error("Non-interactive terminal. Use --yes to confirm.");const e=_({input:process.stdin,output:process.stdout}),p=await new Promise(h=>{e.question(`
4
+ Type "uninstall" to confirm: `,h)});if(e.close(),p.trim()!=="uninstall"){n.info("Aborted.");return}}const a=b(n);for(const e of a)n.info(`Cleaned ${e}`);try{await o.rm(c,{force:!0,recursive:!0}),n.info(`
5
+ ✓ Removed ${c}`)}catch(e){throw new Error(`Failed to remove ${c}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}n.info("✓ vis has been uninstalled.")};export{q as default};
@@ -0,0 +1 @@
1
+ import{I as f,P as d}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{r as k,a as m}from"../packem_shared/command-runtime-CR70qSUM.js";const v=async({argument:o,logger:s,options:i,process:c,visConfig:e,workspaceRoot:r})=>{if(!o||o.length===0)throw new Error("No package specified. Usage: vis info <package> [field...]");const[t,...l]=o,a=r??c.cwd,p=k({logger:s,options:i,visConfig:e},a),g=f(a,{backend:m(p),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),n=d(g,{fields:l,json:i.json||!1,package:t},a,s);n!==0&&n!==1&&(process.exitCode=n)};export{v as default};
@@ -0,0 +1,27 @@
1
+ import{createRequire as A}from"node:module";import{m,y as N,f as $,T as S}from"../packem_shared/index-BDmTbWX1.js";import{b as F,q as h}from"./config.js";import{p as e}from"./bin.js";import{w as I}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{w as P}from"../packem_shared/build-scripts-CCCi8U66.js";import{O as R}from"../packem_shared/native-config-sync-BEkJW7g3.js";import{S as T}from"../packem_shared/min-release-age-D1alDE3K.js";const B=A(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=t=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[s,o]=g.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return g.getBuiltinModule(t)}return B(t)},{execFileSync:E}=x("node:child_process"),{createInterface:M}=x("node:readline"),q=t=>{const s=[];return $(m(t,"turbo.json"))&&s.push("turborepo"),$(m(t,"nx.json"))&&s.push("nx"),$(m(t,".moon"))&&s.push("moon"),s},C=(t,s)=>new Promise(o=>{t.question(s,i=>{o(i.trim())})}),u=async(t,s,o=!0)=>{const i=await C(t,`${s} ${o?"[Y/n]":"[y/N]"} `);return i===""?o:i.toLowerCase()==="y"||i.toLowerCase()==="yes"},w=(t,s)=>{const o=[],i=Object.entries(s.allowBuilds).filter(([,l])=>l).map(([l])=>` "${l}": true,`).join(`
2
+ `),a=[` installScripts: {
3
+ allow: ${i?`{
4
+ ${i}
5
+ }`:"{}"},
6
+ },`];s.minimumReleaseAge!==void 0&&a.push(` firstSeen: {
7
+ minutes: ${String(s.minimumReleaseAge)},
8
+ },`);let n=` policies: {
9
+ ${a.join(`
10
+ `)}
11
+ },`;return s.enableSocket&&(n+=`
12
+ socket: { enabled: true },`),s.enableDepsDev&&(n+=`
13
+ depsDev: { enabled: true },`),o.push(` security: {
14
+ ${n}
15
+ },`),s.staged&&o.push(` staged: {
16
+ "*": ["vis lint --staged --fix", "vis fmt --staged"],
17
+ },`),`import { defineConfig } from "@visulima/vis/config";
18
+
19
+ export default defineConfig({
20
+ ${o.join(`
21
+
22
+ `)}
23
+ });
24
+ `},G=async(t,s,o)=>{const i=M({input:process.stdin,output:process.stdout});e.info(`
25
+ vis init — interactive setup
26
+ `);const a=await u(i," Enable Socket.dev security scanning?");a&&(e.success(" Socket.dev enabled — scores, alerts, and supply chain data active."),process.env.VIS_SOCKET_TOKEN||e.notice(" Set VIS_SOCKET_TOKEN for a custom API token (optional).")),e.info("");const n=await u(i," Enable Google deps.dev (OpenSSF Scorecard + GHSA advisories)?");n&&e.success(" deps.dev enabled — Scorecard signals and advisories merged into the security report."),e.info("");const l=await u(i," Scan for packages with build scripts?"),p={};if(l){e.info(" Scanning node_modules...");const c=P(t,{});if(c.length>0){e.info(` Found ${String(c.length)} package${c.length===1?"":"s"} with build scripts:
27
+ `);for(const r of c){const f=await u(i,` Allow ${r}?`,!1),_=r.split(" (")[0]??r;p[_]=f,f&&e.success(` ✓ ${_} approved`)}}else e.info(" No packages with build scripts found.")}e.info("");const D=await u(i," Enforce a minimum release age (block freshly-published versions)?");let d;if(D){const c=await C(i,` Minimum age in minutes (default ${String(h)} = 2 days): `),r=c===""?h:Number.parseInt(c,10);d=Number.isFinite(r)&&r>0?r:h,e.success(` minimumReleaseAge: ${String(d)} minutes`)}e.info("");const b=await u(i," Set up pre-commit hooks (lint-staged)?",!1);let y=!1;(s.name==="pnpm"||s.name==="yarn"||s.name==="npm"||s.name==="bun")&&(e.info(""),y=await u(i,` Sync security settings to ${s.name} config?`));const v=q(t);if(v.length>0&&(e.info(""),e.info(` Detected existing tools: ${v.join(", ")}`),await u(i,` Run \`vis migrate\` for ${v.join(", ")}?`,!1))){i.close();const[c,...r]=s.name==="pnpm"?["pnpm","exec"]:s.name==="yarn"?["yarn","exec"]:s.name==="bun"?["bunx"]:["npx"];for(const f of v){e.info(` Migrating from ${f}...`);try{E(c,[...r,"vis","migrate",f],{cwd:t,stdio:"inherit"})}catch{e.warn(` Migration from ${f} had issues — run \`vis migrate ${f}\` manually.`)}}if($(o))e.success(`Migrated config written to ${o}`);else{const f=w(s.name,{allowBuilds:p,enableDepsDev:n,enableSocket:a,minimumReleaseAge:d,staged:b});S(o,f),e.success(`Created ${o}`)}e.notice(" Run 'vis doctor' to see your project's full health status.");return}i.close(),e.info("");const O=w(s.name,{allowBuilds:p,enableDepsDev:n,enableSocket:a,minimumReleaseAge:d,staged:b});if(S(o,O),e.success(`Created ${o}`),y){const c=Object.fromEntries(Object.entries(p).filter(([,r])=>r));for(const r of R(s.name,t,c))e.success(` ${r}`);for(const r of T(s.name,t,d))e.success(` ${r}`)}e.info(""),e.info(" Setup complete. Your config:");const j=[a&&"Socket.dev",n&&"deps.dev"].filter(Boolean);e.info(` Security: ${j.length>0?`${j.join(" + ")} enabled`:"defaults only"}`),e.info(` Build scripts: ${Object.values(p).filter(Boolean).length} approved`),e.info(` Min age: ${d===void 0?"not enforced":`${String(d)} minutes`}`),e.info(` Git hooks: ${b?"lint-staged configured":"not configured"}`),e.info(` PM sync: ${y?"done":"skipped"}`),e.info(""),e.notice(" Run 'vis doctor' to see your project's full health status."),e.info("")},K=(t,s,o,i)=>{const a=w(s.name,{allowBuilds:{},enableDepsDev:!1,enableSocket:!1,minimumReleaseAge:h,staged:!1});if(S(i,a),e.success(`Created ${i}`),e.info(" Secure defaults are applied automatically by defineConfig()."),o.syncNative){for(const n of R(s.name,t,{}))e.success(` ${n}`);for(const n of T(s.name,t,h))e.success(` ${n}`)}e.info(""),e.notice("Run 'vis doctor' for a full health check, or 'vis init' in a terminal for guided setup.")},k=(t,s,o)=>{const i=m(t,".."),a=m(s,"node_modules","@visulima","vis","schemas",o),n=N(i,a),l=n===""?`./${o}`:n.split(/[/\\]/u).join("/");return l.startsWith(".")?l:`./${l}`},Y=(t,s)=>{const o=k(m(t,"project.json"),s,"project.schema.json"),i=k(m(t,"vis.config.ts"),s,"vis-config.schema.json");e.info(""),e.info("Paste these into your config files to get editor IntelliSense:"),e.info(""),e.info(` project.json → "$schema": "${o}"`),e.info(` vis.config.ts → see ${i} (vis.config.ts is TypeScript; use the import path directly)`),e.info(""),e.notice("For nested project.json files, the `..` depth changes — run `vis migrate nx` to auto-rewrite all of them.")},X=async({options:t,workspaceRoot:s})=>{const o=s??process.cwd();if(t.schema){Y(o,o);return}const i=I(o),a=F(o);if(a&&!t.force){e.warn(`Config already exists: ${a}`),e.notice("Use --force to overwrite, or edit the existing file.");return}const n=a??m(o,"vis.config.ts");process.stdin.isTTY&&t.interactive!==!1?await G(o,i,n):K(o,i,t,n)};export{k as buildSchemaRefForTesting,X as default};
@@ -0,0 +1,5 @@
1
+ import{I as $,E as u,V as k,s as y}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{p}from"./bin.js";import{r as N,M,a as R,b as S,c as x,d as A,e as V,f as b,g as C,h as E}from"../packem_shared/s1ngularity-DCPmPE5M.js";import{g as P,a as j,r as B}from"../packem_shared/provenance-BFEwKgI3.js";import{r as D}from"../packem_shared/signatures-Xpd6HjG_.js";const v=new Set(["archivedRepo","author","downloads","expiredDomains","metadata","newBin","provenance","s1ngularity","signatures"]),I=r=>{const s=r.trim();if(s==="")return;if(s.startsWith("@")){const o=s.indexOf("@",1);return o===-1?{name:s,spec:void 0}:{name:s.slice(0,o),spec:s.slice(o+1)||void 0}}const i=s.indexOf("@");return i===-1?{name:s,spec:void 0}:{name:s.slice(0,i),spec:s.slice(i+1)||void 0}},O=r=>{if(r===void 0||r.trim()==="")return;const s=new Set;for(const i of r.split(",")){const o=i.trim();if(!v.has(o))throw new Error(`Unknown marshall in --only: ${o}. Known: ${[...v].sort().join(", ")}.`);s.add(o)}return s},m=(r,s)=>r===void 0||r.has(s),F=r=>r?.has("signatures")??!1,H=async({argument:r,options:s,workspaceRoot:i})=>{if(!r||r.length===0)throw new Error("No package specified. Usage: vis inspect <package>[@<spec>]");const o=I(r[0]);if(o===void 0)throw new Error(`Invalid package argument: "${String(r[0])}". Usage: vis inspect <package>[@<spec>]`);const t=O(s.only),f=await P(o.name,{workspaceRoot:i});if(f===void 0){p.error(`Package ${o.name} not found in the registry.`),process.exitCode=2;return}const g=j(f,o.spec);if(g===void 0){p.error(`Could not resolve ${o.name}@${o.spec??"latest"} to a published version.`),process.exitCode=2;return}const c=[{name:o.name,version:g}],n=new M;if(m(t,"author")){const e=await N(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"author",message:a.message,packageName:a.packageName,severity:a.severity})}if(m(t,"provenance")){const e=await B(c);for(const a of e)n.add({marshall:"provenance",message:`Prior version ${a.priorVersionWithProvenance} had provenance but ${a.version} does not.`,packageName:a.packageName,severity:"error"})}if(m(t,"s1ngularity")){const e=await R(c,{workspaceRoot:i});for(const a of e){const d=a.hookChanges.map(w=>`${w.hook} (${w.kind})`).join(", "),l=a.hookChanges.length===1;n.add({marshall:"s1ngularity",message:`${a.version} ${l?"has an":"has"} install-script ${l?"change":"changes"} [${d}] AND dropped the provenance attestation that ${a.priorVersion} carried — this is the s1ngularity compromised-publish shape.`,packageName:a.packageName,severity:"error"})}}if(m(t,"newBin")){const e=await S(c);for(const a of e){const d=a.newBins.map(l=>l.command).join(", ");n.add({marshall:"newBin",message:`${a.toVersion} adds new bin script${a.newBins.length===1?"":"s"}: ${d} (prior: ${a.fromVersion}).`,packageName:a.packageName,severity:"warning"})}}if(m(t,"metadata")){const e=await x(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"metadata",message:`Missing/invalid metadata: ${a.issues.join(", ")}.`,packageName:a.packageName,severity:"warning"})}if(m(t,"downloads")){const e=await A([o.name]);for(const a of e){const d=a.downloadsLastMonth===void 0?"unknown":String(a.downloadsLastMonth);n.add({marshall:"downloads",message:a.kind==="no-data"?"npm stats API returned no monthly download data.":`Only ${d} downloads in the past month.`,packageName:a.packageName,severity:a.severity})}}if(m(t,"expiredDomains")){const e=await V(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"expiredDomains",message:a.kind==="expired"?`Maintainer email domain ${a.domain} (${a.maintainer}) is unregistered — potential hijack risk.`:`Could not verify maintainer email domain ${a.domain} (${a.maintainer}).`,packageName:a.packageName,severity:a.severity})}if(F(t)){const e=await D(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"signatures",message:a.message,packageName:a.packageName,severity:a.severity})}if(m(t,"archivedRepo")){const e=await b(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"archivedRepo",message:a.kind==="archived"?`Source repo ${a.owner}/${a.repo} is archived${a.archivedAt===void 0?"":` (since ${a.archivedAt})`}.`:`Source repo ${a.owner}/${a.repo} returned 404 from GitHub.`,packageName:a.packageName,severity:"warning"})}const h=n.all();if(s.json===!0)process.stdout.write(`${JSON.stringify(C(h),void 0,2)}
2
+ `);else{const e=`${o.name}@${g}`;if(h.length===0)p.info(`${$("✓")} ${e} — no findings.`);else{p.info(`${u("Inspecting")} ${e}`);for(const l of E(h))process.stdout.write(`${l}
3
+ `);const a=n.errors().length,d=n.warnings().length;process.stdout.write(`
4
+ ${u("Summary:")} ${k(`${String(a)} error${a===1?"":"s"}`)}, ${y(`${String(d)} warning${d===1?"":"s"}`)}.
5
+ `)}}(n.hasErrors()||s.strict===!0&&!n.isEmpty())&&(process.exitCode=1)};export{H as default,I as parsePackageArg};
@@ -0,0 +1 @@
1
+ import{m as w,f as _,H as B,j as A}from"../packem_shared/index-BDmTbWX1.js";import{p as t}from"./bin.js";import{w as F,I as h,p as H,h as T}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{a as M,r as N}from"../packem_shared/command-runtime-CR70qSUM.js";import{s as Q}from"../packem_shared/typosquats-DN78xx1x.js";import{h as U,P as V}from"../packem_shared/peer-warnings-BXAzXqY3.js";import{i as W}from"../packem_shared/utils-Cxree603.js";const G=["pnpm-lock.yaml","yarn.lock","package-lock.json","npm-shrinkwrap.json","bun.lock","bun.lockb"],J=a=>{let r=a;for(;;){for(const l of G)if(_(w(r,l)))return!0;const n=B(r);if(n===r||A(r).root===r)return!1;r=n}},g=new Set(["aube","auto","bun","npm","pnpm","yarn"]),se=async a=>{const{argument:r,fs:n,logger:l,options:e,visConfig:i,workspaceRoot:C}=a,s=C??process.cwd();if(r&&r.length>0){const o=e,{default:q}=await import("./handler16.js"),I=o.marshallCheck===!1||o["no-marshall-check"]===!0?!1:void 0,z=o.socketCheck===!1||o["no-socket-check"]===!0?!1:void 0,E=o.typosquatCheck===!1||o["no-typosquat-check"]===!0?!1:void 0,P=o.runScripts===!0||o["run-scripts"]===!0,j=o.workspaceRoot===!0||o["workspace-root"]===!0,D=o.saveOptional===!0||o["save-optional"]===!0,$=e.dev===!0,L={autoInstallPeers:!1,exact:o.exact===!0,filter:e.filter,global:!1,marshallCheck:I,runScripts:P,saveDev:$,saveOptional:D,savePeer:!1,socketCheck:z,to:void 0,typosquatCheck:E,workspace:!1,workspaceRoot:j};await q({...a,argument:r,options:L});return}if(e.typosquatCheck!==!1&&!await Q(s,i?.security?.typosquatAllowlist)){process.exitCode=1;return}const c=e.installer;if(c&&!g.has(c)){t.error(`Invalid --installer value: "${c}". Expected one of: ${[...g].join(", ")}.`),process.exitCode=1;return}const y=c,b=e.aube===!1,f=M(N({logger:l,options:e,visConfig:i},s));let p;try{p=b?f===void 0?F(s):h(s,{backend:f}):h(s,{backend:y??f,configBackend:i?.install?.backend,configCorepack:i?.install?.corepack})}catch(o){t.error(o instanceof Error?o.message:String(o)),process.exitCode=1;return}const m=H(s,p);m&&t.warn(m);const x=W(e.filter),u=e.ci||!1,d=e.frozenLockfile||u,O=e.frozenLockfile===!1||e.force||e.lockfileOnly,R=J(s),v=d||!O&&R;if(!d&&v&&!e.silent&&t.info("Defaulting to frozen lockfile (pass --no-frozen-lockfile to allow lockfile updates)."),u){t.info("Clean install: removing node_modules...");try{await n.rm(w(s,"node_modules"),{force:!0,recursive:!0})}catch(o){t.error(`Failed to remove node_modules: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1;return}}const{code:k,output:S}=await T(p,{dev:e.dev||!1,filter:x,force:e.force||!1,frozenLockfile:v,ignoreScripts:!e.runScripts,lockfileOnly:e.lockfileOnly||!1,noOptional:e.optional===!1,offline:e.offline||!1,prod:e.prod||!1,recursive:e.recursive||!1,silent:e.silent||!1,workspaceRoot:e.workspaceRoot||!1},s,l,{ciMode:u,preferOffline:e.preferOffline||!1});k!==0&&(process.exitCode=k),k===0&&!e.silent&&U(S)&&t.info(V)};export{se as default};
@@ -0,0 +1 @@
1
+ import{createRequire as E}from"node:module";import{I as x,E as j,V as T,s as A}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as L,O as B}from"../packem_shared/index-BDmTbWX1.js";import{l as b,c as N,p as f,f as F,b as z,P as U,R as V,Y,Z as H,_ as C,a0 as J,a1 as W,a2 as $,B as Z,a3 as G}from"./bin.js";import"../packem_shared/public-api-WqUCiyIe.js";import{I as K,M as Q,R as X}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{r as ee,a as se}from"../packem_shared/command-runtime-CR70qSUM.js";import{r as P,a as oe,p as te,b as ne}from"../packem_shared/resolve-explicit-C6WM-I2u.js";import{r as re}from"../packem_shared/typosquats-DN78xx1x.js";import{f as _,i as R}from"../packem_shared/utils-Cxree603.js";import{a as ae}from"./config.js";const q=E(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=o=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[c,e]=w.versions.node.split(".").map(Number);if(c>22||c===22&&e>=3||c===20&&e>=16)return w.getBuiltinModule(o)}return q(o)},{createInterface:O}=I("node:readline"),S=o=>o==="default"?"catalog:":`catalog:${o}`,v=o=>o==="default"?"default catalog":`catalog "${o}"`,ie=(o,c)=>{const e=[];for(const[s,t]of c)s.includes(":")||t.has(o)&&e.push(s);if(e.length===0)return;if(e.length===1){const[s]=e;return{source:v(s),spec:S(s)}}const r=e.find(s=>s==="default")??e[0],a=e.filter(s=>s!==r);return{candidates:[...e],conflict:!0,source:`${v(r)} (also in: ${a.map(s=>v(s)).join(", ")})`,spec:S(r)}},ce=(o,c)=>{const e=new Map;for(const[i,u]of c){if(!i.includes(":"))continue;const p=u.get(o);p!==void 0&&e.set(p,(e.get(p)??0)+1)}if(e.size===0)return;const r=[...e.entries()],a=r.reduce((i,[,u])=>i+u,0);if(r.length===1){const[[i]]=r;return{source:`siblings (${String(a)} pkg${a===1?"":"s"} on ${i})`,spec:i}}const s=[...r].sort((i,u)=>u[1]-i[1]),[t,n]=s[0],l=s.slice(1).map(([i,u])=>`${i} (×${String(u)})`);return{candidates:s.map(([i])=>i),conflict:!0,source:`siblings (most common: ${t} ×${String(n)}; conflicts: ${l.join(", ")})`,spec:t}},le=(o,c)=>ie(o,c)||ce(o,c),pe=(o,c,e)=>{const r=[];for(const a of o.values()){const{overall:s}=a.score,t=Z(s),n=`${String(Math.round(s*100))}%`,l=a.alerts.length,i=$(a),u=H(i,a.version,e),p=t==="red"?T:t==="yellow"?A:x;if(u?f.info(` ${p(n)} ${C(a)} ${j(`[accepted: ${u.reason}]`)}`):f.info(` ${p(n)} ${C(a)}`),l>0){const g=a.alerts.filter(d=>d.severity==="critical"||d.severity==="high").length;g>0&&f.warn(` ${String(g)} critical/high alert${g===1?"":"s"}`)}s<c&&!u&&r.push(a)}return r},fe=async(o,c)=>{const e=O({input:process.stdin,output:process.stdout}),r=n=>new Promise(l=>{e.question(n,i=>{l(i.trim())})}),a=String(Math.round(c*100));f.warn(""),f.warn(`${String(o.length)} package${o.length===1?"":"s"} scored below the minimum threshold (${a}%):`);for(const n of o){const l=$(n),i=`${String(Math.round(n.score.overall*100))}%`;f.warn(` • ${l}@${n.version} — score: ${i} (${J(n.score.overall)})`)}f.warn("");const s=await r("Continue adding these packages? [y/N] ");if(s.toLowerCase()!=="y"&&s.toLowerCase()!=="yes")return e.close(),!1;const t=await r("Remember this decision? (prints config snippet) [y/N] ");if(e.close(),t.toLowerCase()==="y"||t.toLowerCase()==="yes"){f.notice(""),f.notice("Add the following to security.acceptedRisks in vis.config.ts:"),f.notice("");for(const n of o){const l=$(n),i=W(l,n.version,n.score.overall,"Reviewed and accepted");f.notice(i)}f.notice("")}return!0},ue=async(o,c,e,r)=>{const a=await P(o);if(a.length===0)return!0;f.info(""),f.info(`${c.map(n=>n.displayName).join(" + ")} security check:`);const s=await F(c,a);if(s.size===0)return f.info(" Could not fetch security data. Proceeding."),!0;const t=pe(s,e,r);return t.length===0?(f.info(""),!0):process.stdin.isTTY?fe(t,e):(f.warn(`Aborting: ${String(t.length)} package${t.length===1?"":"s"} below minimum score. Use --no-socket-check to skip.`),!1)},de=["dependencies","devDependencies","peerDependencies","optionalDependencies"],ge=o=>o.savePeer?"peerDependencies":o.saveOptional?"optionalDependencies":o.saveDev?"devDependencies":"dependencies",D=(o,c)=>o.startsWith("catalog:")||!c?o:o.replace(/^[\^~]/,""),me=async(o,c)=>{const e=[];for(const s of o){const{name:t,versionSpec:n}=_(s);if(!t)continue;if(n!==void 0){e.push({explicit:n,name:t});continue}const l=le(t,c);if(l){l.conflict&&f.warn(`${t}: ambiguous constraint — picking ${l.spec} (${l.source}). Pass ${t}@<version> to override.`),e.push({entry:{name:t,source:l.source,spec:l.spec},kind:"resolved",name:t});continue}e.push({kind:"missing",name:t})}const r=e.filter(s=>"kind"in s&&s.kind==="missing").map(s=>s.name),a=r.length>0?await ne(r):new Map;return e.map(s=>{if("explicit"in s)return{name:s.name,source:"explicit",spec:s.explicit};if(s.kind==="resolved")return s.entry;const t=a.get(s.name);if(t===void 0)throw new Error(`--to: cannot resolve a version for "${s.name}" (not in any catalog or sibling, and registry lookup failed). Pass ${s.name}@<version> explicitly.`);const n=`^${t}`;return f.info(`${s.name}: no existing constraint — using registry latest (${n}). Add to a catalog to share this version across workspace packages.`),{name:s.name,source:"registry latest",spec:n}})},he=(o,c,e,r)=>{for(const{name:a,spec:s}of c){const t=D(s,r);for(const l of de){if(l===e)continue;const i=o[l];i?.[a]!==void 0&&(delete i[a],Object.keys(i).length===0&&delete o[l])}let n=o[e];n===void 0&&(n={},o[e]=n),n[a]=t}},ke=async({ignoreScripts:o,logger:c,options:e,packages:r,pm:a,target:s,visConfig:t,workspaceRoot:n})=>{const{workspace:l}=z(n,t??{}),i=l.projects[s];if(!i){const m=Object.keys(l.projects).sort();throw new Error(`--to: workspace package "${s}" not found. Available: ${m.length>0?m.slice(0,10).join(", "):"(none)"}${m.length>10?`, ... (${String(m.length-10)} more)`:""}.`)}const u=L(n,i.root,"package.json"),{packageManager:p}=U(n),g=V(n,p),d=ge(e),k=e.exact??!1,h=await me(r,g);if(h.length===0)return 0;const y=ae(u);he(y,h,d,k),B(u,y,{indent:Y(u,{useEditorconfig:t?.editorconfig??!0}),overwrite:!0});for(const m of h){const M=D(m.spec,k);f.info(`${x("+")} ${m.name}@${M} → ${s}/${d} (${j(m.source)})`)}return X(a,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:o,lockfileOnly:!1,noOptional:!1,offline:!1,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},n,c)},_e=async({argument:o,logger:c,options:e,visConfig:r,workspaceRoot:a})=>{let s=o;if(!s||s.length===0)throw new Error("No packages specified. Usage: vis add <packages...>");if(e.typosquatCheck!==!1){const p=s.map(d=>_(d)),g=await re(p.map(d=>d.name),r?.security?.typosquatAllowlist);if(!g.ok){process.exitCode=1;return}s=p.map((d,k)=>{const h=g.packages[k];return h!==d.name?d.versionSpec?`${h}@${d.versionSpec}`:h??"":s[k]??""})}if(e.marshallCheck!==!1){const p=await P(s);if(p.length>0){const g=await oe(p,{config:r?.security?.marshalls,workspaceRoot:a});if(!await te(g)){process.exitCode=1;return}}}if(e.socketCheck!==!1){const p=new Set;b("socket")&&p.add("socket"),b("depsDev")&&p.add("deps-dev");const g=N(r?.security,{disabled:p,minimumScore:r?.security?.policies?.score?.minimum});if(g.length>0){const d=r?.security?.policies?.score?.minimum??G;if(!await ue(s,g,d,r?.security?.acceptedRisks)){process.exitCode=1;return}}}const t=process.cwd(),n=ee({logger:c,options:e,visConfig:r},a??t),l=K(a??t,{backend:se(n),configBackend:r?.install?.backend,configCorepack:r?.install?.corepack}),i=!e.runScripts;if(e.to){if(e.global||e.workspaceRoot)throw new Error("--to is incompatible with --global / --workspace-root.");if(e.filter&&R(e.filter).length>0)throw new Error("--to and --filter are mutually exclusive — --to already targets one package.");if(!a)throw new Error("--to requires a monorepo workspace. Run from inside a pnpm/bun/yarn/npm workspace.");const p=await ke({ignoreScripts:i,logger:c,options:e,packages:s,pm:l,target:e.to,visConfig:r,workspaceRoot:a});p!==0&&(process.exitCode=p);return}const u=Q(l,{exact:e.exact||!1,filter:R(e.filter),global:e.global||!1,optional:e.saveOptional||!1,packages:s,peer:e.savePeer||!1,saveDev:e.saveDev||!1,workspace:e.workspace||!1,workspaceRoot:e.workspaceRoot||!1},t,c,{autoInstallPeers:e.autoInstallPeers||!1,ignoreScripts:i});u!==0&&(process.exitCode=u)};export{_e as default};
@@ -0,0 +1 @@
1
+ import{I as m,j as p}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{r as g,a as d}from"../packem_shared/command-runtime-CR70qSUM.js";const u=async({argument:s,logger:e,options:r,visConfig:o,workspaceRoot:t})=>{const c=s?.[0]??null,n=t??process.cwd(),i=g({logger:e,options:r,visConfig:o},n),l=m(n,{backend:d(i),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),a=p(l,c,n,e);a!==0&&(process.exitCode=a)};export{u as default};
@@ -0,0 +1 @@
1
+ import{I as g,B as m}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{r as u,a as f}from"../packem_shared/command-runtime-CR70qSUM.js";const b=async({argument:s,logger:i,options:t,visConfig:e,workspaceRoot:c})=>{const o=s;if(!o||o.length===0)throw new Error("No subcommand specified. Available: cache, publish, audit, list, view, config, whoami, login, logout, pack, owner, dist-tag, search, fund, ping, token, deprecate, rebuild, prune, plugin");const[r,...l]=o,n=c??process.cwd(),p=u({logger:i,options:t,visConfig:e},n),d=g(n,{backend:f(p),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),a=m(d,r,l,n,i);a!==0&&(process.exitCode=a)};export{b as default};
@@ -0,0 +1 @@
1
+ import{I as p,D as f}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{r as g,a as k}from"../packem_shared/command-runtime-CR70qSUM.js";import{i as m}from"../packem_shared/utils-Cxree603.js";const w=async({argument:t,logger:r,options:e,visConfig:o,workspaceRoot:n})=>{const a=t;if(!a||a.length===0)throw new Error("No packages specified. Usage: vis remove <packages...>");const s=process.cwd(),c=g({logger:r,options:e,visConfig:o},n??s),l=p(n??s,{backend:k(c),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),i=f(l,{filter:m(e.filter),global:e.global||!1,packages:a,recursive:e.recursive||!1,saveDev:e.saveDev||!1,workspaceRoot:e.workspaceRoot||!1},s,r);i!==0&&(process.exitCode=i)};export{w as default};
@@ -0,0 +1,4 @@
1
+ import{getAffectedProjects as $}from"@visulima/task-runner";import{b as E,O as F}from"./bin.js";import{r as b}from"../packem_shared/affected-shas-cVnX8-zs.js";import{f as k}from"../packem_shared/selectors-GCJIe342.js";const T=async({argument:w,logger:s,options:e,runtime:j,visConfig:u,workspaceRoot:h})=>{const l=w[0];if(!l)throw new Error("Missing target. Usage: vis affected <target>");if(!h)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const a=h,{packageJsons:v,workspace:i}=E(a,u),y=F(a,i,v),g=new Set(["deep","direct","none"]),p=e.downstream??"deep",d=e.upstream??"none";if(!g.has(p))throw new Error(`Invalid --downstream value: "${p}". Must be "none", "direct", or "deep".`);if(!g.has(d))throw new Error(`Invalid --upstream value: "${d}". Must be "none", "direct", or "deep".`);let{base:c}=e,{head:f}=e;if(!c||!f){const o=b({defaultBase:u?.defaultBase,workspaceRoot:a});c=c??o.base,f=f??o.head,s.info(`▸ Resolved affected refs from ${o.provider} (${o.notes.join("; ")})`)}const S={base:c,downstream:p,head:f,projectGraph:y,projects:i.projects,upstream:d,workspaceRoot:a},n=await $(S);if(n.changedFiles.length===0){s.info("No files changed. Nothing to run.");return}if(n.affectedProjects.length===0){s.info("No projects affected by the changes.");return}let{affectedProjects:t}=n;if(e.query&&(t=k(t,i,e.query),t.length===0)){s.info(`Query "${String(e.query)}" matched no affected projects.`);return}if(e.sparseCheckout){const o=[...new Set(t.map(m=>i.projects[m]?.root??m))].sort();process.stdout.write(`${o.join(`
2
+ `)}
3
+ `);return}s.info(`Affected projects: ${t.join(", ")}`),n.changedFiles.length>0&&(process.env.VIS_AFFECTED_FILES=n.changedFiles.join(`
4
+ `));const r=[l,`--projects=${t.join(",")}`];e.parallel!==void 0&&r.push(`--parallel=${String(e.parallel)}`),e.cache||r.push("--no-cache"),e.dryRun&&r.push("--dry-run"),e.partition&&r.push(`--partition=${String(e.partition)}`),e.reverse&&r.push("--reverse"),typeof e.runnerTags=="string"&&e.runnerTags!==""&&r.push(`--runner-tags=${e.runnerTags}`);try{await j.runCommand("run",{argv:r})}finally{delete process.env.VIS_AFFECTED_FILES}};export{T as default};
@@ -0,0 +1,5 @@
1
+ import{readLastRunSummary as k,getLastRunSummaryPath as g}from"@visulima/task-runner";import{p as m,y as S,z as h,A as x,C as p}from"./bin.js";const I=new Set(["json","table"]),v=(t,a)=>t??a,c=t=>t===void 0?"-":t<1e3?`${String(t)}ms`:`${(t/1e3).toFixed(2)}s`,$=t=>t.exitCode===void 0?t.cacheStatus:t.exitCode===0?t.cacheStatus==="MISS"?"OK":t.cacheStatus:`FAIL(${String(t.exitCode)})`,o=(t,a)=>t.length>=a?t:t+" ".repeat(a-t.length),y=t=>t.exitCode!==void 0&&t.exitCode!==0,l=(t,a)=>{a.info(`Run ${t.id}`),a.info(` start: ${t.startTime}`),a.info(` end: ${t.endTime}`),a.info(` duration: ${c(t.duration)}`),a.info(` totals: ${String(t.stats.total)} total · ${String(t.stats.succeeded)} ok · ${String(t.stats.cached)} cached · ${String(t.stats.skipped)} skipped · ${String(t.stats.failed)} failed`),a.info(` env: node ${t.environment.nodeVersion} · ${t.environment.platform}/${t.environment.arch}`),a.info("")},w=(t,a)=>{if(t.length===0){a.info("(no tasks match the current filter)");return}const e=t.map(s=>({duration:c(s.duration),hash:s.hash?s.hash.slice(0,12):"-",status:$(s),taskId:s.taskId})),i={duration:Math.max(8,...e.map(s=>s.duration.length)),hash:Math.max(4,...e.map(s=>s.hash.length)),status:Math.max(6,...e.map(s=>s.status.length)),taskId:Math.max(4,...e.map(s=>s.taskId.length))};a.info(` ${o("task",i.taskId)} ${o("status",i.status)} ${o("duration",i.duration)} ${o("hash",i.hash)}`),a.info(` ${"-".repeat(i.taskId)} ${"-".repeat(i.status)} ${"-".repeat(i.duration)} ${"-".repeat(i.hash)}`);for(const s of e)a.info(` ${o(s.taskId,i.taskId)} ${o(s.status,i.status)} ${o(s.duration,i.duration)} ${o(s.hash,i.hash)}`)},C=(t,a,e)=>{l(t,e),e.info(`Task ${a.taskId}`),e.info(` status: ${$(a)}`),e.info(` cache: ${a.cacheStatus}`),e.info(` duration: ${c(a.duration)}`),e.info(` exit: ${a.exitCode===void 0?"-":String(a.exitCode)}`),e.info(` hash: ${a.hash??"(none)"}`),e.info(` start: ${a.startTime??"-"}`),e.info(` end: ${a.endTime??"-"}`),a.dependencies.length>0&&e.info(` deps: ${a.dependencies.join(", ")}`),e.info(""),m.info(`Drill into hash inputs with: vis cache why ${a.taskId} --run ${t.id}`)},R=t=>{process.stdout.write(`${JSON.stringify(t.map(a=>({id:a.id,mtime:new Date(a.mtimeMs).toISOString(),path:a.path})),void 0,2)}
2
+ `)},T=(t,a,e)=>{if(t.length===0){m.info(`No recorded runs found in ${p(a)}/. Run with --summarize to record a run.`);return}const i={id:Math.max(2,...t.map(s=>s.id.length)),mtime:24};e.info(` ${o("id",i.id)} ${o("mtime",i.mtime)}`),e.info(` ${"-".repeat(i.id)} ${"-".repeat(i.mtime)}`);for(const s of t)e.info(` ${o(s.id,i.id)} ${new Date(s.mtimeMs).toISOString()}`)},D=(t,a)=>{let{tasks:e}=t;return a.task!==void 0&&(e=e.filter(i=>i.taskId===a.task)),a.failed&&(e=e.filter(i=>y(i))),e},M=async(t,a)=>{const{failed:e,format:i,runId:s,task:r,workspaceRoot:d}=t,n=s===void 0?await k(d,{dataDirectory:h(d)}):await x(d,s);if(!n){if(i==="json"){process.stdout.write(`${JSON.stringify({error:"no-summary",runId:s??null},void 0,2)}
3
+ `),process.exitCode=1;return}s===void 0?m.error(`No previous run summary found. Run a task first to populate \`${g(d,{dataDirectory:h(d)})}\`.`):m.error(`Run summary "${s}" not found in ${p(d)}/.`),process.exitCode=1;return}const f=D(n,{failed:e,task:r});if(r!==void 0&&f.length===0){if(i==="json"){process.stdout.write(`${JSON.stringify({error:"task-not-in-summary",runId:n.id,taskId:r},void 0,2)}
4
+ `),process.exitCode=1;return}m.error(`Task "${r}" was not part of run ${n.id}.`),process.exitCode=1;return}if(n.stats.failed>0&&(process.exitCode=1),i==="json"){process.stdout.write(`${JSON.stringify({duration:n.duration,endTime:n.endTime,environment:n.environment,runId:n.id,startTime:n.startTime,stats:n.stats,tasks:f.map(u=>({cacheStatus:u.cacheStatus,dependencies:u.dependencies,duration:u.duration,endTime:u.endTime,exitCode:u.exitCode,hash:u.hash??null,startTime:u.startTime,taskId:u.taskId}))},void 0,2)}
5
+ `);return}if(r!==void 0){C(n,f[0],a);return}l(n,a),w(f,a)},N=async({logger:t,options:a,process:e,workspaceRoot:i})=>{const s=v(i,e.cwd),r=a.format??"table";if(!I.has(r)){m.error(`Invalid --format: ${r}. Expected "table" or "json".`),process.exitCode=1;return}if(a.list===!0){const d=await S(s);if(r==="json"){R(d);return}T(d,s,t);return}await M({failed:a.failed===!0,format:r,runId:a.run,task:a.task,workspaceRoot:s},t)};export{N as default,N as replayExecute,M as runReplay};
@@ -0,0 +1,2 @@
1
+ import{B as k,a as B,H as g}from"../packem_shared/index-BDmTbWX1.js";import{b as h,O as j,p as m}from"./bin.js";import{b as v,s as y}from"../packem_shared/cyclonedx-Cadls41z.js";const l=["json","xml"],C=n=>l.includes(n),R=async({fs:n,options:e,visConfig:d,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{packageJsons:f,workspace:i}=h(o,d),u=j(o,i,f),c=e.focus,w=c?c.split(",").map(b=>b.trim()).filter(Boolean):void 0,s=(e.format??"json").toLowerCase();if(!C(s))throw new Error(`Unknown --format: "${s}". Expected one of: ${l.join(", ")}.`);const t=v({focus:w,includeDev:!!e.includeDev,projectGraph:u,workspace:i,workspaceRoot:o}),a=s==="xml"?y(t):`${JSON.stringify(t,void 0,2)}
2
+ `,p=e.output??(s==="xml"?"sbom.cdx.xml":"sbom.cdx.json");if(p==="-"){process.stdout.write(a);return}const r=k(o,p);B(g(r)),await n.writeFile(r,a,"utf8");const x=t.components?.length??0,$=t.dependencies?.length??0;m.success(`SBOM written to ${r}`),m.notice(`${x} components, ${$} dependency edges`)};export{R as default};
@@ -0,0 +1,2 @@
1
+ import{createRequire as b}from"node:module";import{b as _}from"../packem_shared/index-BDmTbWX1.js";import{p as c,L as N,M as I,b as A,Q as H,S as U}from"./bin.js";import{p as D,i as E,r as v,s as R,a as C,S as L,b as P,c as z,d as G,e as q}from"../packem_shared/lifecycle-4z9hHE5b.js";const j=b(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,F=s=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,r]=w.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return w.getBuiltinModule(s)}return j(s)},{open:S,stat:k,watch:T}=F("node:fs/promises"),$=async s=>{const e=s?.plugins;if(!e||e.length===0)return;const r=G();return await q(r,e),{callHook:async(d,...o)=>{try{await r.callHook(d,...o)}catch(t){const n=t instanceof Error?t.message:String(t);c.warn(`Plugin error in ${d}: ${n}`)}}}},B=s=>{const e=s.trim(),r=e.lastIndexOf(":");if(!(r<=0||r===e.length-1))return{project:e.slice(0,r),target:e.slice(r+1)}},M=async(s,e,r)=>{const d=B(r);if(!d){c.error(`Invalid target id "${r}". Expected "<project>:<target>", e.g. "@my/api:db".`);return}const o=await I(s),{projectOptions:t,workspace:n}=A(s,e,o),i=n.projects[d.project],a=t.get(d.project)?.[d.target];if(!i||!a){c.error(`Target "${r}" not found in this workspace.`);return}const p=a.options?.service;if(!p){c.error(`Target "${r}" is not a service. Add an \`options.service\` block to make it eligible for \`vis service\`.`);return}if(!a.command){c.error(`Target "${r}" has no command — services must be runnable.`);return}const u=H(s,i.root,a.options?.runFromWorkspaceRoot===!0),f=a.options?.envFile?U(u,a.options.envFile):{};return{command:a.command,cwd:u,env:{...f,...p.env},service:p,target:a,targetId:r}},m=s=>{if(!s)throw new Error("Could not determine workspace root. Run `vis service` inside a workspace.");return s},Z=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),t=s[0]?.trim();if(!t){c.error("Missing target id. Usage: vis service start <project>:<target>"),process.exitCode=1;return}const n=await M(o,r,t);if(!n){process.exitCode=1;return}try{const{entry:i}=await C({command:n.command,config:n.service,cwd:n.cwd,env:n.env,id:t,readinessTimeoutMs:e.timeout,skipReadiness:e.readiness===!1,workspaceRoot:o});await(await $(r))?.callHook("service:start",i),c.success(`Started ${t} (pid ${String(i.pid)})`),c.info(` log: ${i.logFile}`)}catch(i){const a=i instanceof Error?i.message:String(i);i instanceof L?c.error(`Readiness probe failed for ${t}: ${a}`):c.error(`Failed to start ${t}: ${a}`),process.exitCode=1}},y=async({graceMs:s,hookSink:e,id:r,workspaceRoot:d})=>{const o=await v(d,r),{stopped:t}=await R({graceMs:s,id:r,workspaceRoot:d});return t?(o&&await e?.callHook("service:stop",o),c.success(`Stopped ${r}`),!0):(c.info(`No running service registered for ${r}`),!1)},ee=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),{graceMs:t}=e,n=s[0]?.trim(),i=await $(r);if(e.all===!0){if(n){c.error("Cannot combine --all with a target id. Use one or the other."),process.exitCode=1;return}const a=await z(o);if(a.length===0){c.info("No running services registered for this workspace.");return}for(const p of a)await y({graceMs:t,hookSink:i,id:p.id,workspaceRoot:o});return}if(!n){c.error("Missing target id. Usage: vis service stop <project>:<target> | --all"),process.exitCode=1;return}await y({graceMs:t,hookSink:i,id:n,workspaceRoot:o})||(process.exitCode=1)},O=s=>{const e=s.config.readiness?.tcp.port??s.config.port;return e===void 0?"—":String(e)},x=new Set(["json","table"]),te=async({logger:s,options:e,workspaceRoot:r})=>{const d=m(r),o=e.format??"table";if(!x.has(o)){c.error(`Invalid --format "${o}". Expected one of: ${[...x].sort().join(", ")}.`),process.exitCode=1;return}const{surviving:t}=await D(d);if(o==="json"){const l=Date.now();process.stdout.write(`${JSON.stringify(t.map(g=>{const h=Date.parse(g.startedAt);return{ageMs:Number.isFinite(h)?l-h:null,alive:E(g.pid),command:g.command,cwd:g.cwd,env:g.env,id:g.id,logFile:g.logFile,pid:g.pid,port:g.config.readiness?.tcp.port??g.config.port??null,startedAt:g.startedAt,visVersion:g.visVersion}}),void 0,2)}
2
+ `);return}if(t.length===0){c.info("No running services registered for this workspace.");return}const n=Date.now(),i=t.map(l=>{const g=Date.parse(l.startedAt);return{age:Number.isFinite(g)?N(g,n):"?",id:l.id,log:l.logFile,pid:String(l.pid),port:O(l)}}),a=Math.max(2,...i.map(l=>l.id.length)),p=Math.max(3,...i.map(l=>l.pid.length)),u=Math.max(4,...i.map(l=>l.port.length)),f=Math.max(3,...i.map(l=>l.age.length));s.info(` ${"id".padEnd(a)} ${"pid".padEnd(p)} ${"port".padEnd(u)} ${"age".padEnd(f)} log`),s.info(` ${"-".repeat(a)} ${"-".repeat(p)} ${"-".repeat(u)} ${"-".repeat(f)} ---`);for(const l of i)s.info(` ${l.id.padEnd(a)} ${l.pid.padEnd(p)} ${l.port.padEnd(u)} ${l.age.padEnd(f)} ${l.log}`)},re=async({argument:s,options:e,workspaceRoot:r})=>{const d=m(r),o=s[0]?.trim();if(!o){c.error("Missing target id. Usage: vis service status <project>:<target>"),process.exitCode=1;return}const t=await v(d,o);if(!t){c.error(`No service registered for ${o}.`),process.exitCode=1;return}if(!E(t.pid)){c.error(`Service ${o} is not running (pid ${String(t.pid)} is dead). Run \`vis service start ${o}\` to recover.`),process.exitCode=1;return}try{await P(t.config,{timeoutMs:e.timeout}),c.success(`${o} healthy (pid ${String(t.pid)})`)}catch(n){const i=n instanceof Error?n.message:String(n);c.error(`${o} probe failed: ${i}`),process.exitCode=1}},oe=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),t=s[0]?.trim();if(!t){c.error("Missing target id. Usage: vis service restart <project>:<target>"),process.exitCode=1;return}const n=await $(r),i=await v(o,t);(await R({graceMs:e.graceMs,id:t,workspaceRoot:o})).stopped&&i&&await n?.callHook("service:stop",i);const a=await M(o,r,t);if(!a){process.exitCode=1;return}try{const{entry:p}=await C({command:a.command,config:a.service,cwd:a.cwd,env:a.env,id:t,readinessTimeoutMs:e.timeout,skipReadiness:e.readiness===!1,workspaceRoot:o});await n?.callHook("service:start",p),c.success(`Restarted ${t} (pid ${String(p.pid)})`)}catch(p){const u=p instanceof Error?p.message:String(p);c.error(`Failed to restart ${t}: ${u}`),process.exitCode=1}},V=200,W=1024*1024,J=async s=>{let e=0;try{e=(await k(s)).size}catch{e=0}const r=new AbortController;let d=!1;const o=()=>{d=!0,r.abort()},t=()=>{r.abort()};process.on("SIGINT",o),process.on("SIGTERM",t);let n=!1;const i=async()=>{if(!n){n=!0;try{const a=await k(s).catch(()=>{});if(!a||(a.size<e&&(e=0),a.size===e))return;const p=a.size-e,u=Math.min(p,W),f=await S(s,"r");try{const l=Buffer.alloc(u);await f.read(l,0,u,e),process.stdout.write(l),e+=u}finally{await f.close().catch(()=>{})}}finally{n=!1}}};try{const a=(async()=>{try{const p=T(s,{signal:r.signal});for(;!(await p.next()).done;)await i()}catch{}})();for(;!r.signal.aborted;)await i(),await new Promise(p=>{const u=setTimeout(p,V);r.signal.addEventListener("abort",()=>{clearTimeout(u),p()},{once:!0})});await a.catch(()=>{}),await i().catch(()=>{})}finally{process.off("SIGINT",o),process.off("SIGTERM",t)}d&&(process.exitCode=130)},se=async({argument:s,options:e,workspaceRoot:r})=>{const d=m(r),o=s[0]?.trim();if(!o){c.error("Missing target id. Usage: vis service logs <project>:<target>"),process.exitCode=1;return}const t=await v(d,o);if(!t){c.error(`No service registered for ${o}.`),process.exitCode=1;return}if(!await _(t.logFile)){c.warn(`Log file is missing for ${o}: ${t.logFile}`),process.exitCode=1;return}if(e.follow===!0){await J(t.logFile);return}const n=await S(t.logFile,"r");try{const i=n.createReadStream();await new Promise((a,p)=>{i.on("end",a),i.on("error",p),i.pipe(process.stdout,{end:!1})})}finally{await n.close().catch(()=>{})}};export{te as serviceListExecute,se as serviceLogsExecute,oe as serviceRestartExecute,Z as serviceStartExecute,re as serviceStatusExecute,ee as serviceStopExecute};
@@ -0,0 +1 @@
1
+ import{E as w}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{A as b,m as y}from"../packem_shared/index-BDmTbWX1.js";import{b as C}from"./bin.js";import{a as R,b as j,s as E,i as x,c as B,p as D,d as P,r as N,e as A}from"../packem_shared/subtree-C7bZuiSQ.js";import{l as M,o as v}from"../packem_shared/utils-Cxree603.js";const S=async(p,m,r)=>{const o=m[p];if(o?.root)return{pkgName:p,relativeDir:v(o.root)};const i=v(p);if(i.length>0&&await r(i))return{pkgName:i.split("/").pop()??i,relativeDir:i}},U=async({argument:p,fs:m,logger:r,options:o,process:i,visConfig:g,workspaceRoot:k})=>{const d=p[0];if(!d)throw new Error("Missing <package>. Pass a project name or a workspace-relative path.");if(!o.dryRun&&!o.output)throw new Error("Missing --output <dir>. Pass the destination directory for the new repo (or use --dry-run).");const t=k??i.cwd;R(t);const{workspace:h}=C(t,g),l=async a=>{try{return await m.access(a),!0}catch{return!1}},$=await S(d,h.projects,a=>l(y(t,a,"package.json")));if(!$){const a=Object.keys(h.projects).sort().join(", ");throw new Error(`Unknown package "${d}". Known projects: ${a||"(none)"}.`)}const{pkgName:f,relativeDir:n}=$,s=o.branch??g?.defaultBase??"main",u=`vis/split/${M(n.replaceAll("/","-"))}`,c=o.output?b(o.output)?o.output:y(t,o.output):void 0;if(o.dryRun){r.info("Dry run — no changes will be made. Planned git commands:"),r.info(` git subtree split --prefix=${n}${o.annotate?` --annotate=(${f}) `:""} -b ${u}`),c&&(r.info(` git -C ${c} init -b ${s}`),r.info(` git -C ${c} pull ${t} ${u}`)),o.remote&&r.info(` git -C ${c??"<output>"} remote add origin ${o.remote}`),o.push&&r.info(` git -C ${c??"<output>"} push -u origin ${s}`),o.remove&&r.info(` git rm -r ${n} && git commit (in ${t})`);return}const e=c;if(await l(e)){if((await m.readdir(e)).length>0&&!o.force)throw new Error(`${e} is not empty. Re-run with --force to use it anyway.`)}else await m.mkdir(e,{recursive:!0});o.remove&&j(t),r.info(`Splitting ${w(n)} → ${e} ...`);try{E({annotate:o.annotate?`(${f}) `:void 0,branch:u,cwd:t,prefix:n}),x({branch:s,source:t,sourceBranch:u,target:e}),o.remote?(B("origin",o.remote,e),o.push&&D("origin",s,e)):o.push&&r.warn("--push ignored: no --remote provided.");const a=P(s,e);r.info(`✓ Extracted ${f} with ${a} commit(s) to ${e}`),o.remove&&(N(n,`chore(${f}): split out to standalone repo`,t),r.info(`✓ Removed ${n} from the monorepo (committed).`)),o.remote||r.info(w(`Next: cd ${e} && git remote add origin <url> && git push -u origin ${s}`))}finally{try{A(u,t)}catch{}}};export{U as default,S as resolvePackageDirectory};
@@ -0,0 +1 @@
1
+ import{E as R,I as a,s as S,V as d}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{f as b,m as V}from"../packem_shared/index-BDmTbWX1.js";import{enforceProjectConstraints as v}from"@visulima/task-runner";import{b as x,O as F,X as I,C as T}from"./bin.js";import{c as z}from"../packem_shared/runtime-check-Stc9AI78.js";import{a as D}from"./config.js";const o=c=>c?a("✓"):d("✗"),M=async({fs:c,logger:t,options:O,visConfig:y,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root.");const{config:p,packageJsons:w,workspace:l}=x(s,y),C=F(s,l,w),$=Object.keys(l.projects).length,k=new Set(Object.values(l.projects).flatMap(g=>Object.keys(g.targets??{}))).size,n=z(s);let e=0;p.constraints&&(e=v(C,p.constraints).length);const i=I(s,{minRuns:2});let r;const f=T(s);if(b(f)){const g=(await c.readdir(f)).filter(u=>u.endsWith(".json")).sort();let m=0,j=0;for(const u of g.slice(-20))try{const h=D(V(f,u));h.stats&&(m+=h.stats.total??0,j+=h.stats.cached??0)}catch{continue}m>0&&(r=`${(j/m*100).toFixed(0)}%`)}if(O.json){t.info(JSON.stringify({cacheHitRate:r??null,constraintViolations:e,flakyTasks:i.length,projects:$,runtimeIssues:n.length,targets:k},null,2));return}t.info(""),t.info(` ${R("VIS STATUS")}`),t.info(""),t.info(` ${o(!0)} ${String($)} projects · ${String(k)} unique targets`),t.info(` ${o(n.length===0)} Runtime: ${n.length===0?a("OK"):S(`${String(n.length)} issue(s)`)}`),t.info(` ${o(e===0)} Constraints: ${e===0?a("OK"):d(`${String(e)} violation(s)`)}`),t.info(` ${o(i.length===0)} Flaky tasks: ${i.length===0?a("none"):S(String(i.length))}`),r&&t.info(` ${o(!0)} Cache hit rate: ${r} (last 20 runs)`),t.info("")};export{M as default};
@@ -0,0 +1 @@
1
+ import{createTaskGraph as j}from"@visulima/task-runner";import{b as m,O as b}from"./bin.js";const y=(a,e)=>{const r=new Map;for(const[i,t]of Object.entries(a.dependencies))for(const c of t){const f=r.get(c)??[];f.push(i),r.set(c,f)}if(!a.tasks[e])return;const s=new Set([e]),o=[{node:e,path:[e]}];for(;o.length>0;){const i=o.shift();if(a.roots.includes(i.node))return i.path;for(const t of r.get(i.node)??[])s.has(t)||(s.add(t),o.push({node:t,path:[t,...i.path]}))}return[e]},E=(a,e)=>{const r=[];for(const[s,o]of Object.entries(a.dependencies))o.includes(e)&&r.push(s);return r.sort()},T=async({argument:a,logger:e,visConfig:r,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root.");const o=a[0];if(!o)throw new Error("No task ID specified. Usage: vis task-why <project>:<target>");if(!o.includes(":"))throw new Error(`Invalid task ID "${o}" — expected format "project:target".`);const{packageJsons:i,workspace:t}=m(s,r),c=b(s,t,i),[f,l]=o.split(":",2),u=t.projects[f];if(!u)throw new Error(`Unknown project "${f}".`);if(!u.targets?.[l])throw new Error(`Project "${f}" has no target "${l}".`);const $=Object.entries(t.projects).flatMap(([n,k])=>Object.keys(k.targets??{}).map(h=>({id:`${n}:${h}`,outputs:[],overrides:{},target:{project:n,target:h}}))),p=j($,{projectGraph:c,workspace:t});if(!p.tasks[o])throw new Error(`Task "${o}" is not reachable in the graph.`);const d=y(p,o),g=E(p,o);if(e.info(""),e.info(`Why ${o}?`),e.info(""),d&&d.length>1){e.info("Shortest path from a root to this task:");for(const[n,k]of d.entries()){const h=n===0?" ":`${" ".repeat(n+1)}└─ `;e.info(`${h}${k}`)}e.info("")}else e.info(" This task is itself a root — nothing upstream depends on it."),e.info("");if(g.length>0){e.info(`Directly depended on by ${g.length} task(s):`);for(const n of g)e.info(` - ${n}`);e.info("")}const w=p.dependencies[o]??[];if(w.length>0){e.info(`This task depends on ${w.length} task(s):`);for(const n of[...w].sort())e.info(` - ${n}`);e.info("")}};export{T as default};
@@ -0,0 +1,5 @@
1
+ import{createRequire as M}from"node:module";import{E as d,I as F,V as I,s as U}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as A}from"../packem_shared/index-BDmTbWX1.js";import{p as t}from"./bin.js";import{p as N,g as C,S as w,w as b,b as S,a as W,f as k,c as E,d as B,u as y,e as q,h as H}from"../packem_shared/toolchain-pR7AJ-tB.js";const _=M(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[n,i]=$.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return $.getBuiltinModule(e)}return _(e)},{spawnSync:P}=T("node:child_process"),x=["aube","bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],O=e=>x.includes(e),v=e=>e?F("✓"):I("✗"),j=U("⚠"),V=e=>{if(e.installed){const n=e.version?` v${e.version}`:"",i=e.configFiles.length>0?` (${e.configFiles.join(", ")})`:"";return`${v(!0)} ${e.name}${n}${i}`}return`${j} ${e.name} — referenced by ${e.configFiles.join(", ")} but not installed`},D=e=>{if(e.matches)return"";const{manager:n}=e;return n.name==="none"?d("→ (no manager)"):n.name==="self-activate"?"":n.installed?d(`→ ${n.name}`):d(`→ ${n.name} (missing)`)},G=e=>e.matches?v(!0):e.actual?j:v(!1),J=e=>{if(t.info(""),t.info(d("── Toolchain ───────────────────────")),e.detected.length===0)t.info(` ${v(!1)} No version manager detected`),t.notice(` Install one of: ${w.join(", ")}`);else for(const n of e.detected)t.info(` ${V(n)}`);if(t.info(""),e.tools.length===0){t.info(` ${d("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);return}t.info(d("── Tools ───────────────────────────"));for(const n of e.tools){const i=`${n.expected.tool} ${n.expected.version}`,a=n.actual?`actual ${n.actual}`:"not installed",c=n.matches?"":d(` [${n.expected.source}]`),o=D(n),g=o===""?"":` ${o}`;t.info(` ${G(n)} ${i} — ${a}${c}${g}`),n.manager.note&&t.notice(` ${n.manager.note}`)}},K=(e,n,i)=>{const a=C(e,n);if(i.json){process.stdout.write(`${JSON.stringify({detected:a.detected.map(o=>({binPath:o.binPath??null,configFiles:o.configFiles,installed:o.installed,name:o.name,version:o.version??null})),tools:a.tools.map(o=>({actual:o.actual??null,expected:o.expected.version,manager:o.manager.name,managerInstalled:o.manager.installed,matches:o.matches,note:o.manager.note??null,source:o.expected.source,tool:o.expected.tool}))},void 0,2)}
2
+ `);return}J(a);const c=a.tools.filter(o=>!o.matches);c.length>0&&(t.info(""),t.notice(" Run `vis toolchain install` to install pinned versions.")),i.exitCode&&c.length>0&&(process.exitCode=1)},L=e=>{const n=new Map;for(const i of e){const a=n.get(i.manager.name);a?a.push(i):n.set(i.manager.name,[i])}return n},R=(e,n,i)=>P(e,n,{cwd:i,stdio:"inherit"}).status??1,z=(e,n,i)=>{const a=C(e,n),c=a.tools.filter(u=>!u.matches);if(c.length===0){t.success("Everything already matches — nothing to install.");return}const o=c.some(u=>u.manager.name!=="self-activate"&&u.manager.name!=="none");if(a.detected.length===0&&o){t.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const g=L(c);let l=!1,r=0;for(const[u,f]of g){if(u==="self-activate"){for(const{expected:s}of f){if(s.source==="packageManager")t.info(`${d("$")} (${s.tool} will self-activate from packageManager on next invocation)`);else if(t.info(`${d("$")} Writing packageManager=${s.tool}@${s.version}`),i.dryRun)l=!0;else try{b(e,s),l=!0}catch(h){t.error(h.message),r=1}t.notice(` ${s.tool} ${s.version} — no install needed`)}continue}if(u==="none"){for(const{expected:s}of f)t.warn(`Cannot install ${s.tool} ${s.version} — no manager can handle it.`);r=1;continue}if(!a.detected.find(s=>s.name===u)?.installed){t.error(`${u} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),r=1;continue}const m=f.map(s=>S(u,s.expected)).filter(Boolean);for(const s of m){if(!s)continue;if(s.bin==="nvm"&&s.args.length===0){t.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),s.hint&&t.notice(` ${s.hint}`),r=1;continue}if(t.info(`${d("$")} ${s.bin} ${s.args.join(" ")}`),s.hint&&t.notice(` ${s.hint}`),i.dryRun){l=!0;continue}const h=R(s.bin,s.args,e);if(l=!0,h!==0){r=h;break}}}if(r!==0){process.exitCode=r;return}l&&t.success("Toolchain installed.")},Q=async(e,n,i,a,c)=>{if(!a)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const o=W(a);if(!o)throw new Error(`Could not parse "${a}". Expected "<tool>@<version>" where <tool> is one of ${x.join(", ")}.`);const g=k(n),l=E(o,g,i);if(l.name==="none"){t.error(`No manager can pin ${o.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!l.installed){t.error(`The best manager for ${o.tool} (${l.name}) is not on PATH. ${l.note??""}`),process.exitCode=1;return}const r=B(l.name,o);if(!r){t.error(`${l.name} cannot pin ${o.tool}. Use a different manager, or set \`toolchain.tools.${o.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(l.name==="self-activate"){if(t.info(`${d("→")} Writing packageManager field to package.json...`),c.dryRun){t.notice(` Would set packageManager: "${o.tool}@${o.version}"`);return}try{const f=b(n,o);if(!f){t.error(`Refusing to pin non-package-manager tool ${o.tool} via the packageManager field.`),process.exitCode=1;return}if(t.success(`Set packageManager: "${f}" — ${o.tool} will activate this version on next invocation.`),c.engines!==!1){const m=y(n,o);m&&t.success(`Updated package.json engines.${o.tool} → ${m}.`)}}catch(f){t.error(f.message),process.exitCode=1}return}if(r.args.length===0&&l.name==="nvm"&&o.tool==="node"){const f=A(n,".nvmrc");if(t.info(`${d("→")} Writing ${f}...`),c.dryRun){t.notice(` Would write ${o.version} to .nvmrc`);return}try{await e.writeFile(f,`${o.version}
3
+ `)}catch(m){t.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}t.success(`Wrote ${o.version} to .nvmrc.`),t.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(r.args.length===0){t.error(`${l.name} cannot pin ${o.tool} from a subprocess. ${r.configChange?.hint??""}`),r.configChange&&t.notice(` Edit ${r.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(t.info(`${d("$")} ${r.bin} ${r.args.join(" ")}`),r.configChange&&t.notice(` Will update ${r.configChange.file} — ${r.configChange.hint}`),c.dryRun)return;const u=R(r.bin,r.args,n);if(u!==0){process.exitCode=u;return}if(t.success(`Pinned ${o.tool} to ${o.version}.`),c.engines!==!1)try{const f=y(n,o);f&&t.success(`Updated package.json engines.${o.tool} → ${f}.`)}catch(f){t.warn(`Could not update engines.${o.tool}: ${f.message}`)}},X=(e,n,i)=>{if(!i)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const a=i.toLowerCase();if(!O(a))throw new Error(`Unknown tool "${i}". Known: ${x.join(", ")}.`);const c=k(e),o=E({source:"vis.config.ts",tool:a,version:"*"},c,n),g=o.installed&&o.name!=="self-activate"&&o.name!=="none"?c.find(r=>r.name===o.name):void 0,l=g?q(g,a):H(a);if(!l){t.error(`${i} not found in PATH${g?` or via ${g.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
4
+ `)},Y=(e,n)=>{const i=N(e,n);process.stdout.write(`${i.name}
5
+ `)},p=e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},ie=async({options:e,visConfig:n,workspaceRoot:i})=>{K(p(i),n?.toolchain,e)},se=async({visConfig:e,workspaceRoot:n})=>{Y(p(n),e?.toolchain)},ae=async({options:e,visConfig:n,workspaceRoot:i})=>{z(p(i),n?.toolchain,e)},re=async({argument:e,fs:n,options:i,visConfig:a,workspaceRoot:c})=>{await Q(n,p(c),a?.toolchain,e[0],i)},ce=async({argument:e,visConfig:n,workspaceRoot:i})=>{X(p(i),n?.toolchain,e[0])};export{se as detectExecute,ae as installExecute,ie as statusExecute,re as useExecute,ce as whichExecute};
@@ -0,0 +1 @@
1
+ import{I as m,S as p}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{r as g,a as d}from"../packem_shared/command-runtime-CR70qSUM.js";const u=async({argument:r,logger:s,options:a,visConfig:e,workspaceRoot:i})=>{const t=r||[],o=i??process.cwd(),c=g({logger:s,options:a,visConfig:e},o),l=m(o,{backend:d(c),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),n=p(l,t,a.recursive||!1,o,s);n!==0&&(process.exitCode=n)};export{u as default};
@@ -0,0 +1,3 @@
1
+ import{createRequire as u}from"node:module";import{c as p}from"../packem_shared/index-Bt521H5J.js";const f=u(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,a=s=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,i]=r.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return r.getBuiltinModule(s)}return f(s)},{execSync:d,spawnSync:l}=a("node:child_process"),v=async({argument:s,logger:e,options:i})=>{const t=s?.[0];e.info("info: checking for updates...");const n=p.version;let o;try{const c=d("npm view @visulima/vis version",{encoding:"utf8"}).trim();o=t??c}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(n===o&&!i.force){e.info(`
2
+ ✓ Already up to date (${n})`);return}if(i.check){n===o?e.info(`✓ Already up to date (${n})`):e.info(`info: found @visulima/vis@${o} (current: ${n})`);return}if(e.info(`info: found @visulima/vis@${o} (current: ${n})`),e.info("info: installing..."),l("npm",["install","-g",`@visulima/vis@${o}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
3
+ ✓ Updated @visulima/vis from ${n} → ${o}`)};export{v as default};
@@ -0,0 +1 @@
1
+ import{I as f,E as d}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{r as g,a as m}from"../packem_shared/command-runtime-CR70qSUM.js";import{i as k}from"../packem_shared/utils-Cxree603.js";const h=async({argument:r,logger:n,options:o,process:i,visConfig:a,workspaceRoot:t})=>{const e=r;if(!e||e.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const s=t??i.cwd,p=g({logger:n,options:o,visConfig:a},s),c=f(s,{backend:m(p),configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),l=d(c,{depth:o.depth===void 0?void 0:Number(o.depth),dev:o.dev||!1,filter:k(o.filter),global:o.global||!1,json:o.json||!1,long:o.long||!1,noOptional:o.optional===!1,packages:e,parseable:o.parseable||!1,prod:o.prod||!1,recursive:o.recursive||!1},s,n);l!==0&&l!==1&&(process.exitCode=l)};export{h as default};
@@ -0,0 +1,4 @@
1
+ import{P as N,R as C,T as P,E as h,N as T,c as I,f as j,q,I as x}from"./bin.js";import"../packem_shared/index-BDmTbWX1.js";import"../packem_shared/public-api-WqUCiyIe.js";import{K as z,Z as A,W as F}from"../packem_shared/ai-analysis-BUeX2J2H.js";const M=/^[\^~>=<]+/,U=async({argument:v,logger:n,options:c,visConfig:l,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const m=v,e=m[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const p=m[1],{packageManager:R}=N(f);let o,u="default";const b=C(f,R);for(const[t,i]of b){const a=i.get(e);if(a){o=a,u=t;break}}if(!o)throw new Error(`Package "${e}" not found in any catalog or package.json. Make sure it exists in your workspace dependencies.`);let r;if(p)r=p;else{n.info(`Fetching latest version for ${e}...
2
+ `);const t=await P(e);if(!t.latest)throw new Error(`Could not determine latest version for "${e}".`);r=t.latest}const d=h(o),w=h(r);if(!d||!w)throw new Error(`Could not parse versions: current="${o}", target="${r}".`);const k=q(d,w);if(k==="none"){n.info(`${e} is already at ${r}. Nothing to analyze.`);return}const E=x(o),g={catalogName:u,currentRange:o,newRange:`${E}${r}`,packageName:e,targetVersion:r,updateType:k},y=z(c.aiType??"impact");if(y==="security"||c.security){n.info(`Checking for known vulnerabilities...
3
+ `);const t=o.replace(M,""),i=(await T([{name:e,version:t}])).get(e);i&&i.length>0&&(g.vulnerabilities=i);const a=I(l?.security,{minimumScore:l?.security?.policies?.score?.minimum});if(a.length>0){const s=(await j(a,[{name:e,version:t}])).get(`${e}@${t}`);s&&(g.socketReport={alerts:s.alerts,license:s.license,score:s.score})}}const $=await A([g],n,l?.ai,y);(c.format??"table")==="json"?process.stdout.write(`${JSON.stringify($,void 0,2)}
4
+ `):n.info(F($))};export{U as default};
@@ -0,0 +1 @@
1
+ import{createRequire as h}from"node:module";import{A as b,B as v}from"../packem_shared/index-BDmTbWX1.js";import{r as y}from"../packem_shared/command-runtime-CR70qSUM.js";const w=h(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=o=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[r,s]=n.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return n.getBuiltinModule(o)}return w(o)},{spawnSync:l}=_("node:child_process"),x=["--experimental-transform-types","--disable-warning=ExperimentalWarning"],E=(o,r,s)=>{const e=l(process.execPath,[...x,o,...r],{cwd:s,stdio:"inherit"});if(e.error)throw e.error;return e.status??(e.signal?1:0)},j=(o,r,s)=>{const e=l("bun",["run",o,...r],{cwd:s,stdio:"inherit"});if(e.error){const{code:c}=e.error;throw c==="ENOENT"?new Error("Runtime is set to bun but the `bun` binary is not on PATH. Install it from https://bun.sh."):e.error}return e.status??(e.signal?1:0)},N=async({argument:o,logger:r,options:s,rawUnknown:e,visConfig:c,workspaceRoot:d})=>{const f=o??[],[t,...m]=f;if(t===void 0)throw new Error("No file specified. Usage: vis x <file> [args...]");const i=process.cwd(),a=b(t)?t:v(i,t),u=[...m,...e??[]],{runtime:g}=y({logger:r,options:s,visConfig:c},d??i),p=g==="bun"?j(a,u,i):E(a,u,i);p!==0&&(process.exitCode=p)};export{N as default};
@@ -0,0 +1,2 @@
1
+ import{createRequire as R}from"node:module";import{DEFAULT_CHANGES_DIR as C}from"./DEFAULT_CLEAN_KEEP.js";import{b as E,f as B}from"./orchestrator.js";import{r as T}from"../packem_shared/slug-DoueYuLo.js";import{VisReleaseError as w}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const S=R(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,n]=u.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return u.getBuiltinModule(e)}return S(e)},{mkdir:V,writeFile:O}=$("node:fs/promises"),{resolve:b,sep:k,join:P}=$("node:path");let y;const W=e=>{y=e},_=async()=>y||(await import("./shell-runner.js")).createShellRunner(),v=e=>!e||!/^[\dv]/i.test(e)?!1:/^[\d.+\-a-z]+$/i.test(e),D=e=>{const o=e.trim(),n=/^(?:[a-z]+(?:\([^)]+\))?:\s+)?[Bb]ump\s+(?<dep>\S+)\s+from\s+(?<fromVersion>\S+)\s+to\s+(?<toVersion>\S+)(?:\s+in\s+\S+)?$/.exec(o);if(n?.groups){const t=n.groups.toVersion;return v(t)?{dep:n.groups.dep,fromVersion:n.groups.fromVersion,toVersion:t}:void 0}const s=/^(?:[a-z]+(?:\([^)]+\))?:\s+)?[Uu]pdate\s+(?:dependency|module)\s+(?<dep>\S+)\s+to\s+(?<toVersion>\S+)(?:\s+\S.*)?$/.exec(o);if(s?.groups){const t=s.groups.toVersion;return v(t)?{dep:s.groups.dep,fromVersion:"",toVersion:t}:void 0}},A=async e=>{const o=process.env.PR_NUMBER;if(o&&/^\d+$/.test(o))return Number.parseInt(o,10);const n=process.env.GITHUB_REF;if(n){const s=/^refs\/pull\/(\d+)\//.exec(n);if(s)return Number.parseInt(s[1],10)}try{const s=await(await _()).run("gh",["pr","view","--json","number"],{cwd:e,silent:!0});if(s.exitCode===0){const t=JSON.parse(s.stdout.trim());if(typeof t.number=="number")return t.number}}catch{}},L=async(e,o)=>{try{const n=await(await _()).run("gh",["pr","view",String(o),"--json","title,body,author"],{cwd:e,silent:!0});return n.exitCode!==0?void 0:JSON.parse(n.stdout.trim())}catch{return}},U=(e,o)=>{const n=[];for(const s of o){const{manifest:t}=s;(Object.hasOwn(t.dependencies??{},e)||Object.hasOwn(t.devDependencies??{},e)||Object.hasOwn(t.peerDependencies??{},e)||Object.hasOwn(t.optionalDependencies??{},e))&&n.push(s.name)}return n},F=e=>{const o={};for(const n of e.split(",")){const s=n.trim();if(!s)continue;const t=s.lastIndexOf(":");if(t<1)throw new w({code:"BUMP_FILE_INVALID",message:`Invalid --packages entry: ${JSON.stringify(s)}. Expected "package:level".`});const i=s.slice(0,t).trim(),r=s.slice(t+1).trim();if(r!=="major"&&r!=="minor"&&r!=="patch"&&r!=="none")throw new w({code:"BUMP_FILE_INVALID",message:`Invalid bump level: ${JSON.stringify(r)}. Expected major|minor|patch|none.`});o[i]=r}return o},M=async e=>{const{multiSelectPrompt:o,selectPrompt:n,textPrompt:s}=await import("./prompts.js"),t=await o("Which packages to bump?",e.map(p=>({label:p,value:p}))),i={};for(const p of t){const f=await n(`Bump level for ${p}?`,[{label:"patch — bug fixes only",value:"patch"},{label:"minor — new feature, backward-compatible",value:"minor"},{label:"major — breaking change",value:"major"},{label:"none — acknowledged, no direct bump",value:"none"}]);i[p]=f}const r=await s("Changelog entry (markdown):","");return{bumps:i,message:r}},Y=async({logger:e,options:o,workspaceRoot:n})=>{const s=n??process.cwd(),t=await E({cwd:s,skipRegistryLookup:!0});let i={},r=o.message??"";if(o.fromBotPr){const c=await A(s);if(c===void 0){e.error("No PR found. Set PR_NUMBER, run inside a GitHub Actions PR workflow, or check `gh pr view` works on this branch."),process.exitCode=1;return}const a=await L(s,c);if(!a||typeof a.title!="string"){e.error(`Could not fetch PR #${c} via \`gh pr view\`. Ensure gh is on PATH and authenticated.`),process.exitCode=1;return}const d=D(a.title);if(!d){e.info(`PR #${c} title is not a recognised Dependabot / Renovate pattern; skipping.`),e.info(`Title: ${a.title}`),process.exitCode=0;return}const h=U(d.dep,t.packages),N=d.fromVersion?`from ${d.fromVersion} to ${d.toVersion}`:`to ${d.toVersion}`;if(r=r||`Updated ${d.dep} ${N}`,h.length===0){const g=t.packages[0]?.name;if(!g){e.error("Workspace has no packages — cannot author an acknowledging change file."),process.exitCode=1;return}i={[g]:"none"},r=`${r} (no workspace package depends on ${d.dep})`}else for(const g of h)i[g]="patch"}else if(o.empty)i={},r=r||"Empty change file (no release).";else if(o.packages){i=F(o.packages);const c=new Set(t.packages.map(a=>a.name));for(const a of Object.keys(i))if(!c.has(a))throw new w({code:"BUMP_FILE_INVALID",message:`Unknown workspace package in --packages: ${JSON.stringify(a)}.`,packageName:a})}else{if(!process.stdout.isTTY){e.error("--packages is required when stdin is not a TTY."),e.error("Example: vis release add --packages '@scope/cerebro:minor' --message 'Add X'"),process.exitCode=1;return}const c=await M(t.packages.map(a=>a.name));i=c.bumps,r=r||c.message}if(Object.keys(i).length===0){e.error("No bumps specified."),process.exitCode=1;return}const p=t.config.changesDir??C,f=(o.name??T()).replaceAll(/[^a-z0-9-]/gi,"-"),l=b(s),x=l.endsWith(k)?l:`${l}${k}`,m=b(s,p);if(m!==l&&!m.startsWith(x))throw new w({code:"CONFIG_INVALID",message:`changesDir resolves outside the workspace: ${m} (workspace: ${l}).`});const j=P(m,`${f}.md`),I=B({bumps:i},r);await V(m,{recursive:!0}),await O(j,I,{flag:"wx"}),e.info(`Created ${p}/${f}.md`),e.info("");for(const[c,a]of Object.entries(i))e.info(` ${c}: ${a}`);r&&(e.info(""),e.info(` Body: ${r.split(`
2
+ `)[0]?.slice(0,80)??""}`))};export{W as __setBotPrRunnerForTests,Y as default,D as parseBotPrTitle};
@@ -0,0 +1,2 @@
1
+ import{releaseChangelog as l}from"../packem_shared/ReleaseClient-YHzBIxYS.js";const c=async({logger:o,options:t,workspaceRoot:r})=>{const s=r??process.cwd(),i=t.filter?t.filter.split(",").map(e=>e.trim()).filter(Boolean):void 0,n=await l({channel:t.channel,cwd:s,projects:i});if(t.json){process.stdout.write(`${JSON.stringify(n,null,2)}
2
+ `),n.projectChangelogs.length===0&&(process.exitCode=1);return}if(n.projectChangelogs.length===0){o.info("No pending releases — no changelog entries to render."),process.exitCode=1;return}for(const e of n.projectChangelogs)o.info(`# ${e.package} → ${e.file}`),o.info(""),o.info(e.content),o.info("")};export{c as default};
@@ -0,0 +1,2 @@
1
+ import{DEFAULT_CHANGES_DIR as R}from"./DEFAULT_CLEAN_KEEP.js";import{b as D,r as F,c as b}from"./orchestrator.js";import{createShellRunner as E}from"./shell-runner.js";const y=async({logger:r,options:d,workspaceRoot:$})=>{const s=$??process.cwd(),p=d.noFail===!0,u=d.strict===!0,t=await D({cwd:s}),{printConfigIfRequested:x}=await import("./print-config.js");if(x(d,t,r))return;const{files:i}=await F({changesDir:t.config.changesDir,cwd:s});if(i.length===0){u?(r.error("No change files present and --strict is set."),r.error(`Run \`vis release add\` to author one in ${t.config.changesDir??R}.`),process.exitCode=p?0:1):(r.warn("No change files present. PR will not produce a release."),process.exitCode=0);return}if(!u){r.info(`${i.length} change file(s) present. ✓`),process.exitCode=0;return}const m=t.config.baseBranch??"main",g=await E().run("git",["diff","--name-only",`${m}...HEAD`],{cwd:s,silent:!0});if(g.exitCode!==0){r.warn(`Could not run git diff vs ${m}: ${g.stderr}`),process.exitCode=0;return}const f=g.stdout.split(`
2
+ `).map(e=>e.trim()).filter(Boolean);if(f.length===0){r.info("No source files changed. ✓"),process.exitCode=0;return}const{default:w}=await import("./index.js"),k=t.config.changedFilePatterns??["**"],v=(e,n,l)=>{if(!e.startsWith(`${n}/`))return!1;const h=e.slice(n.length+1);return l.some(o=>w(o,h))},C=new Set(b(i).keys()),c=new Set;for(const e of f){const n=t.packages.find(o=>{const a=o.dir.startsWith(s)?o.dir.slice(s.length).replace(/^[/\\]/,""):o.dir;return e===`${a}/package.json`||e.startsWith(`${a}/`)});for(const o of t.packages){const a=t.perPackageConfig.get(o.name)?.additionalPaths;!a||a.length===0||a.some(P=>w(P,e))&&!C.has(o.name)&&c.add(o.name)}if(!n)continue;const l=n.dir.startsWith(s)?n.dir.slice(s.length).replace(/^[/\\]/,""):n.dir,h=t.perPackageConfig.get(n.name)?.changedFilePatterns??k;e!==`${l}/package.json`&&!v(e,l,h)||C.has(n.name)||c.add(n.name)}if(c.size>0){r.error("The following packages have changes but no covering change file:");for(const e of c)r.error(` - ${e}`);r.error("Run `vis release add` to author one."),process.exitCode=p?0:1;return}r.info(`${i.length} change file(s); ${f.length} changed file(s) all covered. ✓`),process.exitCode=0};export{y as default};
@@ -0,0 +1,3 @@
1
+ import{b as h}from"./orchestrator.js";import{escapeMarkdown as f}from"./security.js";import{createShellRunner as g}from"./shell-runner.js";import{d as w,a as R,u as $}from"../packem_shared/sticky-comment-D6_7-w8T.js";const k=(o,a)=>{const e=["### 🚀 Release Plan",""];if(a&&(e.push(`Channel: \`${a}\``),e.push("")),o.releases.length===0)return e.push("_No pending releases._ (Add a change file via `vis release add` to mark this PR as releasing.)"),e.join(`
2
+ `);const n={major:[],minor:[],patch:[]};for(const s of o.releases)n[s.type].push(s);for(const s of["major","minor","patch"])if(n[s].length!==0){e.push(`#### ${s.charAt(0).toUpperCase()}${s.slice(1)}`),e.push("");for(const r of n[s]){const t=[];r.isCascadeBump&&t.push("cascade"),r.isGroupBump&&t.push("group"),r.isDependencyBump&&!r.isCascadeBump&&t.push("dep-bump");const i=t.length>0?` _(${t.join(", ")})_`:"";e.push(`- \`${r.name}\`: ${r.oldVersion} → **${r.newVersion}**${i}`)}e.push("")}if(o.warnings.length>0){e.push("#### ⚠️ Warnings"),e.push("");for(const s of o.warnings)e.push(`- ${f(s)}`)}return e.join(`
3
+ `)},v=async({logger:o,options:a,workspaceRoot:e})=>{const n=e??process.cwd(),s=a.noFail===!0,r=a.strict===!0,t=g(),i=await w(t,n),c=R(process.env);(!i||!c)&&o.warn("Not running in a PR context (GITHUB_REF / PR_NUMBER missing or `gh repo view` failed). Falling back to local print.");const p=await h({cwd:n,skipRegistryLookup:!0}),{printConfigIfRequested:d}=await import("./print-config.js");if(d(a,p,o))return;const m=p.config.versionPr?.commentMarker??"<!-- vis-release-comment -->",l=k(p.plan,p.channel?.tag);if(i&&c){const u=await $({body:l,cwd:n,issueNumber:c,marker:m,repo:i,runner:t});if(u)o.info(`${u.created?"Posted":"Updated"} release-plan comment on PR #${c} (id: ${u.id}).`);else{o.error("Failed to post / update PR comment."),process.exitCode=s?0:1;return}}else o.info(l);r&&p.plan.releases.length===0&&(o.error("--strict and no pending releases."),process.exitCode=s?0:1)};export{v as default};
@@ -0,0 +1,6 @@
1
+ import{createRequire as _}from"node:module";import{b as y}from"./orchestrator.js";const m=_(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=n=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,i]=r.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return r.getBuiltinModule(n)}return m(n)},{appendFileSync:f}=g("node:fs"),B=async({logger:n,options:o,workspaceRoot:i})=>{const l=i??process.cwd(),s=await y({cwd:l,skipRegistryLookup:!0}),{printConfigIfRequested:u}=await import("./print-config.js");if(u(o,s,n))return;const t=s.plan.releases.length===0?"nothing":s.channel?.mode==="version-pr"?"version-pr":"publish",a=s.plan.releases.map(e=>e.name),p={channel:s.channel?.tag,mode:t,packages:a,plan:s.plan.releases.map(e=>({isCascadeBump:e.isCascadeBump,isDependencyBump:e.isDependencyBump,isGroupBump:e.isGroupBump,name:e.name,newVersion:e.newVersion,oldVersion:e.oldVersion,type:e.type})),prerelease:s.channel?.prerelease,warnings:s.plan.warnings};process.stdout.write(`${JSON.stringify(p,null,2)}
2
+ `);const c=process.env.GITHUB_OUTPUT;if(c){const e=[`mode=${t}`,`packages=${a.join(",")}`,`json<<__VIS_RELEASE_EOF__
3
+ ${JSON.stringify(p)}
4
+ __VIS_RELEASE_EOF__`];try{f(c,`${e.join(`
5
+ `)}
6
+ `)}catch(d){n.warn(`Could not write $GITHUB_OUTPUT: ${d.message}`)}}};export{B as default};
@@ -0,0 +1 @@
1
+ import{b as f}from"./orchestrator.js";import{createShellRunner as g}from"./shell-runner.js";const p=async({logger:r,options:n,workspaceRoot:l})=>{const t=l??process.cwd(),i=g(),s=await f({cwd:t}),e=n.branch??s.config.versionPr?.branch??"vis-release/version-packages",o=n.base??s.config.baseBranch??"main";r.info(`Rebasing ${e} onto ${o}...`);const a=await i.run("git",["fetch","origin",`${e}:${e}`,o],{cwd:t,silent:!0});if(a.exitCode!==0){r.info(`No remote branch ${e} to rebase (${a.stderr.trim()||"fetch failed"}). Skipping.`);return}const c=await i.run("git",["switch",e],{cwd:t,silent:!0});if(c.exitCode!==0){r.error(`Could not switch to ${e}: ${c.stderr.trim()}`),process.exitCode=1;return}if((await i.run("git",["rebase",`origin/${o}`],{cwd:t,silent:!0})).exitCode!==0){await i.run("git",["rebase","--abort"],{cwd:t,silent:!0}),r.error("Rebase produced conflicts; aborting. Resolve manually, or let the next `vis release ci release` recompute the version PR from scratch."),process.exitCode=1;return}const u=await i.run("git",["rev-list","--count",`origin/${e}..${e}`],{cwd:t,silent:!0});if(u.exitCode===0&&u.stdout.trim()==="0"){r.info(`${e} is already up to date with ${o}. Nothing to push.`);return}const d=await i.run("git",["push","--force-with-lease","origin",`${e}:${e}`],{cwd:t,silent:!0});if(d.exitCode!==0){r.error(`Failed to force-push ${e}: ${d.stderr.trim()}`),process.exitCode=1;return}r.info(`Force-pushed ${e} after rebasing onto ${o}.`)};export{p as default};
@@ -0,0 +1,42 @@
1
+ const i=`
2
+ 🔧 vis release CI setup
3
+
4
+ 1. Workflow permissions
5
+ Add to .github/workflows/vis-release.yml:
6
+ permissions:
7
+ contents: write
8
+ pull-requests: write
9
+ id-token: write # required for OIDC trusted publishing on npm
10
+
11
+ 2. Secrets
12
+ Required:
13
+ - VIS_GH_TOKEN — PAT or GitHub App token. Used to force-push the
14
+ version-PR branch and create/edit the version PR. The default
15
+ \${{ github.token }} is anti-recursion-locked and cannot trigger
16
+ downstream workflows on the version-PR.
17
+ - GH_TOKEN — \${{ github.token }} works for read-only / commenting.
18
+ Optional:
19
+ - NPM_TOKEN — fallback when OIDC is not available. Trusted Publishing
20
+ (id-token: write) is preferred.
21
+
22
+ 3. Trusted Publishing on npm
23
+ For each published package:
24
+ a. https://npmjs.com/package/<name>/access → Publishing access
25
+ b. Add a Trusted Publisher with provider=GitHub Actions
26
+ c. Repository: visulima/visulima
27
+ d. Workflow filename: vis-release.yml
28
+ e. Environment name: (leave blank unless you use one)
29
+
30
+ 4. Concurrency group (recommended)
31
+ concurrency:
32
+ group: vis-release-\${{ github.ref }}
33
+ cancel-in-progress: false
34
+
35
+ 5. Husky pre-commit gate (optional)
36
+ Add to .husky/pre-commit:
37
+ vis release check --hook pre-commit --no-fail
38
+ (Or run \`vis release init\` and confirm the prompt — it'll auto-wire
39
+ the hook if you say yes.)
40
+
41
+ 📚 RFC: packages/tooling/vis/rfc/design-release-manager.md (§16)
42
+ `,o=async({logger:e})=>{e.info(i)};export{o as default};
@@ -0,0 +1,8 @@
1
+ import{b as g}from"./orchestrator.js";import{detectRemoteProvider as h,createRemoteClient as $}from"./detect2.js";import{createShellRunner as w}from"./shell-runner.js";import{runSnapshot as R}from"./snapshot.js";const y=(r,o)=>{if(r.length===0)return"_No packages were affected by this PR._";const n=["### 📦 Preview Packages",""];for(const e of r){const t=`${e.name}@${e.version}`;n.push(`- \`${e.name}\` → \`${e.version}\``),o?n.push(` \`\`\`sh
2
+ npm i ${t} --registry ${o}
3
+ \`\`\``):n.push(` \`\`\`sh
4
+ npm i ${t}
5
+ \`\`\``)}return n.join(`
6
+ `)},S=async({logger:r,options:o,workspaceRoot:n})=>{const e=n??process.cwd(),t=w(),l=await h(e,t),a=$(l),s=a.detectPullRequestNumber(process.env),p=o.tag??(s?`pr-${s}`:void 0);if(!p){r.error("Could not determine snapshot tag. Pass --tag or run in a PR context (GITHUB_REF=refs/pull/<n>/merge)."),process.exitCode=1;return}if(o.onClose){await C(e,t,a,s,r);return}let c,u;try{c=await g({cwd:e});const{printConfigIfRequested:i}=await import("./print-config.js");if(i(o,c,r))return;u=await R({context:c,runner:t,tag:p})}catch(i){r.error(`Snapshot failed: ${i.message}`),process.exitCode=1;return}if(r.info(`Snapshotted ${u.published.length} package(s) at version ${u.snapshotVersion} → tag "${u.tag}"`),!s)return;const d=await a.detectRepoSlug(e,t);if(!d){r.warn("Could not detect repo slug — skipping sticky PR comment.");return}const m="<!-- vis-release-snapshot-comment -->",f=`${m}
7
+
8
+ ${y(u.published,c.config.snapshot?.registry)}`;try{const i=await a.upsertStickyComment(t,{body:f,cwd:e,issueNumber:s,marker:m,repo:d});i&&r.info(`${i.created?"Posted":"Updated"} snapshot comment on PR #${s}.`)}catch(i){r.warn(`upsertStickyComment failed (publish already succeeded): ${i.message}`)}},C=async(r,o,n,e,t)=>{if(!e){t.error("PR-close cleanup requires a PR context."),process.exitCode=1;return}const l=await n.detectRepoSlug(r,o);if(!l){t.warn("Could not detect repo slug — skipping cleanup.");return}const a=await o.run("gh",["api",`repos/${l}/pulls/${e}/commits`,"--paginate"],{cwd:r,silent:!0});if(a.exitCode!==0){t.warn(`gh api failed: ${a.stderr}`);return}let s;try{s=JSON.parse(a.stdout)}catch{t.warn("Could not parse gh api output.");return}const p=[`pr-${e}`];for(const c of s)p.push(c.sha,c.sha.slice(0,7));t.info(`Cleanup intent for PR #${e}: ${p.length} tag pattern(s) across ${s.length} commit(s)`),t.info("Default backend (pkg-pr-new) auto-cleans by TTL — no DELETE issued. Implement a custom backend's delete endpoint to enable real cleanup.")};export{S as default};
@@ -0,0 +1,9 @@
1
+ import{b as j}from"./orchestrator.js";const A=async({logger:u,options:m,workspaceRoot:h})=>{const c=h??process.cwd(),a=[];let n;try{n=await j({cwd:c}),a.push({message:"vis.config.ts loaded; release block parsed.",name:"config-loads",severity:"error",status:"pass"})}catch(e){a.push({message:`Config failed to load: ${e.message}`,name:"config-loads",severity:"error",status:"fail"}),await $(u,m,a),process.exitCode=1;return}n.packages.length===0?a.push({message:"No packages discovered. Ensure your package manager's workspace block resolves.",name:"workspace-discovered",severity:"error",status:"fail"}):a.push({message:`Discovered ${n.packages.length} workspace package(s).`,name:"workspace-discovered",severity:"info",status:"pass"});try{const e=await n.pm.detectVersion(c);e?a.push({message:`${n.pm.id}@${e} (min required: ${n.pm.minVersion})`,name:"pm-version",severity:"info",status:"pass"}):a.push({message:`Could not detect ${n.pm.id} version.`,name:"pm-version",severity:"warn",status:"skip"})}catch(e){a.push({message:`Skipped: ${e.message}`,name:"pm-version",severity:"warn",status:"skip"})}n.branch&&n.channel?a.push({message:`Branch "${n.branch}" → channel ${n.channel.tag}${n.channel.prerelease?` (preid: ${n.channel.prerelease})`:""}, mode: ${n.channel.mode}`,name:"branch-channel",severity:"info",status:"pass"}):n.branch&&!n.channel?a.push({message:`Branch "${n.branch}" does not match any configured channel. Releases will use dist-tag "latest" by default.`,name:"branch-channel",severity:"warn",status:"fail"}):a.push({message:"No branch detected (detached HEAD or non-git workspace).",name:"branch-channel",severity:"warn",status:"skip"});try{await import("node:child_process").then(({execSync:e})=>{try{return e("gh --version",{stdio:"ignore"}),!0}catch{return!1}})?a.push({message:"gh CLI is on PATH.",name:"gh-cli-available",severity:"info",status:"pass"}):a.push({message:"gh CLI not found. GH releases / PR comments will be skipped.",name:"gh-cli-available",severity:"warn",status:"fail"})}catch{}if(process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true")try{const{createShellRunner:e}=await import("./shell-runner.js"),i=await e().run("gh",["auth","status","--show-token"],{cwd:c,silent:!0}),t=`${i.stdout}
2
+ ${i.stderr}`,s=/Token scopes:\s*(.+)/.exec(t);if(i.exitCode!==0||!s)a.push({message:"Skipped: `gh auth status` did not return a parseable Token scopes line. (Fine-grained tokens / OIDC-only auth fall in this bucket.)",name:"github.token-scopes",severity:"info",status:"skip"});else{const r=s[1].split(",").map(l=>l.trim().replaceAll(/^['"]|['"]$/g,"")).filter(Boolean),o=new Set(["admin:org","admin:repo_hook","delete_repo","repo","site_admin"]),g=r.filter(l=>o.has(l));g.length>0?a.push({message:`Token carries broader scopes than vis needs: ${g.join(", ")}. The release flow needs only contents:write + pull-requests:write (+ optional id-token:write for OIDC). Consider provisioning a fine-grained PAT or scoping the workflow's permissions block.`,name:"github.token-scopes",severity:"warn",status:"fail"}):a.push({message:`Token scopes look appropriately narrow: ${r.join(", ")||"(none)"}.`,name:"github.token-scopes",severity:"info",status:"pass"})}}catch{a.push({message:"Skipped: gh auth status could not be invoked.",name:"github.token-scopes",severity:"info",status:"skip"})}(process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true")&&(process.env.ACTIONS_ID_TOKEN_REQUEST_URL?a.push({message:"GitHub Actions OIDC env vars present.",name:"oidc-available",severity:"info",status:"pass"}):process.env.NPM_TOKEN?a.push({message:"OIDC env vars missing; falling back to NPM_TOKEN. Add `permissions: { id-token: write }` to the workflow to enable trusted publishing.",name:"oidc-available",severity:"warn",status:"fail"}):a.push({message:"Neither OIDC env vars nor NPM_TOKEN are set in CI. Publish will fail.",name:"oidc-available",severity:"error",status:"fail"}));const y=await import("node:fs/promises"),b=await import("node:path");for(const e of n.packages){if(e.manifest.napi===void 0)continue;const i=b.join(e.dir,"npm");try{const t=(await y.readdir(i,{withFileTypes:!0})).filter(g=>g.isDirectory());if(t.length===0){a.push({message:`${e.name} has a napi field but no npm/<platform>/ subdirs. Run pnpm exec napi artifacts before publishing.`,name:`napi-${e.name}-platforms`,severity:"warn",status:"fail"});continue}const s=[];for(const g of t){const l=b.join(i,g.name,"package.json");try{const p=JSON.parse(await y.readFile(l,"utf8"));p.version!==e.version&&s.push(`${g.name} (${p.version} vs parent ${e.version})`)}catch{s.push(`${g.name} (unreadable manifest)`)}}s.length>0?a.push({message:`${e.name}: platform versions out of sync — ${s.join(", ")}. They'll be re-synced on next publish.`,name:`napi-${e.name}-versions`,severity:"warn",status:"fail"}):a.push({message:`${e.name}: ${t.length} platform package(s), all versions in sync.`,name:`napi-${e.name}`,severity:"info",status:"pass"});const r=e.manifest.optionalDependencies??{},o=[];for(const g of t)try{const l=JSON.parse(await y.readFile(b.join(i,g.name,"package.json"),"utf8"));Object.hasOwn(r,l.name)||o.push(l.name)}catch{}o.length>0&&a.push({message:`${e.name}: missing optionalDependencies entries for: ${o.join(", ")}. Consumers won't get the right binary.`,name:`napi-${e.name}-optdeps`,severity:"error",status:"fail"})}catch{a.push({message:`${e.name}: could not read npm/ subdir.`,name:`napi-${e.name}-platforms`,severity:"warn",status:"skip"})}}{const{resolveVersionActionsId:e}=await import("./orchestrator.js").then(t=>t.w),i=n.packages.filter(t=>e(t,n.perPackageConfig.get(t.name)??{})==="jsr");for(const t of i){const s=n.perPackageConfig.get(t.name)??{},r=["jsr","publish","--dry-run","--allow-dirty"],o=s.jsrConfigPath;o!==void 0&&o!=="jsr.json"&&r.push("--config",o);for(const g of s.jsrPublishArgs??[])r.push(g);try{const g=await n.pm.runner.run("npx",r,{cwd:t.dir,silent:!0});g.exitCode===0?a.push({message:`${t.name}: \`jsr publish --dry-run\` passed.`,name:`jsr-dry-run/${t.name}`,severity:"info",status:"pass"}):a.push({message:`${t.name}: \`jsr publish --dry-run\` reported issues (slow types / exports / auth?): ${(g.stderr||g.stdout).trim().slice(0,300)}`,name:`jsr-dry-run/${t.name}`,severity:"warn",status:"fail"})}catch(g){a.push({message:`${t.name}: could not run \`npx jsr publish --dry-run\` (${g.message}). Install the jsr CLI / check network to enable this pre-flight.`,name:`jsr-dry-run/${t.name}`,severity:"warn",status:"skip"})}}}if(n.plan.warnings.length>0)for(const e of n.plan.warnings)a.push({message:e,name:"plan-warning",severity:"warn",status:"fail"});else a.push({message:n.plan.releases.length===0?"No pending releases.":`Plan resolves ${n.plan.releases.length} release(s).`,name:"plan-readable",severity:"info",status:"pass"});const d=n.config.publish?.guards;if(d?.packSecretScan)try{await import("@visulima/secret-scanner"),a.push({message:"@visulima/secret-scanner resolves; pack-set secret scanning will run.",name:"publish-guards.packSecretScan",severity:"info",status:"pass"})}catch{a.push({message:"publish.guards.packSecretScan is enabled but @visulima/secret-scanner is not installed. pnpm add -D @visulima/secret-scanner, or set the gate to false.",name:"publish-guards.packSecretScan",severity:"error",status:"fail"})}d?.audit&&d.audit!=="off"&&a.push({message:`Runtime npm audit gate active at "${d.audit}" severity.`,name:"publish-guards.audit",severity:"info",status:"pass"});const f=n.config.publish?.releaseAssets;if((f?.stampHashes||f?.uploadTarball)&&a.push({message:`Release-asset attestation: stampHashes=${f.stampHashes??!1}, uploadTarball=${f.uploadTarball??!1}.`,name:"publish-releaseAssets",severity:"info",status:"pass"}),n.config.publish?.stage){try{const{execSync:r}=await import("node:child_process"),o=r("npm --version",{stdio:["ignore","pipe","ignore"]}).toString().trim(),[g="0",l="0"]=o.split("."),p=Number.parseInt(g,10)>11||Number.parseInt(g,10)===11&&Number.parseInt(l,10)>=15;a.push({message:p?`npm ${o} supports \`npm stage publish\`.`:`npm ${o} is too old for staged publishing. Upgrade to npm ≥ 11.15.0.`,name:"publish-stage.npm-version",severity:p?"info":"error",status:p?"pass":"fail"})}catch{a.push({message:"publish.stage is enabled but npm is not on PATH.",name:"publish-stage.npm-version",severity:"error",status:"fail"})}const e=n.config.publish?.registry??"https://registry.npmjs.org/",i=/(?:^|:\/\/)registry\.npmjs\.(?:org|com)\//.test(e);a.push({message:i?"Registry is npmjs.com; staging is supported.":`publish.stage is enabled but registry "${e}" is not npmjs.com. Staging is npm Inc-specific; the request will be rejected.`,name:"publish-stage.registry",severity:i?"info":"warn",status:i?"pass":"fail"});const t=n.packages.filter(r=>r.manifest.publishConfig?.access==="restricted"),s=!!process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&!process.env.NPM_TOKEN;t.length>0&&s&&a.push({message:`${t.length} package(s) have publishConfig.access: "restricted" and OIDC trusted publishing is active. Staging this combo is not supported in v1 (no static token for the post-decision read). Set NPM_TOKEN, or disable publish.stage for these packages.`,name:"publish-stage.oidc-restricted",severity:"error",status:"fail"})}try{const{DEFAULT_CHANGES_DIR:e}=await import("./DEFAULT_CLEAN_KEEP.js"),{readStagedRegistry:i}=await import("./staged-registry.js"),t=await i(c,n.config.changesDir??e);if(t.pending.length>0){const s=t.pending.map(r=>`${r.name}@${r.version} (${r.reason})`).join(", ");a.push({message:`${t.pending.length} pending stage(s) recorded in .vis/release/staged.json: ${s}. Approve / reject before the next release: vis release stage approve --all`,name:"publish-stage.pending",severity:"warn",status:"fail"})}}catch{}try{const{DEFAULT_CHANGES_DIR:e}=await import("./DEFAULT_CLEAN_KEEP.js"),{readFile:i}=await import("node:fs/promises"),{join:t}=await import("node:path"),s=t(c,n.config.changesDir??e,".state.json"),r=await i(s,"utf8"),o=JSON.parse(r);Array.isArray(o.stagedIds)&&o.stagedIds.length>0&&a.push({message:`Found ${o.stagedIds.length} legacy stage id(s) in .state.json#stagedIds: ${o.stagedIds.join(", ")}. The new registry lives in .vis/release/staged.json. Approve / reject these via npmjs.com or \`vis release stage approve <id>\` to avoid losing them.`,name:"publish-stage.legacy-stagedIds",severity:"warn",status:"fail"})}catch{}{const e=n.packages.filter(i=>n.perPackageConfig.get(i.name)?.versionActions==="shell");for(const i of e){const t=n.perPackageConfig.get(i.name)??{},s=n.config.allowCustomCommands,r=s===!0||Array.isArray(s)&&s.includes(i.name),o=t.publishCommand!==void 0&&t.publishCommand!=="";r||a.push({message:`${i.name} uses versionActions: "shell" but release.allowCustomCommands does not permit it. Set allowCustomCommands: true or include "${i.name}" in the array.`,name:`shell-actions.${i.name}.trust-gate`,severity:"error",status:"fail"}),o?r&&a.push({message:`${i.name} → shell publish (${Array.isArray(t.publishCommand)?`${t.publishCommand.length} commands`:"1 command"}).`,name:`shell-actions.${i.name}`,severity:"info",status:"pass"}):a.push({message:`${i.name} uses versionActions: "shell" but no publishCommand is configured. Set release.packages["${i.name}"].publishCommand.`,name:`shell-actions.${i.name}.publish-command`,severity:"error",status:"fail"})}}if(!n.config.gitUser)try{const{createShellRunner:e}=await import("./shell-runner.js"),i=e(),t=await i.run("git",["config","user.name"],{cwd:c,silent:!0}),s=await i.run("git",["config","user.email"],{cwd:c,silent:!0}),r=t.exitCode===0&&t.stdout.trim().length>0,o=s.exitCode===0&&s.stdout.trim().length>0;!r||!o?a.push({message:`git config user.name/user.email is not set (name=${r?"ok":"missing"}, email=${o?"ok":"missing"}). vis auto-commits staged.json and version bumps — these will fail without an identity. Set release.gitUser in vis.config.ts or configure git globally.`,name:"git.identity",severity:"warn",status:"fail"}):a.push({message:`git identity: ${t.stdout.trim()} <${s.stdout.trim()}>.`,name:"git.identity",severity:"info",status:"pass"})}catch{}if(n.config.signing){const{signing:e}=n.config;try{const{createShellRunner:i}=await import("./shell-runner.js"),t=i(),s=await t.run("git",["config","user.signingkey"],{cwd:c,silent:!0}),r=await t.run("git",["config","gpg.format"],{cwd:c,silent:!0}),o=s.exitCode===0?s.stdout.trim():"",g=r.exitCode===0?r.stdout.trim():"",l=o.length>0||!!e.key;if(e.mode==="ssh")g!=="ssh"||!l?a.push({message:`release.signing.mode is "ssh" but git config is incomplete (gpg.format=${g||"<unset>"}, user.signingkey=${l?"ok":"missing"}). Run \`git config gpg.format ssh\` and \`git config user.signingkey <path-to-key>\` before releasing.`,name:"git.signing",severity:"warn",status:"fail"}):a.push({message:"git signing: ssh mode active (gpg.format=ssh, signingkey configured).",name:"git.signing",severity:"info",status:"pass"});else if(e.mode==="sigstore"){const{gitsignAvailable:p}=await import("./git.js");await p({cwd:c,runner:t})?a.push({message:"git signing: sigstore mode (preview); gitsign is on PATH.",name:"git.signing",severity:"info",status:"pass"}):a.push({message:'release.signing.mode is "sigstore" (preview) but gitsign is not on PATH. Tags will fall back to GPG signing with a warning. Install gitsign: https://github.com/sigstore/gitsign',name:"git.signing",severity:"warn",status:"fail"})}else if(l){const p=e.key?/[\\/]/.test(e.key)||/\.(?:pem|gpg|key|asc|p12|pfx)$/i.test(e.key)||e.key.length<8?"configured":`…${e.key.slice(-4)}`:"from git config";a.push({message:`git signing: gpg mode active (key: ${p}).`,name:"git.signing",severity:"info",status:"pass"})}else a.push({message:'release.signing.mode is "gpg" but neither release.signing.key nor git config user.signingkey is set. Configure one before releasing.',name:"git.signing",severity:"warn",status:"fail"})}catch(i){a.push({message:`Could not verify git signing config: ${i.message}.`,name:"git.signing",severity:"warn",status:"skip"})}}if(n.config.floatingMajorTag===!0&&n.config.signing?.mode==="sigstore"&&a.push({message:`release.floatingMajorTag and release.signing.mode="sigstore" are both enabled. The floating-tag retarget force-pushes <unscoped-name>-v<major> (e.g. acme-action-v1) on every release, which appends a new sigstore transparency-log entry to Rekor each time (Rekor is append-only — entries are never removed). Over a long-lived major you'll accumulate one log entry per release. Consider either dropping floatingMajorTag (and pin consumers to a specific tag) or switching to gpg/ssh signing if the Rekor footprint matters for your project.`,name:"floating-major-tag.signing-risk",severity:"warn",status:"fail"}),n.config.floatingMajorTag===!0)try{const{createShellRunner:e}=await import("./shell-runner.js"),i=await e().run("git",["tag","--list","v*"],{cwd:c,silent:!0});if(i.exitCode===0){const t=i.stdout.split(`
3
+ `).map(s=>s.trim()).filter(s=>/^v\d+$/.test(s));if(t.length===0)a.push({message:"No legacy `v<major>` tags found; floating-tag migration is clean.",name:"floating-major-tag.legacy-tags",severity:"info",status:"pass"});else{const s=t.slice(0,5),r=t.length>5?` (+${t.length-5} more)`:"",o=t[0],g=o.slice(1);a.push({message:`Legacy floating-major tags detected (${s.join(", ")}${r}). After upgrading the floating-tag format to \`<safe-name>-v<major>\`, these legacy tags are no longer updated. Consumers pinning \`<repo>@${o}\` will silently freeze at the pre-upgrade commit. Migration:
4
+ 1. Re-tag the legacy tag to point at the new floating tag:
5
+ git tag -f ${o} <safe-name>-v${g}
6
+ git push --force origin ${o}
7
+ 2. Or sunset the legacy tag and announce the new pin to consumers.`,name:"floating-major-tag.legacy-tags",severity:"warn",status:"fail"})}}else a.push({message:`Skipped: \`git tag --list "v*"\` exited ${i.exitCode}.`,name:"floating-major-tag.legacy-tags",severity:"info",status:"skip"})}catch(e){a.push({message:`Skipped: could not list git tags: ${e.message}.`,name:"floating-major-tag.legacy-tags",severity:"info",status:"skip"})}if(m.firstRelease===!0){const e=[];try{const{createShellRunner:i}=await import("./shell-runner.js"),t=i(),s=new Set,r=n.config.releaseTagPattern??"{name}@{version}";s.add(r);for(const o of n.packages){const g=n.perPackageConfig.get(o.name)?.releaseTagPattern??r;s.add(g)}for(const o of s){const g=o.replaceAll(/\{(?:name|unscopedName|version|major|minor|patch|date|channel)\}/g,()=>"*"),l=await t.run("git",["tag","--list",g],{cwd:c,silent:!0});if(l.exitCode!==0)continue;const p=l.stdout.split(`
8
+ `).map(v=>v.trim()).filter(Boolean);p.length>0&&e.push(`Found ${p.length} git tag(s) matching "${o}": ${p.slice(0,5).join(", ")}${p.length>5?` (+${p.length-5} more)`:""}.`)}}catch(i){e.push(`Could not scan git tags: ${i.message}.`)}try{const{resolveVersionActionsId:i}=await import("./orchestrator.js").then(s=>s.w),{createVersionActions:t}=await import("../packem_shared/createVersionActions-BK43SNDH.js");for(const s of n.packages){const r=n.perPackageConfig.get(s.name),o=i(s,r??{});let g;try{g=t(o)}catch{continue}let l;try{l=await g.readPublishedVersion.call(g,{perPackageConfig:r,pkg:s,pm:n.pm})}catch{continue}l&&l.length>0&&e.push(`${s.name} is already published at version ${l}.`)}}catch(i){e.push(`Could not probe published versions: ${i.message}.`)}e.length>0?a.push({message:`--first-release is set but the workspace is NOT greenfield: ${e.join(" ")} Remove --first-release and run a normal release, or roll back the existing tags / unpublish before bootstrapping.`,name:"first-release.repo-not-greenfield",severity:"error",status:"fail"}):a.push({message:"Workspace looks greenfield (no matching release tags, no published versions detected). Safe to use --first-release.",name:"first-release.repo-not-greenfield",severity:"info",status:"pass"})}if(n.config.gitlabHost){const{detectRemoteProvider:e}=await import("./detect2.js"),{createShellRunner:i}=await import("./shell-runner.js"),t=await e(c,i(),n.config.provider);t==="gitlab"?a.push({message:`Self-hosted GitLab host configured: ${n.config.gitlabHost}.`,name:"gitlab-host",severity:"info",status:"pass"}):a.push({message:`release.gitlabHost is set ("${n.config.gitlabHost}") but the resolved provider is "${t}". The host will be ignored. Either set release.provider: "gitlab" or remove gitlabHost.`,name:"gitlab-host",severity:"warn",status:"fail"})}if(n.config.githubHost){const{detectRemoteProvider:e}=await import("./detect2.js"),{createShellRunner:i}=await import("./shell-runner.js"),t=await e(c,i(),n.config.provider);t==="github"?await import("node:child_process").then(({execSync:s})=>{try{return s("gh --version",{stdio:"ignore"}),!0}catch{return!1}})?a.push({message:`Self-hosted GitHub Enterprise host configured: ${n.config.githubHost}.`,name:"github-host",severity:"info",status:"pass"}):a.push({message:`release.githubHost is set ("${n.config.githubHost}") but the gh CLI is not on PATH. Install gh and run \`gh auth login --hostname ${n.config.githubHost}\` before releasing.`,name:"github-host",severity:"error",status:"fail"}):a.push({message:`release.githubHost is set ("${n.config.githubHost}") but the resolved provider is "${t}". The host will be ignored. Either set release.provider: "github" or remove githubHost.`,name:"github-host",severity:"warn",status:"fail"})}{const e=await import("node:fs/promises"),i=await import("node:path");let t;for(const s of n.packages){const r=n.perPackageConfig.get(s.name);if(r){if(r.uvLockPath){const o=i.isAbsolute(r.uvLockPath)?r.uvLockPath:i.join(s.dir,r.uvLockPath);try{await e.access(o),a.push({message:`uv.lock present at ${o}.`,name:`uv-lockfile/${s.name}`,severity:"info",status:"pass"})}catch{a.push({message:`${s.name}: configured uvLockPath "${r.uvLockPath}" doesn't exist (expected ${o}). Run \`uv lock\` to generate it, or remove uvLockPath if the lockfile lives elsewhere.`,name:`uv-lockfile/${s.name}`,severity:"warn",status:"fail"})}}if(r.uvWorkspace?.root){const o=i.resolve(s.dir,r.uvWorkspace.root),g=i.relative(o,s.dir).replaceAll("\\","/");switch(t||({checkUvWorkspaceMembership:t}=await import("./registry.js").then(l=>l.g)),await t(o,g)){case"member":{a.push({message:`${s.name} is a member of the uv workspace rooted at ${o}.`,name:`uv-workspace/${s.name}`,severity:"info",status:"pass"});break}case"no-root-pyproject":{a.push({message:`${s.name}: uvWorkspace.root points at ${o} but no pyproject.toml was found there. Verify the path is correct.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"});break}case"no-workspace":{a.push({message:`${s.name}: uvWorkspace.root points at ${o} but that pyproject.toml has no [tool.uv.workspace] block. Add one with a "members" list, or drop the uvWorkspace setting.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"});break}default:a.push({message:`${s.name}: uv workspace root at ${o} has [tool.uv.workspace] but its "members" list doesn't include "${g}". Add the package to members or correct uvWorkspace.root.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"})}}}}}const{execFileSync:w}=await import("node:child_process"),k=(e,i)=>{const t=e.split(".").map(r=>Number.parseInt(r,10)),s=i.split(".").map(r=>Number.parseInt(r,10));for(const[r,o]of s.entries()){const g=t[r]??0;if(g!==(o??0))return g>(o??0)}return!0};{const e=process.versions.node,[i=0,t=0]=e.split(".").map(r=>Number.parseInt(r,10)),s=i===22&&t>=14||i>=24||i===23;a.push({message:`node@${e} (min: 22.14.0 || >=24.10.0)`,name:"node-version",severity:s?"info":"error",status:s?"pass":"fail"})}for(const[e,i,t]of[["git","2.31","git-version"],["gh","2.40","gh-version"]])try{const s=w(e,["--version"],{stdio:["ignore","pipe","ignore"]}).toString(),r=/(\d+\.\d+\.\d+)/.exec(s);if(!r)continue;const o=k(r[1],i);a.push({message:`${e}@${r[1]} (min: ${i})`,name:t,severity:o?"info":e==="git"?"error":"warn",status:o?"pass":"fail"})}catch{}{const e=new Set([n.config.publish?.registry??"https://registry.npmjs.org"]);for(const i of n.packages){const t=n.perPackageConfig.get(i.name)?.registry;t&&e.add(t)}for(const i of e)try{const t=i.replace(/\/+$/,""),s=await fetch(`${t}/-/ping`,{method:"HEAD",signal:AbortSignal.timeout(3e3)});a.push({message:`${i} reachable (HTTP ${s.status}).`,name:"registry-reachable",severity:s.ok||s.status===404?"info":"warn",status:"pass"})}catch(t){a.push({message:`${i} not reachable: ${t.message}. Publishing may fail (or you're offline — this is a warning).`,name:"registry-reachable",severity:"warn",status:"fail"})}}try{const e=w("git",["tag","--list"],{cwd:c,stdio:["ignore","pipe","ignore"]}).toString().split(/\r?\n/).map(s=>s.trim()).filter(Boolean),i=/(?:^|@)\d+\.\d+\.\d+(?:[-+].+)?$/,t=e.filter(s=>!i.test(s)&&!/^v?\d+\.\d+\.\d+/.test(s));a.push({message:e.length===0?"No git tags yet (fresh repo).":`${e.length-t.length}/${e.length} tags parse as a release tag${t.length>0?` (unrecognised: ${t.slice(0,3).join(", ")}${t.length>3?"…":""})`:""}.`,name:"tags-parseable",severity:"warn",status:t.length>0?"fail":"pass"})}catch{}{const{readFile:e}=await import("node:fs/promises"),i=await import("node:path");let t=0,s=0;for(const r of n.packages)try{const o=await e(i.join(r.dir,"CHANGELOG.md"),"utf8");s+=1,/^#{1,2}\s/m.test(o)&&(t+=1)}catch{}s>0&&a.push({message:`${t}/${s} existing CHANGELOG.md file(s) have a recognised heading structure.`,name:"changelog-format",severity:"info",status:t===s?"pass":"fail"})}try{const e=await n.pm.readCatalogYaml(c);if(e){const{parseCatalogs:i}=await import("./registry.js").then(r=>r.f),t=i(e),s=[];for(const r of n.packages)for(const o of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const g=r.manifest[o];if(!(!g||typeof g!="object"))for(const[l,p]of Object.entries(g)){if(typeof p!="string"||!p.startsWith("catalog:"))continue;const v=p.slice(8)||"default";(v==="default"?t.default?.[l]:t.named?.[v]?.[l])||s.push(`${r.name} → ${l} (${p})`)}}a.push({message:s.length===0?"All catalog: references resolve against pnpm-workspace.yaml.":`${s.length} catalog: reference(s) don't resolve: ${s.slice(0,3).join("; ")}${s.length>3?"…":""}`,name:"catalog-consistency",severity:"warn",status:s.length===0?"pass":"fail"})}}catch{}await $(u,m,a);const C=a.some(e=>e.severity==="error"&&e.status==="fail");process.exitCode=C?1:0},$=async(u,m,h)=>{if(m.json){process.stdout.write(`${JSON.stringify({checks:h},null,2)}
9
+ `);return}for(const c of h){const a=`${c.status==="pass"?"✓":c.status==="fail"?"✗":"—"} [${c.severity}] ${c.name}: ${c.message}`;c.severity==="error"&&c.status==="fail"?u.error(a):c.severity==="warn"&&c.status==="fail"?u.warn(a):u.info(a)}};export{A as default};
@@ -0,0 +1,6 @@
1
+ import{createRequire as b}from"node:module";import{h as _,d as O,e as j}from"./bin.js";import{w as R}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{l as E}from"../packem_shared/dependency-scan-DnTgYleU.js";import{r as I}from"../packem_shared/provenance-BFEwKgI3.js";import{r as P}from"../packem_shared/signatures-Xpd6HjG_.js";import{loadOptionalSigstore as C}from"./loader.js";const N=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,t]=u.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return u.getBuiltinModule(r)}return N(r)},{createHash:S}=$("node:crypto"),{isAbsolute:y,resolve:k,basename:v}=$("node:path"),T=r=>(r??"").split(",").map(o=>o.trim()).filter(o=>o.length>0),K=async({logger:r,options:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o.format??"table",c=o.prodOnly??!1,p=o.failOn==="error"?"error":"warning",l=T(o.allowlist),a=R(t),d=E(t,a.name,{includeDev:!c}).map(({name:e,version:n})=>({name:e,version:n})),[m,g]=await Promise.all([I(d,{allowlist:l,workspaceRoot:t}),P(d,{allowlist:l,workspaceRoot:t})]),s=[...m.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...g.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],f=s.filter(e=>p==="error"?e.severity==="error":!0);if(i==="json")process.stdout.write(`${JSON.stringify({findings:s,ok:f.length===0},void 0,2)}
2
+ `);else if(i==="ndjson")for(const e of s)process.stdout.write(`${JSON.stringify(e)}
3
+ `);else if(s.length===0)r.info(`No provenance regressions or signature problems across ${String(d.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(_(O.createElement(j,{data:s.map(n=>({code:n.code,package:`${n.packageName}@${n.version}`,severity:n.severity}))}),{columns:e}));for(const n of s)r.warn(`${n.packageName}@${n.version}: ${n.message}`)}f.length>0&&(process.exitCode=1)},D=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",q=(r,o,t)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:t},internalParameters:{},resolvedDependencies:[]},runDetails:{builder:{id:"https://visulima.com/vis"},metadata:{invocationId:process.env.GITHUB_RUN_ID??"",startedOn:new Date().toISOString()}}},predicateType:"https://slsa.dev/provenance/v1",subject:[{digest:{sha256:o},name:r}]}),G=async({argument:r,fs:o,logger:t,options:i,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const p=r[0];if(!p)throw new Error("Missing subject. Usage: vis attest <path-to-artifact>");const l=i.predicate??"slsaProvenance";if(l!=="slsaProvenance")throw new Error(`Unsupported predicate '${l}'. Only 'slsaProvenance' is supported.`);const a=y(p)?p:k(c,p),d=i.requireSigning??!1,m=i.format??"table";let g;try{g=await o.readFile(a)}catch{throw new Error(`Cannot read subject artifact at ${a}.`)}const s=S("sha256").update(g).digest("hex");if(!D()){const h="No ambient OIDC token (not running in CI). Keyless signing needs a Fulcio identity from CI OIDC.";if(d)throw new Error(`${h} Re-run in CI or drop --require-signing.`);if(m==="json"){process.stdout.write(`${JSON.stringify({ok:!1,reason:"no-ambient-oidc",sha256:s,skipped:!0,subject:v(a)},void 0,2)}
4
+ `);return}t.warn(`${h} Skipping signing (subject sha256: ${s}). Pass --require-signing to make this fatal.`);return}const f=q(v(a),s,c),e=Buffer.from(JSON.stringify(f)),n=await(await C({workspaceRoot:c})).attest(e,"application/vnd.in-toto+json"),w=i.output?y(i.output)?i.output:k(c,i.output):`${a}.sigstore`;if(await o.writeFile(w,`${JSON.stringify(n,void 0,2)}
5
+ `,"utf8"),m==="json"){process.stdout.write(`${JSON.stringify({bundle:w,ok:!0,sha256:s,subject:v(a)},void 0,2)}
6
+ `);return}t.info(`Signed SLSA v1 provenance for ${v(a)} (sha256 ${s.slice(0,16)}…).`),t.info(`Bundle written to ${w}.`)};export{G as attestEmitExecute,K as attestVerifyExecute};