@pipelab/cli 2.0.0-beta.18 → 2.0.0-beta.19

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.
package/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as __require, n as __esmMin, s as __toESM, t as __commonJSMin } from "./chunk-M2dkpuaD.mjs";
3
- import { S as useLogger, a as isRequired, c as supabase, g as processGraph, i as isWebSocketRequestMessage, l as SubscriptionRequiredError, n as savedFileMigrator, o as transformUrl, r as WebSocketError, s as isSupabaseAvailable, u as usePlugins } from "./src-Cgn6322X.mjs";
3
+ import { a as WebSocketError, c as transformUrl, d as SubscriptionRequiredError, f as usePlugins, i as savedFileMigrator, l as isSupabaseAvailable, n as connectionsMigrator, o as isWebSocketRequestMessage, r as fileRepoMigrations, s as isRequired, t as appSettingsMigrator, u as supabase, v as processGraph, w as useLogger } from "./src-CoHipk5y.mjs";
4
4
  import "./dist-BC_B45iu.mjs";
5
- import { c as getFolderSize, d as execa, i as downloadFile, l as require_commonjs$8, n as getMigrator, o as extractTarGz, r as setupConfigFile, s as extractZip, t as deleteConfigFile, u as require_balanced_match } from "./config-wyW8CcHw.mjs";
5
+ import { a as setupPipelineConfigFileByName, c as setupSettingsConfigFile, d as extractTarGz, f as extractZip, g as execa, h as require_balanced_match, i as setupConnectionsConfigFile, l as downloadFile, m as require_commonjs$8, n as deletePipelineConfigFileByPath, o as setupPipelineConfigFileByPath, p as getFolderSize, s as setupProjectsConfigFile, t as deletePipelineConfigFileByName } from "./config-C4SmHbuE.mjs";
6
6
  import path, { delimiter, dirname, isAbsolute, join, normalize, resolve, sep } from "node:path";
7
7
  import { fileURLToPath, pathToFileURL } from "node:url";
8
8
  import { homedir, platform, release } from "node:os";
9
9
  import fs, { createReadStream, existsSync, readFileSync, readdirSync, statSync } from "node:fs";
10
- import { access, chmod, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
10
+ import fs$1, { access, chmod, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
11
11
  import http from "http";
12
12
  import http$1 from "node:http";
13
13
  import { webcrypto } from "node:crypto";
@@ -90,8 +90,33 @@ var PipelabContext = class {
90
90
  getConfigPath(...subpaths) {
91
91
  return join(this.userDataPath, "config", ...subpaths);
92
92
  }
93
+ getSettingsPath() {
94
+ return this.getConfigPath("settings.json");
95
+ }
96
+ getConnectionsPath() {
97
+ return this.getConfigPath("connections.json");
98
+ }
99
+ getProjectsPath() {
100
+ return this.getConfigPath("projects.json");
101
+ }
102
+ _cachedSettings = null;
103
+ _cachedSettingsTime = 0;
104
+ getSettings() {
105
+ const settingsPath = this.getSettingsPath();
106
+ if (!existsSync(settingsPath)) return null;
107
+ const now = Date.now();
108
+ if (this._cachedSettings && now - this._cachedSettingsTime < 2e3) return this._cachedSettings;
109
+ try {
110
+ const content = readFileSync(settingsPath, "utf8");
111
+ this._cachedSettings = JSON.parse(content);
112
+ this._cachedSettingsTime = now;
113
+ return this._cachedSettings;
114
+ } catch (e) {
115
+ return this._cachedSettings;
116
+ }
117
+ }
93
118
  getTempPath(...subpaths) {
94
- return join(this.userDataPath, "temp", ...subpaths);
119
+ return join(this.getSettings()?.tempFolder || join(this.userDataPath, "temp"), ...subpaths);
95
120
  }
96
121
  async createTempFolder(prefix = "pipelab-") {
97
122
  const baseDir = this.getTempPath();
@@ -99,8 +124,9 @@ var PipelabContext = class {
99
124
  return await mkdtemp(join(await realpath(baseDir), prefix));
100
125
  }
101
126
  getCachePath(folder, ...subpaths) {
102
- if (!folder) return join(this.userDataPath, "cache");
103
- return join(this.userDataPath, "cache", folder, ...subpaths);
127
+ const base = this.getSettings()?.cacheFolder || join(this.userDataPath, "cache");
128
+ if (!folder) return base;
129
+ return join(base, folder, ...subpaths);
104
130
  }
105
131
  getPnpmPath(...subpaths) {
106
132
  return join(this.userDataPath, "pnpm", ...subpaths);
@@ -4018,61 +4044,57 @@ const registerFsHandlers = (_context) => {
4018
4044
  const registerConfigHandlers = (context) => {
4019
4045
  const { handle } = useAPI();
4020
4046
  const { logger } = useLogger();
4021
- handle("config:load", async (_, { send, value }) => {
4022
- const { config: name } = value;
4023
- logger().info("config:load", name);
4047
+ handle("settings:load", async (_, { send }) => {
4048
+ logger().info("settings:load");
4024
4049
  try {
4025
4050
  send({
4026
4051
  type: "end",
4027
4052
  data: {
4028
4053
  type: "success",
4029
- result: { result: await (await setupConfigFile(name, { context })).getConfig() }
4054
+ result: await (await setupSettingsConfigFile(context)).getConfig()
4030
4055
  }
4031
4056
  });
4032
4057
  } catch (e) {
4033
- logger().error(`config:load error for ${name}:`, e);
4058
+ logger().error("settings:load error:", e);
4034
4059
  send({
4035
4060
  type: "end",
4036
4061
  data: {
4037
4062
  type: "error",
4038
- ipcError: e instanceof Error ? e.message : `Unable to load config ${name}`
4063
+ ipcError: e instanceof Error ? e.message : "Unable to load settings"
4039
4064
  }
4040
4065
  });
4041
4066
  }
4042
4067
  });
4043
- handle("config:save", async (_, { send, value }) => {
4044
- const { data, config: name } = value;
4068
+ handle("settings:save", async (_, { send, value }) => {
4069
+ const { data } = value;
4045
4070
  try {
4046
- const manager = await setupConfigFile(name, { context });
4071
+ const manager = await setupSettingsConfigFile(context);
4047
4072
  const json = typeof data === "string" ? JSON.parse(data) : data;
4048
4073
  await manager.setConfig(json);
4049
4074
  send({
4050
4075
  type: "end",
4051
4076
  data: {
4052
4077
  type: "success",
4053
- result: { result: "ok" }
4078
+ result: "ok"
4054
4079
  }
4055
4080
  });
4056
4081
  } catch (e) {
4057
- logger().error(`config:save error for ${name}:`, e);
4082
+ logger().error("settings:save error:", e);
4058
4083
  send({
4059
4084
  type: "end",
4060
4085
  data: {
4061
4086
  type: "error",
4062
- ipcError: e instanceof Error ? e.message : `Unable to save config ${name}`
4087
+ ipcError: e instanceof Error ? e.message : "Unable to save settings"
4063
4088
  }
4064
4089
  });
4065
4090
  }
4066
4091
  });
4067
- handle("config:reset", async (event, { value, send }) => {
4068
- const { config: name, key } = value;
4069
- logger().info("config:reset", name, key);
4092
+ handle("settings:reset", async (_, { send, value }) => {
4093
+ const { key } = value;
4070
4094
  try {
4071
- const manager = await setupConfigFile(name, { context });
4095
+ const manager = await setupSettingsConfigFile(context);
4072
4096
  const currentConfig = await manager.getConfig();
4073
- const migrator = getMigrator(name);
4074
- if (!migrator) throw new Error(`No migrator found for configuration: ${name}`);
4075
- const defaultValue = migrator.defaultValue[key];
4097
+ const defaultValue = appSettingsMigrator.defaultValue[key];
4076
4098
  await manager.setConfig({
4077
4099
  ...currentConfig ? currentConfig : {},
4078
4100
  [key]: defaultValue
@@ -4081,39 +4103,300 @@ const registerConfigHandlers = (context) => {
4081
4103
  type: "end",
4082
4104
  data: {
4083
4105
  type: "success",
4084
- result: { result: "ok" }
4106
+ result: "ok"
4085
4107
  }
4086
4108
  });
4087
4109
  } catch (e) {
4088
- logger().error(`config:reset error for ${name}:`, e);
4110
+ logger().error("settings:reset error:", e);
4089
4111
  send({
4090
4112
  type: "end",
4091
4113
  data: {
4092
4114
  type: "error",
4093
- ipcError: e instanceof Error ? e.message : `Unable to reset config ${name}`
4115
+ ipcError: e instanceof Error ? e.message : "Unable to reset settings"
4094
4116
  }
4095
4117
  });
4096
4118
  }
4097
4119
  });
4098
- handle("config:delete", async (_, { send, value }) => {
4099
- const { config: name } = value;
4100
- logger().info("config:delete", name);
4120
+ handle("connections:load", async (_, { send }) => {
4121
+ logger().info("connections:load");
4101
4122
  try {
4102
- await deleteConfigFile(name, context);
4103
4123
  send({
4104
4124
  type: "end",
4105
4125
  data: {
4106
4126
  type: "success",
4107
- result: { result: "ok" }
4127
+ result: await (await setupConnectionsConfigFile(context)).getConfig()
4128
+ }
4129
+ });
4130
+ } catch (e) {
4131
+ logger().error("connections:load error:", e);
4132
+ send({
4133
+ type: "end",
4134
+ data: {
4135
+ type: "error",
4136
+ ipcError: e instanceof Error ? e.message : "Unable to load connections"
4137
+ }
4138
+ });
4139
+ }
4140
+ });
4141
+ handle("connections:save", async (_, { send, value }) => {
4142
+ const { data } = value;
4143
+ try {
4144
+ const manager = await setupConnectionsConfigFile(context);
4145
+ const json = typeof data === "string" ? JSON.parse(data) : data;
4146
+ await manager.setConfig(json);
4147
+ send({
4148
+ type: "end",
4149
+ data: {
4150
+ type: "success",
4151
+ result: "ok"
4152
+ }
4153
+ });
4154
+ } catch (e) {
4155
+ logger().error("connections:save error:", e);
4156
+ send({
4157
+ type: "end",
4158
+ data: {
4159
+ type: "error",
4160
+ ipcError: e instanceof Error ? e.message : "Unable to save connections"
4161
+ }
4162
+ });
4163
+ }
4164
+ });
4165
+ handle("connections:reset", async (_, { send, value }) => {
4166
+ const { key } = value;
4167
+ try {
4168
+ const manager = await setupConnectionsConfigFile(context);
4169
+ const currentConfig = await manager.getConfig();
4170
+ const defaultValue = connectionsMigrator.defaultValue[key];
4171
+ await manager.setConfig({
4172
+ ...currentConfig ? currentConfig : {},
4173
+ [key]: defaultValue
4174
+ });
4175
+ send({
4176
+ type: "end",
4177
+ data: {
4178
+ type: "success",
4179
+ result: "ok"
4180
+ }
4181
+ });
4182
+ } catch (e) {
4183
+ logger().error("connections:reset error:", e);
4184
+ send({
4185
+ type: "end",
4186
+ data: {
4187
+ type: "error",
4188
+ ipcError: e instanceof Error ? e.message : "Unable to reset connections"
4189
+ }
4190
+ });
4191
+ }
4192
+ });
4193
+ handle("projects:load", async (_, { send }) => {
4194
+ logger().info("projects:load");
4195
+ try {
4196
+ send({
4197
+ type: "end",
4198
+ data: {
4199
+ type: "success",
4200
+ result: await (await setupProjectsConfigFile(context)).getConfig()
4201
+ }
4202
+ });
4203
+ } catch (e) {
4204
+ logger().error("projects:load error:", e);
4205
+ send({
4206
+ type: "end",
4207
+ data: {
4208
+ type: "error",
4209
+ ipcError: e instanceof Error ? e.message : "Unable to load projects"
4210
+ }
4211
+ });
4212
+ }
4213
+ });
4214
+ handle("projects:save", async (_, { send, value }) => {
4215
+ const { data } = value;
4216
+ try {
4217
+ const manager = await setupProjectsConfigFile(context);
4218
+ const json = typeof data === "string" ? JSON.parse(data) : data;
4219
+ await manager.setConfig(json);
4220
+ send({
4221
+ type: "end",
4222
+ data: {
4223
+ type: "success",
4224
+ result: "ok"
4225
+ }
4226
+ });
4227
+ } catch (e) {
4228
+ logger().error("projects:save error:", e);
4229
+ send({
4230
+ type: "end",
4231
+ data: {
4232
+ type: "error",
4233
+ ipcError: e instanceof Error ? e.message : "Unable to save projects"
4234
+ }
4235
+ });
4236
+ }
4237
+ });
4238
+ handle("projects:reset", async (_, { send, value }) => {
4239
+ const { key } = value;
4240
+ try {
4241
+ const manager = await setupProjectsConfigFile(context);
4242
+ const currentConfig = await manager.getConfig();
4243
+ const defaultValue = fileRepoMigrations.defaultValue[key];
4244
+ await manager.setConfig({
4245
+ ...currentConfig ? currentConfig : {},
4246
+ [key]: defaultValue
4247
+ });
4248
+ send({
4249
+ type: "end",
4250
+ data: {
4251
+ type: "success",
4252
+ result: "ok"
4253
+ }
4254
+ });
4255
+ } catch (e) {
4256
+ logger().error("projects:reset error:", e);
4257
+ send({
4258
+ type: "end",
4259
+ data: {
4260
+ type: "error",
4261
+ ipcError: e instanceof Error ? e.message : "Unable to reset projects"
4262
+ }
4263
+ });
4264
+ }
4265
+ });
4266
+ handle("pipeline:load-by-name", async (_, { send, value }) => {
4267
+ const { name } = value;
4268
+ logger().info("pipeline:load-by-name", name);
4269
+ try {
4270
+ send({
4271
+ type: "end",
4272
+ data: {
4273
+ type: "success",
4274
+ result: await (await setupPipelineConfigFileByName(name, context)).getConfig()
4108
4275
  }
4109
4276
  });
4110
4277
  } catch (e) {
4111
- logger().error(`config:delete error for ${name}:`, e);
4278
+ logger().error(`pipeline:load-by-name error for ${name}:`, e);
4112
4279
  send({
4113
4280
  type: "end",
4114
4281
  data: {
4115
4282
  type: "error",
4116
- ipcError: e instanceof Error ? e.message : `Unable to delete config ${name}`
4283
+ ipcError: e instanceof Error ? e.message : `Unable to load pipeline ${name}`
4284
+ }
4285
+ });
4286
+ }
4287
+ });
4288
+ handle("pipeline:load-by-path", async (_, { send, value }) => {
4289
+ const { path: absolutePath } = value;
4290
+ logger().info("pipeline:load-by-path", absolutePath);
4291
+ try {
4292
+ send({
4293
+ type: "end",
4294
+ data: {
4295
+ type: "success",
4296
+ result: await (await setupPipelineConfigFileByPath(absolutePath, context)).getConfig()
4297
+ }
4298
+ });
4299
+ } catch (e) {
4300
+ logger().error(`pipeline:load-by-path error for ${absolutePath}:`, e);
4301
+ send({
4302
+ type: "end",
4303
+ data: {
4304
+ type: "error",
4305
+ ipcError: e instanceof Error ? e.message : `Unable to load pipeline ${absolutePath}`
4306
+ }
4307
+ });
4308
+ }
4309
+ });
4310
+ handle("pipeline:save-by-name", async (_, { send, value }) => {
4311
+ const { data, name } = value;
4312
+ try {
4313
+ const manager = await setupPipelineConfigFileByName(name, context);
4314
+ const json = typeof data === "string" ? JSON.parse(data) : data;
4315
+ await manager.setConfig(json);
4316
+ send({
4317
+ type: "end",
4318
+ data: {
4319
+ type: "success",
4320
+ result: "ok"
4321
+ }
4322
+ });
4323
+ } catch (e) {
4324
+ logger().error(`pipeline:save-by-name error for ${name}:`, e);
4325
+ send({
4326
+ type: "end",
4327
+ data: {
4328
+ type: "error",
4329
+ ipcError: e instanceof Error ? e.message : `Unable to save pipeline ${name}`
4330
+ }
4331
+ });
4332
+ }
4333
+ });
4334
+ handle("pipeline:save-by-path", async (_, { send, value }) => {
4335
+ const { data, path: absolutePath } = value;
4336
+ try {
4337
+ const manager = await setupPipelineConfigFileByPath(absolutePath, context);
4338
+ const json = typeof data === "string" ? JSON.parse(data) : data;
4339
+ await manager.setConfig(json);
4340
+ send({
4341
+ type: "end",
4342
+ data: {
4343
+ type: "success",
4344
+ result: "ok"
4345
+ }
4346
+ });
4347
+ } catch (e) {
4348
+ logger().error(`pipeline:save-by-path error for ${absolutePath}:`, e);
4349
+ send({
4350
+ type: "end",
4351
+ data: {
4352
+ type: "error",
4353
+ ipcError: e instanceof Error ? e.message : `Unable to save pipeline ${absolutePath}`
4354
+ }
4355
+ });
4356
+ }
4357
+ });
4358
+ handle("pipeline:delete-by-name", async (_, { send, value }) => {
4359
+ const { name } = value;
4360
+ logger().info("pipeline:delete-by-name", name);
4361
+ try {
4362
+ await deletePipelineConfigFileByName(name, context);
4363
+ send({
4364
+ type: "end",
4365
+ data: {
4366
+ type: "success",
4367
+ result: "ok"
4368
+ }
4369
+ });
4370
+ } catch (e) {
4371
+ logger().error(`pipeline:delete-by-name error for ${name}:`, e);
4372
+ send({
4373
+ type: "end",
4374
+ data: {
4375
+ type: "error",
4376
+ ipcError: e instanceof Error ? e.message : `Unable to delete pipeline ${name}`
4377
+ }
4378
+ });
4379
+ }
4380
+ });
4381
+ handle("pipeline:delete-by-path", async (_, { send, value }) => {
4382
+ const { path: absolutePath } = value;
4383
+ logger().info("pipeline:delete-by-path", absolutePath);
4384
+ try {
4385
+ await deletePipelineConfigFileByPath(absolutePath, context);
4386
+ send({
4387
+ type: "end",
4388
+ data: {
4389
+ type: "success",
4390
+ result: "ok"
4391
+ }
4392
+ });
4393
+ } catch (e) {
4394
+ logger().error(`pipeline:delete-by-path error for ${absolutePath}:`, e);
4395
+ send({
4396
+ type: "end",
4397
+ data: {
4398
+ type: "error",
4399
+ ipcError: e instanceof Error ? e.message : `Unable to delete pipeline ${absolutePath}`
4117
4400
  }
4118
4401
  });
4119
4402
  }
@@ -65996,8 +66279,8 @@ var require_error$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
65996
66279
  })();
65997
66280
  }));
65998
66281
  //#endregion
65999
- //#region ../../packages/core-node/src/migrations.ts
66000
- var import_src$1 = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
66282
+ //#region ../../node_modules/serve-handler/src/index.js
66283
+ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66001
66284
  const { promisify: promisify$1 } = __require("util");
66002
66285
  const path$3 = __require("path");
66003
66286
  const { createHash } = __require("crypto");
@@ -66449,47 +66732,12 @@ var import_src$1 = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((expo
66449
66732
  response.writeHead(response.statusCode || 200, headers);
66450
66733
  stream.pipe(response);
66451
66734
  };
66452
- })))(), 1);
66453
- var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
66454
- var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
66455
- /**
66456
- * Registers migration handlers for the CLI/Standalone server.
66457
- * This overrides the default handlers from @pipelab/core-node to include
66458
- * pipeline and file repo migrations directly in the backend.
66459
- */
66460
- function registerMigrationHandlers(context) {
66461
- const { handle } = useAPI();
66462
- const { logger } = useLogger();
66463
- handle("config:load", async (_, { send, value }) => {
66464
- const { config: name } = value;
66465
- logger().info("[CLI Migration] config:load", name);
66466
- try {
66467
- const migrator = getMigrator(name);
66468
- if (!migrator) throw new Error(`No migrator found for configuration: ${name}. All files loaded via config:load MUST have a migration schema.`);
66469
- send({
66470
- type: "end",
66471
- data: {
66472
- type: "success",
66473
- result: { result: await (await setupConfigFile(name, {
66474
- context,
66475
- migrator
66476
- })).getConfig() }
66477
- }
66478
- });
66479
- } catch (e) {
66480
- logger().error(`[CLI Migration] config:load error for ${name}:`, e);
66481
- send({
66482
- type: "end",
66483
- data: {
66484
- type: "error",
66485
- ipcError: e instanceof Error ? e.message : `Unable to load config ${name}`
66486
- }
66487
- });
66488
- }
66489
- });
66490
- }
66735
+ }));
66491
66736
  //#endregion
66492
66737
  //#region ../../packages/core-node/src/server.ts
66738
+ var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
66739
+ var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
66740
+ var import_src$1 = /* @__PURE__ */ __toESM(require_src$1(), 1);
66493
66741
  const sendStartupProgress = (message) => {
66494
66742
  console.log(`[Startup Progress] ${message}`);
66495
66743
  webSocketServer.broadcast("startup:progress", {
@@ -66560,7 +66808,6 @@ async function serveCommand(options, version, _dirname) {
66560
66808
  version,
66561
66809
  context
66562
66810
  });
66563
- registerMigrationHandlers(context);
66564
66811
  sendStartupReady();
66565
66812
  return server;
66566
66813
  }
@@ -67169,9 +67416,9 @@ const builtInPlugins = async (options) => {
67169
67416
  const envStart = Date.now();
67170
67417
  await Promise.all([ensureNodeJS(options.context), ensurePNPM(options.context)]);
67171
67418
  console.log(`[Plugins] Environment preparation took ${Date.now() - envStart}ms`);
67172
- const { usePlugins } = await import("./src-BmqReRBI.mjs");
67419
+ const { usePlugins } = await import("./src-DU3j_v2A.mjs");
67173
67420
  const { registerPlugins } = usePlugins();
67174
- const { webSocketServer } = await import("./src-DhNbRNuq.mjs");
67421
+ const { webSocketServer } = await import("./src-5EzZR-UT.mjs");
67175
67422
  webSocketServer.broadcast("startup:progress", { type: "ready" });
67176
67423
  (async () => {
67177
67424
  const totalStart = Date.now();
@@ -67191,8 +67438,8 @@ const builtInPlugins = async (options) => {
67191
67438
  "@pipelab/plugin-netlify"
67192
67439
  ]) pluginsToLoad.set(name, "latest");
67193
67440
  try {
67194
- const { setupConfigFile } = await import("./config-Cjh-mvRR.mjs");
67195
- const settingsPlugins = (await (await setupConfigFile("settings", { context: options.context })).getConfig())?.plugins || [];
67441
+ const { setupSettingsConfigFile } = await import("./config-B-M_kmKR.mjs");
67442
+ const settingsPlugins = (await (await setupSettingsConfigFile(options.context)).getConfig())?.plugins || [];
67196
67443
  for (const plugin of settingsPlugins) if (plugin.name) if (plugin.enabled) {
67197
67444
  if (!pluginsToLoad.has(plugin.name)) pluginsToLoad.set(plugin.name, "latest");
67198
67445
  } else pluginsToLoad.delete(plugin.name);
@@ -67291,7 +67538,7 @@ const executeGraphWithHistory = async ({ graph, variables, projectName, projectP
67291
67538
  } else logger().error(`[Runner] Failed to load or register plugin "${pluginId}"`);
67292
67539
  }
67293
67540
  logger().info(`[Sandbox] Execution sandbox created at: ${sandboxPath}`);
67294
- await (await setupConfigFile("settings", { context: ctx })).getConfig();
67541
+ await (await setupSettingsConfigFile(ctx)).getConfig();
67295
67542
  try {
67296
67543
  const result = await processGraph({
67297
67544
  graph,
@@ -67799,7 +68046,7 @@ const registerEngineHandlers = (context) => {
67799
68046
  });
67800
68047
  handle("graph:execute", async (event, { send, value }) => {
67801
68048
  const { graph, variables, projectName, projectPath, pipelineId } = value;
67802
- await (await setupConfigFile("settings", { context })).getConfig();
68049
+ await (await setupSettingsConfigFile(context)).getConfig();
67803
68050
  const effectiveProjectName = projectName || "Unnamed Project";
67804
68051
  const effectiveProjectPath = projectPath || "";
67805
68052
  const effectivePipelineId = pipelineId || "unknown";
@@ -68331,6 +68578,470 @@ const registerPluginsHandlers = (context) => {
68331
68578
  });
68332
68579
  };
68333
68580
  //#endregion
68581
+ //#region ../../packages/core-node/src/handlers/migration.ts
68582
+ const registerMigrationHandlers = (context) => {
68583
+ const { handle } = useAPI();
68584
+ const { logger } = useLogger();
68585
+ const getFileMetadata = async (filePath) => {
68586
+ const exists = existsSync(filePath);
68587
+ let mtime = Date.now();
68588
+ let version = null;
68589
+ if (exists) {
68590
+ try {
68591
+ const stat = await fs$1.stat(filePath);
68592
+ mtime = stat.mtime ? stat.mtime.getTime() : Date.now();
68593
+ } catch (e) {
68594
+ mtime = Date.now();
68595
+ }
68596
+ try {
68597
+ const content = await fs$1.readFile(filePath, "utf8");
68598
+ const json = JSON.parse(content);
68599
+ version = json && typeof json.version === "string" ? json.version : null;
68600
+ } catch (e) {}
68601
+ } else mtime = Date.now();
68602
+ return {
68603
+ exists,
68604
+ mtime,
68605
+ version
68606
+ };
68607
+ };
68608
+ const isVersionImportable = (sourceVer, targetVer) => {
68609
+ if (!sourceVer) return false;
68610
+ if (!targetVer) return true;
68611
+ try {
68612
+ const coercedSource = import_semver.default.coerce(sourceVer);
68613
+ const coercedTarget = import_semver.default.coerce(targetVer);
68614
+ if (!coercedSource) return false;
68615
+ if (!coercedTarget) return true;
68616
+ return import_semver.default.lte(coercedSource, coercedTarget);
68617
+ } catch {
68618
+ return sourceVer <= targetVer;
68619
+ }
68620
+ };
68621
+ handle("migration:scan-stable", async (_, { send }) => {
68622
+ logger().info("[Migration] Scanning other channel database...");
68623
+ try {
68624
+ const isStable = context.userDataPath.endsWith("app") || !context.userDataPath.includes("app-beta");
68625
+ const sourceEnv = isStable ? "beta" : "prod";
68626
+ const sourcePath = getDefaultUserDataPath$1(sourceEnv);
68627
+ if (sourcePath === context.userDataPath) {
68628
+ logger().info("[Migration] Running in same channel. Disabling migration scan.");
68629
+ return send({
68630
+ type: "end",
68631
+ data: {
68632
+ type: "success",
68633
+ result: {
68634
+ sourceChannel: isStable ? "Beta" : "Stable",
68635
+ targetChannel: isStable ? "Stable" : "Beta",
68636
+ settingsExists: false,
68637
+ settingsVersion: null,
68638
+ settingsVersionTarget: null,
68639
+ settingsMtimeSource: Date.now(),
68640
+ settingsMtimeTarget: Date.now(),
68641
+ settingsImportable: false,
68642
+ connectionsExists: false,
68643
+ connectionsCount: 0,
68644
+ connectionsVersion: null,
68645
+ connectionsVersionTarget: null,
68646
+ connectionsMtimeSource: Date.now(),
68647
+ connectionsMtimeTarget: Date.now(),
68648
+ connectionsImportable: false,
68649
+ projectsExists: false,
68650
+ projectsVersion: null,
68651
+ projectsVersionTarget: null,
68652
+ projectsMtimeSource: Date.now(),
68653
+ projectsMtimeTarget: Date.now(),
68654
+ projectsImportable: false,
68655
+ projects: []
68656
+ }
68657
+ }
68658
+ });
68659
+ }
68660
+ const sourceContext = new PipelabContext({
68661
+ userDataPath: sourcePath,
68662
+ releaseTag: sourceEnv
68663
+ });
68664
+ const sourceSettingsPath = sourceContext.getSettingsPath();
68665
+ const targetSettingsPath = context.getSettingsPath();
68666
+ const sourceConnectionsPath = sourceContext.getConnectionsPath();
68667
+ const targetConnectionsPath = context.getConnectionsPath();
68668
+ const sourceProjectsPath = sourceContext.getProjectsPath();
68669
+ const targetProjectsPath = context.getProjectsPath();
68670
+ const sourceSettingsMeta = await getFileMetadata(sourceSettingsPath);
68671
+ const targetSettingsMeta = await getFileMetadata(targetSettingsPath);
68672
+ const sourceConnectionsMeta = await getFileMetadata(sourceConnectionsPath);
68673
+ const targetConnectionsMeta = await getFileMetadata(targetConnectionsPath);
68674
+ const sourceProjectsMeta = await getFileMetadata(sourceProjectsPath);
68675
+ const targetProjectsMeta = await getFileMetadata(targetProjectsPath);
68676
+ const settingsExists = sourceSettingsMeta.exists;
68677
+ const settingsVersion = sourceSettingsMeta.version;
68678
+ const settingsMtimeSource = sourceSettingsMeta.mtime;
68679
+ const settingsMtimeTarget = targetSettingsMeta.mtime;
68680
+ const settingsImportable = isVersionImportable(settingsVersion, targetSettingsMeta.version);
68681
+ const connectionsExists = sourceConnectionsMeta.exists;
68682
+ const connectionsVersion = sourceConnectionsMeta.version;
68683
+ const connectionsMtimeSource = sourceConnectionsMeta.mtime;
68684
+ const connectionsMtimeTarget = targetConnectionsMeta.mtime;
68685
+ const connectionsImportable = isVersionImportable(connectionsVersion, targetConnectionsMeta.version);
68686
+ const projectsExists = sourceProjectsMeta.exists;
68687
+ const projectsVersion = sourceProjectsMeta.version;
68688
+ const projectsMtimeSource = sourceProjectsMeta.mtime;
68689
+ const projectsMtimeTarget = targetProjectsMeta.mtime;
68690
+ const projectsImportable = isVersionImportable(projectsVersion, targetProjectsMeta.version);
68691
+ let connectionsCount = 0;
68692
+ try {
68693
+ if (sourceConnectionsMeta.exists) {
68694
+ const connContent = await fs$1.readFile(sourceConnectionsPath, "utf8");
68695
+ const connJson = JSON.parse(connContent);
68696
+ if (connJson && Array.isArray(connJson.connections)) connectionsCount = connJson.connections.length;
68697
+ }
68698
+ } catch (err) {
68699
+ logger().error("[Migration] Error parsing source connections.json:", err);
68700
+ }
68701
+ let sourceProjectsList = [];
68702
+ let sourcePipelinesList = [];
68703
+ try {
68704
+ if (sourceProjectsMeta.exists) {
68705
+ const projContent = await fs$1.readFile(sourceProjectsPath, "utf8");
68706
+ const projJson = JSON.parse(projContent);
68707
+ sourceProjectsList = projJson.projects || [];
68708
+ sourcePipelinesList = projJson.pipelines || [];
68709
+ }
68710
+ } catch (err) {
68711
+ logger().error("[Migration] Error parsing source projects.json:", err);
68712
+ }
68713
+ let targetPipelinesList = [];
68714
+ try {
68715
+ if (targetProjectsMeta.exists) {
68716
+ const targetProjContent = await fs$1.readFile(targetProjectsPath, "utf8");
68717
+ targetPipelinesList = JSON.parse(targetProjContent).pipelines || [];
68718
+ }
68719
+ } catch (err) {}
68720
+ const projectsReport = [];
68721
+ for (const proj of sourceProjectsList) {
68722
+ const projPipelines = sourcePipelinesList.filter((p) => p.project === proj.id);
68723
+ const pipelinesReport = [];
68724
+ for (const pipe of projPipelines) {
68725
+ const targetPipe = targetPipelinesList.find((bp) => bp.id === pipe.id);
68726
+ const existsInBeta = !!targetPipe;
68727
+ let pipeName = pipe.id;
68728
+ let pipeDesc = "";
68729
+ if (pipe.type === "internal") {
68730
+ const sourcePipeFile = sourceContext.getConfigPath(`${pipe.configName}.json`);
68731
+ try {
68732
+ if (existsSync(sourcePipeFile)) {
68733
+ const pipeContent = await fs$1.readFile(sourcePipeFile, "utf8");
68734
+ const pipeJson = JSON.parse(pipeContent);
68735
+ pipeName = pipeJson.name || pipeName;
68736
+ pipeDesc = pipeJson.description || pipeDesc;
68737
+ }
68738
+ } catch (err) {
68739
+ logger().error(`[Migration] Error reading source pipeline file ${sourcePipeFile}:`, err);
68740
+ }
68741
+ } else if (pipe.type === "external") {
68742
+ pipeName = pipe.summary?.name || pipeName;
68743
+ pipeDesc = pipe.summary?.description || pipeDesc;
68744
+ }
68745
+ pipelinesReport.push({
68746
+ id: pipe.id,
68747
+ name: pipeName,
68748
+ description: pipeDesc,
68749
+ type: pipe.type,
68750
+ lastModifiedStable: pipe.type !== "pipelab-cloud" ? pipe.lastModified : void 0,
68751
+ lastModifiedBeta: targetPipe && targetPipe.type !== "pipelab-cloud" ? targetPipe.lastModified : void 0,
68752
+ existsInBeta
68753
+ });
68754
+ }
68755
+ projectsReport.push({
68756
+ id: proj.id,
68757
+ name: proj.name,
68758
+ description: proj.description || "",
68759
+ pipelines: pipelinesReport
68760
+ });
68761
+ }
68762
+ send({
68763
+ type: "end",
68764
+ data: {
68765
+ type: "success",
68766
+ result: {
68767
+ sourceChannel: isStable ? "Beta" : "Stable",
68768
+ targetChannel: isStable ? "Stable" : "Beta",
68769
+ settingsExists,
68770
+ settingsVersion,
68771
+ settingsVersionTarget: targetSettingsMeta.version,
68772
+ settingsMtimeSource,
68773
+ settingsMtimeTarget,
68774
+ settingsImportable,
68775
+ connectionsExists,
68776
+ connectionsCount,
68777
+ connectionsVersion,
68778
+ connectionsVersionTarget: targetConnectionsMeta.version,
68779
+ connectionsMtimeSource,
68780
+ connectionsMtimeTarget,
68781
+ connectionsImportable,
68782
+ projectsExists,
68783
+ projectsVersion,
68784
+ projectsVersionTarget: targetProjectsMeta.version,
68785
+ projectsMtimeSource,
68786
+ projectsMtimeTarget,
68787
+ projectsImportable,
68788
+ projects: projectsReport
68789
+ }
68790
+ }
68791
+ });
68792
+ } catch (e) {
68793
+ logger().error("[Migration] Error scanning other channel folder:", e);
68794
+ send({
68795
+ type: "end",
68796
+ data: {
68797
+ type: "error",
68798
+ ipcError: e instanceof Error ? e.message : "Failed to scan other channel database"
68799
+ }
68800
+ });
68801
+ }
68802
+ });
68803
+ handle("migration:perform", async (_, { send, value }) => {
68804
+ logger().info("[Migration] Performing migration...");
68805
+ try {
68806
+ const { migrateSettings, migrateConnections, selectedProjects, selectedPipelines } = value;
68807
+ const sourceEnv = context.userDataPath.endsWith("app") || !context.userDataPath.includes("app-beta") ? "beta" : "prod";
68808
+ const sourcePath = getDefaultUserDataPath$1(sourceEnv);
68809
+ const sourceContext = new PipelabContext({
68810
+ userDataPath: sourcePath,
68811
+ releaseTag: sourceEnv
68812
+ });
68813
+ sourceContext.getConfigPath();
68814
+ const targetConfigDir = context.getConfigPath();
68815
+ if (sourcePath === context.userDataPath) throw new Error("Cannot migrate data: Source and target directories are identical.");
68816
+ if (existsSync(targetConfigDir)) {
68817
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
68818
+ const backupDir = context.getConfigPath("backups", `backup_${timestamp}`);
68819
+ await fs$1.mkdir(backupDir, { recursive: true });
68820
+ const entries = await fs$1.readdir(targetConfigDir, { withFileTypes: true });
68821
+ for (const entry of entries) {
68822
+ if (entry.name === "backups") continue;
68823
+ const srcPath = join(targetConfigDir, entry.name);
68824
+ const destPath = join(backupDir, entry.name);
68825
+ try {
68826
+ await fs$1.cp(srcPath, destPath, { recursive: true });
68827
+ } catch (copyErr) {
68828
+ logger().error(`[Migration] Failed to backup ${entry.name}:`, copyErr);
68829
+ }
68830
+ }
68831
+ logger().info(`[Migration] Config backup successfully created at ${backupDir}`);
68832
+ }
68833
+ if (migrateSettings) {
68834
+ const sourceSettingsFile = sourceContext.getSettingsPath();
68835
+ const targetSettingsFile = context.getSettingsPath();
68836
+ const sourceMeta = await getFileMetadata(sourceSettingsFile);
68837
+ const targetMeta = await getFileMetadata(targetSettingsFile);
68838
+ if (!isVersionImportable(sourceMeta.version, targetMeta.version)) throw new Error("Cannot migrate settings: Source version is newer than current version.");
68839
+ if (existsSync(sourceSettingsFile)) {
68840
+ let stableSettings = {
68841
+ version: "7.0.0",
68842
+ locale: "en-US",
68843
+ theme: "light",
68844
+ autosave: true,
68845
+ agents: [],
68846
+ plugins: [],
68847
+ tours: {
68848
+ dashboard: {
68849
+ step: 0,
68850
+ completed: false
68851
+ },
68852
+ editor: {
68853
+ step: 0,
68854
+ completed: false
68855
+ }
68856
+ }
68857
+ };
68858
+ try {
68859
+ const stableContent = await fs$1.readFile(sourceSettingsFile, "utf8");
68860
+ stableSettings = JSON.parse(stableContent);
68861
+ } catch (e) {
68862
+ logger().error("[Migration] Failed to read source settings.json:", e);
68863
+ }
68864
+ let betaSettings = {
68865
+ version: "7.0.0",
68866
+ locale: "en-US",
68867
+ theme: "light",
68868
+ autosave: true,
68869
+ agents: [],
68870
+ plugins: [],
68871
+ tours: {
68872
+ dashboard: {
68873
+ step: 0,
68874
+ completed: false
68875
+ },
68876
+ editor: {
68877
+ step: 0,
68878
+ completed: false
68879
+ }
68880
+ }
68881
+ };
68882
+ if (existsSync(targetSettingsFile)) try {
68883
+ const betaContent = await fs$1.readFile(targetSettingsFile, "utf8");
68884
+ betaSettings = JSON.parse(betaContent);
68885
+ } catch (e) {}
68886
+ betaSettings.theme = stableSettings.theme ?? betaSettings.theme;
68887
+ betaSettings.locale = stableSettings.locale ?? betaSettings.locale;
68888
+ betaSettings.autosave = stableSettings.autosave ?? betaSettings.autosave;
68889
+ if (stableSettings.tours) {
68890
+ betaSettings.tours = betaSettings.tours || {
68891
+ dashboard: {
68892
+ step: 0,
68893
+ completed: false
68894
+ },
68895
+ editor: {
68896
+ step: 0,
68897
+ completed: false
68898
+ }
68899
+ };
68900
+ if (stableSettings.tours.dashboard) betaSettings.tours.dashboard = stableSettings.tours.dashboard;
68901
+ if (stableSettings.tours.editor) betaSettings.tours.editor = stableSettings.tours.editor;
68902
+ }
68903
+ const betaAgents = betaSettings.agents || [];
68904
+ const stableAgents = stableSettings.agents || [];
68905
+ for (const sAgent of stableAgents) {
68906
+ const existingIdx = betaAgents.findIndex((a) => a.id === sAgent.id);
68907
+ if (existingIdx >= 0) betaAgents[existingIdx] = { ...sAgent };
68908
+ else betaAgents.push({ ...sAgent });
68909
+ }
68910
+ betaSettings.agents = betaAgents;
68911
+ const betaPlugins = betaSettings.plugins || [];
68912
+ const stablePlugins = stableSettings.plugins || [];
68913
+ for (const sPlugin of stablePlugins) {
68914
+ const existingIdx = betaPlugins.findIndex((p) => p.name === sPlugin.name);
68915
+ if (existingIdx >= 0) betaPlugins[existingIdx] = { ...sPlugin };
68916
+ else betaPlugins.push({ ...sPlugin });
68917
+ }
68918
+ betaSettings.plugins = betaPlugins;
68919
+ await fs$1.mkdir(dirname(targetSettingsFile), { recursive: true });
68920
+ await fs$1.writeFile(targetSettingsFile, JSON.stringify(betaSettings, null, 2));
68921
+ logger().info("[Migration] Settings merged successfully");
68922
+ }
68923
+ }
68924
+ if (migrateConnections) {
68925
+ const sourceConnectionsFile = sourceContext.getConnectionsPath();
68926
+ const targetConnectionsFile = context.getConnectionsPath();
68927
+ const sourceMeta = await getFileMetadata(sourceConnectionsFile);
68928
+ const targetMeta = await getFileMetadata(targetConnectionsFile);
68929
+ if (!isVersionImportable(sourceMeta.version, targetMeta.version)) throw new Error("Cannot migrate connections: Source version is newer than current version.");
68930
+ if (existsSync(sourceConnectionsFile)) {
68931
+ let stableConnections = {
68932
+ version: "1.0.0",
68933
+ connections: []
68934
+ };
68935
+ try {
68936
+ const stableContent = await fs$1.readFile(sourceConnectionsFile, "utf8");
68937
+ stableConnections = JSON.parse(stableContent);
68938
+ } catch (e) {
68939
+ logger().error("[Migration] Failed to read source connections.json:", e);
68940
+ }
68941
+ let betaConnections = {
68942
+ version: "1.0.0",
68943
+ connections: []
68944
+ };
68945
+ if (existsSync(targetConnectionsFile)) try {
68946
+ const betaContent = await fs$1.readFile(targetConnectionsFile, "utf8");
68947
+ betaConnections = JSON.parse(betaContent);
68948
+ } catch (e) {}
68949
+ betaConnections.connections = betaConnections.connections || [];
68950
+ stableConnections.connections = stableConnections.connections || [];
68951
+ for (const sConn of stableConnections.connections) {
68952
+ const existingIdx = betaConnections.connections.findIndex((c) => c.id === sConn.id);
68953
+ if (existingIdx >= 0) betaConnections.connections[existingIdx] = { ...sConn };
68954
+ else betaConnections.connections.push({ ...sConn });
68955
+ }
68956
+ await fs$1.mkdir(dirname(targetConnectionsFile), { recursive: true });
68957
+ await fs$1.writeFile(targetConnectionsFile, JSON.stringify(betaConnections, null, 2));
68958
+ logger().info("[Migration] Connections merged successfully");
68959
+ }
68960
+ }
68961
+ if (selectedPipelines.length > 0 || selectedProjects.length > 0) {
68962
+ const sourceProjectsFile = sourceContext.getProjectsPath();
68963
+ const targetProjectsFile = context.getProjectsPath();
68964
+ const sourceMeta = await getFileMetadata(sourceProjectsFile);
68965
+ const targetMeta = await getFileMetadata(targetProjectsFile);
68966
+ if (!isVersionImportable(sourceMeta.version, targetMeta.version)) throw new Error("Cannot migrate projects: Source version is newer than current version.");
68967
+ let stableFileRepo = {
68968
+ version: "3.0.0",
68969
+ projects: [],
68970
+ pipelines: []
68971
+ };
68972
+ if (existsSync(sourceProjectsFile)) {
68973
+ const stableContent = await fs$1.readFile(sourceProjectsFile, "utf8");
68974
+ stableFileRepo = JSON.parse(stableContent);
68975
+ }
68976
+ let betaFileRepo = {
68977
+ version: "3.0.0",
68978
+ projects: [],
68979
+ pipelines: []
68980
+ };
68981
+ if (existsSync(targetProjectsFile)) try {
68982
+ const betaContent = await fs$1.readFile(targetProjectsFile, "utf8");
68983
+ betaFileRepo = JSON.parse(betaContent);
68984
+ } catch (readErr) {
68985
+ logger().warn("[Migration] Failed to parse existing target projects.json, starting fresh:", readErr);
68986
+ }
68987
+ betaFileRepo.projects = betaFileRepo.projects || [];
68988
+ betaFileRepo.pipelines = betaFileRepo.pipelines || [];
68989
+ for (const projId of selectedProjects) {
68990
+ const stableProj = stableFileRepo.projects.find((p) => p.id === projId);
68991
+ if (stableProj) {
68992
+ const existingProjIdx = betaFileRepo.projects.findIndex((p) => p.id === projId);
68993
+ if (existingProjIdx >= 0) betaFileRepo.projects[existingProjIdx] = { ...stableProj };
68994
+ else betaFileRepo.projects.push({ ...stableProj });
68995
+ }
68996
+ }
68997
+ for (const pipeId of selectedPipelines) {
68998
+ const stablePipe = (stableFileRepo.pipelines || []).find((p) => p.id === pipeId);
68999
+ if (stablePipe) {
69000
+ const parentProjId = stablePipe.project;
69001
+ if (!betaFileRepo.projects.some((p) => p.id === parentProjId)) {
69002
+ const stableProj = stableFileRepo.projects.find((p) => p.id === parentProjId);
69003
+ if (stableProj) betaFileRepo.projects.push({ ...stableProj });
69004
+ }
69005
+ if (stablePipe.type === "internal") {
69006
+ const stablePipeFile = sourceContext.getConfigPath(`${stablePipe.configName}.json`);
69007
+ const betaPipeFile = context.getConfigPath(`${stablePipe.configName}.json`);
69008
+ if (existsSync(stablePipeFile)) {
69009
+ await fs$1.mkdir(dirname(betaPipeFile), { recursive: true });
69010
+ await fs$1.copyFile(stablePipeFile, betaPipeFile);
69011
+ logger().info(`[Migration] Copied pipeline file: ${stablePipe.configName}`);
69012
+ }
69013
+ }
69014
+ const updatedPipe = { ...stablePipe };
69015
+ if (updatedPipe.type !== "pipelab-cloud") updatedPipe.lastModified = (/* @__PURE__ */ new Date()).toISOString();
69016
+ const existingPipeIdx = betaFileRepo.pipelines.findIndex((p) => p.id === pipeId);
69017
+ if (existingPipeIdx >= 0) betaFileRepo.pipelines[existingPipeIdx] = updatedPipe;
69018
+ else betaFileRepo.pipelines.push(updatedPipe);
69019
+ }
69020
+ }
69021
+ await fs$1.mkdir(dirname(targetProjectsFile), { recursive: true });
69022
+ await fs$1.writeFile(targetProjectsFile, JSON.stringify(betaFileRepo, null, 2));
69023
+ logger().info("[Migration] Merged and saved projects.json successfully");
69024
+ }
69025
+ send({
69026
+ type: "end",
69027
+ data: {
69028
+ type: "success",
69029
+ result: { result: "ok" }
69030
+ }
69031
+ });
69032
+ } catch (e) {
69033
+ logger().error("[Migration] Error performing migration:", e);
69034
+ send({
69035
+ type: "end",
69036
+ data: {
69037
+ type: "error",
69038
+ ipcError: e instanceof Error ? e.message : "Failed to migrate selected data"
69039
+ }
69040
+ });
69041
+ }
69042
+ });
69043
+ };
69044
+ //#endregion
68334
69045
  //#region ../../packages/core-node/src/handlers/index.ts
68335
69046
  const registerAllHandlers = async (options) => {
68336
69047
  const context = options.context;
@@ -68343,6 +69054,7 @@ const registerAllHandlers = async (options) => {
68343
69054
  registerAuthHandlers(context);
68344
69055
  registerSystemHandlers(options);
68345
69056
  registerPluginsHandlers(context);
69057
+ registerMigrationHandlers(context);
68346
69058
  const { registerPlugins } = usePlugins();
68347
69059
  builtInPlugins({ context });
68348
69060
  };
@@ -68374,7 +69086,6 @@ async function runPipelineCommand(file, options, version) {
68374
69086
  version,
68375
69087
  context
68376
69088
  });
68377
- registerMigrationHandlers(context);
68378
69089
  const cachePath = context.getCachePath(CacheFolder.Pipelines, effectivePipelineId);
68379
69090
  await mkdir(cachePath, { recursive: true });
68380
69091
  const abortController = new AbortController();
@@ -68442,7 +69153,7 @@ async function runPipelineCommand(file, options, version) {
68442
69153
  }
68443
69154
  //#endregion
68444
69155
  //#region package.json
68445
- var version$2 = "2.0.0-beta.18";
69156
+ var version$2 = "2.0.0-beta.19";
68446
69157
  //#endregion
68447
69158
  //#region src/paths.ts
68448
69159
  const getDefaultUserDataPath = () => {
@@ -68525,7 +69236,7 @@ async function purgeCommand(pipelineId, options) {
68525
69236
  async function listPipelinesCommand(options) {
68526
69237
  const context = new PipelabContext({ userDataPath: options.userData || getDefaultUserDataPath() });
68527
69238
  try {
68528
- const repo = await (await setupConfigFile("projects", { context })).getConfig();
69239
+ const repo = await (await setupProjectsConfigFile(context)).getConfig();
68529
69240
  if (!repo.pipelines || repo.pipelines.length === 0) {
68530
69241
  console.log("No pipelines found.");
68531
69242
  return;
@@ -68562,7 +69273,7 @@ async function listPipelinesCommand(options) {
68562
69273
  async function showPipelineCommand(idOrName, options) {
68563
69274
  const context = new PipelabContext({ userDataPath: options.userData || getDefaultUserDataPath() });
68564
69275
  try {
68565
- const pipeline = (await (await setupConfigFile("projects", { context })).getConfig()).pipelines?.find((p) => p.id === idOrName || p.type === "internal" && p.configName === idOrName || p.type === "external" && p.path.includes(idOrName));
69276
+ const pipeline = (await (await setupProjectsConfigFile(context)).getConfig()).pipelines?.find((p) => p.id === idOrName || p.type === "internal" && p.configName === idOrName || p.type === "external" && p.path.includes(idOrName));
68566
69277
  if (!pipeline) {
68567
69278
  console.error(`Pipeline "${idOrName}" not found.`);
68568
69279
  process.exit(1);
@@ -68644,7 +69355,7 @@ async function deletePipelineCommand(id, options) {
68644
69355
  }
68645
69356
  const context = new PipelabContext({ userDataPath: options.userData || getDefaultUserDataPath() });
68646
69357
  try {
68647
- const projectsConfig = await setupConfigFile("projects", { context });
69358
+ const projectsConfig = await setupProjectsConfigFile(context);
68648
69359
  const repo = await projectsConfig.getConfig();
68649
69360
  if (!repo.pipelines) {
68650
69361
  console.error(`Pipeline "${id}" not found.`);
@@ -68657,10 +69368,10 @@ async function deletePipelineCommand(id, options) {
68657
69368
  }
68658
69369
  const pipeline = repo.pipelines[index];
68659
69370
  if (pipeline.type === "internal") try {
68660
- await deleteConfigFile(pipeline.configName, context);
69371
+ await deletePipelineConfigFileByName(pipeline.configName, context);
68661
69372
  console.log(`Deleted pipeline file: ${pipeline.configName}.json`);
68662
69373
  } catch (e) {
68663
- if (e.code !== "ENOENT") console.warn(`Warning: Could not delete pipeline file: ${e.message}`);
69374
+ console.warn(`Warning: Could not delete pipeline file: ${e.message}`);
68664
69375
  }
68665
69376
  repo.pipelines.splice(index, 1);
68666
69377
  await projectsConfig.setConfig(repo);
@@ -69863,7 +70574,7 @@ async function setupCommand(options) {
69863
70574
  await setTimeout$1(1500);
69864
70575
  s.stop("Authenticated successfully!");
69865
70576
  }
69866
- const settings = await setupConfigFile("settings", { context });
70577
+ const settings = await setupSettingsConfigFile(context);
69867
70578
  const config = await settings.getConfig();
69868
70579
  const configChanges = await dt({
69869
70580
  theme: () => _t({
@@ -76507,4 +77218,4 @@ program.hook("postAction", (thisCommand) => {
76507
77218
  program.parse(process.argv);
76508
77219
  if (!process.argv.slice(2).length) program.outputHelp();
76509
77220
  //#endregion
76510
- export { useAPI as A, registerHistoryHandlers as C, registerShellHandlers as D, registerFsHandlers as E, PipelabContext as M, getDefaultUserDataPath$1 as N, WebSocketServer as O, projectRoot as P, registerMigrationHandlers as S, registerConfigHandlers as T, isOnline as _, executeGraphWithHistory as a, sendStartupReady as b, findInstalledPlugins as c, handleActionExecute as d, ensureNodeJS as f, fetchPipelabPlugin as g, fetchPipelabAsset as h, registerEngineHandlers as i, CacheFolder as j, webSocketServer as k, loadCustomPlugin as l, fetchPackage as m, registerAllHandlers as n, getFinalPlugins as o, ensurePNPM as p, registerAgentsHandlers as r, builtInPlugins as s, runPipelineCommand as t, loadPipelabPlugin as u, runPnpm as v, BuildHistoryStorage as w, serveCommand as x, sendStartupProgress as y };
77221
+ export { CacheFolder as A, BuildHistoryStorage as C, WebSocketServer as D, registerShellHandlers as E, getDefaultUserDataPath$1 as M, projectRoot as N, webSocketServer as O, registerHistoryHandlers as S, registerFsHandlers as T, isOnline as _, executeGraphWithHistory as a, sendStartupReady as b, findInstalledPlugins as c, handleActionExecute as d, ensureNodeJS as f, fetchPipelabPlugin as g, fetchPipelabAsset as h, registerEngineHandlers as i, PipelabContext as j, useAPI as k, loadCustomPlugin as l, fetchPackage as m, registerAllHandlers as n, getFinalPlugins as o, ensurePNPM as p, registerAgentsHandlers as r, builtInPlugins as s, runPipelineCommand as t, loadPipelabPlugin as u, runPnpm as v, registerConfigHandlers as w, serveCommand as x, sendStartupProgress as y };