@visulima/vis 1.0.0-alpha.1 → 1.0.0-alpha.10
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 +350 -12
- package/LICENSE.md +70 -0
- package/README.md +250 -9
- package/dist/bin.js +1 -146
- package/dist/errors/index.d.ts +26 -0
- package/dist/errors/index.js +1 -0
- package/dist/generate/index.d.ts +157 -0
- package/dist/generate/index.js +1 -0
- package/dist/packem_chunks/bin.js +87 -0
- package/dist/packem_chunks/config.js +2 -0
- package/dist/packem_chunks/fix.js +53 -0
- package/dist/packem_chunks/handler.js +1 -0
- package/dist/packem_chunks/handler10.js +1 -0
- package/dist/packem_chunks/handler11.js +1 -0
- package/dist/packem_chunks/handler12.js +2 -0
- package/dist/packem_chunks/handler13.js +1 -0
- package/dist/packem_chunks/handler14.js +5 -0
- package/dist/packem_chunks/handler15.js +1 -0
- package/dist/packem_chunks/handler16.js +20 -0
- package/dist/packem_chunks/handler17.js +1 -0
- package/dist/packem_chunks/handler18.js +1 -0
- package/dist/packem_chunks/handler19.js +1 -0
- package/dist/packem_chunks/handler2.js +1 -0
- package/dist/packem_chunks/handler20.js +1 -0
- package/dist/packem_chunks/handler21.js +1 -0
- package/dist/packem_chunks/handler22.js +5 -0
- package/dist/packem_chunks/handler23.js +1 -0
- package/dist/packem_chunks/handler24.js +1 -0
- package/dist/packem_chunks/handler25.js +5 -0
- package/dist/packem_chunks/handler26.js +1 -0
- package/dist/packem_chunks/handler27.js +3 -0
- package/dist/packem_chunks/handler28.js +1 -0
- package/dist/packem_chunks/handler29.js +7 -0
- package/dist/packem_chunks/handler3.js +2 -0
- package/dist/packem_chunks/handler30.js +23 -0
- package/dist/packem_chunks/handler31.js +3 -0
- package/dist/packem_chunks/handler32.js +2 -0
- package/dist/packem_chunks/handler33.js +24 -0
- package/dist/packem_chunks/handler34.js +2 -0
- package/dist/packem_chunks/handler35.js +19 -0
- package/dist/packem_chunks/handler36.js +428 -0
- package/dist/packem_chunks/handler37.js +22 -0
- package/dist/packem_chunks/handler38.js +22 -0
- package/dist/packem_chunks/handler39.js +22 -0
- package/dist/packem_chunks/handler4.js +4 -0
- package/dist/packem_chunks/handler40.js +3 -0
- package/dist/packem_chunks/handler41.js +10 -0
- package/dist/packem_chunks/handler42.js +153 -0
- package/dist/packem_chunks/handler43.js +42 -0
- package/dist/packem_chunks/handler44.js +3 -0
- package/dist/packem_chunks/handler45.js +27 -0
- package/dist/packem_chunks/handler5.js +2 -0
- package/dist/packem_chunks/handler6.js +13 -0
- package/dist/packem_chunks/handler7.js +8 -0
- package/dist/packem_chunks/handler8.js +1 -0
- package/dist/packem_chunks/handler9.js +1 -0
- package/dist/packem_chunks/index.js +7 -0
- package/dist/packem_chunks/loader.js +1 -0
- package/dist/packem_shared/VisConfigCycleError-CAYNC7d-.js +1 -0
- package/dist/packem_shared/VisConfigError-B5LP1zRf.js +1 -0
- package/dist/packem_shared/VisConfigLoadError-CeqBSd2Z.js +2 -0
- package/dist/packem_shared/VisConfigNotFoundError-DZ9KC527.js +5 -0
- package/dist/packem_shared/VisUpdateApp-D-L4_-Iu.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
- package/dist/packem_shared/ai-analysis-CGuy7dfE.js +67 -0
- package/dist/packem_shared/ai-cache-Bynt6Y9x.js +1 -0
- package/dist/packem_shared/cache-directory-D72ZEag2.js +1 -0
- package/dist/packem_shared/catalog-BVPerCwG.js +12 -0
- package/dist/packem_shared/dependency-scan-Du0tBu64.js +2 -0
- package/dist/packem_shared/docker-BcfqH4Av.js +2 -0
- package/dist/packem_shared/failure-log-DqYen0LC.js +2 -0
- package/dist/packem_shared/flakiness-DSIHZGBT.js +1 -0
- package/dist/packem_shared/run-summary-utils-C24Aaf9E.js +1 -0
- package/dist/packem_shared/runtime-check-CGHal8SO.js +1 -0
- package/dist/packem_shared/selectors-CfH9ZY08.js +3 -0
- package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
- package/dist/packem_shared/target-merge-DNa-6eWu.js +1 -0
- package/dist/packem_shared/toolchain-DQfTQY8E.js +5 -0
- package/dist/packem_shared/typosquats-DOR8izpX.js +1 -0
- package/dist/packem_shared/use-measured-height-DjYgUOKk.js +1 -0
- package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
- package/dist/packem_shared/xxh3-DrAUNq4n.js +1 -0
- package/index.js +601 -0
- package/package.json +67 -24
- package/schemas/project.schema.json +422 -0
- package/schemas/vis-config.schema.json +377 -0
- package/dist/ai-analysis.d.ts +0 -40
- package/dist/ai-cache.d.ts +0 -21
- package/dist/bin.d.ts +0 -1
- package/dist/catalog.d.ts +0 -110
- package/dist/commands/affected.d.ts +0 -3
- package/dist/commands/ai.d.ts +0 -3
- package/dist/commands/analyze.d.ts +0 -3
- package/dist/commands/check.d.ts +0 -3
- package/dist/commands/graph.d.ts +0 -3
- package/dist/commands/hook/constants.d.ts +0 -8
- package/dist/commands/hook/index.d.ts +0 -3
- package/dist/commands/hook/install.d.ts +0 -7
- package/dist/commands/hook/migrate.d.ts +0 -27
- package/dist/commands/hook/uninstall.d.ts +0 -3
- package/dist/commands/migrate/constants.d.ts +0 -12
- package/dist/commands/migrate/deps.d.ts +0 -32
- package/dist/commands/migrate/index.d.ts +0 -3
- package/dist/commands/migrate/json.d.ts +0 -20
- package/dist/commands/migrate/lint-staged.d.ts +0 -62
- package/dist/commands/migrate/types.d.ts +0 -20
- package/dist/commands/run.d.ts +0 -3
- package/dist/commands/staged.d.ts +0 -3
- package/dist/commands/update.d.ts +0 -3
- package/dist/config.d.ts +0 -40
- package/dist/config.js +0 -1
- package/dist/package-manager.d.ts +0 -23
- package/dist/workspace.d.ts +0 -58
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</h3>
|
|
9
|
+
<h3 align="center">A CLI task runner for monorepo workspaces, powered by @visulima/task-runner</h3>
|
|
10
10
|
|
|
11
11
|
<!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
12
12
|
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
- **Task caching**: Powered by `@visulima/task-runner` with local and remote caching support
|
|
41
41
|
- **Dependency-aware scheduling**: Runs tasks in topological order with configurable parallelism
|
|
42
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
|
|
43
44
|
- **Catalog management**: Check and update dependencies in pnpm/bun workspace catalogs
|
|
44
45
|
- **Security scanning**: Check for known vulnerabilities via OSV.dev
|
|
45
46
|
- **Graph visualization**: View your project dependency graph in ASCII, DOT, JSON, or HTML
|
|
@@ -61,6 +62,24 @@ yarn add @visulima/vis
|
|
|
61
62
|
pnpm add @visulima/vis
|
|
62
63
|
```
|
|
63
64
|
|
|
65
|
+
### Cold start (no Node? no manager?)
|
|
66
|
+
|
|
67
|
+
One-liner bootstrap that installs a version manager, Node LTS, and `vis` in one go.
|
|
68
|
+
|
|
69
|
+
**Linux / macOS / WSL** (bash):
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
curl -fsSL https://visulima.com/install.sh | bash
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Windows** (PowerShell 5.1+):
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
irm https://visulima.com/install.ps1 | iex
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Pass `--yes --manager=proto` (POSIX) or `-Yes -Manager proto` (PowerShell) for non-interactive / CI usage. See [`vis toolchain` docs](./docs/commands/toolchain.mdx#cold-start--no-node-no-manager) for details.
|
|
82
|
+
|
|
64
83
|
## Quick Start
|
|
65
84
|
|
|
66
85
|
```bash
|
|
@@ -86,16 +105,238 @@ vis update --interactive
|
|
|
86
105
|
vis hook install
|
|
87
106
|
```
|
|
88
107
|
|
|
108
|
+
## Installer backend (aube)
|
|
109
|
+
|
|
110
|
+
`vis install`, `vis add`, `vis remove`, `vis update`, `vis dlx`, `vis exec`, `vis link`, `vis unlink`, `vis dedupe`, `vis why`, `vis outdated`, `vis info`, and `vis pm` honor [aube](https://github.com/endevco/aube) — a Rust-native package manager that reads and writes pnpm/npm/yarn/bun lockfiles in place — as a drop-in installer. Aube also supports the pnpm `catalog:` and `catalog:<name>` protocol from `pnpm-workspace.yaml`, including walk-up resolution from subpackages.
|
|
111
|
+
|
|
112
|
+
`vis` does not bundle aube. Install it once via your tool of choice and `vis` will auto-detect it on `PATH`:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm install -g @endevco/aube # or
|
|
116
|
+
mise use -g aube # or
|
|
117
|
+
brew install endevco/tap/aube
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Resolution precedence (highest first):
|
|
121
|
+
|
|
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
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
// vis.config.ts — pin the installer for the team
|
|
129
|
+
import { defineConfig } from "@visulima/vis/config";
|
|
130
|
+
|
|
131
|
+
export default defineConfig({
|
|
132
|
+
install: { backend: "aube" }, // "auto" | "aube" | "pnpm" | "npm" | "yarn" | "bun"
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Lockfile drift
|
|
137
|
+
|
|
138
|
+
Aube reuses pnpm/npm/yarn/bun lockfile formats but its serialized output isn't byte-identical to the original tool's. The first install on a workspace whose lockfile was written by another PM produces a one-time churn diff; teams that mix tools on the same lockfile see ongoing drift. `vis install` warns when this is about to happen — pin `install.backend` to keep the team consistent.
|
|
139
|
+
|
|
140
|
+
### Lifecycle scripts
|
|
141
|
+
|
|
142
|
+
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
|
+
|
|
89
144
|
## Commands
|
|
90
145
|
|
|
91
|
-
| Command | Alias
|
|
92
|
-
| ----------------------- |
|
|
93
|
-
| `vis
|
|
94
|
-
| `vis
|
|
95
|
-
| `vis
|
|
96
|
-
| `vis
|
|
97
|
-
| `vis
|
|
98
|
-
| `vis
|
|
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 cache <action>` | | Inspect cache (`list`, `size`, `hash`, `why`), or `prune` / `clean` |
|
|
163
|
+
| `vis hook <action>` | | Manage git hooks (install, uninstall, migrate) |
|
|
164
|
+
| `vis secrets [paths]` | | Scan for hardcoded secrets / credentials (Rust-native) |
|
|
165
|
+
| `vis toolchain <cmd>` | | Inspect / delegate to the version manager (proto, mise, fnm, volta…) |
|
|
166
|
+
| `vis staged` | | Run tasks on staged files (built-in `lint-staged` replacement) |
|
|
167
|
+
| `vis migrate <type>` | | Migrate from other tools — now including `gitleaks` and `secretlint` |
|
|
168
|
+
|
|
169
|
+
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.
|
|
170
|
+
|
|
171
|
+
### Diagnosing cache misses
|
|
172
|
+
|
|
173
|
+
When a task you expected to be cached re-ran, ask vis what changed:
|
|
174
|
+
|
|
175
|
+
```sh
|
|
176
|
+
vis cache why @myorg/app:build # human-friendly diff vs. previous run
|
|
177
|
+
vis cache why @myorg/app:build --json # stable shape for CI
|
|
178
|
+
vis cache hash @myorg/app:build # just print the hash + per-bucket inputs
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`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.
|
|
182
|
+
|
|
183
|
+
### Cache retention
|
|
184
|
+
|
|
185
|
+
`vis cache prune` evicts entries by any combination of age, total size, and count:
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
vis cache prune --max-age-days=7 # drop entries older than a week
|
|
189
|
+
vis cache prune --max-size=2GB # evict oldest until under 2 GB
|
|
190
|
+
vis cache prune --keep-last=30 # keep only the 30 newest entries
|
|
191
|
+
vis cache prune --keep-last=30 --max-age-days=14 # combine: 30-newest floor, then age cap
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`--keep-last` enforces a count floor first (newest-first by mtime), then `--max-age-days` and `--max-size` apply.
|
|
195
|
+
|
|
196
|
+
### Sharing the cache across git worktrees
|
|
197
|
+
|
|
198
|
+
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.
|
|
199
|
+
|
|
200
|
+
### Quieting successful runs
|
|
201
|
+
|
|
202
|
+
`--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:
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
vis run :build --output-style=quiet # only failures print
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"targets": {
|
|
211
|
+
"lint": { "options": { "outputStyle": "quiet" } },
|
|
212
|
+
"migrate": { "options": { "outputStyle": "normal" } }
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
See the [`vis cache`](./docs/commands/cache.mdx) and [`vis run`](./docs/commands/run.mdx) command references for the full surface.
|
|
218
|
+
|
|
219
|
+
### Scanning for secrets
|
|
220
|
+
|
|
221
|
+
`vis secrets` wraps [`@visulima/secret-scanner`](../secret-scanner) — a Rust port of the gitleaks detection engine — with ergonomic flags for the common workflows.
|
|
222
|
+
|
|
223
|
+
```sh
|
|
224
|
+
vis secrets # scan the workspace (grouped, colourised output)
|
|
225
|
+
vis secrets --staged # pre-commit mode: scan staged files only
|
|
226
|
+
vis secrets --since main # scan files changed since the `main` branch
|
|
227
|
+
vis secrets --affected # scan only files affected by the current branch
|
|
228
|
+
vis secrets --init # scaffold an initial .secrets-baseline.json
|
|
229
|
+
vis secrets --list-rules # print all bundled detection rules
|
|
230
|
+
vis secrets --enable-rule tag:preset:weak-passwords # enable an opt-in rule group additively
|
|
231
|
+
vis secrets --exclude 'dist/**' --exclude-from .secretsignore # extra walker exclusions
|
|
232
|
+
vis secrets --include-rule stripe-access-token # check a single rule
|
|
233
|
+
vis secrets --exclude-rule generic-api-key # drop a noisy rule
|
|
234
|
+
vis secrets --baseline .secrets-baseline.json # suppress triaged findings; print diff
|
|
235
|
+
vis secrets --update-baseline # merge current findings into the baseline
|
|
236
|
+
vis secrets --format sarif > report.sarif # SARIF for GitHub code-scanning
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Suppression** — inline (`// gitleaks:allow`), block (`gitleaks:allow-start` … `gitleaks:allow-end`), or a baseline JSON (sole fingerprint store). See the [secret-scanner README](../secret-scanner/README.md#suppression) for details.
|
|
240
|
+
|
|
241
|
+
**CI example** (GitHub Actions, SARIF upload):
|
|
242
|
+
|
|
243
|
+
```yaml
|
|
244
|
+
name: Secrets
|
|
245
|
+
on: [push, pull_request]
|
|
246
|
+
jobs:
|
|
247
|
+
scan:
|
|
248
|
+
runs-on: ubuntu-latest
|
|
249
|
+
permissions: { security-events: write, contents: read }
|
|
250
|
+
steps:
|
|
251
|
+
- uses: actions/checkout@v4
|
|
252
|
+
- uses: pnpm/action-setup@v4
|
|
253
|
+
- run: pnpm install
|
|
254
|
+
- run: pnpm vis secrets --format sarif > report.sarif
|
|
255
|
+
continue-on-error: true
|
|
256
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
257
|
+
with: { sarif_file: report.sarif }
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Migrations
|
|
261
|
+
|
|
262
|
+
`vis migrate` now speaks two security tools:
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
vis migrate gitleaks # keeps gitleaks.toml, rewrites scripts/hooks to `vis secrets`
|
|
266
|
+
vis migrate secretlint # removes @secretlint/*, rewrites scripts/hooks, notes active rules
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Every destructive step writes a `.bak` sidecar first and prompts for confirmation (skip with `-y`). Dry-run previews are available via `--dry-run`.
|
|
270
|
+
|
|
271
|
+
### Running tasks on staged files
|
|
272
|
+
|
|
273
|
+
`vis staged` is a built-in replacement for `lint-staged` — the same config shape, no peer dependency, and an integrated task renderer. Requires Git ≥ 2.32.
|
|
274
|
+
|
|
275
|
+
Declare the patterns and tasks under `staged` in `vis.config.ts`:
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
// vis.config.ts
|
|
279
|
+
import { defineConfig } from "@visulima/vis/config";
|
|
280
|
+
|
|
281
|
+
export default defineConfig({
|
|
282
|
+
staged: {
|
|
283
|
+
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
|
|
284
|
+
"*.md": "prettier --write",
|
|
285
|
+
"package.json": (files) => `sort-package-json ${files.join(" ")}`,
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Each key is a glob (basename or path-style — path-style matches resolve relative to `cwd`). Each value is one of:
|
|
291
|
+
|
|
292
|
+
- a command string — split into argv, invoked with matched files appended;
|
|
293
|
+
- a `string[]` array — commands run serially for that pattern;
|
|
294
|
+
- a function `(files) => string | string[] | {title, task}` — generate dynamic commands or a custom task;
|
|
295
|
+
- a `{ title, task }` object — runs `task(files)` with no argv construction, useful for in-process side effects.
|
|
296
|
+
|
|
297
|
+
`vis.config.ts` is the single source of truth — no standalone `.lintstagedrc*` or `.vis-staged.*` files are read at runtime. Migrating from lint-staged or nano-staged? Run `vis migrate lint-staged` (or `vis migrate nano-staged`) to move the config in and remove the legacy files.
|
|
298
|
+
|
|
299
|
+
#### Command-line flags
|
|
300
|
+
|
|
301
|
+
```sh
|
|
302
|
+
vis staged # run tasks on the current staged set
|
|
303
|
+
vis staged --verbose # show stdout/stderr on success as well as failure
|
|
304
|
+
vis staged --no-stash # skip the backup stash (faster, but no recovery on failure)
|
|
305
|
+
vis staged --diff HEAD~1 # operate on a range instead of `--staged`
|
|
306
|
+
vis staged --diff-filter=ACM # override the default ACMR filter
|
|
307
|
+
vis staged --concurrent 4 # cap parallel pattern execution
|
|
308
|
+
vis staged --continue-on-error # don't short-circuit on the first failure
|
|
309
|
+
vis staged --fail-on-changes # non-zero exit if tasks modified staged content
|
|
310
|
+
vis staged --hide-unstaged # hide all unstaged edits on tracked files
|
|
311
|
+
vis staged --hide-all # hide unstaged edits AND untracked files
|
|
312
|
+
vis staged --relative # pass paths relative to cwd to tasks
|
|
313
|
+
vis staged --revert # restore pre-task state on failure
|
|
314
|
+
vis staged --allow-empty # allow a commit when tasks revert everything
|
|
315
|
+
vis staged --auto-stage # auto-stage new files tasks create (codegen, lockfile regen, …)
|
|
316
|
+
vis staged --force-kill # kill in-flight tasks with SIGKILL on fast-fail (default: SIGTERM)
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### Environment variables
|
|
320
|
+
|
|
321
|
+
| Variable | Description |
|
|
322
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
323
|
+
| `VIS_STAGED_CONCURRENT` | Concurrency fallback when `--concurrent` is not passed. Same value shape as the flag (`true`, `false`, or an integer). Useful in CI so you don't repeat the flag on every invocation. |
|
|
324
|
+
|
|
325
|
+
#### How it behaves
|
|
326
|
+
|
|
327
|
+
1. A hidden backup stash is created (via `git stash create` + `git stash store`, so the working tree is untouched).
|
|
328
|
+
2. For partially-staged files, the unstaged delta is captured as a patch and the working tree is reset to the staged content. `--hide-all` extends this to every unstaged change _and_ untracked files via a single `git stash push --include-untracked`.
|
|
329
|
+
3. Tasks run — patterns in parallel (capped at `os.availableParallelism()` by default), commands within a pattern serially.
|
|
330
|
+
4. Task-driven edits are re-staged with `git update-index --again` (with a `git add -u` fallback for deletions), so commits made via pathspec (`git commit -m "…" .`) keep working.
|
|
331
|
+
5. The unstaged patch — or the hide-all stash — is re-applied and the backup stash is dropped on success. On failure without `--revert`, the backup stash is preserved and the recovery sha is surfaced to the user. Ctrl+C aborts in-flight commands and still runs the restore path; a second Ctrl+C exits immediately.
|
|
332
|
+
|
|
333
|
+
#### Migrating from lint-staged
|
|
334
|
+
|
|
335
|
+
```sh
|
|
336
|
+
vis migrate lint-staged # moves the config into vis.config.ts and rewrites hooks
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
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.
|
|
99
340
|
|
|
100
341
|
## Documentation
|
|
101
342
|
|