@visulima/vis 1.0.0-alpha.8 → 1.0.0-alpha.9

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 (280) hide show
  1. package/CHANGELOG.md +90 -57
  2. package/LICENSE.md +44 -1
  3. package/README.md +56 -0
  4. package/dist/bin.js +1 -1003
  5. package/dist/config.d.ts +1073 -68
  6. package/dist/config.js +1 -1
  7. package/dist/generate/index.d.ts +155 -30
  8. package/dist/packem_chunks/handler.js +1 -0
  9. package/dist/packem_chunks/handler10.js +1 -0
  10. package/dist/packem_chunks/handler11.js +1 -0
  11. package/dist/packem_chunks/handler12.js +153 -0
  12. package/dist/packem_chunks/handler13.js +1 -0
  13. package/dist/packem_chunks/handler14.js +3 -0
  14. package/dist/packem_chunks/handler15.js +1 -0
  15. package/dist/packem_chunks/handler16.js +2 -0
  16. package/dist/packem_chunks/handler17.js +7 -0
  17. package/dist/packem_chunks/handler18.js +1 -0
  18. package/dist/packem_chunks/handler19.js +19 -0
  19. package/dist/packem_chunks/handler2.js +1 -0
  20. package/dist/packem_chunks/handler20.js +428 -0
  21. package/dist/packem_chunks/handler21.js +22 -0
  22. package/dist/packem_chunks/handler22.js +3 -0
  23. package/dist/packem_chunks/handler23.js +5 -0
  24. package/dist/packem_chunks/handler24.js +1 -0
  25. package/dist/packem_chunks/handler25.js +20 -0
  26. package/dist/packem_chunks/handler26.js +1 -0
  27. package/dist/packem_chunks/handler27.js +1 -0
  28. package/dist/packem_chunks/handler28.js +1 -0
  29. package/dist/packem_chunks/handler29.js +2 -0
  30. package/dist/packem_chunks/handler3.js +2 -0
  31. package/dist/packem_chunks/handler30.js +22 -0
  32. package/dist/packem_chunks/handler31.js +1 -0
  33. package/dist/packem_chunks/handler32.js +1 -0
  34. package/dist/packem_chunks/handler33.js +37 -0
  35. package/dist/packem_chunks/handler34.js +3 -0
  36. package/dist/packem_chunks/handler35.js +23 -0
  37. package/dist/packem_chunks/handler36.js +5 -0
  38. package/dist/packem_chunks/handler37.js +27 -0
  39. package/dist/packem_chunks/handler38.js +1 -0
  40. package/dist/packem_chunks/handler39.js +2 -0
  41. package/dist/packem_chunks/handler4.js +5 -0
  42. package/dist/packem_chunks/handler40.js +1 -0
  43. package/dist/packem_chunks/handler41.js +5 -0
  44. package/dist/packem_chunks/handler42.js +1 -0
  45. package/dist/packem_chunks/handler43.js +24 -0
  46. package/dist/packem_chunks/handler44.js +3 -0
  47. package/dist/packem_chunks/handler45.js +1 -0
  48. package/dist/packem_chunks/handler5.js +4 -0
  49. package/dist/packem_chunks/handler6.js +2 -0
  50. package/dist/packem_chunks/handler7.js +24 -0
  51. package/dist/packem_chunks/handler8.js +6 -0
  52. package/dist/packem_chunks/handler9.js +8 -0
  53. package/dist/packem_shared/VisUpdateApp-BBx3idMI.js +1 -0
  54. package/dist/packem_shared/ai-analysis-DDqXRFxY.js +67 -0
  55. package/dist/packem_shared/bin-BaZZ32BK.js +93 -0
  56. package/dist/packem_shared/cache-directory-DL8hfXeG.js +1 -0
  57. package/dist/packem_shared/catalog-CuSpuB_R.js +12 -0
  58. package/dist/packem_shared/dependency-scan-BoLG2Fez.js +1 -0
  59. package/dist/packem_shared/docker-BcfqH4Av.js +2 -0
  60. package/dist/packem_shared/flakiness-DSIHZGBT.js +1 -0
  61. package/dist/packem_shared/otelPlugin-DxyvBcXO.js +1 -0
  62. package/dist/packem_shared/runtime-check-CGHal8SO.js +1 -0
  63. package/dist/packem_shared/selectors-CfH9ZY08.js +3 -0
  64. package/dist/packem_shared/symbols-CIMw60-G.js +1 -0
  65. package/dist/packem_shared/toolchain-C3ZG0o_X.js +5 -0
  66. package/dist/packem_shared/typosquats-Bpq4zcWL.js +1 -0
  67. package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
  68. package/index.js +555 -727
  69. package/package.json +27 -19
  70. package/schemas/project.schema.json +1 -1
  71. package/schemas/vis-config.schema.json +47 -1
  72. package/dist/ai-analysis.d.ts +0 -26
  73. package/dist/ai-cache.d.ts +0 -21
  74. package/dist/ai-types.d.ts +0 -16
  75. package/dist/audit-config.d.ts +0 -24
  76. package/dist/bin.d.ts +0 -1
  77. package/dist/cache-directory.d.ts +0 -73
  78. package/dist/catalog.d.ts +0 -136
  79. package/dist/codeowners.d.ts +0 -30
  80. package/dist/commands/action-graph.d.ts +0 -8
  81. package/dist/commands/add.d.ts +0 -3
  82. package/dist/commands/affected.d.ts +0 -3
  83. package/dist/commands/ai.d.ts +0 -3
  84. package/dist/commands/analyze.d.ts +0 -3
  85. package/dist/commands/approve-builds.d.ts +0 -3
  86. package/dist/commands/audit.d.ts +0 -23
  87. package/dist/commands/cache.d.ts +0 -86
  88. package/dist/commands/check.d.ts +0 -3
  89. package/dist/commands/ci.d.ts +0 -19
  90. package/dist/commands/clean.d.ts +0 -3
  91. package/dist/commands/create/discovery.d.ts +0 -42
  92. package/dist/commands/create/index.d.ts +0 -13
  93. package/dist/commands/create/prompts.d.ts +0 -31
  94. package/dist/commands/create/random-name.d.ts +0 -15
  95. package/dist/commands/create/templates/builtin.d.ts +0 -15
  96. package/dist/commands/create/templates/generator.d.ts +0 -14
  97. package/dist/commands/create/templates/index.d.ts +0 -13
  98. package/dist/commands/create/templates/monorepo.d.ts +0 -16
  99. package/dist/commands/create/templates/remote.d.ts +0 -41
  100. package/dist/commands/create/templates/types.d.ts +0 -46
  101. package/dist/commands/create/utils.d.ts +0 -42
  102. package/dist/commands/dedupe.d.ts +0 -3
  103. package/dist/commands/devcontainer.d.ts +0 -3
  104. package/dist/commands/dlx.d.ts +0 -3
  105. package/dist/commands/docker.d.ts +0 -22
  106. package/dist/commands/doctor.d.ts +0 -15
  107. package/dist/commands/exec.d.ts +0 -3
  108. package/dist/commands/generate.d.ts +0 -10
  109. package/dist/commands/graph.d.ts +0 -3
  110. package/dist/commands/hook/constants.d.ts +0 -13
  111. package/dist/commands/hook/index.d.ts +0 -3
  112. package/dist/commands/hook/install.d.ts +0 -7
  113. package/dist/commands/hook/list.d.ts +0 -28
  114. package/dist/commands/hook/migrate.d.ts +0 -30
  115. package/dist/commands/hook/prek-builtins.d.ts +0 -8
  116. package/dist/commands/hook/prek.d.ts +0 -129
  117. package/dist/commands/hook/run.d.ts +0 -21
  118. package/dist/commands/hook/uninstall.d.ts +0 -3
  119. package/dist/commands/hook/validate.d.ts +0 -17
  120. package/dist/commands/ignore-helpers.d.ts +0 -157
  121. package/dist/commands/ignore.d.ts +0 -17
  122. package/dist/commands/implode.d.ts +0 -3
  123. package/dist/commands/info.d.ts +0 -3
  124. package/dist/commands/init.d.ts +0 -14
  125. package/dist/commands/install.d.ts +0 -3
  126. package/dist/commands/link.d.ts +0 -3
  127. package/dist/commands/list.d.ts +0 -3
  128. package/dist/commands/migrate/backup.d.ts +0 -8
  129. package/dist/commands/migrate/constants.d.ts +0 -16
  130. package/dist/commands/migrate/deps.d.ts +0 -32
  131. package/dist/commands/migrate/gitleaks.d.ts +0 -29
  132. package/dist/commands/migrate/index.d.ts +0 -3
  133. package/dist/commands/migrate/json.d.ts +0 -22
  134. package/dist/commands/migrate/kingfisher.d.ts +0 -14
  135. package/dist/commands/migrate/lint-staged.d.ts +0 -62
  136. package/dist/commands/migrate/moon.d.ts +0 -5
  137. package/dist/commands/migrate/nano-staged.d.ts +0 -30
  138. package/dist/commands/migrate/nx.d.ts +0 -12
  139. package/dist/commands/migrate/prompt.d.ts +0 -2
  140. package/dist/commands/migrate/secretlint.d.ts +0 -14
  141. package/dist/commands/migrate/shared.d.ts +0 -29
  142. package/dist/commands/migrate/turborepo.d.ts +0 -11
  143. package/dist/commands/migrate/types.d.ts +0 -27
  144. package/dist/commands/migrate/verify.d.ts +0 -12
  145. package/dist/commands/optimize.d.ts +0 -38
  146. package/dist/commands/pm.d.ts +0 -3
  147. package/dist/commands/remove.d.ts +0 -3
  148. package/dist/commands/run.d.ts +0 -16
  149. package/dist/commands/sbom.d.ts +0 -10
  150. package/dist/commands/secrets.d.ts +0 -3
  151. package/dist/commands/sort-package-json.d.ts +0 -3
  152. package/dist/commands/staged.d.ts +0 -10
  153. package/dist/commands/status.d.ts +0 -3
  154. package/dist/commands/sync.d.ts +0 -16
  155. package/dist/commands/task-why.d.ts +0 -3
  156. package/dist/commands/unlink.d.ts +0 -3
  157. package/dist/commands/update.d.ts +0 -3
  158. package/dist/commands/upgrade.d.ts +0 -3
  159. package/dist/commands/why.d.ts +0 -3
  160. package/dist/docker.d.ts +0 -73
  161. package/dist/flakiness.d.ts +0 -40
  162. package/dist/generate/discover.d.ts +0 -29
  163. package/dist/generate/loader.d.ts +0 -15
  164. package/dist/generate/moon-adapter/filename-interp.d.ts +0 -42
  165. package/dist/generate/moon-adapter/filters.d.ts +0 -22
  166. package/dist/generate/moon-adapter/frontmatter.d.ts +0 -39
  167. package/dist/generate/moon-adapter/index.d.ts +0 -19
  168. package/dist/generate/moon-adapter/tera-subset.d.ts +0 -85
  169. package/dist/generate/moon-adapter/util.d.ts +0 -14
  170. package/dist/generate/prompts.d.ts +0 -25
  171. package/dist/generate/remote.d.ts +0 -43
  172. package/dist/generate/runner.d.ts +0 -37
  173. package/dist/generate/types.d.ts +0 -152
  174. package/dist/hooks.d.ts +0 -118
  175. package/dist/native-binding.d.ts +0 -158
  176. package/dist/output.d.ts +0 -40
  177. package/dist/overrides.d.ts +0 -82
  178. package/dist/package-manager.d.ts +0 -23
  179. package/dist/packem_shared/otelPlugin-CJLkguJ8.js +0 -1
  180. package/dist/plugins/config-loader.d.ts +0 -3
  181. package/dist/plugins/otel.d.ts +0 -63
  182. package/dist/plugins/post-command.d.ts +0 -3
  183. package/dist/plugins/security-enforcement.d.ts +0 -3
  184. package/dist/pm-runner.d.ts +0 -44
  185. package/dist/run-report.d.ts +0 -40
  186. package/dist/runtime-check.d.ts +0 -27
  187. package/dist/sbom/cyclonedx.d.ts +0 -39
  188. package/dist/sbom/installed-package.d.ts +0 -49
  189. package/dist/sbom/license.d.ts +0 -31
  190. package/dist/sbom/lockfile.d.ts +0 -34
  191. package/dist/sbom/purl.d.ts +0 -25
  192. package/dist/sbom/resolve-specifier.d.ts +0 -24
  193. package/dist/sbom/types.d.ts +0 -196
  194. package/dist/secrets/baseline.d.ts +0 -20
  195. package/dist/secrets/format.d.ts +0 -14
  196. package/dist/secrets/git.d.ts +0 -6
  197. package/dist/secrets/spinner.d.ts +0 -9
  198. package/dist/security.d.ts +0 -64
  199. package/dist/selectors.d.ts +0 -81
  200. package/dist/shell-history.d.ts +0 -16
  201. package/dist/socket-security.d.ts +0 -129
  202. package/dist/staged/cli-parse.d.ts +0 -18
  203. package/dist/staged/config.d.ts +0 -14
  204. package/dist/staged/errors/apply-empty-commit-error.d.ts +0 -4
  205. package/dist/staged/errors/config-error.d.ts +0 -4
  206. package/dist/staged/errors/get-backup-stash-error.d.ts +0 -4
  207. package/dist/staged/errors/git-error.d.ts +0 -6
  208. package/dist/staged/errors/index.d.ts +0 -12
  209. package/dist/staged/errors/restore-original-state-error.d.ts +0 -4
  210. package/dist/staged/errors/staged-error.d.ts +0 -8
  211. package/dist/staged/errors/task-error.d.ts +0 -6
  212. package/dist/staged/git/diff.d.ts +0 -76
  213. package/dist/staged/git/exec.d.ts +0 -43
  214. package/dist/staged/git/index.d.ts +0 -77
  215. package/dist/staged/git/stash.d.ts +0 -37
  216. package/dist/staged/index.d.ts +0 -13
  217. package/dist/staged/match.d.ts +0 -12
  218. package/dist/staged/renderer/index.d.ts +0 -9
  219. package/dist/staged/renderer/ink/index.d.ts +0 -4
  220. package/dist/staged/renderer/plain.d.ts +0 -12
  221. package/dist/staged/tasks/build.d.ts +0 -13
  222. package/dist/staged/tasks/exec.d.ts +0 -56
  223. package/dist/staged/tasks/run.d.ts +0 -26
  224. package/dist/staged/types.d.ts +0 -173
  225. package/dist/target-discovery.d.ts +0 -59
  226. package/dist/target-options.d.ts +0 -261
  227. package/dist/tips.d.ts +0 -41
  228. package/dist/tui/components/CheckProgressApp.d.ts +0 -6
  229. package/dist/tui/components/CommandSummary.d.ts +0 -17
  230. package/dist/tui/components/Header.d.ts +0 -13
  231. package/dist/tui/components/OutputPanel.d.ts +0 -17
  232. package/dist/tui/components/QuitDialog.d.ts +0 -15
  233. package/dist/tui/components/TaskListPanel.d.ts +0 -19
  234. package/dist/tui/components/TaskRow.d.ts +0 -12
  235. package/dist/tui/components/TaskStore.d.ts +0 -80
  236. package/dist/tui/components/VisTaskRunnerApp.d.ts +0 -17
  237. package/dist/tui/components/devcontainer/DevcontainerStore.d.ts +0 -66
  238. package/dist/tui/components/devcontainer/VisDevcontainerApp.d.ts +0 -9
  239. package/dist/tui/components/devcontainer/catalogs/extensions.d.ts +0 -8
  240. package/dist/tui/components/devcontainer/catalogs/features.d.ts +0 -8
  241. package/dist/tui/components/devcontainer/catalogs/filters.d.ts +0 -4
  242. package/dist/tui/components/devcontainer/catalogs/mount-suggestions.d.ts +0 -19
  243. package/dist/tui/components/devcontainer/catalogs/templates.d.ts +0 -8
  244. package/dist/tui/components/devcontainer/devcontainer-io.d.ts +0 -14
  245. package/dist/tui/components/devcontainer/sections/DockerComposeSection.d.ts +0 -11
  246. package/dist/tui/components/devcontainer/sections/EnvironmentSection.d.ts +0 -16
  247. package/dist/tui/components/devcontainer/sections/ExtensionsSection.d.ts +0 -11
  248. package/dist/tui/components/devcontainer/sections/FeaturesSection.d.ts +0 -11
  249. package/dist/tui/components/devcontainer/sections/GeneralSection.d.ts +0 -12
  250. package/dist/tui/components/devcontainer/sections/LifecycleSection.d.ts +0 -13
  251. package/dist/tui/components/devcontainer/sections/MountsSection.d.ts +0 -16
  252. package/dist/tui/components/devcontainer/sections/PortsSection.d.ts +0 -10
  253. package/dist/tui/components/devcontainer/sections/PreviewPanel.d.ts +0 -11
  254. package/dist/tui/components/devcontainer/types.d.ts +0 -53
  255. package/dist/tui/components/devcontainer/validate.d.ts +0 -16
  256. package/dist/tui/components/graph/GraphStore.d.ts +0 -42
  257. package/dist/tui/components/graph/ProjectDetailPanel.d.ts +0 -10
  258. package/dist/tui/components/graph/ProjectListPanel.d.ts +0 -20
  259. package/dist/tui/components/graph/VisGraphApp.d.ts +0 -8
  260. package/dist/tui/components/optimize/OptimizeDetailPanel.d.ts +0 -9
  261. package/dist/tui/components/optimize/OptimizeListPanel.d.ts +0 -16
  262. package/dist/tui/components/optimize/OptimizeStore.d.ts +0 -50
  263. package/dist/tui/components/optimize/VisOptimizeApp.d.ts +0 -8
  264. package/dist/tui/components/optimize/constants.d.ts +0 -7
  265. package/dist/tui/components/update/PackageDetailPanel.d.ts +0 -12
  266. package/dist/tui/components/update/PackageListPanel.d.ts +0 -21
  267. package/dist/tui/components/update/UpdateStore.d.ts +0 -62
  268. package/dist/tui/components/update/VisUpdateApp.d.ts +0 -18
  269. package/dist/tui/dynamic-life-cycle.d.ts +0 -22
  270. package/dist/tui/formatting-utils.d.ts +0 -17
  271. package/dist/tui/pretty-time.d.ts +0 -8
  272. package/dist/tui/static-life-cycle.d.ts +0 -28
  273. package/dist/tui/status-utils.d.ts +0 -20
  274. package/dist/tui/symbols.d.ts +0 -7
  275. package/dist/tui/types.d.ts +0 -11
  276. package/dist/typosquats.d.ts +0 -70
  277. package/dist/upgrade-check.d.ts +0 -30
  278. package/dist/utils.d.ts +0 -22
  279. package/dist/watch.d.ts +0 -65
  280. package/dist/workspace.d.ts +0 -675
@@ -0,0 +1,2 @@
1
+ var m=Object.defineProperty;var d=(n,o)=>m(n,"name",{value:o,configurable:!0});import{createRequire as g}from"node:module";import{writeFileSync as $}from"@visulima/fs";import{join as w}from"@visulima/path";import{Z as v}from"../packem_shared/bin-BaZZ32BK.js";const j=g(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=d(n=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[o,e]=a.versions.node.split(".").map(Number);if(o>22||o===22&&e>=3||o===20&&e>=16)return a.getBuiltinModule(n)}return j(n)},"__cjs_getBuiltinModule"),{readFileSync:b}=y("node:fs");var k=Object.defineProperty,f=d((n,o)=>k(n,"name",{value:o,configurable:!0}),"i");const C=f((n,o)=>{const e=o.replace(/^\.?\//,"");return e===""||e==="."?`/${n}/`:n===""||n==="."?`/${e}`:`/${n}/${e}`},"toWorkspacePath"),_=f((n,o)=>{const e=[];for(const[r,t]of Object.entries(o?.globalPaths??{}))e.push({owners:t,path:r});for(const[r,t]of Object.entries(n.projects)){const s=t.owners??[];for(const c of s)e.push({channel:c.channel,owners:c.owners,path:C(t.root??r,c.path),projectId:r})}return(o?.orderBy??"file-source")==="project-id"?e.sort((r,t)=>(r.projectId??"").localeCompare(t.projectId??"")||r.path.localeCompare(t.path)):e.sort((r,t)=>r.path.localeCompare(t.path)),e},"buildCodeownersLines"),E=["# CODEOWNERS — generated by `vis sync codeowners`. Do not edit by hand.","# Update each project's project.json `owners` field and re-run the command.",""],O=f((n,o="github")=>{const e=[...E];for(const r of n){const t=r.owners.join(" "),s=r.channel?` # notify: ${r.channel}`:"";e.push(`${r.path} ${t}${s}`)}return e.push(""),e.join(`
2
+ `)},"renderCodeowners");var N=Object.defineProperty,R=d((n,o)=>N(n,"name",{value:o,configurable:!0}),"p");const x=R(async({argument:n,logger:o,options:e,visConfig:r,workspaceRoot:t})=>{const s=n[0];if(!s)throw new Error("Missing sync kind. Usage: vis sync <kind> (known kinds: codeowners)");if(!t)throw new Error("Could not determine workspace root. Run inside a monorepo.");if(s!=="codeowners")throw new Error(`Unknown sync kind: "${s}". Known kinds: codeowners.`);const{workspace:c}=v(t,r),p=_(c,r?.codeowners);if(p.length===0){o.info("No `owners` entries found in any project. Nothing to sync.");return}const l=O(p,r?.codeowners?.provider??"github"),i=e.out?w(t,e.out):w(t,"CODEOWNERS");if(e.check){let u="";try{u=b(i,"utf8")}catch(h){if(h.code==="ENOENT")u="";else throw h}if(u.trim()!==l.trim()){o.error(`${i} is out of date. Run \`vis sync codeowners\` to update it.`),process.exitCode=1;return}o.info(`${i} is up to date.`);return}$(i,l),o.info(`Wrote ${p.length} entries to ${i}`)},"execute");export{x as default};
@@ -0,0 +1,5 @@
1
+ var v=Object.defineProperty;var l=(t,e)=>v(t,"name",{value:e,configurable:!0});import{runProvider as u,detectAllProviders as h}from"@visulima/find-ai-runner";import{renderToString as S,Table as g}from"@visulima/tui";import $ from"react";import{M as y,R as m,S as c,x as b}from"../packem_shared/ai-analysis-DDqXRFxY.js";import{H as w}from"../packem_shared/bin-BaZZ32BK.js";var I=Object.defineProperty,d=l((t,e)=>I(t,"name",{value:e,configurable:!0}),"c");const C=d((t,e)=>{const r=y();if(t==="json"){process.stdout.write(`${JSON.stringify(r,void 0,2)}
2
+ `);return}e.info("AI Cache Statistics:"),e.info(` Entries: ${String(r.entries)}`),e.info(` Total size: ${String(Math.round(r.totalSizeBytes/1024))} KB`),e.info(` Oldest: ${r.oldestEntry?new Date(r.oldestEntry).toISOString():"N/A"}`),e.info(` Newest: ${r.newestEntry?new Date(r.newestEntry).toISOString():"N/A"}`)},"handleCacheStats"),x=d(async(t,e)=>{const r=m(e);if(!r){t.error("No AI provider available to test."),process.exitCode=1;return}t.info(`Testing ${r.name}...`);try{const n=await u(r,"Reply with exactly: OK",{timeoutMs:3e4});t.info(`Provider ${r.name} responded: ${n.stdout.trim().slice(0,200)}`)}catch(n){const o=n instanceof Error?n.message:String(n);t.error(`Provider ${r.name} failed: ${o}`),process.exitCode=1}},"handleTest"),A=d((t,e,r)=>{const n=h(),o=m(r);if(t==="json"){const i=n.map(a=>({available:a.available,method:a.detectionMethod,name:a.name,path:a.path,priority:c[a.name]??0,selected:a.name===o?.name,version:a.version}));process.stdout.write(`${JSON.stringify(i,void 0,2)}
3
+ `);return}const s=n.map(i=>({method:i.detectionMethod??"-",path:i.path??"-",priority:String(c[i.name]??0),provider:i.name,selected:i.name===o?.name?">>>":"",status:i.available?"available":"not found",version:i.version??"-"})),f=process.stdout.columns||80,p=S($.createElement(g,{data:s}),{columns:f});e.info(p),o?e.info(`
4
+ Selected provider: ${o.name} (priority ${String(c[o.name]??0)})`):e.info(`
5
+ No AI provider available. Install one of the supported AI CLI tools.`)},"handleProviderStatus"),j=d(async({logger:t,options:e,visConfig:r})=>{const n=e.format??"table";if(e.cacheStats){C(n,t);return}if(e.clearCache){const o=b(),s=w();t.info(`Cleared ${String(o)} cached AI response${o===1?"":"s"}.`),s>0&&t.info(`Cleared ${String(s)} cached Socket.dev report${s===1?"":"s"}.`);return}if(e.test){await x(t,r?.ai);return}A(n,t,r?.ai)},"execute");export{j as default};
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var j=(t,e)=>b(t,"name",{value:e,configurable:!0});import{createTaskGraph as v}from"@visulima/task-runner";import{Z as y,e as E}from"../packem_shared/bin-BaZZ32BK.js";var T=Object.defineProperty,w=j((t,e)=>T(t,"name",{value:e,configurable:!0}),"h");const O=w((t,e)=>{const s=new Map;for(const[i,r]of Object.entries(t.dependencies))for(const f of r){const c=s.get(f)??[];c.push(i),s.set(f,c)}if(!t.tasks[e])return;const a=new Set([e]),o=[{node:e,path:[e]}];for(;o.length>0;){const i=o.shift();if(t.roots.includes(i.node))return i.path;for(const r of s.get(i.node)??[])a.has(r)||(a.add(r),o.push({node:r,path:[r,...i.path]}))}return[e]},"findShortestPathToRoot"),x=w((t,e)=>{const s=[];for(const[a,o]of Object.entries(t.dependencies))o.includes(e)&&s.push(a);return s.sort()},"collectParents"),I=w(async({argument:t,logger:e,visConfig:s,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root.");const o=t[0];if(!o)throw new Error("No task ID specified. Usage: vis task-why <project>:<target>");if(!o.includes(":"))throw new Error(`Invalid task ID "${o}" — expected format "project:target".`);const{packageJsons:i,workspace:r}=y(a,s),f=E(a,r,i),[c,k]=o.split(":",2),$=r.projects[c];if(!$)throw new Error(`Unknown project "${c}".`);if(!$.targets?.[k])throw new Error(`Project "${c}" has no target "${k}".`);const m=Object.entries(r.projects).flatMap(([n,u])=>Object.keys(u.targets??{}).map(h=>({id:`${n}:${h}`,outputs:[],overrides:{},target:{project:n,target:h}}))),p=v(m,{projectGraph:f,workspace:r});if(!p.tasks[o])throw new Error(`Task "${o}" is not reachable in the graph.`);const d=O(p,o),g=x(p,o);if(e.info(""),e.info(`Why ${o}?`),e.info(""),d&&d.length>1){e.info("Shortest path from a root to this task:");for(const[n,u]of d.entries()){const h=n===0?" ":`${" ".repeat(n+1)}└─ `;e.info(`${h}${u}`)}e.info("")}else e.info(" This task is itself a root — nothing upstream depends on it."),e.info("");if(g.length>0){e.info(`Directly depended on by ${g.length} task(s):`);for(const n of g)e.info(` - ${n}`);e.info("")}const l=p.dependencies[o]??[];if(l.length>0){e.info(`This task depends on ${l.length} task(s):`);for(const n of[...l].sort())e.info(` - ${n}`);e.info("")}},"execute");export{I as default};
@@ -0,0 +1,5 @@
1
+ var U=Object.defineProperty;var y=(e,n)=>U(e,"name",{value:n,configurable:!0});import{createRequire as F}from"node:module";import{green as B,red as O,yellow as q,dim as f}from"@visulima/colorize";import{join as H}from"@visulima/path";import{O as u,I as $,c as p,E as m,y as M}from"../packem_shared/bin-BaZZ32BK.js";import{S as C,g as T,w as I,b as K,p as L,f as P,a as _,c as D,u as j,d as G,e as J,h as V}from"../packem_shared/toolchain-C3ZG0o_X.js";const W=F(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=y(e=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[n,a]=v.versions.node.split(".").map(Number);if(n>22||n===22&&a>=3||n===20&&a>=16)return v.getBuiltinModule(e)}return W(e)},"__cjs_getBuiltinModule"),{spawnSync:A}=k("node:child_process"),{writeFileSync:N}=k("node:fs");var z=Object.defineProperty,d=y((e,n)=>z(e,"name",{value:n,configurable:!0}),"u");const b=["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],Q=d(e=>b.includes(e),"isKnownTool"),x=d(e=>e?B("✓"):O("✗"),"icon"),E=q("⚠"),X=d(e=>{if(e.installed){const n=e.version?` v${e.version}`:"",a=e.configFiles.length>0?` (${e.configFiles.join(", ")})`:"";return`${x(!0)} ${e.name}${n}${a}`}return`${E} ${e.name} — referenced by ${e.configFiles.join(", ")} but not installed`},"renderManagerLine"),Y=d(e=>{if(e.matches)return"";const{manager:n}=e;return n.name==="none"?f("→ (no manager)"):n.name==="self-activate"?"":n.installed?f(`→ ${n.name}`):f(`→ ${n.name} (missing)`)},"renderToolManager"),Z=d(e=>e.matches?x(!0):e.actual?E:x(!1),"toolIcon"),ee=d(e=>{if(u(""),u(f("── Toolchain ───────────────────────")),e.detected.length===0)u(` ${x(!1)} No version manager detected`),$(` Install one of: ${C.join(", ")}`);else for(const n of e.detected)u(` ${X(n)}`);if(u(""),e.tools.length===0){u(` ${f("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);return}u(f("── Tools ───────────────────────────"));for(const n of e.tools){const a=`${n.expected.tool} ${n.expected.version}`,s=n.actual?`actual ${n.actual}`:"not installed",o=n.matches?"":f(` [${n.expected.source}]`),t=Y(n),l=t===""?"":` ${t}`;u(` ${Z(n)} ${a} — ${s}${o}${l}`),n.manager.note&&$(` ${n.manager.note}`)}},"printStatus"),ne=d((e,n,a)=>{const s=T(e,n);if(a.json){process.stdout.write(`${JSON.stringify({detected:s.detected.map(t=>({binPath:t.binPath??null,configFiles:t.configFiles,installed:t.installed,name:t.name,version:t.version??null})),tools:s.tools.map(t=>({actual:t.actual??null,expected:t.expected.version,manager:t.manager.name,managerInstalled:t.manager.installed,matches:t.matches,note:t.manager.note??null,source:t.expected.source,tool:t.expected.tool}))},void 0,2)}
2
+ `);return}ee(s);const o=s.tools.filter(t=>!t.matches);o.length>0&&(u(""),$(" Run `vis toolchain install` to install pinned versions.")),a.exitCode&&o.length>0&&(process.exitCode=1)},"executeStatus"),oe=d(e=>{const n=new Map;for(const a of e){const s=n.get(a.manager.name);s?s.push(a):n.set(a.manager.name,[a])}return n},"groupByManager"),R=d((e,n,a)=>A(e,n,{cwd:a,stdio:"inherit"}).status??1,"runInvocation"),te=d((e,n,a)=>{const s=T(e,n),o=s.tools.filter(r=>!r.matches);if(o.length===0){p("Everything already matches — nothing to install.");return}const t=o.some(r=>r.manager.name!=="self-activate"&&r.manager.name!=="none");if(s.detected.length===0&&t){m(`No version manager detected. Install one of: ${C.join(", ")}.`),process.exitCode=1;return}const l=oe(o);let c=!1,g=0;for(const[r,h]of l){if(r==="self-activate"){for(const{expected:i}of h){if(i.source!=="packageManager")if(u(`${f("$")} Writing packageManager=${i.tool}@${i.version}`),a.dryRun)c=!0;else try{I(e,i),c=!0}catch(w){m(w.message),g=1}else u(`${f("$")} (${i.tool} will self-activate from packageManager on next invocation)`);$(` ${i.tool} ${i.version} — no install needed`)}continue}if(r==="none"){for(const{expected:i}of h)M(`Cannot install ${i.tool} ${i.version} — no manager can handle it.`);g=1;continue}if(!s.detected.find(i=>i.name===r)?.installed){m(`${r} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),g=1;continue}const S=h.map(i=>K(r,i.expected)).filter(Boolean);for(const i of S){if(!i)continue;if(i.bin==="nvm"&&i.args.length===0){m("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),i.hint&&$(` ${i.hint}`),g=1;continue}if(u(`${f("$")} ${i.bin} ${i.args.join(" ")}`),i.hint&&$(` ${i.hint}`),a.dryRun){c=!0;continue}const w=R(i.bin,i.args,e);if(c=!0,w!==0){g=w;break}}}if(g!==0){process.exitCode=g;return}c&&p("Toolchain installed.")},"executeInstall"),ae=d((e,n,a,s)=>{if(!a)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const o=L(a);if(!o)throw new Error(`Could not parse "${a}". Expected "<tool>@<version>" where <tool> is one of ${b.join(", ")}.`);const t=P(e),l=_(o,t,n);if(l.name==="none"){m(`No manager can pin ${o.tool}. Install one of: ${C.join(", ")}.`),process.exitCode=1;return}if(!l.installed){m(`The best manager for ${o.tool} (${l.name}) is not on PATH. ${l.note??""}`),process.exitCode=1;return}const c=D(l.name,o);if(!c){m(`${l.name} cannot pin ${o.tool}. Use a different manager, or set \`toolchain.tools.${o.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(l.name==="self-activate"){if(u(`${f("→")} Writing packageManager field to package.json...`),s.dryRun){$(` Would set packageManager: "${o.tool}@${o.version}"`);return}try{const r=I(e,o);if(!r){m(`Refusing to pin non-package-manager tool ${o.tool} via the packageManager field.`),process.exitCode=1;return}if(p(`Set packageManager: "${r}" — ${o.tool} will activate this version on next invocation.`),s.engines!==!1){const h=j(e,o);h&&p(`Updated package.json engines.${o.tool} → ${h}.`)}}catch(r){m(r.message),process.exitCode=1}return}if(c.args.length===0&&l.name==="nvm"&&o.tool==="node"){const r=H(e,".nvmrc");if(u(`${f("→")} Writing ${r}...`),s.dryRun){$(` Would write ${o.version} to .nvmrc`);return}try{N(r,`${o.version}
3
+ `)}catch(h){m(`Failed to write .nvmrc: ${h.message}`),process.exitCode=1;return}p(`Wrote ${o.version} to .nvmrc.`),$(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(c.args.length===0){m(`${l.name} cannot pin ${o.tool} from a subprocess. ${c.configChange?.hint??""}`),c.configChange&&$(` Edit ${c.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(u(`${f("$")} ${c.bin} ${c.args.join(" ")}`),c.configChange&&$(` Will update ${c.configChange.file} — ${c.configChange.hint}`),s.dryRun)return;const g=R(c.bin,c.args,e);if(g!==0){process.exitCode=g;return}if(p(`Pinned ${o.tool} to ${o.version}.`),s.engines!==!1)try{const r=j(e,o);r&&p(`Updated package.json engines.${o.tool} → ${r}.`)}catch(r){M(`Could not update engines.${o.tool}: ${r.message}`)}},"executeUse"),se=d((e,n,a)=>{if(!a)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const s=a.toLowerCase();if(!Q(s))throw new Error(`Unknown tool "${a}". Known: ${b.join(", ")}.`);const o=P(e),t=_({source:"vis.config.ts",tool:s,version:"*"},o,n),l=t.installed&&t.name!=="self-activate"&&t.name!=="none"?o.find(g=>g.name===t.name):void 0,c=l?G(l,s):J(s);if(!c){m(`${a} not found in PATH${l?` or via ${l.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${c}
4
+ `)},"executeWhich"),ie=d((e,n)=>{const a=V(e,n);process.stdout.write(`${a.name}
5
+ `)},"executeDetect"),ge=d(async({argument:e,options:n,visConfig:a,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run inside a monorepo.");const o=e[0]??"status",t=a?.toolchain;switch(o){case"detect":{ie(s,t);return}case"install":{te(s,t,n);return}case"status":{ne(s,t,n);return}case"use":{ae(s,t,e[1],n);return}case"which":{se(s,t,e[1]);return}default:throw new Error(`Unknown toolchain action "${o}". Known: status, detect, install, use, which.`)}},"execute");export{ge as default};
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var r=(e,a)=>l(e,"name",{value:a,configurable:!0});import{a as p,af as u}from"../packem_shared/bin-BaZZ32BK.js";var d=Object.defineProperty,g=r((e,a)=>d(e,"name",{value:a,configurable:!0}),"c");const x=g(async({argument:e,logger:a,options:c,visConfig:n,workspaceRoot:t})=>{const i=e||[],o=t??process.cwd(),f=p(o,{configBackend:n?.install?.backend}),s=u(f,i,c.recursive||!1,o,a);s!==0&&(process.exitCode=s)},"execute");export{x as default};
@@ -0,0 +1,24 @@
1
+ var ue=Object.defineProperty;var B=(e,t)=>ue(e,"name",{value:t,configurable:!0});import{createRequire as de}from"node:module";import fe from"@visulima/colorize";import{isAccessibleSync as Z,readJsonSync as he}from"@visulima/fs";import{readYamlSync as $e}from"@visulima/fs/yaml";import{findPackageManagerSync as ke,getPackageManagerVersion as ve}from"@visulima/package";import{join as H}from"@visulima/path";import{render as K,renderToString as J,Text as b}from"@visulima/tui";import{ag as we,J as ye,N as be,s as Se,a as Re}from"../packem_shared/bin-BaZZ32BK.js";import $ from"react";import{G as Ce,r as Ae,i as Q}from"../packem_shared/ai-analysis-DDqXRFxY.js";import{N as A,C as Ee,O as Te,T as xe,v as re,V as je,L as oe,o as Ue,a as Ne,w as _e,c as Oe,E as qe,S as Me,s as Be}from"../packem_shared/catalog-CuSpuB_R.js";import{U as Pe,p as Fe,f as X}from"../packem_shared/VisUpdateApp-BBx3idMI.js";import{r as Le,s as Ve}from"../packem_shared/typosquats-Bpq4zcWL.js";import{d as Ye}from"../packem_shared/utils-DrNg0XTR.js";const ge=de(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,me=B(e=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[t,n]=_.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return _.getBuiltinModule(e)}return ge(e)},"__cjs_getBuiltinModule"),{execSync:ae}=me("node:child_process");var ze=Object.defineProperty,E=B((e,t)=>ze(e,"name",{value:t,configurable:!0}),"s");const Je=E(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"),We=E(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"),De=E(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"),Ie=E((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 a of e.filters)n.push("--workspace",a);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"),Ge=E(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"),Ze=E((e,t,n)=>{const a=[];if(n.global&&e!=="aube")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:a};let l;switch(e){case"aube":{const r=we(n);l={args:r.args,bin:r.bin},a.push(...r.warnings);break}case"bun":{l=Ge(n);break}case"npm":{l=Ie(n,a);break}case"pnpm":{l=Je(n);break}case"yarn":{l=t.startsWith("1.")?We(n):De(n);break}default:{const r=e;throw new Error(`Unsupported package manager: ${String(r)}`)}}return{command:l,warnings:a}},"resolveUpdateCommand");var He=Object.defineProperty,S=B((e,t)=>He(e,"name",{value:t,configurable:!0}),"w");const{red:Ke,yellow:W}=fe,Qe=S((e,t)=>{try{if(t==="pnpm"){const n=H(e,"pnpm-workspace.yaml");if(Z(n)){const a=$e(n);if(typeof a?.minimumReleaseAge=="number")return a.minimumReleaseAge}}else if(t==="bun"){const n=H(e,"package.json");if(Z(n)){const a=he(n);if(typeof a.minimumReleaseAge=="number")return a.minimumReleaseAge}}}catch{}},"readPmNativeMinimumReleaseAge"),Xe=S((e,t,n)=>{const a=e.latest?"latest":e.target??t.target??"latest";if(!["latest","minor","patch"].includes(a))throw new Error(`Invalid target "${a}". Use: latest, minor, or patch.`);return{exclude:[...A(e.exclude),...A(t.exclude)],ignore:A(t.ignore),include:[...A(e.include),...A(t.include),...n],includeLocked:e.includeLocked||t.includeLocked||!1,includePrerelease:e.prerelease||t.prerelease||!1,minimumReleaseAge:t.minimumReleaseAge,minimumReleaseAgeExclude:t.minimumReleaseAgeExclude,packageMode:t.packageMode,security:e.security||e.ai||t.security||!1,target:a}},"buildCatalogCheckOptions"),ee=S((e,t)=>{if(e.length!==0){t.info(`
2
+ ${W("⚠")} ${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,a)=>{n==="json"?process.stdout.write(`${Ee({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
3
+ `):n==="minimal"?process.stdout.write(`${Te(e)}
4
+ `):(xe(e,a),a.info(re(e)))},"writeFormattedOutput"),ne=S(async(e,t,n,a,l)=>{const r=je(e,n,t),s=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(l.info(`
5
+ Updated ${s}`),r&&l.info(`Backup saved to ${r}`),a.changelog){l.info(`
6
+ Fetching changelogs...`);const u=await oe(n);for(const c of u){const f=c.releaseUrl??c.repoUrl??c.npmUrl;l.info(` ${c.packageName}: ${f}`)}}if(a.install??!0){const u={bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}[t]??`${t} install`;l.info(`Running ${u}...
7
+ `);try{ae(u,{cwd:e,env:process.env,stdio:"inherit"})}catch{l.warn(`${u} failed. You may need to run it manually.`)}}},"applyCatalogAndInstall"),et=S(async(e,t,n,a,l,r)=>{const s=n.update??{},u=[["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[o,h]of u)a[o]&&r.warn(`${W("⚠")} ${h}, ignoring.`);const c=Qe(e,t),f=s.minimumReleaseAge??c;if(s.minimumReleaseAge!==void 0&&c!==void 0&&s.minimumReleaseAge!==c){const o=t==="pnpm"?"pnpm-workspace.yaml":"package.json";r.warn(`${W("⚠")} minimumReleaseAge mismatch: vis config = ${String(s.minimumReleaseAge)} min, ${o} = ${String(c)} min. Consider keeping them in sync.`)}const w=Ue(e),p=Ne(e,t,{depFields:s.depFields,dev:a.dev,prod:a.prod});if(p.size===0){r.info("No catalogs found.");return}const O={...s,minimumReleaseAge:f},T=Xe(a,O,l);let P=0;for(const o of p.values())P+=o.size;const q=!!process.stdout.isTTY&&!Se;let C;const se=q?(o,h)=>{C?C.rerender($.createElement(X,{current:o,total:h})):C=K($.createElement(X,{current:o,total:h}),{interactive:!0,patchConsole:!1})}:(o,h)=>{r.info(`Checking ${String(o)}/${String(h)} dependencies...`)};q||r.info(`Checking ${String(P)} catalog dependencies...
8
+ `);const ie=ye(n.security?.socket),{checkedCount:k,failed:v,filteredByTarget:g,ignored:x,outdated:d}=await _e(p,T,w,se,e,ie,n.security?.socket?.acceptedRisks);C&&(C.clear(),C.unmount());const D=k-d.length-v.length;if(v.length>0&&r.warn(`Failed to fetch: ${v.join(", ")}`),x.length>0&&r.info(`Skipped ${String(x.length)} ignored package${x.length===1?"":"s"}: ${x.join(", ")}`),!q&&k>d.length){const o=[...p.values()].reduce((N,L)=>N+L.size,0),h=o>k?` (${String(o)} catalog entries, ${String(o-k)} duplicates)`:"";r.info(`Checked ${String(k)} unique packages${h}: ${String(d.length)} outdated, ${String(D)} up-to-date${v.length>0?`, ${String(v.length)} failed`:""}${g.length>0?`, ${String(g.length)} skipped by target`:""}`)}if(d.length===0){g.length>0?r.info(`All catalog dependencies are up to date within the current target.
9
+ ${String(g.length)} package${g.length===1?" has":"s have"} newer versions available with --target latest:
10
+ ${g.map(o=>` ${o.packageName} ${o.currentRange} → ${o.newRange} (${o.updateType})`).join(`
11
+ `)}`):r.info("All catalog dependencies are up to date.");return}const j=a.format??s.format??"table";let y;if(a.ai){const o=Ce(a.aiType??"impact");y=await Ae(d,r,n.ai,o)}const F=!!a.dryRun;if(q&&j==="table"){const o=new Pe(d,y??null);let h;if(a.changelog){r.info("Fetching changelogs...");const i=await oe(d);h=new Map;for(const m of i){const R=m.releaseUrl??m.repoUrl??m.npmUrl;R&&h.set(m.packageName,R)}}const N=n.tui?.autoExit??!1,L=N===!0?3:typeof N=="number"?N:0,I=await K($.createElement(Fe,{autoExitSeconds:L,changelogUrls:h,checkedCount:k,filteredOutEntries:g,isDryRun:F,store:o,totalCatalogEntries:P}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),V=process.stdout.columns||80;process.stdout.write(`
12
+ `);for(const i of d){const m=i.vulnerabilities?.length||i.socketReport&&i.socketReport.alerts.length>0,R=!!i.acceptedRisk,z=m?R?"✓":"⚠":"✓",ce=R?"gray":i.updateType==="major"?"red":i.updateType==="minor"?"yellow":"green",M=i.socketReport?.score.overall,pe=M===void 0?"":` [${String(Math.round(M*100))}%]`,G=M===void 0?void 0:be(M);process.stdout.write(`${J($.createElement(b,null," ",$.createElement(b,{color:ce},z),` ${i.packageName} ${i.currentRange} → ${i.newRange}`,$.createElement(b,{dimColor:!0},` ${i.updateType}`),G?$.createElement(b,{color:G},pe):null),{columns:V})}
13
+ `)}if(process.stdout.write(`
14
+ `),r.info(re(d)),k>d.length){const i=[...p.values()].reduce((R,z)=>R+z.size,0),m=i>k?` (${String(i)} catalog entries, ${String(i-k)} duplicates)`:"";r.info(` Checked ${String(k)} unique packages${m}: ${String(D)} up-to-date${v.length>0?`, ${String(v.length)} failed`:""}`)}if(g.length>0){process.stdout.write(`
15
+ `);const i=`${String(g.length)} package${g.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${J($.createElement(b,{color:"yellow"},` ${i}`),{columns:V})}
16
+ `);for(const m of g)process.stdout.write(`${J($.createElement(b,null," ",$.createElement(b,{dimColor:!0},m.packageName),` ${m.currentRange} → ${m.newRange}`,$.createElement(b,{dimColor:!0},` ${m.updateType}`)),{columns:V})}
17
+ `)}const Y=Array.isArray(I)?I:[];if(Y.length>0&&!F){r.info(`
18
+ Applying ${String(Y.length)} updates...
19
+ `);const i={...a,install:a.install??s.install};await ne(e,t,Y,i,r)}return}if(F){if(j==="json"){const o={failed:v,filteredByTarget:g,ignored:x,outdated:d};y&&(o.aiAnalysis=y),process.stdout.write(`${JSON.stringify(o,void 0,2)}
20
+ `)}else r.info(`Would update ${String(d.length)} dependencies:
21
+ `),te(d,v,j,r),y&&(r.info(""),r.info(Q(y))),ee(g,r);return}y&&j!=="json"&&(r.info(Q(y)),r.info(""));let U=d;if(a.interactive&&(U=await Oe(d),U.length===0)){r.info("No updates selected.");return}r.info(`Updating ${String(U.length)} catalog dependencies...
22
+ `),te(U,[],j,r),ee(g,r);const le={...a,install:a.install??s.install};await ne(e,t,U,le,r)},"executeCatalogUpdate"),tt=S((e,t,n,a,l,r)=>{const s={dev:a.dev,filters:A(a.filter),global:a.global,interactive:a.interactive,latest:a.latest||a.target==="latest",noOptional:a.noOptional,noSave:a.noSave,packages:l,prod:a.prod,recursive:a.recursive,workspaceRoot:a.workspaceRoot},{command:u,warnings:c}=Ze(t,n,s);for(const w of c)r.warn(w);const f=`${u.bin} ${u.args.join(" ")}`.trim();if(a.dryRun){r.info(`Would run: ${f}`);return}r.info(`Running: ${f}`);try{ae(f,{cwd:e,env:process.env,stdio:"inherit"})}catch(w){const p=w.status??1;r.error(`
23
+ ${Ke("✖")} Update failed (exit code ${String(p)})`),r.error(` Command: ${f}`),r.error(` Directory: ${e}
24
+ `),process.exitCode=p}},"executePmWrapper"),$t=S(async({argument:e,logger:t,options:n,visConfig:a,workspaceRoot:l})=>{if(!l)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");let r=e;const s=l,{packageManager:u}=ke(s);if(!n.noTyposquatCheck){if(r.length>0){const c=r.map(p=>Ye(p)),f=a?.security?.typosquatAllowlist,w=await Le(c.map(p=>p.name),f);if(!w.ok){process.exitCode=1;return}r=c.map((p,O)=>{const T=w.packages[O];return T!==p.name?p.versionSpec?`${T}@${p.versionSpec}`:T??"":r[O]??""})}else if(!await Ve(s,a?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!qe(s,u)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(Me(s,u))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!n.noCatalog&&Be(s,u))await et(s,u,a??{},n,r,t);else{const c=Re(s,{configBackend:a?.install?.backend}),f=c.name==="aube"?"":ve(c.name);tt(s,c.name,f,n,r,t)}},"execute");export{$t as default};
@@ -0,0 +1,3 @@
1
+ var a=Object.defineProperty;var s=(n,e)=>a(n,"name",{value:e,configurable:!0});import{createRequire as f}from"node:module";import{ah as v}from"../packem_shared/bin-BaZZ32BK.js";const d=f(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=s(n=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,r]=t.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return t.getBuiltinModule(n)}return d(n)},"__cjs_getBuiltinModule"),{execSync:p,spawnSync:m}=l("node:child_process");var g=Object.defineProperty,y=s((n,e)=>g(n,"name",{value:e,configurable:!0}),"r");const w=y(async({argument:n,logger:e,options:r})=>{const c=n?.[0];e.info("info: checking for updates...");const o=v.version;let i;try{const u=p("npm view @visulima/vis version",{encoding:"utf8"}).trim();i=c??u}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(o===i&&!r.force){e.info(`
2
+ ✓ Already up to date (${o})`);return}if(r.check){o===i?e.info(`✓ Already up to date (${o})`):e.info(`info: found @visulima/vis@${i} (current: ${o})`);return}if(e.info(`info: found @visulima/vis@${i} (current: ${o})`),e.info("info: installing..."),m("npm",["install","-g",`@visulima/vis@${i}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
3
+ ✓ Updated @visulima/vis from ${o} → ${i}`)},"execute");export{w as default};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var t=(a,o)=>p(a,"name",{value:o,configurable:!0});import{a as f,ai as d}from"../packem_shared/bin-BaZZ32BK.js";import{o as g}from"../packem_shared/utils-DrNg0XTR.js";var v=Object.defineProperty,u=t((a,o)=>v(a,"name",{value:o,configurable:!0}),"c");const k=u(async({argument:a,logger:o,options:e,visConfig:n,workspaceRoot:i})=>{const s=a;if(!s||s.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const l=i??process.cwd(),c=f(l,{configBackend:n?.install?.backend}),r=d(c,{depth:e.depth===void 0?void 0:Number(e.depth),dev:e.dev||!1,filter:g(e.filter),global:e.global||!1,json:e.json||!1,long:e.long||!1,noOptional:e.noOptional||!1,packages:s,parseable:e.parseable||!1,prod:e.prod||!1,recursive:e.recursive||!1},l,o);r!==0&&r!==1&&(process.exitCode=r)},"execute");export{k as default};
@@ -0,0 +1,4 @@
1
+ var R=Object.defineProperty;var h=(n,t)=>R(n,"name",{value:t,configurable:!0});import{findPackageManagerSync as N}from"@visulima/package";import{G as P,r as j,i as M}from"../packem_shared/ai-analysis-DDqXRFxY.js";import{a as O,f as T,b,n as z,_ as J,m as S}from"../packem_shared/catalog-CuSpuB_R.js";import{J as U,x as q}from"../packem_shared/bin-BaZZ32BK.js";var A=Object.defineProperty,F=h((n,t)=>A(n,"name",{value:t,configurable:!0}),"x");const G=/^[\^~>=<]+/,H=F(async({argument:n,logger:t,options:f,visConfig:u,workspaceRoot:g})=>{if(!g)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const m=n,e=m[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const p=m[1],{packageManager:x}=N(g);let a,w="default";const E=O(g,x);for(const[o,i]of E){const s=i.get(e);if(s){a=s,w=o;break}}if(!a)throw new Error(`Package "${e}" not found in any catalog or package.json. Make sure it exists in your workspace dependencies.`);let r;if(p)r=p;else{t.info(`Fetching latest version for ${e}...
2
+ `);const o=await T(e);if(!o.latest)throw new Error(`Could not determine latest version for "${e}".`);r=o.latest}const d=b(a),k=b(r);if(!d||!k)throw new Error(`Could not parse versions: current="${a}", target="${r}".`);const v=z(d,k);if(v==="none"){t.info(`${e} is already at ${r}. Nothing to analyze.`);return}const C=J(a),l={catalogName:w,currentRange:a,newRange:`${C}${r}`,packageName:e,targetVersion:r,updateType:v},y=P(f.aiType??"impact");if(y==="security"||f.security){t.info(`Checking for known vulnerabilities...
3
+ `);const o=a.replace(G,""),i=(await S([{name:e,version:o}])).get(e);i&&i.length>0&&(l.vulnerabilities=i);const s=U(u?.security?.socket);if(s){const c=(await q([{name:e,version:o}],s)).get(`${e}@${o}`);c&&(l.socketReport={alerts:c.alerts,license:c.license,score:c.score})}}const $=await j([l],t,u?.ai,y);(f.format??"table")==="json"?process.stdout.write(`${JSON.stringify($,void 0,2)}
4
+ `):t.info(M($))},"execute");export{H as default};
@@ -0,0 +1,2 @@
1
+ var g=Object.defineProperty;var l=(o,t)=>g(o,"name",{value:t,configurable:!0});import{createRequire as y}from"node:module";import{m as b,O as u,E as _,I as s,b as j,c as d,y as f,U as k}from"../packem_shared/bin-BaZZ32BK.js";const v=y(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=l(o=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[t,c]=r.versions.node.split(".").map(Number);if(t>22||t===22&&c>=3||t===20&&c>=16)return r.getBuiltinModule(o)}return v(o)},"__cjs_getBuiltinModule"),{spawnSync:w}=h("node:child_process");var B=Object.defineProperty,N=l((o,t)=>B(o,"name",{value:t,configurable:!0}),"l");const O=N(async({options:o,visConfig:t,workspaceRoot:c})=>{const p=c??process.cwd(),a=b(p);if(a.name==="pnpm"&&!o.scan){u("Delegating to pnpm approve-builds...");const i=["approve-builds"];o.all&&i.push("--all");const e=w("pnpm",i,{cwd:p,stdio:"inherit"});if(e.error)throw new Error(`Failed to run pnpm approve-builds: ${e.error.message}`);if(e.status!==0&&e.status!==null&&(_(`pnpm approve-builds exited with code ${e.status}`),process.exitCode=e.status),!o.syncNative){s(""),s("Tip: vis.config.ts security.allowBuilds may now be out of sync with pnpm-workspace.yaml."),s("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const i=t?.security?.allowBuilds??{},e=j(p,i);if(e.length===0)d("No unapproved build scripts found.");else{f(`Found ${e.length} package${e.length===1?"":"s"} with unapproved build scripts:
2
+ `);for(const n of e)u(` ${n}`);s(""),s("To approve these packages, add them to vis.config.ts:"),s(""),s(" security: {"),s(" allowBuilds: {");for(const n of e){const m=n.split(" (")[0];s(` "${m}": true,`)}s(" },"),s(" },"),a.name==="pnpm"&&(s(""),s("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly."))}}if(o.syncNative){const i=t?.security?.allowBuilds??{};if(Object.keys(i).length===0)f("No security.allowBuilds configured in vis.config.ts. Nothing to sync.");else{const e=k(a.name,p,i);u("");for(const n of e)d(n)}}},"execute");export{O as default};
@@ -0,0 +1,24 @@
1
+ var re=Object.defineProperty;var D=(s,i)=>re(s,"name",{value:i,configurable:!0});import{dim as E,yellow as K,cyan as B,magenta as Q,red as X}from"@visulima/colorize";import{isAccessibleSync as N,readFileSync as Y,writeFileSync as q}from"@visulima/fs";import{readYamlSync as Z}from"@visulima/fs/yaml";import{join as O}from"@visulima/path";import{m as oe}from"../packem_shared/catalog-CuSpuB_R.js";import{s as ae,f as ce}from"../packem_shared/dependency-scan-BoLG2Fez.js";import{S as le,A as de,m as ue,O as d,J as ge,x as pe,V as fe,c as F,I as L,$ as T,E as _,y as j}from"../packem_shared/bin-BaZZ32BK.js";var me=Object.defineProperty,S=D((s,i)=>me(s,"name",{value:i,configurable:!0}),"o");const W=S(s=>Array.isArray(s)?s.filter(i=>typeof i=="string"):[],"toStringArray"),M=S((s,i)=>{for(const n of i)if(n===s||n.endsWith("*")&&s.startsWith(n.slice(0,-1)))return!0;return!1},"matchesGlobList"),ee=S(s=>{const i=O(s,"pnpm-workspace.yaml");if(!N(i))return{excludedPackages:[],ignoredAdvisories:[]};try{const n=Z(i);return{excludedPackages:[],ignoredAdvisories:[...W(n?.auditConfig?.ignoreCves),...W(n?.auditConfig?.ignoreGhsas)]}}catch{return{excludedPackages:[],ignoredAdvisories:[]}}},"readPnpmAuditExclusions"),se=S(s=>{const i=O(s,".yarnrc.yml");if(!N(i))return{excludedPackages:[],ignoredAdvisories:[]};try{const n=Z(i);return{excludedPackages:W(n?.npmAuditExcludePackages),ignoredAdvisories:W(n?.npmAuditIgnoreAdvisories)}}catch{return{excludedPackages:[],ignoredAdvisories:[]}}},"readYarnAuditExclusions"),he=S((s,i)=>{switch(i){case"pnpm":return ee(s);case"yarn":return se(s);default:return{excludedPackages:[],ignoredAdvisories:[]}}},"readNativeAuditExclusions"),z=S((s,i,n)=>{if(M(s,i.ignoredAdvisories))return!0;if(n){for(const a of n)if(M(a,i.ignoredAdvisories))return!0}return!1},"isAdvisoryExcluded"),ve=S((s,i)=>M(s,i.excludedPackages),"isPackageExcluded"),$e=S((s,i,n)=>{if(n.length===0)return["No advisory IDs to sync."];const a=[];switch(s){case"bun":{a.push(`bun has no audit config file. Use CLI flags: bun audit ${n.map(u=>`--ignore ${u}`).join(" ")}`);break}case"npm":{a.push("npm has no native audit exclusion config. vis accepted risks are the only layer.");break}case"pnpm":{const u=O(i,"pnpm-workspace.yaml");if(!N(u)){a.push("pnpm-workspace.yaml not found. Cannot sync.");break}const $=ee(i),y=new Set($.ignoredAdvisories.filter(r=>r.startsWith("CVE-"))),h=new Set($.ignoredAdvisories.filter(r=>r.startsWith("GHSA-"))),k=n.filter(r=>r.startsWith("CVE-")),v=n.filter(r=>r.startsWith("GHSA-")),f=[...new Set([...y,...k])],c=[...new Set([...h,...v])],m=k.filter(r=>!y.has(r)).length,C=v.filter(r=>!h.has(r)).length;if(m===0&&C===0){a.push("All advisory IDs already present in pnpm-workspace.yaml.");break}let g=Y(u);if(f.length>0){const r=` ignoreCves:
2
+ ${f.map(R=>` - ${R}`).join(`
3
+ `)}
4
+ `;/auditConfig:/.test(g)?g=/ignoreCves:/.test(g)?g.replace(/ignoreCves:\s*\n(?:\s+-\s+(?:\S.*|[\t\v\f \u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])\n)*/,r):g.replace(/auditConfig:\s*\n/,`auditConfig:
5
+ ${r}`):g=`${g.trimEnd()}
6
+
7
+ auditConfig:
8
+ ${r}`,m>0&&a.push(`Added ${String(m)} new CVE${m===1?"":"s"} to pnpm-workspace.yaml (${String(f.length)} total)`)}if(c.length>0){const r=` ignoreGhsas:
9
+ ${c.map(R=>` - ${R}`).join(`
10
+ `)}
11
+ `;/auditConfig:/.test(g)&&(g=/ignoreGhsas:/.test(g)?g.replace(/ignoreGhsas:\s*\n(?:\s+-\s+(?:\S.*|[\t\v\f \u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])\n)*/,r):g.replace(/(auditConfig:[\s\S]*?)(\n\S|\n?$)/m,`$1${r}$2`)),C>0&&a.push(`Added ${String(C)} new GHSA${C===1?"":"s"} to pnpm-workspace.yaml (${String(c.length)} total)`)}q(u,g);break}case"yarn":{const u=O(i,".yarnrc.yml");if(!N(u)){a.push(".yarnrc.yml not found. Cannot sync.");break}const $=se(i),y=new Set($.ignoredAdvisories),h=[...new Set([...y,...n])],k=n.filter(c=>!y.has(c)).length;if(k===0){a.push("All advisory IDs already present in .yarnrc.yml.");break}let v=Y(u);const f=`npmAuditIgnoreAdvisories:
12
+ ${h.map(c=>` - "${c}"`).join(`
13
+ `)}
14
+ `;v=/npmAuditIgnoreAdvisories:/.test(v)?v.replace(/npmAuditIgnoreAdvisories:\s*\n(?:\s+-\s+(?:\S.*|[\t\v\f \u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])\n)*/,f):`${v.trimEnd()}
15
+
16
+ ${f}`,q(u,v),a.push(`Synced ${String(k)} advisor${k===1?"y":"ies"} to .yarnrc.yml (${String(h.length)} total)`);break}default:a.push(`Unknown package manager: ${s}`)}return a},"syncAcceptedRisksToNativeConfig");var ye=Object.defineProperty,w=D((s,i)=>ye(s,"name",{value:i,configurable:!0}),"m");const V={CRITICAL:0,HIGH:1,LOW:3,MODERATE:2,UNKNOWN:4},ke={critical:X,high:Q,low:B,medium:K},U=w((s,i)=>{const n=V[i.toUpperCase()]??V.MODERATE??2;return(V[s.toUpperCase()]??4)<=n},"severityPassesFilter"),Ae={CRITICAL:X,HIGH:Q,LOW:B,MODERATE:K,UNKNOWN:E},Se=w((s,i,n,a)=>{const u=Ae[n.severity]??E,$=a?` ${E("[acknowledged]")}`:"",y=n.fixedVersions??[],h=y.length>0?` (fix: ${y.join(", ")})`:"";return` ${u(n.severity)} ${n.id} — ${s}@${i}${$}
17
+ ${n.summary}${h}`},"formatVulnLine"),Ce=w((s,i)=>{const n=le(s),a=`${String(Math.round(s.score.overall*100))}%`,u=i?` ${E("[acknowledged]")}`:"",$=s.alerts.length>0?`, ${String(s.alerts.length)} alert${s.alerts.length===1?"":"s"}`:"";return` ${a} ${n}@${s.version} (${de(s.score.overall)}${$})${u}`},"formatSocketLine"),we=w(async(s,i,n,a)=>{const u=i.severity??"low",$=i.format==="json"||!!i.json,y=!!i.fix,h=!!i.showAccepted,k=n?.security?.socket,v=k?.acceptedRisks,f=ue(s),c=he(s,f.name);(c.ignoredAdvisories.length>0||c.excludedPackages.length>0)&&d(`Loaded ${String(c.ignoredAdvisories.length)} ignored advisor${c.ignoredAdvisories.length===1?"y":"ies"} and ${String(c.excludedPackages.length)} excluded package${c.excludedPackages.length===1?"":"s"} from ${f.name} config.`),d("Scanning installed packages...");const m=ae(s);if(m.length===0){d("No packages found in node_modules. Run your package manager's install command first.");return}d(`Found ${String(m.length)} packages.
18
+ `);const C=m.map(e=>({name:e.name,version:e.version})),g=ge(k),r=ce(s,f.name),[R,te]=await Promise.all([oe(C),g?pe(C,g):Promise.resolve(new Map)]),G=[];for(const e of m){if(ve(e.name,c))continue;const t=R.get(e.name)??[],o=te.get(`${e.name}@${e.version}`),l=fe(e.name,e.version,v),p=t.length>0,ie=o?o.score.overall<T:!1,ne=o?o.alerts.length>0:!1;(p||ie||ne)&&G.push({acceptedRisk:l,name:e.name,socketReport:o,version:e.version,vulnerabilities:t})}const A=G.filter(e=>{const t=e.vulnerabilities.some(p=>U(p.severity,u)),o=e.socketReport?.alerts.some(p=>U(p.severity==="medium"?"MODERATE":p.severity.toUpperCase(),u)),l=e.socketReport&&e.socketReport.score.overall<T;return t||o||l});if($){const e={duplicates:r.map(t=>({name:t.name,versionCount:t.versions.length,versions:t.versions})),packages:m.length,results:A.map(t=>({acceptedRisk:t.acceptedRisk??null,name:t.name,socketAlerts:t.socketReport?.alerts??[],socketScore:t.socketReport?.score.overall??null,version:t.version,vulnerabilities:t.vulnerabilities})),summary:{accepted:A.filter(t=>t.acceptedRisk).length,duplicatePackages:r.length,issues:A.filter(t=>!t.acceptedRisk).length,total:A.length}};process.stdout.write(`${JSON.stringify(e,void 0,2)}
19
+ `),i.exitCode&&e.summary.issues>0&&(process.exitCode=1);return}if(A.length===0){F(`No security issues found across ${String(m.length)} packages.`);return}const b={CRITICAL:[],HIGH:[],LOW:[],MODERATE:[]};for(const e of A)for(const t of e.vulnerabilities)if(U(t.severity,u)){const o=t.severity==="UNKNOWN"?"LOW":t.severity;b[o]?.push({entry:e,vuln:t})}let I=0,H=0;for(const e of["CRITICAL","HIGH","MODERATE","LOW"]){const t=b[e];if(!(!t||t.length===0)){d(`
20
+ ── ${e} (${String(t.length)}) ──`);for(const{entry:o,vuln:l}of t){const p=!!o.acceptedRisk||z(l.id,c,l.aliases);p&&(H++,!h)||(I++,d(Se(o.name,o.version,l,p)),y&&(l.fixedVersions??[]).length>0&&L(` Fix: update to ${l.fixedVersions.at(-1)}`))}}}const x=A.filter(e=>e.socketReport&&(e.socketReport.score.overall<T||e.socketReport.alerts.length>0));if(x.length>0){d(`
21
+ ── Socket.dev Supply Chain (${String(x.length)}) ──`);for(const e of x){if(!e.socketReport)continue;const t=!!e.acceptedRisk;if(!(t&&!h)){d(Ce(e.socketReport,t));for(const o of e.socketReport.alerts){const l=ke[o.severity]??E;d(` ${l(`[${o.severity.toUpperCase()}]`)} ${o.type} — ${o.category}`)}}}}if(r.length>0){d(`
22
+ ── Duplicate Dependencies (${String(r.length)}) ──`);for(const e of r){const t=e.versions.join(", ");d(` ${e.name} — ${String(e.versions.length)} versions: ${K(t)}`)}}const P=w(e=>!!e.acceptedRisk||e.vulnerabilities.length>0&&e.vulnerabilities.every(t=>z(t.id,c,t.aliases)),"isEntryExcluded"),J=A.filter(e=>!P(e)).length;if(d(""),d("─ Audit Summary"),d(` ${String(m.length)} packages scanned`),c.ignoredAdvisories.length>0&&d(` ${String(c.ignoredAdvisories.length)} ${f.name} audit exclusion${c.ignoredAdvisories.length===1?"":"s"} applied`),I>0){const e=b.CRITICAL?.filter(o=>!P(o.entry)).length??0,t=b.HIGH?.filter(o=>!P(o.entry)).length??0;_(` ${String(I)} vulnerabilit${I===1?"y":"ies"} found`),e>0&&_(` ${String(e)} critical`),t>0&&j(` ${String(t)} high`)}else F(" No vulnerabilities found");if(x.length>0){const e=x.filter(t=>!P(t)).length;j(` ${String(e)} package${e===1?"":"s"} with Socket.dev supply chain issues`)}if(r.length>0&&(j(` ${String(r.length)} package${r.length===1?"":"s"} with duplicate versions`),L(" Run 'vis dedupe' or your package manager's dedupe command to reduce duplicates.")),H>0&&(d(` ${String(H)} acknowledged (accepted risks)`),h||L(" Use --show-accepted to see acknowledged issues.")),J===0&&F(`
23
+ All issues are acknowledged. No action required.`),i.sync&&v){const e=new Set;for(const o of G)if(o.acceptedRisk){for(const l of o.vulnerabilities)if((l.id.startsWith("CVE-")||l.id.startsWith("GHSA-"))&&e.add(l.id),l.aliases)for(const p of l.aliases)(p.startsWith("CVE-")||p.startsWith("GHSA-"))&&e.add(p)}const t=[...e];if(t.length>0){d("");const o=$e(f.name,s,t);for(const l of o)F(` ${l}`)}else d(`
24
+ No advisory IDs to sync to native PM config.`)}i.exitCode&&J>0&&(process.exitCode=1)},"executeAudit"),Oe=w(async({logger:s,options:i,visConfig:n,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");await we(a,i,n,s)},"execute");export{Oe as default};
@@ -0,0 +1,6 @@
1
+ var R=Object.defineProperty;var $=(e,r)=>R(e,"name",{value:r,configurable:!0});import{createRequire as A}from"node:module";import{isAccessibleSync as w}from"@visulima/fs";import{formatBytes as p}from"@visulima/humanizer";import{join as E}from"@visulima/path";import{Cache as B,parseCacheSize as _}from"@visulima/task-runner";import{E as T,d as O}from"../packem_shared/cache-directory-DL8hfXeG.js";import{O as n,d as y,y as v,c as b}from"../packem_shared/bin-BaZZ32BK.js";const k=A(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=$(e=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[r,t]=f.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return f.getBuiltinModule(e)}return k(e)},"__cjs_getBuiltinModule"),{readdir:z,stat:D,realpath:x,rm:N}=S("node:fs/promises"),{createInterface:j}=S("node:readline");var P=Object.defineProperty,u=$((e,r)=>P(e,"name",{value:r,configurable:!0}),"c");const M=u(async e=>{let r=0;try{const t=await z(e,{withFileTypes:!0});for(const o of t){const i=E(e,o.name);if(o.isDirectory())r+=await M(i);else if(o.isFile()){const a=await D(i);r+=a.size}}}catch{}return r},"sumDirectorySize"),g=u(async e=>{const r=[];let t;try{t=await z(e)}catch{return[]}for(const o of t){if(o.startsWith("."))continue;const i=E(e,o);try{const a=await D(i);if(!a.isDirectory())continue;const h=await M(i);r.push({hash:o,mtimeMs:a.mtimeMs,path:i,sizeBytes:h})}catch{}}return r.sort((o,i)=>i.mtimeMs-o.mtimeMs),r},"collectCacheEntries"),I=u((e,r=Date.now())=>{const t=Math.floor((r-e)/1e3);return t<60?`${String(t)}s`:t<3600?`${String(Math.floor(t/60))}m`:t<86400?`${String(Math.floor(t/3600))}h`:`${String(Math.floor(t/86400))}d`},"formatAge"),F=u(e=>new Promise(r=>{const t=j({input:process.stdin,output:process.stderr});t.question(`${e} (y/N) `,o=>{t.close();const i=o.trim().toLowerCase();r(i==="y"||i==="yes")})}),"confirmPrompt"),J=u(async(e,r,t)=>{if(!w(e)){if(r==="json"){process.stdout.write(`${JSON.stringify({directory:e,entries:[],totalBytes:0,totalCount:0},void 0,2)}
2
+ `);return}n(`No cache directory found at ${e}`);return}const o=await g(e);if(o.length===0){if(r==="json"){process.stdout.write(`${JSON.stringify({directory:e,entries:[],totalBytes:0,totalCount:0},void 0,2)}
3
+ `);return}n(`Cache directory is empty: ${e}`);return}const i=o.reduce((s,c)=>s+c.sizeBytes,0);if(r==="json"){const s=Date.now();process.stdout.write(`${JSON.stringify({directory:e,entries:o.map(c=>({ageMs:s-c.mtimeMs,hash:c.hash,mtimeIso:new Date(c.mtimeMs).toISOString(),sizeBytes:c.sizeBytes})),totalBytes:i,totalCount:o.length},void 0,2)}
4
+ `);return}n(`Cache directory: ${e}`),n(`Entries: ${String(o.length)} (${p(i,{decimals:1,space:!1})})`),t.info("");const a=Date.now(),h=o.map(s=>({age:I(s.mtimeMs,a),hash:s.hash.slice(0,12),size:p(s.sizeBytes,{decimals:1,space:!1})})),d=Math.max(4,...h.map(s=>s.hash.length)),l=Math.max(4,...h.map(s=>s.size.length)),m=Math.max(3,...h.map(s=>s.age.length));t.info(` ${"hash".padEnd(d)} ${"size".padEnd(l)} ${"age".padEnd(m)}`),t.info(` ${"-".repeat(d)} ${"-".repeat(l)} ${"-".repeat(m)}`);for(const s of h)t.info(` ${s.hash.padEnd(d)} ${s.size.padEnd(l)} ${s.age.padEnd(m)}`)},"runList"),L=u(async(e,r,t)=>{if(!w(e)){n(`No cache directory to clean at ${e}`);return}if(t.dryRun){const i=await g(e),a=i.reduce((h,d)=>h+d.sizeBytes,0);n(`Would remove ${String(i.length)} cache entr${i.length===1?"y":"ies"} (${p(a,{decimals:1,space:!1})}) from ${e}`);return}const o=T(e,r);try{const i=await x(e),a=await x(r);if(i===a){y("Refusing to delete the workspace root. The cache directory resolved to the same path as the workspace."),process.exitCode=1;return}}catch{}if(!o&&!t.force){if(v(`Cache directory is outside the workspace root: ${e}`),v("This will recursively delete the entire directory, including anything stored there by other tools."),!process.stdin.isTTY){y("Refusing to clean an out-of-workspace cache without --force (stdin is not a TTY)."),process.exitCode=1;return}if(!await F(" Continue?")){n("Aborted.");return}}o?await new B({cacheDirectory:e,workspaceRoot:r}).clear():await N(e,{force:!0,recursive:!0}),b(`Cleared cache: ${e}`)},"runClean"),q=u(async(e,r,t)=>{if(!w(e)){n(`No cache directory to prune at ${e}`);return}if(t.maxCacheAgeDays!==void 0&&(!Number.isFinite(t.maxCacheAgeDays)||t.maxCacheAgeDays<0)){y(`Invalid --max-age-days value: expected a finite number >= 0, got ${String(t.maxCacheAgeDays)}`),process.exitCode=1;return}if(t.maxCacheSize!==void 0){let s;try{s=_(t.maxCacheSize)}catch(c){y(`Invalid --max-size value: ${c instanceof Error?c.message:String(c)}`),process.exitCode=1;return}if(!Number.isFinite(s)||s<=0){y(`Invalid --max-size value: expected a positive size, got "${t.maxCacheSize}" (${String(s)} bytes)`),process.exitCode=1;return}}const o=t.maxCacheAgeDays===void 0?void 0:t.maxCacheAgeDays*24*60*60*1e3,i=await g(e),a=i.reduce((s,c)=>s+c.sizeBytes,0);await new B({cacheDirectory:e,maxCacheAge:o,maxCacheSize:t.maxCacheSize,workspaceRoot:r}).removeOldEntries();const h=await g(e),d=h.reduce((s,c)=>s+c.sizeBytes,0),l=i.length-h.length,m=a-d;if(l<=0){n("Nothing to prune — all entries are within the configured limits.");return}b(`Pruned ${String(l)} entr${l===1?"y":"ies"}, freed ${p(m,{decimals:1,space:!1})}.`)},"runPrune"),W=u(async(e,r)=>{if(!w(e)){if(r==="json"){process.stdout.write(`${JSON.stringify({directory:e,exists:!1,totalBytes:0,totalCount:0})}
5
+ `);return}n(`No cache directory at ${e}`);return}const t=await g(e),o=t.reduce((i,a)=>i+a.sizeBytes,0);if(r==="json"){process.stdout.write(`${JSON.stringify({directory:e,exists:!0,totalBytes:o,totalCount:t.length})}
6
+ `);return}n(`Cache directory: ${e}`),n(`Entries: ${String(t.length)}`),n(`Total size: ${p(o,{decimals:1,space:!1})}`)},"runSize"),C=u((e,r,t)=>{const o=e??process.cwd(),i=(t??{}).taskRunnerOptions??{};return{cacheDirectory:O(o,r.cacheDir,i.cacheDirectory),workspaceRoot:o}},"resolveCacheDirectoryFromContext"),Z=u(async({logger:e,options:r,visConfig:t,workspaceRoot:o})=>{const{cacheDirectory:i}=C(o,r,t),a=r.format??"table";await J(i,a,e)},"cacheListExecute"),ee=u(async({options:e,visConfig:r,workspaceRoot:t})=>{const{cacheDirectory:o,workspaceRoot:i}=C(t,e,r);await L(o,i,{dryRun:!!e.dryRun,force:!!e.force})},"cacheCleanExecute"),te=u(async({options:e,visConfig:r,workspaceRoot:t})=>{const{cacheDirectory:o,workspaceRoot:i}=C(t,e,r);await q(o,i,{maxCacheAgeDays:typeof e.maxAgeDays=="number"?e.maxAgeDays:void 0,maxCacheSize:e.maxSize})},"cachePruneExecute"),re=u(async({options:e,visConfig:r,workspaceRoot:t})=>{const{cacheDirectory:o}=C(t,e,r),i=e.format??"table";await W(o,i)},"cacheSizeExecute");export{ee as cacheCleanExecute,Z as cacheListExecute,te as cachePruneExecute,re as cacheSizeExecute,g as collectCacheEntries,I as formatAge,L as runClean,J as runList,q as runPrune,W as runSize};
@@ -0,0 +1,8 @@
1
+ var J=Object.defineProperty;var S=(c,r)=>J(c,"name",{value:r,configurable:!0});import{findPackageManagerSync as B}from"@visulima/package";import{render as b,renderToString as G,Text as g}from"@visulima/tui";import{m as V,M as q,T as H,O as y,c as K,J as Q,N as W,s as X}from"../packem_shared/bin-BaZZ32BK.js";import a from"react";import{G as Z,r as _,i as ee}from"../packem_shared/ai-analysis-DDqXRFxY.js";import{o as te,a as re,N as f,w as oe,v as j,O as ne,T as se}from"../packem_shared/catalog-CuSpuB_R.js";import{U as ie,p as ae,f as N}from"../packem_shared/VisUpdateApp-BBx3idMI.js";var ce=Object.defineProperty,le=S((c,r)=>ce(c,"name",{value:r,configurable:!0}),"$");const he=le(async({argument:c,logger:r,options:e,visConfig:i,workspaceRoot:C})=>{if(!C)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const d=C;if(e.securityConfig){const t=V(d);if(q(i??{},t.name),e.sync&&t.name==="pnpm"){const o=H(i??{});if(o.length>0){y(`
2
+ Settings that would sync to pnpm-workspace.yaml:`);for(const x of o)K(` ${x}`)}else y("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(y(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),y("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!c?.length)return}const{packageManager:O}=B(d),M=te(d),l=i?.update??{},w=re(d,O,{dev:e.dev,prod:e.prod});if(w.size===0){r.info("No catalogs found.");return}const h=e.target??l.target??"latest";if(!["latest","minor","patch"].includes(h))throw new Error(`Invalid target "${h}". Use: latest, minor, or patch.`);const U={exclude:[...f(e.exclude),...f(l.exclude)],ignore:f(l.ignore),include:[...f(e.include),...f(l.include),...c],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||l.prerelease||!1,security:!e.noSecurity,target:h};let E=0;for(const t of w.values())E+=t.size;const v=!!process.stdout.isTTY&&!X;let u;const P=v?(t,o)=>{u?u.rerender(a.createElement(N,{current:t,total:o})):u=b(a.createElement(N,{current:t,total:o}),{interactive:!0,patchConsole:!1})}:(t,o)=>{r.info(`Checking ${String(t)}/${String(o)} dependencies...`)};v||r.info(`Checking ${String(E)} catalog dependencies against npm registry...
3
+ `);const z=Q(i?.security?.socket),{failed:$,outdated:s}=await oe(w,U,M,P,d,z,i?.security?.socket?.acceptedRisks);if(u&&(u.clear(),u.unmount()),$.length>0&&r.warn(`Failed to fetch: ${$.join(", ")}`),s.length===0){r.info("All catalog dependencies are up to date.");return}const k=e.format??l.format??"table",L=Z(e.aiType??"impact"),p=e.ai?await _(s,r,i?.ai,L):void 0;if(v&&k==="table"){const t=new ie(s,p??null),o=i?.tui?.autoExit??!1,x=o===!0?3:typeof o=="number"?o:0;await b(a.createElement(ae,{autoExitSeconds:x,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const Y=process.stdout.columns||80;process.stdout.write(`
4
+ `);for(const n of s){const A=n.vulnerabilities?.length||n.socketReport&&n.socketReport.alerts.length>0,T=!!n.acceptedRisk,D=A?T?"✓":"⚠":"✓",F=T?"gray":n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",m=n.socketReport?.score.overall,I=m===void 0?"":` [${String(Math.round(m*100))}%]`,R=m===void 0?void 0:W(m);process.stdout.write(`${G(a.createElement(g,null," ",a.createElement(g,{color:F},D),` ${n.packageName} ${n.currentRange} → ${n.newRange}`,a.createElement(g,{dimColor:!0},` ${n.updateType}`),R?a.createElement(g,{color:R},I):null),{columns:Y})}
5
+ `)}process.stdout.write(`
6
+ `),r.info(j(s))}else if(k==="json"){const t={failed:$,outdated:s};p&&(t.aiAnalysis=p),process.stdout.write(`${JSON.stringify(t,void 0,2)}
7
+ `)}else k==="minimal"?process.stdout.write(`${ne(s)}
8
+ `):(se(s,r),r.info(j(s)),p&&(r.info(""),r.info(ee(p))));e.exitCode&&s.length>0&&(process.exitCode=1)},"execute");export{he as default};
@@ -0,0 +1 @@
1
+ var ue=Object.defineProperty;var k=(s,l)=>ue(s,"name",{value:l,configurable:!0});import{jsxs as t,jsx as r,Fragment as Q}from"react/jsx-runtime";import{useWindowSize as ce,Box as i,Spinner as pe,Text as e,ScrollView as ge,Tabs as fe,Tab as me,ScrollBar as we,useApp as ye,useInput as be,Dialog as _}from"@visulima/tui";import{useSyncExternalStore as Ce,useState as O,useRef as K,useMemo as ke,useCallback as oe,useEffect as xe}from"react";import{N as de,C as ne}from"./bin-BaZZ32BK.js";var Te=Object.defineProperty,Se=k((s,l)=>Te(s,"name",{value:l,configurable:!0}),"a$1");function ve({current:s,total:l}){const{columns:h}=ce(),c=h||80,p=l>0?s/l:0,a=`${String(Math.round(p*100))}%`,w=Math.max(10,c-4),b=Math.round(w*p),f=w-b;return t(i,{flexDirection:"column",paddingX:1,children:[t(i,{children:[r(pe,{type:"dots"}),t(e,{children:["Checking ",String(l)," catalog dependencies"]}),t(e,{dimColor:!0,children:[String(s),"/",String(l)]})]}),t(i,{children:[r(e,{color:"cyan",children:"━".repeat(b)}),r(e,{dimColor:!0,children:"─".repeat(f)}),t(e,{children:[" ",a]})]})]})}k(ve,"f$1");Se(ve,"CheckProgressApp");var Ae=Object.defineProperty,U=k((s,l)=>Ae(s,"name",{value:l,configurable:!0}),"r");const Y=U(s=>{const l=new Map;for(const h of s){const c=l.get(h.catalogName);c?c.push(h):l.set(h.catalogName,[h])}return l},"groupByCatalog"),W=U((s,l,h)=>{let c=s;if(l!=="all"&&(c=l==="security"?c.filter(p=>p.vulnerabilities&&p.vulnerabilities.length>0||p.socketReport&&p.socketReport.alerts.length>0):c.filter(p=>p.updateType===l)),h){const p=h.toLowerCase();c=c.filter(a=>a.packageName.toLowerCase().includes(p))}return c},"filterEntries");class Je{static{k(this,"UpdateStore")}static{U(this,"UpdateStore")}#e;#l=new Set;#t;#i=null;constructor(l,h=null){this.#t=l,h&&(this.#i=new Map(h.recommendations.map(c=>[c.package,c]))),this.#e={aiResult:h,allChecked:!0,applyProgress:null,checkedEntries:new Set(l.map(c=>c.packageName)),entries:l,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:Y(l),phase:"browsing",selectedIndex:0}}getSnapshot=U(()=>this.#e,"getSnapshot");subscribe=U(l=>(this.#l.add(l),()=>{this.#l.delete(l)}),"subscribe");getFilteredEntries(){return W(this.#t,this.#e.filterType,this.#e.filterText)}getRecommendation(l){return this.#i?.get(l)}getCheckedEntries(){return this.#t.filter(l=>this.#e.checkedEntries.has(l.packageName))}setSelectedIndex(l){const h=this.getFilteredEntries(),c=Math.max(0,Math.min(l,h.length-1));c!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:c})}setFocusedPanel(l){l!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:l})}setFilterType(l){if(l!==this.#e.filterType){const h=W(this.#t,l,this.#e.filterText);this.#r({...this.#e,entries:h,filterType:l,groupedByCatalog:Y(h),selectedIndex:0})}}setFilter(l){const h=W(this.#t,this.#e.filterType,l);this.#r({...this.#e,entries:h,filterText:l,groupedByCatalog:Y(h),selectedIndex:0})}setFilterActive(l){if(l!==this.#e.filterActive)if(l)this.#r({...this.#e,filterActive:!0});else{const h=W(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:h,filterActive:!1,filterText:"",groupedByCatalog:Y(h),selectedIndex:0})}}toggleCheck(l){const h=new Set(this.#e.checkedEntries);h.has(l)?h.delete(l):h.add(l),this.#r({...this.#e,allChecked:h.size===this.#t.length,checkedEntries:h})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(l=>l.packageName))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const l=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:l.length},phase:"applying"})}updateApplyProgress(l){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:l}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(l){this.#r({...this.#e,error:l,phase:"error"})}#r(l){this.#e=l;for(const h of this.#l)try{h()}catch{}}}var Re=Object.defineProperty,Ee=k((s,l)=>Re(s,"name",{value:l,configurable:!0}),"d");const De={major:"red",minor:"yellow",patch:"green"},Ie={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Ne={critical:"red",high:"red",low:"gray",medium:"yellow"},Pe={critical:"red",high:"red",low:"green",medium:"yellow"},Be={defer:"gray",review:"yellow",skip:"red",update:"green"},Le=Ee(({changelogUrl:s,entry:l,focused:h,recommendation:c,scrollRef:p})=>{const a=h?"white":"gray";if(!l)return r(i,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:r(e,{dimColor:!0,children:"No package selected"})});const w=De[l.updateType]??"white",b=l.vulnerabilities&&l.vulnerabilities.length>0,f=l.socketReport?.score.overall??0,m=l.socketReport?de(f):"gray";return t(i,{borderColor:a,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[r(i,{flexShrink:0,paddingTop:1,paddingX:2,children:r(e,{bold:!0,color:"white",children:l.packageName})}),t(ge,{flexGrow:1,flexShrink:1,paddingX:2,ref:p,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[r(e,{}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Current:"})}),r(e,{children:l.currentRange})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Target:"})}),r(e,{children:l.newRange}),t(e,{bold:!0,color:w,children:[" ","(",l.updateType,")"]})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Version:"})}),r(e,{children:l.targetVersion})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Catalog:"})}),r(e,{children:l.catalogName})]}),l.acceptedRisk&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{color:"gray",children:"── "}),r(e,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),t(i,{flexDirection:"column",paddingLeft:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Reason: "}),r(e,{children:l.acceptedRisk.reason})]}),t(i,{children:[r(e,{dimColor:!0,children:"Accepted: "}),r(e,{children:l.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),b&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"red",children:"SECURITY"}),r(e,{}),l.vulnerabilities.map(n=>t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{gap:1,children:[t(e,{bold:!0,color:Ie[n.severity]??"gray",children:["⚠"," ",n.severity]}),r(e,{bold:!0,children:n.id})]}),r(i,{paddingLeft:2,children:r(e,{children:n.summary})}),t(i,{gap:2,paddingLeft:2,children:[n.cvssScore!==void 0&&t(e,{dimColor:!0,children:["CVSS:",String(n.cvssScore)]}),n.fixedVersions.length>0&&t(e,{dimColor:!0,children:["Fixed in:",n.fixedVersions.join(", ")]})]})]},n.id))]}),l.socketReport&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),r(e,{}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Overall: "}),t(e,{bold:!0,color:m,children:[String(Math.round(f*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Supply Chain: "}),t(e,{children:[String(Math.round(l.socketReport.score.supplyChain*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Quality: "}),t(e,{children:[String(Math.round(l.socketReport.score.quality*100)),"%"]})]})]}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Maintenance: "}),t(e,{children:[String(Math.round(l.socketReport.score.maintenance*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Vulnerability: "}),t(e,{children:[String(Math.round(l.socketReport.score.vulnerability*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"License: "}),t(e,{children:[l.socketReport.license||"unknown"," ","(",String(Math.round(l.socketReport.score.license*100)),"%)"]})]})]}),l.socketReport.alerts.length>0&&t(i,{flexDirection:"column",marginTop:1,children:[t(e,{bold:!0,color:"yellow",children:["⚠"," ",String(l.socketReport.alerts.length)," ","alert",l.socketReport.alerts.length===1?"":"s",":"]}),l.socketReport.alerts.map(n=>t(i,{gap:1,paddingLeft:2,children:[t(e,{bold:!0,color:Ne[n.severity]??"gray",children:["[",n.severity.toUpperCase(),"]"]}),r(e,{children:n.type}),t(e,{dimColor:!0,children:["(",n.category,")"]})]},n.key))]})]}),c&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"AI ANALYSIS"}),r(e,{}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Action: "}),r(e,{bold:!0,color:Be[c.action]??"white",children:c.action})]}),t(i,{children:[r(e,{dimColor:!0,children:"Risk: "}),r(e,{bold:!0,color:Pe[c.riskLevel]??"white",children:c.riskLevel})]}),t(i,{children:[r(e,{dimColor:!0,children:"Effort: "}),r(e,{bold:!0,children:c.effort})]})]}),c.reason&&r(i,{marginTop:1,paddingLeft:2,children:r(e,{children:c.reason})}),c.breakingChanges.length>0&&t(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r(e,{bold:!0,color:"yellow",children:"Breaking changes:"}),c.breakingChanges.map((n,A)=>t(e,{children:[" ","•"," ",n]},String(A)))]})]}),s&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"CHANGELOG"}),r(i,{marginTop:1,paddingLeft:2,children:r(e,{color:"cyan",underline:!0,children:s})})]}),t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"LINKS"}),r(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:t(e,{color:"cyan",underline:!0,children:["https://npmx.dev/",l.packageName]})})]}),!c&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"GUIDANCE"}),t(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[l.updateType==="major"&&t(Q,{children:[t(e,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),r(e,{dimColor:!0,children:" Review the changelog before updating."}),r(e,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),l.updateType==="minor"&&t(Q,{children:[t(e,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),r(e,{dimColor:!0,children:" Generally safe to update."})]}),l.updateType==="patch"&&t(Q,{children:[t(e,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),r(e,{dimColor:!0,children:" Safe to update."})]}),!c&&r(e,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},"PackageDetailPanel");var Me=Object.defineProperty,J=k((s,l)=>Me(s,"name",{value:l,configurable:!0}),"b");const je={major:"red",minor:"yellow",patch:"green"},Fe=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Oe=J(({checked:s,entry:l,isSelected:h})=>{const c=je[l.updateType]??"white",p=l.vulnerabilities&&l.vulnerabilities.length>0,a=l.socketReport&&l.socketReport.alerts.length>0,w=!!l.acceptedRisk,b=s?"☑":"☐",f=l.socketReport?`${String(Math.round(l.socketReport.score.overall*100))}%`:"",m=l.socketReport?de(l.socketReport.score.overall):"gray";return t(i,{flexShrink:0,height:1,children:[r(e,{children:h?">":" "}),t(e,{color:s?"white":"gray",children:[" ",b," "]}),p||a?r(e,{color:w?"gray":"red",children:w?"✓ ":"⚠ "}):r(e,{children:" "}),r(i,{flexGrow:1,children:t(e,{bold:h,inverse:h,wrap:"truncate",children:[l.packageName,w?" [ack]":""]})}),f&&t(e,{color:m,children:[" ",f]}),t(e,{dimColor:!0,children:[" ",l.currentRange]}),t(e,{dimColor:!0,children:[" ","→"," "]}),t(e,{children:[l.newRange," "]}),r(e,{bold:!0,color:c,children:l.updateType})]})},"PackageRow"),Ue=J(({count:s,name:l})=>t(i,{flexShrink:0,height:1,marginTop:1,children:[t(e,{dimColor:!0,children:["▼"," "]}),r(e,{bold:!0,color:"white",children:l.toUpperCase()}),t(e,{dimColor:!0,children:[" ","(",s,")"]})]}),"CatalogHeader"),$e=J(({checkedEntries:s,entries:l,filterActive:h,filteredOutCount:c,filterText:p,filterType:a,focused:w,groupedByCatalog:b,isDryRun:f,scrollOffset:m,selectedIndex:n,totalCatalogEntries:A,totalChecked:v,totalEntries:$,viewportHeight:N})=>{const M=w?"white":"gray";let R=0,y=0,S=0,j=0;for(const g of l)g.updateType==="major"?R++:g.updateType==="minor"?y++:S++,(g.vulnerabilities&&g.vulnerabilities.length>0||g.socketReport&&g.socketReport.alerts.length>0)&&j++;const C=[];R>0&&C.push(`${R} major`),y>0&&C.push(`${y} minor`),S>0&&C.push(`${S} patch`),j>0&&C.push(`${j} vulnerable`);const G=C.length>0?` (${C.join(", ")})`:"";let E=0;for(const g of l)s.has(g.packageName)&&E++;const D=[];let I=0;for(const[g,P]of b){D.push(r(Ue,{count:P.length,name:g},`hdr-${g}`));for(const B of P){const L=I;D.push(r(Oe,{checked:s.has(B.packageName),entry:B,isSelected:L===n},B.packageName)),I++}}let x=0;for(const[,g]of b)x+=2+g.length;const T=x>N&&N>0;return t(i,{borderColor:M,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t(i,{flexShrink:0,gap:1,paddingX:1,children:[r(e,{bold:!0,inverse:!0,children:" VIS "}),t(e,{wrap:"truncate",children:[$,v>0?`/${v}`:""," ","outdated",G,A>v?` · ${A-v} dupes`:""]}),!f&&E>0&&t(e,{dimColor:!0,children:[" ","—",E," ","selected"]})]}),r(i,{flexShrink:0,paddingX:1,paddingY:1,children:r(fe,{isFocused:w,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:k(()=>{},"onChange"),showIndex:!1,value:a,children:Fe.map(({id:g,label:P})=>r(me,{name:g,children:P},g))})}),h&&t(i,{flexShrink:0,paddingX:1,children:[r(e,{bold:!0,color:"white",children:"/ "}),r(e,{children:p}),r(e,{inverse:!0,children:" "})]}),c>0&&r(i,{flexShrink:0,paddingX:1,children:t(e,{color:"yellow",children:["⚠"," ",c," ","package",c===1?"":"s"," ","filtered out by target constraint — press"," ",r(e,{bold:!0,color:"white",children:"f"})," ","to view"]})}),t(i,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(i,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(i,{flexDirection:"column",marginTop:-m,children:D})}),T&&r(i,{flexShrink:0,marginLeft:1,marginRight:1,children:r(we,{contentHeight:x,placement:"inset",scrollOffset:m,style:"block",viewportHeight:N})})]},`list-${a}-${p}`)]})},"PackageListPanel");var Ge=Object.defineProperty,Ve=k((s,l)=>Ge(s,"name",{value:l,configurable:!0}),"Y");const He=100,qe=40,Xe=10,Ke=[],Ze=Ve(({autoExitSeconds:s=0,changelogUrls:l,checkedCount:h=0,filteredOutEntries:c=Ke,isDryRun:p,store:a,totalCatalogEntries:w=0})=>{const{exit:b}=ye(),{columns:f,rows:m}=ce(),n=Ce(a.subscribe,a.getSnapshot),[A,v]=O(!1),[$,N]=O(!1),M=K(null),R=K(null),y=K(null),S=K(null),[j,C]=O(0),[G,E]=O(!1),[D,I]=O(!1),x=ke(()=>a.getFilteredEntries(),[n.entries,n.filterType,n.filterText]),T=x[n.selectedIndex]??null,g=T?a.getRecommendation(T.packageName):void 0,P=T&&l?l.get(T.packageName):void 0,B=oe(o=>{let d=0,u=0;for(const[,q]of n.groupedByCatalog){d+=2;for(let X=0;X<q.length;X++){if(u===o)return d;d+=1,u++}}return d},[n.groupedByCatalog]),L=Math.max(1,m-8-(n.filterActive?1:0)),F=oe(o=>{const d=B(o);C(u=>d>u+L-2?Math.max(0,d-L+2):d<u+1?Math.max(0,d-1):u)},[B,L]);if(xe(()=>{y.current?.scrollToTop()},[T?.packageName]),be((o,d)=>{if(o==="c"&&d.ctrl){b();return}if(!D){if($){d.escape||o==="f"||o==="q"?N(!1):d.downArrow||o==="j"?R.current?.scrollBy(1):(d.upArrow||o==="k")&&R.current?.scrollBy(-1);return}if(G){o==="u"||d.return?(E(!1),a.startApply(),b(a.getCheckedEntries())):d.escape||o==="q"?E(!1):d.downArrow||o==="j"?S.current?.scrollBy(1):d.upArrow||o==="k"?S.current?.scrollBy(-1):d.pageDown?S.current?.scrollBy(5):d.pageUp&&S.current?.scrollBy(-5);return}if(A){d.escape||o==="?"?v(!1):o==="q"?(v(!1),I(!0)):d.downArrow||o==="j"?M.current?.scrollBy(1):(d.upArrow||o==="k")&&M.current?.scrollBy(-1);return}if(o==="?"){v(!0);return}if(o==="q"){I(!0);return}if(d.tab){a.setFocusedPanel(n.focusedPanel==="list"?"detail":"list");return}if(n.focusedPanel==="list"&&(d.leftArrow||d.rightArrow)){const u=["all","major","minor","patch","security"],q=u.indexOf(n.filterType),X=d.rightArrow?(q+1)%u.length:(q-1+u.length)%u.length;C(0),y.current?.scrollToTop(),a.setFilterType(u[X]);return}if(o==="f"&&c.length>0){N(u=>!u);return}if(n.filterActive){if(d.escape){a.setFilterActive(!1);return}if(d.return){a.setFilterActive(!1);return}if(d.backspace){C(0),a.setFilter(n.filterText.slice(0,-1));return}if(o&&!d.ctrl&&!d.meta){C(0),a.setFilter(n.filterText+o);return}return}if(n.focusedPanel==="list"){if(d.downArrow||o==="j"){const u=Math.min(n.selectedIndex+1,x.length-1);a.setSelectedIndex(u),F(u);return}if(d.upArrow||o==="k"){const u=Math.max(n.selectedIndex-1,0);a.setSelectedIndex(u),F(u);return}if(d.pageDown){const u=Math.min(n.selectedIndex+10,x.length-1);a.setSelectedIndex(u),F(u);return}if(d.pageUp){const u=Math.max(n.selectedIndex-10,0);a.setSelectedIndex(u),F(u);return}if(d.home){a.setSelectedIndex(0),C(0);return}if(d.end){const u=x.length-1;a.setSelectedIndex(u),F(u);return}if(o===" "||d.return){T&&a.toggleCheck(T.packageName);return}if(o==="a"){a.toggleAll();return}if(o==="/"){a.setFilterActive(!0);return}if(o==="u"&&!p&&n.checkedEntries.size>0){E(!0);return}if(d.rightArrow){a.setFocusedPanel("detail");return}return}if(n.focusedPanel==="detail"){if(d.escape||d.leftArrow){a.setFocusedPanel("list");return}if(d.downArrow||o==="j"){y.current?.scrollBy(1);return}if(d.upArrow||o==="k"){y.current?.scrollBy(-1);return}if(d.pageDown){y.current?.scrollBy(10);return}if(d.pageUp){y.current?.scrollBy(-10);return}if(d.home){y.current?.scrollToTop();return}d.end&&y.current?.scrollToBottom()}}},{isActive:!0}),f<qe||m<Xe)return r(i,{alignItems:"center",height:m,justifyContent:"center",width:f,children:t(e,{color:"yellow",children:["Terminal too small (",f,"x",m,")"]})});const he=f>=He,V=[t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"q"}),r(e,{dimColor:!0,children:"QUIT"})]},"q"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"?"}),r(e,{dimColor:!0,children:"HELP"})]},"?"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"↑↓"}),r(e,{dimColor:!0,children:"NAV"})]},"nav"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"Space"}),r(e,{dimColor:!0,children:"CHECK"})]},"sp"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"a"}),r(e,{dimColor:!0,children:"ALL"})]},"a")];!p&&n.checkedEntries.size>0&&V.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"green",children:"u"}),r(e,{dimColor:!0,children:"APPLY"})]},"u")),c.length>0&&V.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"yellow",children:"f"}),t(e,{dimColor:!0,children:["FILTERED (",c.length,")"]})]},"fo")),V.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"←→"}),r(e,{dimColor:!0,children:"FILTER"})]},"lr"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"/"}),r(e,{dimColor:!0,children:"SEARCH"})]},"f"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"Tab"}),r(e,{dimColor:!0,children:"PANEL"})]},"t"));const Z=r(i,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:r(i,{flexWrap:"wrap",gap:2,paddingX:1,children:V})}),ee=t(_,{footer:t(e,{dimColor:!0,children:[r(e,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(e,{bold:!0,color:"white",children:"?"}),"/",r(e,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:M,title:"KEYBOARD SHORTCUTS",visible:A,width:52,children:[t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"NAVIGATION"})]}),t(i,{children:[r(i,{width:24,children:t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","↑","/k"]}),r(e,{dimColor:!0,children:" Move up"})]})}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","↓","/j"]}),r(e,{dimColor:!0,children:" Move down"})]})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","Tab"]}),r(e,{dimColor:!0,children:" Switch panel"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","→","/","←"]}),r(e,{dimColor:!0,children:" Focus detail/list"})]})]}),t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"SELECTION"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","Space"]}),r(e,{dimColor:!0,children:" Toggle check on package"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","a"]}),r(e,{dimColor:!0,children:" Toggle check all"})]})]}),t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"FILTERS"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","←→"]}),r(e,{dimColor:!0,children:" Switch filter tab"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","/"]}),r(e,{dimColor:!0,children:" Text filter"})]}),c.length>0&&t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","f"]}),r(e,{dimColor:!0,children:" View filtered-out packages"})]})]}),t(i,{flexDirection:"column",children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"ACTIONS"})]}),!p&&t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","u"]}),r(e,{dimColor:!0,children:" Apply selected updates"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","q"]}),r(e,{dimColor:!0,children:" Quit"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","?"]}),r(e,{dimColor:!0,children:" Toggle help"})]})]})]}),H=a.getCheckedEntries(),z=H.filter(o=>o.updateType==="major").length,ae=t(i,{alignItems:"center",flexDirection:"column",children:[z>0&&r(i,{marginBottom:1,marginTop:1,children:t(e,{color:"yellow",children:["⚠"," ",z," ","major update",z===1?"":"s"," ","— review breaking changes"]})}),t(e,{dimColor:!0,children:["Press"," ",r(e,{bold:!0,color:"white",children:"u"})," ","or"," ",r(e,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",r(e,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),re=r(_,{footer:ae,scrollRef:S,title:`Apply ${H.length} update${H.length===1?"":"s"}?`,visible:G,width:70,children:H.map(o=>t(i,{gap:1,children:[t(e,{children:[" ",o.packageName]}),t(e,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),r(e,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))}),te=c.length>0?r(_,{footer:t(e,{dimColor:!0,children:[r(e,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(e,{bold:!0,color:"white",children:"f"}),"/",r(e,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:R,title:`${c.length} PACKAGE${c.length===1?"":"S"} FILTERED BY TARGET`,visible:$,width:70,children:t(i,{flexDirection:"column",children:[r(i,{marginBottom:1,children:t(e,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",r(e,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),c.map(o=>t(i,{gap:1,children:[t(e,{children:[" ",o.packageName]}),t(e,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),r(e,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))]})}):null,le=r($e,{checkedEntries:n.checkedEntries,entries:x,filterActive:n.filterActive,filteredOutCount:c.length,filterText:n.filterText,filterType:n.filterType,focused:n.focusedPanel==="list",groupedByCatalog:n.groupedByCatalog,isDryRun:p,scrollOffset:j,selectedIndex:n.selectedIndex,totalCatalogEntries:w,totalChecked:h,totalEntries:x.length,viewportHeight:L}),ie=r(Le,{changelogUrl:P,entry:T,focused:n.focusedPanel==="detail",recommendation:g,scrollRef:y});if(he){const o=Math.floor(f*.35);return t(i,{flexDirection:"column",height:m,width:f,children:[t(i,{flexDirection:"row",flexGrow:1,children:[r(i,{flexGrow:1,children:le}),r(i,{width:o,children:ie})]}),Z,re,te,r(ne,{autoExitSeconds:s||3,onCancel:k(()=>{I(!1)},"onCancel"),visible:D}),ee]})}const se=Math.floor(m*.55);return t(i,{flexDirection:"column",height:m,width:f,children:[r(i,{height:se,children:le}),r(i,{flexGrow:1,children:ie}),Z,re,te,r(ne,{autoExitSeconds:s||3,onCancel:k(()=>{I(!1)},"onCancel"),visible:D}),ee]})},"VisUpdateApp");export{Je as U,ve as f,Ze as p};
@@ -0,0 +1,67 @@
1
+ var ae=Object.defineProperty;var w=(e,t)=>ae(e,"name",{value:t,configurable:!0});import{createRequire as ie}from"node:module";import{runProvider as oe,PROVIDER_NAMES as ce,detectProvider as le,detectAvailableProviders as de}from"@visulima/find-ai-runner";import{renderToString as ue,Box as ge,Text as E,Table as pe}from"@visulima/tui";import v from"react";import{isAccessibleSync as M,readJsonSync as ye,ensureDirSync as be}from"@visulima/fs";import{join as S}from"@visulima/path";const se=ie(import.meta.url),L=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,V=w(e=>{if(typeof L<"u"&&L.versions&&L.versions.node){const[t,r]=L.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return L.getBuiltinModule(e)}return se(e)},"__cjs_getBuiltinModule"),{rmSync:T,writeFileSync:me,readdirSync:H,statSync:he}=V("node:fs"),{homedir:fe}=V("node:os");var ve=Object.defineProperty,l=w((e,t)=>ve(e,"name",{value:t,configurable:!0}),"f$1");const I=(1n<<128n)-1n,c=(1n<<64n)-1n,j=(1n<<32n)-1n,W=0x9E3779B1n,K=0x85EBCA77n,ke=0xC2B2AE3Dn,k=0x9E3779B185EBCA87n,$=0xC2B2AE3D27D4EB4Fn,X=0x165667B19E3779F9n,O=0x85EBCA77C2B2AE63n,Be=0x27D4EB2F165667C5n,$e=0x165667919E3779F9n,we=0x9FB21C651E98DF25n,b=64,G=b/8,Ee=8,h=Buffer.from("b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e","hex"),u=l((e,t=0)=>Buffer.from(e.buffer,e.byteOffset+t,e.length-t),"getView"),Ie=l(e=>{const t=Buffer.allocUnsafe(8);return t.writeBigUInt64LE(e),t.readBigUInt64BE()},"bswap64"),Le=l(e=>{let t=e;return t=(t&0x0000FFFFn)<<16n|(t&0xFFFF0000n)>>16n,t=(t&0x00FF00FFn)<<8n|(t&0xFF00FF00n)>>8n,t},"bswap32"),Se=l((e,t)=>(e&j)*(t&j)&c,"multU32ToU64"),Ae=l((e,t)=>(e<<t|e>>32n-t)&j,"rotl32"),N=l((e,t)=>e^e>>t,"xorshift64"),_=l(e=>~e+1n&c,"inv64"),Y=l((e,t)=>{const r=e*t&I;return r&c^r>>64n},"mul128Fold64"),f=l(e=>{let t=e;return t^=t>>37n,t=t*$e&c,t^=t>>32n,t},"avalanche"),R=l(e=>{let t=e;return t^=t>>33n,t=t*$&c,t^=t>>29n,t=t*X&c,t^=t>>32n,t},"avalanche64"),Q=l((e,t,r)=>{for(let n=0;n<G;n++){const a=t.readBigUInt64LE(n*8),i=a^r.readBigUInt64LE(n*8);e[n^1]+=a,e[n]+=Se(i,i>>32n)}return e},"accumulate512"),D=l((e,t,r,n)=>{for(let a=0;a<n;a++)Q(e,u(t,a*b),u(r,a*8));return e},"accumulate"),Ue=l((e,t)=>{for(let r=0;r<G;r++){const n=t.readBigUInt64LE(r*8);let a=e[r];a=N(a,47n),a^=n,a*=W,e[r]=a&c}return e},"scrambleAcc"),U=l((e,t)=>Y(e[0]^t.readBigUInt64LE(0),e[1]^t.readBigUInt64LE(Ee)),"mix2Accs"),q=l((e,t,r)=>{let n=r;return n+=U(e.slice(0),u(t,0)),n+=U(e.slice(2),u(t,16)),n+=U(e.slice(4),u(t,32)),n+=U(e.slice(6),u(t,48)),f(n&c)},"mergeAccs"),xe=l((e,t,r)=>{const n=Math.floor((r.byteLength-b)/8),a=b*n,i=Math.floor((t.byteLength-1)/a);for(let d=0;d<i;d++)D(e,u(t,d*a),r,n),Ue(e,u(r,r.byteLength-b));const s=Math.floor((t.byteLength-1-a*i)/b);return D(e,u(t,i*a),r,s),Q(e,u(t,t.byteLength-b),u(r,r.byteLength-b-7)),e},"hashLong"),Ce=l((e,t)=>{const r=new BigUint64Array([ke,k,$,X,O,K,Be,W]);xe(r,e,t);const n=q(r,u(t,11),BigInt(e.byteLength)*k&c);return q(r,u(t,t.byteLength-b-11),~(BigInt(e.byteLength)*$)&c)<<64n|n},"hashLong128b"),J=l((e,t,r)=>Y((e.readBigUInt64LE(0)^t.readBigUInt64LE(0)+r)&c,(e.readBigUInt64LE(8)^t.readBigUInt64LE(8)-r)&c),"mix16B"),C=l((e,t,r,n,a)=>{let i=e&c,s=e>>64n&c;return i+=J(t,n,a),i^=r.readBigUInt64LE(0)+r.readBigUInt64LE(8),i&=c,s+=J(r,u(n,16),a),s^=t.readBigUInt64LE(0)+t.readBigUInt64LE(8),s&=c,s<<64n|i},"mix32B"),je=l((e,t,r)=>{const n=e.byteLength,a=BigInt(e.readUInt8(n-1))|BigInt(n<<8)|BigInt(e.readUInt8(0)<<16)|BigInt(e.readUInt8(n>>1)<<24),i=(BigInt(t.readUInt32LE(0))^BigInt(t.readUInt32LE(4)))+r,s=(a^i)&c,d=(BigInt(t.readUInt32LE(8))^BigInt(t.readUInt32LE(12)))-r,o=(Ae(Le(a),13n)^d)&c;return(R(o)&c)<<64n|R(s)},"len1to3_128b"),Re=l((e,t,r)=>{const n=e.byteLength,a=e.readUInt32LE(0),i=e.readUInt32LE(n-4),s=BigInt(a)|BigInt(i)<<32n,d=(t.readBigUInt64LE(16)^t.readBigUInt64LE(24))+r&c;let o=(s^d)*(k+(BigInt(n)<<2n))&I;return o+=(o&c)<<65n,o&=I,o^=o>>67n,N(N(o&c,35n)*we&c,28n)|f(o>>64n)<<64n},"len4to8_128b"),Fe=l((e,t,r)=>{const n=e.byteLength,a=(t.readBigUInt64LE(32)^t.readBigUInt64LE(40))+r&c,i=(t.readBigUInt64LE(48)^t.readBigUInt64LE(56))-r&c,s=e.readBigUInt64LE();let d=e.readBigUInt64LE(n-8),o=(s^d^a)*k;const g=(o&c)+(BigInt(n-1)<<54n);o=o&(I^c)|g,d^=i,o+=d+(d&j)*(K-1n)<<64n,o&=I,o^=Ie(o>>64n);let m=(o&c)*$;return m+=(o>>64n)*$<<64n,m&=I,f(m&c)|f(m>>64n)<<64n},"len9to16_128b"),Te=l((e,t)=>{const r=e.byteLength;return r>8?Fe(e,h,t):r>=4?Re(e,h,t):r>0?je(e,h,t):R(t^h.readBigUInt64LE(64)^h.readBigUInt64LE(72))|R(t^h.readBigUInt64LE(80)^h.readBigUInt64LE(88))<<64n},"len0to16_128b"),Ne=l((e,t,r)=>{let n=BigInt(e.byteLength)*k&c,a=BigInt(e.byteLength-1)/32n;for(;a>=0n;){const d=Number(a);n=C(n,u(e,16*d),u(e,e.byteLength-16*(d+1)),u(t,32*d),r),a--}let i=n+(n>>64n)&c;i=f(i);let s=(n&c)*k+(n>>64n)*O+(BigInt(e.byteLength)-r&c)*$;return s&=c,s=_(f(s)),i|s<<64n},"len17to128_128b"),_e=l((e,t,r)=>{let n=BigInt(e.byteLength)*k&c;for(let s=32;s<160;s+=32)n=C(n,u(e,s-32),u(e,s-16),u(t,s-32),r);n=f(n&c)|f(n>>64n)<<64n;for(let s=160;s<=e.byteLength;s+=32)n=C(n,u(e,s-32),u(e,s-16),u(t,3+s-160),r);n=C(n,u(e,e.byteLength-16),u(e,e.byteLength-32),u(t,103),_(r));let a=n+(n>>64n)&c;a=f(a);let i=(n&c)*k+(n>>64n)*O+(BigInt(e.byteLength)-r&c)*$;return i&=c,i=_(f(i)),a|i<<64n},"len129to240_128b"),Me=l((e,t=0n)=>{const r=e.byteLength;return r<=16?Te(e,t):r<=128?Ne(e,h,t):r<=240?_e(e,h,t):Ce(e,h)},"xxh3_128"),Oe=l(e=>{const t=e>>64n&c,r=e&c;return t.toString(16).padStart(16,"0")+r.toString(16).padStart(16,"0")},"bigintToHex"),Z=l(e=>Oe(Me(e)),"xxh3Hash");class Pe{static{w(this,"gn")}static{l(this,"Xxh3Hasher")}#e=[];update(t){return typeof t=="string"?this.#e.push(Buffer.from(t)):this.#e.push(t),this}digest(){return Z(Buffer.concat(this.#e))}}l(()=>new Pe,"createXxh3Hasher");var De=Object.defineProperty,B=w((e,t)=>De(e,"name",{value:t,configurable:!0}),"s");const A=B(()=>S(fe(),".vis","cache","ai"),"getCacheDirectory"),qe=3600*1e3,Je=1800*1e3,ze=B(()=>{be(A())},"ensureCacheDirectory"),Ve=B((e,t,r)=>{const n=r.map(i=>({currentRange:i.currentRange,name:i.packageName,targetVersion:i.targetVersion})).toSorted((i,s)=>i.name.localeCompare(s.name)),a=JSON.stringify({analysisType:t,packages:n,provider:e});return Z(Buffer.from(a))},"buildCacheKey"),He=B(e=>{const t=S(A(),`${e}.json`);if(M(t))try{const r=ye(t);if(Date.now()-r.createdAt>r.ttlMs){T(t,{force:!0});return}return r.result}catch{T(t,{force:!0});return}},"getCachedAnalysis"),We=B((e,t,r)=>{ze();const n=A(),a={createdAt:Date.now(),result:t,ttlMs:r};me(S(n,`${e}.json`),JSON.stringify(a,void 0,2),"utf8")},"setCachedAnalysis"),Ke=B((e,t)=>t!==void 0&&t>0?t:e==="security"?Je:qe,"getTtlForAnalysisType"),Et=B(()=>{const e=A();if(!M(e))return{entries:0,newestEntry:void 0,oldestEntry:void 0,totalSizeBytes:0};const t=H(e).filter(i=>i.endsWith(".json"));let r=0,n,a;for(const i of t){const s=S(e,i),d=he(s);r+=d.size;const{mtimeMs:o}=d;(n===void 0||o<n)&&(n=o),(a===void 0||o>a)&&(a=o)}return{entries:t.length,newestEntry:a,oldestEntry:n,totalSizeBytes:r}},"getCacheStats"),It=B(()=>{const e=A();if(!M(e))return 0;const t=H(e).filter(r=>r.endsWith(".json"));for(const r of t)T(S(e,r),{force:!0});return t.length},"clearCache");var Xe=Object.defineProperty,p=w((e,t)=>Xe(e,"name",{value:t,configurable:!0}),"o");const Ge={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},Ye=p(e=>{if(e?.provider){if(!ce.includes(e.provider))return;const n=le(e.provider);return n.available?n:void 0}const t=de();if(t.length===0)return;const r={...Ge,...e?.priority};return t.toSorted((n,a)=>(r[a.name]??0)-(r[n.name]??0))[0]},"resolveProvider"),Qe=new Set(["defer","review","skip","update"]),Ze=new Set(["critical","high","low","medium"]),et=new Set(["high","low","medium"]),tt=50,F=30,nt=2,rt=1e3,at=12e4,it=p(e=>e.map(t=>{const r=t.vulnerabilities&&t.vulnerabilities.length>0?` [VULNERABILITIES: ${t.vulnerabilities.map(a=>`${a.severity} ${a.id}`).join(", ")}]`:"";let n="";if(t.socketReport){const a=Math.round(t.socketReport.score.overall*100),i=[`score:${String(a)}%`];if(t.socketReport.alerts.length>0){const s=t.socketReport.alerts.reduce((o,g)=>(o[g.severity]=(o[g.severity]??0)+1,o),{}),d=Object.entries(s).map(([o,g])=>`${String(g)} ${o}`).join(", ");i.push(`alerts: ${d}`)}i.push(`supply-chain:${String(Math.round(t.socketReport.score.supplyChain*100))}%`),i.push(`quality:${String(Math.round(t.socketReport.score.quality*100))}%`),n=` [SOCKET.DEV: ${i.join(", ")}]`}return`- ${t.packageName}: ${t.currentRange} → ${t.newRange} (${t.updateType})${r}${n}`}).join(`
2
+ `),"buildPackageList"),x=`Respond ONLY with valid JSON in this exact structure:
3
+ {
4
+ "summary": "Brief overall summary",
5
+ "recommendations": [
6
+ {
7
+ "package": "package-name",
8
+ "action": "update|skip|review|defer",
9
+ "reason": "explanation",
10
+ "riskLevel": "low|medium|high|critical",
11
+ "breakingChanges": ["change1"],
12
+ "effort": "low|medium|high"
13
+ }
14
+ ],
15
+ "warnings": ["warning1"]
16
+ }`,st={compatibility:p(e=>`Analyze the compatibility of these package updates:
17
+
18
+ ${e}
19
+
20
+ For each package:
21
+ 1. Check peer dependency compatibility
22
+ 2. Identify potential conflicts with other packages in the list
23
+ 3. Assess API compatibility between current and target versions
24
+ 4. Check for deprecated features being removed
25
+ 5. Evaluate Node.js version requirements
26
+
27
+ ${x}`,"compatibility"),impact:p(e=>`Analyze the impact of updating these npm packages:
28
+
29
+ ${e}
30
+
31
+ For each package, provide:
32
+ 1. Risk level (low/medium/high/critical)
33
+ 2. Recommended action (update/skip/review/defer)
34
+ 3. Reason for recommendation
35
+ 4. Known breaking changes (if any)
36
+ 5. Estimated migration effort (low/medium/high)
37
+
38
+ ${x}`,"impact"),recommend:p(e=>`Provide smart recommendations for updating these packages:
39
+
40
+ ${e}
41
+
42
+ Consider:
43
+ 1. Update priority based on security, features, and stability
44
+ 2. Grouping related packages for atomic updates
45
+ 3. Best practices for the specific package ecosystem
46
+ 4. Risk vs. benefit analysis
47
+ 5. Suggested update order
48
+ 6. If Socket.dev scores are provided, prioritize packages with low supply chain or quality scores
49
+
50
+ ${x}`,"recommend"),security:p(e=>`Analyze the security implications of these package updates:
51
+
52
+ ${e}
53
+
54
+ For each package:
55
+ 1. Check if the update fixes known vulnerabilities (use the vulnerability data above)
56
+ 2. Assess if the new version introduces security risks
57
+ 3. Evaluate if this is a security-sensitive package (auth, crypto, session, etc.)
58
+ 4. Recommend urgency of the update based on vulnerability severity
59
+ 5. Flag any packages where skipping the update poses security risk
60
+ 6. If Socket.dev scores are provided, factor in supply chain and quality scores — low scores indicate higher risk
61
+
62
+ ${x}`,"security")},ot=new Set(["compatibility","impact","recommend","security"]),Lt=p(e=>ot.has(e)?e:"impact","validateAnalysisType"),ee=p((e,t="impact")=>{const r=it(e);return st[t](r)},"buildAnalysisPrompt"),ct=/```(?:json)?\s*([\s\S]*?)```/,lt=/\{[\s\S]*\}/,dt=p(e=>{try{return JSON.parse(e)}catch{}const t=ct.exec(e);if(t?.[1])try{return JSON.parse(t[1])}catch{}const r=lt.exec(e);if(r?.[0])try{return JSON.parse(r[0])}catch{}},"extractJson"),ut=p(e=>({action:Qe.has(e.action)?e.action:"review",breakingChanges:Array.isArray(e.breakingChanges)?e.breakingChanges:[],effort:et.has(e.effort)?e.effort:"medium",package:typeof e.package=="string"?e.package:"",reason:typeof e.reason=="string"?e.reason:"",riskLevel:Ze.has(e.riskLevel)?e.riskLevel:"medium"}),"normalizeRecommendation"),te=p((e,t,r)=>{const n=dt(e);if(!n||typeof n!="object")return{analysisType:r,provider:t,recommendations:[],summary:"Failed to parse AI response.",warnings:["AI response was not valid JSON."]};const a=n,i=Array.isArray(a.recommendations)?a.recommendations:[];return{analysisType:r,provider:t,recommendations:i.map(s=>ut(s)),summary:typeof a.summary=="string"?a.summary:"",warnings:Array.isArray(a.warnings)?a.warnings:[]}},"parseAiResponse"),gt={eslint:["ESLint 9.0: Flat config required","ESLint 8.0+: New rule formats"],next:["Next.js 13+: App router changes","Next.js 14+: Server components default"],react:["React 17 to 18: Concurrent features","React 18+: Strict mode changes"],typescript:["TypeScript 5.0: New decorators","TypeScript 4.7+: ESM changes"],vite:["Vite 5: Node.js 18+ required"],vue:["Vue 3: Composition API","Vue 3: Breaking template changes"],webpack:["Webpack 5: Node.js polyfills removed"]},pt=new Set(["bcrypt","cors","crypto-js","express-session","helmet","jose","jsonwebtoken","node-forge","oauth","passport"]),z=p((e,t)=>{const r=e.map(n=>{const a=n.vulnerabilities&&n.vulnerabilities.length>0,i=pt.has(n.packageName),s=gt[n.packageName]??[];let d="low",o="update",g="low",m="Patch/minor update, safe to apply.";return n.updateType==="major"?(d="high",o=s.length>0?"review":"update",g="medium",m=s.length>0?`Major update with known breaking changes: ${s[0]}`:"Major version update, review changelog before applying."):n.updateType==="minor"&&(d="medium",m="Minor update, generally safe."),a&&(d="high",o="update",m="Security update — current version has known vulnerabilities."),i&&n.updateType==="major"&&(o="review",m="Security-sensitive package with major update, careful review needed.",g="high"),{action:o,breakingChanges:s,effort:g,package:n.packageName,reason:m,riskLevel:d}});return{analysisType:t,provider:"rule-engine",recommendations:r,summary:`Rule-based ${t} analysis for ${String(e.length)} packages.`,warnings:["No AI provider available — using built-in rule engine."]}},"ruleBasedAnalysis"),mt=p(e=>new Promise(t=>{setTimeout(t,e)}),"sleep"),ne=p(async(e,t,r=nt)=>{let n;for(let a=0;a<=r;a+=1)try{return(await oe(e,t,{timeoutMs:at})).stdout}catch(i){if(n=i instanceof Error?i:new Error(String(i)),n.message.includes("timed out"))throw n;if(a<r){const s=rt*2**a;await mt(s)}}throw n??new Error("AI analysis failed after retries")},"runWithRetry"),ht=p(async(e,t,r)=>{const n=ee(t,r),a=await ne(e,n);return te(a,e.name,r)},"analyzeChunk"),ft=p((e,t,r)=>{const n=[],a=[],i=[];for(const s of e)n.push(...s.recommendations),a.push(...s.warnings),s.summary&&i.push(s.summary);return{analysisType:r,provider:t,recommendations:n,summary:i.length===1?i[0]??"":`Analyzed ${String(n.length)} packages in ${String(e.length)} batches.`,warnings:[...new Set(a)]}},"mergeResults"),re={compatibility:"Compatibility",impact:"Impact",recommend:"Recommendations",security:"Security"},St=p(e=>{const t=`${re[e.analysisType]??e.analysisType} Analysis (${e.provider})`,r=e.recommendations.flatMap(a=>{const i=[{action:a.action,effort:a.effort,package:a.package,reason:a.reason,risk:a.riskLevel}];return a.breakingChanges.length>0&&i.push({action:"",effort:"",package:"",reason:`Breaking: ${a.breakingChanges.join("; ")}`,risk:""}),i}),n=process.stdout.columns||80;return ue(v.createElement(ge,{borderStyle:"round",flexDirection:"column",paddingLeft:1,paddingRight:1},v.createElement(E,{bold:!0},t),v.createElement(E,null,""),v.createElement(E,null,e.summary),v.createElement(E,null,""),v.createElement(pe,{borderStyle:"none",data:r}),...e.warnings.length>0?[v.createElement(E,null,""),...e.warnings.map((a,i)=>v.createElement(E,{dimColor:!0,key:String(i)},` ${a}`))]:[]),{columns:n})},"formatAiAnalysis");p(e=>JSON.stringify(e,void 0,2),"formatAiAnalysisJson");const At=p(async(e,t,r,n="impact")=>{const a=Ye(r);if(!a)return t.info(`No AI CLI tool found, using rule-based analysis.
63
+ `),z(e,n);const i=Ve(a.name,n,e),s=He(i);if(s)return t.info(`Using cached ${n} analysis from ${s.provider}.
64
+ `),s;const d=re[n]??n;t.info(`Running ${d.toLowerCase()} analysis with ${a.name}...
65
+ `);try{let o;if(e.length>tt){t.info(`Splitting ${String(e.length)} packages into batches of ${String(F)}...
66
+ `);const g=[];for(let y=0;y<e.length;y+=F)g.push(e.slice(y,y+F));const m=[];for(let y=0;y<g.length;y+=1){t.info(` Batch ${String(y+1)}/${String(g.length)}...`);const P=g[y];P&&m.push(await ht(a,P,n))}o=ft(m,a.name,n)}else{const g=await ne(a,ee(e,n));o=te(g,a.name,n)}return We(i,o,Ke(n,r?.cacheTtl)),o}catch(o){const g=o instanceof Error?o.message:String(o);return t.warn(`AI analysis failed (${g}), falling back to rule engine.
67
+ `),z(e,n)}},"runAiAnalysis");export{Lt as G,Et as M,Ye as R,Ge as S,St as i,At as r,It as x};