@visulima/vis 1.0.0-alpha.3 → 1.0.0-alpha.5

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 (103) hide show
  1. package/CHANGELOG.md +151 -24
  2. package/LICENSE.md +27 -0
  3. package/README.md +15 -9
  4. package/dist/audit-config.d.ts +24 -0
  5. package/dist/bin.js +784 -70
  6. package/dist/catalog.d.ts +37 -11
  7. package/dist/commands/add.d.ts +3 -0
  8. package/dist/commands/approve-builds.d.ts +3 -0
  9. package/dist/commands/audit.d.ts +23 -0
  10. package/dist/commands/clean.d.ts +3 -0
  11. package/dist/commands/create/discovery.d.ts +42 -0
  12. package/dist/commands/create/index.d.ts +13 -0
  13. package/dist/commands/create/prompts.d.ts +31 -0
  14. package/dist/commands/create/random-name.d.ts +15 -0
  15. package/dist/commands/create/templates/builtin.d.ts +15 -0
  16. package/dist/commands/create/templates/generator.d.ts +14 -0
  17. package/dist/commands/create/templates/index.d.ts +13 -0
  18. package/dist/commands/create/templates/monorepo.d.ts +16 -0
  19. package/dist/commands/create/templates/remote.d.ts +41 -0
  20. package/dist/commands/create/templates/types.d.ts +46 -0
  21. package/dist/commands/create/utils.d.ts +42 -0
  22. package/dist/commands/dedupe.d.ts +3 -0
  23. package/dist/commands/devcontainer.d.ts +3 -0
  24. package/dist/commands/dlx.d.ts +3 -0
  25. package/dist/commands/doctor.d.ts +15 -0
  26. package/dist/commands/exec.d.ts +3 -0
  27. package/dist/commands/implode.d.ts +3 -0
  28. package/dist/commands/init.d.ts +14 -0
  29. package/dist/commands/install.d.ts +3 -0
  30. package/dist/commands/link.d.ts +3 -0
  31. package/dist/commands/optimize.d.ts +38 -0
  32. package/dist/commands/pm.d.ts +3 -0
  33. package/dist/commands/remove.d.ts +3 -0
  34. package/dist/commands/sort-package-json.d.ts +3 -0
  35. package/dist/commands/unlink.d.ts +3 -0
  36. package/dist/commands/upgrade.d.ts +3 -0
  37. package/dist/commands/why.d.ts +3 -0
  38. package/dist/config.d.ts +38 -11
  39. package/dist/config.js +1 -1
  40. package/dist/native-binding.d.ts +151 -0
  41. package/dist/output.d.ts +40 -0
  42. package/dist/overrides.d.ts +82 -0
  43. package/dist/plugins/config-loader.d.ts +3 -0
  44. package/dist/plugins/post-command.d.ts +3 -0
  45. package/dist/plugins/security-enforcement.d.ts +3 -0
  46. package/dist/pm-runner.d.ts +23 -0
  47. package/dist/security.d.ts +64 -0
  48. package/dist/socket-security.d.ts +129 -0
  49. package/dist/tips.d.ts +41 -0
  50. package/dist/tui/components/CheckProgressApp.d.ts +6 -0
  51. package/dist/tui/components/CommandSummary.d.ts +17 -0
  52. package/dist/tui/components/Header.d.ts +13 -0
  53. package/dist/tui/components/OutputPanel.d.ts +16 -0
  54. package/dist/tui/components/QuitDialog.d.ts +15 -0
  55. package/dist/tui/components/TaskListPanel.d.ts +19 -0
  56. package/dist/tui/components/TaskRow.d.ts +12 -0
  57. package/dist/tui/components/TaskStore.d.ts +80 -0
  58. package/dist/tui/components/VisTaskRunnerApp.d.ts +17 -0
  59. package/dist/tui/components/devcontainer/DevcontainerStore.d.ts +66 -0
  60. package/dist/tui/components/devcontainer/VisDevcontainerApp.d.ts +9 -0
  61. package/dist/tui/components/devcontainer/catalogs/extensions.d.ts +8 -0
  62. package/dist/tui/components/devcontainer/catalogs/features.d.ts +8 -0
  63. package/dist/tui/components/devcontainer/catalogs/filters.d.ts +4 -0
  64. package/dist/tui/components/devcontainer/catalogs/mount-suggestions.d.ts +19 -0
  65. package/dist/tui/components/devcontainer/catalogs/templates.d.ts +8 -0
  66. package/dist/tui/components/devcontainer/devcontainer-io.d.ts +14 -0
  67. package/dist/tui/components/devcontainer/sections/DockerComposeSection.d.ts +11 -0
  68. package/dist/tui/components/devcontainer/sections/EnvironmentSection.d.ts +16 -0
  69. package/dist/tui/components/devcontainer/sections/ExtensionsSection.d.ts +11 -0
  70. package/dist/tui/components/devcontainer/sections/FeaturesSection.d.ts +11 -0
  71. package/dist/tui/components/devcontainer/sections/GeneralSection.d.ts +12 -0
  72. package/dist/tui/components/devcontainer/sections/LifecycleSection.d.ts +13 -0
  73. package/dist/tui/components/devcontainer/sections/MountsSection.d.ts +16 -0
  74. package/dist/tui/components/devcontainer/sections/PortsSection.d.ts +10 -0
  75. package/dist/tui/components/devcontainer/sections/PreviewPanel.d.ts +11 -0
  76. package/dist/tui/components/devcontainer/types.d.ts +53 -0
  77. package/dist/tui/components/devcontainer/validate.d.ts +16 -0
  78. package/dist/tui/components/graph/GraphStore.d.ts +42 -0
  79. package/dist/tui/components/graph/ProjectDetailPanel.d.ts +10 -0
  80. package/dist/tui/components/graph/ProjectListPanel.d.ts +20 -0
  81. package/dist/tui/components/graph/VisGraphApp.d.ts +8 -0
  82. package/dist/tui/components/optimize/OptimizeDetailPanel.d.ts +9 -0
  83. package/dist/tui/components/optimize/OptimizeListPanel.d.ts +16 -0
  84. package/dist/tui/components/optimize/OptimizeStore.d.ts +50 -0
  85. package/dist/tui/components/optimize/VisOptimizeApp.d.ts +8 -0
  86. package/dist/tui/components/optimize/constants.d.ts +7 -0
  87. package/dist/tui/components/update/PackageDetailPanel.d.ts +12 -0
  88. package/dist/tui/components/update/PackageListPanel.d.ts +21 -0
  89. package/dist/tui/components/update/UpdateStore.d.ts +62 -0
  90. package/dist/tui/components/update/VisUpdateApp.d.ts +18 -0
  91. package/dist/tui/dynamic-life-cycle.d.ts +21 -0
  92. package/dist/tui/formatting-utils.d.ts +17 -0
  93. package/dist/tui/pretty-time.d.ts +8 -0
  94. package/dist/tui/static-life-cycle.d.ts +22 -0
  95. package/dist/tui/status-utils.d.ts +20 -0
  96. package/dist/tui/symbols.d.ts +7 -0
  97. package/dist/tui/types.d.ts +11 -0
  98. package/dist/typosquats.d.ts +70 -0
  99. package/dist/upgrade-check.d.ts +30 -0
  100. package/dist/utils.d.ts +22 -0
  101. package/dist/workspace.d.ts +302 -5
  102. package/index.js +600 -0
  103. package/package.json +34 -11
@@ -1,12 +1,15 @@
1
- import type { ProjectGraph, TargetConfiguration, WorkspaceConfiguration } from "@visulima/task-runner";
1
+ import type { ConstraintsConfig, ProjectGraph, TargetConfiguration, WorkspaceConfiguration } from "@visulima/task-runner";
2
+ import type { Configuration as StagedConfig } from "lint-staged";
2
3
  interface PackageJson {
4
+ bin?: Record<string, string> | string;
3
5
  dependencies?: Record<string, string>;
4
6
  devDependencies?: Record<string, string>;
5
7
  name?: string;
6
8
  peerDependencies?: Record<string, string>;
7
9
  scripts?: Record<string, string>;
8
10
  workspaces?: string[] | {
9
- packages: string[];
11
+ catalog?: Record<string, string>;
12
+ packages?: string[];
10
13
  };
11
14
  }
12
15
  interface VisConfig {
@@ -19,20 +22,309 @@ interface VisConfig {
19
22
  /** Use a specific provider instead of auto-detecting (e.g., `"claude"`, `"gemini"`). */
20
23
  provider?: string;
21
24
  };
25
+ /**
26
+ * Project dependency constraints.
27
+ * Enforced after building the project graph, before running tasks.
28
+ */
29
+ constraints?: ConstraintsConfig;
30
+ /**
31
+ * Configuration for the `vis create` scaffolding command.
32
+ * Controls template downloads (via giget), default options, and
33
+ * post-creation behavior.
34
+ */
35
+ create?: {
36
+ /**
37
+ * Authorization token for downloading private repository templates.
38
+ * Passed as Bearer token to the git host API.
39
+ * Can also be set via GIGET_AUTH, GITHUB_TOKEN, or GH_TOKEN environment variables.
40
+ */
41
+ auth?: string;
42
+ /**
43
+ * Default editor to configure after scaffolding.
44
+ * When set, `vis create` automatically generates editor config files.
45
+ * @example "vscode"
46
+ */
47
+ defaultEditor?: "vscode";
48
+ /**
49
+ * Default package manager for new standalone projects.
50
+ * When set, skips the PM selection prompt in interactive mode.
51
+ */
52
+ defaultPm?: "bun" | "npm" | "pnpm" | "yarn";
53
+ /**
54
+ * Default giget provider for `owner/repo` shorthand inputs.
55
+ * @default "github"
56
+ */
57
+ defaultProvider?: "bitbucket" | "github" | "gitlab" | "sourcehut";
58
+ /**
59
+ * Initialize a git repository after scaffolding standalone projects.
60
+ * @default false
61
+ */
62
+ gitInit?: boolean;
63
+ /**
64
+ * Install dependencies automatically after scaffolding.
65
+ * @default true
66
+ */
67
+ install?: boolean;
68
+ /**
69
+ * Prefer locally cached templates over re-downloading.
70
+ * Useful for offline development or slow connections.
71
+ * @default false
72
+ */
73
+ preferOffline?: boolean;
74
+ /**
75
+ * Custom template registry URL.
76
+ * When set, giget checks this registry for template metadata
77
+ * before falling back to direct provider resolution.
78
+ * Set to `false` to disable registry lookup entirely.
79
+ * @see https://github.com/unjs/giget#custom-registry
80
+ */
81
+ registry?: false | string;
82
+ /**
83
+ * Named template aliases for quick access.
84
+ * Maps short names to full giget source strings.
85
+ * @example
86
+ * ```
87
+ * templates: {
88
+ * "react": "github:vitejs/vite/packages/create-vite/template-react-ts",
89
+ * "lib": "github:my-org/lib-template",
90
+ * "internal": "gitlab:company/templates/node-service",
91
+ * }
92
+ * ```
93
+ */
94
+ templates?: Record<string, string>;
95
+ };
22
96
  /** Package override mappings applied during migration (e.g., `{ "lodash": "lodash-es" }`) */
23
97
  overrides?: Record<string, string>;
24
- /** Staged file patterns and commands (replaces lint-staged) */
25
- staged?: Record<string, string | string[]>;
98
+ /**
99
+ * Supply chain security settings.
100
+ * These settings are inspired by pnpm's security features and are applied
101
+ * universally across all package managers (pnpm, npm, yarn, bun).
102
+ *
103
+ * For pnpm users: these map directly to pnpm-workspace.yaml settings.
104
+ * For npm/yarn/bun users: vis enforces these at the vis layer since
105
+ * those package managers lack native support.
106
+ */
107
+ security?: {
108
+ /**
109
+ * Map of package names/patterns to allow (true) or deny (false) build scripts.
110
+ * Packages not listed are denied by default.
111
+ * Equivalent to pnpm's `allowBuilds` setting.
112
+ * @example
113
+ * ```
114
+ * allowBuilds: {
115
+ * "esbuild": true,
116
+ * "core-js": false,
117
+ * "@prisma/client": true,
118
+ * }
119
+ * ```
120
+ */
121
+ allowBuilds?: Record<string, boolean>;
122
+ /**
123
+ * When true, prevents transitive dependencies from using exotic sources
124
+ * (git repositories, direct tarball URLs). Only direct dependencies may
125
+ * use such sources. Equivalent to pnpm's `blockExoticSubdeps`.
126
+ * @default false
127
+ */
128
+ blockExoticSubdeps?: boolean;
129
+ /**
130
+ * Minimum number of minutes that must pass after a version is published
131
+ * before vis will allow installation. Reduces risk of installing
132
+ * compromised packages that are typically discovered within hours.
133
+ * Equivalent to pnpm's `minimumReleaseAge`.
134
+ * @default 0
135
+ * @example 1440 // 24 hours
136
+ */
137
+ minimumReleaseAge?: number;
138
+ /**
139
+ * Package names/patterns excluded from minimumReleaseAge check.
140
+ * Equivalent to pnpm's `minimumReleaseAgeExclude`.
141
+ * @example ["webpack", "react", "@myorg/*"]
142
+ */
143
+ minimumReleaseAgeExclude?: string[];
144
+ /**
145
+ * Socket.dev security intelligence configuration.
146
+ * When enabled, vis fetches package security scores, alerts, and report
147
+ * data from the Socket.dev API during install, update, and check commands.
148
+ * @see https://socket.dev
149
+ */
150
+ socket?: {
151
+ /**
152
+ * Packages whose low Socket.dev scores or alerts have been reviewed
153
+ * and explicitly accepted. These packages skip the confirmation
154
+ * prompt during `vis add` and show as "acknowledged" in `vis audit`.
155
+ *
156
+ * Key format: package name (`"lodash"`), name@version
157
+ * (`"lodash@4.17.21"`), or glob (`"@myorg/*"`).
158
+ * Unversioned keys match all versions of that package.
159
+ * @example
160
+ * ```
161
+ * acceptedRisks: {
162
+ * "some-risky-pkg": {
163
+ * reason: "Internal fork, low score expected",
164
+ * acceptedAt: "2026-03-15T10:00:00Z",
165
+ * acceptedScore: 0.25,
166
+ * },
167
+ * }
168
+ * ```
169
+ */
170
+ acceptedRisks?: Record<string, {
171
+ /** ISO 8601 timestamp when the risk was accepted. */
172
+ acceptedAt: string;
173
+ /** The overall Socket.dev score at the time of acceptance. */
174
+ acceptedScore: number;
175
+ /** User-provided reason for accepting the risk. */
176
+ reason: string;
177
+ }>;
178
+ /**
179
+ * Custom Socket.dev API token. Falls back to the public API token.
180
+ * Set via VIS_SOCKET_TOKEN environment variable or here.
181
+ */
182
+ apiToken?: string;
183
+ /**
184
+ * Cache TTL in milliseconds for Socket.dev reports.
185
+ * @default 3_600_000 (1 hour)
186
+ */
187
+ cacheTtlMs?: number;
188
+ /**
189
+ * Enable Socket.dev security scanning on install/update/check commands.
190
+ * @default false
191
+ */
192
+ enabled?: boolean;
193
+ /**
194
+ * Minimum overall Socket.dev score (0–1) for a package to be
195
+ * accepted without a confirmation prompt during `vis add`.
196
+ * Packages scoring below this threshold trigger an interactive
197
+ * prompt asking the user to confirm. Set to 0 to disable.
198
+ * @default 0.4
199
+ */
200
+ minimumScore?: number;
201
+ /**
202
+ * Request timeout in milliseconds for the Socket.dev API.
203
+ * @default 15_000 (15 seconds)
204
+ */
205
+ timeoutMs?: number;
206
+ };
207
+ /**
208
+ * When true, installation will fail (exit non-zero) if any dependencies
209
+ * have unreviewed build scripts. Equivalent to pnpm's `strictDepBuilds`.
210
+ * @default false
211
+ */
212
+ strictDepBuilds?: boolean;
213
+ /**
214
+ * Trust level checking for package publishing.
215
+ * - "off": No trust checking (default)
216
+ * - "no-downgrade": Fail if a package's trust level has decreased
217
+ * compared to previous releases (e.g., was published by trusted
218
+ * publisher, now only has provenance).
219
+ * Equivalent to pnpm's `trustPolicy`.
220
+ * @default "off"
221
+ */
222
+ trustPolicy?: "no-downgrade" | "off";
223
+ /**
224
+ * Package selectors excluded from trust policy checks.
225
+ * Equivalent to pnpm's `trustPolicyExclude`.
226
+ * @example ["chokidar@4.0.3", "@babel/core@7.28.5"]
227
+ */
228
+ trustPolicyExclude?: string[];
229
+ /**
230
+ * Ignore the trust policy check for packages published more than
231
+ * the specified number of minutes ago. Useful for older packages
232
+ * that pre-date provenance support.
233
+ * Equivalent to pnpm's `trustPolicyIgnoreAfter` (10.27+).
234
+ * @example 43200 // 30 days
235
+ */
236
+ trustPolicyIgnoreAfter?: number;
237
+ /**
238
+ * Package names to skip during typosquat detection.
239
+ * Use this for internal packages or known-safe names that happen to
240
+ * look similar to popular packages.
241
+ * @example ["my-internal-axois", "@myorg/recat"]
242
+ */
243
+ typosquatAllowlist?: string[];
244
+ };
245
+ /** sort-package-json command defaults */
246
+ sortPackageJson?: {
247
+ /** Alphabetize script commands (default: false) */
248
+ sortScripts?: boolean;
249
+ };
250
+ /**
251
+ * Staged file patterns and commands (replaces lint-staged).
252
+ *
253
+ * Accepts all lint-staged config forms:
254
+ * - `string` or `string[]` commands
255
+ * - Sync/async functions returning `string | string[]`
256
+ * - `{ title, task }` objects for named side-effect tasks
257
+ * - Mixed arrays of strings and functions
258
+ * - A top-level generate-task function
259
+ */
260
+ staged?: StagedConfig;
26
261
  /** Target default configurations */
27
262
  targetDefaults?: Record<string, Partial<TargetConfiguration>>;
28
263
  /** Task runner options */
29
264
  taskRunnerOptions?: Record<string, unknown>;
265
+ /** Terminal UI configuration */
266
+ tui?: {
267
+ /**
268
+ * Auto-exit the TUI after tasks complete.
269
+ * - `false`: Stay open until the user presses `q` (default)
270
+ * - `true`: Show quit dialog with 3-second countdown after completion
271
+ * - `number`: Show quit dialog with custom countdown in seconds
272
+ */
273
+ autoExit?: boolean | number;
274
+ };
30
275
  /** Update command defaults */
31
276
  update?: {
277
+ /**
278
+ * Dependency fields to scan for outdated packages.
279
+ * Beyond the standard fields, supports:
280
+ * - `"overrides"` (npm)
281
+ * - `"resolutions"` (yarn)
282
+ * - `"pnpm.overrides"`
283
+ * @default ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]
284
+ */
285
+ depFields?: string[];
32
286
  exclude?: string[];
33
287
  format?: "json" | "minimal" | "table";
288
+ /**
289
+ * Package names or glob patterns to permanently ignore during updates.
290
+ * Ignored packages are skipped and listed in the output so you know
291
+ * they were not checked.
292
+ * @example ["eslint", "@types/*"]
293
+ */
294
+ ignore?: string[];
34
295
  include?: string[];
296
+ /**
297
+ * Include packages with pinned/exact versions (no `^` or `~` prefix).
298
+ * By default, pinned versions are skipped during update checks.
299
+ * @default false
300
+ */
301
+ includeLocked?: boolean;
35
302
  install?: boolean;
303
+ /**
304
+ * Minimum number of minutes since a version was published before
305
+ * vis will consider it for updates. This mirrors pnpm's
306
+ * `minimumReleaseAge` — a single setting that applies to both
307
+ * install and update.
308
+ *
309
+ * Not set by default. If your package manager config
310
+ * (`pnpm-workspace.yaml`) has `minimumReleaseAge`, vis will
311
+ * read it from there as a fallback.
312
+ * @example 1440 // 24 hours
313
+ */
314
+ minimumReleaseAge?: number;
315
+ /**
316
+ * Package names/patterns excluded from the minimumReleaseAge check.
317
+ * @example ["webpack", "@myorg/*"]
318
+ */
319
+ minimumReleaseAgeExclude?: string[];
320
+ /**
321
+ * Per-package or per-pattern update target overrides.
322
+ * Keys are exact package names, glob patterns, or regex patterns
323
+ * wrapped in `/` (e.g., `/^@vue/`).
324
+ * Values are `"latest"`, `"minor"`, or `"patch"`.
325
+ * @example { "typescript": "minor", "/^@vue/": "patch" }
326
+ */
327
+ packageMode?: Record<string, "latest" | "minor" | "patch">;
36
328
  prerelease?: boolean;
37
329
  security?: boolean;
38
330
  target?: "latest" | "minor" | "patch";
@@ -43,6 +335,10 @@ interface VisConfig {
43
335
  * Supports simple patterns like "packages/*" and "packages/**".
44
336
  */
45
337
  declare const resolveWorkspacePatterns: (workspaceRoot: string, patterns: string[]) => string[];
338
+ /**
339
+ * Reads workspace patterns from pnpm-workspace.yaml (simple parser).
340
+ */
341
+ declare const readPnpmWorkspacePatterns: (workspaceRoot: string) => string[] | undefined;
46
342
  /**
47
343
  * Discovers all projects in the workspace and builds a WorkspaceConfiguration.
48
344
  */
@@ -55,4 +351,5 @@ declare const discoverWorkspace: (workspaceRoot: string, config?: VisConfig) =>
55
351
  */
56
352
  declare const buildProjectGraph: (workspaceRoot: string, workspace: WorkspaceConfiguration) => ProjectGraph;
57
353
  export type { PackageJson, VisConfig };
58
- export { buildProjectGraph, discoverWorkspace, resolveWorkspacePatterns };
354
+ export { buildProjectGraph, discoverWorkspace, readPnpmWorkspacePatterns, resolveWorkspacePatterns };
355
+ export { type Configuration as StagedConfig } from "lint-staged";