@visulima/vis 1.0.0-alpha.10 → 1.0.0-alpha.12

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 (107) hide show
  1. package/CHANGELOG.md +185 -42
  2. package/LICENSE.md +586 -0
  3. package/README.md +26 -4
  4. package/dist/config/index.d.ts +1739 -0
  5. package/dist/config/index.js +1 -0
  6. package/dist/generate/index.d.ts +1 -1
  7. package/dist/packem_chunks/applyDefaults.js +2 -0
  8. package/dist/packem_chunks/bin.js +232 -60
  9. package/dist/packem_chunks/doctor-probe.js +2 -0
  10. package/dist/packem_chunks/fix.js +11 -53
  11. package/dist/packem_chunks/handler.js +1 -1
  12. package/dist/packem_chunks/handler10.js +2 -1
  13. package/dist/packem_chunks/handler11.js +1 -1
  14. package/dist/packem_chunks/handler12.js +5 -2
  15. package/dist/packem_chunks/handler13.js +1 -1
  16. package/dist/packem_chunks/handler14.js +18 -5
  17. package/dist/packem_chunks/handler15.js +20 -1
  18. package/dist/packem_chunks/handler16.js +1 -20
  19. package/dist/packem_chunks/handler17.js +1 -1
  20. package/dist/packem_chunks/handler18.js +1 -1
  21. package/dist/packem_chunks/handler19.js +1 -1
  22. package/dist/packem_chunks/handler2.js +2 -1
  23. package/dist/packem_chunks/handler20.js +5 -1
  24. package/dist/packem_chunks/handler21.js +1 -1
  25. package/dist/packem_chunks/handler22.js +1 -5
  26. package/dist/packem_chunks/handler23.js +5 -1
  27. package/dist/packem_chunks/handler24.js +1 -1
  28. package/dist/packem_chunks/handler25.js +3 -5
  29. package/dist/packem_chunks/handler26.js +1 -1
  30. package/dist/packem_chunks/handler27.js +1 -3
  31. package/dist/packem_chunks/handler28.js +7 -1
  32. package/dist/packem_chunks/handler29.js +22 -6
  33. package/dist/packem_chunks/handler3.js +4 -2
  34. package/dist/packem_chunks/handler30.js +3 -23
  35. package/dist/packem_chunks/handler31.js +1 -3
  36. package/dist/packem_chunks/handler32.js +2 -2
  37. package/dist/packem_chunks/handler33.js +24 -23
  38. package/dist/packem_chunks/handler34.js +2 -2
  39. package/dist/packem_chunks/handler35.js +3 -19
  40. package/dist/packem_chunks/handler36.js +22 -428
  41. package/dist/packem_chunks/handler37.js +428 -22
  42. package/dist/packem_chunks/handler38.js +20 -20
  43. package/dist/packem_chunks/handler39.js +21 -21
  44. package/dist/packem_chunks/handler4.js +2 -4
  45. package/dist/packem_chunks/handler40.js +22 -3
  46. package/dist/packem_chunks/handler41.js +6 -10
  47. package/dist/packem_chunks/handler42.js +5 -153
  48. package/dist/packem_chunks/handler43.js +10 -42
  49. package/dist/packem_chunks/handler44.js +153 -3
  50. package/dist/packem_chunks/handler45.js +25 -27
  51. package/dist/packem_chunks/handler46.js +3 -0
  52. package/dist/packem_chunks/handler47.js +27 -0
  53. package/dist/packem_chunks/handler48.js +42 -0
  54. package/dist/packem_chunks/handler5.js +8 -2
  55. package/dist/packem_chunks/handler6.js +1 -13
  56. package/dist/packem_chunks/handler7.js +1 -8
  57. package/dist/packem_chunks/handler8.js +1 -1
  58. package/dist/packem_chunks/handler9.js +1 -1
  59. package/dist/packem_chunks/heal-accept.js +10 -0
  60. package/dist/packem_chunks/heal.js +14 -0
  61. package/dist/packem_chunks/index.js +3 -3
  62. package/dist/packem_chunks/tar.js +3 -0
  63. package/dist/packem_shared/ai-analysis-hm8d2W7z.js +67 -0
  64. package/dist/packem_shared/{ai-cache-Bynt6Y9x.js → ai-cache-DoiF80AR.js} +1 -1
  65. package/dist/packem_shared/ai-fix-nn4zOE95.js +43 -0
  66. package/dist/packem_shared/cache-directory-CwHlJhgx.js +1 -0
  67. package/dist/packem_shared/dependency-scan-COr5n63B.js +2 -0
  68. package/dist/packem_shared/{docker-BcfqH4Av.js → docker-D6OGr5_S.js} +1 -1
  69. package/dist/packem_shared/{failure-log-DqYen0LC.js → failure-log-iUVLf6ts.js} +1 -1
  70. package/dist/packem_shared/flakiness-D9wf0t56.js +1 -0
  71. package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
  72. package/dist/packem_shared/index-DH-5hsrC.js +1 -0
  73. package/dist/packem_shared/otel-DxDUPJJH.js +6 -0
  74. package/dist/packem_shared/otelPlugin-CQq6poq8.js +1 -0
  75. package/dist/packem_shared/registry-CkubDdiY.js +2 -0
  76. package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +1 -0
  77. package/dist/packem_shared/{runtime-check-CGHal8SO.js → runtime-check-BXZ43CBW.js} +1 -1
  78. package/dist/packem_shared/{selectors-CfH9ZY08.js → selectors-BylODRiM.js} +1 -1
  79. package/dist/packem_shared/toolchain-BgBOUHII.js +5 -0
  80. package/dist/packem_shared/typosquats-CcZl99B1.js +1 -0
  81. package/dist/packem_shared/verify-Baj5mFJ7.js +1 -0
  82. package/dist/packem_shared/vis-update-app-D1jl0UZZ.js +1 -0
  83. package/index.js +54 -53
  84. package/package.json +34 -26
  85. package/schemas/project.schema.json +739 -299
  86. package/schemas/vis-config.schema.json +3383 -278
  87. package/skills/vis/SKILL.md +96 -0
  88. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  89. package/templates/buildkite-ci/template.yml +20 -0
  90. package/dist/errors/index.d.ts +0 -26
  91. package/dist/errors/index.js +0 -1
  92. package/dist/packem_chunks/config.js +0 -2
  93. package/dist/packem_shared/VisConfigCycleError-CAYNC7d-.js +0 -1
  94. package/dist/packem_shared/VisConfigError-B5LP1zRf.js +0 -1
  95. package/dist/packem_shared/VisConfigLoadError-CeqBSd2Z.js +0 -2
  96. package/dist/packem_shared/VisConfigNotFoundError-DZ9KC527.js +0 -5
  97. package/dist/packem_shared/VisUpdateApp-D-L4_-Iu.js +0 -1
  98. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
  99. package/dist/packem_shared/ai-analysis-CGuy7dfE.js +0 -67
  100. package/dist/packem_shared/cache-directory-D72ZEag2.js +0 -1
  101. package/dist/packem_shared/catalog-BVPerCwG.js +0 -12
  102. package/dist/packem_shared/dependency-scan-Du0tBu64.js +0 -2
  103. package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
  104. package/dist/packem_shared/run-summary-utils-C24Aaf9E.js +0 -1
  105. package/dist/packem_shared/target-merge-DNa-6eWu.js +0 -1
  106. package/dist/packem_shared/toolchain-DQfTQY8E.js +0 -5
  107. package/dist/packem_shared/typosquats-DOR8izpX.js +0 -1
@@ -0,0 +1,1739 @@
1
+ import { TaskResult, Task, TargetConfiguration, ConstraintsConfig, NamedInputs, TaskRunnerOptions } from '@visulima/task-runner';
2
+ import { Hookable } from 'hookable';
3
+ import { Tracer } from '@opentelemetry/api';
4
+ /**
5
+ * Typed hook surface exposed to vis plugins.
6
+ *
7
+ * Plugins subscribe via `hooks.hook(name, handler)` — handlers are
8
+ * awaited sequentially in registration order. Returning a promise
9
+ * delays the next hook firing until it resolves, so plugins can
10
+ * safely perform async setup/teardown.
11
+ *
12
+ * Naming deliberately mirrors vite-task / webpack-style verbs:
13
+ * before/after for boundaries, on<Event> for passive observation.
14
+ */
15
+ interface VisHooks {
16
+ /**
17
+ * Fired after the entire task graph completes (including any
18
+ * failures). `results` maps task ID → {@link TaskResult}.
19
+ */
20
+ "run:after": (results: Map<string, TaskResult>) => Promise<void> | void;
21
+ /**
22
+ * Fired once before any task in the graph starts, after workspace
23
+ * discovery and graph construction. Throwing aborts the run.
24
+ */
25
+ "run:before": (context: {
26
+ tasks: Task[];
27
+ workspaceRoot: string;
28
+ }) => Promise<void> | void;
29
+ /**
30
+ * Fired after a task completes (success, failure, or cache hit).
31
+ * Receives the final {@link TaskResult}.
32
+ */
33
+ "task:after": (task: Task, result: TaskResult) => Promise<void> | void;
34
+ /**
35
+ * Fired before each task begins execution — after scheduling, before
36
+ * the executor runs the command. Throwing aborts that single task.
37
+ */
38
+ "task:before": (task: Task) => Promise<void> | void;
39
+ /** Fired when a task hit the local or remote cache. */
40
+ "task:cacheHit": (task: Task, result: TaskResult) => Promise<void> | void;
41
+ /**
42
+ * Fired when auto-fingerprint cache diagnostics reports a miss,
43
+ * carrying the human-readable reason string.
44
+ */
45
+ "task:cacheMiss": (task: Task, reasons: string) => Promise<void> | void;
46
+ /** Fired when a task exits non-zero. */
47
+ "task:failure": (task: Task, result: TaskResult) => Promise<void> | void;
48
+ /**
49
+ * Fired with a stderr chunk as a running task emits it. Plugins
50
+ * that ship logs live (Slack, Datadog) should prefer this over
51
+ * `task:after` so they don't wait for the full buffer.
52
+ */
53
+ "task:stderr": (task: Task, chunk: string) => Promise<void> | void;
54
+ /**
55
+ * Fired with a stdout chunk as a running task emits it. See
56
+ * `task:stderr` for semantics.
57
+ */
58
+ "task:stdout": (task: Task, chunk: string) => Promise<void> | void;
59
+ }
60
+ /**
61
+ * Public plugin contract. Implementations register handlers by
62
+ * returning a partial {@link VisHooks} map from `hooks`, or by
63
+ * mutating the Hookable instance directly via `setup(hooks)` for
64
+ * advanced cases (dynamic registration, removeHook, etc.).
65
+ *
66
+ * Plugins are loaded in the order they appear in `visConfig.plugins`.
67
+ * Handler execution order within a hook follows registration order,
68
+ * so earlier plugins see events first.
69
+ */
70
+ interface VisPlugin {
71
+ /**
72
+ * Declarative handlers — the common shape. One entry per hook
73
+ * name; pass a function or an array of functions (all run serially
74
+ * in order).
75
+ */
76
+ hooks?: Partial<{ [K in keyof VisHooks]: VisHooks[K] | VisHooks[K][] }>;
77
+ /** Plugin name — surfaced in debug logs. */
78
+ name: string;
79
+ /**
80
+ * Imperative setup — receives the shared Hookable instance so the
81
+ * plugin can register hooks conditionally, unregister later, or
82
+ * use advanced APIs like `hookOnce`/`beforeEach`/`afterEach`.
83
+ */
84
+ setup?: (hooks: Hookable<VisHooks>) => Promise<void> | void;
85
+ }
86
+ /**
87
+ * One family of upstream-coupled packages.
88
+ *
89
+ * `members` is an exact-match list. `prefixes` accept any dep whose
90
+ * name starts with the prefix — useful for monorepos that ship many
91
+ * subpackages under one scope (e.g. `@babel/`, `@storybook/`,
92
+ * `@nx/`). A family can use either or both; a dep matching either
93
+ * list belongs to the family.
94
+ */
95
+ interface SimilarDepFamily {
96
+ /** Stable id; used in report output and config overrides. */
97
+ id: string;
98
+ /** Pretty label for the report. Defaults to `id` when omitted. */
99
+ label?: string;
100
+ /** Dep names that belong to this family verbatim. */
101
+ members?: string[];
102
+ /** Dep-name prefixes (literal, no glob). Match if `depName.startsWith(prefix)`. */
103
+ prefixes?: string[];
104
+ }
105
+ type VersionManagerName = "asdf" | "corepack" | "fnm" | "mise" | "none" | "nvm" | "proto" | "self-activate" | "volta";
106
+ type RuntimeTool = "bun" | "deno" | "go" | "node" | "npm" | "pnpm" | "python" | "ruby" | "rust" | "yarn";
107
+ interface ToolchainConfig {
108
+ /**
109
+ * When a tool pin doesn't match the running version, try to fix it
110
+ * automatically before `vis run` / `vis ci` proceed. Defaults to
111
+ * `true` when {@link findInstalledManagers} reports at least one
112
+ * installed manager, `false` otherwise.
113
+ *
114
+ * Set to `false` to keep the doctor-style warning behaviour and
115
+ * make users run `vis toolchain install` themselves.
116
+ */
117
+ readonly autoInstall?: boolean;
118
+ /** Explicit manager override, useful in CI. */
119
+ readonly preferredManager?: VersionManagerName;
120
+ /** Overrides for engines/packageManager-derived pins. */
121
+ readonly tools?: Partial<Record<RuntimeTool, string>>;
122
+ }
123
+ /**
124
+ * Custom task form — `{ title, task }` — analogous to lint-staged's
125
+ * listr-style task objects. `task` receives the matched absolute paths
126
+ * and returns a promise that resolves on success or rejects on failure.
127
+ */
128
+ interface CustomTask {
129
+ readonly task: (files: string[]) => unknown;
130
+ readonly title: string;
131
+ }
132
+ /**
133
+ * A task value as authored by the user. Command strings are split into
134
+ * argv and invoked with the matched file paths appended. Arrays run
135
+ * serially. Functions receive the matched paths and return further
136
+ * task values (possibly async). `{ title, task }` objects run `task`
137
+ * directly with no argv construction.
138
+ */
139
+ type StagedTask = CustomTask | StagedTaskFunction | ReadonlyArray<CustomTask | StagedTaskFunction | string> | string | ReadonlyArray<string>;
140
+ type StagedTaskFunction = (files: string[]) => Promise<StagedTaskResult> | StagedTaskResult;
141
+ type StagedTaskResult = CustomTask | ReadonlyArray<CustomTask | string> | string | ReadonlyArray<string>;
142
+ /**
143
+ * Config object mapping glob patterns (basename or path-style) to tasks.
144
+ * A top-level function form lets the user generate the entire config
145
+ * from the staged file list.
146
+ */
147
+ type StagedConfig = Readonly<Record<string, StagedTask>> | StagedConfigFunction;
148
+ type StagedConfigFunction = (files: string[]) => Promise<Record<string, StagedTask>> | Record<string, StagedTask>;
149
+ /**
150
+ * Configuration block declared on a target to mark it as a long-lived
151
+ * "service" — eligible to be started/stopped via `vis service` and
152
+ * auto-attached when other tasks depend on it.
153
+ *
154
+ * Targets must also carry `preset: "server"` (or the equivalent
155
+ * `persistent: true`) for the service-mode lifecycle to apply.
156
+ */
157
+ interface ServiceConfig {
158
+ /**
159
+ * Env vars to expose to dependent tasks when this service is
160
+ * registered. Merged into the dependent task's env after the task's
161
+ * own envFile and before the task's explicit `env` overrides — the
162
+ * dependent task wins on key collisions.
163
+ *
164
+ * Note: only this `env` map propagates to dependents. The service
165
+ * target's own `envFile` is loaded into the **service process** at
166
+ * start time but is *not* forwarded — dependents must declare any
167
+ * shared values they need either here or in their own envFile. This
168
+ * boundary is intentional: envFiles often contain operator-only
169
+ * secrets (deploy keys, admin tokens) that should not leak into
170
+ * downstream test commands.
171
+ */
172
+ env?: Record<string, string>;
173
+ /**
174
+ * Grace period in milliseconds between SIGTERM and SIGKILL when the
175
+ * service is stopped.
176
+ * @default 5000
177
+ */
178
+ killGracePeriodMs?: number;
179
+ /**
180
+ * Optional port the service listens on. Used as the default for
181
+ * `readiness.tcp.port` when no explicit probe is configured, and
182
+ * surfaced by `vis service list`.
183
+ */
184
+ port?: number;
185
+ /** Readiness probe configuration. v1 supports TCP only. */
186
+ readiness?: {
187
+ tcp: {
188
+ host?: string;
189
+ port: number;
190
+ timeoutMs?: number;
191
+ };
192
+ };
193
+ }
194
+ /**
195
+ * Semantic classification for a target.
196
+ * - `build`: Generates one or more artifacts; cached by default.
197
+ * - `test`: Validation task (lint, typecheck, unit test). Default type.
198
+ * - `run`: One-off or long-running process. Not cached by default.
199
+ */
200
+ type TargetType = "build" | "run" | "test";
201
+ /**
202
+ * Preset bundles of target options.
203
+ * - `server`: Long-running local dev server — caching off, not in CI,
204
+ * interactive, persistent.
205
+ * - `utility`: Short-lived helper — caching off, not in CI.
206
+ */
207
+ type TargetPreset = "server" | "utility";
208
+ /**
209
+ * Controls whether a target runs in CI.
210
+ * - `true` (default): Always run.
211
+ * - `false`: Never run in CI (local-only).
212
+ * - `"affected"`: Only when the project is affected by the current change set.
213
+ * - `"always"`: Always run, even if unaffected.
214
+ */
215
+ type RunInCI = "affected" | "always" | boolean;
216
+ /**
217
+ * Controls how affected files are forwarded to a task.
218
+ * - `false` (default): Do not forward.
219
+ * - `"args"`: Append affected paths as additional command arguments.
220
+ * - `"env"`: Expose them via `VIS_AFFECTED_FILES` environment variable.
221
+ * - `"both"`: Both of the above.
222
+ */
223
+ type AffectedFilesMode = "args" | "both" | "env" | false;
224
+ /**
225
+ * Vis-specific target options that extend the task-runner's
226
+ * base `TargetConfiguration`. These live under `target.options` and are
227
+ * interpreted by vis before handing the task off to task-runner.
228
+ *
229
+ * Conditional execution (`when:`) and finally tasks (`always:`) live at
230
+ * the target top level, not under `options` — they're handled by the
231
+ * task-runner orchestrator. See `@visulima/task-runner`'s `WhenCondition`.
232
+ */
233
+ interface VisTargetOptions {
234
+ /**
235
+ * How to forward affected files to the task process.
236
+ * Only used when invoked via `vis affected &lt;target>`.
237
+ * @default false
238
+ */
239
+ affectedFiles?: AffectedFilesMode;
240
+ /**
241
+ * Load environment variables from dotenv file(s) before running.
242
+ * - `string`: a single file path (relative to project root).
243
+ * - `string[]`: multiple files — later entries override earlier ones,
244
+ * so put more-specific files last (e.g. `[".env", ".env.local"]`).
245
+ * - `true`: auto-cascade in the Next/Vite order:
246
+ * `.env` → `.env.{NODE_ENV}` → `.env.local` → `.env.{NODE_ENV}.local`.
247
+ * Skips `.env.local` when NODE_ENV is `test`, matching Next.js.
248
+ */
249
+ envFile?: boolean | string | string[];
250
+ /**
251
+ * When true, the task is serialized with respect to parallel execution
252
+ * and must be run on the main process (claims stdin). Used for commands
253
+ * that read from the terminal.
254
+ * @default false
255
+ */
256
+ interactive?: boolean;
257
+ /**
258
+ * When true, the task is hidden from CLI listings and can only be invoked
259
+ * as a dependency of another task.
260
+ * @default false
261
+ */
262
+ internal?: boolean;
263
+ /**
264
+ * Milliseconds the timeout watchdog waits between sending SIGTERM
265
+ * and SIGKILL when the `timeout` budget fires. Tasks that ignore
266
+ * SIGTERM (e.g. test runners holding open child processes) get
267
+ * force-killed after this grace window so a stuck task can't outlive
268
+ * its budget.
269
+ *
270
+ * Set to `0` to skip escalation and rely on SIGTERM only.
271
+ * @default 5000
272
+ */
273
+ killGracePeriodMs?: number;
274
+ /**
275
+ * Serializes all tasks that share the same mutex name. Useful for tasks
276
+ * that contend on a shared resource (e.g., a database migration).
277
+ */
278
+ mutex?: string;
279
+ /**
280
+ * Per-target output verbosity. Overrides the global `--output-style`
281
+ * flag for this specific target.
282
+ *
283
+ * - `"normal"` (default): print every task's terminal output
284
+ * - `"quiet"`: only print output when the task fails. Successful
285
+ * and cached tasks contribute their status line and timing, but
286
+ * their captured stdout/stderr is suppressed.
287
+ *
288
+ * Useful when a routinely-noisy task (a linter or test runner with
289
+ * verbose progress output) should stay quiet during green builds
290
+ * but reveal everything when it fails.
291
+ */
292
+ outputStyle?: "normal" | "quiet";
293
+ /**
294
+ * When true, the task is a long-running / never-ending process.
295
+ * Persistent tasks are scheduled last, execute after all cacheable
296
+ * tasks complete, and are never cached.
297
+ * @default false
298
+ */
299
+ persistent?: boolean;
300
+ /**
301
+ * A preset that pre-fills a common bundle of options.
302
+ * User-provided fields always take precedence over the preset.
303
+ */
304
+ preset?: TargetPreset;
305
+ /**
306
+ * Run the task through a pseudo-terminal so color-aware tools
307
+ * (vitest, eslint, biome, …) render as if attached to a real TTY
308
+ * instead of a pipe. Output is captured via task-runner's
309
+ * `TerminalBuffer` so ANSI escapes are normalized into the final
310
+ * rendered state before reaching the reporter.
311
+ *
312
+ * Forces cache to off — PTY output can include timing-dependent
313
+ * frames (spinners) that aren't safe to replay from a cache.
314
+ * @default false
315
+ */
316
+ pty?: boolean;
317
+ /**
318
+ * Number of times to retry the task on failure. Uses an exponential
319
+ * backoff by default (1s, 2s, 4s, ...).
320
+ * @default 0
321
+ */
322
+ retryCount?: number;
323
+ /**
324
+ * Delay between retry attempts in milliseconds, or `"exponential"`
325
+ * for 2^attempt * 1000 ms.
326
+ * @default "exponential"
327
+ */
328
+ retryDelay?: number | "exponential";
329
+ /**
330
+ * When true, the command executes with the workspace root as CWD
331
+ * instead of the project root.
332
+ * @default false
333
+ */
334
+ runFromWorkspaceRoot?: boolean;
335
+ /**
336
+ * Controls whether the task runs in CI environments.
337
+ * @default true
338
+ */
339
+ runInCI?: RunInCI;
340
+ /**
341
+ * Capability tags that gate this task to runners advertising the
342
+ * same tag. The CLI's `--runner-tags=gpu,slow` flag (or
343
+ * `VIS_RUNNER_TAGS` env var) tells vis what the current runner
344
+ * supports; tasks whose `runnerTags` share at least one tag with
345
+ * the runner set are eligible. Untagged tasks (no `runnerTags` or
346
+ * an empty array) are general-purpose and always run.
347
+ *
348
+ * Use this for special-purpose CI lanes — e.g. a GPU runner that
349
+ * should only pick up visual-regression suites, or a nightly job
350
+ * that runs `slow` integration tests. When neither flag nor env
351
+ * is set, the filter is inactive and every task runs.
352
+ */
353
+ runnerTags?: string[];
354
+ /**
355
+ * Marks this target as a long-lived service that can be started via
356
+ * `vis service start &lt;id>` and auto-attached when other tasks declare
357
+ * it in `dependsOn`. Implies persistent + non-cacheable behaviour
358
+ * (set `preset: "server"` to inherit the rest of the bundle).
359
+ *
360
+ * The presence of this block — not `preset: "server"` alone — is
361
+ * what makes a target eligible for the cross-invocation registry.
362
+ * `preset: "server"` without `service` keeps today's in-run-only
363
+ * behaviour.
364
+ */
365
+ service?: ServiceConfig;
366
+ /**
367
+ * Per-target shell override. When set, the command runs through this
368
+ * shell instead of the platform default.
369
+ */
370
+ shell?: string;
371
+ /**
372
+ * Override the workspace `strictEnv` setting for this target. When
373
+ * truthy, the target fails if its command references an env var
374
+ * that resolves to neither the task's effective env nor
375
+ * `process.env`. When `false`, the target opts out of a workspace
376
+ * `strictEnv: true` (e.g. for a one-off command that legitimately
377
+ * tolerates an unset variable).
378
+ * @see VisConfig.strictEnv
379
+ */
380
+ strictEnv?: boolean;
381
+ /**
382
+ * Maximum wall-clock milliseconds a single task run is allowed to
383
+ * take before being killed. `0` / `undefined` means no timeout.
384
+ *
385
+ * When the timeout fires the task is sent SIGTERM and, if it has
386
+ * not exited within `killGracePeriodMs`, SIGKILL. The task exits
387
+ * with a failure status carrying the `[timeout]` marker in
388
+ * `terminalOutput`. Retries count per-attempt, not cumulatively.
389
+ *
390
+ * Use this to prevent runaway tasks from eating CI wall-clock time
391
+ * up to the job-level cutoff.
392
+ */
393
+ timeout?: number;
394
+ /**
395
+ * Per-target unix shell override, used on Linux and macOS.
396
+ * Takes precedence over `shell` on unix-like systems.
397
+ */
398
+ unixShell?: string;
399
+ /**
400
+ * Per-target windows shell override, used on Windows.
401
+ * Takes precedence over `shell` on Windows.
402
+ */
403
+ windowsShell?: string;
404
+ }
405
+ /**
406
+ * An extended target configuration that adds the vis-specific options
407
+ * on top of task-runner's `TargetConfiguration`.
408
+ */
409
+ interface VisTargetConfiguration extends Omit<TargetConfiguration, "options"> {
410
+ /**
411
+ * Alternate names that resolve to this target on the CLI. Useful
412
+ * for shortening long canonical names (`test` ↔ `t`) or for
413
+ * offering migration-friendly aliases when renaming targets.
414
+ * Aliases must be globally unique within the workspace.
415
+ */
416
+ aliases?: string[];
417
+ /**
418
+ * One-line description surfaced by `vis list` and (in future)
419
+ * per-task `--help`. Kept short — longer docs belong in project
420
+ * READMEs or vis.config.ts comments.
421
+ */
422
+ description?: string;
423
+ /**
424
+ * True when the target was synthesized by a Project Crystal-style
425
+ * detector (see {@link ../inference}) rather than declared by a
426
+ * package.json script, project.json, or vis.task.ts file. Surfaced
427
+ * by `vis list --inferred` and used by tooling to distinguish
428
+ * implicit defaults from explicit user intent.
429
+ */
430
+ inferred?: boolean;
431
+ /** Vis-specific target options. */
432
+ options?: VisTargetOptions;
433
+ /** Preset applied before user-specified options. */
434
+ preset?: TargetPreset;
435
+ /**
436
+ * Semantic task type. Affects caching defaults and CI filtering.
437
+ * @default "test"
438
+ */
439
+ type?: TargetType;
440
+ }
441
+ interface CodeownersConfig {
442
+ /** Workspace-level paths that apply outside any project (e.g., `.github/**`). */
443
+ globalPaths?: Record<string, string[]>;
444
+ /** Sort order for generated entries — mirrors moon's `orderBy`. */
445
+ orderBy?: "file-source" | "project-id";
446
+ /** Provider determines whether `channel` is emitted (GitHub supports it via comment). */
447
+ provider?: "bitbucket" | "github" | "gitlab" | "other";
448
+ }
449
+ /**
450
+ * One user-declared customTypes entry. See `policy.customTypes.extraTypes`
451
+ * for the full contract — this is just the row shape.
452
+ */
453
+ interface ExtraCustomType {
454
+ /**
455
+ * Required when `strategy === "string"`. The dep-cluster key the bare
456
+ * version string at `path` should be associated with.
457
+ */
458
+ depName?: string;
459
+ /**
460
+ * Display name for this customType. Used as the cluster key prefix in
461
+ * lint output and JSON. Must not collide with the built-in names.
462
+ */
463
+ name: string;
464
+ /** Dot-separated walk into package.json (e.g. `pnpm.overrides`, `myTool.runtime`). */
465
+ path: string;
466
+ /**
467
+ * How to interpret the JSON found at `path`.
468
+ * - `name@version` — single string `pnpm@9.0.0` (with optional `+sha512.…` hash).
469
+ * - `name~version` — single string `node~20.0.0`, mirrors syncpack's tilde form.
470
+ * - `string` — bare version literal (requires `depName`).
471
+ * - `versionsByName` — `{ name: version }` object such as `engines`.
472
+ */
473
+ strategy: "name@version" | "name~version" | "string" | "versionsByName";
474
+ }
475
+ /**
476
+ * Declared code-owner assignment for a path glob within a project.
477
+ * Mirrors moon's `owners` shape so migrations can round-trip cleanly.
478
+ */
479
+ interface OwnersEntry {
480
+ /** Optional notification channel (e.g. Slack, Teams). */
481
+ channel?: string;
482
+ /** Owner handles (e.g. `@visulima/core-team`). */
483
+ owners: string[];
484
+ /** File/glob pattern relative to the project root. */
485
+ path: string;
486
+ }
487
+ /**
488
+ * Per-project TypeScript overlay loaded from `vis.task.ts`. Adds a
489
+ * dynamic, type-safe layer for target overrides on top of `project.json`,
490
+ * which stays the canonical home for static metadata (`tags`, `layer`,
491
+ * `stack`, `language`, `owners`, `projectType`, `sourceRoot`,
492
+ * `implicitDependencies`).
493
+ *
494
+ * `vis.task.ts` is opt-in. A package without one behaves identically to
495
+ * before its introduction. Targets defined here merge over `project.json`'s
496
+ * `targets` block — see `design-config-layering.md` for the full
497
+ * precedence stack.
498
+ */
499
+ interface VisTaskConfig {
500
+ /** Per-target overrides — same shape as `project.json#targets`. */
501
+ targets?: Record<string, VisTargetConfiguration>;
502
+ }
503
+ /**
504
+ * Per-project metadata surfaced by `project.json`. Extended beyond the
505
+ * minimal `projectType` / `tags` / `sourceRoot` fields we historically
506
+ * parsed to include targets, owners, and layer/stack classification.
507
+ */
508
+ interface ProjectJson {
509
+ /** Implicit dependencies on other projects. */
510
+ implicitDependencies?: string[];
511
+ /** Primary language — informational and query-able. */
512
+ language?: string;
513
+ /** Project layer, used for constraint inheritance and query filtering. */
514
+ layer?: "application" | "automation" | "configuration" | "library" | "scaffolding" | "tool";
515
+ /** Code owners for paths inside this project. */
516
+ owners?: OwnersEntry[];
517
+ /** Project-level metadata. */
518
+ project?: {
519
+ channel?: string;
520
+ description?: string;
521
+ maintainers?: string[];
522
+ owner?: string;
523
+ title?: string;
524
+ };
525
+ /** Project type — library or application. */
526
+ projectType?: "application" | "library";
527
+ /** Source root, used for display and language inference. */
528
+ sourceRoot?: string;
529
+ /** Tech stack. */
530
+ stack?: "backend" | "data" | "frontend" | "infrastructure" | "systems";
531
+ /** Filterable tags. */
532
+ tags?: string[];
533
+ /** Vis-style target definitions (merged on top of package.json scripts). */
534
+ targets?: Record<string, VisTargetConfiguration>;
535
+ }
536
+ /**
537
+ * A scope predicate used by {@link VisConfig.taskDefaults}.
538
+ * All listed constraints must match for the block to apply.
539
+ */
540
+ interface TaskDefaultsScope {
541
+ /** Match on primary language. */
542
+ language?: string | string[];
543
+ /** Match on project layer. */
544
+ layer?: ProjectJson["layer"] | ProjectJson["layer"][];
545
+ /** Match on project type. */
546
+ projectType?: "application" | "library";
547
+ /** Match on project stack. */
548
+ stack?: ProjectJson["stack"] | ProjectJson["stack"][];
549
+ /** Match projects tagged with any of these tags. */
550
+ tags?: string[];
551
+ }
552
+ /**
553
+ * A single task-defaults block — a set of target defaults gated by an
554
+ * optional scope predicate.
555
+ */
556
+ interface TaskDefaultsBlock {
557
+ /** Optional scope predicate; if omitted, the block applies universally. */
558
+ scope?: TaskDefaultsScope;
559
+ /** Target default configurations. */
560
+ targets: Record<string, Partial<VisTargetConfiguration>>;
561
+ }
562
+ interface VisConfig {
563
+ /** AI analysis configuration */
564
+ ai?: {
565
+ /** Cache TTL in milliseconds. Overrides default (1h / 30min for security). */
566
+ cacheTtl?: number;
567
+ /** Override default provider priority. Higher number = preferred. */
568
+ priority?: Record<string, number>;
569
+ /** Use a specific provider instead of auto-detecting (e.g., `"claude"`, `"gemini"`). */
570
+ provider?: string;
571
+ };
572
+ /**
573
+ * Scope the task-runner cache directory by the current git branch.
574
+ * When `true`, caches are stored under `&lt;cacheDir>/branches/&lt;slug>`
575
+ * so `main` and feature branches stop thrashing each other —
576
+ * generated artefacts (schemas, `.d.ts` snapshots) that legitimately
577
+ * differ across branches no longer oscillate the cache contents.
578
+ *
579
+ * Falls back to the unscoped path on detached HEAD, non-git
580
+ * workspaces, or when git isn't available.
581
+ * @default false
582
+ */
583
+ branchScopedCache?: boolean;
584
+ /**
585
+ * Code ownership configuration. Controls how `vis sync codeowners`
586
+ * renders the generated CODEOWNERS file.
587
+ */
588
+ codeowners?: CodeownersConfig;
589
+ /**
590
+ * Project dependency constraints.
591
+ * Enforced after building the project graph, before running tasks.
592
+ */
593
+ constraints?: ConstraintsConfig;
594
+ /**
595
+ * Configuration for the `vis create` scaffolding command.
596
+ * Controls template downloads (via giget), default options, and
597
+ * post-creation behavior.
598
+ */
599
+ create?: {
600
+ /**
601
+ * Authorization token for downloading private repository templates.
602
+ * Passed as Bearer token to the git host API.
603
+ * Can also be set via GIGET_AUTH, GITHUB_TOKEN, or GH_TOKEN environment variables.
604
+ */
605
+ auth?: string;
606
+ /**
607
+ * Default editor to configure after scaffolding.
608
+ * When set, `vis create` automatically generates editor config files.
609
+ * @example "vscode"
610
+ */
611
+ defaultEditor?: "vscode";
612
+ /**
613
+ * Default package manager for new standalone projects.
614
+ * When set, skips the PM selection prompt in interactive mode.
615
+ */
616
+ defaultPm?: "bun" | "npm" | "pnpm" | "yarn";
617
+ /**
618
+ * Default giget provider for `owner/repo` shorthand inputs.
619
+ * @default "github"
620
+ */
621
+ defaultProvider?: "bitbucket" | "github" | "gitlab" | "sourcehut";
622
+ /**
623
+ * Initialize a git repository after scaffolding standalone projects.
624
+ * @default false
625
+ */
626
+ gitInit?: boolean;
627
+ /**
628
+ * Install dependencies automatically after scaffolding.
629
+ * @default true
630
+ */
631
+ install?: boolean;
632
+ /**
633
+ * Prefer locally cached templates over re-downloading.
634
+ * Useful for offline development or slow connections.
635
+ * @default false
636
+ */
637
+ preferOffline?: boolean;
638
+ /**
639
+ * Custom template registry URL.
640
+ * When set, giget checks this registry for template metadata
641
+ * before falling back to direct provider resolution.
642
+ * Set to `false` to disable registry lookup entirely.
643
+ * @see https://github.com/unjs/giget#custom-registry
644
+ */
645
+ registry?: false | string;
646
+ /**
647
+ * Named template aliases for quick access.
648
+ * Maps short names to full giget source strings.
649
+ * @example
650
+ * ```
651
+ * templates: {
652
+ * "react": "github:vitejs/vite/packages/create-vite/template-react-ts",
653
+ * "lib": "github:my-org/lib-template",
654
+ * "internal": "gitlab:company/templates/node-service",
655
+ * }
656
+ * ```
657
+ */
658
+ templates?: Record<string, string>;
659
+ };
660
+ /**
661
+ * Discover `.editorconfig` for indent / line-ending defaults during
662
+ * file transformations (sort-package-json, migrate, hook, pm overrides,
663
+ * workspace catalog rewrites). Per-command flags can still override.
664
+ * @default true
665
+ */
666
+ editorconfig?: boolean;
667
+ /**
668
+ * Inherit configuration from one or more parent configs. Entries are
669
+ * resolved left-to-right (later wins) and the consumer's own values
670
+ * always override anything pulled in from `extends`.
671
+ *
672
+ * Each entry is either:
673
+ * - a relative path (`./shared.config.ts`, `../shared.config.ts`) —
674
+ * resolved against the file declaring `extends`;
675
+ * - an npm package name (`@acme/vis-preset`) — resolved via Node.js
676
+ * module resolution from the consumer file.
677
+ *
678
+ * Absolute paths are rejected — they break across machines and CI.
679
+ * Cycles raise `VisConfigCycleError` during load.
680
+ * @example
681
+ * ```
682
+ * extends: ["@acme/vis-preset", "./shared/security.config.ts"]
683
+ * ```
684
+ */
685
+ extends?: string | string[];
686
+ /**
687
+ * Named file-group patterns, reusable from target `inputs` via the
688
+ * `@filegroup:&lt;name>` token. File groups are resolved relative to each
689
+ * project root at discovery time.
690
+ * @example
691
+ * ```
692
+ * fileGroups: {
693
+ * sources: ["src/**\/*.ts", "!src/**\/*.test.ts"],
694
+ * tests: ["**\/*.test.ts"],
695
+ * }
696
+ * ```
697
+ */
698
+ fileGroups?: Record<string, string[]>;
699
+ /**
700
+ * Configuration for the `vis generate` in-repo scaffolding command.
701
+ * Points at additional template directories beyond the defaults
702
+ * (`.vis/templates/` and `.moon/templates/`).
703
+ */
704
+ generator?: {
705
+ /**
706
+ * Authorization token forwarded to giget when fetching
707
+ * `git://`/`npm://` remote templates. Falls back to
708
+ * `GIGET_AUTH` / `GITHUB_TOKEN` / `GH_TOKEN` env vars.
709
+ */
710
+ auth?: string;
711
+ /**
712
+ * Prefer locally cached remote templates over re-downloading.
713
+ * Overridable per invocation via `--prefer-offline`.
714
+ * @default false
715
+ */
716
+ preferOffline?: boolean;
717
+ /**
718
+ * Extra directories to scan for templates. Each directory is
719
+ * checked for both native templates (`&lt;name>.ts`) and
720
+ * moon-format directories (containing `template.yml`).
721
+ * @example
722
+ * ```
723
+ * generator: {
724
+ * templates: ["./tools/generators", "./packages/scaffolding/templates"],
725
+ * }
726
+ * ```
727
+ */
728
+ templates?: string[];
729
+ };
730
+ /**
731
+ * Auto-create targets from detected config files (Project Crystal-style).
732
+ * Inferred targets sit *below* explicit ones — anything in
733
+ * `package.json#scripts`, `project.json#targets`, or `vis.task.ts`
734
+ * wins per-key, so opting in never overrides existing setups.
735
+ *
736
+ * Built-in detectors and the targets they synthesize:
737
+ *
738
+ * - **App frameworks** — `nuxt` (build/dev/preview/generate),
739
+ * `next` (build/dev/start), `remix` (build/dev/start), `astro`
740
+ * (build/dev), `gatsby` (build/develop/serve), `docusaurus`
741
+ * (build/start/serve).
742
+ * - **Bundlers** — `vite` (build/dev/preview), `rolldown` (build),
743
+ * `tsdown` (build), `tsup` (build), `packem` (build), `rollup`
744
+ * (build), `webpack` (build).
745
+ * - **Docs sites** — `vitepress` (docs:build/docs:dev/docs:preview),
746
+ * `typedoc` (docs).
747
+ * - **Server frameworks** — `nest` (build/start/start:dev).
748
+ * - **Test runners** — `vitest` (test/test:watch), `jest`
749
+ * (test/test:watch), `bun` (test), `playwright` (test:e2e),
750
+ * `cypress` (test:e2e/cypress:open).
751
+ * - **Stories** — `storybook` (storybook/build-storybook).
752
+ * - **Type checking** — `typescript` (typecheck via `tsc --noEmit`).
753
+ * - **Lint / format** — `eslint` (lint), `prettier` (format /
754
+ * format:check), `biome` (lint, format), `oxlint` (lint),
755
+ * `oxfmt` (format / format:check), `stylelint` (lint:css),
756
+ * `knip` (knip).
757
+ * - **Runtimes** — `deno` (test/lint/fmt/check).
758
+ * - **Database tooling** — `prisma` (db:generate/db:migrate/
759
+ * db:push/db:studio), `drizzle` (db:generate/db:migrate/
760
+ * db:push/db:studio).
761
+ * - **Codegen / release** — `graphql-codegen` (codegen),
762
+ * `api-extractor` (api-extract), `changeset` (changeset:version /
763
+ * changeset:publish / changeset:status).
764
+ *
765
+ * Trigger: presence of any matching config file in the project root.
766
+ * Most detectors additionally match when their framework appears in
767
+ * `dependencies` / `devDependencies` / `peerDependencies` /
768
+ * `optionalDependencies` — covering convention-only setups (e.g.
769
+ * vitest with default config). Detectors that intentionally require
770
+ * a config file (because the package frequently appears transitively
771
+ * and a dep-only match would synthesize broken commands): `vite`,
772
+ * `rolldown`, `rollup`, `webpack`, `storybook`, `nest`, `remix`,
773
+ * `vitepress`, `bun`, `deno`, `changeset`.
774
+ *
775
+ * Conflict resolution: detectors are evaluated in registration order
776
+ * (see `BUILT_IN_DETECTORS`) and the first to claim a target name
777
+ * wins. Per-name priorities: `build` → nuxt > next > remix > astro
778
+ * > gatsby > docusaurus > vite > nest > rolldown > tsdown > tsup >
779
+ * packem > rollup > webpack; `test` → vitest > jest > bun > deno;
780
+ * `test:e2e` → playwright > cypress; `lint` → eslint > biome >
781
+ * oxlint > deno; `format` → prettier > biome > oxfmt; `db:*` →
782
+ * prisma > drizzle.
783
+ *
784
+ * Also accepts an object form (`{ vite: false, vitest: true }`) to
785
+ * opt individual detectors in or out by name. Detectors omitted from
786
+ * the object run at their default (enabled). Useful when one
787
+ * detector misfires for a given workspace without disabling the rest.
788
+ * @default false
789
+ */
790
+ inferTargets?: Record<string, boolean> | boolean;
791
+ /**
792
+ * Installer backend selection for `vis install` / `vis add` /
793
+ * `vis remove` / `vis update` / `vis ci`.
794
+ *
795
+ * Lets users opt into [aube](https://github.com/endevco/aube) — a
796
+ * Rust-native package manager that reads/writes pnpm/npm/yarn/bun
797
+ * lockfiles in place — as the default installer, while keeping a
798
+ * single switch to fall back to the conventional PM detected from
799
+ * the lockfile.
800
+ *
801
+ * Resolution precedence (highest first):
802
+ * 1. CLI flag (`--installer &lt;name>` / `--no-aube`)
803
+ * 2. Env var `VIS_INSTALLER`
804
+ * 3. This config field
805
+ * 4. Auto-detect (the default)
806
+ *
807
+ * Aube must be installed separately — `vis` does not bundle it.
808
+ * Install via npm (`@endevco/aube`), `mise use -g aube`, or
809
+ * `brew install endevco/tap/aube`.
810
+ */
811
+ install?: {
812
+ /**
813
+ * Which package manager performs install/add/remove/etc.
814
+ * - `auto` (default): use `aube` when it is on PATH; otherwise
815
+ * fall back to the lockfile-detected PM.
816
+ * - explicit name: always use that PM. Errors when the named
817
+ * binary is missing rather than silently falling back.
818
+ * @default "auto"
819
+ */
820
+ backend?: "aube" | "auto" | "bun" | "npm" | "pnpm" | "yarn";
821
+ /**
822
+ * Whether to dispatch PM invocations through `corepack`.
823
+ * - `"auto"` (default): use corepack only when the workspace
824
+ * pins a PM via the `packageManager` field AND `corepack` is
825
+ * on PATH AND the PM is one corepack manages (pnpm/yarn/npm).
826
+ * - `true`: always prefix `corepack` when the binary is on PATH
827
+ * and the PM is corepack-managed (errors loudly otherwise).
828
+ * - `false`: never go through corepack — invoke the PM directly.
829
+ *
830
+ * Mirrors nypm's `corepack: true` flag. Bun, deno, and aube are
831
+ * never wrapped — corepack does not manage them.
832
+ * @default "auto"
833
+ */
834
+ corepack?: "auto" | boolean;
835
+ };
836
+ /**
837
+ * Named input patterns inherited by every project target. Equivalent
838
+ * to task-runner's `namedInputs` but configurable from the vis config.
839
+ */
840
+ namedInputs?: NamedInputs;
841
+ /** Package override mappings applied during migration (e.g., `{ "lodash": "lodash-es" }`) */
842
+ overrides?: Record<string, string>;
843
+ /**
844
+ * Plugins — each plugin registers typed hooks that fire at run /
845
+ * task / cache boundaries. See {@link VisPlugin} for the contract.
846
+ * Prefer plugins over per-target shell hooks when behaviour needs
847
+ * access to task metadata, results, or cache state.
848
+ */
849
+ plugins?: VisPlugin[];
850
+ /**
851
+ * Workspace dep-policy lints exposed via `vis lint`. Each block opts in
852
+ * to a single rule; the command flags (`--workspace-protocol`,
853
+ * `--no-redefine-root`, `--banned-deps`) toggle them per-run.
854
+ */
855
+ policy?: {
856
+ /**
857
+ * Map of dep names or globs → reason (or `{ reason, replacement, packages?, paths? }`).
858
+ * Internal/workspace deps are never flagged here; the
859
+ * workspace-protocol lint owns those.
860
+ *
861
+ * Optional `packages` (globs over the declaring package's `name`) and
862
+ * `paths` (globs over the workspace-relative `packageDir`) narrow where
863
+ * the rule applies. With both set, either match is enough. Omit both
864
+ * to ban anywhere — the default.
865
+ * @example
866
+ * ```
867
+ * bannedDeps: {
868
+ * request: "deprecated; use undici",
869
+ * moment: { reason: "huge bundle, frozen upstream", replacement: "date-fns" },
870
+ * "@radix-ui/*": "we standardized on shadcn",
871
+ * react: { reason: "no react in shared libs", paths: ["packages/shared/*"] },
872
+ * "next": { reason: "apps only", packages: ["@app/*"] },
873
+ * }
874
+ * ```
875
+ */
876
+ bannedDeps?: Record<string, string | {
877
+ packages?: string[];
878
+ paths?: string[];
879
+ reason: string;
880
+ replacement?: string;
881
+ }>;
882
+ /**
883
+ * Tweak the custom-types lint that flags drift in `engines.{node,pnpm,...}`,
884
+ * `packageManager`, `volta.{node,pnpm,yarn}`, and the proposed
885
+ * `devEngines.{runtime,packageManager}` array form.
886
+ *
887
+ * Each (customType × name) cluster is tracked independently —
888
+ * `engines.node` and `volta.node` don't cross-couple here. Use a
889
+ * versionGroup once that lands if you need to enforce they agree.
890
+ */
891
+ customTypes?: {
892
+ /**
893
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
894
+ * for the contract — same semantics, applied to drift rewrites
895
+ * across engines / packageManager / volta / devEngines.
896
+ *
897
+ * Note: `--fix` strips any `+sha512.&lt;hash&gt;` suffix from
898
+ * `packageManager` on bump — content-integrity hashes are tied
899
+ * to a specific package, not a version, so users must regenerate
900
+ * via their PM (`pnpm install` re-pins; `corepack use pnpm@X` etc.).
901
+ * @default true
902
+ */
903
+ autofix?: "prompt" | boolean;
904
+ /**
905
+ * User-defined custom-type pin locations. Each entry tells the
906
+ * customTypes lint to read additional version pins from a
907
+ * non-standard JSON path inside every workspace package.json,
908
+ * cluster them by `(name × depName)` like the built-in types,
909
+ * and rewrite them with `--fix`.
910
+ *
911
+ * The original built-ins (`engines`, `volta`, `packageManager`,
912
+ * `devEngines.runtime`, `devEngines.packageManager`) keep
913
+ * running unconditionally — these layer on top.
914
+ *
915
+ * Strategies:
916
+ * - `versionsByName`: the JSON at `path` is `{ [depName]: version }`
917
+ * (like `engines` or `pnpm.overrides`).
918
+ * - `name@version`: the JSON at `path` is a string of the form
919
+ * `name@version` (like `packageManager`). The leading `name@`
920
+ * is preserved; only the version segment is rewritten.
921
+ * - `string`: the JSON at `path` is a bare version string. The
922
+ * `depName` field is required and identifies the dep cluster.
923
+ *
924
+ * `name` must not collide with a built-in type name. `path` is
925
+ * a dot-separated walk into the package.json (e.g. `pnpm.overrides`).
926
+ * @example
927
+ * ```ts
928
+ * extraTypes: [
929
+ * { name: "pnpmOverridesLegacy", path: "pnpm.overrides", strategy: "versionsByName" },
930
+ * { name: "myToolPin", path: "myTool.runtime", strategy: "name@version" },
931
+ * { name: "minNode", path: "config.minNode", strategy: "string", depName: "node" },
932
+ * ]
933
+ * ```
934
+ */
935
+ extraTypes?: ExtraCustomType[];
936
+ /**
937
+ * Dep names exempt from the drift check (exact match against the
938
+ * field name within the block — e.g. `node`, `pnpm`).
939
+ */
940
+ ignore?: string[];
941
+ /**
942
+ * Resolution strategy used when `--fix` runs.
943
+ * - `highest` (default): align every drifting instance to the
944
+ * highest declared version.
945
+ * - `lowest`: align to the lowest.
946
+ * @default "highest"
947
+ */
948
+ resolve?: "highest" | "lowest";
949
+ };
950
+ /**
951
+ * Tweak the dead-workspace-patterns lint that flags entries in
952
+ * `pnpm-workspace.yaml#packages` / `package.json#workspaces` which
953
+ * resolve to zero on-disk directories.
954
+ */
955
+ deadWorkspacePatterns?: {
956
+ /**
957
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
958
+ * for the contract — applied here to dropping unmatched patterns
959
+ * from the workspace config file.
960
+ * @default true
961
+ */
962
+ autofix?: "prompt" | boolean;
963
+ };
964
+ /**
965
+ * Tweak the empty-deps lint that flags empty `dependencies` /
966
+ * `devDependencies` / `peerDependencies` / `optionalDependencies`
967
+ * blocks across the workspace.
968
+ */
969
+ emptyDeps?: {
970
+ /**
971
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
972
+ * for the contract — applied here to removing the empty key.
973
+ * @default true
974
+ */
975
+ autofix?: "prompt" | boolean;
976
+ /**
977
+ * Block names exempt from the rule (e.g. `["peerDependencies"]`
978
+ * to keep the key around as a marker even when empty).
979
+ */
980
+ ignoreBlocks?: ("dependencies" | "devDependencies" | "optionalDependencies" | "peerDependencies")[];
981
+ };
982
+ /**
983
+ * Tweak the redefine-root lint that flags non-root packages duplicating
984
+ * deps already pinned at the workspace root.
985
+ */
986
+ redefineRoot?: {
987
+ /** Dep names that are exempt from the redefine-root rule (exact match). */
988
+ ignore?: string[];
989
+ };
990
+ /**
991
+ * Tweak the root-deps lint that flags runtime `dependencies` declared
992
+ * on the private workspace root (they should live in `devDependencies`).
993
+ */
994
+ rootDeps?: {
995
+ /**
996
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
997
+ * for the contract — applied here to moving entries from
998
+ * `dependencies` to `devDependencies` on the root package.json.
999
+ * @default true
1000
+ */
1001
+ autofix?: "prompt" | boolean;
1002
+ };
1003
+ /**
1004
+ * Tweak the root-package-manager lint that flags a missing or
1005
+ * malformed `packageManager` field on the workspace root.
1006
+ */
1007
+ rootPackageManager?: {
1008
+ /**
1009
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1010
+ * for the contract. `--fix` only writes when `suggested` is set —
1011
+ * a missing `packageManager` field has no canonical default.
1012
+ * @default true
1013
+ */
1014
+ autofix?: "prompt" | boolean;
1015
+ /**
1016
+ * Canonical specifier (`name@version`) to write when `--fix` runs
1017
+ * and the field is absent. Required to enable autofix —
1018
+ * vis won't guess the workspace's preferred manager.
1019
+ * @example "pnpm@10.32.1"
1020
+ */
1021
+ suggested?: string;
1022
+ };
1023
+ /**
1024
+ * Tweak the root-private lint that flags a workspace root package.json
1025
+ * missing `"private": true`. Only fires when the root looks like a
1026
+ * workspace (npm/yarn/bun `workspaces` field or `pnpm-workspace.yaml`).
1027
+ */
1028
+ rootPrivate?: {
1029
+ /**
1030
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1031
+ * for the contract — applied here to inserting `"private": true`.
1032
+ * @default true
1033
+ */
1034
+ autofix?: "prompt" | boolean;
1035
+ };
1036
+ /**
1037
+ * Tweak the similar-deps lint that flags drift across related dep
1038
+ * families (e.g. `react` and `react-dom`, all of `@babel/*`).
1039
+ *
1040
+ * The lint is report-only — aligning a family requires picking a
1041
+ * single canonical specifier across heterogeneous range syntaxes
1042
+ * (`^`, `~`, exact), which is too lossy without user input.
1043
+ */
1044
+ similarDeps?: {
1045
+ /**
1046
+ * Additional families merged with the built-ins. Same `id` wins
1047
+ * → user override fully replaces the built-in entry.
1048
+ * @example
1049
+ * ```
1050
+ * extraFamilies: [
1051
+ * { id: "vue", label: "Vue", members: ["vue", "vue-router", "pinia"] },
1052
+ * ]
1053
+ * ```
1054
+ */
1055
+ extraFamilies?: SimilarDepFamily[];
1056
+ /** Family ids to skip entirely (matches `SimilarDepFamily.id`). */
1057
+ ignoreFamilies?: string[];
1058
+ };
1059
+ /**
1060
+ * Tweak the types-in-deps lint that flags `@types/*` declared in
1061
+ * `dependencies` on a private package (they belong in
1062
+ * `devDependencies` since the package never ships).
1063
+ */
1064
+ typesInDeps?: {
1065
+ /**
1066
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1067
+ * for the contract — applied here to moving the entry to
1068
+ * `devDependencies`. Existing dev pins are preserved on conflict.
1069
+ * @default true
1070
+ */
1071
+ autofix?: "prompt" | boolean;
1072
+ /** Dep names exempt from the rule (exact match, e.g. `@types/node`). */
1073
+ ignore?: string[];
1074
+ };
1075
+ /**
1076
+ * Tweak the workspace-protocol lint that flags internal deps not
1077
+ * using the `workspace:` protocol.
1078
+ */
1079
+ workspaceProtocol?: {
1080
+ /**
1081
+ * Three-state autofix opt-out. Some workspaces want detection
1082
+ * without rewrite (e.g. dual-licensed packages where `workspace:*`
1083
+ * is unsafe).
1084
+ * - `true` (default): `--fix` rewrites the specifier.
1085
+ * - `false`: never rewrite — report the violation only.
1086
+ * - `"prompt"`: ask before each rewrite. Falls back to report-only
1087
+ * when stdin isn't a TTY (CI). Reserved; not yet implemented.
1088
+ *
1089
+ * Note: when `false` (or `"prompt"`), `--fix` still **fails CI** on
1090
+ * detected violations — the rule is "report only", not "ignore".
1091
+ * Drop the rule from the lint selection if you want a clean exit.
1092
+ * @default true
1093
+ * @example
1094
+ * ```
1095
+ * policy: {
1096
+ * workspaceProtocol: { autofix: false },
1097
+ * }
1098
+ * ```
1099
+ */
1100
+ autofix?: "prompt" | boolean;
1101
+ };
1102
+ /**
1103
+ * Tweak the workspace-versions lint that flags external deps declared
1104
+ * at inconsistent versions across the workspace.
1105
+ */
1106
+ workspaceVersions?: {
1107
+ /**
1108
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1109
+ * for the contract — same semantics, applied to drift rewrites.
1110
+ *
1111
+ * Also gates the `--propose-min` catalog suggestion writer:
1112
+ * when `false` / `"prompt"`, `--fix --propose-min` reports the
1113
+ * proposed catalog entries but does not write
1114
+ * `pnpm-workspace.yaml`. Same "report only, still fails CI"
1115
+ * note applies as on `workspaceProtocol.autofix`.
1116
+ * @default true
1117
+ */
1118
+ autofix?: "prompt" | boolean;
1119
+ /** Dep names exempt from the version-drift check (exact match). */
1120
+ ignore?: string[];
1121
+ /**
1122
+ * Resolution strategy used when `--fix` runs.
1123
+ * - `highest` (default): rewrite every drifting instance to the
1124
+ * highest sibling specifier.
1125
+ * - `lowest`: rewrite to the lowest.
1126
+ * - `catalog`: rewrite any dep already pinned in a workspace catalog
1127
+ * to `catalog:` / `catalog:&lt;name>`. Catalog must exist; this lint
1128
+ * does not create the catalog (see `vis lint --resolve catalog --propose`).
1129
+ * @default "highest"
1130
+ */
1131
+ resolve?: "catalog" | "highest" | "lowest";
1132
+ };
1133
+ };
1134
+ /**
1135
+ * Pre-flight checks fired before `vis run` starts the orchestrator.
1136
+ * Each check is opt-out (`false`) — defaults are sensible for the
1137
+ * common monorepo case.
1138
+ */
1139
+ preflight?: {
1140
+ /**
1141
+ * Detect "lockfile changed but `node_modules` is stale" before
1142
+ * running tasks. Compares lockfile mtime against the
1143
+ * package-manager-specific install marker
1144
+ * (`node_modules/.modules.yaml` for pnpm, `.package-lock.json`
1145
+ * for npm, etc.). Warns in TTY, hard-fails in CI.
1146
+ * @default true
1147
+ */
1148
+ lockfile?: boolean;
1149
+ };
1150
+ /**
1151
+ * Default options for `vis secrets`. CLI flags always take precedence;
1152
+ * this block provides workspace-wide defaults so teams can commit config
1153
+ * once and every invocation picks it up.
1154
+ */
1155
+ secrets?: {
1156
+ /** Path to a baseline of previously-triaged findings (relative to workspace root). */
1157
+ baseline?: string;
1158
+ /** Where the ruleset comes from. Omit for the bundled gitleaks default. */
1159
+ config?: {
1160
+ /** Layer the user's rules on top of the bundled ruleset. Default: `true`. */
1161
+ extendBundled?: boolean;
1162
+ /** Inline rule overrides. Wins over `path` when both are set. */
1163
+ inline?: {
1164
+ allowlist?: unknown;
1165
+ allowlists?: unknown[];
1166
+ description?: string;
1167
+ rules?: unknown[];
1168
+ title?: string;
1169
+ };
1170
+ /** Path to a JSON config (gitleaks-compatible). */
1171
+ path?: string;
1172
+ /** Bundled presets layered on top of the default ruleset (e.g. `"weak-passwords"`). */
1173
+ presets?: string[];
1174
+ };
1175
+ /** Redact secret values in findings. */
1176
+ redact?: boolean;
1177
+ /** Rule-id filters applied after scanning. */
1178
+ rules?: {
1179
+ /** Drop findings whose ruleId matches. */
1180
+ exclude?: string[];
1181
+ /** Only report findings whose ruleId matches. */
1182
+ include?: string[];
1183
+ };
1184
+ /** Walker / filesystem traversal. */
1185
+ walk?: {
1186
+ /**
1187
+ * Paths to additional `.gitignore`-syntax files (e.g. `.secretsignore`).
1188
+ */
1189
+ excludeFromFiles?: string[];
1190
+ /**
1191
+ * Gitignore-syntax patterns (supports negation, directory markers, leading `/`).
1192
+ * Applied on top of `.gitignore`.
1193
+ */
1194
+ excludePatterns?: string[];
1195
+ /** Respect `.gitignore`. Default: `true`. */
1196
+ gitignore?: boolean;
1197
+ /** Include hidden (dotfile) entries. Default: `false`. */
1198
+ includeHidden?: boolean;
1199
+ /** Max file size in bytes. Default 10 MiB. */
1200
+ maxFileSize?: number;
1201
+ };
1202
+ };
1203
+ /**
1204
+ * Supply chain security settings.
1205
+ * These settings are inspired by pnpm's security features and are applied
1206
+ * universally across all package managers (pnpm, npm, yarn, bun).
1207
+ *
1208
+ * For pnpm users: these map directly to pnpm-workspace.yaml settings.
1209
+ * For npm/yarn/bun users: vis enforces these at the vis layer since
1210
+ * those package managers lack native support.
1211
+ */
1212
+ security?: {
1213
+ /**
1214
+ * Map of package names/patterns to allow (true) or deny (false) build scripts.
1215
+ * Packages not listed are denied by default.
1216
+ * Equivalent to pnpm's `allowBuilds` setting.
1217
+ * @example
1218
+ * ```
1219
+ * allowBuilds: {
1220
+ * "esbuild": true,
1221
+ * "core-js": false,
1222
+ * "@prisma/client": true,
1223
+ * }
1224
+ * ```
1225
+ */
1226
+ allowBuilds?: Record<string, boolean>;
1227
+ /**
1228
+ * When true, prevents transitive dependencies from using exotic sources
1229
+ * (git repositories, direct tarball URLs). Only direct dependencies may
1230
+ * use such sources. Equivalent to pnpm's `blockExoticSubdeps`.
1231
+ * @default false
1232
+ */
1233
+ blockExoticSubdeps?: boolean;
1234
+ /**
1235
+ * Minimum number of minutes that must pass after a version is published
1236
+ * before vis will allow installation. Reduces risk of installing
1237
+ * compromised packages that are typically discovered within hours.
1238
+ * Equivalent to pnpm's `minimumReleaseAge`.
1239
+ * @default 0
1240
+ * @example 1440 // 24 hours
1241
+ */
1242
+ minimumReleaseAge?: number;
1243
+ /**
1244
+ * Package names/patterns excluded from minimumReleaseAge check.
1245
+ * Equivalent to pnpm's `minimumReleaseAgeExclude`.
1246
+ * @example ["webpack", "react", "@myorg/*"]
1247
+ */
1248
+ minimumReleaseAgeExclude?: string[];
1249
+ /**
1250
+ * Socket.dev security intelligence configuration.
1251
+ * When enabled, vis fetches package security scores, alerts, and report
1252
+ * data from the Socket.dev API during install, update, and check commands.
1253
+ * @see https://socket.dev
1254
+ */
1255
+ socket?: {
1256
+ /**
1257
+ * Packages whose low Socket.dev scores or alerts have been reviewed
1258
+ * and explicitly accepted. These packages skip the confirmation
1259
+ * prompt during `vis add` and show as "acknowledged" in `vis audit`.
1260
+ *
1261
+ * Key format: package name (`"lodash"`), name@version
1262
+ * (`"lodash@4.17.21"`), or glob (`"@myorg/*"`).
1263
+ * Unversioned keys match all versions of that package.
1264
+ * @example
1265
+ * ```
1266
+ * acceptedRisks: {
1267
+ * "some-risky-pkg": {
1268
+ * reason: "Internal fork, low score expected",
1269
+ * acceptedAt: "2026-03-15T10:00:00Z",
1270
+ * acceptedScore: 0.25,
1271
+ * },
1272
+ * }
1273
+ * ```
1274
+ */
1275
+ acceptedRisks?: Record<string, {
1276
+ /** ISO 8601 timestamp when the risk was accepted. */
1277
+ acceptedAt: string;
1278
+ /** The overall Socket.dev score at the time of acceptance. */
1279
+ acceptedScore: number;
1280
+ /** User-provided reason for accepting the risk. */
1281
+ reason: string;
1282
+ }>;
1283
+ /**
1284
+ * Custom Socket.dev API token. Falls back to the public API token.
1285
+ * Set via VIS_SOCKET_TOKEN environment variable or here.
1286
+ */
1287
+ apiToken?: string;
1288
+ /**
1289
+ * Cache TTL in milliseconds for Socket.dev reports.
1290
+ * @default 3_600_000 (1 hour)
1291
+ */
1292
+ cacheTtlMs?: number;
1293
+ /**
1294
+ * Enable Socket.dev security scanning on install/update/check commands.
1295
+ * @default false
1296
+ */
1297
+ enabled?: boolean;
1298
+ /**
1299
+ * Minimum overall Socket.dev score (0–1) for a package to be
1300
+ * accepted without a confirmation prompt during `vis add`.
1301
+ * Packages scoring below this threshold trigger an interactive
1302
+ * prompt asking the user to confirm. Set to 0 to disable.
1303
+ * @default 0.4
1304
+ */
1305
+ minimumScore?: number;
1306
+ /**
1307
+ * Request timeout in milliseconds for the Socket.dev API.
1308
+ * @default 15_000 (15 seconds)
1309
+ */
1310
+ timeoutMs?: number;
1311
+ };
1312
+ /**
1313
+ * When true, installation will fail (exit non-zero) if any dependencies
1314
+ * have unreviewed build scripts. Equivalent to pnpm's `strictDepBuilds`.
1315
+ * @default false
1316
+ */
1317
+ strictDepBuilds?: boolean;
1318
+ /**
1319
+ * Trust level checking for package publishing.
1320
+ * - "off": No trust checking (default)
1321
+ * - "no-downgrade": Fail if a package's trust level has decreased
1322
+ * compared to previous releases (e.g., was published by trusted
1323
+ * publisher, now only has provenance).
1324
+ * Equivalent to pnpm's `trustPolicy`.
1325
+ * @default "off"
1326
+ */
1327
+ trustPolicy?: "no-downgrade" | "off";
1328
+ /**
1329
+ * Package selectors excluded from trust policy checks.
1330
+ * Equivalent to pnpm's `trustPolicyExclude`.
1331
+ * @example ["chokidar@4.0.3", "@babel/core@7.28.5"]
1332
+ */
1333
+ trustPolicyExclude?: string[];
1334
+ /**
1335
+ * Ignore the trust policy check for packages published more than
1336
+ * the specified number of minutes ago. Useful for older packages
1337
+ * that pre-date provenance support.
1338
+ * Equivalent to pnpm's `trustPolicyIgnoreAfter` (10.27+).
1339
+ * @example 43200 // 30 days
1340
+ */
1341
+ trustPolicyIgnoreAfter?: number;
1342
+ /**
1343
+ * Package names to skip during typosquat detection.
1344
+ * Use this for internal packages or known-safe names that happen to
1345
+ * look similar to popular packages.
1346
+ * @example ["my-internal-axois", "@myorg/recat"]
1347
+ */
1348
+ typosquatAllowlist?: string[];
1349
+ };
1350
+ /**
1351
+ * Share the cache between sibling git worktrees. When the workspace is a
1352
+ * linked worktree (created with `git worktree add`), the cache root is
1353
+ * relocated from `&lt;linkedRoot>/.task-runner-cache` to the *main*
1354
+ * worktree's `.task-runner-cache`. Multiple parallel agents working in
1355
+ * sibling worktrees then share a single cache instead of rebuilding the
1356
+ * same hash N times.
1357
+ *
1358
+ * Single-checkout repos (where `.git` is a directory) are unaffected.
1359
+ *
1360
+ * Set to `false` to opt out — useful when worktrees deliberately need
1361
+ * independent caches, e.g. for hermetic experiments.
1362
+ * @default true
1363
+ */
1364
+ sharedWorktreeCache?: boolean;
1365
+ /** sort-package-json command defaults */
1366
+ sortPackageJson?: {
1367
+ /** Discover `.editorconfig` for indent / line-ending defaults (default: true). */
1368
+ editorconfig?: boolean;
1369
+ /** Collapse `bugs: { url }` to the bare string form when `url` is the only field (default: true). */
1370
+ formatBugs?: boolean;
1371
+ /** Collapse `repository: { type, url }` to the GitHub `owner/repo` shorthand (default: true). */
1372
+ formatRepository?: boolean;
1373
+ /** Sort `exports` condition keys in canonical order (default: true). */
1374
+ sortExports?: boolean;
1375
+ /** Alphabetize script commands (default: false) */
1376
+ sortScripts?: boolean;
1377
+ };
1378
+ /**
1379
+ * Sponsorship notice shown after successful commands.
1380
+ *
1381
+ * vis prints a one-line "consider sponsoring visulima" notice at most
1382
+ * once every 14 days (skipped in CI, non-TTY, and when
1383
+ * `VIS_NO_SPONSOR=1` is set). Set `enabled: false` to silence it
1384
+ * permanently for this workspace.
1385
+ * @example
1386
+ * ```
1387
+ * sponsor: { enabled: false }
1388
+ * ```
1389
+ */
1390
+ sponsor?: {
1391
+ /**
1392
+ * Show the sponsor notice on successful command completion.
1393
+ * @default true
1394
+ */
1395
+ enabled?: boolean;
1396
+ };
1397
+ /**
1398
+ * Staged file patterns and commands (replaces lint-staged).
1399
+ *
1400
+ * Accepts all lint-staged config forms:
1401
+ * - `string` or `string[]` commands
1402
+ * - Sync/async functions returning `string | string[]`
1403
+ * - `{ title, task }` objects for named side-effect tasks
1404
+ * - Mixed arrays of strings and functions
1405
+ * - A top-level generate-task function
1406
+ */
1407
+ staged?: StagedConfig;
1408
+ /**
1409
+ * When `true`, every task command is scanned for `${VAR}` / `$VAR`
1410
+ * references before spawn. If a referenced var is unset in the
1411
+ * task's effective env (envFile + service env + per-task `env` +
1412
+ * `process.env`), the task fails with an actionable error
1413
+ * naming the missing variable, instead of letting the shell
1414
+ * silently substitute an empty string.
1415
+ *
1416
+ * Override per run with `--strict-env` / `--no-strict-env`.
1417
+ * Override per target with `options.strictEnv`.
1418
+ * @default false
1419
+ */
1420
+ strictEnv?: boolean;
1421
+ /** Target default configurations */
1422
+ targetDefaults?: Record<string, Partial<VisTargetConfiguration>>;
1423
+ /**
1424
+ * Cascading task-default blocks. Each block may scope its targets to a
1425
+ * subset of projects via `scope`. Blocks are evaluated in order; later
1426
+ * blocks override earlier ones when the same field is set.
1427
+ *
1428
+ * Scope matching is additive — if `scope` is omitted, the block applies
1429
+ * to every project.
1430
+ * @example
1431
+ * ```
1432
+ * taskDefaults: [
1433
+ * { scope: { tags: ["frontend"] }, targets: { build: { cache: true } } },
1434
+ * { scope: { projectType: "library" }, targets: { lint: { cache: true } } },
1435
+ * ]
1436
+ * ```
1437
+ */
1438
+ taskDefaults?: TaskDefaultsBlock[];
1439
+ /**
1440
+ * Named bundles of target dependencies, referenceable from any task's
1441
+ * `dependsOn`. `dependsOn: [{ group: "lint" }]` expands to every entry
1442
+ * in the named group; nested groups are resolved recursively and a
1443
+ * cycle raises during discovery.
1444
+ */
1445
+ taskGroups?: Record<string, (string | {
1446
+ dependencies?: boolean;
1447
+ projects?: string | string[];
1448
+ target: string;
1449
+ } | {
1450
+ group: string;
1451
+ })[]>;
1452
+ /**
1453
+ * Task runner options forwarded verbatim to `defaultTaskRunner`.
1454
+ *
1455
+ * Includes `remoteCache` (HTTP or REAPI gRPC backend), `cacheDirectory`,
1456
+ * `parallel`, `globalEnv`, `globalInputs`, `targetDefaults`, etc.
1457
+ * See `TaskRunnerOptions` for the full surface.
1458
+ */
1459
+ taskRunnerOptions?: Partial<TaskRunnerOptions>;
1460
+ /**
1461
+ * Toolchain (Node / pnpm / python / rust / ...) management. vis
1462
+ * delegates to whichever version manager (proto, mise, fnm, volta,
1463
+ * asdf, nvm, corepack) the developer already has — it does not ship
1464
+ * its own.
1465
+ *
1466
+ * Re-exported from `./toolchain` so the public config type stays
1467
+ * in lockstep with the resolver implementation. `self-activate` is
1468
+ * narrowed out of `preferredManager` here — it's auto-resolved for
1469
+ * pnpm/yarn `packageManager` pins and isn't meaningful as an
1470
+ * override.
1471
+ */
1472
+ toolchain?: Omit<ToolchainConfig, "preferredManager"> & {
1473
+ readonly preferredManager?: Exclude<VersionManagerName, "self-activate">;
1474
+ };
1475
+ /** Terminal UI configuration */
1476
+ tui?: {
1477
+ /**
1478
+ * Auto-exit the TUI after tasks complete.
1479
+ * - `false`: Stay open until the user presses `q` (default)
1480
+ * - `true`: Show quit dialog with 3-second countdown after completion
1481
+ * - `number`: Show quit dialog with custom countdown in seconds
1482
+ */
1483
+ autoExit?: boolean | number;
1484
+ };
1485
+ /** Update command defaults */
1486
+ update?: {
1487
+ /**
1488
+ * Dependency fields to scan for outdated packages.
1489
+ * Beyond the standard fields, supports:
1490
+ * - `"overrides"` (npm)
1491
+ * - `"resolutions"` (yarn)
1492
+ * - `"pnpm.overrides"`
1493
+ * @default ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]
1494
+ */
1495
+ depFields?: string[];
1496
+ exclude?: string[];
1497
+ format?: "json" | "minimal" | "table";
1498
+ /**
1499
+ * Package names or glob patterns to permanently ignore during updates.
1500
+ * Ignored packages are skipped and listed in the output so you know
1501
+ * they were not checked.
1502
+ * @example ["eslint", "@types/*"]
1503
+ */
1504
+ ignore?: string[];
1505
+ include?: string[];
1506
+ /**
1507
+ * Include packages with pinned/exact versions (no `^` or `~` prefix).
1508
+ * By default, pinned versions are skipped during update checks.
1509
+ * @default false
1510
+ */
1511
+ includeLocked?: boolean;
1512
+ install?: boolean;
1513
+ /**
1514
+ * Maximum number of concurrent registry requests during outdated checks.
1515
+ * Higher values speed up large workspaces but risk hitting registry rate
1516
+ * limits or self-hosted Verdaccio caps.
1517
+ * @default 8
1518
+ */
1519
+ maxConcurrentRequests?: number;
1520
+ /**
1521
+ * Minimum number of minutes since a version was published before
1522
+ * vis will consider it for updates. This mirrors pnpm's
1523
+ * `minimumReleaseAge` — a single setting that applies to both
1524
+ * install and update.
1525
+ *
1526
+ * Not set by default. If your package manager config
1527
+ * (`pnpm-workspace.yaml`) has `minimumReleaseAge`, vis will
1528
+ * read it from there as a fallback.
1529
+ * @example 1440 // 24 hours
1530
+ */
1531
+ minimumReleaseAge?: number;
1532
+ /**
1533
+ * Package names/patterns excluded from the minimumReleaseAge check.
1534
+ * @example ["webpack", "@myorg/*"]
1535
+ */
1536
+ minimumReleaseAgeExclude?: string[];
1537
+ /**
1538
+ * Per-package or per-pattern update target overrides.
1539
+ * Keys are exact package names, glob patterns, or regex patterns
1540
+ * wrapped in `/` (e.g., `/^@vue/`).
1541
+ * Values are `"latest"`, `"minor"`, or `"patch"`.
1542
+ * @example { "typescript": "minor", "/^@vue/": "patch" }
1543
+ */
1544
+ packageMode?: Record<string, "latest" | "minor" | "patch">;
1545
+ prerelease?: boolean;
1546
+ /**
1547
+ * Which release channels to consider when picking the target version.
1548
+ * - `"stable"` (default) — only ship stable releases (no prereleases).
1549
+ * - `"same"` — match the prerelease channel of the *current* range:
1550
+ * if you're on `react@19.0.0-rc.1`, only `rc.*` candidates qualify;
1551
+ * if you're on a stable, only stable candidates. Prevents
1552
+ * accidentally promoting a prerelease pin to a stable major bump.
1553
+ * - `"any"` — equivalent to `--prerelease`. Any channel is fair game.
1554
+ *
1555
+ * `--release-channel` on the CLI overrides this. If `prerelease: true`
1556
+ * is set without `releaseChannel`, vis treats it as `"any"`.
1557
+ * @default "stable"
1558
+ */
1559
+ releaseChannel?: "any" | "same" | "stable";
1560
+ security?: boolean;
1561
+ target?: "latest" | "minor" | "patch";
1562
+ };
1563
+ /**
1564
+ * Minimum vis CLI version required by this workspace. When the
1565
+ * running vis binary is older than this constraint, vis exits with
1566
+ * an actionable error before executing any command.
1567
+ *
1568
+ * Accepts a semver range string (e.g. `">=1.0.0"`, `"^1.2.0"`).
1569
+ * @example ">=1.0.0"
1570
+ */
1571
+ versionConstraint?: string;
1572
+ }
1573
+ interface OtelPluginOptions {
1574
+ /**
1575
+ * Rename incoming `project:target` IDs before they become OTel
1576
+ * span names. Defaults to passing the id through unchanged.
1577
+ */
1578
+ renameSpan?: (task: Task) => string;
1579
+ /** Tracer used to emit spans. Pass the one from `@opentelemetry/api`'s `trace.getTracer("vis")`. */
1580
+ tracer: Tracer;
1581
+ }
1582
+ /**
1583
+ * Reference plugin that maps vis hook lifecycle events to OTel spans.
1584
+ *
1585
+ * Emits:
1586
+ * - one **root span** named `vis.run` spanning `run:before` → `run:after`
1587
+ * - one **child span** per task spanning `task:before` → `task:after`
1588
+ * with attributes `vis.task.id`, `vis.task.project`, `vis.task.target`,
1589
+ * `vis.task.cache_status`, `vis.task.exit_code`
1590
+ * - `task:failure` sets span status to ERROR and records the exit code
1591
+ *
1592
+ * Streaming stdout/stderr events are intentionally **not** emitted as
1593
+ * span events — high-frequency chunks would blow up OTel backends. Use
1594
+ * a log exporter if you need stream-level visibility.
1595
+ * @example
1596
+ * ```ts
1597
+ * import { trace } from "@opentelemetry/api";
1598
+ * import { defineConfig } from "@visulima/vis/config";
1599
+ * import { otelPlugin } from "@visulima/vis/plugins/otel";
1600
+ *
1601
+ * const tracer = trace.getTracer("vis", "1.0.0");
1602
+ *
1603
+ * export default defineConfig({
1604
+ * plugins: [otelPlugin({ tracer })],
1605
+ * });
1606
+ * ```
1607
+ */
1608
+ declare const otelPlugin: (options: OtelPluginOptions) => VisPlugin;
1609
+ /** Supported config file names, checked in priority order. */
1610
+ declare const CONFIG_FILES: string[];
1611
+ /** Per-package overlay file names, checked in priority order. */
1612
+ declare const TASK_CONFIG_FILES: string[];
1613
+ /**
1614
+ * Secure-by-default security settings based on npm supply chain best practices.
1615
+ *
1616
+ * These defaults are applied automatically when using `defineConfig()` or `loadVisConfig()`.
1617
+ * Users can override any value — their settings always take precedence.
1618
+ * @see https://github.com/lirantal/awesome-npm-security-best-practices
1619
+ */
1620
+ declare const SECURITY_DEFAULTS: Required<Pick<NonNullable<VisConfig["security"]>, "blockExoticSubdeps" | "strictDepBuilds" | "trustPolicy" | "trustPolicyIgnoreAfter">>;
1621
+ /**
1622
+ * Apply secure defaults to a raw config object.
1623
+ * Merges `SECURITY_DEFAULTS` into `config.security`, preserving all user overrides.
1624
+ */
1625
+ declare const applyDefaults: (config: VisConfig) => VisConfig;
1626
+ /**
1627
+ * Find the vis config file in a directory.
1628
+ *
1629
+ * Reads the directory listing once and intersects it with the known
1630
+ * config filenames rather than `stat`-ing each candidate — one syscall
1631
+ * instead of up to six. Priority order is preserved via
1632
+ * `CONFIG_FILES` so `.ts` still wins over `.mjs` when both exist.
1633
+ * @param directory The directory to search in.
1634
+ * @returns The absolute path to the config file, or `undefined` if not found.
1635
+ */
1636
+ declare const findVisConfigFile: (directory: string) => string | undefined;
1637
+ /**
1638
+ * Find the per-package `vis.task.ts` overlay in a project directory.
1639
+ * Same single-readdir lookup pattern as {@link findVisConfigFile}.
1640
+ */
1641
+ declare const findVisTaskConfigFile: (projectDirectory: string) => string | undefined;
1642
+ /**
1643
+ * Load the vis configuration from a `vis.config.ts` (or `.js`, `.mjs`, `.cjs`, `.mts`, `.cts`) file.
1644
+ *
1645
+ * Resolves the entire `extends` chain, post-order, and folds it into a
1646
+ * single merged config (extends first, root last — child wins). The
1647
+ * cache key covers every file in the chain, so editing any extended
1648
+ * file invalidates the cache.
1649
+ *
1650
+ * Falls back to secure defaults if no config file is found.
1651
+ * @param workspaceRoot The workspace root directory to search for the config file.
1652
+ * @param options Optional loader options.
1653
+ * @param options.explicitConfigPath Overrides discovery — used by the
1654
+ * global `--config` flag so users can point at any file regardless of
1655
+ * cwd. The path must exist; otherwise an error is thrown so the
1656
+ * config-loader plugin can surface it to the user.
1657
+ * @returns The loaded and resolved configuration with secure defaults applied.
1658
+ */
1659
+ declare const loadVisConfig: (workspaceRoot: string, options?: {
1660
+ explicitConfigPath?: string;
1661
+ }) => Promise<VisConfig>;
1662
+ /**
1663
+ * Load the per-package `vis.task.ts` overlay for a project, if any.
1664
+ *
1665
+ * Returns `undefined` when no overlay file exists. Otherwise compiles
1666
+ * the file via jiti and caches the result under
1667
+ * `node_modules/.cache/vis/task-configs/&lt;project>.json`, keyed by the
1668
+ * file's content hash. Editing one project's overlay does not invalidate
1669
+ * the root config cache.
1670
+ *
1671
+ * Errors thrown by the file are wrapped in `VisConfigLoadError` so the
1672
+ * source path is reported instead of an opaque workspace.ts failure.
1673
+ * @param workspaceRoot Absolute workspace root path (cache scope).
1674
+ * @param projectDirectory Absolute path of the project to probe.
1675
+ * @param projectName Project identifier — used to scope the cache file.
1676
+ */
1677
+ declare const loadVisTaskConfig: (workspaceRoot: string, projectDirectory: string, projectName: string) => Promise<VisTaskConfig | undefined>;
1678
+ /**
1679
+ * Type-safe helper for defining a per-package `vis.task.ts` overlay.
1680
+ * Pure identity — exists only so users get type inference and
1681
+ * autocomplete from the `VisTaskConfig` shape.
1682
+ * @example
1683
+ * ```typescript
1684
+ * // packages/api/crud/vis.task.ts
1685
+ * import { defineTaskConfig } from "@visulima/vis/config";
1686
+ *
1687
+ * export default defineTaskConfig({
1688
+ * targets: {
1689
+ * build: {
1690
+ * inputs: ["@inherit", "src/proto/**\/*.proto"],
1691
+ * outputs: ["dist/**\/*"],
1692
+ * },
1693
+ * },
1694
+ * });
1695
+ * ```
1696
+ */
1697
+ declare const defineTaskConfig: (config: VisTaskConfig) => VisTaskConfig;
1698
+ /**
1699
+ * Type-safe helper for defining vis configuration.
1700
+ * Provides full TypeScript autocomplete when used in `vis.config.ts`.
1701
+ *
1702
+ * Secure defaults are applied automatically — you only need to specify overrides.
1703
+ * To see the active defaults, run `vis check --security-config`.
1704
+ * @example
1705
+ * ```typescript
1706
+ * // vis.config.ts — minimal config, fully secured by defaults
1707
+ * import { defineConfig } from "@visulima/vis/config";
1708
+ *
1709
+ * export default defineConfig({
1710
+ * security: {
1711
+ * allowBuilds: {
1712
+ * esbuild: true,
1713
+ * "@prisma/client": true,
1714
+ * },
1715
+ * },
1716
+ * });
1717
+ * ```
1718
+ * @example
1719
+ * ```typescript
1720
+ * // vis.config.ts — override a default
1721
+ * import { defineConfig } from "@visulima/vis/config";
1722
+ *
1723
+ * export default defineConfig({
1724
+ * security: {
1725
+ * // Relax cooldown to 24 hours instead of the default 14 days
1726
+ * minimumReleaseAge: 1440,
1727
+ * allowBuilds: { esbuild: true },
1728
+ * },
1729
+ * });
1730
+ * ```
1731
+ */
1732
+ declare const defineConfig: (config: VisConfig) => VisConfig;
1733
+ /**
1734
+ * Type-safe helper for defining a vis plugin. Pure identity — exists
1735
+ * only so plugin authors get inference from the `VisPlugin` contract
1736
+ * without needing a `satisfies` annotation.
1737
+ */
1738
+ declare const definePlugin: (plugin: VisPlugin) => VisPlugin;
1739
+ export { CONFIG_FILES, type OtelPluginOptions, SECURITY_DEFAULTS, TASK_CONFIG_FILES, type VisConfig, type VisHooks, type VisPlugin, type VisTaskConfig, applyDefaults, defineConfig, definePlugin, defineTaskConfig, findVisConfigFile, findVisTaskConfigFile, loadVisConfig, loadVisTaskConfig, otelPlugin };