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

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 (116) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/LICENSE.md +559 -186
  3. package/README.md +18 -0
  4. package/dist/bin.js +1 -9
  5. package/dist/config/index.d.ts +477 -556
  6. package/dist/config/index.js +1 -2
  7. package/dist/generate/index.js +1 -3
  8. package/dist/packem_chunks/applyDefaults.js +2 -336
  9. package/dist/packem_chunks/bin.js +234 -9552
  10. package/dist/packem_chunks/doctor-probe.js +2 -112
  11. package/dist/packem_chunks/fix.js +11 -234
  12. package/dist/packem_chunks/handler.js +1 -99
  13. package/dist/packem_chunks/handler10.js +2 -53
  14. package/dist/packem_chunks/handler11.js +1 -32
  15. package/dist/packem_chunks/handler12.js +5 -100
  16. package/dist/packem_chunks/handler13.js +1 -25
  17. package/dist/packem_chunks/handler14.js +18 -916
  18. package/dist/packem_chunks/handler15.js +15 -201
  19. package/dist/packem_chunks/handler16.js +1 -124
  20. package/dist/packem_chunks/handler17.js +1 -13
  21. package/dist/packem_chunks/handler18.js +1 -106
  22. package/dist/packem_chunks/handler19.js +1 -19
  23. package/dist/packem_chunks/handler2.js +2 -75
  24. package/dist/packem_chunks/handler20.js +5 -29
  25. package/dist/packem_chunks/handler21.js +1 -222
  26. package/dist/packem_chunks/handler22.js +1 -237
  27. package/dist/packem_chunks/handler23.js +5 -101
  28. package/dist/packem_chunks/handler24.js +1 -110
  29. package/dist/packem_chunks/handler25.js +3 -402
  30. package/dist/packem_chunks/handler26.js +1 -13
  31. package/dist/packem_chunks/handler27.js +1 -63
  32. package/dist/packem_chunks/handler28.js +7 -34
  33. package/dist/packem_chunks/handler29.js +21 -456
  34. package/dist/packem_chunks/handler3.js +4 -95
  35. package/dist/packem_chunks/handler30.js +3 -170
  36. package/dist/packem_chunks/handler31.js +1 -530
  37. package/dist/packem_chunks/handler32.js +2 -214
  38. package/dist/packem_chunks/handler33.js +25 -119
  39. package/dist/packem_chunks/handler34.js +2 -630
  40. package/dist/packem_chunks/handler35.js +3 -283
  41. package/dist/packem_chunks/handler36.js +22 -542
  42. package/dist/packem_chunks/handler37.js +410 -744
  43. package/dist/packem_chunks/handler38.js +22 -989
  44. package/dist/packem_chunks/handler39.js +22 -574
  45. package/dist/packem_chunks/handler4.js +2 -90
  46. package/dist/packem_chunks/handler40.js +22 -1685
  47. package/dist/packem_chunks/handler41.js +6 -1088
  48. package/dist/packem_chunks/handler42.js +5 -797
  49. package/dist/packem_chunks/handler43.js +10 -2658
  50. package/dist/packem_chunks/handler44.js +51 -3784
  51. package/dist/packem_chunks/handler45.js +25 -2574
  52. package/dist/packem_chunks/handler46.js +3 -3769
  53. package/dist/packem_chunks/handler47.js +21 -1485
  54. package/dist/packem_chunks/handler48.js +42 -0
  55. package/dist/packem_chunks/handler5.js +8 -174
  56. package/dist/packem_chunks/handler6.js +1 -95
  57. package/dist/packem_chunks/handler7.js +1 -115
  58. package/dist/packem_chunks/handler8.js +1 -12
  59. package/dist/packem_chunks/handler9.js +1 -29
  60. package/dist/packem_chunks/heal-accept.js +10 -522
  61. package/dist/packem_chunks/heal.js +14 -673
  62. package/dist/packem_chunks/index.js +7 -873
  63. package/dist/packem_chunks/loader.js +1 -23
  64. package/dist/packem_chunks/tar.js +3 -0
  65. package/dist/packem_shared/ai-analysis-hm8d2W7z.js +67 -0
  66. package/dist/packem_shared/ai-cache-DoiF80AR.js +1 -0
  67. package/dist/packem_shared/ai-fix-nn4zOE95.js +43 -0
  68. package/dist/packem_shared/cache-directory-CwHlJhgx.js +1 -0
  69. package/dist/packem_shared/dependency-scan-COr5n63B.js +2 -0
  70. package/dist/packem_shared/docker-D6OGr5_S.js +2 -0
  71. package/dist/packem_shared/failure-log-iUVLf6ts.js +2 -0
  72. package/dist/packem_shared/flakiness-D9wf0t56.js +1 -0
  73. package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
  74. package/dist/packem_shared/index-DH-5hsrC.js +1 -0
  75. package/dist/packem_shared/otel-DxDUPJJH.js +6 -0
  76. package/dist/packem_shared/otelPlugin-CQq6poq8.js +1 -0
  77. package/dist/packem_shared/registry-CkubDdiY.js +2 -0
  78. package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +1 -0
  79. package/dist/packem_shared/runtime-check-BXZ43CBW.js +1 -0
  80. package/dist/packem_shared/selectors-BylODRiM.js +3 -0
  81. package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
  82. package/dist/packem_shared/toolchain-BgBOUHII.js +5 -0
  83. package/dist/packem_shared/typosquats-CcZl99B1.js +1 -0
  84. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +1 -0
  85. package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
  86. package/dist/packem_shared/verify-Baj5mFJ7.js +1 -0
  87. package/dist/packem_shared/vis-update-app-D1jl0UZZ.js +1 -0
  88. package/dist/packem_shared/xxh3-DrAUNq4n.js +1 -0
  89. package/index.js +556 -727
  90. package/package.json +19 -29
  91. package/schemas/project.schema.json +739 -297
  92. package/schemas/vis-config.schema.json +3365 -384
  93. package/templates/buildkite-ci/template.yml +20 -20
  94. package/dist/packem_shared/VisUpdateApp-D-Yz_wvg.js +0 -1316
  95. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
  96. package/dist/packem_shared/ai-analysis-CHeB1joD.js +0 -367
  97. package/dist/packem_shared/ai-cache-Be_jexe4.js +0 -142
  98. package/dist/packem_shared/ai-fix-B9iQVcD2.js +0 -379
  99. package/dist/packem_shared/cache-directory-2qvs4goY.js +0 -98
  100. package/dist/packem_shared/catalog-BJTtyi-O.js +0 -1371
  101. package/dist/packem_shared/dependency-scan-A0KSklpG.js +0 -188
  102. package/dist/packem_shared/docker-2iZzc280.js +0 -181
  103. package/dist/packem_shared/failure-log-Cz3Z4SKL.js +0 -100
  104. package/dist/packem_shared/flakiness-goTxXuCX.js +0 -180
  105. package/dist/packem_shared/otel-DCvqCTz_.js +0 -158
  106. package/dist/packem_shared/otelPlugin-DFaLDvJf.js +0 -3
  107. package/dist/packem_shared/registry-CbqXI0rc.js +0 -272
  108. package/dist/packem_shared/run-summary-utils-PVMl4aIh.js +0 -130
  109. package/dist/packem_shared/runtime-check-Cobi3p6l.js +0 -127
  110. package/dist/packem_shared/selectors-SM69TfqC.js +0 -194
  111. package/dist/packem_shared/symbols-Ta7g2nU-.js +0 -14
  112. package/dist/packem_shared/toolchain-BdZd9eBi.js +0 -975
  113. package/dist/packem_shared/typosquats-C-bCh3PX.js +0 -1210
  114. package/dist/packem_shared/use-measured-height-CNP0vT4M.js +0 -20
  115. package/dist/packem_shared/utils-CthVdBPS.js +0 -40
  116. package/dist/packem_shared/xxh3-Ck8mXNg1.js +0 -239
@@ -1,214 +1,2 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- import { getAffectedProjects } from '@visulima/task-runner';
21
- import { d as discoverWorkspace, b as buildProjectGraph } from './bin.js';
22
- const {
23
- execFile
24
- } = __cjs_getBuiltinModule("node:child_process");
25
- const {
26
- promisify
27
- } = __cjs_getBuiltinModule("node:util");
28
-
29
- const execFileAsync = promisify(execFile);
30
- const SKIP_TOKENS = ["[skip ci]", "[ci skip]", "[no ci]", "[vis skip]", "[nx skip]"];
31
- const FORCE_TOKENS = ["[vis deploy]", "[nx deploy]"];
32
- const PER_PROJECT_TOKEN_PREFIXES = ["vis", "nx"];
33
- const CI_BASE_SHA_ENV_VARS = [
34
- "CACHED_COMMIT_REF",
35
- // Netlify
36
- "VERCEL_GIT_PREVIOUS_SHA",
37
- // Vercel
38
- "GITHUB_BASE_REF",
39
- // GitHub Actions (PRs; ref name, not SHA — validated below)
40
- "CI_COMMIT_BEFORE_SHA"
41
- // GitLab CI
42
- ];
43
- const GIT_REF_RE = /^[\w./~^@{}][\w.\-/~^@{}]*$/;
44
- const resolveCiBaseSha = (env = process.env) => {
45
- for (const name of CI_BASE_SHA_ENV_VARS) {
46
- const value = env[name];
47
- if (value && value.trim().length > 0) {
48
- return value.trim();
49
- }
50
- }
51
- return void 0;
52
- };
53
- const validateGitRef = (ref) => {
54
- if (!GIT_REF_RE.test(ref)) {
55
- throw new Error(
56
- `Invalid git ref: "${ref}". Refs must start with an alphanumeric character or one of _ . / ~ ^ @ { } and may only contain letters, digits, dots, dashes, underscores, slashes, tildes, carets, @, and braces.`
57
- );
58
- }
59
- };
60
- const isRefReachable = async (cwd, ref) => {
61
- try {
62
- await execFileAsync("git", ["rev-parse", "--verify", `${ref}^{commit}`], { cwd });
63
- return true;
64
- } catch {
65
- return false;
66
- }
67
- };
68
- const readLastCommitMessage = async (cwd) => {
69
- try {
70
- const { stdout } = await execFileAsync("git", ["log", "-1", "--pretty=%B"], { cwd });
71
- return stdout;
72
- } catch {
73
- return "";
74
- }
75
- };
76
- const matchesPerProjectToken = (message, verb, project) => PER_PROJECT_TOKEN_PREFIXES.some((prefix) => message.includes(`[${prefix} ${verb} ${project}]`));
77
- const commitHasSkipMessage = (message, project) => SKIP_TOKENS.some((token) => message.includes(token)) || matchesPerProjectToken(message, "skip", project);
78
- const commitHasForceDeployMessage = (message, project) => FORCE_TOKENS.some((token) => message.includes(token)) || matchesPerProjectToken(message, "deploy", project);
79
- const decideBuild = (project, reason, message, extra) => {
80
- return {
81
- action: "build",
82
- message,
83
- project,
84
- reason,
85
- ...extra
86
- };
87
- };
88
- const decideSkip = (project, reason, message, extra) => {
89
- return {
90
- action: "skip",
91
- message,
92
- project,
93
- reason,
94
- ...extra
95
- };
96
- };
97
- const formatDecisionLine = (decision) => {
98
- const prefix = decision.action === "skip" ? "🛑" : "✅";
99
- return `${prefix} ${decision.message}`;
100
- };
101
- const exitCodeFor = (decision, exitZeroOnBuild) => {
102
- if (decision.action === "skip") {
103
- return 0;
104
- }
105
- return exitZeroOnBuild ? 0 : 1;
106
- };
107
-
108
- const VALID_SCOPES = /* @__PURE__ */ new Set(["deep", "direct", "none"]);
109
- const execute = async ({ argument, logger, options, visConfig, workspaceRoot }) => {
110
- const project = argument[0] ?? "";
111
- const isJson = Boolean(options.json);
112
- const isVerbose = Boolean(options.verbose);
113
- const exitZeroOnBuild = Boolean(options["exit-zero-on-build"] ?? options.exitZeroOnBuild);
114
- const debug = (message) => {
115
- if (isVerbose && !isJson) {
116
- logger.info(`❱ ${message}`);
117
- }
118
- };
119
- const emit = (decision) => {
120
- if (isJson) {
121
- process.stdout.write(`${JSON.stringify(decision)}
122
- `);
123
- } else {
124
- logger.info(formatDecisionLine(decision));
125
- }
126
- process.exit(exitCodeFor(decision, exitZeroOnBuild));
127
- };
128
- if (!project) {
129
- return emit(decideBuild("", "missing-project-argument", "Missing project argument. Usage: vis ignore <project>"));
130
- }
131
- if (!workspaceRoot) {
132
- return emit(decideBuild(project, "workspace-error", "Could not determine workspace root — building defensively"));
133
- }
134
- const commitMessage = await readLastCommitMessage(workspaceRoot);
135
- const commitSubject = commitMessage.trim().split("\n")[0] ?? "";
136
- debug(`commit: ${commitSubject}`);
137
- if (commitMessage && commitHasForceDeployMessage(commitMessage, project)) {
138
- return emit(decideBuild(project, "commit-force-deploy", `Force-deploy keyword in commit: "${commitSubject}"`));
139
- }
140
- if (commitMessage && commitHasSkipMessage(commitMessage, project)) {
141
- return emit(decideSkip(project, "commit-skip", `Skip keyword in commit: "${commitSubject}"`));
142
- }
143
- let workspace;
144
- let packageJsons;
145
- try {
146
- ({ packageJsons, workspace } = discoverWorkspace(workspaceRoot, visConfig));
147
- } catch (error) {
148
- const message = error instanceof Error ? error.message : String(error);
149
- return emit(decideBuild(project, "workspace-error", `Workspace discovery failed (${message}) — building defensively`));
150
- }
151
- if (!Object.hasOwn(workspace.projects, project)) {
152
- return emit(decideBuild(project, "project-unknown", `Project "${project}" not found in workspace — building defensively`));
153
- }
154
- try {
155
- const explicitBase = options.base?.trim();
156
- const ciBase = resolveCiBaseSha();
157
- let baseRef = explicitBase || ciBase || "HEAD~1";
158
- const headRef = options.head?.trim() || "HEAD";
159
- validateGitRef(baseRef);
160
- validateGitRef(headRef);
161
- debug(`resolved base ref: ${baseRef} (source: ${explicitBase ? "flag" : ciBase ? "ci-env" : "default"})`);
162
- const reachablePromise = isRefReachable(workspaceRoot, baseRef);
163
- const projectGraph = buildProjectGraph(workspaceRoot, workspace, packageJsons);
164
- if (!await reachablePromise) {
165
- debug(`base ref ${baseRef} not reachable — falling back to HEAD~1`);
166
- baseRef = "HEAD~1";
167
- }
168
- debug(`comparing ${baseRef}...${headRef}`);
169
- const downstream = options.downstream ?? "deep";
170
- const upstream = options.upstream ?? "none";
171
- if (!VALID_SCOPES.has(downstream)) {
172
- throw new Error(`Invalid --downstream value: "${downstream}". Must be "none", "direct", or "deep".`);
173
- }
174
- if (!VALID_SCOPES.has(upstream)) {
175
- throw new Error(`Invalid --upstream value: "${upstream}". Must be "none", "direct", or "deep".`);
176
- }
177
- const affectedOptions = {
178
- base: baseRef,
179
- downstream,
180
- head: headRef,
181
- projectGraph,
182
- projects: workspace.projects,
183
- upstream,
184
- workspaceRoot
185
- };
186
- const result = await getAffectedProjects(affectedOptions);
187
- debug(`changed files: ${result.changedFiles.length}`);
188
- debug(`affected projects: ${result.affectedProjects.join(", ") || "(none)"}`);
189
- const refs = { base: baseRef, head: headRef };
190
- if (result.changedFiles.length === 0) {
191
- return emit(decideSkip(project, "no-changes", `No files changed between ${baseRef}...${headRef}`, { ...refs, affectedProjects: [] }));
192
- }
193
- if (result.affectedProjects.includes(project)) {
194
- return emit(
195
- decideBuild(project, "project-affected", `Build ${project}: affected by ${result.changedFiles.length} changed file(s)`, {
196
- ...refs,
197
- affectedProjects: result.affectedProjects
198
- })
199
- );
200
- }
201
- return emit(
202
- decideSkip(project, "project-not-affected", `Skip ${project}: not affected by changes between ${baseRef}...${headRef}`, {
203
- ...refs,
204
- affectedProjects: result.affectedProjects
205
- })
206
- );
207
- } catch (error) {
208
- const errorMessage = error instanceof Error ? error.message : String(error);
209
- logger.error(`Affected detection failed: ${errorMessage}`);
210
- return emit(decideBuild(project, "workspace-error", `Affected detection failed (${errorMessage}) — building defensively`));
211
- }
212
- };
213
-
214
- export { execute as default };
1
+ var d=Object.defineProperty;var p=(o,r)=>d(o,"name",{value:r,configurable:!0});import{createRequire as l}from"node:module";import{X as R,Y as E,Z as w,_ as s,$ as k,a0 as v,a1 as x,a2 as C,a3 as b,a4 as M,a5 as h,a6 as _,a7 as I,a8 as S}from"./bin.js";import{v as N}from"../packem_shared/verify-Baj5mFJ7.js";const m=l(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=p(o=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(o)}return m(o)},"__cjs_getBuiltinModule"),{stdin:f,stdout:T}=u,{createInterface:j}=y("node:readline/promises");var $=Object.defineProperty,q=p((o,r)=>$(o,"name",{value:r,configurable:!0}),"n");const B=q(async o=>{if(!f.isTTY)return!0;const r=j({input:f,output:T});try{const t=(await r.question(`${o} [Y/n] `)).trim().toLowerCase();return t===""||t==="y"||t==="yes"}finally{r.close()}},"confirm");var D=Object.defineProperty,n=p((o,r)=>D(o,"name",{value:r,configurable:!0}),"r");const a=n(o=>{const r=o.workspaceRoot??process.cwd(),t=o.visConfig??{};return{config:t,dryRun:!!o.options.dryRun,logger:o.logger,packageManager:E(r),report:R(),root:r,useEditorconfig:typeof t.editorconfig=="boolean"?t.editorconfig:!0}},"buildContext"),g=n(async(o,r,t)=>{if(r.yes||r.dryRun)return!0;const i=await B(`This will edit files, scripts, and hooks for "${o}". Backups (.bak) will be created. Continue?`);return i||t.info("Aborted."),i},"maybeConfirm"),c=n(o=>{o.dryRun&&o.logger.info(`Running in dry-run mode — no changes will be made.
2
+ `)},"announceDryRun"),K=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("deps",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating dependencies and scripts ──"),w(e.root,e.packageManager,e.config,{dryRun:e.dryRun},o,e.report),o.info(""),s(e.report,o)},"migrateDepsExecuteImpl"),L=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("lint-staged",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating lint-staged ──"),k(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateLintStagedExecuteImpl"),P=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("nano-staged",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating nano-staged ──"),v(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateNanoStagedExecuteImpl"),G=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("turborepo",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating turborepo ──"),x(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateTurborepoExecuteImpl"),O=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("nx",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating nx ──"),C(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateNxExecuteImpl"),Y=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("moon",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating moon ──"),b(e.root,{copyTemplates:!!r.copyTemplates,dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateMoonExecuteImpl"),Q=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("gitleaks",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating gitleaks ──"),M(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateGitleaksExecuteImpl"),V=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("kingfisher",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating Kingfisher ──"),h(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateKingfisherExecuteImpl"),A=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("secretlint",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating secretlint ──"),_(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateSecretlintExecuteImpl"),W=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("syncpack",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating syncpack ──"),I(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateSyncpackExecuteImpl"),X=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("sherif",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating sherif ──"),S(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateSherifExecuteImpl"),Z=n(({logger:o,workspaceRoot:r})=>{const t=r??process.cwd();N(t,o).length>0&&(process.exitCode=1)},"migrateVerifyExecuteImpl"),U=K,oo=L,eo=P,ro=G,to=O,io=Y,no=Q,so=V,ao=A,go=W,co=X,uo=Z;export{U as migrateDepsExecute,no as migrateGitleaksExecute,so as migrateKingfisherExecute,oo as migrateLintStagedExecute,io as migrateMoonExecute,eo as migrateNanoStagedExecute,to as migrateNxExecute,ao as migrateSecretlintExecute,co as migrateSherifExecute,go as migrateSyncpackExecute,ro as migrateTurborepoExecute,uo as migrateVerifyExecute};
@@ -1,119 +1,25 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- readFileSync
22
- } = __cjs_getBuiltinModule("node:fs");
23
- import { writeFileSync } from '@visulima/fs';
24
- import { join } from '@visulima/path';
25
- import { d as discoverWorkspace } from './bin.js';
26
-
27
- const toWorkspacePath = (projectRoot, entryPath) => {
28
- const trimmed = entryPath.replace(/^\.?\//, "");
29
- if (trimmed === "" || trimmed === ".") {
30
- return `/${projectRoot}/`;
31
- }
32
- if (projectRoot === "" || projectRoot === ".") {
33
- return `/${trimmed}`;
34
- }
35
- return `/${projectRoot}/${trimmed}`;
36
- };
37
- const buildCodeownersLines = (workspace, config) => {
38
- const lines = [];
39
- for (const [globalPath, owners] of Object.entries(config?.globalPaths ?? {})) {
40
- lines.push({ owners, path: globalPath });
41
- }
42
- for (const [name, project] of Object.entries(workspace.projects)) {
43
- const ownersList = project.owners ?? [];
44
- for (const entry of ownersList) {
45
- lines.push({
46
- channel: entry.channel,
47
- owners: entry.owners,
48
- path: toWorkspacePath(project.root ?? name, entry.path),
49
- projectId: name
50
- });
51
- }
52
- }
53
- const orderBy = config?.orderBy ?? "file-source";
54
- if (orderBy === "project-id") {
55
- lines.sort((a, b) => (a.projectId ?? "").localeCompare(b.projectId ?? "") || a.path.localeCompare(b.path));
56
- } else {
57
- lines.sort((a, b) => a.path.localeCompare(b.path));
58
- }
59
- return lines;
60
- };
61
- const HEADER_LINES = [
62
- "# CODEOWNERS — generated by `vis sync codeowners`. Do not edit by hand.",
63
- "# Update each project's project.json `owners` field and re-run the command.",
64
- ""
65
- ];
66
- const renderCodeowners = (lines, _provider = "github") => {
67
- const out = [...HEADER_LINES];
68
- for (const line of lines) {
69
- const owners = line.owners.join(" ");
70
- const channel = line.channel ? ` # notify: ${line.channel}` : "";
71
- out.push(`${line.path} ${owners}${channel}`);
72
- }
73
- out.push("");
74
- return out.join("\n");
75
- };
76
-
77
- const execute = async ({ argument, logger, options, visConfig, workspaceRoot: wsRoot }) => {
78
- const kind = argument[0];
79
- if (!kind) {
80
- throw new Error("Missing sync kind. Usage: vis sync <kind> (known kinds: codeowners)");
81
- }
82
- if (!wsRoot) {
83
- throw new Error("Could not determine workspace root. Run inside a monorepo.");
84
- }
85
- if (kind !== "codeowners") {
86
- throw new Error(`Unknown sync kind: "${kind}". Known kinds: codeowners.`);
87
- }
88
- const { workspace } = discoverWorkspace(wsRoot, visConfig);
89
- const lines = buildCodeownersLines(workspace, visConfig?.codeowners);
90
- if (lines.length === 0) {
91
- logger.info("No `owners` entries found in any project. Nothing to sync.");
92
- return;
93
- }
94
- const rendered = renderCodeowners(lines, visConfig?.codeowners?.provider ?? "github");
95
- const outPath = options.out ? join(wsRoot, options.out) : join(wsRoot, "CODEOWNERS");
96
- if (options.check) {
97
- let existing = "";
98
- try {
99
- existing = readFileSync(outPath, "utf8");
100
- } catch (error) {
101
- if (error.code === "ENOENT") {
102
- existing = "";
103
- } else {
104
- throw error;
105
- }
106
- }
107
- if (existing.trim() !== rendered.trim()) {
108
- logger.error(`${outPath} is out of date. Run \`vis sync codeowners\` to update it.`);
109
- process.exitCode = 1;
110
- return;
111
- }
112
- logger.info(`${outPath} is up to date.`);
113
- return;
114
- }
115
- writeFileSync(outPath, rendered);
116
- logger.info(`Wrote ${lines.length} entries to ${outPath}`);
117
- };
118
-
119
- export { execute as default };
1
+ var ge=Object.defineProperty;var _=(e,t)=>ge(e,"name",{value:t,configurable:!0});import{createRequire as me}from"node:module";import{yellow as V,red as ve}from"@visulima/colorize";import{isAccessibleSync as H}from"@visulima/fs";import{readTomlSync as ke}from"@visulima/fs/toml";import{readYamlSync as $e}from"@visulima/fs/yaml";import{findPackageManagerSync as we,getPackageManagerVersion as ye}from"@visulima/package";import{join as Z}from"@visulima/path";import{render as K,renderToString as I,Text as R}from"@visulima/tui";import{a9 as be,M as T,aa as Re,v as Se,j as Ce,c as ae,ab as Ae,ac as re,u as xe,g as Ee,V as Te,S as je,B as Ue,ad as Ne,s as qe,ae as Be,af as Me,ag as Oe,m as _e}from"./bin.js";import k from"react";import{H as Pe,e as Fe,Z as Q}from"../packem_shared/ai-analysis-hm8d2W7z.js";import{r as Le,s as We}from"../packem_shared/typosquats-CcZl99B1.js";import{U as ze,B as De,T as X}from"../packem_shared/vis-update-app-D1jl0UZZ.js";import{d as Ie}from"../packem_shared/utils-DrNg0XTR.js";const fe=me(import.meta.url),B=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,he=_(e=>{if(typeof B<"u"&&B.versions&&B.versions.node){const[t,n]=B.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return B.getBuiltinModule(e)}return fe(e)},"__cjs_getBuiltinModule"),{execFileSync:oe}=he("node:child_process");var Ve=Object.defineProperty,x=_((e,t)=>Ve(e,"name",{value:t,configurable:!0}),"s");const Ye=x(e=>{const t=[];for(const n of e.filters)t.push("--filter",n);return e.workspaceRoot&&t.push("--filter","."),t.push("update"),e.latest&&t.push("--latest"),e.recursive&&t.push("--recursive"),e.interactive&&t.push("--interactive"),e.dev&&t.push("--dev"),e.prod&&t.push("--prod"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"pnpm"}},"resolvePnpm"),Ge=x(e=>{const t=[];return e.filters.length>0&&t.push("workspace",e.filters[0]),t.push("upgrade"),e.latest&&t.push("--latest"),t.push(...e.packages),{args:t,bin:"yarn"}},"resolveYarnV1"),Je=x(e=>{const t=[];if(e.filters.length>0||e.recursive){t.push("workspaces","foreach","--all");for(const n of e.filters)t.push("--include",n)}return t.push("up"),e.interactive&&t.push("--interactive"),t.push(...e.packages),{args:t,bin:"yarn"}},"resolveYarnBerry"),He=x((e,t)=>{const n=["update"];e.latest&&t.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&t.push("npm does not support --interactive mode.");for(const o of e.filters)n.push("--workspace",o);return e.recursive&&n.push("--workspaces"),e.workspaceRoot&&n.push("--include-workspace-root"),e.dev&&n.push("--dev"),e.prod&&n.push("--production"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"npm"}},"resolveNpm"),Ze=x(e=>{const t=["update"];e.latest&&t.push("--latest");for(const n of e.filters)t.push("--filter",n);return t.push(...e.packages),{args:t,bin:"bun"}},"resolveBun"),Ke=x((e,t)=>{const n=["outdated","--update"];return e.latest&&n.push("--latest"),e.interactive&&n.push("--interactive"),e.filters.length>0&&t.push("deno outdated has no --filter flag; ignoring."),(e.dev||e.prod)&&t.push("deno outdated has no --dev / --prod flags; dev/prod is governed by deno.json."),e.noOptional&&t.push("deno outdated has no --no-optional flag; ignoring."),e.noSave&&t.push("deno outdated has no --no-save flag; ignoring."),n.push(...e.packages),{args:n,bin:"deno"}},"resolveDeno"),Qe=x((e,t,n)=>{const o=[];if(n.global&&e!=="aube"&&e!=="deno")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:o};let i;switch(e){case"aube":{const a=be(n);i={args:a.args,bin:a.bin},o.push(...a.warnings);break}case"bun":{i=Ze(n);break}case"deno":{i=Ke(n,o);break}case"npm":{i=He(n,o);break}case"pnpm":{i=Ye(n);break}case"yarn":{i=t.startsWith("1.")?Ge(n):Je(n);break}default:{const a=e;throw new Error(`Unsupported package manager: ${String(a)}`)}}return{command:i,warnings:o}},"resolveUpdateCommand");var Xe=Object.defineProperty,S=_((e,t)=>Xe(e,"name",{value:t,configurable:!0}),"C");const et=S((e,t)=>{try{if(t==="pnpm"){const n=Z(e,"pnpm-workspace.yaml");if(H(n)){const o=$e(n);return{excludes:Array.isArray(o?.minimumReleaseAgeExclude)?o.minimumReleaseAgeExclude:void 0,minutes:typeof o?.minimumReleaseAge=="number"?o.minimumReleaseAge:void 0}}}else if(t==="bun"){const n=Z(e,"bunfig.toml");if(H(n)){const o=ke(n);return{excludes:Array.isArray(o?.install?.minimumReleaseAgeExcludes)?o.install.minimumReleaseAgeExcludes:void 0,minutes:typeof o?.install?.minimumReleaseAge=="number"?o.install.minimumReleaseAge:void 0}}}}catch{}return{}},"readPmNativeMinimumReleaseAge"),tt=S((e,t,n)=>{const o=e.latest?"latest":e.target??t.target??"latest";if(!["latest","minor","patch"].includes(o))throw new Error(`Invalid target "${o}". Use: latest, minor, or patch.`);const i=e.maxConcurrentRequests,a=typeof i=="number"&&i>0?i:t.maxConcurrentRequests,r=typeof e.releaseChannel=="string"?e.releaseChannel.toLowerCase():void 0;if(r!==void 0&&!["any","same","stable"].includes(r))throw new Error(`Invalid --release-channel "${String(e.releaseChannel)}". Use: any, same, or stable.`);const p=r??t.releaseChannel;return{exclude:[...T(e.exclude),...T(t.exclude)],ignore:T(t.ignore),include:[...T(e.include),...T(t.include),...n],includeLocked:e.includeLocked||t.includeLocked||!1,includePrerelease:e.prerelease||t.prerelease||!1,maxConcurrentRequests:a,minimumReleaseAge:t.minimumReleaseAge,minimumReleaseAgeExclude:t.minimumReleaseAgeExclude,packageMode:t.packageMode,releaseChannel:p,security:e.security||e.ai||t.security||!1,target:o}},"buildCatalogCheckOptions"),ee=S((e,t)=>{if(e.length!==0){t.info(`
2
+ ${V("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},"logFilteredByTarget"),te=S((e,t,n,o)=>{n==="json"?process.stdout.write(`${Re({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
3
+ `):n==="minimal"?process.stdout.write(`${Se(e)}
4
+ `):(Ce(e,o),o.info(ae(e)))},"writeFormattedOutput"),ne=S(async(e,t,n,o,i,a,r)=>{const p=Ae(e,n,t,!0,{useEditorconfig:r}),h=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(i.info(`
5
+ Updated ${h}`),p&&i.info(`Backup saved to ${p}`),o.changelog){i.info(`
6
+ Fetching changelogs...`);const c=await re(n,void 0,a);for(const u of c){const g=u.releaseUrl??u.repoUrl??u.npmUrl;i.info(` ${u.packageName}: ${g}`)}}if(o.install??!0){const c=t,u=["install"];i.info(`Running ${c} ${u.join(" ")}...
7
+ `);try{oe(c,u,{cwd:e,env:process.env,stdio:"inherit"})}catch{i.warn(`${c} ${u.join(" ")} failed. You may need to run it manually.`)}}},"applyCatalogAndInstall"),nt=S(async(e,t,n,o,i,a)=>{const r=n.update??{},p=[["global","--global is not supported in catalog mode"],["recursive","--recursive is not needed in catalog mode (catalogs are workspace-level)"],["filter","--filter is not supported in catalog mode (use --include/--exclude instead)"],["no-save","--no-save is not supported in catalog mode"],["workspace-root","--workspace-root is not needed in catalog mode"],["no-optional","--no-optional is not supported in catalog mode"]];for(const[s,v]of p)o[s]&&a.warn(`${V("⚠")} ${v}, ignoring.`);const{excludes:h,minutes:c}=et(e,t),u=r.minimumReleaseAge??c,g=r.minimumReleaseAgeExclude??h;if(r.minimumReleaseAge!==void 0&&c!==void 0&&r.minimumReleaseAge!==c){const s=t==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";a.warn(`${V("⚠")} minimumReleaseAge mismatch: vis config = ${String(r.minimumReleaseAge)} min, ${s} = ${String(c)} min. Consider keeping them in sync.`)}const C=xe(e),w=Ee(e,t,{depFields:r.depFields,dev:o.dev,prod:o.prod});if(w.size===0){a.info("No catalogs found.");return}const se={...r,minimumReleaseAge:u,minimumReleaseAgeExclude:g},ie=tt(o,se,i);let P=0;for(const s of w.values())P+=s.size;const M=!!process.stdout.isTTY&&!qe;let E;const le=M?(s,v)=>{E?E.rerender(k.createElement(X,{current:s,total:v})):(process.stdout.write(`
8
+ `),E=K(k.createElement(X,{current:s,total:v}),{interactive:!0,patchConsole:!1}))}:(s,v)=>{a.info(`Checking ${String(s)}/${String(v)} dependencies...`)};M||a.info(`Checking ${String(P)} catalog dependencies...
9
+ `);const ce=Te(n.security?.socket),{checkedCount:$,failed:y,filteredByTarget:m,ignored:j,outdated:d}=await je(w,ie,C,le,e,ce,n.security?.socket?.acceptedRisks);E&&(E.clear(),E.unmount());const Y=$-d.length-y.length;if(y.length>0&&a.warn(`Failed to fetch: ${y.join(", ")}`),j.length>0&&a.info(`Skipped ${String(j.length)} ignored package${j.length===1?"":"s"}: ${j.join(", ")}`),!M&&$>d.length){const s=[...w.values()].reduce((q,L)=>q+L.size,0),v=s>$?` (${String(s)} catalog entries, ${String(s-$)} duplicates)`:"";a.info(`Checked ${String($)} unique packages${v}: ${String(d.length)} outdated, ${String(Y)} up-to-date${y.length>0?`, ${String(y.length)} failed`:""}${m.length>0?`, ${String(m.length)} skipped by target`:""}`)}if(d.length===0){m.length>0?a.info(`All catalog dependencies are up to date within the current target.
10
+ ${String(m.length)} package${m.length===1?" has":"s have"} newer versions available with --target latest:
11
+ ${m.map(s=>` ${s.packageName} ${s.currentRange} ${s.newRange} (${s.updateType})`).join(`
12
+ `)}`):a.info("All catalog dependencies are up to date.");return}const U=o.format??r.format??"table";let b;if(o.ai){const s=Pe(o.aiType??"impact");b=await Fe(d,a,n.ai,s)}const F=!!o.dryRun;if(M&&U==="table"){const s=new ze(d,b??null);let v;if(o.changelog){a.info("Fetching changelogs...");const l=await re(d,void 0,C);v=new Map;for(const f of l){const A=f.releaseUrl??f.repoUrl??f.npmUrl;A&&v.set(f.packageName,A)}}const q=n.tui?.autoExit??!1,L=q===!0?3:typeof q=="number"?q:0,G=await K(k.createElement(De,{autoExitSeconds:L,changelogUrls:v,checkedCount:$,filteredOutEntries:m,isDryRun:F,store:s,totalCatalogEntries:P}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),W=process.stdout.columns||80;process.stdout.write(`
13
+ `);for(const l of d){const f=l.vulnerabilities?.length||l.socketReport&&l.socketReport.alerts.length>0,A=!!l.acceptedRisk,D=f?A?"✓":"⚠":"✓",pe=A?"gray":l.updateType==="major"?"red":l.updateType==="minor"?"yellow":"green",O=l.socketReport?.score.overall,de=O===void 0?"":` [${String(Math.round(O*100))}%]`,J=O===void 0?void 0:Ue(O);process.stdout.write(`${I(k.createElement(R,null," ",k.createElement(R,{color:pe},D),` ${l.packageName} ${l.currentRange} → ${l.newRange}`,k.createElement(R,{dimColor:!0},` ${l.updateType}`),J?k.createElement(R,{color:J},de):null),{columns:W})}
14
+ `)}if(process.stdout.write(`
15
+ `),a.info(ae(d)),$>d.length){const l=[...w.values()].reduce((A,D)=>A+D.size,0),f=l>$?` (${String(l)} catalog entries, ${String(l-$)} duplicates)`:"";a.info(` Checked ${String($)} unique packages${f}: ${String(Y)} up-to-date${y.length>0?`, ${String(y.length)} failed`:""}`)}if(m.length>0){process.stdout.write(`
16
+ `);const l=`${String(m.length)} package${m.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${I(k.createElement(R,{color:"yellow"},` ${l}`),{columns:W})}
17
+ `);for(const f of m)process.stdout.write(`${I(k.createElement(R,null," ",k.createElement(R,{dimColor:!0},f.packageName),` ${f.currentRange} → ${f.newRange}`,k.createElement(R,{dimColor:!0},` ${f.updateType}`)),{columns:W})}
18
+ `)}const z=Array.isArray(G)?G:[];if(z.length>0&&!F){a.info(`
19
+ Applying ${String(z.length)} updates...
20
+ `);const l={...o,install:o.install??r.install};await ne(e,t,z,l,a,C,n.editorconfig??!0)}return}if(F){if(U==="json"){const s={failed:y,filteredByTarget:m,ignored:j,outdated:d};b&&(s.aiAnalysis=b),process.stdout.write(`${JSON.stringify(s,void 0,2)}
21
+ `)}else a.info(`Would update ${String(d.length)} dependencies:
22
+ `),te(d,y,U,a),b&&(a.info(""),a.info(Q(b))),ee(m,a);return}b&&U!=="json"&&(a.info(Q(b)),a.info(""));let N=d;if(o.interactive&&(N=await Ne(d),N.length===0)){a.info("No updates selected.");return}a.info(`Updating ${String(N.length)} catalog dependencies...
23
+ `),te(N,[],U,a),ee(m,a);const ue={...o,install:o.install??r.install};await ne(e,t,N,ue,a,C)},"executeCatalogUpdate"),ot=S((e,t,n,o,i,a)=>{const r={dev:o.dev,filters:T(o.filter),global:o.global,interactive:o.interactive,latest:o.latest||o.target==="latest",noOptional:o.noOptional,noSave:o.noSave,packages:i,prod:o.prod,recursive:o.recursive,workspaceRoot:o.workspaceRoot},{command:p,warnings:h}=Qe(t,n,r);for(const u of h)a.warn(u);const c=`${p.bin} ${p.args.join(" ")}`.trim();if(o.dryRun){a.info(`Would run: ${c}`);return}a.info(`Running: ${c}`);try{oe(p.bin,p.args,{cwd:e,env:process.env,stdio:"inherit"})}catch(u){const g=u.status??1;a.error(`
24
+ ${ve("✖")} Update failed (exit code ${String(g)})`),a.error(` Command: ${c}`),a.error(` Directory: ${e}
25
+ `),process.exitCode=g}},"executePmWrapper"),$t=S(async({argument:e,logger:t,options:n,visConfig:o,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");let a=e;const r=i,{packageManager:p}=we(r);if(!n.noTyposquatCheck){if(a.length>0){const h=a.map(g=>Ie(g)),c=o?.security?.typosquatAllowlist,u=await Le(h.map(g=>g.name),c);if(!u.ok){process.exitCode=1;return}a=h.map((g,C)=>{const w=u.packages[C];return w!==g.name?g.versionSpec?`${w}@${g.versionSpec}`:w??"":a[C]??""})}else if(!await We(r,o?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!Be(r,p)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(Me(r,p))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!n.noCatalog&&Oe(r,p))await nt(r,p,o??{},n,a,t);else{const h=_e(r,{configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),c=h.name==="aube"?"":ye(h.name);ot(r,h.name,c,n,a,t)}},"execute");export{$t as default,et as readPmNativeMinimumReleaseAge};