@visulima/vis 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (147) hide show
  1. package/CHANGELOG.md +830 -14
  2. package/LICENSE.md +7667 -0
  3. package/README.md +322 -19
  4. package/dist/bin.js +1 -146
  5. package/dist/config/index.d.ts +2795 -0
  6. package/dist/config/index.js +1 -0
  7. package/dist/generate/index.d.ts +157 -0
  8. package/dist/generate/index.js +1 -0
  9. package/dist/packem_chunks/bin.js +1295 -0
  10. package/dist/packem_chunks/config.js +19 -0
  11. package/dist/packem_chunks/doctor-probe.js +2 -0
  12. package/dist/packem_chunks/fix.js +11 -0
  13. package/dist/packem_chunks/handler.js +1 -0
  14. package/dist/packem_chunks/handler10.js +1 -0
  15. package/dist/packem_chunks/handler11.js +5 -0
  16. package/dist/packem_chunks/handler12.js +1 -0
  17. package/dist/packem_chunks/handler13.js +27 -0
  18. package/dist/packem_chunks/handler14.js +5 -0
  19. package/dist/packem_chunks/handler15.js +1 -0
  20. package/dist/packem_chunks/handler16.js +1 -0
  21. package/dist/packem_chunks/handler17.js +1 -0
  22. package/dist/packem_chunks/handler18.js +1 -0
  23. package/dist/packem_chunks/handler19.js +1 -0
  24. package/dist/packem_chunks/handler2.js +2 -0
  25. package/dist/packem_chunks/handler20.js +5 -0
  26. package/dist/packem_chunks/handler21.js +2 -0
  27. package/dist/packem_chunks/handler22.js +2 -0
  28. package/dist/packem_chunks/handler23.js +18 -0
  29. package/dist/packem_chunks/handler24.js +1 -0
  30. package/dist/packem_chunks/handler25.js +1 -0
  31. package/dist/packem_chunks/handler26.js +5 -0
  32. package/dist/packem_chunks/handler27.js +1 -0
  33. package/dist/packem_chunks/handler28.js +3 -0
  34. package/dist/packem_chunks/handler29.js +1 -0
  35. package/dist/packem_chunks/handler3.js +4 -0
  36. package/dist/packem_chunks/handler30.js +7 -0
  37. package/dist/packem_chunks/handler31.js +33 -0
  38. package/dist/packem_chunks/handler32.js +3 -0
  39. package/dist/packem_chunks/handler33.js +1 -0
  40. package/dist/packem_chunks/handler34.js +26 -0
  41. package/dist/packem_chunks/handler35.js +3 -0
  42. package/dist/packem_chunks/handler36.js +7 -0
  43. package/dist/packem_chunks/handler37.js +22 -0
  44. package/dist/packem_chunks/handler38.js +428 -0
  45. package/dist/packem_chunks/handler39.js +6 -0
  46. package/dist/packem_chunks/handler4.js +8 -0
  47. package/dist/packem_chunks/handler40.js +24 -0
  48. package/dist/packem_chunks/handler41.js +10 -0
  49. package/dist/packem_chunks/handler42.js +153 -0
  50. package/dist/packem_chunks/handler43.js +25 -0
  51. package/dist/packem_chunks/handler44.js +24 -0
  52. package/dist/packem_chunks/handler45.js +213 -0
  53. package/dist/packem_chunks/handler46.js +3 -0
  54. package/dist/packem_chunks/handler47.js +27 -0
  55. package/dist/packem_chunks/handler48.js +167 -0
  56. package/dist/packem_chunks/handler49.js +34 -0
  57. package/dist/packem_chunks/handler5.js +1 -0
  58. package/dist/packem_chunks/handler6.js +1 -0
  59. package/dist/packem_chunks/handler7.js +1 -0
  60. package/dist/packem_chunks/handler8.js +1 -0
  61. package/dist/packem_chunks/handler9.js +2 -0
  62. package/dist/packem_chunks/heal-accept.js +10 -0
  63. package/dist/packem_chunks/heal.js +14 -0
  64. package/dist/packem_chunks/help-command.js +18 -0
  65. package/dist/packem_chunks/index.js +7 -0
  66. package/dist/packem_chunks/keys-refresh.js +4 -0
  67. package/dist/packem_chunks/list.js +3 -0
  68. package/dist/packem_chunks/loader.js +1 -0
  69. package/dist/packem_chunks/prune.js +3 -0
  70. package/dist/packem_chunks/run.js +1 -0
  71. package/dist/packem_chunks/status.js +2 -0
  72. package/dist/packem_chunks/sync.js +2 -0
  73. package/dist/packem_chunks/sync2.js +2 -0
  74. package/dist/packem_chunks/tar.js +3 -0
  75. package/dist/packem_chunks/tripwire.js +2 -0
  76. package/dist/packem_shared/advisories-DsynpacV.js +1 -0
  77. package/dist/packem_shared/ai-analysis-uYuTIIXi.js +68 -0
  78. package/dist/packem_shared/ai-cache-DuwHYx2O.js +1 -0
  79. package/dist/packem_shared/ai-fix-DzrA-dVz.js +43 -0
  80. package/dist/packem_shared/applyDefaults-BOVDw1jD.js +1 -0
  81. package/dist/packem_shared/build-scripts-DsWMSWDs.js +1 -0
  82. package/dist/packem_shared/cache-directory-DQak1Vjc.js +1 -0
  83. package/dist/packem_shared/cyclonedx-CiHXuG8M.js +4 -0
  84. package/dist/packem_shared/definePlugin-CWm4Dv_t.js +1 -0
  85. package/dist/packem_shared/dependency-scan-DC3nAFHS.js +1 -0
  86. package/dist/packem_shared/docker-B-CIN_nj.js +60 -0
  87. package/dist/packem_shared/failure-log-C3LEMmkq.js +2 -0
  88. package/dist/packem_shared/flakiness-Dq6K4ymq.js +1 -0
  89. package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
  90. package/dist/packem_shared/glob-MHJQjR39-CQ2GC0b_.js +1 -0
  91. package/dist/packem_shared/index-DH-5hsrC.js +1 -0
  92. package/dist/packem_shared/lifecycle-Dv3nAtoD.js +2 -0
  93. package/dist/packem_shared/lockfile-C5DYMHVq.js +1 -0
  94. package/dist/packem_shared/manifests-B0fMp872.js +1 -0
  95. package/dist/packem_shared/min-release-age-BFozFonQ.js +34 -0
  96. package/dist/packem_shared/native-config-sync-Dvi1g2nQ.js +21 -0
  97. package/dist/packem_shared/otelPlugin-CJR2T_lk.js +1 -0
  98. package/dist/packem_shared/registry-keys-CewRFW0e.js +1 -0
  99. package/dist/packem_shared/resolve-explicit-CC4Kifk5.js +5 -0
  100. package/dist/packem_shared/run-summary-utils-BaBGP3bo.js +1 -0
  101. package/dist/packem_shared/runtime-check-BusAwPb2.js +1 -0
  102. package/dist/packem_shared/scan-progress-CMynp3eA.js +2 -0
  103. package/dist/packem_shared/selectors-B2ISH581.js +3 -0
  104. package/dist/packem_shared/signatures-5ZdjJ2Pu.js +2 -0
  105. package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
  106. package/dist/packem_shared/toolchain-Cc3cwyLP.js +5 -0
  107. package/dist/packem_shared/typosquats-BCeR-sLf.js +1 -0
  108. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +1 -0
  109. package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
  110. package/dist/packem_shared/verify-07kUNTuP.js +1 -0
  111. package/dist/packem_shared/vis-update-app-CFrlJ3mW.js +1 -0
  112. package/dist/packem_shared/xxh3-DrAUNq4n.js +1 -0
  113. package/index.d.ts +358 -0
  114. package/index.js +609 -0
  115. package/package.json +57 -22
  116. package/schemas/project.schema.json +872 -0
  117. package/schemas/vis-config.schema.json +4306 -0
  118. package/skills/vis/SKILL.md +96 -0
  119. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  120. package/templates/buildkite-ci/template.yml +20 -0
  121. package/dist/ai-analysis.d.ts +0 -40
  122. package/dist/ai-cache.d.ts +0 -21
  123. package/dist/bin.d.ts +0 -1
  124. package/dist/catalog.d.ts +0 -110
  125. package/dist/commands/affected.d.ts +0 -3
  126. package/dist/commands/ai.d.ts +0 -3
  127. package/dist/commands/analyze.d.ts +0 -3
  128. package/dist/commands/check.d.ts +0 -3
  129. package/dist/commands/graph.d.ts +0 -3
  130. package/dist/commands/hook/constants.d.ts +0 -8
  131. package/dist/commands/hook/index.d.ts +0 -3
  132. package/dist/commands/hook/install.d.ts +0 -7
  133. package/dist/commands/hook/migrate.d.ts +0 -27
  134. package/dist/commands/hook/uninstall.d.ts +0 -3
  135. package/dist/commands/migrate/constants.d.ts +0 -12
  136. package/dist/commands/migrate/deps.d.ts +0 -32
  137. package/dist/commands/migrate/index.d.ts +0 -3
  138. package/dist/commands/migrate/json.d.ts +0 -20
  139. package/dist/commands/migrate/lint-staged.d.ts +0 -62
  140. package/dist/commands/migrate/types.d.ts +0 -20
  141. package/dist/commands/run.d.ts +0 -3
  142. package/dist/commands/staged.d.ts +0 -3
  143. package/dist/commands/update.d.ts +0 -3
  144. package/dist/config.d.ts +0 -40
  145. package/dist/config.js +0 -1
  146. package/dist/package-manager.d.ts +0 -23
  147. package/dist/workspace.d.ts +0 -58
@@ -0,0 +1,2795 @@
1
+ import { TargetConfiguration, TaskResult, Task, FingerprintContributor, ConstraintsConfig, NamedInputs, TaskRunnerOptions } from '@visulima/task-runner';
2
+ export { type FingerprintContributor } from '@visulima/task-runner';
3
+ import { Hookable } from 'hookable';
4
+ /**
5
+ * One family of upstream-coupled packages.
6
+ *
7
+ * `members` is an exact-match list. `prefixes` accept any dep whose
8
+ * name starts with the prefix — useful for monorepos that ship many
9
+ * subpackages under one scope (e.g. `@babel/`, `@storybook/`,
10
+ * `@nx/`). A family can use either or both; a dep matching either
11
+ * list belongs to the family.
12
+ */
13
+ interface SimilarDepFamily {
14
+ /** Stable id; used in report output and config overrides. */
15
+ id: string;
16
+ /** Pretty label for the report. Defaults to `id` when omitted. */
17
+ label?: string;
18
+ /** Dep names that belong to this family verbatim. */
19
+ members?: string[];
20
+ /** Dep-name prefixes (literal, no glob). Match if `depName.startsWith(prefix)`. */
21
+ prefixes?: string[];
22
+ }
23
+ type VersionManagerName = "asdf" | "corepack" | "fnm" | "mise" | "none" | "nvm" | "proto" | "self-activate" | "volta";
24
+ type RuntimeTool = "bun" | "deno" | "go" | "node" | "npm" | "pnpm" | "python" | "ruby" | "rust" | "yarn";
25
+ interface ToolchainConfig {
26
+ /**
27
+ * When a tool pin doesn't match the running version, try to fix it
28
+ * automatically before `vis run` / `vis ci` proceed. Defaults to
29
+ * `true` when {@link findInstalledManagers} reports at least one
30
+ * installed manager, `false` otherwise.
31
+ *
32
+ * Set to `false` to keep the doctor-style warning behaviour and
33
+ * make users run `vis toolchain install` themselves.
34
+ */
35
+ readonly autoInstall?: boolean;
36
+ /** Explicit manager override, useful in CI. */
37
+ readonly preferredManager?: VersionManagerName;
38
+ /** Overrides for engines/packageManager-derived pins. */
39
+ readonly tools?: Partial<Record<RuntimeTool, string>>;
40
+ }
41
+ /**
42
+ * Custom task form — `{ title, task }` — analogous to lint-staged's
43
+ * listr-style task objects. `task` receives the matched absolute paths
44
+ * and returns a promise that resolves on success or rejects on failure.
45
+ */
46
+ interface CustomTask {
47
+ readonly task: (files: string[]) => unknown;
48
+ readonly title: string;
49
+ }
50
+ /**
51
+ * A task value as authored by the user. Command strings are split into
52
+ * argv and invoked with the matched file paths appended. Arrays run
53
+ * serially. Functions receive the matched paths and return further
54
+ * task values (possibly async). `{ title, task }` objects run `task`
55
+ * directly with no argv construction.
56
+ */
57
+ type StagedTask = CustomTask | StagedTaskFunction | ReadonlyArray<CustomTask | StagedTaskFunction | string> | string | ReadonlyArray<string>;
58
+ type StagedTaskFunction = (files: string[]) => Promise<StagedTaskResult> | StagedTaskResult;
59
+ type StagedTaskResult = CustomTask | ReadonlyArray<CustomTask | string> | string | ReadonlyArray<string>;
60
+ /**
61
+ * Config object mapping glob patterns (basename or path-style) to tasks.
62
+ * A top-level function form lets the user generate the entire config
63
+ * from the staged file list.
64
+ */
65
+ type StagedConfig = Readonly<Record<string, StagedTask>> | StagedConfigFunction;
66
+ type StagedConfigFunction = (files: string[]) => Promise<Record<string, StagedTask>> | Record<string, StagedTask>;
67
+ /**
68
+ * Configuration block declared on a target to mark it as a long-lived
69
+ * "service" — eligible to be started/stopped via `vis service` and
70
+ * auto-attached when other tasks depend on it.
71
+ *
72
+ * Targets must also carry `preset: "server"` (or the equivalent
73
+ * `persistent: true`) for the service-mode lifecycle to apply.
74
+ */
75
+ interface ServiceConfig {
76
+ /**
77
+ * Env vars to expose to dependent tasks when this service is
78
+ * registered. Merged into the dependent task's env after the task's
79
+ * own envFile and before the task's explicit `env` overrides — the
80
+ * dependent task wins on key collisions.
81
+ *
82
+ * Note: only this `env` map propagates to dependents. The service
83
+ * target's own `envFile` is loaded into the **service process** at
84
+ * start time but is *not* forwarded — dependents must declare any
85
+ * shared values they need either here or in their own envFile. This
86
+ * boundary is intentional: envFiles often contain operator-only
87
+ * secrets (deploy keys, admin tokens) that should not leak into
88
+ * downstream test commands.
89
+ */
90
+ env?: Record<string, string>;
91
+ /**
92
+ * Grace period in milliseconds between SIGTERM and SIGKILL when the
93
+ * service is stopped.
94
+ * @default 5000
95
+ */
96
+ killGracePeriodMs?: number;
97
+ /**
98
+ * Optional port the service listens on. Used as the default for
99
+ * `readiness.tcp.port` when no explicit probe is configured, and
100
+ * surfaced by `vis service list`.
101
+ */
102
+ port?: number;
103
+ /** Readiness probe configuration. v1 supports TCP only. */
104
+ readiness?: {
105
+ tcp: {
106
+ host?: string;
107
+ port: number;
108
+ timeoutMs?: number;
109
+ };
110
+ };
111
+ }
112
+ /**
113
+ * Persisted registry entry. One JSON file per running service in
114
+ * `~/.vis-services/&lt;workspaceHash>/&lt;slug>.json`.
115
+ */
116
+ interface ServiceEntry {
117
+ /** Resolved command actually spawned. Used for stale-PID detection. */
118
+ command: string;
119
+ /** Service config captured at start time. */
120
+ config: ServiceConfig;
121
+ cwd: string;
122
+ /**
123
+ * Env vars to forward to dependents. Resolved at start time —
124
+ * defaults to `config.env`, but a future `--env-from` flag could
125
+ * extend this without touching the registry consumer.
126
+ */
127
+ env: Record<string, string>;
128
+ /** Target id, e.g. `apps/api:db`. */
129
+ id: string;
130
+ /** Absolute path to the captured stdout/stderr log file. */
131
+ logFile: string;
132
+ pid: number;
133
+ /**
134
+ * Filesystem-safe slug of `id`. `apps/api:db` → `apps_api__db`.
135
+ * Used as the entry's filename so registry reads can map slug → entry.
136
+ */
137
+ slug: string;
138
+ /** ISO 8601 timestamp of when the service was started. */
139
+ startedAt: string;
140
+ /**
141
+ * vis version that started this service. Auto-attach refuses entries
142
+ * from a mismatched version — protects against schema drift.
143
+ */
144
+ visVersion: string;
145
+ }
146
+ /**
147
+ * Semantic classification for a target.
148
+ * - `build`: Generates one or more artifacts; cached by default.
149
+ * - `test`: Validation task (lint, typecheck, unit test). Default type.
150
+ * - `run`: One-off or long-running process. Not cached by default.
151
+ */
152
+ type TargetType = "build" | "run" | "test";
153
+ /**
154
+ * Preset bundles of target options.
155
+ * - `server`: Long-running local dev server — caching off, not in CI,
156
+ * interactive, persistent.
157
+ * - `utility`: Short-lived helper — caching off, not in CI.
158
+ */
159
+ type TargetPreset = "server" | "utility";
160
+ /**
161
+ * Controls whether a target runs in CI.
162
+ * - `true` (default): Always run.
163
+ * - `false`: Never run in CI (local-only).
164
+ * - `"affected"`: Only when the project is affected by the current change set.
165
+ * - `"always"`: Always run, even if unaffected.
166
+ */
167
+ type RunInCI = "affected" | "always" | boolean;
168
+ /**
169
+ * Controls how affected files are forwarded to a task.
170
+ * - `false` (default): Do not forward.
171
+ * - `"args"`: Append affected paths as additional command arguments.
172
+ * - `"env"`: Expose them via `VIS_AFFECTED_FILES` environment variable.
173
+ * - `"both"`: Both of the above.
174
+ */
175
+ type AffectedFilesMode = "args" | "both" | "env" | false;
176
+ /**
177
+ * Vis-specific target options that extend the task-runner's
178
+ * base `TargetConfiguration`. These live under `target.options` and are
179
+ * interpreted by vis before handing the task off to task-runner.
180
+ *
181
+ * Conditional execution (`when:`) and finally tasks (`always:`) live at
182
+ * the target top level, not under `options` — they're handled by the
183
+ * task-runner orchestrator. See `@visulima/task-runner`'s `WhenCondition`.
184
+ */
185
+ interface VisTargetOptions {
186
+ /**
187
+ * How to forward affected files to the task process.
188
+ * Only used when invoked via `vis affected &lt;target>`.
189
+ * @default false
190
+ */
191
+ affectedFiles?: AffectedFilesMode;
192
+ /**
193
+ * Load environment variables from dotenv file(s) before running.
194
+ * - `string`: a single file path (relative to project root).
195
+ * - `string[]`: multiple files — later entries override earlier ones,
196
+ * so put more-specific files last (e.g. `[".env", ".env.local"]`).
197
+ * - `true`: auto-cascade in the Next/Vite order:
198
+ * `.env` → `.env.{NODE_ENV}` → `.env.local` → `.env.{NODE_ENV}.local`.
199
+ * Skips `.env.local` when NODE_ENV is `test`, matching Next.js.
200
+ */
201
+ envFile?: boolean | string | string[];
202
+ /**
203
+ * When true, the task is serialized with respect to parallel execution
204
+ * and must be run on the main process (claims stdin). Used for commands
205
+ * that read from the terminal.
206
+ * @default false
207
+ */
208
+ interactive?: boolean;
209
+ /**
210
+ * When true, the task is hidden from CLI listings and can only be invoked
211
+ * as a dependency of another task.
212
+ * @default false
213
+ */
214
+ internal?: boolean;
215
+ /**
216
+ * Milliseconds the timeout watchdog waits between sending SIGTERM
217
+ * and SIGKILL when the `timeout` budget fires. Tasks that ignore
218
+ * SIGTERM (e.g. test runners holding open child processes) get
219
+ * force-killed after this grace window so a stuck task can't outlive
220
+ * its budget.
221
+ *
222
+ * Set to `0` to skip escalation and rely on SIGTERM only.
223
+ * @default 5000
224
+ */
225
+ killGracePeriodMs?: number;
226
+ /**
227
+ * Serializes all tasks that share the same mutex name. Useful for tasks
228
+ * that contend on a shared resource (e.g., a database migration).
229
+ */
230
+ mutex?: string;
231
+ /**
232
+ * Per-target output verbosity. Overrides the global `--output-style`
233
+ * flag for this specific target.
234
+ *
235
+ * - `"normal"` (default): print every task's terminal output
236
+ * - `"quiet"`: only print output when the task fails. Successful
237
+ * and cached tasks contribute their status line and timing, but
238
+ * their captured stdout/stderr is suppressed.
239
+ *
240
+ * Useful when a routinely-noisy task (a linter or test runner with
241
+ * verbose progress output) should stay quiet during green builds
242
+ * but reveal everything when it fails.
243
+ */
244
+ outputStyle?: "normal" | "quiet";
245
+ /**
246
+ * When true, the task is a long-running / never-ending process.
247
+ * Persistent tasks are scheduled last, execute after all cacheable
248
+ * tasks complete, and are never cached.
249
+ * @default false
250
+ */
251
+ persistent?: boolean;
252
+ /**
253
+ * A preset that pre-fills a common bundle of options.
254
+ * User-provided fields always take precedence over the preset.
255
+ */
256
+ preset?: TargetPreset;
257
+ /**
258
+ * Run the task through a pseudo-terminal so color-aware tools
259
+ * (vitest, eslint, biome, …) render as if attached to a real TTY
260
+ * instead of a pipe. Output is captured via task-runner's
261
+ * `TerminalBuffer` so ANSI escapes are normalized into the final
262
+ * rendered state before reaching the reporter.
263
+ *
264
+ * Forces cache to off — PTY output can include timing-dependent
265
+ * frames (spinners) that aren't safe to replay from a cache.
266
+ * @default false
267
+ */
268
+ pty?: boolean;
269
+ /**
270
+ * Number of times to retry the task on failure. Uses an exponential
271
+ * backoff by default (1s, 2s, 4s, ...).
272
+ * @default 0
273
+ */
274
+ retryCount?: number;
275
+ /**
276
+ * Delay between retry attempts in milliseconds, or `"exponential"`
277
+ * for 2^attempt * 1000 ms.
278
+ * @default "exponential"
279
+ */
280
+ retryDelay?: number | "exponential";
281
+ /**
282
+ * When true, the command executes with the workspace root as CWD
283
+ * instead of the project root.
284
+ * @default false
285
+ */
286
+ runFromWorkspaceRoot?: boolean;
287
+ /**
288
+ * Controls whether the task runs in CI environments.
289
+ * @default true
290
+ */
291
+ runInCI?: RunInCI;
292
+ /**
293
+ * Capability tags that gate this task to runners advertising the
294
+ * same tag. The CLI's `--runner-tags=gpu,slow` flag (or
295
+ * `VIS_RUNNER_TAGS` env var) tells vis what the current runner
296
+ * supports; tasks whose `runnerTags` share at least one tag with
297
+ * the runner set are eligible. Untagged tasks (no `runnerTags` or
298
+ * an empty array) are general-purpose and always run.
299
+ *
300
+ * Use this for special-purpose CI lanes — e.g. a GPU runner that
301
+ * should only pick up visual-regression suites, or a nightly job
302
+ * that runs `slow` integration tests. When neither flag nor env
303
+ * is set, the filter is inactive and every task runs.
304
+ */
305
+ runnerTags?: string[];
306
+ /**
307
+ * Marks this target as a long-lived service that can be started via
308
+ * `vis service start &lt;id>` and auto-attached when other tasks declare
309
+ * it in `dependsOn`. Implies persistent + non-cacheable behaviour
310
+ * (set `preset: "server"` to inherit the rest of the bundle).
311
+ *
312
+ * The presence of this block — not `preset: "server"` alone — is
313
+ * what makes a target eligible for the cross-invocation registry.
314
+ * `preset: "server"` without `service` keeps today's in-run-only
315
+ * behaviour.
316
+ */
317
+ service?: ServiceConfig;
318
+ /**
319
+ * Per-target shell override. When set, the command runs through this
320
+ * shell instead of the platform default.
321
+ */
322
+ shell?: string;
323
+ /**
324
+ * Override the workspace `strictEnv` setting for this target. When
325
+ * truthy, the target fails if its command references an env var
326
+ * that resolves to neither the task's effective env nor
327
+ * `process.env`. When `false`, the target opts out of a workspace
328
+ * `strictEnv: true` (e.g. for a one-off command that legitimately
329
+ * tolerates an unset variable).
330
+ * @see VisConfig.strictEnv
331
+ */
332
+ strictEnv?: boolean;
333
+ /**
334
+ * Maximum wall-clock milliseconds a single task run is allowed to
335
+ * take before being killed. `0` / `undefined` means no timeout.
336
+ *
337
+ * When the timeout fires the task is sent SIGTERM and, if it has
338
+ * not exited within `killGracePeriodMs`, SIGKILL. The task exits
339
+ * with a failure status carrying the `[timeout]` marker in
340
+ * `terminalOutput`. Retries count per-attempt, not cumulatively.
341
+ *
342
+ * Use this to prevent runaway tasks from eating CI wall-clock time
343
+ * up to the job-level cutoff.
344
+ */
345
+ timeout?: number;
346
+ /**
347
+ * Per-target unix shell override, used on Linux and macOS.
348
+ * Takes precedence over `shell` on unix-like systems.
349
+ */
350
+ unixShell?: string;
351
+ /**
352
+ * Per-target windows shell override, used on Windows.
353
+ * Takes precedence over `shell` on Windows.
354
+ */
355
+ windowsShell?: string;
356
+ }
357
+ /**
358
+ * An extended target configuration that adds the vis-specific options
359
+ * on top of task-runner's `TargetConfiguration`.
360
+ */
361
+ interface VisTargetConfiguration extends Omit<TargetConfiguration, "options"> {
362
+ /**
363
+ * Alternate names that resolve to this target on the CLI. Useful
364
+ * for shortening long canonical names (`test` ↔ `t`) or for
365
+ * offering migration-friendly aliases when renaming targets.
366
+ * Aliases must be globally unique within the workspace.
367
+ */
368
+ aliases?: string[];
369
+ /**
370
+ * One-line description surfaced by `vis list` and (in future)
371
+ * per-task `--help`. Kept short — longer docs belong in project
372
+ * READMEs or vis.config.ts comments.
373
+ */
374
+ description?: string;
375
+ /**
376
+ * True when the target was synthesized by a Project Crystal-style
377
+ * detector (see {@link ../inference}) rather than declared by a
378
+ * package.json script, project.json, or vis.task.ts file. Surfaced
379
+ * by `vis list --inferred` and used by tooling to distinguish
380
+ * implicit defaults from explicit user intent.
381
+ */
382
+ inferred?: boolean;
383
+ /** Vis-specific target options. */
384
+ options?: VisTargetOptions;
385
+ /** Preset applied before user-specified options. */
386
+ preset?: TargetPreset;
387
+ /**
388
+ * Semantic task type. Affects caching defaults and CI filtering.
389
+ * @default "test"
390
+ */
391
+ type?: TargetType;
392
+ }
393
+ /**
394
+ * Typed hook surface exposed to vis plugins.
395
+ *
396
+ * Plugins subscribe via `hooks.hook(name, handler)` — handlers are
397
+ * awaited sequentially in registration order. Returning a promise
398
+ * delays the next hook firing until it resolves, so plugins can
399
+ * safely perform async setup/teardown.
400
+ *
401
+ * Naming deliberately mirrors vite-task / webpack-style verbs:
402
+ * before/after for boundaries, on&lt;Event> for passive observation.
403
+ */
404
+ interface VisHooks {
405
+ /**
406
+ * Fired after the entire task graph completes (including any
407
+ * failures). `results` maps task ID → {@link TaskResult}.
408
+ */
409
+ "run:after": (results: Map<string, TaskResult>) => Promise<void> | void;
410
+ /**
411
+ * Fired once before any task in the graph starts, after workspace
412
+ * discovery and graph construction. Throwing aborts the run.
413
+ */
414
+ "run:before": (context: {
415
+ tasks: Task[];
416
+ workspaceRoot: string;
417
+ }) => Promise<void> | void;
418
+ /**
419
+ * Fired after `vis run` auto-attaches to one or more registered
420
+ * services. `taskIds` lists the in-graph dependents that consumed
421
+ * the service's `env` block; an empty array means the service was
422
+ * registered but no kept task depended on it.
423
+ */
424
+ "service:attach": (entry: ServiceEntry, taskIds: ReadonlyArray<string>) => Promise<void> | void;
425
+ /**
426
+ * Fired after a service is registered and its readiness probe
427
+ * succeeds. Sourced from both `vis service start` (and `restart`'s
428
+ * post-start phase) and any future programmatic call sites.
429
+ */
430
+ "service:start": (entry: ServiceEntry) => Promise<void> | void;
431
+ /**
432
+ * Fired after a registered service is stopped (SIGTERM/SIGKILL
433
+ * acknowledged, registry entry deleted). Not fired when stop is
434
+ * called against an unknown id — only when there was an alive
435
+ * entry to terminate.
436
+ */
437
+ "service:stop": (entry: ServiceEntry) => Promise<void> | void;
438
+ /**
439
+ * Fired after a task completes (success, failure, or cache hit).
440
+ * Receives the final {@link TaskResult}.
441
+ */
442
+ "task:after": (task: Task, result: TaskResult) => Promise<void> | void;
443
+ /**
444
+ * Fired before each task begins execution — after scheduling, before
445
+ * the executor runs the command. Throwing aborts that single task.
446
+ */
447
+ "task:before": (task: Task) => Promise<void> | void;
448
+ /** Fired when a task hit the local or remote cache. */
449
+ "task:cacheHit": (task: Task, result: TaskResult) => Promise<void> | void;
450
+ /**
451
+ * Fired when auto-fingerprint cache diagnostics reports a miss,
452
+ * carrying the human-readable reason string.
453
+ */
454
+ "task:cacheMiss": (task: Task, reasons: string) => Promise<void> | void;
455
+ /** Fired when a task exits non-zero. */
456
+ "task:failure": (task: Task, result: TaskResult) => Promise<void> | void;
457
+ /**
458
+ * Fired during fingerprint construction, after built-in inputs are
459
+ * gathered and before the hash is sealed. Plugins call
460
+ * `contributor.contribute(key, value)` to mix arbitrary strings
461
+ * into the task hash — the hasher namespaces and sorts contributions
462
+ * deterministically so call order doesn't change the result.
463
+ *
464
+ * Throwing aborts hashing for the offending task and surfaces as a
465
+ * task failure before any cache lookup runs. Use this to guarantee
466
+ * a buggy plugin can't quietly poison cache state.
467
+ */
468
+ "task:fingerprint": (task: Task, contributor: FingerprintContributor) => Promise<void> | void;
469
+ /**
470
+ * Fired right before a failed task is re-spawned by the retry
471
+ * controller. `attempt` is 1-indexed and counts the retry that's
472
+ * about to start (so the original failed run was attempt 0).
473
+ * `prevExitCode` is the failing exit status that triggered the
474
+ * retry (the full TaskResult isn't materialized at the retry
475
+ * boundary — only the per-attempt close event is available).
476
+ *
477
+ * Throwing aborts the retry; the previous failure becomes the final
478
+ * result.
479
+ */
480
+ "task:retry": (task: Task, attempt: number, prevExitCode: number) => Promise<void> | void;
481
+ /**
482
+ * Fired with a stderr chunk as a running task emits it. Plugins
483
+ * that ship logs live (Slack, Datadog) should prefer this over
484
+ * `task:after` so they don't wait for the full buffer.
485
+ */
486
+ "task:stderr": (task: Task, chunk: string) => Promise<void> | void;
487
+ /**
488
+ * Fired with a stdout chunk as a running task emits it. See
489
+ * `task:stderr` for semantics.
490
+ */
491
+ "task:stdout": (task: Task, chunk: string) => Promise<void> | void;
492
+ }
493
+ /**
494
+ * Public plugin contract. Implementations register handlers by
495
+ * returning a partial {@link VisHooks} map from `hooks`, or by
496
+ * mutating the Hookable instance directly via `setup(hooks)` for
497
+ * advanced cases (dynamic registration, removeHook, etc.).
498
+ *
499
+ * Plugins are loaded in the order they appear in `visConfig.plugins`.
500
+ * Handler execution order within a hook follows registration order,
501
+ * so earlier plugins see events first.
502
+ */
503
+ interface VisPlugin {
504
+ /**
505
+ * Declarative handlers — the common shape. One entry per hook
506
+ * name; pass a function or an array of functions (all run serially
507
+ * in order).
508
+ */
509
+ hooks?: Partial<{ [K in keyof VisHooks]: VisHooks[K] | VisHooks[K][] }>;
510
+ /** Plugin name — surfaced in debug logs. */
511
+ name: string;
512
+ /**
513
+ * Imperative setup — receives the shared Hookable instance so the
514
+ * plugin can register hooks conditionally, unregister later, or
515
+ * use advanced APIs like `hookOnce`/`beforeEach`/`afterEach`.
516
+ */
517
+ setup?: (hooks: Hookable<VisHooks>) => Promise<void> | void;
518
+ }
519
+ /**
520
+ * The 8 Socket.dev-style supply-chain policies. Used in `security.policies`
521
+ * and `security.acceptedRisks[*].policies`. Kept as a const tuple so callers
522
+ * can import the runtime array (`POLICY_NAMES`) for iteration without
523
+ * drifting from the union type.
524
+ */
525
+ declare const POLICY_NAMES: readonly ["firstSeen", "installScripts", "license", "malware", "publisherChange", "score", "unexpectedDeps", "vulnerability"];
526
+ type PolicyName = (typeof POLICY_NAMES)[number];
527
+ /**
528
+ * Recognised input sources for the codeowners aggregator.
529
+ *
530
+ * - `project-json` — owners declared on each project's `project.json`.
531
+ * Canonical source; takes precedence over the other two on path conflicts.
532
+ * - `nested-codeowners` — `CODEOWNERS` files placed at arbitrary depth
533
+ * in the workspace tree (excluding the generated root file).
534
+ * - `package-json-maintainers` — fallback that reads each project's
535
+ * `package.json#maintainers` and emits one entry per project root for
536
+ * projects with no `project.json owners`. GitHub handles are extracted
537
+ * from each maintainer's `url` (e.g. `https://github.com/&lt;handle&gt;`).
538
+ */
539
+ type CodeownersSource = "nested-codeowners" | "package-json-maintainers" | "project-json";
540
+ interface CodeownersConfig {
541
+ /** Markers that bracket the generated block when `preserveBlock` is set. */
542
+ blockMarker?: {
543
+ begin: string;
544
+ end: string;
545
+ };
546
+ /** Workspace-level paths that apply outside any project (e.g., `.github/**`). */
547
+ globalPaths?: Record<string, string[]>;
548
+ /** Glob patterns used to discover nested `CODEOWNERS` files. Defaults to `["**\/CODEOWNERS"]`. */
549
+ nestedIncludes?: string[];
550
+ /** Sort order for generated entries — mirrors moon's `orderBy`. */
551
+ orderBy?: "file-source" | "project-id";
552
+ /**
553
+ * When set, the generated content is spliced between
554
+ * {@link CodeownersConfig.blockMarker} markers in the existing file
555
+ * (markers are appended if missing) instead of overwriting the file.
556
+ */
557
+ preserveBlock?: boolean;
558
+ /** Provider determines whether `channel` is emitted (GitHub supports it via comment). */
559
+ provider?: "bitbucket" | "github" | "gitlab" | "other";
560
+ /**
561
+ * Header instruction shown to reviewers. Replaces the default
562
+ * "Update each project's project.json `owners` field…" line. Useful
563
+ * when the canonical regenerate path is a custom script.
564
+ */
565
+ regenerationCommand?: string;
566
+ /** Enabled input sources. Defaults to `["project-json"]`. */
567
+ sources?: CodeownersSource[];
568
+ }
569
+ /**
570
+ * One user-declared customTypes entry. See `policy.customTypes.extraTypes`
571
+ * for the full contract — this is just the row shape.
572
+ */
573
+ interface ExtraCustomType {
574
+ /**
575
+ * Required when `strategy === "string"`. The dep-cluster key the bare
576
+ * version string at `path` should be associated with.
577
+ */
578
+ depName?: string;
579
+ /**
580
+ * Display name for this customType. Used as the cluster key prefix in
581
+ * lint output and JSON. Must not collide with the built-in names.
582
+ */
583
+ name: string;
584
+ /** Dot-separated walk into package.json (e.g. `pnpm.overrides`, `myTool.runtime`). */
585
+ path: string;
586
+ /**
587
+ * How to interpret the JSON found at `path`.
588
+ * - `name@version` — single string `pnpm@9.0.0` (with optional `+sha512.…` hash).
589
+ * - `name~version` — single string `node~20.0.0`, mirrors syncpack's tilde form.
590
+ * - `string` — bare version literal (requires `depName`).
591
+ * - `versionsByName` — `{ name: version }` object such as `engines`.
592
+ */
593
+ strategy: "name@version" | "name~version" | "string" | "versionsByName";
594
+ }
595
+ /**
596
+ * Declared code-owner assignment for a path glob within a project.
597
+ * Mirrors moon's `owners` shape so migrations can round-trip cleanly.
598
+ */
599
+ interface OwnersEntry {
600
+ /** Optional notification channel (e.g. Slack, Teams). */
601
+ channel?: string;
602
+ /** Owner handles (e.g. `@visulima/core-team`). */
603
+ owners: string[];
604
+ /** File/glob pattern relative to the project root. */
605
+ path: string;
606
+ }
607
+ /**
608
+ * Per-project TypeScript overlay loaded from `vis.task.ts`. Adds a
609
+ * dynamic, type-safe layer for target overrides on top of `project.json`,
610
+ * which stays the canonical home for static metadata (`tags`, `layer`,
611
+ * `stack`, `language`, `owners`, `projectType`, `sourceRoot`,
612
+ * `implicitDependencies`).
613
+ *
614
+ * `vis.task.ts` is opt-in. A package without one behaves identically to
615
+ * before its introduction. Targets defined here merge over `project.json`'s
616
+ * `targets` block — see `design-config-layering.md` for the full
617
+ * precedence stack.
618
+ */
619
+ interface VisTaskConfig {
620
+ /** Per-target overrides — same shape as `project.json#targets`. */
621
+ tasks?: Record<string, VisTargetConfiguration>;
622
+ }
623
+ /**
624
+ * Per-project metadata surfaced by `project.json`. Extended beyond the
625
+ * minimal `projectType` / `tags` / `sourceRoot` fields we historically
626
+ * parsed to include targets, owners, and layer/stack classification.
627
+ */
628
+ interface ProjectJson {
629
+ /** Implicit dependencies on other projects. */
630
+ implicitDependencies?: string[];
631
+ /** Primary language — informational and query-able. */
632
+ language?: string;
633
+ /** Project layer, used for constraint inheritance and query filtering. */
634
+ layer?: "application" | "automation" | "configuration" | "library" | "scaffolding" | "tool";
635
+ /** Code owners for paths inside this project. */
636
+ owners?: OwnersEntry[];
637
+ /** Project-level metadata. */
638
+ project?: {
639
+ channel?: string;
640
+ description?: string;
641
+ maintainers?: string[];
642
+ owner?: string;
643
+ title?: string;
644
+ };
645
+ /**
646
+ * Project type — `library`, `application`, `service`, or `tool`.
647
+ *
648
+ * - `library` — reusable code consumed by other workspace projects.
649
+ * - `application` — end-user-facing build target (web app, mobile app).
650
+ * - `service` — long-running HTTP / worker process deployed independently.
651
+ * - `tool` — CLI or developer tooling shipped as an executable.
652
+ */
653
+ projectType?: "application" | "library" | "service" | "tool";
654
+ /** Source root, used for display and language inference. */
655
+ sourceRoot?: string;
656
+ /** Tech stack. */
657
+ stack?: "backend" | "data" | "frontend" | "infrastructure" | "systems";
658
+ /** Filterable tags. */
659
+ tags?: string[];
660
+ /** Vis-style target definitions (merged on top of package.json scripts). */
661
+ targets?: Record<string, VisTargetConfiguration>;
662
+ }
663
+ /**
664
+ * A predicate used by {@link VisConfig.scopedTasks}.
665
+ * All listed constraints must match for the block to apply.
666
+ */
667
+ interface ScopedTasksMatch {
668
+ /** Match on primary language. */
669
+ language?: string | string[];
670
+ /** Match on project layer. */
671
+ layer?: ProjectJson["layer"] | ProjectJson["layer"][];
672
+ /** Match on project type. */
673
+ projectType?: "application" | "library" | "service" | "tool";
674
+ /** Match on project stack. */
675
+ stack?: ProjectJson["stack"] | ProjectJson["stack"][];
676
+ /** Match projects tagged with any of these tags. */
677
+ tags?: string[];
678
+ }
679
+ /**
680
+ * A single scoped-tasks block — a set of task defaults gated by an
681
+ * optional match predicate.
682
+ */
683
+ interface ScopedTasksBlock {
684
+ /** Optional match predicate; if omitted, the block applies universally. */
685
+ match?: ScopedTasksMatch;
686
+ /** Task default configurations, keyed by target name. */
687
+ tasks: Record<string, Partial<VisTargetConfiguration>>;
688
+ }
689
+ interface VisConfig {
690
+ /** AI analysis configuration */
691
+ ai?: {
692
+ /** Cache TTL in milliseconds. Overrides default (1h / 30min for security). */
693
+ cacheTtl?: number;
694
+ /** Override default provider priority. Higher number = preferred. */
695
+ priority?: Record<string, number>;
696
+ /** Use a specific provider instead of auto-detecting (e.g., `"claude"`, `"gemini"`). */
697
+ provider?: string;
698
+ };
699
+ /**
700
+ * Scope the task-runner cache directory by the current git branch.
701
+ * When `true`, caches are stored under `&lt;cacheDir>/branches/&lt;slug>`
702
+ * so `main` and feature branches stop thrashing each other —
703
+ * generated artefacts (schemas, `.d.ts` snapshots) that legitimately
704
+ * differ across branches no longer oscillate the cache contents.
705
+ *
706
+ * Falls back to the unscoped path on detached HEAD, non-git
707
+ * workspaces, or when git isn't available.
708
+ * @default false
709
+ */
710
+ branchScopedCache?: boolean;
711
+ /**
712
+ * Code ownership configuration. Controls how `vis sync codeowners`
713
+ * renders the generated CODEOWNERS file.
714
+ */
715
+ codeowners?: CodeownersConfig;
716
+ /**
717
+ * Project dependency constraints.
718
+ * Enforced after building the project graph, before running tasks.
719
+ */
720
+ constraints?: ConstraintsConfig;
721
+ /**
722
+ * Configuration for the `vis create` scaffolding command.
723
+ * Controls template downloads (via giget), default options, and
724
+ * post-creation behavior.
725
+ */
726
+ create?: {
727
+ /**
728
+ * Authorization token for downloading private repository templates.
729
+ * Passed as Bearer token to the git host API.
730
+ * Can also be set via GIGET_AUTH, GITHUB_TOKEN, or GH_TOKEN environment variables.
731
+ */
732
+ auth?: string;
733
+ /**
734
+ * Default editor to configure after scaffolding.
735
+ * When set, `vis create` automatically generates editor config files.
736
+ * @example "vscode"
737
+ */
738
+ defaultEditor?: "vscode";
739
+ /**
740
+ * Default package manager for new standalone projects.
741
+ * When set, skips the PM selection prompt in interactive mode.
742
+ */
743
+ defaultPm?: "bun" | "npm" | "pnpm" | "yarn";
744
+ /**
745
+ * Default giget provider for `owner/repo` shorthand inputs.
746
+ * @default "github"
747
+ */
748
+ defaultProvider?: "bitbucket" | "github" | "gitlab" | "sourcehut";
749
+ /**
750
+ * Initialize a git repository after scaffolding standalone projects.
751
+ * @default false
752
+ */
753
+ gitInit?: boolean;
754
+ /**
755
+ * Install dependencies automatically after scaffolding.
756
+ * @default true
757
+ */
758
+ install?: boolean;
759
+ /**
760
+ * Prefer locally cached templates over re-downloading.
761
+ * Useful for offline development or slow connections.
762
+ * @default false
763
+ */
764
+ preferOffline?: boolean;
765
+ /**
766
+ * Custom template registry URL.
767
+ * When set, giget checks this registry for template metadata
768
+ * before falling back to direct provider resolution.
769
+ * Set to `false` to disable registry lookup entirely.
770
+ * @see https://github.com/unjs/giget#custom-registry
771
+ */
772
+ registry?: false | string;
773
+ /**
774
+ * Named template aliases for quick access.
775
+ * Maps short names to full giget source strings.
776
+ * @example
777
+ * ```
778
+ * templates: {
779
+ * "react": "github:vitejs/vite/packages/create-vite/template-react-ts",
780
+ * "lib": "github:my-org/lib-template",
781
+ * "internal": "gitlab:company/templates/node-service",
782
+ * }
783
+ * ```
784
+ */
785
+ templates?: Record<string, string>;
786
+ };
787
+ /**
788
+ * Discover `.editorconfig` for indent / line-ending defaults during
789
+ * file transformations (sort-package-json, migrate, hook, pm overrides,
790
+ * workspace catalog rewrites). Per-command flags can still override.
791
+ * @default true
792
+ */
793
+ editorconfig?: boolean;
794
+ /**
795
+ * Inherit configuration from one or more parent configs. Entries are
796
+ * resolved left-to-right (later wins) and the consumer's own values
797
+ * always override anything pulled in from `extends`.
798
+ *
799
+ * Each entry is either:
800
+ * - a relative path (`./shared.config.ts`, `../shared.config.ts`) —
801
+ * resolved against the file declaring `extends`;
802
+ * - an npm package name (`@acme/vis-preset`) — resolved via Node.js
803
+ * module resolution from the consumer file.
804
+ *
805
+ * Absolute paths are rejected — they break across machines and CI.
806
+ * Cycles raise `VisConfigCycleError` during load.
807
+ * @example
808
+ * ```
809
+ * extends: ["@acme/vis-preset", "./shared/security.config.ts"]
810
+ * ```
811
+ */
812
+ extends?: string | string[];
813
+ /**
814
+ * Named file-group patterns, reusable from target `inputs` via the
815
+ * `@filegroup:&lt;name>` token. File groups are resolved relative to each
816
+ * project root at discovery time.
817
+ * @example
818
+ * ```
819
+ * fileGroups: {
820
+ * sources: ["src/**\/*.ts", "!src/**\/*.test.ts"],
821
+ * tests: ["**\/*.test.ts"],
822
+ * }
823
+ * ```
824
+ */
825
+ fileGroups?: Record<string, string[]>;
826
+ /**
827
+ * Configuration for the `vis generate` in-repo scaffolding command.
828
+ * Points at additional template directories beyond the defaults
829
+ * (`.vis/templates/` and `.moon/templates/`).
830
+ */
831
+ generator?: {
832
+ /**
833
+ * Authorization token forwarded to giget when fetching
834
+ * `git://`/`npm://` remote templates. Falls back to
835
+ * `GIGET_AUTH` / `GITHUB_TOKEN` / `GH_TOKEN` env vars.
836
+ */
837
+ auth?: string;
838
+ /**
839
+ * Prefer locally cached remote templates over re-downloading.
840
+ * Overridable per invocation via `--prefer-offline`.
841
+ * @default false
842
+ */
843
+ preferOffline?: boolean;
844
+ /**
845
+ * Extra directories to scan for templates. Each directory is
846
+ * checked for both native templates (`&lt;name>.ts`) and
847
+ * moon-format directories (containing `template.yml`).
848
+ * @example
849
+ * ```
850
+ * generator: {
851
+ * templates: ["./tools/generators", "./packages/scaffolding/templates"],
852
+ * }
853
+ * ```
854
+ */
855
+ templates?: string[];
856
+ };
857
+ /**
858
+ * Auto-create targets from detected config files (Project Crystal-style).
859
+ * Inferred targets sit *below* explicit ones — anything in
860
+ * `package.json#scripts`, `project.json#targets`, or `vis.task.ts`
861
+ * wins per-key, so opting in never overrides existing setups.
862
+ *
863
+ * Built-in detectors and the targets they synthesize:
864
+ *
865
+ * - **App frameworks** — `nuxt` (build/dev/preview/generate),
866
+ * `next` (build/dev/start), `remix` (build/dev/start), `astro`
867
+ * (build/dev), `gatsby` (build/develop/serve), `docusaurus`
868
+ * (build/start/serve).
869
+ * - **Bundlers** — `vite` (build/dev/preview), `rolldown` (build),
870
+ * `tsdown` (build), `tsup` (build), `packem` (build), `rollup`
871
+ * (build), `webpack` (build).
872
+ * - **Docs sites** — `vitepress` (docs:build/docs:dev/docs:preview),
873
+ * `typedoc` (docs).
874
+ * - **Server frameworks** — `nest` (build/start/start:dev).
875
+ * - **Test runners** — `vitest` (test/test:watch), `jest`
876
+ * (test/test:watch), `bun` (test), `playwright` (test:e2e),
877
+ * `cypress` (test:e2e/cypress:open).
878
+ * - **Stories** — `storybook` (storybook/build-storybook).
879
+ * - **Type checking** — `typescript` (typecheck via `tsc --noEmit`).
880
+ * - **Lint / format** — `eslint` (lint), `prettier` (format /
881
+ * format:check), `biome` (lint, format), `oxlint` (lint),
882
+ * `oxfmt` (format / format:check), `stylelint` (lint:css),
883
+ * `knip` (knip).
884
+ * - **Runtimes** — `deno` (test/lint/fmt/check).
885
+ * - **Database tooling** — `prisma` (db:generate/db:migrate/
886
+ * db:push/db:studio), `drizzle` (db:generate/db:migrate/
887
+ * db:push/db:studio).
888
+ * - **Codegen / release** — `graphql-codegen` (codegen),
889
+ * `api-extractor` (api-extract), `changeset` (changeset:version /
890
+ * changeset:publish / changeset:status).
891
+ *
892
+ * Trigger: presence of any matching config file in the project root.
893
+ * Most detectors additionally match when their framework appears in
894
+ * `dependencies` / `devDependencies` / `peerDependencies` /
895
+ * `optionalDependencies` — covering convention-only setups (e.g.
896
+ * vitest with default config). Detectors that intentionally require
897
+ * a config file (because the package frequently appears transitively
898
+ * and a dep-only match would synthesize broken commands): `vite`,
899
+ * `rolldown`, `rollup`, `webpack`, `storybook`, `nest`, `remix`,
900
+ * `vitepress`, `bun`, `deno`, `changeset`.
901
+ *
902
+ * Conflict resolution: detectors are evaluated in registration order
903
+ * (see `BUILT_IN_DETECTORS`) and the first to claim a target name
904
+ * wins. Per-name priorities: `build` → nuxt > next > remix > astro
905
+ * > gatsby > docusaurus > vite > nest > rolldown > tsdown > tsup >
906
+ * packem > rollup > webpack; `test` → vitest > jest > bun > deno;
907
+ * `test:e2e` → playwright > cypress; `lint` → eslint > biome >
908
+ * oxlint > deno; `format` → prettier > biome > oxfmt; `db:*` →
909
+ * prisma > drizzle.
910
+ *
911
+ * Also accepts an object form (`{ vite: false, vitest: true }`) to
912
+ * opt individual detectors in or out by name. Detectors omitted from
913
+ * the object run at their default (enabled). Useful when one
914
+ * detector misfires for a given workspace without disabling the rest.
915
+ * @default false
916
+ */
917
+ inferTargets?: Record<string, boolean> | boolean;
918
+ /**
919
+ * Installer backend selection for `vis install` / `vis add` /
920
+ * `vis remove` / `vis update` / `vis ci`.
921
+ *
922
+ * Lets users opt into [aube](https://github.com/endevco/aube) — a
923
+ * Rust-native package manager that reads/writes pnpm/npm/yarn/bun
924
+ * lockfiles in place — as the default installer, while keeping a
925
+ * single switch to fall back to the conventional PM detected from
926
+ * the lockfile.
927
+ *
928
+ * Resolution precedence (highest first):
929
+ * 1. CLI flag (`--installer &lt;name>` / `--no-aube`)
930
+ * 2. Env var `VIS_INSTALLER`
931
+ * 3. This config field
932
+ * 4. Auto-detect (the default)
933
+ *
934
+ * Aube must be installed separately — `vis` does not bundle it.
935
+ * Install via npm (`@endevco/aube`), `mise use -g aube`, or
936
+ * `brew install endevco/tap/aube`.
937
+ */
938
+ install?: {
939
+ /**
940
+ * Which package manager performs install/add/remove/etc.
941
+ * - `auto` (default): use `aube` when it is on PATH; otherwise
942
+ * fall back to the lockfile-detected PM.
943
+ * - explicit name: always use that PM. Errors when the named
944
+ * binary is missing rather than silently falling back.
945
+ * @default "auto"
946
+ */
947
+ backend?: "aube" | "auto" | "bun" | "npm" | "pnpm" | "yarn";
948
+ /**
949
+ * Whether to dispatch PM invocations through `corepack`.
950
+ * - `"auto"` (default): use corepack only when the workspace
951
+ * pins a PM via the `packageManager` field AND `corepack` is
952
+ * on PATH AND the PM is one corepack manages (pnpm/yarn/npm).
953
+ * - `true`: always prefix `corepack` when the binary is on PATH
954
+ * and the PM is corepack-managed (errors loudly otherwise).
955
+ * - `false`: never go through corepack — invoke the PM directly.
956
+ *
957
+ * Mirrors nypm's `corepack: true` flag. Bun, deno, and aube are
958
+ * never wrapped — corepack does not manage them.
959
+ * @default "auto"
960
+ */
961
+ corepack?: "auto" | boolean;
962
+ };
963
+ /**
964
+ * `vis-mcp` promotion notice shown after successful commands when an
965
+ * AI CLI (Claude Code, Cursor, Windsurf, Continue, Zed, Cline) is
966
+ * installed but `@visulima/vis-mcp` is not wired into its config.
967
+ *
968
+ * Shown at most once every 14 days; skipped in CI, non-TTY shells,
969
+ * during `--help`/`--version`/`ai`/`mcp` invocations, and when
970
+ * `VIS_NO_MCP_PROMOTE=1` is set. Set `enabled: false` to silence
971
+ * permanently for this workspace.
972
+ * @example
973
+ * ```
974
+ * mcpPromote: { enabled: false }
975
+ * ```
976
+ */
977
+ mcpPromote?: {
978
+ /**
979
+ * Show the vis-mcp promotion notice on successful command completion.
980
+ * @default true
981
+ */
982
+ enabled?: boolean;
983
+ };
984
+ /**
985
+ * Named input patterns inherited by every project target. Equivalent
986
+ * to task-runner's `namedInputs` but configurable from the vis config.
987
+ */
988
+ namedInputs?: NamedInputs;
989
+ /** Package override mappings applied during migration (e.g., `{ "lodash": "lodash-es" }`) */
990
+ overrides?: Record<string, string>;
991
+ /**
992
+ * Plugins — each plugin registers typed hooks that fire at run /
993
+ * task / cache boundaries. See {@link VisPlugin} for the contract.
994
+ * Prefer plugins over per-target shell hooks when behaviour needs
995
+ * access to task metadata, results, or cache state.
996
+ */
997
+ plugins?: VisPlugin[];
998
+ /**
999
+ * Workspace dep-policy lints exposed via `vis lint`. Each block opts in
1000
+ * to a single rule; the command flags (`--workspace-protocol`,
1001
+ * `--no-redefine-root`, `--banned-deps`) toggle them per-run.
1002
+ */
1003
+ policy?: {
1004
+ /**
1005
+ * Map of dep names or globs → reason (or `{ reason, replacement, packages?, paths? }`).
1006
+ * Internal/workspace deps are never flagged here; the
1007
+ * workspace-protocol lint owns those.
1008
+ *
1009
+ * Optional `packages` (globs over the declaring package's `name`) and
1010
+ * `paths` (globs over the workspace-relative `packageDir`) narrow where
1011
+ * the rule applies. With both set, either match is enough. Omit both
1012
+ * to ban anywhere — the default.
1013
+ * @example
1014
+ * ```
1015
+ * bannedDeps: {
1016
+ * request: "deprecated; use undici",
1017
+ * moment: { reason: "huge bundle, frozen upstream", replacement: "date-fns" },
1018
+ * "@radix-ui/*": "we standardized on shadcn",
1019
+ * react: { reason: "no react in shared libs", paths: ["packages/shared/*"] },
1020
+ * "next": { reason: "apps only", packages: ["@app/*"] },
1021
+ * }
1022
+ * ```
1023
+ */
1024
+ bannedDeps?: Record<string, string | {
1025
+ packages?: string[];
1026
+ paths?: string[];
1027
+ reason: string;
1028
+ replacement?: string;
1029
+ }>;
1030
+ /**
1031
+ * Tweak the custom-types lint that flags drift in `engines.{node,pnpm,...}`,
1032
+ * `packageManager`, `volta.{node,pnpm,yarn}`, and the proposed
1033
+ * `devEngines.{runtime,packageManager}` array form.
1034
+ *
1035
+ * Each (customType × name) cluster is tracked independently —
1036
+ * `engines.node` and `volta.node` don't cross-couple here. Use a
1037
+ * versionGroup once that lands if you need to enforce they agree.
1038
+ */
1039
+ customTypes?: {
1040
+ /**
1041
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1042
+ * for the contract — same semantics, applied to drift rewrites
1043
+ * across engines / packageManager / volta / devEngines.
1044
+ *
1045
+ * Note: `--fix` strips any `+sha512.&lt;hash&gt;` suffix from
1046
+ * `packageManager` on bump — content-integrity hashes are tied
1047
+ * to a specific package, not a version, so users must regenerate
1048
+ * via their PM (`pnpm install` re-pins; `corepack use pnpm@X` etc.).
1049
+ * @default true
1050
+ */
1051
+ autofix?: "prompt" | boolean;
1052
+ /**
1053
+ * User-defined custom-type pin locations. Each entry tells the
1054
+ * customTypes lint to read additional version pins from a
1055
+ * non-standard JSON path inside every workspace package.json,
1056
+ * cluster them by `(name × depName)` like the built-in types,
1057
+ * and rewrite them with `--fix`.
1058
+ *
1059
+ * The original built-ins (`engines`, `volta`, `packageManager`,
1060
+ * `devEngines.runtime`, `devEngines.packageManager`) keep
1061
+ * running unconditionally — these layer on top.
1062
+ *
1063
+ * Strategies:
1064
+ * - `versionsByName`: the JSON at `path` is `{ [depName]: version }`
1065
+ * (like `engines` or `pnpm.overrides`).
1066
+ * - `name@version`: the JSON at `path` is a string of the form
1067
+ * `name@version` (like `packageManager`). The leading `name@`
1068
+ * is preserved; only the version segment is rewritten.
1069
+ * - `string`: the JSON at `path` is a bare version string. The
1070
+ * `depName` field is required and identifies the dep cluster.
1071
+ *
1072
+ * `name` must not collide with a built-in type name. `path` is
1073
+ * a dot-separated walk into the package.json (e.g. `pnpm.overrides`).
1074
+ * @example
1075
+ * ```ts
1076
+ * extraTypes: [
1077
+ * { name: "pnpmOverridesLegacy", path: "pnpm.overrides", strategy: "versionsByName" },
1078
+ * { name: "myToolPin", path: "myTool.runtime", strategy: "name@version" },
1079
+ * { name: "minNode", path: "config.minNode", strategy: "string", depName: "node" },
1080
+ * ]
1081
+ * ```
1082
+ */
1083
+ extraTypes?: ExtraCustomType[];
1084
+ /**
1085
+ * Dep names exempt from the drift check (exact match against the
1086
+ * field name within the block — e.g. `node`, `pnpm`).
1087
+ */
1088
+ ignore?: string[];
1089
+ /**
1090
+ * Resolution strategy used when `--fix` runs.
1091
+ * - `highest` (default): align every drifting instance to the
1092
+ * highest declared version.
1093
+ * - `lowest`: align to the lowest.
1094
+ * @default "highest"
1095
+ */
1096
+ resolve?: "highest" | "lowest";
1097
+ };
1098
+ /**
1099
+ * Tweak the dead-workspace-patterns lint that flags entries in
1100
+ * `pnpm-workspace.yaml#packages` / `package.json#workspaces` which
1101
+ * resolve to zero on-disk directories.
1102
+ */
1103
+ deadWorkspacePatterns?: {
1104
+ /**
1105
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1106
+ * for the contract — applied here to dropping unmatched patterns
1107
+ * from the workspace config file.
1108
+ * @default true
1109
+ */
1110
+ autofix?: "prompt" | boolean;
1111
+ };
1112
+ /**
1113
+ * Tweak the empty-deps lint that flags empty `dependencies` /
1114
+ * `devDependencies` / `peerDependencies` / `optionalDependencies`
1115
+ * blocks across the workspace.
1116
+ */
1117
+ emptyDeps?: {
1118
+ /**
1119
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1120
+ * for the contract — applied here to removing the empty key.
1121
+ * @default true
1122
+ */
1123
+ autofix?: "prompt" | boolean;
1124
+ /**
1125
+ * Block names exempt from the rule (e.g. `["peerDependencies"]`
1126
+ * to keep the key around as a marker even when empty).
1127
+ */
1128
+ ignoreBlocks?: ("dependencies" | "devDependencies" | "optionalDependencies" | "peerDependencies")[];
1129
+ };
1130
+ /**
1131
+ * Tweak the redefine-root lint that flags non-root packages duplicating
1132
+ * deps already pinned at the workspace root.
1133
+ */
1134
+ redefineRoot?: {
1135
+ /** Dep names that are exempt from the redefine-root rule (exact match). */
1136
+ ignore?: string[];
1137
+ };
1138
+ /**
1139
+ * Tweak the root-deps lint that flags runtime `dependencies` declared
1140
+ * on the private workspace root (they should live in `devDependencies`).
1141
+ */
1142
+ rootDeps?: {
1143
+ /**
1144
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1145
+ * for the contract — applied here to moving entries from
1146
+ * `dependencies` to `devDependencies` on the root package.json.
1147
+ * @default true
1148
+ */
1149
+ autofix?: "prompt" | boolean;
1150
+ };
1151
+ /**
1152
+ * Tweak the root-package-manager lint that flags a missing or
1153
+ * malformed `packageManager` field on the workspace root.
1154
+ */
1155
+ rootPackageManager?: {
1156
+ /**
1157
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1158
+ * for the contract. `--fix` only writes when `suggested` is set —
1159
+ * a missing `packageManager` field has no canonical default.
1160
+ * @default true
1161
+ */
1162
+ autofix?: "prompt" | boolean;
1163
+ /**
1164
+ * Canonical specifier (`name@version`) to write when `--fix` runs
1165
+ * and the field is absent. Required to enable autofix —
1166
+ * vis won't guess the workspace's preferred manager.
1167
+ * @example "pnpm@10.32.1"
1168
+ */
1169
+ suggested?: string;
1170
+ };
1171
+ /**
1172
+ * Tweak the root-private lint that flags a workspace root package.json
1173
+ * missing `"private": true`. Only fires when the root looks like a
1174
+ * workspace (npm/yarn/bun `workspaces` field or `pnpm-workspace.yaml`).
1175
+ */
1176
+ rootPrivate?: {
1177
+ /**
1178
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1179
+ * for the contract — applied here to inserting `"private": true`.
1180
+ * @default true
1181
+ */
1182
+ autofix?: "prompt" | boolean;
1183
+ };
1184
+ /**
1185
+ * Tweak the similar-deps lint that flags drift across related dep
1186
+ * families (e.g. `react` and `react-dom`, all of `@babel/*`).
1187
+ *
1188
+ * The lint is report-only — aligning a family requires picking a
1189
+ * single canonical specifier across heterogeneous range syntaxes
1190
+ * (`^`, `~`, exact), which is too lossy without user input.
1191
+ */
1192
+ similarDeps?: {
1193
+ /**
1194
+ * Additional families merged with the built-ins. Same `id` wins
1195
+ * → user override fully replaces the built-in entry.
1196
+ * @example
1197
+ * ```
1198
+ * extraFamilies: [
1199
+ * { id: "vue", label: "Vue", members: ["vue", "vue-router", "pinia"] },
1200
+ * ]
1201
+ * ```
1202
+ */
1203
+ extraFamilies?: SimilarDepFamily[];
1204
+ /** Family ids to skip entirely (matches `SimilarDepFamily.id`). */
1205
+ ignoreFamilies?: string[];
1206
+ };
1207
+ /**
1208
+ * Tweak the types-in-deps lint that flags `@types/*` declared in
1209
+ * `dependencies` on a private package (they belong in
1210
+ * `devDependencies` since the package never ships).
1211
+ */
1212
+ typesInDeps?: {
1213
+ /**
1214
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1215
+ * for the contract — applied here to moving the entry to
1216
+ * `devDependencies`. Existing dev pins are preserved on conflict.
1217
+ * @default true
1218
+ */
1219
+ autofix?: "prompt" | boolean;
1220
+ /** Dep names exempt from the rule (exact match, e.g. `@types/node`). */
1221
+ ignore?: string[];
1222
+ };
1223
+ /**
1224
+ * Tweak the workspace-protocol lint that flags internal deps not
1225
+ * using the `workspace:` protocol.
1226
+ */
1227
+ workspaceProtocol?: {
1228
+ /**
1229
+ * Three-state autofix opt-out. Some workspaces want detection
1230
+ * without rewrite (e.g. dual-licensed packages where `workspace:*`
1231
+ * is unsafe).
1232
+ * - `true` (default): `--fix` rewrites the specifier.
1233
+ * - `false`: never rewrite — report the violation only.
1234
+ * - `"prompt"`: ask before each rewrite. Falls back to report-only
1235
+ * when stdin isn't a TTY (CI). Reserved; not yet implemented.
1236
+ *
1237
+ * Note: when `false` (or `"prompt"`), `--fix` still **fails CI** on
1238
+ * detected violations — the rule is "report only", not "ignore".
1239
+ * Drop the rule from the lint selection if you want a clean exit.
1240
+ * @default true
1241
+ * @example
1242
+ * ```
1243
+ * policy: {
1244
+ * workspaceProtocol: { autofix: false },
1245
+ * }
1246
+ * ```
1247
+ */
1248
+ autofix?: "prompt" | boolean;
1249
+ };
1250
+ /**
1251
+ * Tweak the workspace-versions lint that flags external deps declared
1252
+ * at inconsistent versions across the workspace.
1253
+ */
1254
+ workspaceVersions?: {
1255
+ /**
1256
+ * Three-state autofix opt-out. See `workspaceProtocol.autofix`
1257
+ * for the contract — same semantics, applied to drift rewrites.
1258
+ *
1259
+ * Also gates the `--propose-min` catalog suggestion writer:
1260
+ * when `false` / `"prompt"`, `--fix --propose-min` reports the
1261
+ * proposed catalog entries but does not write
1262
+ * `pnpm-workspace.yaml`. Same "report only, still fails CI"
1263
+ * note applies as on `workspaceProtocol.autofix`.
1264
+ * @default true
1265
+ */
1266
+ autofix?: "prompt" | boolean;
1267
+ /** Dep names exempt from the version-drift check (exact match). */
1268
+ ignore?: string[];
1269
+ /**
1270
+ * Resolution strategy used when `--fix` runs.
1271
+ * - `highest` (default): rewrite every drifting instance to the
1272
+ * highest sibling specifier.
1273
+ * - `lowest`: rewrite to the lowest.
1274
+ * - `catalog`: rewrite any dep already pinned in a workspace catalog
1275
+ * to `catalog:` / `catalog:&lt;name>`. Catalog must exist; this lint
1276
+ * does not create the catalog (see `vis lint --resolve catalog --propose`).
1277
+ * @default "highest"
1278
+ */
1279
+ resolve?: "catalog" | "highest" | "lowest";
1280
+ };
1281
+ };
1282
+ /**
1283
+ * Pre-flight checks fired before `vis run` starts the orchestrator.
1284
+ * Each check is opt-out (`false`) — defaults are sensible for the
1285
+ * common monorepo case.
1286
+ */
1287
+ preflight?: {
1288
+ /**
1289
+ * Detect "lockfile changed but `node_modules` is stale" before
1290
+ * running tasks. Compares lockfile mtime against the
1291
+ * package-manager-specific install marker
1292
+ * (`node_modules/.modules.yaml` for pnpm, `.package-lock.json`
1293
+ * for npm, etc.). Warns in TTY, hard-fails in CI.
1294
+ * @default true
1295
+ */
1296
+ lockfile?: boolean;
1297
+ };
1298
+ /**
1299
+ * Behavior of `vis run` when invoked tasks declare service dependencies
1300
+ * that aren't running in the workspace registry. CLI `--services=&lt;mode>`
1301
+ * overrides this block.
1302
+ */
1303
+ run?: {
1304
+ /**
1305
+ * Wrap each task's CI log block in collapsible groups so users
1306
+ * can fold/unfold per-task output in the host CI's web UI.
1307
+ * Failed tasks always render expanded so the failure is visible
1308
+ * without an extra click.
1309
+ *
1310
+ * - `auto` (default): pick the format from the detected runner —
1311
+ * `GITHUB_ACTIONS=true` → `github` (`::group::`),
1312
+ * `GITLAB_CI=true` → `gitlab` (`section_start:` ANSI sequences),
1313
+ * `BUILDKITE=true` → `buildkite` (`---` collapsed headers),
1314
+ * `TF_BUILD=True` → `azure` (`##[group]`),
1315
+ * no grouping otherwise.
1316
+ * - `off`: never group (raw separators only — useful when
1317
+ * piping through tools that mangle the directives).
1318
+ * - `azure` / `buildkite` / `github` / `gitlab`: force the format
1319
+ * regardless of detected environment (useful for self-hosted
1320
+ * runners that don't set the standard env vars).
1321
+ *
1322
+ * CircleCI is intentionally not auto-detected: its 2.0+ format
1323
+ * has no inline grouping directive — steps auto-group in the
1324
+ * web UI without any markup from the runner.
1325
+ */
1326
+ ciGrouping?: "auto" | "azure" | "buildkite" | "github" | "gitlab" | "off";
1327
+ /**
1328
+ * One knob controlling auto-start of missing service deps.
1329
+ * - `auto` (default in TTY): pick by task — `dev` → ephemeral,
1330
+ * others → persistent.
1331
+ * - `ephemeral`: services die with the run (no registry entry).
1332
+ * - `persistent`: services persist across runs in the registry.
1333
+ * - `off` (default in CI / non-TTY): print diagnostics and abort.
1334
+ */
1335
+ services?: "auto" | "ephemeral" | "off" | "persistent";
1336
+ };
1337
+ /**
1338
+ * Cascading scoped-task blocks. Each block may narrow its tasks to a
1339
+ * subset of projects via `match`. Blocks are evaluated in order; later
1340
+ * blocks override earlier ones when the same field is set.
1341
+ *
1342
+ * Match predicates are additive — if `match` is omitted, the block applies
1343
+ * to every project.
1344
+ * @example
1345
+ * ```
1346
+ * scopedTasks: [
1347
+ * { match: { tags: ["frontend"] }, tasks: { build: { cache: true } } },
1348
+ * { match: { projectType: "library" }, tasks: { lint: { cache: true } } },
1349
+ * ]
1350
+ * ```
1351
+ */
1352
+ scopedTasks?: ScopedTasksBlock[];
1353
+ /**
1354
+ * Default options for `vis secrets`. CLI flags always take precedence;
1355
+ * this block provides workspace-wide defaults so teams can commit config
1356
+ * once and every invocation picks it up.
1357
+ */
1358
+ secrets?: {
1359
+ /** Path to a baseline of previously-triaged findings (relative to workspace root). */
1360
+ baseline?: string;
1361
+ /** Where the ruleset comes from. Omit for the bundled gitleaks default. */
1362
+ config?: {
1363
+ /** Layer the user's rules on top of the bundled ruleset. Default: `true`. */
1364
+ extendBundled?: boolean;
1365
+ /** Inline rule overrides. Wins over `path` when both are set. */
1366
+ inline?: {
1367
+ allowlist?: unknown;
1368
+ allowlists?: unknown[];
1369
+ description?: string;
1370
+ rules?: unknown[];
1371
+ title?: string;
1372
+ };
1373
+ /** Path to a JSON config (gitleaks-compatible). */
1374
+ path?: string;
1375
+ /** Bundled presets layered on top of the default ruleset (e.g. `"weak-passwords"`). */
1376
+ presets?: string[];
1377
+ };
1378
+ /** Redact secret values in findings. */
1379
+ redact?: boolean;
1380
+ /** Rule-id filters applied after scanning. */
1381
+ rules?: {
1382
+ /** Drop findings whose ruleId matches. */
1383
+ exclude?: string[];
1384
+ /** Only report findings whose ruleId matches. */
1385
+ include?: string[];
1386
+ };
1387
+ /** Walker / filesystem traversal. */
1388
+ walk?: {
1389
+ /**
1390
+ * Paths to additional `.gitignore`-syntax files (e.g. `.secretsignore`).
1391
+ */
1392
+ excludeFromFiles?: string[];
1393
+ /**
1394
+ * Gitignore-syntax patterns (supports negation, directory markers, leading `/`).
1395
+ * Applied on top of `.gitignore`.
1396
+ */
1397
+ excludePatterns?: string[];
1398
+ /** Respect `.gitignore`. Default: `true`. */
1399
+ gitignore?: boolean;
1400
+ /** Include hidden (dotfile) entries. Default: `false`. */
1401
+ includeHidden?: boolean;
1402
+ /** Max file size in bytes. Default 10 MiB. */
1403
+ maxFileSize?: number;
1404
+ };
1405
+ };
1406
+ /**
1407
+ * Supply chain security settings.
1408
+ * These settings are inspired by pnpm's security features and are applied
1409
+ * universally across all package managers (pnpm, npm, yarn, bun).
1410
+ *
1411
+ * For pnpm users: these map directly to pnpm-workspace.yaml settings.
1412
+ * For npm/yarn/bun users: vis enforces these at the vis layer since
1413
+ * those package managers lack native support.
1414
+ */
1415
+ security?: {
1416
+ /**
1417
+ * Packages whose policy findings have been reviewed and explicitly
1418
+ * accepted. Matched against every policy unless `policies` narrows the
1419
+ * scope. Replaces the legacy `security.socket.acceptedRisks` map.
1420
+ *
1421
+ * Key format: package name (`"lodash"`), name@version
1422
+ * (`"lodash@4.17.21"`), or glob (`"@myorg/*"`). Unversioned keys match
1423
+ * all versions of that package.
1424
+ * @example
1425
+ * ```
1426
+ * acceptedRisks: {
1427
+ * "some-risky-pkg": {
1428
+ * reason: "Internal fork, low score expected",
1429
+ * acceptedAt: "2026-03-15T10:00:00Z",
1430
+ * acceptedScore: 0.25,
1431
+ * policies: ["score"],
1432
+ * expiresAt: "2026-12-31",
1433
+ * },
1434
+ * }
1435
+ * ```
1436
+ */
1437
+ acceptedRisks?: Record<string, {
1438
+ /** ISO 8601 timestamp when the risk was accepted. */
1439
+ acceptedAt: string;
1440
+ /**
1441
+ * The overall Socket.dev score at the time of acceptance,
1442
+ * in the range `[0, 1]` (mirrors `policies.score.minimum`).
1443
+ * Only relevant for the `score` policy; ignored elsewhere.
1444
+ */
1445
+ acceptedScore?: number;
1446
+ /**
1447
+ * ISO 8601 date (or datetime). After this point the acceptance
1448
+ * stops applying and vis emits a warning. Leave undefined for
1449
+ * non-expiring entries. Values that fail to parse as a Date
1450
+ * are rejected by the loader rather than silently treated as
1451
+ * "always expired".
1452
+ */
1453
+ expiresAt?: string;
1454
+ /**
1455
+ * Which policies this acceptance covers. When undefined the
1456
+ * acceptance applies to every policy finding on this package.
1457
+ */
1458
+ policies?: PolicyName[];
1459
+ /** User-provided reason for accepting the risk. */
1460
+ reason: string;
1461
+ }>;
1462
+ /**
1463
+ * Map of bin names (or `pkg#bin` qualifiers) blessed for shadowing.
1464
+ * When two installed packages expose the same bin name, vis flags
1465
+ * the collision in `vis security list` and the post-install drift
1466
+ * report — set the bin (or `pkg#bin`) to `true` here to suppress
1467
+ * the warning once you've reviewed the conflict.
1468
+ *
1469
+ * Port of LavaMoat allow-scripts' experimental `allowBins`.
1470
+ * Bare names match any conflicting bin with that name; the
1471
+ * `pkg#bin` form scopes the approval to a single package's bin.
1472
+ * @example
1473
+ * ```
1474
+ * allowBins: {
1475
+ * tsc: true, // bless any 'tsc' bin
1476
+ * "typescript#tsc": true, // bless only typescript's 'tsc'
1477
+ * }
1478
+ * ```
1479
+ */
1480
+ allowBins?: Record<string, boolean>;
1481
+ /**
1482
+ * Offline OSV advisory + `vis audit` configuration.
1483
+ *
1484
+ * Controls `vis audit --offline` and `vis advisories sync` behavior:
1485
+ * - `audit.advisories.source` is the OSV mirror to download from. It
1486
+ * must be `https://` and resolve to a host in `allowedHosts` (or one
1487
+ * of the built-in defaults).
1488
+ * - `audit.offlineByDefault` flips the default of `--offline`.
1489
+ *
1490
+ * Vulnerability severity gating and reachability filtering live under
1491
+ * `policies.vulnerability` (see below).
1492
+ */
1493
+ audit?: {
1494
+ /**
1495
+ * Offline advisory cache settings.
1496
+ */
1497
+ advisories?: {
1498
+ /**
1499
+ * Extra hosts permitted as `audit.advisories.source`. The
1500
+ * built-in allowlist is enforced even if this field is
1501
+ * omitted; entries here add to it.
1502
+ * @example ["mirror.corp.example.com"]
1503
+ */
1504
+ allowedHosts?: string[];
1505
+ /**
1506
+ * Number of hours after `lastSyncIso` before `vis audit`
1507
+ * prints a "your advisory cache may be stale" notice.
1508
+ * `vis audit` never auto-syncs — the user runs
1509
+ * `vis advisories sync` themselves.
1510
+ * @default 24
1511
+ */
1512
+ refreshIntervalHours?: number;
1513
+ /**
1514
+ * OSV mirror base URL (no trailing slash). Defaults to the
1515
+ * public Google Cloud Storage bucket. Override to point at a
1516
+ * corporate mirror; the hostname must appear in `allowedHosts`
1517
+ * (or one of the built-in defaults) and the scheme must be
1518
+ * `https://`.
1519
+ * @default "https://osv-vulnerabilities.storage.googleapis.com"
1520
+ */
1521
+ source?: string;
1522
+ /**
1523
+ * Sigstore signature verification for the OSV dump.
1524
+ * Requires the native binding to be built with the
1525
+ * `verify-signatures` Cargo feature (default in the release
1526
+ * build). Off by default — the upstream OSV bucket does not
1527
+ * ship signatures today.
1528
+ */
1529
+ verify?: {
1530
+ /**
1531
+ * Enable signature verification. The sync flow downloads
1532
+ * `&lt;eco>/all.zip.sig` next to the zip and aborts if it
1533
+ * cannot verify against `expectedIssuer` / `expectedSubject`.
1534
+ * @default false
1535
+ */
1536
+ enabled?: boolean;
1537
+ /** OIDC issuer that signed the bundle. */
1538
+ expectedIssuer?: string;
1539
+ /** OIDC subject (workload identity) that signed the bundle. */
1540
+ expectedSubject?: string;
1541
+ };
1542
+ };
1543
+ /**
1544
+ * Gates for the auto-fix flow (`vis audit --fix` /
1545
+ * `--fix-transitive`). The CLI prompts outside CI; inside CI
1546
+ * the flags refuse to run unless `--yes` is set and, for
1547
+ * transitives, `apply.transitive.enabled = true`.
1548
+ */
1549
+ apply?: {
1550
+ /**
1551
+ * Gates for `vis audit --fix-transitive`. Two-lock: the
1552
+ * CLI requires `--yes` AND this flag set to `true` before
1553
+ * it will rewrite override entries in CI.
1554
+ */
1555
+ transitive?: {
1556
+ /**
1557
+ * When true, allows `--fix-transitive` to run in CI
1558
+ * environments. Defaults to false because rewriting
1559
+ * overrides is a higher blast radius than bumping a
1560
+ * direct dep.
1561
+ * @default false
1562
+ */
1563
+ enabled?: boolean;
1564
+ };
1565
+ };
1566
+ /**
1567
+ * When true, `vis audit` skips network calls and queries the
1568
+ * offline cache. Equivalent to the CLI `--offline` flag.
1569
+ * @default false
1570
+ */
1571
+ offlineByDefault?: boolean;
1572
+ };
1573
+ /**
1574
+ * When true, prevents transitive dependencies from using exotic sources
1575
+ * (git repositories, direct tarball URLs). Only direct dependencies may
1576
+ * use such sources. Equivalent to pnpm's `blockExoticSubdeps`.
1577
+ * @default false
1578
+ */
1579
+ blockExoticSubdeps?: boolean;
1580
+ /**
1581
+ * Pre-install marshall pipeline — packument-derived supply-chain
1582
+ * gates (author, provenance, new-bin, metadata, downloads,
1583
+ * expired-domains, signatures, archived-repo) that run before
1584
+ * `vis add` / `vis install &lt;pkg>` / `vis update &lt;pkg>` hand off to
1585
+ * the underlying package manager. Every entry is optional; omit a
1586
+ * key and the marshall runs with defaults. Set `enabled: false`
1587
+ * on a specific marshall to skip it without touching env vars.
1588
+ */
1589
+ marshalls?: {
1590
+ /** Archived-repo marshall (GitHub repository status). */
1591
+ archivedRepo?: {
1592
+ /** Package names to skip. */
1593
+ allowlist?: string[];
1594
+ /** Default: marshall is on. Set false to disable. */
1595
+ enabled?: boolean;
1596
+ /** GitHub PAT for the API call (5k/hr vs 60/hr). */
1597
+ githubToken?: string;
1598
+ };
1599
+ /** Author / publisher heuristics. */
1600
+ author?: {
1601
+ allowlist?: string[]; /** Days since the publisher's last release before flagging as error. */
1602
+ dormantErrorDays?: number;
1603
+ /** Days since the publisher's last release before flagging as warning. */
1604
+ dormantWarnDays?: number;
1605
+ enabled?: boolean; /** Window for the "new publisher on an established package" check. */
1606
+ newPublisherWindowDays?: number;
1607
+ /** Days since the resolved version was published — error threshold. */
1608
+ recentVersionErrorDays?: number;
1609
+ /** Days since the resolved version was published — warning threshold. */
1610
+ recentVersionWarnDays?: number;
1611
+ };
1612
+ /** Monthly download-count floor. */
1613
+ downloads?: {
1614
+ allowlist?: string[];
1615
+ enabled?: boolean; /** Below this monthly count → error (default: 20). */
1616
+ errorThreshold?: number;
1617
+ /** Below this monthly count → warning (default: 1000). */
1618
+ warnThreshold?: number;
1619
+ };
1620
+ /** Maintainer-email-domain NS lookup. */
1621
+ expiredDomains?: {
1622
+ /** Domains exempted from the check (legacy / internal). */
1623
+ allowDomains?: string[];
1624
+ allowlist?: string[]; /** DNS resolvers to query (default: system). */
1625
+ dnsServers?: string[];
1626
+ enabled?: boolean; /** Per-domain DNS timeout (default: 5000). */
1627
+ timeoutMs?: number;
1628
+ };
1629
+ /** README / license / repository presence checks. */
1630
+ metadata?: {
1631
+ allowlist?: string[]; /** Subset of checks to run. Default: all three. */
1632
+ checks?: ("license" | "readme" | "repo")[];
1633
+ enabled?: boolean;
1634
+ };
1635
+ /** New CLI-bin script introduced in this version. */
1636
+ newBin?: {
1637
+ allowlist?: string[];
1638
+ enabled?: boolean;
1639
+ };
1640
+ /** Provenance regression check. */
1641
+ provenance?: {
1642
+ allowlist?: string[];
1643
+ enabled?: boolean;
1644
+ };
1645
+ /**
1646
+ * ECDSA P-256 verification against npm's signing keys. Disabled
1647
+ * by default because npm coverage still has gaps that produce
1648
+ * noisy warnings on legitimate packages.
1649
+ */
1650
+ signatures?: {
1651
+ allowlist?: string[]; /** Default: marshall is *off*. Set true to enable. */
1652
+ enabled?: boolean;
1653
+ /** Override the keys endpoint (default: npm registry). */
1654
+ keysUrl?: string;
1655
+ /** How to treat an expired-but-known key. Default: "warning". */
1656
+ treatExpiredAs?: "error" | "warning";
1657
+ };
1658
+ };
1659
+ /**
1660
+ * When true, `security.policies.installScripts.allow` keys are matched
1661
+ * as `name@version`. A version bump on an approved package drops it from
1662
+ * the allowlist until the new version is explicitly re-approved (port
1663
+ * of LavaMoat allow-scripts' version-aware policy matcher).
1664
+ *
1665
+ * After a version bump, run `vis approve-builds` or `vis security list`
1666
+ * — both surface a "Version drift" block with the suggested new key
1667
+ * (`old-key → new-key`) so you can update `vis.config.ts` by hand.
1668
+ * @default false
1669
+ */
1670
+ pinVersions?: boolean;
1671
+ /**
1672
+ * Supply-chain policy gates. Each sub-block enables one policy and
1673
+ * configures its behavior. When a sub-block is omitted the policy is
1674
+ * inactive. `acceptedRisks` (above) silences specific packages without
1675
+ * disabling a policy globally.
1676
+ *
1677
+ * The 8 policies are inspired by Socket.dev's classification:
1678
+ * - `malware` — Socket-flagged malicious packages
1679
+ * - `firstSeen` — packages published less than N minutes ago
1680
+ * - `unexpectedDeps` — packages outside an allow-list / baseline
1681
+ * - `publisherChange` — maintainer set changed between installs
1682
+ * - `installScripts` — preinstall/install/postinstall scripts
1683
+ * - `score` — Socket overall score below threshold
1684
+ * - `vulnerability` — OSV vulnerability findings
1685
+ * - `license` — SPDX allow / deny lists
1686
+ */
1687
+ policies?: {
1688
+ /**
1689
+ * Minimum number of minutes that must pass after a version is
1690
+ * published before vis will allow installation. Migrated from
1691
+ * the legacy `security.minimumReleaseAge` field. Equivalent to
1692
+ * pnpm's `minimumReleaseAge`.
1693
+ * @default 0
1694
+ * @example { minutes: 1440, exclude: ["@myorg/*"] } // 24 hours
1695
+ */
1696
+ firstSeen?: {
1697
+ /**
1698
+ * Package names/patterns excluded from the firstSeen check.
1699
+ * Equivalent to pnpm's `minimumReleaseAgeExclude`.
1700
+ * @example ["webpack", "react", "@myorg/*"]
1701
+ */
1702
+ exclude?: string[];
1703
+ /** Minutes after publish before install is allowed. */
1704
+ minutes?: number;
1705
+ };
1706
+ /**
1707
+ * Build-script (pre/install/postinstall/prepare) controls.
1708
+ * Migrated from the legacy `security.allowBuilds` /
1709
+ * `security.strictDepBuilds` fields.
1710
+ * @example { allow: { esbuild: true }, strict: true }
1711
+ */
1712
+ installScripts?: {
1713
+ /**
1714
+ * Map of package names/patterns to allow (true) or deny
1715
+ * (false) build scripts. Packages not listed are denied
1716
+ * by default. Equivalent to pnpm's `allowBuilds`.
1717
+ */
1718
+ allow?: Record<string, boolean>;
1719
+ /**
1720
+ * When true, installation will fail (exit non-zero) if any
1721
+ * dependencies have unreviewed build scripts. Equivalent to
1722
+ * pnpm's `strictDepBuilds`.
1723
+ * @default false
1724
+ */
1725
+ strict?: boolean;
1726
+ };
1727
+ /**
1728
+ * SPDX license allow / deny lists. Deny wins on any sub-license
1729
+ * match in SPDX expressions (`(MIT OR GPL-3.0)` against
1730
+ * `deny: ["GPL-3.0"]` is blocked). Packages with no declared
1731
+ * license are flagged when `allow` is set.
1732
+ * @example
1733
+ * ```
1734
+ * license: {
1735
+ * allow: ["MIT", "Apache-2.0", "BSD-3-Clause"],
1736
+ * deny: ["GPL-3.0", "AGPL-3.0"],
1737
+ * }
1738
+ * ```
1739
+ */
1740
+ license?: {
1741
+ /**
1742
+ * SPDX identifiers that are explicitly permitted. When set,
1743
+ * any package whose declared license is not on this list is
1744
+ * blocked.
1745
+ */
1746
+ allow?: string[];
1747
+ /**
1748
+ * SPDX identifiers that are explicitly forbidden. Always
1749
+ * wins over `allow` when both reference the same identifier.
1750
+ */
1751
+ deny?: string[];
1752
+ };
1753
+ /**
1754
+ * Behavior when the Socket.dev feed flags a package as malicious
1755
+ * (`alerts[].type === "Malware"`).
1756
+ *
1757
+ * The default is cross-field: `{ mode: "block" }` whenever
1758
+ * `security.socket.enabled !== false` (the engine cannot evaluate
1759
+ * malware without Socket data), and `"off"` otherwise. Consumers
1760
+ * resolve this default at evaluation time.
1761
+ */
1762
+ malware?: {
1763
+ /**
1764
+ * - `"block"` — emit a block decision.
1765
+ * - `"warn"` — surface as a warning; do not gate exit code.
1766
+ * - `"off"` — disable the policy entirely.
1767
+ */
1768
+ mode?: "block" | "off" | "warn";
1769
+ };
1770
+ /**
1771
+ * Trust-level checking for package publishing. Migrated from the
1772
+ * legacy `security.trustPolicy*` fields. Equivalent to pnpm's
1773
+ * `trustPolicy`.
1774
+ * @example { mode: "no-downgrade", ignoreAfter: 43200 } // 30 days
1775
+ */
1776
+ publisherChange?: {
1777
+ /**
1778
+ * Package selectors excluded from the check.
1779
+ * Equivalent to pnpm's `trustPolicyExclude`.
1780
+ * @example ["chokidar@4.0.3"]
1781
+ */
1782
+ exclude?: string[];
1783
+ /**
1784
+ * Ignore packages published more than N minutes ago. Useful
1785
+ * for older packages that pre-date provenance support.
1786
+ * Equivalent to pnpm's `trustPolicyIgnoreAfter`.
1787
+ */
1788
+ ignoreAfter?: number;
1789
+ /**
1790
+ * - `"off"` — no trust checking (default).
1791
+ * - `"no-downgrade"` — block when a package's trust level
1792
+ * has decreased compared to previous releases (e.g., was
1793
+ * published by trusted publisher, now only has provenance).
1794
+ */
1795
+ mode?: "no-downgrade" | "off";
1796
+ };
1797
+ /**
1798
+ * Socket.dev overall-score threshold. Packages scoring below
1799
+ * `minimum` trigger a block decision (or interactive prompt
1800
+ * during `vis add`). Migrated from the legacy
1801
+ * `security.socket.minimumScore` field.
1802
+ * @example { minimum: 0.4 }
1803
+ */
1804
+ score?: {
1805
+ /**
1806
+ * Minimum overall Socket.dev score (0–1). Set to 0 to
1807
+ * disable the gate while keeping Socket data fetched.
1808
+ *
1809
+ * Consulted by `vis add`, `audit`, `doctor`, `check`, and
1810
+ * `update`; resolved once in `buildSocketOptions`, then
1811
+ * threaded through every consumer. Falls back to
1812
+ * `DEFAULT_LOW_SCORE_THRESHOLD` (`0.4`) when unset.
1813
+ */
1814
+ minimum?: number;
1815
+ };
1816
+ /**
1817
+ * Net-new transitive dependency detection. Either provide a
1818
+ * static allow-list, a baseline lockfile path (recommended), or
1819
+ * both — the intersection is enforced.
1820
+ * @example { baselineLockfile: "./security/lockfile.baseline.yaml" }
1821
+ */
1822
+ unexpectedDeps?: {
1823
+ /**
1824
+ * Allow-list of dependency names that may appear in the
1825
+ * resolved package set. Glob patterns are supported.
1826
+ * @example ["lodash", "axios", "@myorg/*"]
1827
+ */
1828
+ allow?: string[];
1829
+ /**
1830
+ * Path (absolute or relative to the workspace root) to a
1831
+ * baseline lockfile snapshot. The policy diffs the current
1832
+ * lockfile against this baseline and flags any package that
1833
+ * didn't exist before.
1834
+ * @example "./security/lockfile.baseline.yaml"
1835
+ */
1836
+ baselineLockfile?: string;
1837
+ };
1838
+ /**
1839
+ * OSV vulnerability gating. Migrated from the legacy
1840
+ * `security.audit.failOn` + `security.audit.usage` fields.
1841
+ */
1842
+ vulnerability?: {
1843
+ /**
1844
+ * Severity threshold that makes `vis audit` exit non-zero.
1845
+ * Equivalent to the CLI `--fail-on` flag.
1846
+ * @example "high"
1847
+ */
1848
+ failOn?: "critical" | "high" | "low" | "medium";
1849
+ /**
1850
+ * Reachability filter — only report vulnerabilities in
1851
+ * packages the workspace statically imports.
1852
+ */
1853
+ usage?: {
1854
+ /**
1855
+ * Packages to always treat as reachable even if no
1856
+ * static import is found.
1857
+ * @example ["esbuild", "webpack-cli"]
1858
+ */
1859
+ alwaysAssumeUsed?: string[];
1860
+ /**
1861
+ * Enable the reachability filter by default. Equivalent
1862
+ * to `--usage` on the CLI; `--no-usage` disables.
1863
+ * @default false
1864
+ */
1865
+ enabled?: boolean;
1866
+ };
1867
+ };
1868
+ };
1869
+ /**
1870
+ * Socket.dev data-source configuration. Connection knobs only — score
1871
+ * thresholds and accepted-risk overrides moved to `policies.score` and
1872
+ * `security.acceptedRisks` respectively.
1873
+ * @see https://socket.dev
1874
+ */
1875
+ socket?: {
1876
+ /**
1877
+ * Custom Socket.dev API token. Falls back to the public API token.
1878
+ * Set via VIS_SOCKET_TOKEN environment variable or here.
1879
+ */
1880
+ apiToken?: string;
1881
+ /**
1882
+ * Cache TTL in milliseconds for Socket.dev reports.
1883
+ * @default 3_600_000 (1 hour)
1884
+ */
1885
+ cacheTtlMs?: number;
1886
+ /**
1887
+ * Enable Socket.dev security scanning on install/update/check commands.
1888
+ * @default false
1889
+ */
1890
+ enabled?: boolean;
1891
+ /**
1892
+ * Request timeout in milliseconds for the Socket.dev API.
1893
+ * @default 15_000 (15 seconds)
1894
+ */
1895
+ timeoutMs?: number;
1896
+ };
1897
+ /**
1898
+ * Package names to skip during typosquat detection.
1899
+ * Use this for internal packages or known-safe names that happen to
1900
+ * look similar to popular packages.
1901
+ * @example ["my-internal-axois", "@myorg/recat"]
1902
+ */
1903
+ typosquatAllowlist?: string[];
1904
+ };
1905
+ /**
1906
+ * Share the cache between sibling git worktrees. When the workspace is a
1907
+ * linked worktree (created with `git worktree add`), the cache root is
1908
+ * relocated from `&lt;linkedRoot>/.vis/cache` to the *main*
1909
+ * worktree's `.vis/cache`. Multiple parallel agents working in
1910
+ * sibling worktrees then share a single cache instead of rebuilding the
1911
+ * same hash N times.
1912
+ *
1913
+ * Single-checkout repos (where `.git` is a directory) are unaffected.
1914
+ *
1915
+ * Set to `false` to opt out — useful when worktrees deliberately need
1916
+ * independent caches, e.g. for hermetic experiments.
1917
+ * @default true
1918
+ */
1919
+ sharedWorktreeCache?: boolean;
1920
+ /** sort-package-json command defaults */
1921
+ sortPackageJson?: {
1922
+ /** Discover `.editorconfig` for indent / line-ending defaults (default: true). */
1923
+ editorconfig?: boolean;
1924
+ /** Collapse `bugs: { url }` to the bare string form when `url` is the only field (default: true). */
1925
+ formatBugs?: boolean;
1926
+ /** Collapse `repository: { type, url }` to the GitHub `owner/repo` shorthand (default: true). */
1927
+ formatRepository?: boolean;
1928
+ /** Sort `exports` condition keys in canonical order (default: true). */
1929
+ sortExports?: boolean;
1930
+ /** Alphabetize script commands (default: false) */
1931
+ sortScripts?: boolean;
1932
+ };
1933
+ /**
1934
+ * Sponsorship notice shown after successful commands.
1935
+ *
1936
+ * vis prints a one-line "consider sponsoring visulima" notice at most
1937
+ * once every 14 days (skipped in CI, non-TTY, and when
1938
+ * `VIS_NO_SPONSOR=1` is set). Set `enabled: false` to silence it
1939
+ * permanently for this workspace.
1940
+ * @example
1941
+ * ```
1942
+ * sponsor: { enabled: false }
1943
+ * ```
1944
+ */
1945
+ sponsor?: {
1946
+ /**
1947
+ * Show the sponsor notice on successful command completion.
1948
+ * @default true
1949
+ */
1950
+ enabled?: boolean;
1951
+ };
1952
+ /**
1953
+ * Staged file patterns and commands (replaces lint-staged).
1954
+ *
1955
+ * Accepts all lint-staged config forms:
1956
+ * - `string` or `string[]` commands
1957
+ * - Sync/async functions returning `string | string[]`
1958
+ * - `{ title, task }` objects for named side-effect tasks
1959
+ * - Mixed arrays of strings and functions
1960
+ * - A top-level generate-task function
1961
+ */
1962
+ staged?: StagedConfig;
1963
+ /**
1964
+ * When `true`, every task command is scanned for `${VAR}` / `$VAR`
1965
+ * references before spawn. If a referenced var is unset in the
1966
+ * task's effective env (envFile + service env + per-task `env` +
1967
+ * `process.env`), the task fails with an actionable error
1968
+ * naming the missing variable, instead of letting the shell
1969
+ * silently substitute an empty string.
1970
+ *
1971
+ * Override per run with `--strict-env` / `--no-strict-env`.
1972
+ * Override per target with `options.strictEnv`.
1973
+ * @default false
1974
+ */
1975
+ strictEnv?: boolean;
1976
+ /**
1977
+ * Named bundles of target dependencies, referenceable from any task's
1978
+ * `dependsOn`. `dependsOn: [{ group: "lint" }]` expands to every entry
1979
+ * in the named group; nested groups are resolved recursively and a
1980
+ * cycle raises during discovery.
1981
+ */
1982
+ taskGroups?: Record<string, (string | {
1983
+ dependencies?: boolean;
1984
+ projects?: string | string[];
1985
+ target: string;
1986
+ } | {
1987
+ group: string;
1988
+ })[]>;
1989
+ /**
1990
+ * Task runner options forwarded verbatim to `defaultTaskRunner`.
1991
+ *
1992
+ * Includes `remoteCache` (HTTP or REAPI gRPC backend), `cacheDirectory`,
1993
+ * `parallel`, `globalEnv`, `globalInputs`, etc.
1994
+ * See `TaskRunnerOptions` for the full surface.
1995
+ */
1996
+ taskRunner?: Partial<TaskRunnerOptions>;
1997
+ /**
1998
+ * Workspace-wide task defaults keyed by target name. Applied universally
1999
+ * to every project that exposes a matching target. Use `scopedTasks` when
2000
+ * defaults should only apply to a subset of projects.
2001
+ */
2002
+ tasks?: Record<string, Partial<VisTargetConfiguration>>;
2003
+ /**
2004
+ * Toolchain (Node / pnpm / python / rust / ...) management. vis
2005
+ * delegates to whichever version manager (proto, mise, fnm, volta,
2006
+ * asdf, nvm, corepack) the developer already has — it does not ship
2007
+ * its own.
2008
+ *
2009
+ * Re-exported from `./toolchain` so the public config type stays
2010
+ * in lockstep with the resolver implementation. `self-activate` is
2011
+ * narrowed out of `preferredManager` here — it's auto-resolved for
2012
+ * pnpm/yarn `packageManager` pins and isn't meaningful as an
2013
+ * override.
2014
+ */
2015
+ toolchain?: Omit<ToolchainConfig, "preferredManager"> & {
2016
+ readonly preferredManager?: Exclude<VersionManagerName, "self-activate">;
2017
+ };
2018
+ /** Terminal UI configuration */
2019
+ tui?: {
2020
+ /**
2021
+ * Auto-exit the TUI after tasks complete.
2022
+ * - `false`: Stay open until the user presses `q` (default)
2023
+ * - `true`: Show quit dialog with 3-second countdown after completion
2024
+ * - `number`: Show quit dialog with custom countdown in seconds
2025
+ */
2026
+ autoExit?: boolean | number;
2027
+ };
2028
+ /** Update command defaults */
2029
+ update?: {
2030
+ /**
2031
+ * Dependency fields to scan for outdated packages.
2032
+ * Beyond the standard fields, supports:
2033
+ * - `"overrides"` (npm)
2034
+ * - `"resolutions"` (yarn)
2035
+ * - `"pnpm.overrides"`
2036
+ * @default ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]
2037
+ */
2038
+ depFields?: string[];
2039
+ exclude?: string[];
2040
+ format?: "json" | "minimal" | "table";
2041
+ /**
2042
+ * Package names or glob patterns to permanently ignore during updates.
2043
+ * Ignored packages are skipped and listed in the output so you know
2044
+ * they were not checked.
2045
+ * @example ["eslint", "@types/*"]
2046
+ */
2047
+ ignore?: string[];
2048
+ include?: string[];
2049
+ /**
2050
+ * Include packages with pinned/exact versions (no `^` or `~` prefix).
2051
+ * By default, pinned versions are skipped during update checks.
2052
+ * @default false
2053
+ */
2054
+ includeLocked?: boolean;
2055
+ install?: boolean;
2056
+ /**
2057
+ * Maximum number of concurrent registry requests during outdated checks.
2058
+ * Higher values speed up large workspaces but risk hitting registry rate
2059
+ * limits or self-hosted Verdaccio caps.
2060
+ * @default 8
2061
+ */
2062
+ maxConcurrentRequests?: number;
2063
+ /**
2064
+ * Minimum number of minutes since a version was published before
2065
+ * vis will consider it for updates. This mirrors pnpm's
2066
+ * `minimumReleaseAge` — a single setting that applies to both
2067
+ * install and update.
2068
+ *
2069
+ * Not set by default. If your package manager config
2070
+ * (`pnpm-workspace.yaml`) has `minimumReleaseAge`, vis will
2071
+ * read it from there as a fallback.
2072
+ * @example 1440 // 24 hours
2073
+ */
2074
+ minimumReleaseAge?: number;
2075
+ /**
2076
+ * Package names/patterns excluded from the minimumReleaseAge check.
2077
+ * @example ["webpack", "@myorg/*"]
2078
+ */
2079
+ minimumReleaseAgeExclude?: string[];
2080
+ /**
2081
+ * Per-package or per-pattern update target overrides.
2082
+ * Keys are exact package names, glob patterns, or regex patterns
2083
+ * wrapped in `/` (e.g., `/^@vue/`).
2084
+ * Values are `"latest"`, `"minor"`, or `"patch"`.
2085
+ * @example { "typescript": "minor", "/^@vue/": "patch" }
2086
+ */
2087
+ packageMode?: Record<string, "latest" | "minor" | "patch">;
2088
+ prerelease?: boolean;
2089
+ /**
2090
+ * Which release channels to consider when picking the target version.
2091
+ * - `"stable"` (default) — only ship stable releases (no prereleases).
2092
+ * - `"same"` — match the prerelease channel of the *current* range:
2093
+ * if you're on `react@19.0.0-rc.1`, only `rc.*` candidates qualify;
2094
+ * if you're on a stable, only stable candidates. Prevents
2095
+ * accidentally promoting a prerelease pin to a stable major bump.
2096
+ * - `"any"` — equivalent to `--prerelease`. Any channel is fair game.
2097
+ *
2098
+ * `--release-channel` on the CLI overrides this. If `prerelease: true`
2099
+ * is set without `releaseChannel`, vis treats it as `"any"`.
2100
+ * @default "stable"
2101
+ */
2102
+ releaseChannel?: "any" | "same" | "stable";
2103
+ security?: boolean;
2104
+ target?: "latest" | "minor" | "patch";
2105
+ };
2106
+ /**
2107
+ * Minimum vis CLI version required by this workspace. When the
2108
+ * running vis binary is older than this constraint, vis exits with
2109
+ * an actionable error before executing any command.
2110
+ *
2111
+ * Accepts a semver range string (e.g. `">=1.0.0"`, `"^1.2.0"`).
2112
+ * @example ">=1.0.0"
2113
+ */
2114
+ versionConstraint?: string;
2115
+ }
2116
+ /**
2117
+ * @since 1.0.0
2118
+ */
2119
+ interface Context {
2120
+ /**
2121
+ * Get a value from the context.
2122
+ *
2123
+ * @param key key which identifies a context value
2124
+ */
2125
+ getValue(key: symbol): unknown;
2126
+ /**
2127
+ * Create a new context which inherits from this context and has
2128
+ * the given key set to the given value.
2129
+ *
2130
+ * @param key context key for which to set the value
2131
+ * @param value value to set for the given key
2132
+ */
2133
+ setValue(key: symbol, value: unknown): Context;
2134
+ /**
2135
+ * Return a new context which inherits from this context but does
2136
+ * not contain a value for the given key.
2137
+ *
2138
+ * @param key context key for which to clear a value
2139
+ */
2140
+ deleteValue(key: symbol): Context;
2141
+ }
2142
+ /**
2143
+ * Attributes is a map from string to attribute values.
2144
+ *
2145
+ * Note: only the own enumerable keys are counted as valid attribute keys.
2146
+ *
2147
+ * @since 1.3.0
2148
+ */
2149
+ interface Attributes {
2150
+ [attributeKey: string]: AttributeValue | undefined;
2151
+ }
2152
+ /**
2153
+ * Attribute values may be any non-nullish primitive value except an object.
2154
+ *
2155
+ * null or undefined attribute values are invalid and will result in undefined behavior.
2156
+ *
2157
+ * @since 1.3.0
2158
+ */
2159
+ type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
2160
+ interface ExceptionWithCode {
2161
+ code: string | number;
2162
+ name?: string;
2163
+ message?: string;
2164
+ stack?: string;
2165
+ }
2166
+ interface ExceptionWithMessage {
2167
+ code?: string | number;
2168
+ message: string;
2169
+ name?: string;
2170
+ stack?: string;
2171
+ }
2172
+ interface ExceptionWithName {
2173
+ code?: string | number;
2174
+ message?: string;
2175
+ name: string;
2176
+ stack?: string;
2177
+ }
2178
+ /**
2179
+ * Defines Exception.
2180
+ *
2181
+ * string or an object with one of (message or name or code) and optional stack
2182
+ *
2183
+ * @since 1.0.0
2184
+ */
2185
+ type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
2186
+ /**
2187
+ * Defines High-Resolution Time.
2188
+ *
2189
+ * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
2190
+ * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
2191
+ * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
2192
+ * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
2193
+ * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
2194
+ * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
2195
+ * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
2196
+ * This is represented in HrTime format as [1609504210, 150000000].
2197
+ *
2198
+ * @since 1.0.0
2199
+ */
2200
+ type HrTime = [number, number];
2201
+ /**
2202
+ * Defines TimeInput.
2203
+ *
2204
+ * hrtime, epoch milliseconds, performance.now() or Date
2205
+ *
2206
+ * @since 1.0.0
2207
+ */
2208
+ type TimeInput = HrTime | number | Date;
2209
+ /**
2210
+ * @deprecated please use {@link Attributes}
2211
+ * @since 1.0.0
2212
+ */
2213
+ type SpanAttributes = Attributes;
2214
+ /**
2215
+ * @deprecated please use {@link AttributeValue}
2216
+ * @since 1.0.0
2217
+ */
2218
+ type SpanAttributeValue = AttributeValue;
2219
+ /**
2220
+ * @since 1.0.0
2221
+ */
2222
+ interface TraceState {
2223
+ /**
2224
+ * Create a new TraceState which inherits from this TraceState and has the
2225
+ * given key set.
2226
+ * The new entry will always be added in the front of the list of states.
2227
+ *
2228
+ * @param key key of the TraceState entry.
2229
+ * @param value value of the TraceState entry.
2230
+ */
2231
+ set(key: string, value: string): TraceState;
2232
+ /**
2233
+ * Return a new TraceState which inherits from this TraceState but does not
2234
+ * contain the given key.
2235
+ *
2236
+ * @param key the key for the TraceState entry to be removed.
2237
+ */
2238
+ unset(key: string): TraceState;
2239
+ /**
2240
+ * Returns the value to which the specified key is mapped, or `undefined` if
2241
+ * this map contains no mapping for the key.
2242
+ *
2243
+ * @param key with which the specified value is to be associated.
2244
+ * @returns the value to which the specified key is mapped, or `undefined` if
2245
+ * this map contains no mapping for the key.
2246
+ */
2247
+ get(key: string): string | undefined;
2248
+ /**
2249
+ * Serializes the TraceState to a `list` as defined below. The `list` is a
2250
+ * series of `list-members` separated by commas `,`, and a list-member is a
2251
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
2252
+ * surrounding `list-members` are ignored. There can be a maximum of 32
2253
+ * `list-members` in a `list`.
2254
+ *
2255
+ * @returns the serialized string.
2256
+ */
2257
+ serialize(): string;
2258
+ }
2259
+ /**
2260
+ * A SpanContext represents the portion of a {@link Span} which must be
2261
+ * serialized and propagated along side of a {@link Baggage}.
2262
+ *
2263
+ * @since 1.0.0
2264
+ */
2265
+ interface SpanContext {
2266
+ /**
2267
+ * The ID of the trace that this span belongs to. It is worldwide unique
2268
+ * with practically sufficient probability by being made as 16 randomly
2269
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
2270
+ * 128 bits.
2271
+ */
2272
+ traceId: string;
2273
+ /**
2274
+ * The ID of the Span. It is globally unique with practically sufficient
2275
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
2276
+ * lowercase hex characters corresponding to 64 bits.
2277
+ */
2278
+ spanId: string;
2279
+ /**
2280
+ * Only true if the SpanContext was propagated from a remote parent.
2281
+ */
2282
+ isRemote?: boolean;
2283
+ /**
2284
+ * Trace flags to propagate.
2285
+ *
2286
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
2287
+ * sampled or not. When set, the least significant bit documents that the
2288
+ * caller may have recorded trace data. A caller who does not record trace
2289
+ * data out-of-band leaves this flag unset.
2290
+ *
2291
+ * see {@link TraceFlags} for valid flag values.
2292
+ */
2293
+ traceFlags: number;
2294
+ /**
2295
+ * Tracing-system-specific info to propagate.
2296
+ *
2297
+ * The tracestate field value is a `list` as defined below. The `list` is a
2298
+ * series of `list-members` separated by commas `,`, and a list-member is a
2299
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
2300
+ * surrounding `list-members` are ignored. There can be a maximum of 32
2301
+ * `list-members` in a `list`.
2302
+ * More Info: https://www.w3.org/TR/trace-context/#tracestate-field
2303
+ *
2304
+ * Examples:
2305
+ * Single tracing system (generic format):
2306
+ * tracestate: rojo=00f067aa0ba902b7
2307
+ * Multiple tracing systems (with different formatting):
2308
+ * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
2309
+ */
2310
+ traceState?: TraceState;
2311
+ }
2312
+ /**
2313
+ * @since 1.0.0
2314
+ */
2315
+ interface SpanStatus {
2316
+ /** The status code of this message. */
2317
+ code: SpanStatusCode;
2318
+ /** A developer-facing error message. */
2319
+ message?: string;
2320
+ }
2321
+ /**
2322
+ * An enumeration of status codes.
2323
+ *
2324
+ * @since 1.0.0
2325
+ */
2326
+ declare enum SpanStatusCode {
2327
+ /**
2328
+ * The default status.
2329
+ */
2330
+ UNSET = 0,
2331
+ /**
2332
+ * The operation has been validated by an Application developer or
2333
+ * Operator to have completed successfully.
2334
+ */
2335
+ OK = 1,
2336
+ /**
2337
+ * The operation contains an error.
2338
+ */
2339
+ ERROR = 2,
2340
+ }
2341
+ /**
2342
+ * A pointer from the current {@link Span} to another span in the same trace or
2343
+ * in a different trace.
2344
+ * Few examples of Link usage.
2345
+ * 1. Batch Processing: A batch of elements may contain elements associated
2346
+ * with one or more traces/spans. Since there can only be one parent
2347
+ * SpanContext, Link is used to keep reference to SpanContext of all
2348
+ * elements in the batch.
2349
+ * 2. Public Endpoint: A SpanContext in incoming client request on a public
2350
+ * endpoint is untrusted from service provider perspective. In such case it
2351
+ * is advisable to start a new trace with appropriate sampling decision.
2352
+ * However, it is desirable to associate incoming SpanContext to new trace
2353
+ * initiated on service provider side so two traces (from Client and from
2354
+ * Service Provider) can be correlated.
2355
+ *
2356
+ * @since 1.0.0
2357
+ */
2358
+ interface Link {
2359
+ /** The {@link SpanContext} of a linked span. */
2360
+ context: SpanContext;
2361
+ /** A set of {@link SpanAttributes} on the link. */
2362
+ attributes?: SpanAttributes;
2363
+ /** Count of attributes of the link that were dropped due to collection limits */
2364
+ droppedAttributesCount?: number;
2365
+ }
2366
+ /**
2367
+ * An interface that represents a span. A span represents a single operation
2368
+ * within a trace. Examples of span might include remote procedure calls or a
2369
+ * in-process function calls to sub-components. A Trace has a single, top-level
2370
+ * "root" Span that in turn may have zero or more child Spans, which in turn
2371
+ * may have children.
2372
+ *
2373
+ * Spans are created by the {@link Tracer.startSpan} method.
2374
+ *
2375
+ * @since 1.0.0
2376
+ */
2377
+ interface Span {
2378
+ /**
2379
+ * Returns the {@link SpanContext} object associated with this Span.
2380
+ *
2381
+ * Get an immutable, serializable identifier for this span that can be used
2382
+ * to create new child spans. Returned SpanContext is usable even after the
2383
+ * span ends.
2384
+ *
2385
+ * @returns the SpanContext object associated with this Span.
2386
+ */
2387
+ spanContext(): SpanContext;
2388
+ /**
2389
+ * Sets an attribute to the span.
2390
+ *
2391
+ * Sets a single Attribute with the key and value passed as arguments.
2392
+ *
2393
+ * @param key the key for this attribute.
2394
+ * @param value the value for this attribute. Setting a value null or
2395
+ * undefined is invalid and will result in undefined behavior.
2396
+ */
2397
+ setAttribute(key: string, value: SpanAttributeValue): this;
2398
+ /**
2399
+ * Sets attributes to the span.
2400
+ *
2401
+ * @param attributes the attributes that will be added.
2402
+ * null or undefined attribute values
2403
+ * are invalid and will result in undefined behavior.
2404
+ */
2405
+ setAttributes(attributes: SpanAttributes): this;
2406
+ /**
2407
+ * Adds an event to the Span.
2408
+ *
2409
+ * @param name the name of the event.
2410
+ * @param [attributesOrStartTime] the attributes that will be added; these are
2411
+ * associated with this event. Can be also a start time
2412
+ * if type is {@type TimeInput} and 3rd param is undefined
2413
+ * @param [startTime] start time of the event.
2414
+ */
2415
+ addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this;
2416
+ /**
2417
+ * Adds a single link to the span.
2418
+ *
2419
+ * Links added after the creation will not affect the sampling decision.
2420
+ * It is preferred span links be added at span creation.
2421
+ *
2422
+ * @param link the link to add.
2423
+ */
2424
+ addLink(link: Link): this;
2425
+ /**
2426
+ * Adds multiple links to the span.
2427
+ *
2428
+ * Links added after the creation will not affect the sampling decision.
2429
+ * It is preferred span links be added at span creation.
2430
+ *
2431
+ * @param links the links to add.
2432
+ */
2433
+ addLinks(links: Link[]): this;
2434
+ /**
2435
+ * Sets the status of the span.
2436
+ *
2437
+ * By default, a span has status {@link SpanStatusCode.UNSET}.
2438
+ * Calling this method overrides that default.
2439
+ *
2440
+ * The status codes have a total order: `OK > ERROR > UNSET`.
2441
+ *
2442
+ * - Once {@link SpanStatusCode.OK} is set, any further attempts to change
2443
+ * the status are ignored.
2444
+ * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.
2445
+ *
2446
+ * The `message` field is only used when {@link SpanStatusCode.ERROR} is set.
2447
+ * For all other status codes, `message` is ignored.
2448
+ *
2449
+ * @param status The {@link SpanStatus} to set.
2450
+ */
2451
+ setStatus(status: SpanStatus): this;
2452
+ /**
2453
+ * Updates the Span name.
2454
+ *
2455
+ * This will override the name provided via {@link Tracer.startSpan}.
2456
+ *
2457
+ * Upon this update, any sampling behavior based on Span name will depend on
2458
+ * the implementation.
2459
+ *
2460
+ * @param name the Span name.
2461
+ */
2462
+ updateName(name: string): this;
2463
+ /**
2464
+ * Marks the end of Span execution.
2465
+ *
2466
+ * Call to End of a Span MUST not have any effects on child spans. Those may
2467
+ * still be running and can be ended later.
2468
+ *
2469
+ * Do not return `this`. The Span generally should not be used after it
2470
+ * is ended so chaining is not desired in this context.
2471
+ *
2472
+ * @param [endTime] the time to set as Span's end time. If not provided,
2473
+ * use the current time as the span's end time.
2474
+ */
2475
+ end(endTime?: TimeInput): void;
2476
+ /**
2477
+ * Returns the flag whether this span will be recorded.
2478
+ *
2479
+ * @returns true if this Span is active and recording information like events
2480
+ * with the `AddEvent` operation and attributes using `setAttributes`.
2481
+ */
2482
+ isRecording(): boolean;
2483
+ /**
2484
+ * Sets exception as a span event
2485
+ * @param exception the exception the only accepted values are string or Error
2486
+ * @param [time] the time to set as Span's event time. If not provided,
2487
+ * use the current time.
2488
+ */
2489
+ recordException(exception: Exception, time?: TimeInput): void;
2490
+ }
2491
+ /**
2492
+ * @since 1.0.0
2493
+ */
2494
+ declare enum SpanKind {
2495
+ /** Default value. Indicates that the span is used internally. */
2496
+ INTERNAL = 0,
2497
+ /**
2498
+ * Indicates that the span covers server-side handling of an RPC or other
2499
+ * remote request.
2500
+ */
2501
+ SERVER = 1,
2502
+ /**
2503
+ * Indicates that the span covers the client-side wrapper around an RPC or
2504
+ * other remote request.
2505
+ */
2506
+ CLIENT = 2,
2507
+ /**
2508
+ * Indicates that the span describes producer sending a message to a
2509
+ * broker. Unlike client and server, there is no direct critical path latency
2510
+ * relationship between producer and consumer spans.
2511
+ */
2512
+ PRODUCER = 3,
2513
+ /**
2514
+ * Indicates that the span describes consumer receiving a message from a
2515
+ * broker. Unlike client and server, there is no direct critical path latency
2516
+ * relationship between producer and consumer spans.
2517
+ */
2518
+ CONSUMER = 4,
2519
+ }
2520
+ /**
2521
+ * Options needed for span creation
2522
+ *
2523
+ * @since 1.0.0
2524
+ */
2525
+ interface SpanOptions {
2526
+ /**
2527
+ * The SpanKind of a span
2528
+ * @default {@link SpanKind.INTERNAL}
2529
+ */
2530
+ kind?: SpanKind;
2531
+ /** A span's attributes */
2532
+ attributes?: Attributes;
2533
+ /** {@link Link}s span to other spans */
2534
+ links?: Link[];
2535
+ /** A manually specified start time for the created `Span` object. */
2536
+ startTime?: TimeInput;
2537
+ /** The new span should be a root span. (Ignore parent from context). */
2538
+ root?: boolean;
2539
+ }
2540
+ /**
2541
+ * Tracer provides an interface for creating {@link Span}s.
2542
+ *
2543
+ * @since 1.0.0
2544
+ */
2545
+ interface Tracer {
2546
+ /**
2547
+ * Starts a new {@link Span}. Start the span without setting it on context.
2548
+ *
2549
+ * This method do NOT modify the current Context.
2550
+ *
2551
+ * @param name The name of the span
2552
+ * @param [options] SpanOptions used for span creation
2553
+ * @param [context] Context to use to extract parent
2554
+ * @returns Span The newly created span
2555
+ * @example
2556
+ * const span = tracer.startSpan('op');
2557
+ * span.setAttribute('key', 'value');
2558
+ * span.end();
2559
+ */
2560
+ startSpan(name: string, options?: SpanOptions, context?: Context): Span;
2561
+ /**
2562
+ * Starts a new {@link Span} and calls the given function passing it the
2563
+ * created span as first argument.
2564
+ * Additionally the new span gets set in context and this context is activated
2565
+ * for the duration of the function call.
2566
+ *
2567
+ * @param name The name of the span
2568
+ * @param [options] SpanOptions used for span creation
2569
+ * @param [context] Context to use to extract parent
2570
+ * @param fn function called in the context of the span and receives the newly created span as an argument
2571
+ * @returns return value of fn
2572
+ * @example
2573
+ * const something = tracer.startActiveSpan('op', span => {
2574
+ * try {
2575
+ * do some work
2576
+ * span.setStatus({code: SpanStatusCode.OK});
2577
+ * return something;
2578
+ * } catch (err) {
2579
+ * span.setStatus({
2580
+ * code: SpanStatusCode.ERROR,
2581
+ * message: err.message,
2582
+ * });
2583
+ * throw err;
2584
+ * } finally {
2585
+ * span.end();
2586
+ * }
2587
+ * });
2588
+ *
2589
+ * @example
2590
+ * const span = tracer.startActiveSpan('op', span => {
2591
+ * try {
2592
+ * do some work
2593
+ * return span;
2594
+ * } catch (err) {
2595
+ * span.setStatus({
2596
+ * code: SpanStatusCode.ERROR,
2597
+ * message: err.message,
2598
+ * });
2599
+ * throw err;
2600
+ * }
2601
+ * });
2602
+ * do some more work
2603
+ * span.end();
2604
+ */
2605
+ startActiveSpan<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>;
2606
+ startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
2607
+ startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
2608
+ }
2609
+ interface OtelPluginOptions {
2610
+ /**
2611
+ * Rename incoming `project:target` IDs before they become OTel
2612
+ * span names. Defaults to passing the id through unchanged.
2613
+ */
2614
+ renameSpan?: (task: Task) => string;
2615
+ /** Tracer used to emit spans. Pass the one from `@opentelemetry/api`'s `trace.getTracer("vis")`. */
2616
+ tracer: Tracer;
2617
+ }
2618
+ /**
2619
+ * Reference plugin that maps vis hook lifecycle events to OTel spans.
2620
+ *
2621
+ * Emits:
2622
+ * - one **root span** named `vis.run` spanning `run:before` → `run:after`
2623
+ * - one **child span** per task spanning `task:before` → `task:after`
2624
+ * with attributes `vis.task.id`, `vis.task.project`, `vis.task.target`,
2625
+ * `vis.task.cache_status`, `vis.task.exit_code`
2626
+ * - `task:failure` sets span status to ERROR and records the exit code
2627
+ *
2628
+ * Streaming stdout/stderr events are intentionally **not** emitted as
2629
+ * span events — high-frequency chunks would blow up OTel backends. Use
2630
+ * a log exporter if you need stream-level visibility.
2631
+ * @example
2632
+ * ```ts
2633
+ * import { trace } from "@opentelemetry/api";
2634
+ * import { defineConfig } from "@visulima/vis/config";
2635
+ * import { otelPlugin } from "@visulima/vis/plugins/otel";
2636
+ *
2637
+ * const tracer = trace.getTracer("vis", "1.0.0");
2638
+ *
2639
+ * export default defineConfig({
2640
+ * plugins: [otelPlugin({ tracer })],
2641
+ * });
2642
+ * ```
2643
+ */
2644
+ declare const otelPlugin: (options: OtelPluginOptions) => VisPlugin;
2645
+ /**
2646
+ * Type-safe helper for defining a vis plugin. Pure identity — exists
2647
+ * only so plugin authors get inference from the `VisPlugin` contract
2648
+ * without needing a `satisfies` annotation.
2649
+ *
2650
+ * Lives in its own module so plugins can import it without going
2651
+ * through `config.ts`, which re-exports plugins like `otelPlugin` and
2652
+ * would otherwise form an import cycle.
2653
+ */
2654
+ declare const definePlugin: (plugin: VisPlugin) => VisPlugin;
2655
+ /** Supported config file names, checked in priority order. */
2656
+ declare const CONFIG_FILES: string[];
2657
+ /** Per-package overlay file names, checked in priority order. */
2658
+ declare const TASK_CONFIG_FILES: string[];
2659
+ /**
2660
+ * Default `security.policies.firstSeen.minutes` applied by `vis init`.
2661
+ * 2 days — long enough to filter out most rage-published malware while
2662
+ * staying short enough that genuine fixes still land in a working week.
2663
+ *
2664
+ * Note: this is NOT merged into `SECURITY_DEFAULTS` — leaving it undefined
2665
+ * preserves the "no opinion" semantics that downstream drift checks rely
2666
+ * on. `vis init` writes the value explicitly into the generated config.
2667
+ */
2668
+
2669
+ /**
2670
+ * Secure-by-default security settings based on npm supply chain best practices.
2671
+ *
2672
+ * Applied automatically when using `defineConfig()` or `loadVisConfig()`.
2673
+ * Users can override any value — their settings always take precedence.
2674
+ * @see https://github.com/lirantal/awesome-npm-security-best-practices
2675
+ */
2676
+ declare const SECURITY_DEFAULTS: NonNullable<VisConfig["security"]>;
2677
+ /**
2678
+ * Apply secure defaults to a raw config object.
2679
+ * Merges `SECURITY_DEFAULTS` into `config.security`, preserving all user overrides.
2680
+ */
2681
+ declare const applyDefaults: (config: VisConfig) => VisConfig;
2682
+ /**
2683
+ * Find the vis config file in a directory.
2684
+ *
2685
+ * Reads the directory listing once and intersects it with the known
2686
+ * config filenames rather than `stat`-ing each candidate — one syscall
2687
+ * instead of up to six. Priority order is preserved via
2688
+ * `CONFIG_FILES` so `.ts` still wins over `.mjs` when both exist.
2689
+ * @param directory The directory to search in.
2690
+ * @returns The absolute path to the config file, or `undefined` if not found.
2691
+ */
2692
+ declare const findVisConfigFile: (directory: string) => string | undefined;
2693
+ /**
2694
+ * Find the per-package `vis.task.ts` overlay in a project directory.
2695
+ * Same single-readdir lookup pattern as {@link findVisConfigFile}.
2696
+ */
2697
+ declare const findVisTaskConfigFile: (projectDirectory: string) => string | undefined;
2698
+ /**
2699
+ * Load the vis configuration from a `vis.config.ts` (or `.js`, `.mjs`, `.cjs`, `.mts`, `.cts`) file.
2700
+ *
2701
+ * Resolves the entire `extends` chain, post-order, and folds it into a
2702
+ * single merged config (extends first, root last — child wins). The
2703
+ * cache key covers every file in the chain, so editing any extended
2704
+ * file invalidates the cache.
2705
+ *
2706
+ * Falls back to secure defaults if no config file is found.
2707
+ * @param workspaceRoot The workspace root directory to search for the config file.
2708
+ * @param options Optional loader options.
2709
+ * @param options.explicitConfigPath Overrides discovery — used by the
2710
+ * global `--config` flag so users can point at any file regardless of
2711
+ * cwd. The path must exist; otherwise an error is thrown so the
2712
+ * config-loader plugin can surface it to the user.
2713
+ * @returns The loaded and resolved configuration with secure defaults applied.
2714
+ */
2715
+ declare const loadVisConfig: (workspaceRoot: string, options?: {
2716
+ explicitConfigPath?: string;
2717
+ }) => Promise<VisConfig>;
2718
+ /**
2719
+ * Load the per-package `vis.task.ts` overlay for a project, if any.
2720
+ *
2721
+ * Returns `undefined` when no overlay file exists. Otherwise compiles
2722
+ * the file via jiti and caches the result under
2723
+ * `node_modules/.cache/vis/task-configs/&lt;project>.json`, keyed by the
2724
+ * file's content hash. Editing one project's overlay does not invalidate
2725
+ * the root config cache.
2726
+ *
2727
+ * Errors thrown by the file are wrapped in `VisConfigLoadError` so the
2728
+ * source path is reported instead of an opaque workspace.ts failure.
2729
+ * @param workspaceRoot Absolute workspace root path (cache scope).
2730
+ * @param projectDirectory Absolute path of the project to probe.
2731
+ * @param projectName Project identifier — used to scope the cache file.
2732
+ */
2733
+ declare const loadVisTaskConfig: (workspaceRoot: string, projectDirectory: string, projectName: string) => Promise<VisTaskConfig | undefined>;
2734
+ /**
2735
+ * Type-safe helper for defining a per-package `vis.task.ts` overlay.
2736
+ * Pure identity — exists only so users get type inference and
2737
+ * autocomplete from the `VisTaskConfig` shape.
2738
+ * @example
2739
+ * ```typescript
2740
+ * // packages/api/crud/vis.task.ts
2741
+ * import { defineTaskConfig } from "@visulima/vis/config";
2742
+ *
2743
+ * export default defineTaskConfig({
2744
+ * targets: {
2745
+ * build: {
2746
+ * inputs: ["@inherit", "src/proto/**\/*.proto"],
2747
+ * outputs: ["dist/**\/*"],
2748
+ * },
2749
+ * },
2750
+ * });
2751
+ * ```
2752
+ */
2753
+ declare const defineTaskConfig: (config: VisTaskConfig) => VisTaskConfig;
2754
+ /**
2755
+ * Type-safe helper for defining vis configuration.
2756
+ * Provides full TypeScript autocomplete when used in `vis.config.ts`.
2757
+ *
2758
+ * Secure defaults are applied automatically — you only need to specify overrides.
2759
+ * To see the active defaults, run `vis check --security-config`.
2760
+ * @example
2761
+ * ```typescript
2762
+ * // vis.config.ts — minimal config, fully secured by defaults
2763
+ * import { defineConfig } from "@visulima/vis/config";
2764
+ *
2765
+ * export default defineConfig({
2766
+ * security: {
2767
+ * policies: {
2768
+ * installScripts: {
2769
+ * allow: {
2770
+ * esbuild: true,
2771
+ * "@prisma/client": true,
2772
+ * },
2773
+ * },
2774
+ * },
2775
+ * },
2776
+ * });
2777
+ * ```
2778
+ * @example
2779
+ * ```typescript
2780
+ * // vis.config.ts — override a default
2781
+ * import { defineConfig } from "@visulima/vis/config";
2782
+ *
2783
+ * export default defineConfig({
2784
+ * security: {
2785
+ * policies: {
2786
+ * // Relax cooldown to 24 hours instead of the default 14 days
2787
+ * firstSeen: { minutes: 1440 },
2788
+ * installScripts: { allow: { esbuild: true } },
2789
+ * },
2790
+ * },
2791
+ * });
2792
+ * ```
2793
+ */
2794
+ declare const defineConfig: (config: VisConfig) => VisConfig;
2795
+ 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 };