@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.
- package/CHANGELOG.md +1854 -3
- package/LICENSE.md +13515 -10
- package/README.md +215 -39
- package/bin/resolve-binary.mjs +85 -0
- package/bin/vis.mjs +76 -0
- package/dashboard/dist/index.html +152 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +1 -2
- package/dist/binx.js +3 -0
- package/dist/config/index.d.ts +3276 -0
- package/dist/config/index.js +1 -0
- package/dist/generate/index.d.ts +1 -1
- package/dist/generate/index.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +8 -0
- package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -0
- package/dist/packem_chunks/agent-instructions.js +11 -0
- package/dist/packem_chunks/bloom-status.js +2 -0
- package/dist/packem_chunks/bloom-sync.js +2 -0
- package/dist/packem_chunks/cache-attestation.js +1 -0
- package/dist/packem_chunks/catalog-detector.js +1 -0
- package/dist/packem_chunks/catalog.js +114 -0
- package/dist/packem_chunks/cli-exec.js +1 -0
- package/dist/packem_chunks/cli-main.js +268 -0
- package/dist/packem_chunks/defineReleasePlugin.js +3 -0
- package/dist/packem_chunks/detect.js +3 -0
- package/dist/packem_chunks/detect2.js +8 -0
- package/dist/packem_chunks/devtools.js +4 -0
- package/dist/packem_chunks/discord.js +4 -0
- package/dist/packem_chunks/dispatch.js +4 -0
- package/dist/packem_chunks/doctor-probe.js +2 -0
- package/dist/packem_chunks/dynamic-import.js +1 -0
- package/dist/packem_chunks/extra-files.js +3 -0
- package/dist/packem_chunks/fix.js +11 -0
- package/dist/packem_chunks/git.js +3 -0
- package/dist/packem_chunks/group-tags.js +1 -0
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +5 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +26 -152
- package/dist/packem_chunks/handler13.js +5 -1
- package/dist/packem_chunks/handler14.js +1 -3
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -2
- package/dist/packem_chunks/handler17.js +1 -7
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +5 -19
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -428
- package/dist/packem_chunks/handler21.js +2 -22
- package/dist/packem_chunks/handler22.js +14 -3
- package/dist/packem_chunks/handler23.js +1 -5
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -20
- package/dist/packem_chunks/handler26.js +5 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +3 -1
- package/dist/packem_chunks/handler29.js +1 -2
- package/dist/packem_chunks/handler3.js +4 -2
- package/dist/packem_chunks/handler30.js +1 -22
- package/dist/packem_chunks/handler31.js +2 -1
- package/dist/packem_chunks/handler32.js +2 -1
- package/dist/packem_chunks/handler33.js +2 -37
- package/dist/packem_chunks/handler34.js +3 -3
- package/dist/packem_chunks/handler35.js +6 -23
- package/dist/packem_chunks/handler36.js +1 -5
- package/dist/packem_chunks/handler37.js +36 -21
- package/dist/packem_chunks/handler38.js +8 -1
- package/dist/packem_chunks/handler39.js +9 -2
- package/dist/packem_chunks/handler4.js +4 -5
- package/dist/packem_chunks/handler40.js +75 -1
- package/dist/packem_chunks/handler41.js +5 -5
- package/dist/packem_chunks/handler42.js +4 -1
- package/dist/packem_chunks/handler43.js +3 -24
- package/dist/packem_chunks/handler44.js +2 -3
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -0
- package/dist/packem_chunks/handler47.js +1 -0
- package/dist/packem_chunks/handler48.js +3 -0
- package/dist/packem_chunks/handler49.js +1 -0
- package/dist/packem_chunks/handler5.js +6 -4
- package/dist/packem_chunks/handler50.js +7 -0
- package/dist/packem_chunks/handler51.js +33 -0
- package/dist/packem_chunks/handler52.js +3 -0
- package/dist/packem_chunks/handler53.js +8 -0
- package/dist/packem_chunks/handler54.js +4 -0
- package/dist/packem_chunks/handler55.js +1 -0
- package/dist/packem_chunks/handler56.js +12 -0
- package/dist/packem_chunks/handler57.js +11 -0
- package/dist/packem_chunks/handler58.js +5 -0
- package/dist/packem_chunks/handler59.js +11 -0
- package/dist/packem_chunks/handler6.js +8 -2
- package/dist/packem_chunks/handler60.js +3 -0
- package/dist/packem_chunks/handler61.js +22 -0
- package/dist/packem_chunks/handler62.js +61 -0
- package/dist/packem_chunks/handler63.js +3 -0
- package/dist/packem_chunks/handler64.js +6 -0
- package/dist/packem_chunks/handler65.js +9 -0
- package/dist/packem_chunks/handler66.js +2 -0
- package/dist/packem_chunks/handler67.js +24 -0
- package/dist/packem_chunks/handler68.js +25 -0
- package/dist/packem_chunks/handler69.js +153 -0
- package/dist/packem_chunks/handler7.js +1 -24
- package/dist/packem_chunks/handler70.js +10 -0
- package/dist/packem_chunks/handler71.js +23 -0
- package/dist/packem_chunks/handler72.js +322 -0
- package/dist/packem_chunks/handler73.js +708 -0
- package/dist/packem_chunks/handler74.js +48 -0
- package/dist/packem_chunks/handler75.js +27 -0
- package/dist/packem_chunks/handler76.js +3 -0
- package/dist/packem_chunks/handler77.js +190 -0
- package/dist/packem_chunks/handler78.js +38 -0
- package/dist/packem_chunks/handler8.js +1 -6
- package/dist/packem_chunks/handler9.js +1 -8
- package/dist/packem_chunks/heal-accept.js +10 -0
- package/dist/packem_chunks/heal.js +14 -0
- package/dist/packem_chunks/help-command.js +31 -0
- package/dist/packem_chunks/index.js +1 -7
- package/dist/packem_chunks/index2.js +802 -0
- package/dist/packem_chunks/index3.js +7 -0
- package/dist/packem_chunks/index4.js +135 -0
- package/dist/packem_chunks/index5.js +73 -0
- package/dist/packem_chunks/interface.js +2 -0
- package/dist/packem_chunks/keys-refresh.js +4 -0
- package/dist/packem_chunks/lean.js +4 -0
- package/dist/packem_chunks/list.js +3 -0
- package/dist/packem_chunks/loader.js +4 -1
- package/dist/packem_chunks/loader2.js +1 -0
- package/dist/packem_chunks/orchestrator.js +42 -0
- package/dist/packem_chunks/pre-mode.js +2 -0
- package/dist/packem_chunks/print-config.js +2 -0
- package/dist/packem_chunks/prompts.js +7 -0
- package/dist/packem_chunks/prune.js +3 -0
- package/dist/packem_chunks/publish-guards.js +1 -0
- package/dist/packem_chunks/registry.js +48 -0
- package/dist/packem_chunks/resolveFormatter.js +9 -0
- package/dist/packem_chunks/run.js +1 -0
- package/dist/packem_chunks/security.js +1 -0
- package/dist/packem_chunks/shell-runner.js +1 -0
- package/dist/packem_chunks/slack.js +2 -0
- package/dist/packem_chunks/snapshot.js +2 -0
- package/dist/packem_chunks/stage-publisher.js +1 -0
- package/dist/packem_chunks/staged-registry.js +2 -0
- package/dist/packem_chunks/state.js +3 -0
- package/dist/packem_chunks/status.js +2 -0
- package/dist/packem_chunks/success-walk.js +8 -0
- package/dist/packem_chunks/sync.js +2 -0
- package/dist/packem_chunks/sync2.js +2 -0
- package/dist/packem_chunks/tar.js +3 -0
- package/dist/packem_chunks/tripwire.js +2 -0
- package/dist/packem_chunks/ts-loader.js +22 -0
- package/dist/packem_chunks/verify-lockfile.js +2 -0
- package/dist/packem_chunks/version-resolver.js +2 -0
- package/dist/packem_chunks/webhook.js +1 -0
- package/dist/packem_chunks/workflow-templates.js +167 -0
- package/dist/packem_chunks/workspace.js +2 -0
- package/dist/packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js +1 -0
- package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
- package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +1 -0
- package/dist/packem_shared/Table-BGIHvenQ-D2oJtNQj.js +34 -0
- package/dist/packem_shared/VisReleaseError-DMGRBTNO.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
- package/dist/packem_shared/advisories-CaP4uNhD.js +1 -0
- package/dist/packem_shared/affected-shas-BfO3PDJq.js +1 -0
- package/dist/packem_shared/ai-analysis-CO7No4rt.js +68 -0
- package/dist/packem_shared/ai-fix-B4u2zlVG.js +43 -0
- package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
- package/dist/packem_shared/api.d-BPftyU9r.d.ts +27 -0
- package/dist/packem_shared/augment-8z86AwtF.js +4 -0
- package/dist/packem_shared/bin-Cv8vsMEo.js +1 -0
- package/dist/packem_shared/build-scripts-D477Ou-x.js +1 -0
- package/dist/packem_shared/command-runtime-EWjmSxPj.js +1 -0
- package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
- package/dist/packem_shared/createAdapter-bU4DIP3F.js +1 -0
- package/dist/packem_shared/createVersionActions-BK43SNDH.js +1 -0
- package/dist/packem_shared/cyclonedx-CDWHbD9s.js +4 -0
- package/dist/packem_shared/defineFormatter-D5dCp6Kv.js +1 -0
- package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
- package/dist/packem_shared/dependency-scan-P52jY0pU.js +1 -0
- package/dist/packem_shared/docker-CD7o1D1o.js +59 -0
- package/dist/packem_shared/env-Cpxa_7UE.js +27 -0
- package/dist/packem_shared/failure-log-MOhz-TBv.js +2 -0
- package/dist/packem_shared/giget-DVTFJlbR.js +2 -0
- package/dist/packem_shared/glob-DMbPwGSj-uzODoE-1.js +1 -0
- package/dist/packem_shared/index-B0EsgdzO.js +1 -0
- package/dist/packem_shared/index-BAUIIRZJ.js +1 -0
- package/dist/packem_shared/index-BVuCxe14.js +22 -0
- package/dist/packem_shared/index-CdTXvj-V.js +1 -0
- package/dist/packem_shared/index-CgXLAAVI.js +28 -0
- package/dist/packem_shared/index-DjTWo3sH.js +1 -0
- package/dist/packem_shared/index.server-J83sowC4.js +2 -0
- package/dist/packem_shared/interface.d-B7VK2rcH.d.ts +148 -0
- package/dist/packem_shared/interface.d-Cezzifoh.d.ts +106 -0
- package/dist/packem_shared/license-t5KnNX6v.js +1 -0
- package/dist/packem_shared/lifecycle-hzwghh5a.js +2 -0
- package/dist/packem_shared/lockfile-CWcVTdRc.js +1 -0
- package/dist/packem_shared/main-B3juSU5z.js +1 -0
- package/dist/packem_shared/manifests-CaPqgQxW.js +1 -0
- package/dist/packem_shared/min-release-age-skpcnlpk.js +34 -0
- package/dist/packem_shared/missing-package-json-_hOp4AW5.js +1 -0
- package/dist/packem_shared/native-config-sync-CFi1iQNG.js +21 -0
- package/dist/packem_shared/osv-bloom-BAyJUnRx.js +2 -0
- package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
- package/dist/packem_shared/packument-CYxvm590.js +1 -0
- package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
- package/dist/packem_shared/plugins.d-ND23R9I3.d.ts +4 -0
- package/dist/packem_shared/pm-runner-mVFjedM6.js +1 -0
- package/dist/packem_shared/prompt-DjXHVgYU.js +1 -0
- package/dist/packem_shared/provenance-CI_WQx7G.js +1 -0
- package/dist/packem_shared/public-api-WqUCiyIe.js +131 -0
- package/dist/packem_shared/readJsonSync-DuMMeB3s-Cx08VBQg.js +1 -0
- package/dist/packem_shared/registry-keys-AGlSEY6R.js +1 -0
- package/dist/packem_shared/resolve-explicit-DVE9cfkm.js +5 -0
- package/dist/packem_shared/resolve-runtime-CGHf-wHz.js +1 -0
- package/dist/packem_shared/run-file-Bs_E9O6O.js +1 -0
- package/dist/packem_shared/runtime-check-pS2XH4BO.js +1 -0
- package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
- package/dist/packem_shared/s1ngularity-xmrq5T5r.js +1 -0
- package/dist/packem_shared/scan-progress-DQ4TMXcb.js +2 -0
- package/dist/packem_shared/selectors-CRgS4bU9.js +3 -0
- package/dist/packem_shared/signatures-Dp3th1DB.js +2 -0
- package/dist/packem_shared/slug-DoueYuLo.js +1 -0
- package/dist/packem_shared/spinner-DuJJvFTl.js +1 -0
- package/dist/packem_shared/sticky-comment-D6_7-w8T.js +1 -0
- package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
- package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
- package/dist/packem_shared/tabs-CgxCvjCY.js +1 -0
- package/dist/packem_shared/target-merge-D2eTghgd.js +11 -0
- package/dist/packem_shared/target-options-TM6ETDAS.js +1 -0
- package/dist/packem_shared/toolchain-B5KwUZfq.js +5 -0
- package/dist/packem_shared/typosquats-C0layQsP.js +1 -0
- package/dist/packem_shared/use-measured-height-Drobr4fe.js +1 -0
- package/dist/packem_shared/utils-CRueU43T.js +1 -0
- package/dist/packem_shared/verify-Cjo4EBFZ.js +1 -0
- package/dist/packem_shared/vis-update-app-qIkyvrd1.js +1 -0
- package/dist/packem_shared/watch-BnE1TzYn.js +1 -0
- package/dist/packem_shared/watch-loop-Irf3Pm-1.js +11 -0
- package/dist/release/core/changelog/index.d.ts +5 -0
- package/dist/release/core/changelog/index.js +1 -0
- package/dist/release/core/package-managers/index.d.ts +6 -0
- package/dist/release/core/package-managers/index.js +1 -0
- package/dist/release/core/version-actions/index.d.ts +14 -0
- package/dist/release/core/version-actions/index.js +1 -0
- package/dist/release/index.d.ts +233 -0
- package/dist/release/index.js +1 -0
- package/dist/release/plugin-sdk.d.ts +128 -0
- package/dist/release/plugin-sdk.js +1 -0
- package/dist/release/presets.d.ts +225 -0
- package/dist/release/presets.js +1 -0
- package/dist/release/types.d.ts +1493 -0
- package/dist/release/types.js +1 -0
- package/dist/runtime/preload.d.ts +1 -0
- package/dist/runtime/preload.js +1 -0
- package/index.d.ts +450 -0
- package/index.js +663 -556
- package/package.json +105 -62
- package/schemas/project.schema.json +872 -225
- package/schemas/vis-config.schema.json +6309 -264
- package/schemas/vis-release-config.schema.json +1423 -0
- package/skills/vis/SKILL.md +96 -0
- package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
- package/templates/buildkite-ci/template.yml +20 -0
- package/dist/config.d.ts +0 -1087
- package/dist/config.js +0 -1
- package/dist/packem_shared/VisUpdateApp-BBx3idMI.js +0 -1
- package/dist/packem_shared/ai-analysis-DDqXRFxY.js +0 -67
- package/dist/packem_shared/bin-BaZZ32BK.js +0 -93
- package/dist/packem_shared/cache-directory-DL8hfXeG.js +0 -1
- package/dist/packem_shared/catalog-CuSpuB_R.js +0 -12
- package/dist/packem_shared/dependency-scan-BoLG2Fez.js +0 -1
- package/dist/packem_shared/docker-BcfqH4Av.js +0 -2
- package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
- package/dist/packem_shared/otelPlugin-DxyvBcXO.js +0 -1
- package/dist/packem_shared/runtime-check-CGHal8SO.js +0 -1
- package/dist/packem_shared/selectors-CfH9ZY08.js +0 -3
- package/dist/packem_shared/symbols-CIMw60-G.js +0 -1
- package/dist/packem_shared/toolchain-C3ZG0o_X.js +0 -5
- package/dist/packem_shared/typosquats-Bpq4zcWL.js +0 -1
- 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
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
- **
|
|
42
|
-
-
|
|
43
|
-
- **
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
- **
|
|
48
|
-
-
|
|
49
|
-
- **
|
|
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
|
|
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
|
|
123
|
-
2. `VIS_INSTALLER` environment variable
|
|
124
|
-
3. `install.backend` in `vis.config.ts`
|
|
125
|
-
4. Auto-detect —
|
|
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
|
|
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
|
|
163
|
-
| `vis
|
|
164
|
-
| `vis
|
|
165
|
-
| `vis
|
|
166
|
-
| `vis
|
|
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);
|