@reliverse/dler 1.7.139 → 1.7.141

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.
@@ -1,5 +1,5 @@
1
1
  export declare const PROJECT_ROOT: string;
2
- export declare const cliVersion = "1.7.139";
2
+ export declare const cliVersion = "1.7.141";
3
3
  export declare const cliName = "@reliverse/rse";
4
4
  export declare const rseName = "@reliverse/rse";
5
5
  export declare const dlerName = "@reliverse/dler";
@@ -1,7 +1,7 @@
1
1
  import os from "node:os";
2
2
  import path from "@reliverse/pathkit";
3
3
  export const PROJECT_ROOT = path.resolve(process.cwd());
4
- const version = "1.7.139";
4
+ const version = "1.7.141";
5
5
  export const cliVersion = version;
6
6
  export const cliName = "@reliverse/rse";
7
7
  export const rseName = "@reliverse/rse";
@@ -230,7 +230,7 @@ function generateJsoncConfig(isDev, pkgDescription) {
230
230
  "bumpSet": "${DEFAULT_CONFIG_RELIVERSE.bumpSet}",
231
231
  // Common configuration
232
232
  "commonPubPause": ${pausePublishValue},
233
- "commonPubRegistry": ${DEFAULT_CONFIG_RELIVERSE.commonPubRegistry},
233
+ "commonPubRegistry": "npm",
234
234
  "commonVerbose": ${verboseValue},
235
235
  "displayBuildPubLogs": ${DEFAULT_CONFIG_RELIVERSE.displayBuildPubLogs},
236
236
  // Core configuration
@@ -551,7 +551,7 @@ function generateConfig(isDev, pkgDescription, configKind = "ts", usePackageImpo
551
551
  "",
552
552
  " // Common configuration",
553
553
  " commonPubPause: " + pausePublishValue + ",",
554
- " commonPubRegistry: " + DEFAULT_CONFIG_RELIVERSE.commonPubRegistry + ",",
554
+ ` commonPubRegistry: "npm",`,
555
555
  " commonVerbose: " + verboseValue + ",",
556
556
  " displayBuildPubLogs: " + DEFAULT_CONFIG_RELIVERSE.displayBuildPubLogs + ",",
557
557
  "",
@@ -10,18 +10,18 @@ export type Database = z.infer<typeof DatabaseSchema>;
10
10
  export declare const ORMSchema: z.ZodEnum<{
11
11
  none: "none";
12
12
  drizzle: "drizzle";
13
- prisma: "prisma";
14
13
  mongoose: "mongoose";
14
+ prisma: "prisma";
15
15
  }>;
16
16
  export type ORM = z.infer<typeof ORMSchema>;
17
17
  export declare const BackendSchema: z.ZodEnum<{
18
18
  none: "none";
19
19
  hono: "hono";
20
20
  next: "next";
21
+ convex: "convex";
21
22
  express: "express";
22
23
  fastify: "fastify";
23
24
  elysia: "elysia";
24
- convex: "convex";
25
25
  }>;
26
26
  export type Backend = z.infer<typeof BackendSchema>;
27
27
  export declare const RuntimeSchema: z.ZodEnum<{
@@ -56,8 +56,8 @@ export declare const AddonsSchema: z.ZodEnum<{
56
56
  export type Addons = z.infer<typeof AddonsSchema>;
57
57
  export declare const ExamplesSchema: z.ZodEnum<{
58
58
  none: "none";
59
- todo: "todo";
60
59
  ai: "ai";
60
+ todo: "todo";
61
61
  }>;
62
62
  export type Examples = z.infer<typeof ExamplesSchema>;
63
63
  export declare const PackageManagerSchema: z.ZodEnum<{
@@ -14,7 +14,7 @@ export type BrowserRepoOption = "reliverse/template-browser-extension" | "unknow
14
14
  export declare function configureBrowserExtension(): Promise<{
15
15
  displayName: string;
16
16
  description: string;
17
- features: ("commands" | "webview" | "language" | "themes")[];
17
+ features: ("webview" | "language" | "commands" | "themes")[];
18
18
  activation: "onCommand" | "onLanguage" | "startup";
19
19
  publisher: string;
20
20
  }>;
@@ -24,7 +24,7 @@ export declare function configureBrowserExtension(): Promise<{
24
24
  export declare function configureVSCodeExtension(): Promise<{
25
25
  displayName: string;
26
26
  description: string;
27
- features: ("commands" | "webview" | "language" | "themes")[];
27
+ features: ("webview" | "language" | "commands" | "themes")[];
28
28
  activation: "onCommand" | "onLanguage" | "startup";
29
29
  publisher: string;
30
30
  }>;
@@ -1,43 +1,21 @@
1
- import { type PackageCheckOptions, type UpdateResult } from "./utils";
1
+ import { type UpdateResult } from "./utils";
2
2
  interface UpdateArgs {
3
+ ci?: boolean;
4
+ cwd?: string;
3
5
  name?: string[];
4
6
  ignore?: string[];
5
- devOnly?: boolean;
6
- prodOnly?: boolean;
7
- peerOnly?: boolean;
8
- optionalOnly?: boolean;
9
- catalogsOnly?: boolean;
10
7
  dryRun?: boolean;
11
- concurrency?: number;
12
- withCheckScript?: boolean;
13
- linker?: string;
14
8
  withInstall?: boolean;
15
- global?: boolean;
16
- interactive?: boolean;
17
- filter?: string[];
18
- allWorkspaces?: boolean;
19
- rootOnly?: boolean;
20
- recursive?: boolean;
21
- savePrefix?: string;
22
9
  allowMajor?: boolean;
10
+ concurrency?: number;
23
11
  }
24
- export declare function validateUpdateArgs(args: UpdateArgs): Promise<void>;
25
- export declare function handleCatalogOnlyUpdate(args: UpdateArgs): Promise<boolean>;
26
12
  export declare function validatePackageJson(): Promise<string>;
27
- export declare function getEffectiveLinker(args: UpdateArgs): Promise<{
28
- effectiveLinker: string;
29
- linkerSource: string;
30
- }>;
31
- export declare function prepareUpdateCandidates(args: UpdateArgs): Promise<{
13
+ export declare function prepareAllUpdateCandidates(args: UpdateArgs): Promise<{
32
14
  candidates: string[];
33
15
  allDepsMap: Record<string, any>;
16
+ packageJsonFiles: string[];
34
17
  }>;
35
18
  export declare function checkPackageUpdates(candidates: string[], allDepsMap: Record<string, any>, args: UpdateArgs): Promise<UpdateResult[]>;
36
- export declare function handleInteractiveSelection(results: UpdateResult[]): Promise<UpdateResult[]>;
37
- export declare function updateRootPackageJson(packageJsonPath: string, allDepsMap: Record<string, any>, toUpdate: UpdateResult[], savePrefix: string): Promise<number>;
38
- export declare function handleRecursiveUpdates(args: UpdateArgs, options: PackageCheckOptions): Promise<number>;
39
- export declare function handleWorkspaceUpdates(args: UpdateArgs, options: PackageCheckOptions): Promise<number>;
40
- export declare function displayUpdateSummary(totalUpdated: number, args: UpdateArgs, isMonorepoProject: boolean, shouldUpdateWorkspaces: boolean): void;
41
- export declare function handleInstallation(args: UpdateArgs, effectiveLinker: string, packageJson: any): Promise<void>;
42
- export declare function handleToolUpgrades(args: any): Promise<void>;
19
+ export declare function updateAllPackageJsonFiles(packageJsonFiles: string[], toUpdate: UpdateResult[], savePrefix: string): Promise<number>;
20
+ export declare function handleInstallation(): Promise<void>;
43
21
  export {};
@@ -1,80 +1,16 @@
1
1
  import path from "@reliverse/pathkit";
2
- import { re } from "@reliverse/relico";
3
2
  import fs from "@reliverse/relifso";
4
3
  import { relinka } from "@reliverse/relinka";
5
- import { multiselectPrompt } from "@reliverse/rempts";
6
- import { $ } from "bun";
7
4
  import pMap from "p-map";
8
- import { readPackageJSON } from "pkg-types";
9
- import { getConfigBunfig } from "../config/load.js";
10
- import { isCatalogSupported, updateCatalogs } from "../utils/pm/pm-catalog.js";
5
+ import { glob } from "tinyglobby";
11
6
  import { detectPackageManager } from "../utils/pm/pm-detect.js";
12
7
  import {
13
8
  checkPackageUpdate,
14
9
  collectTargetDependencies,
15
- findAllPackageJsons,
16
- findWorkspacePackageJsons,
17
- isMonorepo,
18
10
  prepareDependenciesForUpdate,
19
11
  runInstallCommand,
20
- runInstallCommandWithFilter,
21
- updatePackageJsonFile,
22
- updateWorkspacePackages,
23
- upgradeBun,
24
- upgradeDlerGlobal,
25
- upgradeDlerLocal,
26
- upgradeGit,
27
- upgradeNode,
28
- upgradeNpm,
29
- upgradePnpm,
30
- upgradeYarn
12
+ updatePackageJsonFile
31
13
  } from "./utils.js";
32
- export async function validateUpdateArgs(args) {
33
- const exclusiveFlags = [
34
- args["devOnly"],
35
- args["prodOnly"],
36
- args["peerOnly"],
37
- args["optionalOnly"],
38
- args["catalogsOnly"]
39
- ];
40
- if (exclusiveFlags.filter(Boolean).length > 1) {
41
- relinka(
42
- "error",
43
- "Cannot specify multiple exclusive flags (--dev-only, --prod-only, --peer-only, --optional-only, --catalogs-only)"
44
- );
45
- process.exit(1);
46
- }
47
- if (args["allWorkspaces"] && args["rootOnly"]) {
48
- relinka("error", "Cannot specify both --all-workspaces and --root-only flags");
49
- process.exit(1);
50
- }
51
- if (args.recursive && (args["allWorkspaces"] || args["rootOnly"])) {
52
- relinka(
53
- "error",
54
- "Cannot use --recursive with --all-workspaces or --root-only flags. Use --no-recursive to disable recursive mode."
55
- );
56
- process.exit(1);
57
- }
58
- }
59
- export async function handleCatalogOnlyUpdate(args) {
60
- if (!args["catalogsOnly"]) {
61
- return false;
62
- }
63
- const packageManager = await detectPackageManager(process.cwd());
64
- if (!packageManager) {
65
- relinka("error", "Could not detect package manager");
66
- process.exit(1);
67
- }
68
- if (!isCatalogSupported(packageManager)) {
69
- relinka(
70
- "error",
71
- `Catalogs are not supported by ${packageManager.name}. Only Bun supports catalogs.`
72
- );
73
- process.exit(1);
74
- }
75
- await updateCatalogs(process.cwd());
76
- return true;
77
- }
78
14
  export async function validatePackageJson() {
79
15
  const packageJsonPath = path.resolve(process.cwd(), "package.json");
80
16
  if (!await fs.pathExists(packageJsonPath)) {
@@ -83,38 +19,68 @@ export async function validatePackageJson() {
83
19
  }
84
20
  return packageJsonPath;
85
21
  }
86
- export async function getEffectiveLinker(args) {
87
- let effectiveLinker = args.linker || "hoisted";
88
- let linkerSource = "CLI default";
89
- if (typeof Bun !== "undefined") {
90
- const bunfigConfig = await getConfigBunfig();
91
- const bunfigLinker = bunfigConfig?.install?.linker;
92
- if (bunfigLinker && ["isolated", "hoisted"].includes(bunfigLinker) && args.linker === "hoisted") {
93
- effectiveLinker = bunfigLinker;
94
- linkerSource = bunfigLinker === "hoisted" ? "bunfig.toml (same as default)" : "bunfig.toml";
22
+ export async function prepareAllUpdateCandidates(args) {
23
+ const packageJsonFiles = await glob("**/package.json", {
24
+ cwd: process.cwd(),
25
+ absolute: true,
26
+ ignore: [
27
+ "**/node_modules/**",
28
+ "**/dist/**",
29
+ "**/build/**",
30
+ "**/.git/**",
31
+ "**/coverage/**",
32
+ "**/.next/**",
33
+ "**/.nuxt/**",
34
+ "**/out/**",
35
+ "**/target/**",
36
+ "**/.turbo/**"
37
+ ]
38
+ });
39
+ if (packageJsonFiles.length === 0) {
40
+ relinka("warn", "No package.json files found");
41
+ return { candidates: [], allDepsMap: {}, packageJsonFiles: [] };
42
+ }
43
+ relinka("verbose", `Found ${packageJsonFiles.length} package.json files`);
44
+ const allDepsMap = {};
45
+ const allCandidates = /* @__PURE__ */ new Set();
46
+ for (const packageJsonPath of packageJsonFiles) {
47
+ try {
48
+ const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
49
+ const { map } = collectTargetDependencies(packageJson);
50
+ const candidates2 = prepareDependenciesForUpdate(map, args);
51
+ for (const [dep, info] of Object.entries(map)) {
52
+ if (!allDepsMap[dep]) {
53
+ allDepsMap[dep] = { ...info, locations: new Set(info.locations) };
54
+ } else {
55
+ for (const location of info.locations) {
56
+ allDepsMap[dep].locations.add(location);
57
+ }
58
+ allDepsMap[dep].versionSpec = info.versionSpec;
59
+ }
60
+ }
61
+ for (const candidate of candidates2) {
62
+ allCandidates.add(candidate);
63
+ }
64
+ } catch (error) {
65
+ relinka(
66
+ "warn",
67
+ `Failed to process ${packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`
68
+ );
95
69
  }
96
70
  }
97
- if (args.linker !== "hoisted") {
98
- effectiveLinker = args.linker;
99
- linkerSource = "CLI override";
100
- }
101
- relinka("verbose", `Using linker strategy: ${effectiveLinker} (from ${linkerSource})`);
102
- return { effectiveLinker, linkerSource };
103
- }
104
- export async function prepareUpdateCandidates(args) {
105
- const packageJson = await readPackageJSON();
106
- const { map: allDepsMap } = collectTargetDependencies(packageJson, args);
107
- const candidates = prepareDependenciesForUpdate(allDepsMap, args);
71
+ const candidates = Array.from(allCandidates);
108
72
  if (candidates.length === 0) {
109
- relinka("warn", "No dependencies to update based on provided filters");
110
- return { candidates: [], allDepsMap };
73
+ relinka("warn", "No dependencies to update");
74
+ return { candidates: [], allDepsMap: {}, packageJsonFiles };
111
75
  }
112
- return { candidates, allDepsMap };
76
+ relinka("verbose", `Processing ${packageJsonFiles.length} package.json files`);
77
+ return { candidates, allDepsMap, packageJsonFiles };
113
78
  }
114
79
  export async function checkPackageUpdates(candidates, allDepsMap, args) {
115
80
  const options = {
116
- allowMajor: !!args["allowMajor"],
117
- savePrefix: args["savePrefix"],
81
+ allowMajor: !!args.allowMajor,
82
+ savePrefix: "^",
83
+ // Use default prefix
118
84
  concurrency: args.concurrency || 5
119
85
  };
120
86
  return await pMap(
@@ -137,225 +103,49 @@ export async function checkPackageUpdates(candidates, allDepsMap, args) {
137
103
  { concurrency: args.concurrency || 5 }
138
104
  );
139
105
  }
140
- export async function handleInteractiveSelection(results) {
141
- const toUpdate = results.filter((r) => r.updated && !r.error);
142
- const errors = results.filter((r) => r.error);
143
- const upToDate = results.filter((r) => !r.updated && !r.error && r.semverCompatible);
144
- const allPackages = [
145
- ...toUpdate.map((pkg) => ({
146
- ...pkg,
147
- canUpdate: true,
148
- isUpToDate: false,
149
- hasError: false
150
- })),
151
- ...upToDate.map((pkg) => ({
152
- ...pkg,
153
- canUpdate: false,
154
- isUpToDate: true,
155
- hasError: false
156
- })),
157
- ...errors.map((pkg) => ({ ...pkg, canUpdate: false, isUpToDate: false, hasError: true }))
158
- ];
159
- const selectedPackages = await multiselectPrompt({
160
- title: "Select dependencies to update",
161
- options: [
162
- { label: "Exit", value: "exit" },
163
- ...allPackages.map((pkg) => {
164
- let label = `${pkg.package} (${pkg.location})`;
165
- if (pkg.canUpdate) {
166
- label += `: ${pkg.currentVersion} \u2192 ${pkg.latestVersion}`;
167
- } else if (pkg.isUpToDate) {
168
- label += `: ${pkg.currentVersion} (up-to-date)`;
169
- } else if (pkg.hasError) {
170
- label += `: ${pkg.currentVersion} (has errors)`;
106
+ export async function updateAllPackageJsonFiles(packageJsonFiles, toUpdate, savePrefix) {
107
+ if (packageJsonFiles.length === 0 || toUpdate.length === 0) {
108
+ return 0;
109
+ }
110
+ let totalUpdated = 0;
111
+ for (const packageJsonPath of packageJsonFiles) {
112
+ try {
113
+ const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
114
+ const { map: fileDepsMap } = collectTargetDependencies(packageJson);
115
+ const fileSpecificUpdates = toUpdate.filter((update) => fileDepsMap[update.package]);
116
+ if (fileSpecificUpdates.length > 0) {
117
+ const updated = await updatePackageJsonFile(
118
+ packageJsonPath,
119
+ fileDepsMap,
120
+ fileSpecificUpdates,
121
+ savePrefix
122
+ );
123
+ totalUpdated += updated;
124
+ if (updated > 0) {
125
+ const relativePath = path.relative(process.cwd(), packageJsonPath);
126
+ relinka("verbose", `Updated ${updated} dependencies in ${relativePath}`);
171
127
  }
172
- return {
173
- label,
174
- value: pkg.package,
175
- disabled: !pkg.canUpdate,
176
- hint: pkg.hasError ? pkg.error : void 0
177
- };
178
- })
179
- ]
180
- });
181
- if (selectedPackages.length === 0 || selectedPackages.includes("exit")) {
182
- relinka("log", "Exiting update process");
183
- return [];
184
- }
185
- const actualSelectedPackages = selectedPackages.filter((pkg) => pkg !== "exit");
186
- const filteredToUpdate = toUpdate.filter(
187
- (update) => actualSelectedPackages.includes(update.package)
188
- );
189
- relinka("log", `Updating ${actualSelectedPackages.length} selected dependencies...`);
190
- return filteredToUpdate;
191
- }
192
- export async function updateRootPackageJson(packageJsonPath, allDepsMap, toUpdate, savePrefix) {
193
- return await updatePackageJsonFile(packageJsonPath, allDepsMap, toUpdate, savePrefix);
194
- }
195
- export async function handleRecursiveUpdates(args, options) {
196
- const allPackageJsons = await findAllPackageJsons(process.cwd());
197
- const rootPackageJsonPath = path.resolve(process.cwd(), "package.json");
198
- const otherPackageJsons = allPackageJsons.filter((p) => p !== rootPackageJsonPath);
199
- if (otherPackageJsons.length > 0) {
200
- relinka(
201
- "verbose",
202
- `Found ${otherPackageJsons.length} additional package.json files to update recursively`
203
- );
204
- return await updateWorkspacePackages(otherPackageJsons, args, options);
205
- }
206
- return 0;
207
- }
208
- export async function handleWorkspaceUpdates(args, options) {
209
- const isMonorepoProject = await isMonorepo(process.cwd());
210
- const shouldUpdateWorkspaces = args["allWorkspaces"] || !args["rootOnly"] && isMonorepoProject;
211
- if (shouldUpdateWorkspaces) {
212
- const workspacePkgJsons = await findWorkspacePackageJsons(process.cwd());
213
- if (workspacePkgJsons.length > 0) {
214
- return await updateWorkspacePackages(workspacePkgJsons, args, options);
215
- } else if (args["allWorkspaces"]) {
216
- relinka("warn", "No workspace packages found but --all-workspaces flag was provided");
217
- }
218
- } else if (isMonorepoProject) {
219
- relinka("log", "Skipping workspace packages due to --root-only flag");
220
- }
221
- return 0;
222
- }
223
- export function displayUpdateSummary(totalUpdated, args, isMonorepoProject, shouldUpdateWorkspaces) {
224
- if (args.recursive) {
225
- relinka("log", `Updated ${totalUpdated} dependencies across all package.json files`);
226
- } else {
227
- if (isMonorepoProject && shouldUpdateWorkspaces) {
228
- relinka("log", `Updated ${totalUpdated} dependencies across workspace (root + workspaces)`);
229
- } else if (isMonorepoProject) {
230
- relinka("log", `Updated ${totalUpdated} dependencies in root package.json only`);
231
- } else {
232
- relinka("log", `Updated ${totalUpdated} dependencies`);
128
+ }
129
+ } catch (error) {
130
+ relinka(
131
+ "warn",
132
+ `Failed to process ${packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`
133
+ );
233
134
  }
234
135
  }
136
+ return totalUpdated;
235
137
  }
236
- export async function handleInstallation(args, effectiveLinker, packageJson) {
237
- if (!args["withInstall"]) {
238
- const packageManager2 = await detectPackageManager(process.cwd());
239
- const installCommand = packageManager2?.command || "your package manager";
240
- relinka(
241
- "log",
242
- `Install step is skipped by default. Run '${installCommand} install' manually to apply the changes.`
243
- );
244
- relinka(
245
- "log",
246
- `(experimental) Next time you can try --withInstall flag to run it automatically.`
247
- );
248
- return;
249
- }
138
+ export async function handleInstallation() {
250
139
  const packageManager = await detectPackageManager(process.cwd());
251
140
  if (!packageManager) {
252
141
  relinka("warn", "Could not detect package manager. Please run install manually.");
253
142
  return;
254
143
  }
255
144
  try {
256
- if (args.filter && args.filter.length > 0) {
257
- const filterArgs = args.filter.flatMap((filter) => ["--filter", filter]);
258
- await runInstallCommandWithFilter(packageManager, effectiveLinker, filterArgs);
259
- } else {
260
- await runInstallCommand(packageManager, effectiveLinker);
261
- }
262
- if (packageManager.name === "bun" && packageJson.scripts?.check && args["withCheckScript"]) {
263
- await $`bun check`;
264
- }
145
+ await runInstallCommand(packageManager);
146
+ relinka("log", "Installation completed successfully");
265
147
  } catch (error) {
266
148
  relinka("warn", `Install failed: ${error instanceof Error ? error.message : String(error)}`);
267
149
  relinka("log", `Run '${packageManager.command} install' manually to apply the changes`);
268
150
  }
269
151
  }
270
- export async function handleToolUpgrades(args) {
271
- const toolUpgradeFunctions = [
272
- { name: "dler (local)", fn: upgradeDlerLocal },
273
- { name: "dler (global)", fn: upgradeDlerGlobal },
274
- { name: "git", fn: upgradeGit },
275
- { name: "node.js", fn: upgradeNode },
276
- { name: "npm", fn: upgradeNpm },
277
- { name: "bun", fn: upgradeBun },
278
- { name: "yarn", fn: upgradeYarn },
279
- { name: "pnpm", fn: upgradePnpm }
280
- ];
281
- let results = [];
282
- if (args["upgrade-interactive"]) {
283
- const preliminaryResults = await Promise.all(
284
- toolUpgradeFunctions.map(async ({ fn }) => await fn())
285
- );
286
- const availableTools = toolUpgradeFunctions.map((tool, index) => ({
287
- ...tool,
288
- result: preliminaryResults[index]
289
- })).filter(({ result }) => result && result.status !== "not-found");
290
- if (availableTools.length === 0) {
291
- relinka("warn", "No tools available for upgrade");
292
- return;
293
- }
294
- const selectedTools = await multiselectPrompt({
295
- title: "Select tools to upgrade",
296
- displayInstructions: true,
297
- options: [
298
- { label: "Exit", value: "exit" },
299
- ...availableTools.map(({ name, result }) => {
300
- const isUpToDate = result && result.status === "up-to-date";
301
- const hasErrors = result && result.status === "error";
302
- const canUpgrade = result && result.status === "upgraded";
303
- let label = name;
304
- if (isUpToDate) {
305
- label += " (up-to-date)";
306
- } else if (hasErrors) {
307
- label += " (has errors)";
308
- } else if (canUpgrade) {
309
- label += " (can be upgraded)";
310
- }
311
- return {
312
- label: isUpToDate || hasErrors ? re.gray(label) : label,
313
- value: name,
314
- disabled: isUpToDate || hasErrors,
315
- hint: hasErrors ? result.message : void 0
316
- };
317
- })
318
- ]
319
- });
320
- if (selectedTools.length === 0 || selectedTools.includes("exit")) {
321
- relinka("info", "Exiting upgrade process");
322
- return;
323
- }
324
- const actualSelectedTools = selectedTools.filter((tool) => tool !== "exit");
325
- relinka("info", `Upgrading ${actualSelectedTools.length} selected tools...`);
326
- for (const toolName of actualSelectedTools) {
327
- const tool = availableTools.find((t) => t.name === toolName);
328
- if (tool) {
329
- const result = await tool.fn();
330
- results.push(result);
331
- }
332
- }
333
- } else {
334
- results = await Promise.all(toolUpgradeFunctions.map(async ({ fn }) => await fn()));
335
- }
336
- const upgraded = results.filter((r) => r.status === "upgraded");
337
- const upToDate = results.filter((r) => r.status === "up-to-date");
338
- const notFound = results.filter((r) => r.status === "not-found");
339
- const errors = results.filter((r) => r.status === "error");
340
- if (upgraded.length > 0) {
341
- relinka("success", `Upgraded ${upgraded.length} tools:`);
342
- upgraded.forEach(
343
- (r) => relinka("verbose", ` \u2713 ${r.tool}${r.message ? ` - ${r.message}` : ""}`)
344
- );
345
- }
346
- if (upToDate.length > 0) {
347
- relinka("info", `${upToDate.length} tools already up-to-date:`);
348
- upToDate.forEach(
349
- (r) => relinka("verbose", ` \u2022 ${r.tool}${r.message ? ` - ${r.message}` : ""}`)
350
- );
351
- }
352
- if (notFound.length > 0) {
353
- relinka("warn", `${notFound.length} tools not installed (skipped):`);
354
- notFound.forEach((r) => relinka("verbose", ` - ${r.tool}`));
355
- }
356
- if (errors.length > 0) {
357
- relinka("error", `${errors.length} tools had errors:`);
358
- errors.forEach((r) => relinka("verbose", ` \u2717 ${r.tool}${r.message ? ` - ${r.message}` : ""}`));
359
- }
360
- relinka("success", "Upgrade check completed!");
361
- }