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

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 (107) hide show
  1. package/CHANGELOG.md +185 -42
  2. package/LICENSE.md +586 -0
  3. package/README.md +26 -4
  4. package/dist/config/index.d.ts +1739 -0
  5. package/dist/config/index.js +1 -0
  6. package/dist/generate/index.d.ts +1 -1
  7. package/dist/packem_chunks/applyDefaults.js +2 -0
  8. package/dist/packem_chunks/bin.js +232 -60
  9. package/dist/packem_chunks/doctor-probe.js +2 -0
  10. package/dist/packem_chunks/fix.js +11 -53
  11. package/dist/packem_chunks/handler.js +1 -1
  12. package/dist/packem_chunks/handler10.js +2 -1
  13. package/dist/packem_chunks/handler11.js +1 -1
  14. package/dist/packem_chunks/handler12.js +5 -2
  15. package/dist/packem_chunks/handler13.js +1 -1
  16. package/dist/packem_chunks/handler14.js +18 -5
  17. package/dist/packem_chunks/handler15.js +20 -1
  18. package/dist/packem_chunks/handler16.js +1 -20
  19. package/dist/packem_chunks/handler17.js +1 -1
  20. package/dist/packem_chunks/handler18.js +1 -1
  21. package/dist/packem_chunks/handler19.js +1 -1
  22. package/dist/packem_chunks/handler2.js +2 -1
  23. package/dist/packem_chunks/handler20.js +5 -1
  24. package/dist/packem_chunks/handler21.js +1 -1
  25. package/dist/packem_chunks/handler22.js +1 -5
  26. package/dist/packem_chunks/handler23.js +5 -1
  27. package/dist/packem_chunks/handler24.js +1 -1
  28. package/dist/packem_chunks/handler25.js +3 -5
  29. package/dist/packem_chunks/handler26.js +1 -1
  30. package/dist/packem_chunks/handler27.js +1 -3
  31. package/dist/packem_chunks/handler28.js +7 -1
  32. package/dist/packem_chunks/handler29.js +22 -6
  33. package/dist/packem_chunks/handler3.js +4 -2
  34. package/dist/packem_chunks/handler30.js +3 -23
  35. package/dist/packem_chunks/handler31.js +1 -3
  36. package/dist/packem_chunks/handler32.js +2 -2
  37. package/dist/packem_chunks/handler33.js +24 -23
  38. package/dist/packem_chunks/handler34.js +2 -2
  39. package/dist/packem_chunks/handler35.js +3 -19
  40. package/dist/packem_chunks/handler36.js +22 -428
  41. package/dist/packem_chunks/handler37.js +428 -22
  42. package/dist/packem_chunks/handler38.js +20 -20
  43. package/dist/packem_chunks/handler39.js +21 -21
  44. package/dist/packem_chunks/handler4.js +2 -4
  45. package/dist/packem_chunks/handler40.js +22 -3
  46. package/dist/packem_chunks/handler41.js +6 -10
  47. package/dist/packem_chunks/handler42.js +5 -153
  48. package/dist/packem_chunks/handler43.js +10 -42
  49. package/dist/packem_chunks/handler44.js +153 -3
  50. package/dist/packem_chunks/handler45.js +25 -27
  51. package/dist/packem_chunks/handler46.js +3 -0
  52. package/dist/packem_chunks/handler47.js +27 -0
  53. package/dist/packem_chunks/handler48.js +42 -0
  54. package/dist/packem_chunks/handler5.js +8 -2
  55. package/dist/packem_chunks/handler6.js +1 -13
  56. package/dist/packem_chunks/handler7.js +1 -8
  57. package/dist/packem_chunks/handler8.js +1 -1
  58. package/dist/packem_chunks/handler9.js +1 -1
  59. package/dist/packem_chunks/heal-accept.js +10 -0
  60. package/dist/packem_chunks/heal.js +14 -0
  61. package/dist/packem_chunks/index.js +3 -3
  62. package/dist/packem_chunks/tar.js +3 -0
  63. package/dist/packem_shared/ai-analysis-hm8d2W7z.js +67 -0
  64. package/dist/packem_shared/{ai-cache-Bynt6Y9x.js → ai-cache-DoiF80AR.js} +1 -1
  65. package/dist/packem_shared/ai-fix-nn4zOE95.js +43 -0
  66. package/dist/packem_shared/cache-directory-CwHlJhgx.js +1 -0
  67. package/dist/packem_shared/dependency-scan-COr5n63B.js +2 -0
  68. package/dist/packem_shared/{docker-BcfqH4Av.js → docker-D6OGr5_S.js} +1 -1
  69. package/dist/packem_shared/{failure-log-DqYen0LC.js → failure-log-iUVLf6ts.js} +1 -1
  70. package/dist/packem_shared/flakiness-D9wf0t56.js +1 -0
  71. package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
  72. package/dist/packem_shared/index-DH-5hsrC.js +1 -0
  73. package/dist/packem_shared/otel-DxDUPJJH.js +6 -0
  74. package/dist/packem_shared/otelPlugin-CQq6poq8.js +1 -0
  75. package/dist/packem_shared/registry-CkubDdiY.js +2 -0
  76. package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +1 -0
  77. package/dist/packem_shared/{runtime-check-CGHal8SO.js → runtime-check-BXZ43CBW.js} +1 -1
  78. package/dist/packem_shared/{selectors-CfH9ZY08.js → selectors-BylODRiM.js} +1 -1
  79. package/dist/packem_shared/toolchain-BgBOUHII.js +5 -0
  80. package/dist/packem_shared/typosquats-CcZl99B1.js +1 -0
  81. package/dist/packem_shared/verify-Baj5mFJ7.js +1 -0
  82. package/dist/packem_shared/vis-update-app-D1jl0UZZ.js +1 -0
  83. package/index.js +54 -53
  84. package/package.json +34 -26
  85. package/schemas/project.schema.json +739 -299
  86. package/schemas/vis-config.schema.json +3383 -278
  87. package/skills/vis/SKILL.md +96 -0
  88. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  89. package/templates/buildkite-ci/template.yml +20 -0
  90. package/dist/errors/index.d.ts +0 -26
  91. package/dist/errors/index.js +0 -1
  92. package/dist/packem_chunks/config.js +0 -2
  93. package/dist/packem_shared/VisConfigCycleError-CAYNC7d-.js +0 -1
  94. package/dist/packem_shared/VisConfigError-B5LP1zRf.js +0 -1
  95. package/dist/packem_shared/VisConfigLoadError-CeqBSd2Z.js +0 -2
  96. package/dist/packem_shared/VisConfigNotFoundError-DZ9KC527.js +0 -5
  97. package/dist/packem_shared/VisUpdateApp-D-L4_-Iu.js +0 -1
  98. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
  99. package/dist/packem_shared/ai-analysis-CGuy7dfE.js +0 -67
  100. package/dist/packem_shared/cache-directory-D72ZEag2.js +0 -1
  101. package/dist/packem_shared/catalog-BVPerCwG.js +0 -12
  102. package/dist/packem_shared/dependency-scan-Du0tBu64.js +0 -2
  103. package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
  104. package/dist/packem_shared/run-summary-utils-C24Aaf9E.js +0 -1
  105. package/dist/packem_shared/target-merge-DNa-6eWu.js +0 -1
  106. package/dist/packem_shared/toolchain-DQfTQY8E.js +0 -5
  107. package/dist/packem_shared/typosquats-DOR8izpX.js +0 -1
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: vis
3
+ description: Use when the workspace contains a vis.config.ts (or vis.config.js/json) at the repo root, or when the user mentions "vis", "task-runner", or "@visulima/vis". This skill orchestrates the vis MCP server's eight read-only tools to inspect projects, plan task graphs, and diagnose remote-cache rotations.
4
+ ---
5
+
6
+ # Working with the `vis` task runner
7
+
8
+ `vis` is the Visulima monorepo task runner — a Turborepo/Nx-class tool with a remote cache, REAPI gRPC backend, and project graph. When this skill is active you have the **`@visulima/vis-mcp` server** mounted, exposing eight read-only tools. Use them in preference to running `vis` shell commands yourself: the tools give you structured JSON and run faster.
9
+
10
+ The MCP server deliberately does NOT execute targets or scaffold templates — Nx-style "agent prepares, human executes". When the user wants to run `<project>:<target>` or `vis generate <template>`, prepare the command (use `list_targets`/`describe_template` to confirm it exists and capture required arguments) and ask the user to run it themselves; afterwards use `get_run_logs` to read the result of any task run.
11
+
12
+ ## Tools available
13
+
14
+ | Tool | Purpose |
15
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
16
+ | `list_projects` | All projects in the workspace, optionally filtered by a vis query (`tag=frontend`, `type=application`, …) |
17
+ | `describe_project` | Full metadata for one project: language, layer, tags, root path, all targets |
18
+ | `list_targets` | Per-target rows across the workspace, optionally narrowed to a single project |
19
+ | `list_templates` | Scaffolding templates discovered in `.vis/templates/`, `.moon/templates/`, and `vis.config.ts` `generator.templates` |
20
+ | `describe_template` | Variable schema, default destination, and description for a single template — required before suggesting a `vis generate` command |
21
+ | `get_run_logs` | Most recent run summary from `.task-runner/`, or a specific `runId`, optionally filtered to one task |
22
+ | `cache_why` | Diff a task's cache hash against the previous run — pinpoints what changed (command, nodes, runtime, implicit deps) |
23
+ | `cache_hash` | Recorded hash and per-input hash details for a task |
24
+
25
+ ## Workflow patterns
26
+
27
+ ### Discovery — "what's in this repo?"
28
+
29
+ Default opening move when the user asks about the workspace:
30
+
31
+ 1. `list_projects` (no filter). Shows everything with categories and target counts.
32
+ 2. If they ask about a specific package, `describe_project` for the full picture rather than re-running list with a filter.
33
+
34
+ ### Plan a build
35
+
36
+ 1. `list_targets` (optionally with `project: "@scope/name"`) to see what `build`/`test`/`lint`/etc. targets exist.
37
+ 2. Tell the user the exact command (`vis run @scope/name:build`) and let them run it.
38
+ 3. Use `get_run_logs` afterwards to inspect status, cache hits, and stderr tails.
39
+
40
+ ### Investigate a cache miss
41
+
42
+ When a build that should have been cached re-ran:
43
+
44
+ 1. `get_run_logs` (no args → latest summary) — surfaces all task statuses for the last run.
45
+ 2. For any task with status `success` but `cacheStatus: "miss"`, call `cache_why` with that `taskId`. It diffs hashDetails against the previous run and tells you which input rotated (command string, file content, `implicitDependency`, runtime version, …).
46
+ 3. If `cache_why` shows the change but the user wants to see the raw hash inputs, `cache_hash` returns the full per-input breakdown.
47
+
48
+ ### Scaffold a new package or component
49
+
50
+ When the user asks for "a new X" / "scaffold Y":
51
+
52
+ 1. `list_templates` — pick the template whose `name` or `description` matches the user's request.
53
+ 2. `describe_template` with that name — read the `variables[]` schema. Identify which variables are `required` and which have sensible `default` values.
54
+ 3. Construct the command: `vis generate <name> -- --var1=value1 --var2=value2`. For interactive prompts, drop the `--` overrides and let the user step through. For `--defaults`-friendly templates, add `--defaults` to skip prompts.
55
+ 4. Hand the command to the user to execute. Don't fabricate variable values — if the user hasn't told you what to pass for a required variable, ask.
56
+
57
+ #### Worked example
58
+
59
+ User: _"Scaffold a new React button component called PrimaryButton."_
60
+
61
+ 1. Call `list_templates` → response contains an entry `{ "name": "component", "source": "native", "description": "Scaffold a React component" }`. That's the closest match.
62
+ 2. Call `describe_template` with `{ "name": "component" }` → response shows `variables`:
63
+ ```json
64
+ [
65
+ { "name": "name", "type": "string", "required": true, "prompt": "Component name?" },
66
+ { "name": "withTest", "type": "boolean", "required": false, "default": true },
67
+ { "name": "style", "type": "enum", "required": false, "default": "primary", "values": ["primary", "secondary"] }
68
+ ]
69
+ ```
70
+ 3. The user supplied `name` (`PrimaryButton`) and implied `style=primary` (default already matches). `withTest` is unspecified — the default is fine, no need to override.
71
+ 4. Suggested command for the user to run:
72
+ ```sh
73
+ vis generate component -- --name=PrimaryButton --style=primary
74
+ ```
75
+ Do **not** invent values for required variables the user never mentioned — ask first.
76
+
77
+ ### Diagnose a failed run
78
+
79
+ 1. `get_run_logs` to see which task(s) failed.
80
+ 2. `get_run_logs` with `taskId` set to the failing task — returns just that entry, including the captured stderr tail.
81
+ 3. Decide: is it a code bug (read the project's source), a cache poisoning issue (`cache_why`), or environmental (look at the run summary's `runtime` block)?
82
+
83
+ ## Safety rules
84
+
85
+ - **All tools are read-only.** The server does not execute targets. If the user wants something built/tested/linted, give them the command and let them run it.
86
+ - **All tools run in the directory where `vis-mcp` was launched.** Override at server startup by setting `VIS_MCP_WORKSPACE_ROOT`. You can read that path from the server's stderr boot line: `[vis-mcp] ready (workspace: …)`.
87
+
88
+ ## When NOT to use this skill
89
+
90
+ - The user wants to write a `vis.config.ts` — that's editing source, not running the CLI. Use Read/Edit/Write on the config file directly.
91
+ - The user is asking about Turborepo, Nx, or Bazel specifically (not vis). The tools won't help with those.
92
+ - The repo has no `vis.config.*` and no mention of vis. Don't volunteer the tools.
93
+
94
+ ## Tool-result conventions
95
+
96
+ All tools return JSON-encoded text in the standard MCP `content[].text` slot. On error, `isError: true` is set and the text payload is `{"error": "<message>"}`. Parse the JSON before reasoning about it — the text field is structured data, not prose.
@@ -0,0 +1,85 @@
1
+ ---
2
+ to: ".buildkite/pipeline.yml"
3
+ ---
4
+ # Generated by `vis generate buildkite-ci`.
5
+ # Run `vis ci` against affected packages on every build.{% if withHeal %}
6
+ # Heal block: on failure, `vis ai heal` posts a Buildkite annotation; an
7
+ # allow-listed maintainer manually unblocks the block step to apply +
8
+ # commit the patch via `vis ai heal accept`. The unblocker email
9
+ # (BUILDKITE_UNBLOCKER_EMAIL) must be listed in `ai.heal.allowedActors`
10
+ # in vis.config.ts or the accept step refuses to commit.{% endif %}
11
+
12
+ steps:
13
+ - label: ":hammer: vis ci"
14
+ key: ci
15
+ timeout_in_minutes: 30
16
+ command: |
17
+ {% if packageManager == "pnpm" %} corepack enable
18
+ pnpm install --frozen-lockfile
19
+ pnpm vis ci {{ targets }}
20
+ {% endif %}{% if packageManager == "npm" %} npm ci
21
+ npx vis ci {{ targets }}
22
+ {% endif %}{% if packageManager == "yarn" %} corepack enable
23
+ yarn install --immutable
24
+ yarn vis ci {{ targets }}
25
+ {% endif %}{% if packageManager == "bun" %} bun install --frozen-lockfile
26
+ bunx vis ci {{ targets }}
27
+ {% endif %} agents:
28
+ queue: {{ agentQueue }}
29
+ {% if withHeal %}
30
+ - label: ":sparkles: vis ai heal"
31
+ key: heal-propose
32
+ depends_on: ci
33
+ timeout_in_minutes: 30
34
+ # Only run when CI failed and the build is for a PR — heal-accept
35
+ # has nowhere to commit on push-event builds.
36
+ if: build.failed_jobs > 0 && build.pull_request.id != null
37
+ command: |
38
+ {% if packageManager == "pnpm" %} corepack enable
39
+ pnpm install --frozen-lockfile
40
+ pnpm vis ai heal
41
+ {% endif %}{% if packageManager == "npm" %} npm ci
42
+ npx vis ai heal
43
+ {% endif %}{% if packageManager == "yarn" %} corepack enable
44
+ yarn install --immutable
45
+ yarn vis ai heal
46
+ {% endif %}{% if packageManager == "bun" %} bun install --frozen-lockfile
47
+ bunx vis ai heal
48
+ {% endif %} agents:
49
+ queue: {{ agentQueue }}
50
+ # Buildkite has no commit API of its own — `vis ai heal accept`
51
+ # derives the upstream provider from BUILDKITE_REPO and commits
52
+ # through GitHub or GitLab. Set GITHUB_TOKEN or GITLAB_TOKEN on
53
+ # the agent (matching your remote) so heal accept can land the patch.
54
+
55
+ - block: ":white_check_mark: Apply AI heal patch?"
56
+ key: heal-gate
57
+ depends_on: heal-propose
58
+ if: build.failed_jobs > 0 && build.pull_request.id != null
59
+ prompt: |
60
+ Unblocking applies and commits the patch from the heal annotation.
61
+ The unblocker email (BUILDKITE_UNBLOCKER_EMAIL) must be listed in
62
+ `ai.heal.allowedActors` in vis.config.ts, otherwise the accept
63
+ step will refuse to commit.
64
+
65
+ - label: ":robot_face: vis ai heal accept"
66
+ key: heal-accept
67
+ depends_on: heal-gate
68
+ timeout_in_minutes: 30
69
+ # Defense in depth — heal-accept can't push to a fork and has no
70
+ # commit target on push-event builds. Refuse early.
71
+ if: build.pull_request.id != null
72
+ command: |
73
+ {% if packageManager == "pnpm" %} corepack enable
74
+ pnpm install --frozen-lockfile
75
+ pnpm vis ai heal accept
76
+ {% endif %}{% if packageManager == "npm" %} npm ci
77
+ npx vis ai heal accept
78
+ {% endif %}{% if packageManager == "yarn" %} corepack enable
79
+ yarn install --immutable
80
+ yarn vis ai heal accept
81
+ {% endif %}{% if packageManager == "bun" %} bun install --frozen-lockfile
82
+ bunx vis ai heal accept
83
+ {% endif %} agents:
84
+ queue: {{ agentQueue }}
85
+ {% endif %}
@@ -0,0 +1,20 @@
1
+ "title": "Buildkite CI"
2
+ "description": "A Buildkite pipeline.yml that runs `vis ci` against affected packages, with an optional `vis ai heal` block-step flow."
3
+ "variables":
4
+ "targets":
5
+ "type": "string"
6
+ "default": "lint,test,build"
7
+ "prompt": "Comma-separated list of `vis ci` targets to run"
8
+ "packageManager":
9
+ "type": "enum"
10
+ "values": ["pnpm", "npm", "yarn", "bun"]
11
+ "default": "pnpm"
12
+ "prompt": "Package manager (used in the install line)"
13
+ "withHeal":
14
+ "type": "boolean"
15
+ "default": false
16
+ "prompt": "Include the `vis ai heal` propose + block-step accept flow?"
17
+ "agentQueue":
18
+ "type": "string"
19
+ "default": "default"
20
+ "prompt": "Buildkite agent queue to schedule on"
@@ -1,26 +0,0 @@
1
- /**
2
- * Base class for all `vis.config.ts` / `vis.task.ts` loader failures.
3
- * Consumers switch on `instanceof VisConfigError` to distinguish loader
4
- * failures from arbitrary user-code exceptions thrown inside a config.
5
- */
6
- declare class VisConfigError extends Error {
7
- readonly chain: ReadonlyArray<string>;
8
- constructor(message: string, chain: ReadonlyArray<string>, options?: ErrorOptions);
9
- }
10
- /** An `extends` chain re-enters a path that is still loading. */
11
- declare class VisConfigCycleError extends VisConfigError {
12
- constructor(reentered: string, chain: ReadonlyArray<string>);
13
- }
14
- /**
15
- * Wraps any throw raised by jiti while compiling a `vis.config.ts` /
16
- * `vis.task.ts`. Without this wrapper a user's syntax error surfaces as
17
- * "TypeError in workspace.ts" — which sends them debugging the wrong file.
18
- */
19
- declare class VisConfigLoadError extends VisConfigError {
20
- constructor(filePath: string, chain: ReadonlyArray<string>, cause: unknown);
21
- }
22
- /** An entry in `extends` could not be resolved on disk or via npm. */
23
- declare class VisConfigNotFoundError extends VisConfigError {
24
- constructor(specifier: string, chain: ReadonlyArray<string>, attempted: ReadonlyArray<string>);
25
- }
26
- export { VisConfigCycleError, VisConfigError, VisConfigLoadError, VisConfigNotFoundError };
@@ -1 +0,0 @@
1
- import{VisConfigCycleError as f}from"../packem_shared/VisConfigCycleError-CAYNC7d-.js";import{VisConfigError as e}from"../packem_shared/VisConfigError-B5LP1zRf.js";import{VisConfigLoadError as t}from"../packem_shared/VisConfigLoadError-CeqBSd2Z.js";import{VisConfigNotFoundError as g}from"../packem_shared/VisConfigNotFoundError-DZ9KC527.js";export{f as VisConfigCycleError,e as VisConfigError,t as VisConfigLoadError,g as VisConfigNotFoundError};
@@ -1,2 +0,0 @@
1
- var x=Object.defineProperty;var m=(e,t)=>x(e,"name",{value:t,configurable:!0});import{createRequire as A}from"node:module";import{findCacheDirSync as D}from"@visulima/find-cache-dir";import{isAccessibleSync as d,ensureDirSync as y,readJsonSync as V,writeJsonSync as T}from"@visulima/fs";import{join as f,dirname as v,isAbsolute as B}from"@visulima/path";import{createJiti as b}from"jiti";import{m as J}from"../packem_shared/target-merge-DNa-6eWu.js";import{VisConfigCycleError as L}from"../packem_shared/VisConfigCycleError-CAYNC7d-.js";import{VisConfigLoadError as S}from"../packem_shared/VisConfigLoadError-CeqBSd2Z.js";import{VisConfigNotFoundError as C}from"../packem_shared/VisConfigNotFoundError-DZ9KC527.js";const R=A(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=m(e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,s]=l.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return l.getBuiltinModule(e)}return R(e)},"__cjs_getBuiltinModule"),{createHash:j}=g("node:crypto"),{readdirSync:_,copyFileSync:I,unlinkSync:P,readFileSync:$}=g("node:fs"),{createRequire:q}=g("node:module"),{tmpdir:N}=g("node:os");var M=Object.defineProperty,n=m((e,t)=>M(e,"name",{value:t,configurable:!0}),"r");const F=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],U=new Set(F),G=["vis.task.ts","vis.task.mts","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.cjs"],W=new Set(G),z={blockExoticSubdeps:!0,strictDepBuilds:!0,trustPolicy:"no-downgrade",trustPolicyIgnoreAfter:43200},H=n(e=>({...z,...e}),"mergeSecurityDefaults"),k=n(e=>({...e,security:H(e.security),update:{security:!0,target:"minor",...e.update}}),"applyDefaults"),K=n(e=>{let t;try{t=_(e)}catch{return}const s=new Set(t.filter(r=>U.has(r)));for(const r of F)if(s.has(r))return f(e,r)},"findVisConfigFile"),Y=n(e=>{let t;try{t=_(e)}catch{return}const s=new Set(t.filter(r=>W.has(r)));for(const r of G)if(s.has(r))return f(e,r)},"findVisTaskConfigFile"),w=n(e=>j("sha256").update($(e)).digest("hex"),"hashFileContents"),Q=n(e=>{const t=j("sha256"),s=[...e].sort();for(const r of s)t.update(r),t.update(":"),t.update(w(r)),t.update(`
2
- `);return t.digest("hex")},"hashConfigChain"),X=n(e=>{const t=f(e,"node_modules");if(d(t)){const r=f(t,".cache","vis");return y(r),f(r,"vis-config-cache.json")}const s=D("vis",{create:!0,cwd:e});return s?f(s,"vis-config-cache.json"):void 0},"getConfigCachePath"),Z=n((e,t)=>{if(d(e))try{const s=V(e);if(s.hash===t)return s.config}catch{}},"readConfigCache"),ee=n((e,t,s)=>{try{y(v(e)),T(e,{config:s,hash:t})}catch{}},"writeConfigCache"),te=n(e=>e===void 0?[]:Array.isArray(e)?e:[e],"normalizeExtends"),se=n((e,t,s)=>{if(B(e))throw new C(e,[...s,t],["Absolute paths in `extends` are not supported. Use a relative path or an npm package name."]);const r=[];if(e.startsWith("./")||e.startsWith("../")){const o=v(t),i=f(o,e);if(r.push(i),d(i))return i;throw new C(e,[...s,t],r)}try{return q(t).resolve(e)}catch{throw r.push(`require.resolve("${e}") from ${t}`),new C(e,[...s,t],r)}},"resolveExtendsSpecifier"),E=n(async(e,t,s)=>{const r=w(t),o=t.slice(t.lastIndexOf(".")),i=f(N(),`vis-config-${r}${o}`);I(t,i);let c;try{c=await e.import(i,{default:!0,try:!0})??{}}catch(a){throw new S(t,s,a)}finally{try{P(i)}catch{}}try{return(typeof c=="function"?await c()??{}:c)??{}}catch(a){throw new S(t,s,a)}},"loadRawConfig"),re=n((e,t)=>{const s={...e,...t};if(e.targetDefaults||t.targetDefaults){const r=new Set([...Object.keys(e.targetDefaults??{}),...Object.keys(t.targetDefaults??{})]),o={};for(const i of r)o[i]=J(e.targetDefaults?.[i],t.targetDefaults?.[i]);s.targetDefaults=o}return(e.taskDefaults||t.taskDefaults)&&(s.taskDefaults=[...e.taskDefaults??[],...t.taskDefaults??[]]),(e.fileGroups||t.fileGroups)&&(s.fileGroups={...e.fileGroups,...t.fileGroups}),(e.taskGroups||t.taskGroups)&&(s.taskGroups={...e.taskGroups,...t.taskGroups}),(e.security||t.security)&&(s.security={...e.security,...t.security}),(e.update||t.update)&&(s.update={...e.update,...t.update}),(e.taskRunnerOptions||t.taskRunnerOptions)&&(s.taskRunnerOptions={...e.taskRunnerOptions,...t.taskRunnerOptions}),delete s.extends,s},"mergeVisConfigs"),O=n(async(e,t,s,r,o,i)=>{if(r.has(t))throw new L(t,s);if(!o.has(t)){r.add(t);try{const c=await E(e,t,s),a=te(c.extends);for(const u of a){const p=se(u,t,s);await O(e,p,[...s,t],r,o,i)}o.set(t,c),i.push(t)}finally{r.delete(t)}}},"resolveConfigChain"),Ce=n(async e=>{const t=K(e);if(!t)return k({});const s=b(e,{fsCache:!1,moduleCache:!1}),r=new Set,o=new Map,i=[];await O(s,t,[],r,o,i);const c=Q(i),a=X(e);if(a){const h=Z(a,c);if(h)return h}let u={};for(const h of i)u=re(u,o.get(h));const p=k(u);return a&&ee(a,c,p),p},"loadVisConfig"),ie=n(e=>e.replaceAll(/[^\w.-]+/g,"_"),"sanitizeProjectName"),ne=n((e,t)=>{const s=f(e,"node_modules"),r=ie(t);if(d(s)){const i=f(s,".cache","vis","task-configs");return y(i),f(i,`${r}.json`)}const o=D("vis",{create:!0,cwd:e});return o?f(o,"task-configs",`${r}.json`):void 0},"getVisTaskCachePath"),oe=n((e,t)=>{if(d(e))try{const s=V(e);if(s.hash===t)return s.config}catch{}},"readVisTaskCache"),ae=n((e,t,s)=>{try{y(v(e)),T(e,{config:s,hash:t})}catch{}},"writeVisTaskCache"),ke=n(async(e,t,s)=>{const r=Y(t);if(!r)return;const o=w(r),i=ne(e,s);if(i){const u=oe(i,o);if(u)return u}const c=b(t,{fsCache:!1,moduleCache:!1}),a=await E(c,r,[]);return i&&ae(i,o,a),a},"loadVisTaskConfig");n(e=>e,"defineTaskConfig");n(e=>k(e),"defineConfig");n(e=>e,"definePlugin");export{F as CONFIG_FILES,z as SECURITY_DEFAULTS,G as TASK_CONFIG_FILES,k as applyDefaults,K as findVisConfigFile,Y as findVisTaskConfigFile,Ce as loadVisConfig,ke as loadVisTaskConfig};
@@ -1 +0,0 @@
1
- var t=Object.defineProperty;var o=(e,r)=>t(e,"name",{value:r,configurable:!0});import{VisConfigError as c}from"./VisConfigError-B5LP1zRf.js";var s=Object.defineProperty,a=o((e,r)=>s(e,"name",{value:r,configurable:!0}),"e");class C extends c{static{o(this,"VisConfigCycleError")}static{a(this,"VisConfigCycleError")}constructor(r,i){const n=[...i,`${r} (re-enters)`].join(" → ");super(`Config cycle: ${n}`,i)}}export{C as VisConfigCycleError};
@@ -1 +0,0 @@
1
- var n=Object.defineProperty;var e=(t,r)=>n(t,"name",{value:r,configurable:!0});var o=Object.defineProperty,a=e((t,r)=>o(t,"name",{value:r,configurable:!0}),"s");class h extends Error{static{e(this,"VisConfigError")}static{a(this,"VisConfigError")}chain;constructor(r,s,i){super(r,i),this.name=this.constructor.name,this.chain=s}}export{h as VisConfigError};
@@ -1,2 +0,0 @@
1
- var n=Object.defineProperty;var t=(o,r)=>n(o,"name",{value:r,configurable:!0});import{VisConfigError as c}from"./VisConfigError-B5LP1zRf.js";var g=Object.defineProperty,f=t((o,r)=>g(o,"name",{value:r,configurable:!0}),"t");class u extends c{static{t(this,"VisConfigLoadError")}static{f(this,"VisConfigLoadError")}constructor(r,i,e){const a=e instanceof Error?e.message:String(e),s=i.length>0?`
2
- Chain: ${i.join(" → ")}`:"";super(`Failed to load ${r}: ${a}${s}`,i,{cause:e})}}export{u as VisConfigLoadError};
@@ -1,5 +0,0 @@
1
- var c=Object.defineProperty;var n=(o,r)=>c(o,"name",{value:r,configurable:!0});import{VisConfigError as f}from"./VisConfigError-B5LP1zRf.js";var g=Object.defineProperty,i=n((o,r)=>g(o,"name",{value:r,configurable:!0}),"t");const l=i(o=>o.join(" → "),"formatChain");class h extends f{static{n(this,"VisConfigNotFoundError")}static{i(this,"VisConfigNotFoundError")}constructor(r,t,e){const s=t.length>0?t[t.length-1]:"<unknown>",a=e.length>0?`
2
- Tried:
3
- ${e.join(`
4
- `)}`:"";super(`Cannot resolve "${r}" extended from ${s}.${a}
5
- Chain: ${l(t)}`,t)}}export{h as VisConfigNotFoundError};
@@ -1 +0,0 @@
1
- var fe=Object.defineProperty;var k=(s,l)=>fe(s,"name",{value:l,configurable:!0});import{jsxs as t,jsx as r,Fragment as Z}from"react/jsx-runtime";import{useWindowSize as ae,Box as i,Spinner as me,Text as e,ScrollView as we,Tabs as ye,Tab as be,ScrollBar as Ce,useApp as ke,useInput as xe,Dialog as ee}from"@visulima/tui";import{useSyncExternalStore as Te,useState as L,useRef as W,useMemo as Se,useCallback as de,useEffect as ve}from"react";import{B as se,M as he}from"../packem_chunks/bin.js";import{u as Ae}from"./use-measured-height-DjYgUOKk.js";var Re=Object.defineProperty,Ee=k((s,l)=>Re(s,"name",{value:l,configurable:!0}),"a$1");function Ie({current:s,total:l}){const{columns:h}=ae(),c=h||80,p=l>0?s/l:0,a=`${String(Math.round(p*100))}%`,m=Math.max(10,c-4),b=Math.round(m*p),f=m-b;return t(i,{flexDirection:"column",paddingX:1,children:[t(i,{children:[r(me,{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(Ie,"f$2");Ee(Ie,"CheckProgressApp");var De=Object.defineProperty,G=k((s,l)=>De(s,"name",{value:l,configurable:!0}),"r");const Q=G(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"),_=G((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 lr{static{k(this,"UpdateStore")}static{G(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:Q(l),phase:"browsing",selectedIndex:0}}getSnapshot=G(()=>this.#e,"getSnapshot");subscribe=G(l=>(this.#l.add(l),()=>{this.#l.delete(l)}),"subscribe");getFilteredEntries(){return _(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=_(this.#t,l,this.#e.filterText);this.#r({...this.#e,entries:h,filterType:l,groupedByCatalog:Q(h),selectedIndex:0})}}setFilter(l){const h=_(this.#t,this.#e.filterType,l);this.#r({...this.#e,entries:h,filterText:l,groupedByCatalog:Q(h),selectedIndex:0})}setFilterActive(l){if(l!==this.#e.filterActive)if(l)this.#r({...this.#e,filterActive:!0});else{const h=_(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:h,filterActive:!1,filterText:"",groupedByCatalog:Q(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 Be=Object.defineProperty,Ne=k((s,l)=>Be(s,"name",{value:l,configurable:!0}),"d");const Pe={major:"red",minor:"yellow",patch:"green"},Le={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Me={critical:"red",high:"red",low:"gray",medium:"yellow"},je={critical:"red",high:"red",low:"green",medium:"yellow"},Fe={defer:"gray",review:"yellow",skip:"red",update:"green"},Oe=Ne(({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 m=Pe[l.updateType]??"white",b=l.vulnerabilities&&l.vulnerabilities.length>0,f=l.socketReport?.score.overall??0,w=l.socketReport?se(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(we,{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:m,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(o=>t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{gap:1,children:[t(e,{bold:!0,color:Le[o.severity]??"gray",children:["⚠"," ",o.severity]}),r(e,{bold:!0,children:o.id})]}),r(i,{paddingLeft:2,children:r(e,{children:o.summary})}),t(i,{gap:2,paddingLeft:2,children:[o.cvssScore!==void 0&&t(e,{dimColor:!0,children:["CVSS:",String(o.cvssScore)]}),o.fixedVersions.length>0&&t(e,{dimColor:!0,children:["Fixed in:",o.fixedVersions.join(", ")]})]})]},o.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:w,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(o=>t(i,{gap:1,paddingLeft:2,children:[t(e,{bold:!0,color:Me[o.severity]??"gray",children:["[",o.severity.toUpperCase(),"]"]}),r(e,{children:o.type}),t(e,{dimColor:!0,children:["(",o.category,")"]})]},o.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:Fe[c.action]??"white",children:c.action})]}),t(i,{children:[r(e,{dimColor:!0,children:"Risk: "}),r(e,{bold:!0,color:je[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((o,I)=>t(e,{children:[" ","•"," ",o]},String(I)))]})]}),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(Z,{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(Z,{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(Z,{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 $e=Object.defineProperty,re=k((s,l)=>$e(s,"name",{value:l,configurable:!0}),"f");const Ue={major:"red",minor:"yellow",patch:"green"},Ge=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],He=re(({checked:s,entry:l,isSelected:h})=>{const c=Ue[l.updateType]??"white",p=l.vulnerabilities&&l.vulnerabilities.length>0,a=l.socketReport&&l.socketReport.alerts.length>0,m=!!l.acceptedRisk,b=s?"☑":"☐",f=l.socketReport?`${String(Math.round(l.socketReport.score.overall*100))}%`:"",w=l.socketReport?se(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:m?"gray":"red",children:m?"✓ ":"⚠ "}):r(e,{children:" "}),r(i,{flexGrow:1,children:t(e,{bold:h,inverse:h,wrap:"truncate",children:[l.packageName,m?" [ack]":""]})}),f&&t(e,{color:w,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"),Ve=re(({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"),qe=re(({checkedEntries:s,entries:l,filterActive:h,filteredOutCount:c,filterText:p,filterType:a,focused:m,groupedByCatalog:b,isDryRun:f,onViewportHeightChange:w,scrollOffset:o,selectedIndex:I,totalCatalogEntries:D,totalChecked:v,totalEntries:H,viewportHeight:M})=>{const j=m?"white":"gray",{measuredHeight:y,ref:A}=Ae(M,w);let F=0,S=0,B=0,R=0;for(const g of l)g.updateType==="major"?F++:g.updateType==="minor"?S++:B++,(g.vulnerabilities&&g.vulnerabilities.length>0||g.socketReport&&g.socketReport.alerts.length>0)&&R++;const x=[];F>0&&x.push(`${F} major`),S>0&&x.push(`${S} minor`),B>0&&x.push(`${B} patch`),R>0&&x.push(`${R} vulnerable`);const N=x.length>0?` (${x.join(", ")})`:"";let T=0;for(const g of l)s.has(g.packageName)&&T++;const C=[];let V=0;for(const[g,E]of b){C.push(r(Ve,{count:E.length,name:g},`hdr-${g}`));for(const $ of E){const P=V;C.push(r(He,{checked:s.has($.packageName),entry:$,isSelected:P===I},$.packageName)),V++}}let O=0;for(const[,g]of b)O+=2+g.length;const q=O>y&&y>0;return t(i,{borderColor:j,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:[H,v>0?`/${v}`:""," ","outdated",N,D>v?` · ${D-v} dupes`:""]}),!f&&T>0&&t(e,{dimColor:!0,children:[" ","—",T," ","selected"]})]}),r(i,{flexShrink:0,paddingX:1,paddingY:1,children:r(ye,{isFocused:m,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:k(()=>{},"onChange"),showIndex:!1,value:a,children:Ge.map(({id:g,label:E})=>r(be,{name:g,children:E},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",ref:A,children:[r(i,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(i,{flexDirection:"column",marginTop:-o,children:C})}),q&&r(i,{flexShrink:0,marginLeft:1,marginRight:1,children:r(Ce,{contentHeight:O,placement:"inset",scrollOffset:o,style:"block",viewportHeight:y})})]},`list-${a}-${p}`)]})},"PackageListPanel");var Ke=Object.defineProperty,Xe=k((s,l)=>Ke(s,"name",{value:l,configurable:!0}),"K");const Ye=100,ze=40,We=10,Qe=[],ir=Xe(({autoExitSeconds:s=0,changelogUrls:l,checkedCount:h=0,filteredOutEntries:c=Qe,isDryRun:p,store:a,totalCatalogEntries:m=0})=>{const{exit:b}=ke(),{columns:f,rows:w}=ae(),o=Te(a.subscribe,a.getSnapshot),[I,D]=L(!1),[v,H]=L(!1),M=W(null),j=W(null),y=W(null),A=W(null),[F,S]=L(0),[B,R]=L(!1),[x,N]=L(!1),T=Se(()=>a.getFilteredEntries(),[o.entries,o.filterType,o.filterText]),C=T[o.selectedIndex]??null,V=C?a.getRecommendation(C.packageName):void 0,O=C&&l?l.get(C.packageName):void 0,q=de(n=>{let d=0,u=0;for(const[,Y]of o.groupedByCatalog){d+=2;for(let z=0;z<Y.length;z++){if(u===n)return d;d+=1,u++}}return d},[o.groupedByCatalog]),g=Math.max(1,w-8-(o.filterActive?1:0)),[E,$]=L(g),P=E>0?E:g,U=de(n=>{const d=q(n);S(u=>d>u+P-2?Math.max(0,d-P+2):d<u+1?Math.max(0,d-1):u)},[q,P]);if(ve(()=>{y.current?.scrollToTop()},[C?.packageName]),xe((n,d)=>{if(n==="c"&&d.ctrl){b();return}if(!x){if(v){d.escape||n==="f"||n==="q"?H(!1):d.downArrow||n==="j"?j.current?.scrollBy(1):(d.upArrow||n==="k")&&j.current?.scrollBy(-1);return}if(B){n==="u"||d.return?(R(!1),a.startApply(),b(a.getCheckedEntries())):d.escape||n==="q"?R(!1):d.downArrow||n==="j"?A.current?.scrollBy(1):d.upArrow||n==="k"?A.current?.scrollBy(-1):d.pageDown?A.current?.scrollBy(5):d.pageUp&&A.current?.scrollBy(-5);return}if(I){d.escape||n==="?"?D(!1):n==="q"?(D(!1),N(!0)):d.downArrow||n==="j"?M.current?.scrollBy(1):(d.upArrow||n==="k")&&M.current?.scrollBy(-1);return}if(n==="?"){D(!0);return}if(n==="q"){N(!0);return}if(d.tab){a.setFocusedPanel(o.focusedPanel==="list"?"detail":"list");return}if(o.focusedPanel==="list"&&(d.leftArrow||d.rightArrow)){const u=["all","major","minor","patch","security"],Y=u.indexOf(o.filterType),z=d.rightArrow?(Y+1)%u.length:(Y-1+u.length)%u.length;S(0),y.current?.scrollToTop(),a.setFilterType(u[z]);return}if(n==="f"&&c.length>0){H(u=>!u);return}if(o.filterActive){if(d.escape){a.setFilterActive(!1);return}if(d.return){a.setFilterActive(!1);return}if(d.backspace){S(0),a.setFilter(o.filterText.slice(0,-1));return}if(n&&!d.ctrl&&!d.meta){S(0),a.setFilter(o.filterText+n);return}return}if(o.focusedPanel==="list"){if(d.downArrow||n==="j"){const u=Math.min(o.selectedIndex+1,T.length-1);a.setSelectedIndex(u),U(u);return}if(d.upArrow||n==="k"){const u=Math.max(o.selectedIndex-1,0);a.setSelectedIndex(u),U(u);return}if(d.pageDown){const u=Math.min(o.selectedIndex+10,T.length-1);a.setSelectedIndex(u),U(u);return}if(d.pageUp){const u=Math.max(o.selectedIndex-10,0);a.setSelectedIndex(u),U(u);return}if(d.home){a.setSelectedIndex(0),S(0);return}if(d.end){const u=T.length-1;a.setSelectedIndex(u),U(u);return}if(n===" "||d.return){C&&a.toggleCheck(C.packageName);return}if(n==="a"){a.toggleAll();return}if(n==="/"){a.setFilterActive(!0);return}if(n==="u"&&!p&&o.checkedEntries.size>0){R(!0);return}if(d.rightArrow){a.setFocusedPanel("detail");return}return}if(o.focusedPanel==="detail"){if(d.escape||d.leftArrow){a.setFocusedPanel("list");return}if(d.downArrow||n==="j"){y.current?.scrollBy(1);return}if(d.upArrow||n==="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<ze||w<We)return r(i,{alignItems:"center",height:w,justifyContent:"center",width:f,children:t(e,{color:"yellow",children:["Terminal too small (",f,"x",w,")"]})});const ue=f>=Ye,K=[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&&o.checkedEntries.size>0&&K.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"green",children:"u"}),r(e,{dimColor:!0,children:"APPLY"})]},"u")),c.length>0&&K.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"yellow",children:"f"}),t(e,{dimColor:!0,children:["FILTERED (",c.length,")"]})]},"fo")),K.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 te=r(i,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:r(i,{flexWrap:"wrap",gap:2,paddingX:1,children:K})}),le=t(ee,{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:I,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"})]})]})]}),X=a.getCheckedEntries(),J=X.filter(n=>n.updateType==="major").length,pe=t(i,{alignItems:"center",flexDirection:"column",children:[J>0&&r(i,{marginBottom:1,marginTop:1,children:t(e,{color:"yellow",children:["⚠"," ",J," ","major update",J===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"]})]}),ie=r(ee,{footer:pe,scrollRef:A,title:`Apply ${X.length} update${X.length===1?"":"s"}?`,visible:B,width:70,children:X.map(n=>t(i,{gap:1,children:[t(e,{children:[" ",n.packageName]}),t(e,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),r(e,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))}),oe=c.length>0?r(ee,{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:j,title:`${c.length} PACKAGE${c.length===1?"":"S"} FILTERED BY TARGET`,visible:v,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(n=>t(i,{gap:1,children:[t(e,{children:[" ",n.packageName]}),t(e,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),r(e,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))]})}):null,ne=r(qe,{checkedEntries:o.checkedEntries,entries:T,filterActive:o.filterActive,filteredOutCount:c.length,filterText:o.filterText,filterType:o.filterType,focused:o.focusedPanel==="list",groupedByCatalog:o.groupedByCatalog,isDryRun:p,onViewportHeightChange:$,scrollOffset:F,selectedIndex:o.selectedIndex,totalCatalogEntries:m,totalChecked:h,totalEntries:T.length,viewportHeight:P}),ce=r(Oe,{changelogUrl:O,entry:C,focused:o.focusedPanel==="detail",recommendation:V,scrollRef:y});if(ue){const n=Math.floor(f*.35);return t(i,{flexDirection:"column",height:w,width:f,children:[t(i,{flexDirection:"row",flexGrow:1,children:[r(i,{flexGrow:1,children:ne}),r(i,{width:n,children:ce})]}),te,ie,oe,r(he,{autoExitSeconds:s||3,onCancel:k(()=>{N(!1)},"onCancel"),visible:x}),le]})}const ge=Math.floor(w*.55);return t(i,{flexDirection:"column",height:w,width:f,children:[r(i,{height:ge,children:ne}),r(i,{flexGrow:1,children:ce}),te,ie,oe,r(he,{autoExitSeconds:s||3,onCancel:k(()=>{N(!1)},"onCancel"),visible:x}),le]})},"VisUpdateApp");export{ir as B,lr as U,Ie as f};
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var r=(t,e)=>c(t,"name",{value:e,configurable:!0});var p=Object.defineProperty,a=r((t,e)=>p(t,"name",{value:e,configurable:!0}),"t");function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}r(f,"getDefaultExportFromCjs");a(f,"getDefaultExportFromCjs");function l(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}r(l,"getDefaultExportFromNamespaceIfPresent");a(l,"getDefaultExportFromNamespaceIfPresent");function s(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")&&Object.keys(t).length===1?t.default:t}r(s,"getDefaultExportFromNamespaceIfNotNamed");a(s,"getDefaultExportFromNamespaceIfNotNamed");function m(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var o=a(r(function n(){var u=!1;try{u=this instanceof n}catch{}return u?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)},"a"),"a");o.prototype=e.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var u=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(o,n,u.get?u:{enumerable:!0,get:a(function(){return t[n]},"get")})}),o}r(m,"getAugmentedNamespace");a(m,"getAugmentedNamespace");export{f as g};
@@ -1,67 +0,0 @@
1
- var R=Object.defineProperty;var y=(e,r)=>R(e,"name",{value:r,configurable:!0});import{runProvider as E,PROVIDER_NAMES as j,detectProvider as T,detectAvailableProviders as N}from"@visulima/find-ai-runner";import{renderToString as C,Box as I,Text as g,Table as L}from"@visulima/tui";import d from"react";import{D as x,R as M,j as P,k as O}from"./ai-cache-Bynt6Y9x.js";var q=Object.defineProperty,w=y((e,r)=>q(e,"name",{value:r,configurable:!0}),"i");const B=12e4,J=2,z=1e3,D=w(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),b=w(async(e,r,i=J)=>{let a;for(let t=0;t<=i;t+=1)try{return(await E(e,r,{timeoutMs:B})).stdout}catch(n){if(a=n instanceof Error?n:new Error(String(n)),a.message.includes("timed out"))throw a;if(t<i){const s=z*2**t;await D(s)}}throw a??new Error("AI request failed after retries")},"runWithRetry");var F=Object.defineProperty,l=y((e,r)=>F(e,"name",{value:r,configurable:!0}),"c");const V={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},_=l(e=>{if(e?.provider){if(!j.includes(e.provider))return;const a=T(e.provider);return a.available?a:void 0}const r=N();if(r.length===0)return;const i={...V,...e?.priority};return r.toSorted((a,t)=>(i[t.name]??0)-(i[a.name]??0))[0]},"resolveProvider"),U=new Set(["defer","review","skip","update"]),W=new Set(["critical","high","low","medium"]),Y=new Set(["high","low","medium"]),K=50,f=30,G=l(e=>e.map(r=>{const i=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(t=>`${t.severity} ${t.id}`).join(", ")}]`:"";let a="";if(r.socketReport){const t=Math.round(r.socketReport.score.overall*100),n=[`score:${String(t)}%`];if(r.socketReport.alerts.length>0){const s=r.socketReport.alerts.reduce((o,c)=>(o[c.severity]=(o[c.severity]??0)+1,o),{}),u=Object.entries(s).map(([o,c])=>`${String(c)} ${o}`).join(", ");n.push(`alerts: ${u}`)}n.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),n.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),a=` [SOCKET.DEV: ${n.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${i}${a}`}).join(`
2
- `),"buildPackageList"),h=`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
- }`,X={compatibility:l(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
- ${h}`,"compatibility"),impact:l(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
- ${h}`,"impact"),recommend:l(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
- ${h}`,"recommend"),security:l(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
- ${h}`,"security")},H=new Set(["compatibility","impact","recommend","security"]),ue=l(e=>H.has(e)?e:"impact","validateAnalysisType"),S=l((e,r="impact")=>{const i=G(e);return X[r](i)},"buildAnalysisPrompt"),Z=/```(?:json)?\s*([\s\S]*?)```/,Q=/\{[\s\S]*\}/,ee=l(e=>{try{return JSON.parse(e)}catch{}const r=Z.exec(e);if(r?.[1])try{return JSON.parse(r[1])}catch{}const i=Q.exec(e);if(i?.[0])try{return JSON.parse(i[0])}catch{}},"extractJson"),re=l(e=>({action:U.has(e.action)?e.action:"review",breakingChanges:Array.isArray(e.breakingChanges)?e.breakingChanges:[],effort:Y.has(e.effort)?e.effort:"medium",package:typeof e.package=="string"?e.package:"",reason:typeof e.reason=="string"?e.reason:"",riskLevel:W.has(e.riskLevel)?e.riskLevel:"medium"}),"normalizeRecommendation"),$=l((e,r,i)=>{const a=ee(e);if(!a||typeof a!="object")return{analysisType:i,provider:r,recommendations:[],summary:"Failed to parse AI response.",warnings:["AI response was not valid JSON."]};const t=a,n=Array.isArray(t.recommendations)?t.recommendations:[];return{analysisType:i,provider:r,recommendations:n.map(s=>re(s)),summary:typeof t.summary=="string"?t.summary:"",warnings:Array.isArray(t.warnings)?t.warnings:[]}},"parseAiResponse"),ae={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"]},te=new Set(["bcrypt","cors","crypto-js","express-session","helmet","jose","jsonwebtoken","node-forge","oauth","passport"]),v=l((e,r)=>{const i=e.map(a=>{const t=a.vulnerabilities&&a.vulnerabilities.length>0,n=te.has(a.packageName),s=ae[a.packageName]??[];let u="low",o="update",c="low",m="Patch/minor update, safe to apply.";return a.updateType==="major"?(u="high",o=s.length>0?"review":"update",c="medium",m=s.length>0?`Major update with known breaking changes: ${s[0]}`:"Major version update, review changelog before applying."):a.updateType==="minor"&&(u="medium",m="Minor update, generally safe."),t&&(u="high",o="update",m="Security update — current version has known vulnerabilities."),n&&a.updateType==="major"&&(o="review",m="Security-sensitive package with major update, careful review needed.",c="high"),{action:o,breakingChanges:s,effort:c,package:a.packageName,reason:m,riskLevel:u}});return{analysisType:r,provider:"rule-engine",recommendations:i,summary:`Rule-based ${r} analysis for ${String(e.length)} packages.`,warnings:["No AI provider available — using built-in rule engine."]}},"ruleBasedAnalysis"),ie=l(async(e,r,i)=>{const a=S(r,i),t=await b(e,a);return $(t,e.name,i)},"analyzeChunk"),ne=l((e,r,i)=>{const a=[],t=[],n=[];for(const s of e)a.push(...s.recommendations),t.push(...s.warnings),s.summary&&n.push(s.summary);return{analysisType:i,provider:r,recommendations:a,summary:n.length===1?n[0]??"":`Analyzed ${String(a.length)} packages in ${String(e.length)} batches.`,warnings:[...new Set(t)]}},"mergeResults"),A={compatibility:"Compatibility",impact:"Impact",recommend:"Recommendations",security:"Security"},me=l(e=>{const r=`${A[e.analysisType]??e.analysisType} Analysis (${e.provider})`,i=e.recommendations.flatMap(t=>{const n=[{action:t.action,effort:t.effort,package:t.package,reason:t.reason,risk:t.riskLevel}];return t.breakingChanges.length>0&&n.push({action:"",effort:"",package:"",reason:`Breaking: ${t.breakingChanges.join("; ")}`,risk:""}),n}),a=process.stdout.columns||80;return C(d.createElement(I,{borderStyle:"round",flexDirection:"column",paddingLeft:1,paddingRight:1},d.createElement(g,{bold:!0},r),d.createElement(g,null,""),d.createElement(g,null,e.summary),d.createElement(g,null,""),d.createElement(L,{borderStyle:"none",data:i}),...e.warnings.length>0?[d.createElement(g,null,""),...e.warnings.map((t,n)=>d.createElement(g,{dimColor:!0,key:String(n)},` ${t}`))]:[]),{columns:a})},"formatAiAnalysis");l(e=>JSON.stringify(e,void 0,2),"formatAiAnalysisJson");const de=l(async(e,r,i,a="impact")=>{const t=_(i);if(!t)return r.info(`No AI CLI tool found, using rule-based analysis.
63
- `),v(e,a);const n=x(t.name,a,e),s=M(n);if(s)return r.info(`Using cached ${a} analysis from ${s.provider}.
64
- `),s;const u=A[a]??a;r.info(`Running ${u.toLowerCase()} analysis with ${t.name}...
65
- `);try{let o;if(e.length>K){r.info(`Splitting ${String(e.length)} packages into batches of ${String(f)}...
66
- `);const c=[];for(let p=0;p<e.length;p+=f)c.push(e.slice(p,p+f));const m=[];for(let p=0;p<c.length;p+=1){r.info(` Batch ${String(p+1)}/${String(c.length)}...`);const k=c[p];k&&m.push(await ie(t,k,a))}o=ne(m,t.name,a)}else{const c=await b(t,S(e,a));o=$(c,t.name,a)}return P(n,o,O(a,i?.cacheTtl)),o}catch(o){const c=o instanceof Error?o.message:String(o);return r.warn(`AI analysis failed (${c}), falling back to rule engine.
67
- `),v(e,a)}},"runAiAnalysis");export{V as R,me as Z,_ as b,de as e,b as r,ee as w,ue as z};
@@ -1 +0,0 @@
1
- var W=Object.defineProperty;var u=(e,t)=>W(e,"name",{value:t,configurable:!0});import{createRequire as C}from"node:module";import{resolve as a,isAbsolute as g,dirname as b,relative as S}from"@visulima/path";import{loadNativeBindings as E,DEFAULT_CACHE_DIRECTORY_NAME as y}from"@visulima/task-runner";const R=C(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=u(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 R(e)},"__cjs_getBuiltinModule"),{execFileSync:m}=v("node:child_process"),{realpathSync:M,statSync:A}=v("node:fs");var B=Object.defineProperty,c=u((e,t)=>B(e,"name",{value:t,configurable:!0}),"r");let f,h=!1;const p=c(()=>{if(h)return f;h=!0;const e=E();return e&&typeof e.getMainWorktreeRoot=="function"&&typeof e.isLinkedWorktree=="function"&&(f={getMainWorktreeRoot:e.getMainWorktreeRoot,isLinkedWorktree:e.isLinkedWorktree,resetWorktreeCache:typeof e.resetWorktreeCache=="function"?e.resetWorktreeCache:()=>{}}),f},"getNativeBindings"),d=new Map,k=c(e=>{try{return M(e)}catch{return e}},"canonicalize"),_=c(e=>{try{return A(a(e,".git")).isFile()}catch{return!1}},"fallbackIsLinkedWorktree"),D=c(e=>{const t=k(e);if(d.has(t))return d.get(t);let r;try{if(_(t)){const o=m("git",["rev-parse","--git-common-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(o.length>0){const n=g(o)?o:a(t,o),i=k(b(n));r=i===t?void 0:i}}else r=void 0}catch{r=void 0}return d.set(t,r),r},"fallbackGetMainWorktreeRoot"),j=c(e=>{const t=p();if(t){const r=t.getMainWorktreeRoot(e);return typeof r=="string"&&r.length>0?r:void 0}return D(e)},"getMainWorktreeRoot");c(e=>{const t=p();return t?t.isLinkedWorktree(e):_(e)},"isLinkedWorktree");c(()=>{d.clear();const e=p();e&&e.resetWorktreeCache()},"resetWorktreeCache");var I=Object.defineProperty,s=u((e,t)=>I(e,"name",{value:t,configurable:!0}),"i");const L=s((e,t,r)=>{const o=s(i=>g(i)?i:a(e,i),"normalize");if(t&&t.length>0)return o(t);if(r&&r.length>0)return o(r);const n=process.env.VIS_CACHE_DIRECTORY;return n&&n.length>0?o(n):a(e,y)},"resolveCacheDirectory"),T=s((e,t)=>t===!1?e:j(e)??e,"resolveSharedCacheRoot"),P=s((e,t,r,o)=>{const n=t??r??process.env.VIS_CACHE_DIRECTORY;if(n&&n.length>0)return L(e,t,r);const i=T(e,o);return a(i,y)},"resolveSharedCacheDirectory"),H=/[^\w.-]+/g,O=/^-+|-+$/g,w=s(e=>e.trim().replaceAll(H,"-").replaceAll(O,"").slice(0,64),"sanitizeBranchSegment"),z=s(e=>{try{const t=m("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return!t||t==="HEAD"?void 0:t}catch{return}},"detectGitBranch"),Y=s((e,t,r)=>{if(r!==!0)return e;const o=z(t);if(!o)return e;const n=w(o);return n.length===0?e:a(e,"branches",n)},"applyBranchScope"),x=s((e,t)=>{const r=S(t,e);return r.length===0?!1:!(r===".."||r.startsWith("../"))&&!g(r)},"isCacheDirectoryInsideWorkspace");export{P as E,x as _,Y as a};
@@ -1,12 +0,0 @@
1
- var ge=Object.defineProperty;var O=(e,t)=>ge(e,"name",{value:t,configurable:!0});import{createRequire as ue}from"node:module";import{findCacheDirSync as G}from"@visulima/find-cache-dir";import{isAccessibleSync as d,readFileSync as y,readJsonSync as w,ensureDirSync as E,writeJsonSync as D,writeFileSync as C,walkSync as he,removeSync as ke}from"@visulima/fs";import{join as m,dirname as X}from"@visulima/path";import{Text as P,renderToString as K,Box as ye,Table as we}from"@visulima/tui";import R from"react";import{rcompare as $e,parse as ve,coerce as je}from"semver";import{b as F,U as Ne,q as be,f as L,D as Se}from"../packem_chunks/bin.js";const me=ue(import.meta.url),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,fe=O(e=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[t,a]=S.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return S.getBuiltinModule(e)}return me(e)},"__cjs_getBuiltinModule"),{createInterface:de}=fe("node:readline");var Re=Object.defineProperty,c=O((e,t)=>Re(e,"name",{value:t,configurable:!0}),"c");const Te=/^([\^~]|>=|<=|[><=])/,Ce=/^(?:'([^']+)'|"([^"]+)"|([^:\s]+)):\s*(?:'([^']+)'|"([^"]+)"|(\S+))/,Me=/^catalog:/m,Ae=/^catalogs:/m,Oe=/^(@[^:]+):registry$/,Pe=/^\/\/(.+)\/:_authToken$/,xe=/\*+/g,Ee=/[.+^${}()|[\]\\]/g,V=/[.*+?^${}()|[\]\\]/g,Z=/^['"]|['"]$/g,De=/^https?:\/\//,Q=/\/$/,We=/\n(\s+)/,ee=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Ue=new Set([...ee,"overrides","pnpm.overrides","resolutions"]),W=c(e=>{const t=G("vis",{create:!0,cwd:e});if(!t)throw new Error("Cannot resolve cache directory. Ensure node_modules exists in your workspace. Run your package manager's install command first.");return m(t,"backup")},"getBackupDir"),v=c(e=>{const t=e.replace(/^[\^~]|^>=|^<=|^[><]/,""),a=ve(t);if(a)return{major:a.major,minor:a.minor,patch:a.patch,prerelease:Array.isArray(a.prerelease)?a.prerelease.join("."):String(a.prerelease??"")};const r=je(e);if(r)return{major:r.major,minor:r.minor,patch:r.patch,prerelease:""}},"parseVersion"),te=c(e=>Te.exec(e)?.[1]??"","extractPrefix"),Fe=c(e=>{const t=`${String(e.major)}.${String(e.minor)}.${String(e.patch)}`;return e.prerelease?`${t}-${e.prerelease}`:t},"versionToString"),Le=c((e,t)=>e.major!==t.major?"major":e.minor!==t.minor?"minor":e.patch!==t.patch||e.prerelease!==t.prerelease?"patch":"none","getUpdateType"),Ve=c((e,t)=>e.major!==t.major?e.major-t.major:e.minor!==t.minor?e.minor-t.minor:e.patch!==t.patch?e.patch-t.patch:!e.prerelease&&t.prerelease?1:e.prerelease&&!t.prerelease?-1:e.prerelease&&t.prerelease?e.prerelease<t.prerelease?-1:e.prerelease>t.prerelease?1:0:0,"compareVersions"),ae=c((e,t)=>Ve(t,e)>0,"isNewer"),T=c((e,t)=>{const a=t.replaceAll(xe,"*").replaceAll(Ee,String.raw`\$&`);return new RegExp(`^${a.replaceAll("*",".*").replaceAll("?",".")}$`).test(e)},"matchesPattern"),_e=c((e,t,a)=>a.some(r=>T(e,r))?!1:t.length>0?t.some(r=>T(e,r)):!0,"matchesFilters"),re=c(e=>{const t=Ce.exec(e);if(!t)return;const a=t[1]??t[2]??t[3],r=t[4]??t[5]??t[6];if(!(!a||!r))return[a,r]},"parseYamlEntry"),se=c((e,t,a,r)=>{e.has(t)||e.set(t,new Map);const n=e.get(t);n&&n.set(a,r)},"setCatalogEntry"),Be=c((e,t,a)=>{if(a<2)return;const r=re(t);r&&se(e,"default",r[0],r[1])},"parseCatalogSection"),Ie=c((e,t,a,r)=>{if(a===2&&t.endsWith(":"))return t.slice(0,-1).trim().replaceAll(Z,"");if(a>=4&&r){const n=re(t);n&&se(e,r,n[0],n[1])}return r},"parseCatalogsSection"),ne=c(e=>e==="catalog:"||e.startsWith("catalog:")?"catalog":e==="catalogs:"||e.startsWith("catalogs:")?"catalogs":"none","detectTopLevelSection"),Je=c(e=>{const t=new Map;let a="none",r="";for(const n of e.split(`
2
- `)){const s=n.trimStart(),o=n.length-s.length;if(o===0&&s.length>0&&!s.startsWith("#")){a=ne(s),a==="catalogs"&&(r="");continue}s.length===0||s.startsWith("#")||(a==="catalog"&&Be(t,s,o),a==="catalogs"&&(r=Ie(t,s,o,r)))}return t},"parseCatalogsFromYaml"),qe=c(e=>{const t=m(e,"pnpm-workspace.yaml");if(!d(t))return!1;const a=y(t);return Me.test(a)||Ae.test(a)},"hasPnpmCatalogs"),He=c(e=>{const t=m(e,"pnpm-workspace.yaml");if(!d(t))return new Map;const a=y(t);return Je(a)},"readPnpmCatalogs"),oe=c(e=>{if(d(e))try{return w(e)}catch{return}},"readPackageJsonSafe"),Ye=c(e=>{const t=oe(m(e,"package.json"));return!!(t?.workspaces?.catalog||t?.workspaces?.catalogs)},"hasBunCatalogs"),ze=c(e=>{const t=new Map;if(e.workspaces?.catalog&&typeof e.workspaces.catalog=="object"&&t.set("default",new Map(Object.entries(e.workspaces.catalog))),e.workspaces?.catalogs&&typeof e.workspaces.catalogs=="object")for(const[a,r]of Object.entries(e.workspaces.catalogs))typeof r=="object"&&r!==void 0&&t.set(a,new Map(Object.entries(r)));return t},"parseBunCatalogs"),Ge=c(e=>{const t=oe(m(e,"package.json"));return t?ze(t):new Map},"readBunCatalogs"),M=c(e=>{const t=e.lastIndexOf(":");if(t===-1)return;const a=e.slice(t+1);if(Ue.has(a))return{depType:a,relativePath:e.slice(0,t)}},"parseCompositeCatalogName"),Xe=c(e=>e?.dev?["devDependencies"]:e?.prod?["dependencies"]:e?.depFields&&e.depFields.length>0?e.depFields:ee,"getDepTypesToInclude"),Ke=c((e,t,a)=>{const r=new Set;t&&r.add(t);for(const n of a){const s=m(e,n,"package.json");if(d(s))try{const o=w(s);o.name&&r.add(o.name)}catch{}}return r},"collectInternalPackageNames"),ce=c((e,t)=>{const a=t.split(".");let r=e;for(const n of a)if(r&&typeof r=="object")r=r[n];else return;return typeof r=="object"&&r!==null?r:void 0},"getNestedField"),Ze=c((e,t,a,r)=>{const n=t.split(".");let s=e;for(const i of n.slice(0,-1))(!s[i]||typeof s[i]!="object")&&(s[i]={}),s=s[i];const o=n.at(-1);(!s[o]||typeof s[o]!="object")&&(s[o]={}),s[o][a]=r},"setNestedField"),Qe=c((e,t)=>{const a=new Map;for(const[r,n]of Object.entries(e))t.has(r)||n.startsWith("workspace:")||n.startsWith("file:")||n.startsWith("link:")||n.startsWith("catalog:")||n.startsWith("$")||a.set(r,n);return a},"filterExternalDeps"),et=c((e,t,a,r,n,s)=>{const o=t==="."?a:m(e,t,"package.json");if(!d(o))return;let i;try{i=w(o)}catch{return}for(const l of r){const p=l.includes(".")?ce(i,l):i[l];if(!p||typeof p!="object")continue;const g=Qe(p,n);g.size>0&&s.set(`${t}:${l}`,g)}},"scanDirectoryDeps"),tt=c((e,t)=>{const a=new Map,r=m(e,"package.json");if(!d(r))return a;const n=w(r);let s=[];const o=n.workspaces;if(o){const g=Array.isArray(o)?o:o.packages;g&&(s=L(e,g))}if(s.length===0){const g=Se(e);g&&(s=L(e,g))}const i=Ke(e,n.name,s),l=Xe(t),p=[".",...s];for(const g of p)et(e,g,r,l,i,a);return a},"readPackageJsonDeps"),x=c(e=>{const t=m(e,"package.json");if(!d(t))return!1;try{const a=w(t);return!!(a.dependencies||a.devDependencies||a.peerDependencies||a.optionalDependencies||a.overrides||a.resolutions||ce(a,"pnpm.overrides"))}catch{return!1}},"hasPackageJsonDeps"),_=c((e,t)=>{const a=new Map;for(const r of t){const n=M(r.catalogName);if(!n)continue;const s=n.relativePath==="."?m(e,"package.json"):m(e,n.relativePath,"package.json");a.has(s)||a.set(s,[]);const o=a.get(s);o&&o.push({depType:n.depType,newRange:r.newRange,packageName:r.packageName})}for(const[r,n]of a){const s=w(r);for(const{depType:o,newRange:i,packageName:l}of n)o.includes(".")?Ze(s,o,l,i):s[o]&&(s[o][l]=i);D(r,s,{detectIndent:!0,overwrite:!0})}},"applyPackageJsonUpdates"),Vt=c((e,t)=>t==="bun"?Ye(e)||x(e):t==="npm"||t==="yarn"?x(e):qe(e)||x(e),"hasCatalogs"),_t=c((e,t,a)=>{let r;t==="bun"?r=Ge(e):t==="npm"||t==="yarn"?r=new Map:r=He(e);const n=tt(e,a);for(const[s,o]of n)r.has(s)||r.set(s,o);return r},"readCatalogs"),B=c(e=>{const t=new Map,a=new Map;let r="https://registry.npmjs.org";for(const n of e.split(`
3
- `)){const s=n.trim();if(!s||s.startsWith("#")||s.startsWith(";"))continue;const o=s.indexOf("=");if(o===-1)continue;const i=s.slice(0,o).trim(),l=s.slice(o+1).trim(),p=Oe.exec(i);if(p?.[1]){t.set(p[1],l);continue}if(i==="registry"){r=l;continue}const g=Pe.exec(i);g?.[1]&&a.set(g[1],l)}return{authTokens:a,defaultRegistry:r,registries:t}},"parseNpmrc"),at=c((e,t)=>({authTokens:new Map([...e.authTokens,...t.authTokens]),defaultRegistry:t.defaultRegistry==="https://registry.npmjs.org"?e.defaultRegistry:t.defaultRegistry,registries:new Map([...e.registries,...t.registries])}),"mergeNpmrcConfigs"),Bt=c(e=>{const t={authTokens:new Map,defaultRegistry:"https://registry.npmjs.org",registries:new Map},a=process.env.HOME??process.env.USERPROFILE??"",r=m(a,".npmrc");let n=a&&d(r)?B(y(r)):t;const s=m(e,".npmrc");return d(s)&&(n=at(n,B(y(s)))),n},"loadNpmrc"),rt=c((e,t)=>{let a=t.defaultRegistry;if(e.startsWith("@")){const n=e.split("/")[0];if(n&&t.registries.has(n)){const s=t.registries.get(n);s&&(a=s)}}const r=a.replace(De,"").replace(Q,"");return{token:t.authTokens.get(r),url:a}},"getRegistryForPackage"),ie=15e3,st=c(async(e,t,a=ie,r=!1)=>{const n=`${(t?.url??"https://registry.npmjs.org").replace(Q,"")}/${e}`,s=r?{Accept:"application/json"}:{Accept:"application/vnd.npm.install-v1+json"};t?.authToken&&(s.Authorization=`Bearer ${t.authToken}`);const o=new AbortController,i=setTimeout(()=>{o.abort()},a);try{const l=await fetch(n,{headers:s,signal:o.signal});if(!l.ok)throw new Error(`Failed to fetch ${e}: ${String(l.status)} ${l.statusText}`);const p=await l.json(),g={latest:p["dist-tags"]?.latest??"",versions:Object.keys(p.versions??{})};return r&&p.time&&(g.publishTimes=new Map(Object.entries(p.time))),g}finally{clearTimeout(i)}},"fetchPackageVersions"),nt=c(e=>{const t=e.database_specific?.severity?.toUpperCase();if(t==="CRITICAL"||t==="HIGH"||t==="MODERATE"||t==="LOW")return t;const a=e.severity?.find(r=>r.type==="CVSS_V3")?.score;if(a){const r=Number.parseFloat(a);return r>=9?"CRITICAL":r>=7?"HIGH":r>=4?"MODERATE":"LOW"}return"UNKNOWN"},"mapOsvSeverity"),ot=c(e=>{const t=e.severity?.find(a=>a.type==="CVSS_V3")?.score;return t?Number.parseFloat(t):void 0},"mapOsvCvss"),ct=c(e=>{const t=[];for(const a of e.affected??[])for(const r of a.ranges??[])for(const n of r.events??[])n.fixed&&t.push(n.fixed);return t},"mapOsvFixedVersions"),it=c(e=>({aliases:e.aliases?.length?e.aliases:void 0,cvssScore:ot(e),fixedVersions:ct(e),id:e.id,severity:nt(e),summary:e.summary??""}),"mapOsvVuln"),lt=c(async(e,t=1e4)=>{if(e.length===0)return new Map;const a=e.map(s=>({package:{ecosystem:"npm",name:s.name},version:s.version})),r=new AbortController,n=setTimeout(()=>{r.abort()},t);try{const s=await fetch("https://api.osv.dev/v1/querybatch",{body:JSON.stringify({queries:a}),headers:{"Content-Type":"application/json"},method:"POST",signal:r.signal});if(!s.ok)return new Map;const o=await s.json(),i=new Map;for(const[l,p]of e.entries()){const g=o.results[l]?.vulns;g&&g.length>0&&i.set(p.name,g.map(u=>it(u)))}return i}catch{return new Map}finally{clearTimeout(n)}},"fetchVulnerabilities"),I=new Map,pt=c((e,t,a)=>{if(!a)return t;const r=a[e];if(r!==void 0)return r;for(const[n,s]of Object.entries(a))if(n!==e){if(n.startsWith("/")&&n.endsWith("/")){let o=I.get(n);if(o||(o=new RegExp(n.slice(1,-1)),I.set(n,o)),o.test(e))return s}else if(T(e,n))return s}return t},"resolvePackageTarget"),le=c((e,t,a)=>{const r=t?.get(e);return r?Date.now()-new Date(r).getTime()<a:!1},"isTooNew"),gt=c(e=>e?.minimumReleaseAge?e.packageName&&e.minimumReleaseAgeExclude?.some(t=>T(e.packageName,t))?0:e.minimumReleaseAge*60*1e3:0,"resolveMinAgeMs"),J=c((e,t,a,r,n,s)=>e.map(o=>({parsed:v(o),raw:o})).filter(o=>!o.parsed||!a&&o.parsed.prerelease!==""||!ae(t,o.parsed)||r&&le(o.raw,n,r)?!1:s?s(o.parsed):!0).toSorted((o,i)=>$e(o.raw,i.raw))[0]?.raw,"filterCandidates"),ut=c((e,t,a,r,n,s)=>{const o=v(a);if(!o)return;const i=gt(s);if(r==="latest"){const p=v(t);return!p||!n&&p.prerelease!==""||!ae(o,p)?void 0:!i||!le(t,s?.publishTimes,i)?t:J(e,o,n,i,s?.publishTimes)}const l=r==="patch"?p=>p.major===o.major&&p.minor===o.minor:p=>p.major===o.major;return J(e,o,n,i,s?.publishTimes,l)},"findTargetVersion"),mt=c((e,t)=>{const a=[],r=new Set;for(const[n,s]of e)for(const[o,i]of s)if(!(i.startsWith("workspace:")||i.startsWith("file:")||i.startsWith("link:")||i==="*")&&!(!t.includeLocked&&!te(i))){if(t.ignore.some(l=>T(o,l))){r.add(o);continue}_e(o,t.include,t.exclude)&&a.push({catalogName:n,packageName:o,range:i})}return{entries:a,ignored:[...r]}},"collectEntries"),ft=c(async(e,t,a,r=!1)=>{const n=new Map,s=[],o=8;let i=0;for(let l=0;l<e.length;l+=o){const p=e.slice(l,l+o),g=await Promise.allSettled(p.map(async u=>{const f=t?rt(u,t):void 0,k=await st(u,f?{authToken:f.token,url:f.url}:void 0,ie,r);return n.set(u,k),u}));for(const[u,f]of g.entries())if(i+=1,f.status==="rejected"){const k=p[u];k&&s.push(k)}a&&a(i,e.length)}return{failed:s,versionCache:n}},"fetchVersionsBatched"),q=c((e,t,a)=>{const r=[];for(const n of e){const s=t.get(n.packageName);if(!s)continue;const o=pt(n.packageName,a.target,a.packageMode),i=ut(s.versions,s.latest,n.range,o,a.includePrerelease,{minimumReleaseAge:a.minimumReleaseAge,minimumReleaseAgeExclude:a.minimumReleaseAgeExclude,packageName:n.packageName,publishTimes:s.publishTimes});if(!i)continue;const l=v(n.range),p=v(i);if(!l||!p)continue;const g=Le(l,p);if(g==="none")continue;const u=te(n.range);r.push({catalogName:n.catalogName,currentRange:n.range,newRange:`${u}${i}`,packageName:n.packageName,targetVersion:i,updateType:g})}return r},"buildOutdatedEntries"),H=c(e=>e?Fe(e):"","formatVersionString"),dt=c(async(e,t,a,r)=>{const n=[...new Map(t.map(l=>{const p=v(l.range);return[l.packageName,{name:l.packageName,version:H(p)}]})).values()].filter(l=>l.version),s=a?Ne(n,a):void 0,[o,i]=await Promise.all([lt(n),s]);for(const l of e){const p=o.get(l.packageName);p&&p.length>0&&(l.vulnerabilities=p);const g=v(l.currentRange),u=H(g);if(i){const f=i.get(`${l.packageName}@${u}`);f&&(l.socketReport={alerts:f.alerts,license:f.license,score:f.score})}if(r){const f=be(l.packageName,u,r);f&&(l.acceptedRisk=f)}}},"enrichWithSecurity"),ht=6e4,kt=c((e,t,a,r)=>{const n=[];for(const[i,l]of e)for(const[p,g]of l)n.push(`${i}:${p}=${g}`);if(n.push(`target=${t.target},pre=${String(t.includePrerelease)},sec=${String(t.security??!1)}`),n.push(`in=${t.include.join(",")},ex=${t.exclude.join(",")},ig=${t.ignore.join(",")}`),n.push(`locked=${String(t.includeLocked)}`),n.push(`mra=${String(t.minimumReleaseAge??0)}`),t.packageMode){const i=Object.entries(t.packageMode).map(([l,p])=>`${l}=${p}`).toSorted().join(",");n.push(`pkgMode=${i}`)}n.push(`socket=${String(a??!1)}`),r&&r.length>0&&n.push(`risks=${r.toSorted().join(",")}`);let s=5381;const o=n.join("|");for(let i=0;i<o.length;i++)s=(s<<5)+s+o.charCodeAt(i)|0;return String(s)},"computeCacheHash"),pe=c(e=>{const t=G("vis",{create:!0,cwd:e});return t?m(t,"outdated-cache.json"):void 0},"getOutdatedCachePath"),yt=c((e,t)=>{const a=pe(e);if(!(!a||!d(a)))try{const r=w(a);if(r.hash===t&&Date.now()-r.timestamp<ht)return r.result}catch{}},"readOutdatedCache"),wt=c((e,t,a)=>{const r=pe(e);if(r)try{E(X(r)),D(r,{hash:t,result:a,timestamp:Date.now()})}catch{}},"writeOutdatedCache"),It=c(async(e,t,a,r,n,s,o)=>{const i=kt(e,t,!!s,o?Object.keys(o):void 0);if(n){const h=yt(n,i);if(h)return h}const{entries:l,ignored:p}=mt(e,t),g=[...new Set(l.map(h=>h.packageName))],u=!!(t.minimumReleaseAge&&t.minimumReleaseAge>0),{failed:f,versionCache:k}=await ft(g,a,r,u),j=q(l,k,t);let b=[];if(t.target!=="latest"){const h=new Set(j.map(A=>A.packageName)),$={...t,packageMode:void 0,target:"latest"};b=q(l,k,$).filter(A=>!h.has(A.packageName))}(t.security||s)&&j.length>0&&await dt(j,l,s,o);const N={checkedCount:g.length,failed:f,filteredByTarget:b,ignored:p,outdated:j};return n&&wt(n,i,N),N},"checkOutdated"),U=c((e,t)=>t==="bun"?m(e,"package.json"):m(e,"pnpm-workspace.yaml"),"getCatalogFilePath"),Y=c((e,t)=>{const a=W(e),r=new Set;for(const n of t){const s=M(n.catalogName);s&&r.add(s.relativePath==="."?"package.json":m(s.relativePath,"package.json"))}if(r.size!==0){E(a);for(const n of r){const s=m(e,n);if(d(s)){const o=m(a,n),i=X(o);E(i),C(o,y(s))}}return a}},"createPackageJsonBackup"),$t=c((e,t,a)=>{if((t==="npm"||t==="yarn")&&a)return Y(e,a);let r;const n=U(e,t);if(d(n)&&(r=`${n}.bak`,C(r,y(n))),a){const s=a.filter(o=>M(o.catalogName));s.length>0&&Y(e,s)}return r},"createBackup"),vt=c(e=>{const t=W(e);if(!d(t))return!1;for(const a of he(t,{includeDirs:!1})){const r=a.path.slice(t.length+1),n=m(e,r);C(n,y(a.path))}return ke(t),!0},"restorePackageJsonBackup"),Jt=c((e,t)=>{if(t==="npm"||t==="yarn")return vt(e);const a=U(e,t),r=`${a}.bak`;if(!d(r))return!1;const n=y(r);return C(a,n),!0},"restoreFromBackup"),qt=c((e,t)=>{if(t==="npm"||t==="yarn")try{const r=W(e);return d(r)}catch{return!1}const a=U(e,t);return d(`${a}.bak`)},"hasBackup"),Ht=c(e=>JSON.stringify(e,void 0,2),"formatOutdatedJson"),Yt=c(e=>e.map(t=>`${t.packageName} ${t.currentRange} → ${t.newRange}`).join(`
4
- `),"formatOutdatedMinimal"),zt=c(e=>e?Array.isArray(e)?e:[e]:[],"toFilterArray"),jt=c(e=>{const t=new Map;for(const a of e){t.has(a.catalogName)||t.set(a.catalogName,[]);const r=t.get(a.catalogName);r&&r.push(a)}return t},"groupByCatalog"),Nt=c(e=>{const t=M(e);return t?`${t.relativePath==="."?"root":t.relativePath} (${t.depType})`:`Catalog: ${e}`},"formatCatalogDisplayName"),Gt=c((e,t)=>{const a=jt(e),r=process.stdout.columns||80,n=e.some(s=>s.socketReport);for(const[s,o]of a){const i=o.flatMap(g=>{const u=g.vulnerabilities&&g.vulnerabilities.length>0,f=g.socketReport&&g.socketReport.alerts.length>0,k=`${u||f?"[SEC] ":""}${g.packageName}`,j=g.socketReport?`${String(Math.round(g.socketReport.score.overall*100))}%`:"",b={current:g.currentRange,package:k,target:g.newRange,type:g.updateType};n&&(b.score=j);const N=[b];if(g.vulnerabilities)for(const h of g.vulnerabilities){const $={current:h.summary,package:` ${h.severity} ${h.id}`,target:"",type:""};n&&($.score=""),N.push($)}if(g.socketReport)for(const h of g.socketReport.alerts){const $={current:h.category,package:` [${h.severity.toUpperCase()}] ${h.type}`,target:"",type:""};n&&($.score=""),N.push($)}return N}),l=Nt(s),p=K(R.createElement(we,{data:i}),{columns:r});t.info(`${l}
5
- ${p}
6
- `)}},"formatOutdatedTable"),Xt=c(e=>{let t=0,a=0,r=0,n=0,s=0,o=0;for(const u of e)u.updateType==="major"?t++:u.updateType==="minor"?a++:r++,u.vulnerabilities&&u.vulnerabilities.length>0&&n++,u.socketReport?.alerts.length&&s++,u.socketReport&&u.socketReport.score.overall<F&&o++;const i=[];t&&i.push(`${String(t)} major`),a&&i.push(`${String(a)} minor`),r&&i.push(`${String(r)} patch`),n&&i.push(`${String(n)} with vulnerabilities`),s&&i.push(`${String(s)} with Socket.dev alerts`);const l=`Found ${String(e.length)} outdated (${i.join(", ")})`,p=process.stdout.columns||80,g=[R.createElement(P,{bold:!0},"─ Summary"),R.createElement(P,null,` ${l}`)];return o>0&&g.push(R.createElement(P,{color:"yellow"},` ${String(o)} package${o===1?"":"s"} with low Socket.dev score (<${String(F*100)}%)`)),K(R.createElement(ye,{flexDirection:"column",paddingX:1},...g),{columns:p})},"formatSummary"),bt=c((e,t)=>{const a=e.replaceAll(V,String.raw`\$&`),r=t.replaceAll(V,String.raw`\$&`);return new RegExp(String.raw`^(?:'${a}'|"${a}"|${a}):\s*['"]?${r}['"]?`)},"buildLineMatchRegex"),St=c((e,t,a)=>bt(t,a).test(e),"lineMatchesPackage"),Rt=c(e=>{const t=new Map;for(const a of e){t.has(a.catalogName)||t.set(a.catalogName,new Map);const r=t.get(a.catalogName);r&&r.set(a.packageName,{newRange:a.newRange,oldRange:a.currentRange})}return t},"buildUpdateMap"),z=c((e,t,a)=>{if(!a)return e;for(const[r,{newRange:n,oldRange:s}]of a)if(St(t,r,s))return e.replace(s,n);return e},"applyLineUpdate"),Tt=c((e,t,a,r)=>{const n=e.trimStart(),s=e.length-n.length;return n.length===0||n.startsWith("#")?e:t==="catalog"&&s>=2?z(e,n,r.get("default")):t==="catalogs"&&s>=4&&a?z(e,n,r.get(a)):e},"processYamlLineForUpdate"),Ct=c((e,t)=>{const a=m(e,"pnpm-workspace.yaml"),r=y(a).split(`
7
- `),n=Rt(t);let s="none",o="";const i=[];for(const l of r){const p=l.trimStart(),g=l.length-p.length;g===0&&p.length>0&&!p.startsWith("#")&&(s=ne(p),s==="catalogs"&&(o="")),s==="catalogs"&&g===2&&p.endsWith(":")&&(o=p.slice(0,-1).trim().replaceAll(Z,"")),i.push(Tt(l,s,o,n))}C(a,i.join(`
8
- `))},"applyPnpmCatalogUpdates");c(e=>{const t=We.exec(e);if(!t)return 2;const a=t[1];return a?a.includes(" ")?a:a.length:2},"detectJsonIndent");const Mt=c((e,t)=>{const a=m(e,"package.json"),r=w(a);for(const n of t)if(n.catalogName==="default")r.workspaces?.catalog&&(r.workspaces.catalog[n.packageName]=n.newRange);else{const s=r.workspaces?.catalogs?.[n.catalogName];s&&(s[n.packageName]=n.newRange)}D(a,r,{detectIndent:!0,overwrite:!0})},"applyBunCatalogUpdates"),Kt=c((e,t,a,r=!0)=>{let n;r&&(n=$t(e,a,t));const s=[],o=[];for(const i of t)M(i.catalogName)?o.push(i):s.push(i);return s.length>0&&(a==="npm"||a==="yarn"?_(e,s):a==="bun"?Mt(e,s):Ct(e,s)),o.length>0&&_(e,o),n},"applyCatalogUpdates"),Zt=c(async e=>{const t=de({input:process.stdin,output:process.stdout}),a=c(n=>new Promise(s=>{t.question(n,o=>{s(o.trim())})}),"ask");process.stdout.write(`
9
- Outdated catalog dependencies:
10
- `);for(const[n,s]of e.entries())s&&process.stdout.write(` ${String(n+1)}. ${s.packageName}: ${s.currentRange} → ${s.newRange} (${s.updateType})
11
- `);process.stdout.write(`
12
- `);const r=await a("Apply updates? [a]ll / [n]one / [s]elect: ");if(r.toLowerCase()==="a"||r.toLowerCase()==="all")return t.close(),e;if(r.toLowerCase()==="n"||r.toLowerCase()==="none")return t.close(),[];if(r.toLowerCase()==="s"||r.toLowerCase()==="select"){const n=await a("Enter numbers to apply (comma-separated): ");return t.close(),n.split(",").map(s=>Number.parseInt(s.trim(),10)-1).filter(s=>s>=0&&s<e.length).map(s=>e[s]).filter(s=>s!==void 0)}return t.close(),[]},"promptPackageSelection"),At=/github\.com[/:]([\w.-]+)\/([\w.-]+?)(?:\.git|\/|$)/,Qt=c(async(e,t=1e4)=>{const a=[],r=new AbortController,n=setTimeout(()=>{r.abort()},t);try{const s=e.map(async o=>{const i=`https://www.npmjs.com/package/${o.packageName}`;try{const l=await fetch(`https://registry.npmjs.org/${o.packageName}`,{headers:{Accept:"application/json"},signal:r.signal});if(!l.ok)return{npmUrl:i,packageName:o.packageName};const p=(await l.json()).repository?.url;if(!p)return{npmUrl:i,packageName:o.packageName};const g=At.exec(p);if(!g)return{npmUrl:i,packageName:o.packageName,repoUrl:p};const u=g[1],f=g[2],k=`https://github.com/${u}/${f}/releases/tag/v${o.targetVersion}`;return{npmUrl:i,packageName:o.packageName,releaseUrl:k,repoUrl:`https://github.com/${u}/${f}`}}catch{return{npmUrl:i,packageName:o.packageName}}});a.push(...await Promise.all(s))}finally{clearTimeout(n)}return a},"fetchChangelogInfo");export{Ht as C,qt as E,Qt as L,zt as N,Yt as O,Jt as S,Gt as T,Kt as V,te as _,_t as a,v as b,Zt as c,st as f,lt as m,Le as n,Bt as o,Vt as s,Xt as v,It as w};
@@ -1,2 +0,0 @@
1
- var $=Object.defineProperty;var b=(t,e)=>$(t,"name",{value:e,configurable:!0});import{yellow as O,dim as w,green as R,red as A}from"@visulima/colorize";import{Box as h,Text as d,Spinner as E,render as M}from"@visulima/tui";import{j as g,d as Y}from"../packem_chunks/bin.js";import k from"react";import{jsx as i,jsxs as v}from"react/jsx-runtime";import{D as S,W as B,T as F,C as G}from"./symbols-CQmER5MT.js";import{readFileSync as C}from"@visulima/fs";import{parseLockFileContent as D}from"@visulima/package";import{join as P}from"@visulima/path";var I=Object.defineProperty,L=b((t,e)=>I(t,"name",{value:e,configurable:!0}),"l$1");const j=L(({rows:t})=>i(h,{flexDirection:"column",children:t.map(e=>{let r;switch(e.status){case"error":{r=i(d,{color:"red",children:G});break}case"ok":{r=i(d,{color:"green",children:F});break}case"running":{r=i(d,{color:"white",children:i(E,{type:"dots"})});break}case"warn":{r=i(d,{color:"yellow",children:B});break}default:{r=i(d,{dimColor:!0,children:S});break}}return v(h,{children:[i(h,{width:3,children:r}),i(h,{flexGrow:1,children:i(d,{children:e.label})}),e.summary?i(h,{children:v(d,{dimColor:!0,children:[S," ",e.summary]})}):null]},e.id)})}),"ScanProgressApp");var N=Object.defineProperty,l=b((t,e)=>N(t,"name",{value:e,configurable:!0}),"e");const W={error:A(g.failure),ok:R(g.success),pending:w(g.dash),skip:w(g.dash),warn:O(g.warning)},z=l((t,e,r)=>{const m=r?`${t} ${w(`— ${r}`)}`:t;return` ${W[e]} ${m}
2
- `},"formatStaticRow"),re=l((t,e={})=>{const r=e.stream??process.stderr,m=typeof r.isTTY=="boolean"&&r.isTTY&&!Y,u=e.live??m,n=new Map;for(const o of t)n.set(o.id,{id:o.id,label:o.label,status:"pending"});if(!u||t.length===0)return{finish:l((o,c,y)=>{const f=n.get(o);f&&(n.set(o,{...f,status:c,summary:y}),r.write(z(f.label,c,y)))},"finish"),start:l(o=>{const c=n.get(o);c&&n.set(o,{...c,status:"running"})},"start"),stop:l(()=>{},"stop")};const p=l(()=>t.map(o=>n.get(o.id)),"buildRows");let s=M(k.createElement(j,{rows:p()}),{interactive:!0,patchConsole:!1});const a=l(()=>{s?.rerender(k.createElement(j,{rows:p()}))},"rerender");return{finish:l((o,c,y)=>{const f=n.get(o);f&&(n.set(o,{...f,status:c,summary:y}),a())},"finish"),start:l(o=>{const c=n.get(o);c&&(n.set(o,{...c,status:"running"}),a())},"start"),stop:l(()=>{s&&(a(),s.unmount(),s=void 0)},"stop")}},"startScanProgress");var H=Object.defineProperty,T=b((t,e)=>H(t,"name",{value:e,configurable:!0}),"l");const x={bun:{file:"bun.lock",type:"bun"},npm:{file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},te=T((t,e)=>{const r=x[e];if(!r)return[];let m;try{m=C(P(t,r.file))}catch{return[]}const u=D(m,r.type);if(u.length===0)return[];const n=new Set,p=[];for(const s of u){const a=`${s.name}@${s.version}`;n.has(a)||(n.add(a),p.push({isDev:!1,name:s.name,version:s.version}))}return p},"lockedPackages"),ne=T((t,e)=>{const r=x[e];if(!r)return[];let m;try{m=C(P(t,r.file))}catch{return[]}const u=D(m,r.type);if(u.length===0)return[];const n=new Map;for(const s of u)n.has(s.name)||n.set(s.name,new Set),n.get(s.name).add(s.version);const p=[];for(const[s,a]of n)a.size<=1||p.push({name:s,versions:[...a]});return p.sort((s,a)=>s.name.localeCompare(a.name))},"findDuplicateDependencies");export{ne as f,te as l,re as s};
@@ -1 +0,0 @@
1
- var b=Object.defineProperty;var f=(a,s)=>b(a,"name",{value:s,configurable:!0});import{createRequire as R}from"node:module";import{isAccessibleSync as T,readJsonSync as v}from"@visulima/fs";import{join as p}from"@visulima/path";const j=R(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=f(a=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[s,o]=l.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return l.getBuiltinModule(a)}return j(a)},"__cjs_getBuiltinModule"),{readdirSync:S}=y("node:fs");var F=Object.defineProperty,d=f((a,s)=>F(a,"name",{value:s,configurable:!0}),"i");const P=d((a,s)=>{let o=0,n=0,r=0;for(const[,t]of a)switch(t.status){case"failure":{r+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{n+=1;break}case"success":{o+=1;break}}const c=[];o>0&&c.push(`${String(o)} succeeded`),n>0&&c.push(`${String(n)} cached`),r>0&&c.push(`${String(r)} failed`);const i=(s/1e3).toFixed(1);return c.push(`${i}s`),c.join(" · ")},"formatTimingSummary"),h=d(a=>{const s=p(a,".task-runner","runs");if(!T(s))return[];const o=S(s).filter(r=>r.endsWith(".json")),n=[];for(const r of o)try{n.push(v(p(s,r)))}catch{}return n},"loadRunSummaries"),E=d((a,s,o)=>{const n=o??h(a);if(n.length<2)return;let r=0,c=0;for(const e of n)typeof e.duration=="number"&&e.duration>0&&(r+=e.duration,c+=1);if(c<2)return;const i=r/c-s,t=Math.abs(i/1e3).toFixed(1);return Math.abs(i)<500?"(about average)":i>0?`(${t}s faster than avg)`:`(${t}s slower than avg)`},"compareDuration");var _=Object.defineProperty,m=f((a,s)=>_(a,"name",{value:s,configurable:!0}),"c");const q=m((a,s={},o)=>{const n=o??h(a);if(n.length===0)return[];const r=new Map;for(const t of n)if(!(s.since&&(t.startTime===void 0||t.startTime<s.since))&&Array.isArray(t.tasks))for(const e of t.tasks){if(e.cacheStatus==="HIT"||e.cacheStatus==="REMOTE_HIT"||e.cacheStatus==="SKIPPED")continue;const u=r.get(e.taskId)??{failures:0,project:e.target.project,successes:0,target:e.target.target,totalRuns:0};u.totalRuns+=1,e.exitCode!==void 0&&e.exitCode!==0?(u.failures+=1,u.lastFailure=e.startTime??t.startTime):u.successes+=1,r.set(e.taskId,u)}const c=s.minRuns??2,i=[];for(const[t,e]of r)e.totalRuns<c||e.failures!==0&&i.push({failures:e.failures,flakinessRate:e.failures/e.totalRuns,lastFailure:e.lastFailure,project:e.project,successes:e.successes,target:e.target,taskId:t,totalRuns:e.totalRuns});return i.sort((t,e)=>e.flakinessRate-t.flakinessRate),i},"analyzeFlakiness"),w=m(a=>{if(a.length===0)return["No flaky tasks detected."];const s=["Task","Runs","Failures","Rate","Last Failure"],o=a.map(t=>[t.taskId,String(t.totalRuns),String(t.failures),`${(t.flakinessRate*100).toFixed(1)}%`,t.lastFailure??"—"]),n=s.map((t,e)=>{const u=o.reduce((g,k)=>Math.max(g,(k[e]??"").length),0);return Math.max(t.length,u)}),r=m((t,e)=>t.padEnd(e),"pad"),c=n.map(t=>"─".repeat(t)).join("──"),i=[];i.push(s.map((t,e)=>r(t,n[e])).join(" ")),i.push(c);for(const t of o)i.push(t.map((e,u)=>r(e,n[u])).join(" "));return i},"formatFlakinessTable");export{q as a,w as b,E as c,P as f,h as l};
@@ -1 +0,0 @@
1
- var l=Object.defineProperty;var m=(s,e)=>l(s,"name",{value:e,configurable:!0});import{createRequire as h}from"node:module";import{join as f}from"@visulima/path";const y=h(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=m(s=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,r]=c.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return c.getBuiltinModule(s)}return y(s)},"__cjs_getBuiltinModule"),{readFile:p,readdir:_,stat:g}=j("node:fs/promises");var k=Object.defineProperty,u=m((s,e)=>k(s,"name",{value:e,configurable:!0}),"u");const B=u((s,e)=>s.tasks.find(r=>r.taskId===e),"findTaskInSummary"),d=u((s,e)=>{const r=s??{},i=e??{},o=[],t=[],a=[];for(const n of Object.keys(r))n in i?r[n]!==i[n]&&a.push(n):o.push(n);for(const n of Object.keys(i))n in r||t.push(n);return o.sort(),t.sort(),a.sort(),{added:o,changed:a,removed:t}},"diffHashBuckets"),M=u((s,e)=>({commandChanged:(s?.command??"")!==(e?.command??""),implicitDeps:d(s?.implicitDeps,e?.implicitDeps),nodes:d(s?.nodes,e?.nodes),runtime:d(s?.runtime,e?.runtime)}),"diffHashDetails"),R=u(async(s,e)=>{const r=f(s,".task-runner","runs",`${e}.json`);try{const i=await p(r,"utf8");return JSON.parse(i)}catch{return}},"readRunSummaryById"),D=u(async(s,e)=>{const r=f(s,".task-runner","runs");let i;try{i=await _(r)}catch{return}const o=[];for(const t of i){if(!t.endsWith(".json")||e!==void 0&&t===`${e}.json`)continue;const a=f(r,t);try{const n=await g(a);n.isFile()&&o.push({mtimeMs:n.mtimeMs,path:a})}catch{}}if(o.length!==0){o.sort((t,a)=>a.mtimeMs-t.mtimeMs);try{const t=await p(o[0].path,"utf8");return JSON.parse(t)}catch{return}}},"readPreviousRunSummary");export{D as a,M as d,B as f,R as r};
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var n=(r,t)=>d(r,"name",{value:t,configurable:!0});var h=Object.defineProperty,u=n((r,t)=>h(r,"name",{value:t,configurable:!0}),"i");const s="@inherit",f=["aliases","dependsOn","inputs","outputs"],v=u((r,t)=>{if(t===void 0)return r===void 0?void 0:[...r];if(!t.includes(s))return[...t];const e=[];for(const i of t){if(i===s){r!==void 0&&e.push(...r);continue}e.push(i)}return e},"mergeArrayWithInherit"),p=u((r,t)=>{const e={...r,...t};for(const i of f){const a=r?.[i],c=t?.[i],o=v(a,c);o===void 0?delete e[i]:e[i]=o}return e},"mergeTargetWithInherit");export{p as m};
@@ -1,5 +0,0 @@
1
- var N=Object.defineProperty;var x=(o,e)=>N(o,"name",{value:e,configurable:!0});import{createRequire as I}from"node:module";import{isAccessibleSync as g,readFileSync as k,readJsonSync as S}from"@visulima/fs";import{join as m}from"@visulima/path";const D=I(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=x(o=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,n]=M.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return M.getBuiltinModule(o)}return D(o)},"__cjs_getBuiltinModule"),{execFileSync:w}=j("node:child_process"),{writeFileSync:U,renameSync:q,unlinkSync:B}=j("node:fs"),{delimiter:J,sep:H}=j("node:path");var R=Object.defineProperty,f=x((o,e)=>R(o,"name",{value:e,configurable:!0}),"d");const z=["proto","mise","fnm","volta","asdf","nvm","corepack"],V={asdf:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],corepack:["npm","pnpm","yarn"],fnm:["node"],mise:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],nvm:["node"],proto:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],volta:["node","npm","pnpm","yarn"]},Z=["proto","mise","fnm","volta","asdf","nvm","corepack"],O={asdf:[".tool-versions"],corepack:[],fnm:[".nvmrc",".node-version"],mise:[".mise.toml",".config/mise.toml","mise.toml"],nvm:[".nvmrc"],proto:[".prototools"],volta:[]},$=new Map,y=f(o=>{const e=$.get(o);if(e!==void 0||$.has(o))return e;const n=process.env.PATH;if(!n){$.set(o,void 0);return}const t=process.platform==="win32"?["",...(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";")]:[""];for(const r of n.split(J)){const i=r.replaceAll(/^["']|["']$/g,"").trim();if(i!=="")for(const l of t){const s=`${i}${H}${o}${l}`;if(g(s))return $.set(o,s),s}}$.set(o,void 0)},"isOnPath"),W=f((o,e=["--version"])=>{try{const n=w(o,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}),t=/\d+\.\d+(\.\d+)?/.exec(n);return t?t[0]:n.trim()||void 0}catch{return}},"queryManagerVersion"),A=f((o,e)=>{const n=m(o,"package.json");if(!g(n))return[];try{const t=S(n)[e];if(e==="volta"&&typeof t=="object"&&t!==null&&Object.keys(t).length>0)return["package.json"];if(e==="packageManager"&&typeof t=="string"&&t.length>0)return["package.json"]}catch{}return[]},"pkgFieldConfigFiles"),X=f((o,e)=>o==="volta"?A(e,"volta"):o==="corepack"?A(e,"packageManager"):O[o].filter(n=>g(m(e,n))),"configFilesFor"),P=new Map,G=f(()=>{P.clear(),$.clear()},"clearToolchainCache"),_=f((o,e)=>{if(!e?.refresh){const i=P.get(o);if(i)return i}const n=[],t=!!y("pnpm")||!!y("yarn");for(const i of Z){const l=i==="nvm"?void 0:y(i),s=i==="nvm"&&!!process.env.NVM_DIR,c=X(i,o),a=!!l||s;i==="corepack"&&!a&&(!(c.length>0)||t)||!a&&c.length===0||n.push({binPath:l,configFiles:c,installed:a,name:i,version:l?W(l):void 0})}const r=Object.freeze(n);return P.set(o,r),r},"findInstalledManagers"),ye=f((o,e,n)=>{const t=n??_(o);return e?.preferredManager&&e.preferredManager!=="none"?t.find(r=>r.name===e.preferredManager)??{configFiles:[],installed:!1,name:e.preferredManager}:t.find(r=>r.installed&&r.configFiles.length>0)??t.find(r=>r.installed)??t.find(r=>r.configFiles.length>0)??{configFiles:[],installed:!1,name:"none"}},"pickPrimaryManager"),K=f((o,e)=>{for(const n of e){const t=m(o,n);if(g(t))try{const r=k(t).trim();if(r!=="")return{name:n,value:r.replace(/^v/,"")}}catch{}}},"readVersionFile"),L=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,Q=f(o=>{const e=m(o,".prototools");if(!g(e))return[];const n=k(e),t=[];let r=!1;for(const i of n.split(/\r?\n/)){const l=i.trim();if(l===""||l.startsWith("#"))continue;if(l.startsWith("[")){r=!0;continue}if(r)continue;const s=L.exec(l);if(!s)continue;const[,c,a]=s,u=h(c);u&&t.push({source:".prototools",tool:u,version:a.trim()})}return t},"parsePrototools"),Y=/^\[tools\]\s*$/i,ee=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,oe=f(o=>{for(const e of O.mise){const n=m(o,e);if(!g(n))continue;const t=[],r=k(n);let i=!1;for(const l of r.split(/\r?\n/)){const s=l.trim();if(s===""||s.startsWith("#"))continue;if(s.startsWith("[")){i=Y.test(s);continue}if(!i)continue;const c=ee.exec(s);if(!c)continue;const[,a,u]=c,d=h(a);d&&t.push({source:".mise.toml",tool:d,version:u.trim()})}if(t.length>0)return t}return[]},"parseMiseToml"),ne=f(o=>{const e=m(o,".tool-versions");if(!g(e))return[];const n=k(e),t=[];for(const r of n.split(/\r?\n/)){const i=r.trim();if(i===""||i.startsWith("#"))continue;const l=i.split(/\s+/);if(l.length<2)continue;const[s,...c]=l,a=h(s);a&&c[0]&&t.push({source:".tool-versions",tool:a,version:c[0]})}return t},"parseToolVersions"),h=f(o=>{switch(o.toLowerCase()){case"bun":return"bun";case"deno":return"deno";case"go":case"golang":return"go";case"node":case"nodejs":return"node";case"npm":return"npm";case"pnpm":return"pnpm";case"python":case"python3":return"python";case"ruby":return"ruby";case"rust":case"rustc":return"rust";case"yarn":return"yarn";default:return}},"normalizeToolName"),te=f(o=>{const[e]=o.split("+",1),n=/^(pnpm|yarn|npm|bun)@(.+)$/.exec(e??"");if(!n)return;const t=h(n[1]);if(t)return{source:"packageManager",tool:t,version:n[2]}},"parsePackageManagerField"),re=f((o,e)=>{const n=new Map,t=f(s=>{n.set(s.tool,s)},"add"),r=m(o,"package.json");let i={};try{g(r)&&(i=S(r))}catch{}if(i.engines)for(const[s,c]of Object.entries(i.engines)){const a=h(s);a&&typeof c=="string"&&t({source:"engines",tool:a,version:c})}if(i.packageManager){const s=te(i.packageManager);s&&t(s)}if(i.volta)for(const[s,c]of Object.entries(i.volta)){const a=h(s);a&&typeof c=="string"&&t({source:"volta",tool:a,version:c})}const l=K(o,[".nvmrc",".node-version"]);l&&t({source:l.name===".nvmrc"?".nvmrc":".node-version",tool:"node",version:l.value});for(const s of ne(o))t(s);for(const s of oe(o))t(s);for(const s of Q(o))t(s);if(e?.tools)for(const[s,c]of Object.entries(e.tools)){const a=h(s);a&&typeof c=="string"&&t({source:"vis.config.ts",tool:a,version:c})}return[...n.values()]},"parseExpectedTools"),F={bun:{args:["--version"],binaries:["bun"]},deno:{args:["--version"],binaries:["deno"]},go:{args:["version"],binaries:["go"]},node:{args:["--version"],binaries:["node"]},npm:{args:["--version"],binaries:["npm"]},pnpm:{args:["--version"],binaries:["pnpm"]},python:{args:["--version"],binaries:["python","python3"]},ruby:{args:["--version"],binaries:["ruby"]},rust:{args:["--version"],binaries:["rustc"]},yarn:{args:["--version"],binaries:["yarn"]}},se=f(o=>{const e=F[o];for(const n of e.binaries){const t=y(n);if(t)return W(t,e.args)}if(o==="node")return process.versions.node},"queryToolVersion"),ie=f((o,e)=>{const n=e.trim();if(n===""||n==="*"||n==="latest")return!0;if(/^\d[\d.]*$/.test(n))return o===n||o.startsWith(`${n}.`);const t=f(s=>s.split(/[.\-+]/).map(c=>Number.parseInt(c,10)||0),"parse"),r=f((s,c)=>{const a=t(s),u=t(c),d=Math.max(a.length,u.length);for(let p=0;p<d;p++){const b=a[p]??0,v=u[p]??0;if(b!==v)return b-v}return 0},"compare"),i=f(s=>{for(const c of s)if(c.startsWith(">=")){if(r(o,c.slice(2).trim())<0)return!1}else if(c.startsWith("<=")){if(r(o,c.slice(2).trim())>0)return!1}else if(c.startsWith(">")){if(r(o,c.slice(1).trim())<=0)return!1}else if(c.startsWith("<")){if(r(o,c.slice(1).trim())>=0)return!1}else if(c.startsWith("^")||c.startsWith("~")){const a=c.slice(1).trim(),[u,d]=t(a),[p,b]=t(o);if(p!==u||c.startsWith("~")&&b!==d||r(o,a)<0)return!1}return!0},"matchesAll"),l=n.split("||").map(s=>s.trim().split(/\s+/).filter(Boolean)).filter(s=>s.length>0);return l.length===0?!0:l.some(s=>i(s))},"satisfies"),ae=f((o,e)=>{switch(o){case".mise.toml":return["mise"];case".node-version":case".nvmrc":return["fnm","nvm","volta","proto","mise","asdf"];case".prototools":return["proto"];case".tool-versions":return["asdf","mise"];case"packageManager":return e==="pnpm"||e==="yarn"?["self-activate","volta","proto","mise","corepack"]:e==="npm"?["volta","proto","mise","asdf","corepack"]:e==="bun"?["proto","mise","asdf"]:["volta","proto","mise"];case"volta":return["volta"];default:return["proto","mise","fnm","volta","asdf","nvm","corepack"]}},"preferenceFor"),ce=f((o,e,n)=>{if(n?.preferredManager&&n.preferredManager!=="none"&&T(n.preferredManager,o.tool)){const r=e.find(i=>i.name===n.preferredManager);return r?{installed:r.installed,name:r.name}:{installed:!1,name:n.preferredManager,note:`${n.preferredManager} is the preferred manager but isn't on PATH`}}const t=ae(o.source,o.tool);for(const r of t){if(r==="self-activate"){if((o.tool==="pnpm"||o.tool==="yarn")&&y(o.tool))return{installed:!0,name:"self-activate",note:`${o.tool} will activate ${o.version} from the packageManager field on next invocation`};continue}if(T(r,o.tool)&&e.find(i=>i.name===r)?.installed)return{installed:!0,name:r}}for(const r of t)if(!(r==="self-activate"||!T(r,o.tool)))return{installed:!1,name:r,note:`${r} can install ${o.tool} — run \`vis toolchain install\` after adding it to PATH`};return{installed:!1,name:"none",note:"No manager knows how to install this tool"}},"resolveManagerFor"),T=f((o,e)=>o==="none"?!1:o==="self-activate"?e==="pnpm"||e==="yarn":V[o].includes(e),"canHandle"),le=f((o,e)=>{const n=_(o),t=re(o,e).map(r=>{const i=se(r.tool),l=i!==void 0&&ie(i,r.version),s=ce(r,n,e);return{actual:i,expected:r,manager:s,matches:l}});return{detected:n,tools:t}},"getToolchainStatus"),fe=f((o,e)=>{switch(o){case"asdf":return e?{args:["install",e.tool,e.version],bin:"asdf"}:void 0;case"corepack":return e?{args:["prepare",`${e.tool}@${e.version}`,"--activate"],bin:"corepack"}:{args:["prepare","--activate"],bin:"corepack",hint:"reads the packageManager field in package.json"};case"fnm":return e?.tool!=="node"?void 0:{args:["install",e.version],bin:"fnm"};case"mise":return e?{args:["install",`${e.tool}@${e.version}`],bin:"mise"}:void 0;case"none":return;case"nvm":return{args:[],bin:"nvm",hint:"nvm is a shell function — run `nvm install` / `nvm use` from your shell"};case"proto":return e?{args:["install",e.tool,e.version],bin:"proto"}:void 0;case"self-activate":return{args:[],bin:e?.tool??"pnpm",hint:`${e?.tool??"pnpm"} will self-activate on next invocation — no install needed`};case"volta":return e?{args:["install",`${e.tool}@${e.version}`],bin:"volta"}:{args:["install","node@lts"],bin:"volta",hint:"volta pins per-tool; specify <tool>@<version>"};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildInstallInvocation"),be=f((o,e)=>{switch(o){case"asdf":return{args:["local",e.tool,e.version],bin:"asdf",configChange:{file:".tool-versions",hint:`Pins ${e.tool} ${e.version}`}};case"corepack":return e.tool!=="npm"&&e.tool!=="pnpm"&&e.tool!=="yarn"?void 0:{args:["use",`${e.tool}@${e.version}`],bin:"corepack",configChange:{file:"package.json",hint:`Writes packageManager: "${e.tool}@${e.version}"`}};case"fnm":return e.tool==="node"?{args:["use",e.version],bin:"fnm"}:void 0;case"mise":return{args:["use","--",`${e.tool}@${e.version}`],bin:"mise",configChange:{file:".mise.toml",hint:`Pins ${e.tool} ${e.version}`}};case"none":return;case"nvm":return e.tool==="node"?{args:[],bin:"nvm",configChange:{file:".nvmrc",hint:"Write version to .nvmrc manually (nvm doesn't persist)."}}:void 0;case"proto":return{args:["pin",e.tool,e.version],bin:"proto",configChange:{file:".prototools",hint:`Pins ${e.tool} ${e.version}`}};case"self-activate":return{args:[],bin:e.tool,configChange:{file:"package.json",hint:`Set packageManager: "${e.tool}@${e.version}" — ${e.tool} will self-activate on next invocation`}};case"volta":return{args:["pin",`${e.tool}@${e.version}`],bin:"volta",configChange:{file:"package.json",hint:`Writes volta.${e.tool}`}};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildUseInvocation"),$e=f(o=>{for(const e of F[o].binaries){const n=y(e);if(n)return n}},"findOnPathByAlias"),ke=f((o,e)=>{const n=F[e].binaries;if(o.installed&&o.binPath&&(o.name==="proto"||o.name==="mise"||o.name==="asdf"||o.name==="volta"||o.name==="fnm"))for(const t of n)try{const r=w(o.binPath,["which",t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();if(r)return r}catch{}for(const t of n){const r=y(t);if(r)return r}},"resolveToolBinary"),E=f((o,e)=>{const n=`${o}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;U(n,e);try{q(n,o)}catch(t){try{B(n)}catch{}throw t}},"atomicWrite"),pe=f((o,e)=>{if("packageManager"in o)return o.packageManager=e,o;const n={};let t=!1;for(const[r,i]of Object.entries(o))!t&&(r==="dependencies"||r==="devDependencies"||r==="peerDependencies"||r==="optionalDependencies")&&(n.packageManager=e,t=!0),n[r]=i;return t||(n.packageManager=e),n},"insertPackageManagerKey"),Me=f((o,e)=>{if(e.tool!=="pnpm"&&e.tool!=="yarn"&&e.tool!=="npm"&&e.tool!=="bun")return;const n=m(o,"package.json");if(!g(n))throw new Error(`Cannot pin ${e.tool}: ${n} does not exist.`);const t=k(n),r=/\n([ \t]+)/.exec(t)?.[1]??" ";let i;try{i=JSON.parse(t)}catch(a){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${a.message}`)}const l=`${e.tool}@${e.version}`,s=pe(i,l),c=t.endsWith(`
2
- `)?`
3
- `:"";return E(n,`${JSON.stringify(s,void 0,r)}${c}`),l},"writePackageManagerField"),we=f((o,e)=>{const n=m(o,"package.json");if(!g(n))return;const t=k(n);let r;try{r=JSON.parse(t)}catch(s){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${s.message}`)}if(r.engines?.[e.tool]===void 0||r.engines[e.tool]===e.version)return;r.engines[e.tool]=e.version;const i=/\n([ \t]+)/.exec(t)?.[1]??" ",l=t.endsWith(`
4
- `)?`
5
- `:"";return E(n,`${JSON.stringify(r,void 0,i)}${l}`),e.version},"updateEnginesField"),xe=f(o=>{const e=/^([a-z][\w-]*)@(.+)$/i.exec(o.trim());if(!e)return;const n=h(e[1]);if(n)return{source:"vis.config.ts",tool:n,version:e[2]}},"parseUseArgument"),ue=f(async(o,e,n)=>{const t=le(o,e),r=t.tools.filter(a=>!a.matches);if(r.length===0)return{attempted:[],failed:[],upToDate:!0};const i=t.detected.some(a=>a.installed);if(!(e?.autoInstall??i))return{attempted:[],failed:[],upToDate:!1};const l=[],s=[],c=new Map;for(const a of r){const u=c.get(a.manager.name);u?u.push(a):c.set(a.manager.name,[a])}for(const[a,u]of c){if(a==="self-activate"){for(const{expected:p}of u)n.info(`toolchain: ${p.tool} ${p.version} will self-activate on next ${p.tool} invocation`),l.push(p);continue}if(a==="none"){for(const{expected:p}of u)s.push({error:`no manager can install ${p.tool} — install one of ${z.join(", ")}`,spec:p});continue}if(!t.detected.find(p=>p.name===a)?.installed){for(const{expected:p}of u)s.push({error:`${a} is not on PATH`,spec:p});continue}const d=u.map(p=>({invocation:fe(a,p.expected),tool:p})).filter(p=>p.invocation!==void 0);for(const{invocation:p,tool:b}of d){const{expected:v}=b;if(p.bin==="nvm"&&p.args.length===0){n.warn(`toolchain: nvm requires a shell-side activation for ${v.tool} ${v.version}. Run \`nvm install\` / \`nvm use\` manually.`),s.push({error:"nvm requires shell-side activation",spec:v});continue}n.info(`toolchain: $ ${p.bin} ${p.args.join(" ")}`);try{w(p.bin,p.args,{cwd:o,stdio:"inherit"}),l.push(v),a==="fnm"&&ge(p.bin,n)}catch(C){s.push({error:C.message,spec:v});break}}}return G(),{attempted:l,failed:s,upToDate:!1}},"ensureToolchain"),Te=f(async(o,e,n,t=!1)=>{if(t)return;const r=await ue(o,e,n);for(const i of r.failed)n.warn(`toolchain: ${i.spec.tool} ${i.spec.version} — ${i.error}`)},"runToolchainPreflight"),ge=f((o,e)=>{const n=process.platform==="win32"?"powershell":"bash";try{const t=w(o,["env","--shell",n],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3});for(const r of t.split(/\r?\n/)){const i=r.trim();if(i==="")continue;const l=/^\$env:([A-Z_]\w*)\s*=\s*(.+)$/i.exec(i);if(l){const[,a,u]=l;process.env[a]=u.replaceAll(/^["']|["']$/g,"");continue}const s=/^set\s+"?([A-Z_]\w*)=(.*?)"?$/i.exec(i);if(s){const[,a,u]=s;process.env[a]=u;continue}const c=/^(?:export\s+)?([A-Z_]\w*)=(.+)$/i.exec(i);if(c){const[,a,u]=c;process.env[a]=u.replaceAll(/^["']|["']$/g,"")}}}catch(t){e.warn(`toolchain: could not activate fnm env (${t.message}). Subsequent tasks may use the previous Node version.`)}},"activateFnmEnv");export{z as S,ce as a,fe as b,be as c,ke as d,$e as e,_ as f,le as g,ye as h,xe as p,Te as r,we as u,Me as w};