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

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