@visulima/vis 1.0.0-alpha.9 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/CHANGELOG.md +1854 -3
  2. package/LICENSE.md +13515 -10
  3. package/README.md +215 -39
  4. package/bin/resolve-binary.mjs +85 -0
  5. package/bin/vis.mjs +76 -0
  6. package/dashboard/dist/index.html +152 -0
  7. package/dist/bin.d.ts +1 -0
  8. package/dist/bin.js +1 -2
  9. package/dist/binx.js +3 -0
  10. package/dist/config/index.d.ts +3276 -0
  11. package/dist/config/index.js +1 -0
  12. package/dist/generate/index.d.ts +1 -1
  13. package/dist/generate/index.js +1 -1
  14. package/dist/packem_chunks/CONFIG_FILES.js +8 -0
  15. package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -0
  16. package/dist/packem_chunks/agent-instructions.js +11 -0
  17. package/dist/packem_chunks/bloom-status.js +2 -0
  18. package/dist/packem_chunks/bloom-sync.js +2 -0
  19. package/dist/packem_chunks/cache-attestation.js +1 -0
  20. package/dist/packem_chunks/catalog-detector.js +1 -0
  21. package/dist/packem_chunks/catalog.js +114 -0
  22. package/dist/packem_chunks/cli-exec.js +1 -0
  23. package/dist/packem_chunks/cli-main.js +268 -0
  24. package/dist/packem_chunks/defineReleasePlugin.js +3 -0
  25. package/dist/packem_chunks/detect.js +3 -0
  26. package/dist/packem_chunks/detect2.js +8 -0
  27. package/dist/packem_chunks/devtools.js +4 -0
  28. package/dist/packem_chunks/discord.js +4 -0
  29. package/dist/packem_chunks/dispatch.js +4 -0
  30. package/dist/packem_chunks/doctor-probe.js +2 -0
  31. package/dist/packem_chunks/dynamic-import.js +1 -0
  32. package/dist/packem_chunks/extra-files.js +3 -0
  33. package/dist/packem_chunks/fix.js +11 -0
  34. package/dist/packem_chunks/git.js +3 -0
  35. package/dist/packem_chunks/group-tags.js +1 -0
  36. package/dist/packem_chunks/handler.js +1 -1
  37. package/dist/packem_chunks/handler10.js +5 -1
  38. package/dist/packem_chunks/handler11.js +1 -1
  39. package/dist/packem_chunks/handler12.js +26 -152
  40. package/dist/packem_chunks/handler13.js +5 -1
  41. package/dist/packem_chunks/handler14.js +1 -3
  42. package/dist/packem_chunks/handler15.js +1 -1
  43. package/dist/packem_chunks/handler16.js +1 -2
  44. package/dist/packem_chunks/handler17.js +1 -7
  45. package/dist/packem_chunks/handler18.js +1 -1
  46. package/dist/packem_chunks/handler19.js +5 -19
  47. package/dist/packem_chunks/handler2.js +1 -1
  48. package/dist/packem_chunks/handler20.js +2 -428
  49. package/dist/packem_chunks/handler21.js +2 -22
  50. package/dist/packem_chunks/handler22.js +14 -3
  51. package/dist/packem_chunks/handler23.js +1 -5
  52. package/dist/packem_chunks/handler24.js +1 -1
  53. package/dist/packem_chunks/handler25.js +1 -20
  54. package/dist/packem_chunks/handler26.js +5 -1
  55. package/dist/packem_chunks/handler27.js +1 -1
  56. package/dist/packem_chunks/handler28.js +3 -1
  57. package/dist/packem_chunks/handler29.js +1 -2
  58. package/dist/packem_chunks/handler3.js +4 -2
  59. package/dist/packem_chunks/handler30.js +1 -22
  60. package/dist/packem_chunks/handler31.js +2 -1
  61. package/dist/packem_chunks/handler32.js +2 -1
  62. package/dist/packem_chunks/handler33.js +2 -37
  63. package/dist/packem_chunks/handler34.js +3 -3
  64. package/dist/packem_chunks/handler35.js +6 -23
  65. package/dist/packem_chunks/handler36.js +1 -5
  66. package/dist/packem_chunks/handler37.js +36 -21
  67. package/dist/packem_chunks/handler38.js +8 -1
  68. package/dist/packem_chunks/handler39.js +9 -2
  69. package/dist/packem_chunks/handler4.js +4 -5
  70. package/dist/packem_chunks/handler40.js +75 -1
  71. package/dist/packem_chunks/handler41.js +5 -5
  72. package/dist/packem_chunks/handler42.js +4 -1
  73. package/dist/packem_chunks/handler43.js +3 -24
  74. package/dist/packem_chunks/handler44.js +2 -3
  75. package/dist/packem_chunks/handler45.js +1 -1
  76. package/dist/packem_chunks/handler46.js +1 -0
  77. package/dist/packem_chunks/handler47.js +1 -0
  78. package/dist/packem_chunks/handler48.js +3 -0
  79. package/dist/packem_chunks/handler49.js +1 -0
  80. package/dist/packem_chunks/handler5.js +6 -4
  81. package/dist/packem_chunks/handler50.js +7 -0
  82. package/dist/packem_chunks/handler51.js +33 -0
  83. package/dist/packem_chunks/handler52.js +3 -0
  84. package/dist/packem_chunks/handler53.js +8 -0
  85. package/dist/packem_chunks/handler54.js +4 -0
  86. package/dist/packem_chunks/handler55.js +1 -0
  87. package/dist/packem_chunks/handler56.js +12 -0
  88. package/dist/packem_chunks/handler57.js +11 -0
  89. package/dist/packem_chunks/handler58.js +5 -0
  90. package/dist/packem_chunks/handler59.js +11 -0
  91. package/dist/packem_chunks/handler6.js +8 -2
  92. package/dist/packem_chunks/handler60.js +3 -0
  93. package/dist/packem_chunks/handler61.js +22 -0
  94. package/dist/packem_chunks/handler62.js +61 -0
  95. package/dist/packem_chunks/handler63.js +3 -0
  96. package/dist/packem_chunks/handler64.js +6 -0
  97. package/dist/packem_chunks/handler65.js +9 -0
  98. package/dist/packem_chunks/handler66.js +2 -0
  99. package/dist/packem_chunks/handler67.js +24 -0
  100. package/dist/packem_chunks/handler68.js +25 -0
  101. package/dist/packem_chunks/handler69.js +153 -0
  102. package/dist/packem_chunks/handler7.js +1 -24
  103. package/dist/packem_chunks/handler70.js +10 -0
  104. package/dist/packem_chunks/handler71.js +23 -0
  105. package/dist/packem_chunks/handler72.js +322 -0
  106. package/dist/packem_chunks/handler73.js +708 -0
  107. package/dist/packem_chunks/handler74.js +48 -0
  108. package/dist/packem_chunks/handler75.js +27 -0
  109. package/dist/packem_chunks/handler76.js +3 -0
  110. package/dist/packem_chunks/handler77.js +190 -0
  111. package/dist/packem_chunks/handler78.js +38 -0
  112. package/dist/packem_chunks/handler8.js +1 -6
  113. package/dist/packem_chunks/handler9.js +1 -8
  114. package/dist/packem_chunks/heal-accept.js +10 -0
  115. package/dist/packem_chunks/heal.js +14 -0
  116. package/dist/packem_chunks/help-command.js +31 -0
  117. package/dist/packem_chunks/index.js +1 -7
  118. package/dist/packem_chunks/index2.js +802 -0
  119. package/dist/packem_chunks/index3.js +7 -0
  120. package/dist/packem_chunks/index4.js +135 -0
  121. package/dist/packem_chunks/index5.js +73 -0
  122. package/dist/packem_chunks/interface.js +2 -0
  123. package/dist/packem_chunks/keys-refresh.js +4 -0
  124. package/dist/packem_chunks/lean.js +4 -0
  125. package/dist/packem_chunks/list.js +3 -0
  126. package/dist/packem_chunks/loader.js +4 -1
  127. package/dist/packem_chunks/loader2.js +1 -0
  128. package/dist/packem_chunks/orchestrator.js +42 -0
  129. package/dist/packem_chunks/pre-mode.js +2 -0
  130. package/dist/packem_chunks/print-config.js +2 -0
  131. package/dist/packem_chunks/prompts.js +7 -0
  132. package/dist/packem_chunks/prune.js +3 -0
  133. package/dist/packem_chunks/publish-guards.js +1 -0
  134. package/dist/packem_chunks/registry.js +48 -0
  135. package/dist/packem_chunks/resolveFormatter.js +9 -0
  136. package/dist/packem_chunks/run.js +1 -0
  137. package/dist/packem_chunks/security.js +1 -0
  138. package/dist/packem_chunks/shell-runner.js +1 -0
  139. package/dist/packem_chunks/slack.js +2 -0
  140. package/dist/packem_chunks/snapshot.js +2 -0
  141. package/dist/packem_chunks/stage-publisher.js +1 -0
  142. package/dist/packem_chunks/staged-registry.js +2 -0
  143. package/dist/packem_chunks/state.js +3 -0
  144. package/dist/packem_chunks/status.js +2 -0
  145. package/dist/packem_chunks/success-walk.js +8 -0
  146. package/dist/packem_chunks/sync.js +2 -0
  147. package/dist/packem_chunks/sync2.js +2 -0
  148. package/dist/packem_chunks/tar.js +3 -0
  149. package/dist/packem_chunks/tripwire.js +2 -0
  150. package/dist/packem_chunks/ts-loader.js +22 -0
  151. package/dist/packem_chunks/verify-lockfile.js +2 -0
  152. package/dist/packem_chunks/version-resolver.js +2 -0
  153. package/dist/packem_chunks/webhook.js +1 -0
  154. package/dist/packem_chunks/workflow-templates.js +167 -0
  155. package/dist/packem_chunks/workspace.js +2 -0
  156. package/dist/packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js +1 -0
  157. package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
  158. package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +1 -0
  159. package/dist/packem_shared/Table-BGIHvenQ-D2oJtNQj.js +34 -0
  160. package/dist/packem_shared/VisReleaseError-DMGRBTNO.js +1 -0
  161. package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
  162. package/dist/packem_shared/advisories-CaP4uNhD.js +1 -0
  163. package/dist/packem_shared/affected-shas-BfO3PDJq.js +1 -0
  164. package/dist/packem_shared/ai-analysis-CO7No4rt.js +68 -0
  165. package/dist/packem_shared/ai-fix-B4u2zlVG.js +43 -0
  166. package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
  167. package/dist/packem_shared/api.d-BPftyU9r.d.ts +27 -0
  168. package/dist/packem_shared/augment-8z86AwtF.js +4 -0
  169. package/dist/packem_shared/bin-Cv8vsMEo.js +1 -0
  170. package/dist/packem_shared/build-scripts-D477Ou-x.js +1 -0
  171. package/dist/packem_shared/command-runtime-EWjmSxPj.js +1 -0
  172. package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
  173. package/dist/packem_shared/createAdapter-bU4DIP3F.js +1 -0
  174. package/dist/packem_shared/createVersionActions-BK43SNDH.js +1 -0
  175. package/dist/packem_shared/cyclonedx-CDWHbD9s.js +4 -0
  176. package/dist/packem_shared/defineFormatter-D5dCp6Kv.js +1 -0
  177. package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
  178. package/dist/packem_shared/dependency-scan-P52jY0pU.js +1 -0
  179. package/dist/packem_shared/docker-CD7o1D1o.js +59 -0
  180. package/dist/packem_shared/env-Cpxa_7UE.js +27 -0
  181. package/dist/packem_shared/failure-log-MOhz-TBv.js +2 -0
  182. package/dist/packem_shared/giget-DVTFJlbR.js +2 -0
  183. package/dist/packem_shared/glob-DMbPwGSj-uzODoE-1.js +1 -0
  184. package/dist/packem_shared/index-B0EsgdzO.js +1 -0
  185. package/dist/packem_shared/index-BAUIIRZJ.js +1 -0
  186. package/dist/packem_shared/index-BVuCxe14.js +22 -0
  187. package/dist/packem_shared/index-CdTXvj-V.js +1 -0
  188. package/dist/packem_shared/index-CgXLAAVI.js +28 -0
  189. package/dist/packem_shared/index-DjTWo3sH.js +1 -0
  190. package/dist/packem_shared/index.server-J83sowC4.js +2 -0
  191. package/dist/packem_shared/interface.d-B7VK2rcH.d.ts +148 -0
  192. package/dist/packem_shared/interface.d-Cezzifoh.d.ts +106 -0
  193. package/dist/packem_shared/license-t5KnNX6v.js +1 -0
  194. package/dist/packem_shared/lifecycle-hzwghh5a.js +2 -0
  195. package/dist/packem_shared/lockfile-CWcVTdRc.js +1 -0
  196. package/dist/packem_shared/main-B3juSU5z.js +1 -0
  197. package/dist/packem_shared/manifests-CaPqgQxW.js +1 -0
  198. package/dist/packem_shared/min-release-age-skpcnlpk.js +34 -0
  199. package/dist/packem_shared/missing-package-json-_hOp4AW5.js +1 -0
  200. package/dist/packem_shared/native-config-sync-CFi1iQNG.js +21 -0
  201. package/dist/packem_shared/osv-bloom-BAyJUnRx.js +2 -0
  202. package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
  203. package/dist/packem_shared/packument-CYxvm590.js +1 -0
  204. package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
  205. package/dist/packem_shared/plugins.d-ND23R9I3.d.ts +4 -0
  206. package/dist/packem_shared/pm-runner-mVFjedM6.js +1 -0
  207. package/dist/packem_shared/prompt-DjXHVgYU.js +1 -0
  208. package/dist/packem_shared/provenance-CI_WQx7G.js +1 -0
  209. package/dist/packem_shared/public-api-WqUCiyIe.js +131 -0
  210. package/dist/packem_shared/readJsonSync-DuMMeB3s-Cx08VBQg.js +1 -0
  211. package/dist/packem_shared/registry-keys-AGlSEY6R.js +1 -0
  212. package/dist/packem_shared/resolve-explicit-DVE9cfkm.js +5 -0
  213. package/dist/packem_shared/resolve-runtime-CGHf-wHz.js +1 -0
  214. package/dist/packem_shared/run-file-Bs_E9O6O.js +1 -0
  215. package/dist/packem_shared/runtime-check-pS2XH4BO.js +1 -0
  216. package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
  217. package/dist/packem_shared/s1ngularity-xmrq5T5r.js +1 -0
  218. package/dist/packem_shared/scan-progress-DQ4TMXcb.js +2 -0
  219. package/dist/packem_shared/selectors-CRgS4bU9.js +3 -0
  220. package/dist/packem_shared/signatures-Dp3th1DB.js +2 -0
  221. package/dist/packem_shared/slug-DoueYuLo.js +1 -0
  222. package/dist/packem_shared/spinner-DuJJvFTl.js +1 -0
  223. package/dist/packem_shared/sticky-comment-D6_7-w8T.js +1 -0
  224. package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
  225. package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
  226. package/dist/packem_shared/tabs-CgxCvjCY.js +1 -0
  227. package/dist/packem_shared/target-merge-D2eTghgd.js +11 -0
  228. package/dist/packem_shared/target-options-TM6ETDAS.js +1 -0
  229. package/dist/packem_shared/toolchain-B5KwUZfq.js +5 -0
  230. package/dist/packem_shared/typosquats-C0layQsP.js +1 -0
  231. package/dist/packem_shared/use-measured-height-Drobr4fe.js +1 -0
  232. package/dist/packem_shared/utils-CRueU43T.js +1 -0
  233. package/dist/packem_shared/verify-Cjo4EBFZ.js +1 -0
  234. package/dist/packem_shared/vis-update-app-qIkyvrd1.js +1 -0
  235. package/dist/packem_shared/watch-BnE1TzYn.js +1 -0
  236. package/dist/packem_shared/watch-loop-Irf3Pm-1.js +11 -0
  237. package/dist/release/core/changelog/index.d.ts +5 -0
  238. package/dist/release/core/changelog/index.js +1 -0
  239. package/dist/release/core/package-managers/index.d.ts +6 -0
  240. package/dist/release/core/package-managers/index.js +1 -0
  241. package/dist/release/core/version-actions/index.d.ts +14 -0
  242. package/dist/release/core/version-actions/index.js +1 -0
  243. package/dist/release/index.d.ts +233 -0
  244. package/dist/release/index.js +1 -0
  245. package/dist/release/plugin-sdk.d.ts +128 -0
  246. package/dist/release/plugin-sdk.js +1 -0
  247. package/dist/release/presets.d.ts +225 -0
  248. package/dist/release/presets.js +1 -0
  249. package/dist/release/types.d.ts +1493 -0
  250. package/dist/release/types.js +1 -0
  251. package/dist/runtime/preload.d.ts +1 -0
  252. package/dist/runtime/preload.js +1 -0
  253. package/index.d.ts +450 -0
  254. package/index.js +663 -556
  255. package/package.json +105 -62
  256. package/schemas/project.schema.json +872 -225
  257. package/schemas/vis-config.schema.json +6309 -264
  258. package/schemas/vis-release-config.schema.json +1423 -0
  259. package/skills/vis/SKILL.md +96 -0
  260. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  261. package/templates/buildkite-ci/template.yml +20 -0
  262. package/dist/config.d.ts +0 -1087
  263. package/dist/config.js +0 -1
  264. package/dist/packem_shared/VisUpdateApp-BBx3idMI.js +0 -1
  265. package/dist/packem_shared/ai-analysis-DDqXRFxY.js +0 -67
  266. package/dist/packem_shared/bin-BaZZ32BK.js +0 -93
  267. package/dist/packem_shared/cache-directory-DL8hfXeG.js +0 -1
  268. package/dist/packem_shared/catalog-CuSpuB_R.js +0 -12
  269. package/dist/packem_shared/dependency-scan-BoLG2Fez.js +0 -1
  270. package/dist/packem_shared/docker-BcfqH4Av.js +0 -2
  271. package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
  272. package/dist/packem_shared/otelPlugin-DxyvBcXO.js +0 -1
  273. package/dist/packem_shared/runtime-check-CGHal8SO.js +0 -1
  274. package/dist/packem_shared/selectors-CfH9ZY08.js +0 -3
  275. package/dist/packem_shared/symbols-CIMw60-G.js +0 -1
  276. package/dist/packem_shared/toolchain-C3ZG0o_X.js +0 -5
  277. package/dist/packem_shared/typosquats-Bpq4zcWL.js +0 -1
  278. package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  </a>
8
8
 
9
- <h3 align="center">A CLI task runner for monorepo workspaces, powered by @visulima/task-runner</h3>
9
+ <h3 align="center">A monorepo dev toolkit — task runner, remote caching, security scanning, git hooks, and AI agent integrations — powered by @visulima/task-runner</h3>
10
10
 
11
11
  <!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
12
12
 
@@ -36,17 +36,59 @@
36
36
 
37
37
  ## Features
38
38
 
39
- - **Workspace-aware**: Automatically discovers projects from `pnpm-workspace.yaml` or `package.json` workspaces
40
- - **Task caching**: Powered by `@visulima/task-runner` with local and remote caching support
41
- - **Dependency-aware scheduling**: Runs tasks in topological order with configurable parallelism
42
- - **Affected detection**: Only runs tasks for projects changed since a given git ref
43
- - **Pluggable installer**: Defaults to the lockfile-detected PM (pnpm/npm/yarn/bun); auto-uses [aube](https://github.com/endevco/aube) when on `PATH`, with a single switch (`install.backend` / `--installer` / `--no-aube`) to pin or bypass it
44
- - **Catalog management**: Check and update dependencies in pnpm/bun workspace catalogs
45
- - **Security scanning**: Check for known vulnerabilities via OSV.dev
46
- - **Graph visualization**: View your project dependency graph in ASCII, DOT, JSON, or HTML
47
- - **Git hooks**: Install, manage, and migrate git hooks (husky migration supported)
48
- - **Configurable**: `vis.json` for target defaults, cache settings, and task runner options
49
- - **Built on Cerebro**: Uses `@visulima/cerebro` for a robust CLI experience with built-in help, version, and completion
39
+ ### Built for AI agents
40
+
41
+ - **MCP server** — `@visulima/vis-mcp` exposes 8 read-only introspection tools to Claude / Cursor / Copilot (project graph, target list, run logs, cache-why, template schema), plus a paired Claude Skill that documents optimal usage
42
+ - **`vis ai heal`** — reads failing tasks, asks the configured AI provider for a structured patch, validates by re-running, posts a markdown comment to the PR/MR. `/vis heal accept` from an allow-listed maintainer lands the fix as a signed commit (GitHub Actions, GitLab CI, Buildkite)
43
+ - **Worktree-aware shared cache** — N parallel agents in N sibling git worktrees automatically share one cache instead of rebuilding the same hash N times
44
+
45
+ ### Production-grade caching
46
+
47
+ - **REAPI gRPC + HTTP backends** — drop-in support for [bazel-remote](https://github.com/buchgr/bazel-remote), BuildBuddy, BuildBarn, EngFlow alongside Turbo-compatible HTTP. `vis cache doctor` probes reachability, capabilities, and latency for CI gating
48
+ - **`vis cache why <task>`** — diff hash buckets (`command`, `nodes`, `runtime`, `implicitDeps`) against the previous run to pinpoint exactly what rotated the hash
49
+ - **HMAC-SHA256 signed artifacts** — `verifyOnDownload` locks production caches against tampering with constant-time comparison
50
+ - **Cache restoration fidelity** — preserves mtime + permission bits + colorized output; `vis cache verify <task>` flags drift between cached archive and live workspace
51
+ - **Retention controls** — `vis cache prune --keep-last/--max-age-days/--max-size`
52
+
53
+ ### Cross-invocation devloop
54
+
55
+ - **`vis service start|stop|list`** — long-lived DB / mock / devserver lifecycle that survives across `vis run` calls within a shell session; auto-attached when targets declare `service:` in their config (no more "I keep restarting Postgres between every test run")
56
+ - **`vis run --watch`** — Vitest-style keybinds (`r/Enter/a/p/q/Ctrl+C/h/?`), Windows-clean SIGINT
57
+ - **`vis run --output-style=quiet`** — swallow stdout from successful and cached tasks, keep failures fully visible
58
+
59
+ ### Workspace orchestration
60
+
61
+ - **Workspace-aware** — discovers projects from `pnpm-workspace.yaml`, `package.json` workspaces, and bun
62
+ - **Topological scheduling** with configurable parallelism and runner-tag filtering
63
+ - **Affected detection** — `vis affected <target>`, plus `${affected.files}` / `$AFFECTED_FILES` token forwarding to the underlying script
64
+ - **Conditional + finally tasks** — `when:` (os/env/branch/ci) and top-level `always: true`
65
+ - **Per-package overlay + extends chain** — root `vis-config.ts` + per-project `vis.task.ts`, with bare-specifier preset resolution
66
+ - **Inferred targets** (Project Crystal-style) — optional synthesis of `build`/`test`/`dev`/`lint`/`format` from 36 tools (Vite, Vitest, Next, Nuxt, packem, ESLint, Biome, Prisma, …). Opt in with `inferTargets: true`; explicit scripts and `project.json`/`vis.task.ts` overrides always win
67
+ - **URI-based input format** — `inputs` accepts `file://`, `glob://`, `env://`, `func://`, `dep://` strings as forward-compat sugar
68
+ - **Plugin / fingerprint hooks** — 14 typed hooks via `definePlugin` (lifecycle, streaming, retry, fingerprint, services), built on `hookable`
69
+ - **Strict env mode** — `--strict-env` extracts `${VAR}` references from each command and fails the task if any are unset
70
+ - **Lockfile preflight** — warns in TTY, hard-fails in CI when the lockfile is newer than the install marker
71
+ - **Project graph** — view dependencies in ASCII, DOT, JSON, or HTML
72
+
73
+ ### Adjacent tooling that ships in-box
74
+
75
+ - **`vis catalog check / update`** — pnpm + bun workspace catalog management
76
+ - **`vis secrets`** — Rust-native secret scanning (gitleaks detection engine)
77
+ - **`vis audit`** — OSV.dev vulnerability scanning with pluggable supply-chain providers ([Socket.dev](https://socket.dev) and [Google deps.dev](https://deps.dev), merged when both are enabled). `--explain` adds a plain-English AI explanation per finding (auto-detects an installed AI CLI, cached, no API key) in the terminal, JSON, and HTML report
78
+ - **`vis docker scaffold`** — lockfile pruning for pnpm / npm / yarn classic + berry / bun, matching turbo's killer Docker-cache feature
79
+ - **`vis hook install / migrate`** — git hooks (husky migration supported)
80
+ - **`vis staged`** — built-in `lint-staged` replacement, no peer dependency
81
+ - **`vis migrate gitleaks|secretlint`** — incremental migration paths
82
+ - **`vis replay <runId>`** — re-render any past run summary without re-execution
83
+
84
+ ### Toolchain & runtime
85
+
86
+ - **Pluggable installer** — defaults to the lockfile-detected PM (pnpm/npm/yarn/bun); auto-uses [aube](https://github.com/endevco/aube) when on `PATH`, with a single switch (`install.backend` / `--installer` / `--no-aube`) to pin or bypass it
87
+ - **Cold-start one-liner** — `curl -fsSL https://visulima.com/install.sh | bash` (Linux/macOS/WSL) or PowerShell equivalent installs the latest Node LTS (or a version manager on request) and `vis`
88
+ - **`vis toolchain`** — delegates to proto / mise / fnm / volta
89
+ - **Built on Cerebro** — robust CLI with built-in help, version, and shell completion
90
+
91
+ > **New to vis?** See [Why vis vs. Vite Task / Turbo / Nx / moon](./docs/guides/why-vis.mdx) for the side-by-side capability matrix.
50
92
 
51
93
  ## Install
52
94
 
@@ -62,9 +104,17 @@ yarn add @visulima/vis
62
104
  pnpm add @visulima/vis
63
105
  ```
64
106
 
107
+ ### Binaries
108
+
109
+ `@visulima/vis` installs four executables:
110
+
111
+ - `vis` — the full CLI (recommended; use this in scripts and CI).
112
+ - `v` — a short alias for `vis`. Note that `v` collides with the [V language](https://vlang.io/) compiler and is a common personal shell alias, so it may be shadowed. Prefer `vis` for anything you commit; see [`docs/guides/shell-alias.mdx`](./docs/guides/shell-alias.mdx) if you want your own short alias.
113
+ - `vx` / `visx` — the lean `dlx`-only entry point for one-off package execution.
114
+
65
115
  ### Cold start (no Node? no manager?)
66
116
 
67
- One-liner bootstrap that installs a version manager, Node LTS, and `vis` in one go.
117
+ One-liner bootstrap that installs Node and `vis` in one go. When no Node is found it installs the latest Node LTS directly by default (OS package manager, falling back to the official nodejs.org build); a version manager (proto / fnm / mise / volta) is offered as an opt-in alternative. Pin a specific major with `VIS_NODE_MAJOR`.
68
118
 
69
119
  **Linux / macOS / WSL** (bash):
70
120
 
@@ -98,7 +148,9 @@ vis check
98
148
  # Check with security vulnerability scanning
99
149
  vis check --security
100
150
 
101
- # Update catalog dependencies interactively
151
+ # Update catalog dependencies interactively, plus any
152
+ # GitHub Actions, Dockerfile, docker-compose, or GitLab CI
153
+ # references in the workspace (auto-detected).
102
154
  vis update --interactive
103
155
 
104
156
  # Install git hooks
@@ -119,10 +171,12 @@ brew install endevco/tap/aube
119
171
 
120
172
  Resolution precedence (highest first):
121
173
 
122
- 1. `--installer <name>` CLI flag (or `--no-aube` to force the lockfile-detected PM for one run)
123
- 2. `VIS_INSTALLER` environment variable
124
- 3. `install.backend` in `vis.config.ts`
125
- 4. Auto-detect — uses `aube` when it's on `PATH`, otherwise the lockfile-detected PM
174
+ 1. `--installer <name>` CLI flag — `auto`, `aube`, `pnpm`, `npm`, `yarn`, or `bun` (or `--no-aube` to force the lockfile-detected PM for a single run; `--no-aube` wins over every other source).
175
+ 2. `VIS_INSTALLER` environment variable — same accepted values as the flag.
176
+ 3. `install.backend` in `vis.config.ts` — same accepted values; the team-wide pin.
177
+ 4. Auto-detect — `aube` when it's on `PATH` or `aube-lock.yaml` is present, otherwise the lockfile-detected PM (`pnpm-lock.yaml` → pnpm, `package-lock.json` → npm, `yarn.lock` → yarn, `bun.lockb` → bun).
178
+
179
+ Each step is consulted in order; the first one that resolves to a concrete backend wins. Picking an explicit value (`pnpm`, `npm`, …) at any level always beats the auto-detect step below it, so you can override the team default for a single shell session via `VIS_INSTALLER=pnpm vis install` without touching the config file.
126
180
 
127
181
  ```ts
128
182
  // vis.config.ts — pin the installer for the team
@@ -141,32 +195,98 @@ Aube reuses pnpm/npm/yarn/bun lockfile formats but its serialized output isn't b
141
195
 
142
196
  Aube already skips dependency lifecycle scripts by default. `--ignore-scripts` is a no-op under aube (`vis install` warns when you pass it). To opt specific packages back in, run `aube approve-builds` — the inverse direction from the pnpm/npm `--ignore-scripts` model.
143
197
 
198
+ ### Audit delegation
199
+
200
+ When aube is the active installer, `vis audit` delegates to `aube audit` so a single, consistent vulnerability scan runs regardless of entry point. Resolution mirrors the installer chain:
201
+
202
+ 1. `--backend <name>` CLI flag — `auto`, `aube`, or `vis`.
203
+ 2. `VIS_AUDIT_BACKEND` env var.
204
+ 3. `security.audit.backend` in `vis.config.ts`.
205
+ 4. Defaults to `auto` — delegates only when `install.backend` (or `VIS_INSTALLER`) resolves to aube AND `aube` is on `PATH`.
206
+
207
+ Vis-only features (`--report`, `--fix-transitive`, `--usage`, `--policies`, `--format sarif|csaf|cyclonedx-vex|gitlab|junit`, `--ecosystem` beyond npm) print a warning and are dropped when delegating; pass `--backend vis` to force the built-in OSV/Socket scanner.
208
+
209
+ ### Doctor visibility
210
+
211
+ When aube is the installer, `vis doctor` surfaces aube's effective hardening posture (`paranoid`, `trustPolicy`, `blockExoticSubdeps`, `jailBuilds`, `strictDepBuilds`, `minimumReleaseAge`, `allowBuilds`) alongside the existing vis `security.policies.*` findings, reading from `aube-workspace.yaml` (or falling back to `pnpm-workspace.yaml`). Aube's defaults are already hardened, so most entries render as `ok` — the section turns into a positive confirmation rather than a wall of warnings.
212
+
144
213
  ## Commands
145
214
 
146
- | Command | Alias | Description |
147
- | ----------------------- | ------ | -------------------------------------------------------------------- |
148
- | `vis create [template]` | | Scaffold a new project from templates, npm packages, or git repos |
149
- | `vis generate [name]` | | Scaffold files from an in-repo template (native TS or moon-format) |
150
- | `vis init` | | Initialize vis.config.ts with security defaults |
151
- | `vis run <target>` | | Run a target across workspace projects with caching |
152
- | `vis affected <target>` | | Run tasks only on projects affected by git changes |
153
- | `vis ignore <project>` | | CI build gating for Vercel / Netlify "Ignored Build Step" |
154
- | `vis graph` | | Visualize the project dependency graph |
155
- | `vis check [packages]` | `c` | Check for outdated dependencies in workspace catalogs |
156
- | `vis update [packages]` | `up` | Update packages to their latest versions |
157
- | `vis install` | `i` | Install dependencies via the detected package manager |
158
- | `vis info <package>` | `view` | Show npm registry metadata for a package (wraps `npm view` et al.) |
159
- | `vis dlx <package>` | | Execute a remote package without permanent installation |
160
- | `vis audit` | | Audit dependencies for security vulnerabilities |
161
- | `vis clean` | | Remove build artifacts, caches, and node_modules |
162
- | `vis hook <action>` | | Manage git hooks (install, uninstall, migrate) |
163
- | `vis secrets [paths]` | | Scan for hardcoded secrets / credentials (Rust-native) |
164
- | `vis toolchain <cmd>` | | Inspect / delegate to the version manager (proto, mise, fnm, volta…) |
165
- | `vis staged` | | Run tasks on staged files (built-in `lint-staged` replacement) |
166
- | `vis migrate <type>` | | Migrate from other tools — now including `gitleaks` and `secretlint` |
215
+ | Command | Alias | Description |
216
+ | ----------------------- | ------ | -------------------------------------------------------------------------------------- |
217
+ | `vis create [template]` | | Scaffold a new project from templates, npm packages, or git repos |
218
+ | `vis generate [name]` | | Scaffold files from an in-repo template (native TS or moon-format) |
219
+ | `vis init` | | Initialize vis.config.ts with security defaults |
220
+ | `vis run <target>` | | Run a target across workspace projects with caching |
221
+ | `vis affected <target>` | | Run tasks only on projects affected by git changes |
222
+ | `vis ignore <project>` | | CI build gating for Vercel / Netlify "Ignored Build Step" |
223
+ | `vis graph` | | Visualize the project dependency graph |
224
+ | `vis check [packages]` | `c` | Check for outdated dependencies in workspace catalogs |
225
+ | `vis update [packages]` | `up` | Update packages, GitHub Actions, Dockerfiles, and GitLab CI refs |
226
+ | `vis install` | `i` | Install dependencies via the detected package manager |
227
+ | `vis info <package>` | `view` | Show npm registry metadata for a package (wraps `npm view` et al.) |
228
+ | `vis dlx <package>` | | Execute a remote package without permanent installation |
229
+ | `vis audit` | | Audit dependencies for security vulnerabilities |
230
+ | `vis clean` | | Remove build artifacts, caches, and node_modules |
231
+ | `vis cache <action>` | | Inspect cache (`list`, `size`, `hash`, `why`), or `prune` / `clean` |
232
+ | `vis hook <action>` | | Manage git hooks (install, uninstall, migrate) |
233
+ | `vis secrets [paths]` | | Scan for hardcoded secrets / credentials (Rust-native) |
234
+ | `vis toolchain <cmd>` | | Inspect / delegate to the version manager (proto, mise, fnm, volta…) |
235
+ | `vis lint [files]` | | Orchestrate detected source-code linters (oxlint, biome, eslint, stylelint, deno-lint) |
236
+ | `vis fmt [files]` | | Orchestrate detected formatters (oxfmt, biome, dprint, prettier, deno-fmt) |
237
+ | `vis staged` | | Run tasks on staged files (built-in `lint-staged` replacement) |
238
+ | `vis migrate <type>` | | Migrate from other tools — now including `gitleaks` and `secretlint` |
167
239
 
168
240
  For `vis ignore`, see the [command reference](./docs/commands/ignore.mdx) and the [deployment build gating section](./docs/guides/ci-cd.mdx#deployment-build-gating) of the CI/CD guide.
169
241
 
242
+ ### Diagnosing cache misses
243
+
244
+ When a task you expected to be cached re-ran, ask vis what changed:
245
+
246
+ ```sh
247
+ vis cache why @myorg/app:build # human-friendly diff vs. previous run
248
+ vis cache why @myorg/app:build --json # stable shape for CI
249
+ vis cache hash @myorg/app:build # just print the hash + per-bucket inputs
250
+ ```
251
+
252
+ `vis cache why` reads `.task-runner/last-summary.json` and diffs the task's `hashDetails` (`command`, `nodes`, `runtime`, `implicitDeps`) against the previous run, so you can pinpoint exactly which bucket rotated. Past runs only land in `.task-runner/runs/` when you pass `--summarize`, so use `vis run :build --summarize` (or set it as a default in CI) for diffs you'll want to inspect later.
253
+
254
+ ### Cache retention
255
+
256
+ `vis cache prune` evicts entries by any combination of age, total size, and count:
257
+
258
+ ```sh
259
+ vis cache prune --max-age-days=7 # drop entries older than a week
260
+ vis cache prune --max-size=2GB # evict oldest until under 2 GB
261
+ vis cache prune --keep-last=30 # keep only the 30 newest entries
262
+ vis cache prune --keep-last=30 --max-age-days=14 # combine: 30-newest floor, then age cap
263
+ ```
264
+
265
+ `--keep-last` enforces a count floor first (newest-first by mtime), then `--max-age-days` and `--max-size` apply.
266
+
267
+ ### Sharing the cache across git worktrees
268
+
269
+ When the workspace is a linked worktree (created with `git worktree add`), vis stores the cache at `<mainWorktreeRoot>/.task-runner-cache` so sibling worktrees driven by parallel agents share one cache instead of rebuilding the same hash N times. Set `sharedWorktreeCache: false` in `vis.config.ts` to opt out, or use `--scope=worktree|shared|all` on `vis cache list/size/prune` to inspect or operate on a specific store.
270
+
271
+ ### Quieting successful runs
272
+
273
+ `--output-style=quiet` skips stdout/stderr from successful and cached tasks while keeping failures fully visible. Pair it with per-target `options.outputStyle` to mute a single noisy task — or to keep one critical task verbose under a global quiet flag:
274
+
275
+ ```sh
276
+ vis run :build --output-style=quiet # only failures print
277
+ ```
278
+
279
+ ```json
280
+ {
281
+ "targets": {
282
+ "lint": { "options": { "outputStyle": "quiet" } },
283
+ "migrate": { "options": { "outputStyle": "normal" } }
284
+ }
285
+ }
286
+ ```
287
+
288
+ See the [`vis cache`](./docs/commands/cache.mdx) and [`vis run`](./docs/commands/run.mdx) command references for the full surface.
289
+
170
290
  ### Scanning for secrets
171
291
 
172
292
  `vis secrets` wraps [`@visulima/secret-scanner`](../secret-scanner) — a Rust port of the gitleaks detection engine — with ergonomic flags for the common workflows.
@@ -289,6 +409,42 @@ vis migrate lint-staged # moves the config into vis.config.ts and rewrites ho
289
409
 
290
410
  The migrator detects `package.json` keys, `.lintstagedrc*` files, and `lint-staged.config.*`, prompts before rewriting husky/vis hooks to call `vis staged`, and removes `lint-staged` from the dependency list.
291
411
 
412
+ ## Configuration API
413
+
414
+ The `@visulima/vis/config` subpath export is the programmatic surface for typed config and the plugin system. It ships more than `defineConfig`:
415
+
416
+ | Export | Kind | Purpose |
417
+ | ---------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------ |
418
+ | `defineConfig` | function | Type-checked `vis.config.ts` helper (root config). |
419
+ | `defineTaskConfig` | function | Type-checked task-only config (`vis.task.config.ts`). |
420
+ | `definePlugin` | function | Author a vis plugin (hooks, fingerprint contributors, OTel, …). |
421
+ | `otelPlugin` | function | Built-in OpenTelemetry plugin factory. |
422
+ | `loadVisConfig` / `loadVisTaskConfig` | function | Resolve + load the config from disk programmatically. |
423
+ | `findVisConfigFile` / `findVisTaskConfigFile` | function | Locate the config file without loading it. |
424
+ | `applyDefaults` | function | Merge a partial config with vis defaults. |
425
+ | `CONFIG_FILES` / `TASK_CONFIG_FILES` | const | The recognised config filenames, in resolution order. |
426
+ | `SECURITY_DEFAULTS` | const | The default audit/security policy applied when none is configured. |
427
+ | `VisConfig`, `VisTaskConfig`, `VisPlugin`, `VisHooks`, `OtelPluginOptions`, `FingerprintContributor` | type | Public config & plugin types. |
428
+
429
+ ```ts
430
+ import { defineConfig, definePlugin, otelPlugin } from "@visulima/vis/config";
431
+
432
+ const auditLogger = definePlugin({
433
+ name: "audit-logger",
434
+ hooks: {
435
+ "task:after": (task, result) => {
436
+ console.log(`${task.id} finished with exit code ${result.exitCode}`);
437
+ },
438
+ },
439
+ });
440
+
441
+ export default defineConfig({
442
+ plugins: [auditLogger, otelPlugin({ serviceName: "my-monorepo" })],
443
+ });
444
+ ```
445
+
446
+ See [`docs/configuration.mdx`](./docs/configuration.mdx) for the full config model and [`docs/guides/plugins.mdx`](./docs/guides/plugins.mdx) for the plugin authoring guide. A `@visulima/vis/generate` subpath export is also available for programmatic scaffolding.
447
+
292
448
  ## Documentation
293
449
 
294
450
  For full documentation including command reference, configuration options, best practices, and CI/CD integration guides, see the [docs](./docs) folder.
@@ -309,6 +465,26 @@ If you would like to help take a look at the [list of issues](https://github.com
309
465
  - [Daniel Bannert](https://github.com/prisis)
310
466
  - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
311
467
 
468
+ ### Migration sources
469
+
470
+ `vis migrate` ports configuration, scripts, and hooks from the following projects. Huge thanks to their authors and maintainers for the prior art that shaped vis's surface area.
471
+
472
+ | Project | Migrates with | Replaces |
473
+ | ---------------------------------------------------------- | ------------------------- | --------------------------- |
474
+ | [Husky](https://github.com/typicode/husky) | `vis hook migrate` | Git hook manager |
475
+ | [lint-staged](https://github.com/lint-staged/lint-staged) | `vis migrate lint-staged` | Pre-commit task runner |
476
+ | [nano-staged](https://github.com/usmanyunusov/nano-staged) | `vis migrate nano-staged` | Pre-commit task runner |
477
+ | [Turborepo](https://github.com/vercel/turborepo) | `vis migrate turborepo` | Monorepo task runner |
478
+ | [Nx](https://github.com/nrwl/nx) | `vis migrate nx` | Monorepo task runner |
479
+ | [Moon](https://github.com/moonrepo/moon) | `vis migrate moon` | Monorepo task runner |
480
+ | [Gitleaks](https://github.com/gitleaks/gitleaks) | `vis migrate gitleaks` | Secret scanner |
481
+ | [Kingfisher](https://github.com/mongodb/kingfisher) | `vis migrate kingfisher` | Secret scanner (MongoDB) |
482
+ | [Secretlint](https://github.com/secretlint/secretlint) | `vis migrate secretlint` | Secret linter |
483
+ | [Syncpack](https://github.com/JamieMason/syncpack) | `vis migrate syncpack` | Workspace dependency policy |
484
+ | [Sherif](https://github.com/QuiiBz/sherif) | `vis migrate sherif` | Monorepo linter |
485
+
486
+ After migrating a task runner, run `vis migrate verify-graph` to prove the migration preserved the task graph and cache-key surface — it diffs the original `turbo` / `nx` / `moon` config against the generated `vis.config.*` across six axes (target set, `dependsOn`, `inputs`, `outputs`, `env`, `cache`) and exits non-zero on any dropped task or narrowed cache key, so it can gate CI.
487
+
312
488
  ## Made with ❤️ at Anolilab
313
489
 
314
490
  This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Anolilab](https://www.anolilab.com/open-source) is a Development and AI Studio. Contact us at [hello@anolilab.com](mailto:hello@anolilab.com) if you need any help with these technologies or just want to say hi!
@@ -0,0 +1,85 @@
1
+ // Platform resolution for the native `vis` CLI binary. Shared by the launcher
2
+ // (`bin/vis.mjs`) and the integration tests so there is a single source of truth
3
+ // for where the binary lives and how the platform -> binding-package target slug
4
+ // is computed (mirroring the NAPI loader matrix in `index.js`).
5
+
6
+ import { existsSync } from "node:fs";
7
+ import { createRequire } from "node:module";
8
+ import { join } from "node:path";
9
+
10
+ const require = createRequire(import.meta.url);
11
+
12
+ // Best-effort musl detection for Linux. Defaults to glibc on any uncertainty.
13
+ const isMusl = () => {
14
+ const report = typeof process.report?.getReport === "function" ? process.report.getReport() : undefined;
15
+
16
+ if (report && Array.isArray(report.sharedObjects)) {
17
+ return report.sharedObjects.some((object) => object.includes("libc.musl-") || object.includes("ld-musl-"));
18
+ }
19
+
20
+ // Default to glibc on uncertainty (no report). musl is identified by the
21
+ // absence of glibcVersionRuntime; matches handler.ts's copy.
22
+ return report ? !report.header?.glibcVersionRuntime : false;
23
+ };
24
+
25
+ // Static platform+arch -> target slug table for the non-Linux targets (Linux is
26
+ // libc-dependent, so it is resolved separately).
27
+ const STATIC_TARGETS = {
28
+ "darwin:arm64": "darwin-arm64",
29
+ "darwin:x64": "darwin-x64",
30
+ "win32:arm64": "win32-arm64-msvc",
31
+ "win32:x64": "win32-x64-msvc",
32
+ };
33
+
34
+ // Compute the binding-package target slug for the current platform, or undefined
35
+ // for platforms with no published binary.
36
+ const nativeTarget = () => {
37
+ const { arch, platform } = process;
38
+
39
+ if (platform === "linux") {
40
+ const libc = isMusl() ? "musl" : "gnu";
41
+
42
+ if (arch === "arm64" || arch === "x64") {
43
+ return `linux-${arch}-${libc}`;
44
+ }
45
+
46
+ return undefined;
47
+ }
48
+
49
+ return STATIC_TARGETS[`${platform}:${arch}`];
50
+ };
51
+
52
+ // Resolve the platform-specific `vis` binary, or undefined if none is available
53
+ // (e.g. the optional binding package was not installed for this platform).
54
+ // Resolution order, most specific first:
55
+ // 1. VIS_NATIVE_BIN env override (dev / CI / tests).
56
+ // 2. A binary placed next to the package (local `build:native:cli` output).
57
+ // 3. The matching `@visulima/vis-binding-<target>` optional dependency.
58
+ const resolveNativeBinary = (packageRoot) => {
59
+ const override = process.env.VIS_NATIVE_BIN;
60
+
61
+ if (override && existsSync(override)) {
62
+ return override;
63
+ }
64
+
65
+ const exe = process.platform === "win32" ? "vis-native-cli.exe" : "vis-native-cli";
66
+ const local = join(packageRoot, exe);
67
+
68
+ if (existsSync(local)) {
69
+ return local;
70
+ }
71
+
72
+ const target = nativeTarget();
73
+
74
+ if (target === undefined) {
75
+ return undefined;
76
+ }
77
+
78
+ try {
79
+ return require.resolve(`@visulima/vis-binding-${target}/${exe}`);
80
+ } catch {
81
+ return undefined;
82
+ }
83
+ };
84
+
85
+ export { nativeTarget, resolveNativeBinary };
package/bin/vis.mjs ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+ // Native front-end launcher for `vis`.
3
+ //
4
+ // This is the npm `bin` entry. Its only jobs are to (1) route the small set of
5
+ // natively-implemented commands to the platform Rust binary, and (2) fall
6
+ // through to the existing in-process Node CLI for everything else. The
7
+ // fall-through path is byte-identical to running `dist/bin.js` directly, so the
8
+ // launcher adds no extra Node boot for delegated commands — it `import()`s the
9
+ // same entry in the same process.
10
+ //
11
+ // As commands are ported off Node, their names are added to NATIVE_COMMANDS and
12
+ // the binary grows to handle them; the binary itself delegates anything it does
13
+ // not implement back to `dist/bin.js` via the VIS_* contract.
14
+
15
+ import { spawnSync } from "node:child_process";
16
+ import { readFileSync } from "node:fs";
17
+ import { constants } from "node:os";
18
+ import { dirname, join } from "node:path";
19
+ import { fileURLToPath, pathToFileURL } from "node:url";
20
+
21
+ import { resolveNativeBinary } from "./resolve-binary.mjs";
22
+
23
+ const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
24
+
25
+ // VIS_FALLBACK_ENTRY lets tests (and the native binary's own delegation) point
26
+ // the Node entry elsewhere; production resolves it next to the package.
27
+ const fallbackEntry = process.env.VIS_FALLBACK_ENTRY ?? join(packageRoot, "dist", "bin.js");
28
+
29
+ // Commands answered by the native binary. Every entry here MUST be handled by
30
+ // the binary (natively or via its own Node delegation), with VERIFIED parity to
31
+ // the Node behavior. Unknown commands never reach the binary — they take the
32
+ // in-process path below, unchanged. NOTE: `-v` is cerebro's verbose flag (not
33
+ // version), so it is deliberately absent.
34
+ //
35
+ // `exec` parity was verified empirically against cerebro: tool flags after the
36
+ // command are forwarded to the tool on both the native path and the Node handler
37
+ // (src/commands/exec/handler.ts), which was fixed to stop dropping them.
38
+ const NATIVE_COMMANDS = new Set(["--version", "-V", "__native-info", "__pm-shim", "dedupe", "exec", "link", "outdated", "pm", "remove", "unlink", "why", "x"]);
39
+
40
+ const command = process.argv[2] ?? "";
41
+
42
+ if (NATIVE_COMMANDS.has(command)) {
43
+ const binary = resolveNativeBinary(packageRoot);
44
+
45
+ if (binary !== undefined) {
46
+ const { version } = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8"));
47
+
48
+ const { error, signal, status } = spawnSync(binary, process.argv.slice(2), {
49
+ env: {
50
+ ...process.env,
51
+ VIS_FALLBACK_ENTRY: fallbackEntry,
52
+ VIS_NODE: process.execPath,
53
+ VIS_VERSION: version,
54
+ },
55
+ stdio: "inherit",
56
+ });
57
+
58
+ if (error) {
59
+ // Binary unusable (e.g. corrupt install) — fall through to Node.
60
+ process.env.VIS_NATIVE_BIN_FAILED = "1";
61
+ } else if (signal) {
62
+ // Signal-terminated: follow the shell convention (128 + signal number)
63
+ // so the exit code matches the binary's own delegation path.
64
+ process.exit(128 + (constants.signals[signal] ?? 1));
65
+ } else {
66
+ process.exit(status ?? 1);
67
+ }
68
+ }
69
+ // No binary for this platform: fall through to the Node CLI below.
70
+ }
71
+
72
+ // In-process Node CLI. Same module graph and behaviour as invoking dist/bin.js
73
+ // directly — no extra process boot. fallbackEntry is an internally-resolved path
74
+ // (never user input); pathToFileURL keeps the dynamic import valid on Windows.
75
+ // eslint-disable-next-line no-unsanitized/method -- fallbackEntry is resolved internally, not from user input
76
+ await import(pathToFileURL(fallbackEntry).href);