paratix 0.8.0 → 0.9.0
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/dist/{chunk-FFQ6FR4N.js → chunk-7Y2RBVG4.js} +79 -32
- package/dist/chunk-7Y2RBVG4.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/index.d.ts +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/{user-BJMqDePy.d.ts → user-B9lkXr0X.d.ts} +114 -84
- package/llm-guide.md +27 -7
- package/package.json +1 -1
- package/dist/chunk-FFQ6FR4N.js.map +0 -1
|
@@ -173,6 +173,11 @@ async function setFlag(ssh2, flagName) {
|
|
|
173
173
|
// src/modules/apt.ts
|
|
174
174
|
var NONINTERACTIVE = "DEBIAN_FRONTEND=noninteractive";
|
|
175
175
|
var APT_REPOSITORY_MODE = "0644";
|
|
176
|
+
var APT_BASE_EXEC_OPTS = { ignoreExitCode: true, silent: true };
|
|
177
|
+
function aptExecOptions(options) {
|
|
178
|
+
if (options?.timeout === void 0) return APT_BASE_EXEC_OPTS;
|
|
179
|
+
return { ...APT_BASE_EXEC_OPTS, timeout: options.timeout };
|
|
180
|
+
}
|
|
176
181
|
var PPA_PREFIX = "ppa:";
|
|
177
182
|
function parseDebconfOutput(stdout) {
|
|
178
183
|
const values = {};
|
|
@@ -292,30 +297,31 @@ var apt = {
|
|
|
292
297
|
* Run `apt-get update && apt-get dist-upgrade` once per dated flag.
|
|
293
298
|
* Performs a full distribution upgrade with dependency resolution.
|
|
294
299
|
*
|
|
300
|
+
* The pipeline is split into three separate SSH commands so that each step
|
|
301
|
+
* gets its own timeout window and produces a precise failure label.
|
|
302
|
+
*
|
|
295
303
|
* @param date - A date string used as the idempotency key (e.g. `"2024-01-15"`).
|
|
304
|
+
* @param options - Optional per-call overrides (e.g. SSH command `timeout`).
|
|
305
|
+
* The same `timeout` is applied to every step of the dist-upgrade pipeline.
|
|
296
306
|
* @returns A Module that performs the dist-upgrade.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* apt.distUpgrade("2024-01-15")
|
|
310
|
+
* apt.distUpgrade("2024-01-15", { timeout: 900_000 })
|
|
297
311
|
*/
|
|
298
|
-
distUpgrade(date) {
|
|
312
|
+
distUpgrade(date, options) {
|
|
299
313
|
const flagName = `apt-dist-upgrade-${date}`;
|
|
300
314
|
return {
|
|
301
315
|
async apply(ssh2) {
|
|
302
316
|
if (!ssh2) return failed(`[apt.distUpgrade] SSH connection is required for ${date}`);
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
silent: true
|
|
306
|
-
});
|
|
317
|
+
const pipelineOptions = aptExecOptions(options);
|
|
318
|
+
const update = await ssh2.exec(`${NONINTERACTIVE} apt-get update`, pipelineOptions);
|
|
307
319
|
if (update.code !== 0)
|
|
308
320
|
return failedCommand("[apt.distUpgrade] apt-get update failed", update);
|
|
309
|
-
const configure = await ssh2.exec(`${NONINTERACTIVE} dpkg --configure -a`,
|
|
310
|
-
ignoreExitCode: true,
|
|
311
|
-
silent: true
|
|
312
|
-
});
|
|
321
|
+
const configure = await ssh2.exec(`${NONINTERACTIVE} dpkg --configure -a`, pipelineOptions);
|
|
313
322
|
if (configure.code !== 0)
|
|
314
323
|
return failedCommand("[apt.distUpgrade] dpkg --configure -a failed", configure);
|
|
315
|
-
const upgrade = await ssh2.exec(`${NONINTERACTIVE} apt-get dist-upgrade -y`,
|
|
316
|
-
ignoreExitCode: true,
|
|
317
|
-
silent: true
|
|
318
|
-
});
|
|
324
|
+
const upgrade = await ssh2.exec(`${NONINTERACTIVE} apt-get dist-upgrade -y`, pipelineOptions);
|
|
319
325
|
if (upgrade.code !== 0)
|
|
320
326
|
return failedCommand("[apt.distUpgrade] apt-get dist-upgrade failed", upgrade);
|
|
321
327
|
await setVersionedFlag(ssh2, flagName, "apt-dist-upgrade-");
|
|
@@ -3137,6 +3143,22 @@ var op = {
|
|
|
3137
3143
|
|
|
3138
3144
|
// src/modules/package.ts
|
|
3139
3145
|
var EXEC_OPTS6 = { ignoreExitCode: true, silent: true };
|
|
3146
|
+
function execOptions(options) {
|
|
3147
|
+
if (options?.timeout === void 0) return EXEC_OPTS6;
|
|
3148
|
+
return { ...EXEC_OPTS6, timeout: options.timeout };
|
|
3149
|
+
}
|
|
3150
|
+
function splitPackagesAndOptions(values) {
|
|
3151
|
+
const packages = [];
|
|
3152
|
+
let options;
|
|
3153
|
+
for (const [index, value] of values.entries()) {
|
|
3154
|
+
if (typeof value === "string") {
|
|
3155
|
+
packages.push(value);
|
|
3156
|
+
} else if (index === values.length - 1) {
|
|
3157
|
+
options = value;
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
return { options, packages };
|
|
3161
|
+
}
|
|
3140
3162
|
var pmCache = /* @__PURE__ */ new WeakMap();
|
|
3141
3163
|
var INSTALL_COMMANDS = {
|
|
3142
3164
|
apk: (pkgs) => `apk add ${pkgs}`,
|
|
@@ -3157,10 +3179,14 @@ var UPDATE_COMMANDS = {
|
|
|
3157
3179
|
yum: "yum makecache"
|
|
3158
3180
|
};
|
|
3159
3181
|
var UPGRADE_COMMANDS = {
|
|
3160
|
-
apk: "apk update
|
|
3161
|
-
apt:
|
|
3162
|
-
|
|
3163
|
-
|
|
3182
|
+
apk: ["apk update", "apk upgrade"],
|
|
3183
|
+
apt: [
|
|
3184
|
+
"DEBIAN_FRONTEND=noninteractive dpkg --configure -a",
|
|
3185
|
+
"DEBIAN_FRONTEND=noninteractive apt-get update",
|
|
3186
|
+
"DEBIAN_FRONTEND=noninteractive apt-get upgrade -y"
|
|
3187
|
+
],
|
|
3188
|
+
dnf: ["dnf upgrade -y"],
|
|
3189
|
+
yum: ["yum update -y"]
|
|
3164
3190
|
};
|
|
3165
3191
|
function missingPackageManager(moduleName) {
|
|
3166
3192
|
return failed(`[${moduleName}] No supported package manager found (apt, dnf, yum, apk)`);
|
|
@@ -3200,13 +3226,19 @@ var pkg = {
|
|
|
3200
3226
|
* The check phase queries the package database for each package individually;
|
|
3201
3227
|
* the remove command is only executed when at least one package is present.
|
|
3202
3228
|
*
|
|
3203
|
-
*
|
|
3229
|
+
* Pass an `UpgradeOptions` object as the last argument to override the SSH
|
|
3230
|
+
* timeout for slow remove operations.
|
|
3231
|
+
*
|
|
3232
|
+
* @param packagesAndOptions - One or more package names, optionally followed
|
|
3233
|
+
* by an `UpgradeOptions` object as the last argument.
|
|
3204
3234
|
* @returns A Module that removes the packages if any are present.
|
|
3205
3235
|
*
|
|
3206
3236
|
* @example
|
|
3207
3237
|
* pkg.absent("vim", "nano")
|
|
3238
|
+
* pkg.absent("vim", "nano", { timeout: 600_000 })
|
|
3208
3239
|
*/
|
|
3209
|
-
absent(...
|
|
3240
|
+
absent(...packagesAndOptions) {
|
|
3241
|
+
const { options, packages } = splitPackagesAndOptions(packagesAndOptions);
|
|
3210
3242
|
if (packages.length === 0) {
|
|
3211
3243
|
throw new Error("package.absent: at least one package name is required");
|
|
3212
3244
|
}
|
|
@@ -3217,7 +3249,7 @@ var pkg = {
|
|
|
3217
3249
|
const pm = await detectPackageManager(ssh2);
|
|
3218
3250
|
if (!pm) return missingPackageManager(`package.absent: ${packages.join(", ")}`);
|
|
3219
3251
|
const quoted = packages.map((p) => shellQuote(p)).join(" ");
|
|
3220
|
-
const result = await ssh2.exec(REMOVE_COMMANDS[pm](quoted),
|
|
3252
|
+
const result = await ssh2.exec(REMOVE_COMMANDS[pm](quoted), execOptions(options));
|
|
3221
3253
|
if (result.code !== 0) {
|
|
3222
3254
|
return failedCommand(
|
|
3223
3255
|
`[package.absent: ${packages.join(", ")}] package removal failed`,
|
|
@@ -3244,13 +3276,19 @@ var pkg = {
|
|
|
3244
3276
|
* The check phase queries the package database for each package individually;
|
|
3245
3277
|
* the install command is only executed when at least one package is missing.
|
|
3246
3278
|
*
|
|
3247
|
-
*
|
|
3279
|
+
* Pass an `UpgradeOptions` object as the last argument to override the SSH
|
|
3280
|
+
* timeout for slow install operations.
|
|
3281
|
+
*
|
|
3282
|
+
* @param packagesAndOptions - One or more package names, optionally followed
|
|
3283
|
+
* by an `UpgradeOptions` object as the last argument.
|
|
3248
3284
|
* @returns A Module that installs missing packages.
|
|
3249
3285
|
*
|
|
3250
3286
|
* @example
|
|
3251
3287
|
* pkg.installed("git", "curl", "unzip")
|
|
3288
|
+
* pkg.installed("texlive-full", { timeout: 900_000 })
|
|
3252
3289
|
*/
|
|
3253
|
-
installed(...
|
|
3290
|
+
installed(...packagesAndOptions) {
|
|
3291
|
+
const { options, packages } = splitPackagesAndOptions(packagesAndOptions);
|
|
3254
3292
|
if (packages.length === 0) {
|
|
3255
3293
|
throw new Error("package.installed: at least one package name is required");
|
|
3256
3294
|
}
|
|
@@ -3262,7 +3300,7 @@ var pkg = {
|
|
|
3262
3300
|
const pm = await detectPackageManager(ssh2);
|
|
3263
3301
|
if (!pm) return missingPackageManager(`package.installed: ${packages.join(", ")}`);
|
|
3264
3302
|
const quoted = packages.map((p) => shellQuote(p)).join(" ");
|
|
3265
|
-
const result = await ssh2.exec(INSTALL_COMMANDS[pm](quoted),
|
|
3303
|
+
const result = await ssh2.exec(INSTALL_COMMANDS[pm](quoted), execOptions(options));
|
|
3266
3304
|
if (result.code !== 0) {
|
|
3267
3305
|
return failedCommand(
|
|
3268
3306
|
`[package.installed: ${packages.join(", ")}] package installation failed`,
|
|
@@ -3292,19 +3330,21 @@ var pkg = {
|
|
|
3292
3330
|
* value invalidates all previous flags for this operation.
|
|
3293
3331
|
*
|
|
3294
3332
|
* @param date - A date string used as the idempotency key (e.g. `"2024-01-15"`).
|
|
3333
|
+
* @param options - Optional per-call overrides (e.g. SSH command `timeout`).
|
|
3295
3334
|
* @returns A Module that refreshes package lists.
|
|
3296
3335
|
*
|
|
3297
3336
|
* @example
|
|
3298
3337
|
* pkg.update("2024-01-15")
|
|
3338
|
+
* pkg.update("2024-01-15", { timeout: 600_000 })
|
|
3299
3339
|
*/
|
|
3300
|
-
update(date) {
|
|
3340
|
+
update(date, options) {
|
|
3301
3341
|
const flagName = `package-update-${date}`;
|
|
3302
3342
|
return {
|
|
3303
3343
|
async apply(ssh2) {
|
|
3304
3344
|
if (!ssh2) return failed(`[package.update: ${date}] SSH connection is required`);
|
|
3305
3345
|
const pm = await detectPackageManager(ssh2);
|
|
3306
3346
|
if (!pm) return missingPackageManager(`package.update: ${date}`);
|
|
3307
|
-
const result = await ssh2.exec(UPDATE_COMMANDS[pm],
|
|
3347
|
+
const result = await ssh2.exec(UPDATE_COMMANDS[pm], execOptions(options));
|
|
3308
3348
|
if (result.code !== 0) {
|
|
3309
3349
|
return failedCommand(`[package.update: ${date}] package index refresh failed`, result);
|
|
3310
3350
|
}
|
|
@@ -3326,27 +3366,34 @@ var pkg = {
|
|
|
3326
3366
|
* reports `"ok"` without running the upgrade again. Changing `date` to a new
|
|
3327
3367
|
* value invalidates all previous flags for this operation.
|
|
3328
3368
|
*
|
|
3329
|
-
* On apt systems this runs `
|
|
3330
|
-
* `
|
|
3369
|
+
* On apt systems this runs `dpkg --configure -a`, `apt-get update`, and
|
|
3370
|
+
* `apt-get upgrade -y` as three separate commands (each subject to its own
|
|
3371
|
+
* SSH `timeout`). For full dependency resolution use `apt.distUpgrade`.
|
|
3331
3372
|
*
|
|
3332
3373
|
* @param date - A date string used as the idempotency key (e.g. `"2024-01-15"`).
|
|
3374
|
+
* @param options - Optional per-call overrides (e.g. SSH command `timeout`).
|
|
3375
|
+
* The same `timeout` is applied to every step of the upgrade pipeline.
|
|
3333
3376
|
* @returns A Module that upgrades all packages.
|
|
3334
3377
|
*
|
|
3335
3378
|
* @example
|
|
3336
3379
|
* pkg.upgrade("2024-01-15")
|
|
3380
|
+
* pkg.upgrade("2024-01-15", { timeout: 900_000 })
|
|
3337
3381
|
*
|
|
3338
3382
|
* @see apt.distUpgrade
|
|
3339
3383
|
*/
|
|
3340
|
-
upgrade(date) {
|
|
3384
|
+
upgrade(date, options) {
|
|
3341
3385
|
const flagName = `package-upgrade-${date}`;
|
|
3342
3386
|
return {
|
|
3343
3387
|
async apply(ssh2) {
|
|
3344
3388
|
if (!ssh2) return failed(`[package.upgrade: ${date}] SSH connection is required`);
|
|
3345
3389
|
const pm = await detectPackageManager(ssh2);
|
|
3346
3390
|
if (!pm) return missingPackageManager(`package.upgrade: ${date}`);
|
|
3347
|
-
const
|
|
3348
|
-
|
|
3349
|
-
|
|
3391
|
+
const pipelineOptions = execOptions(options);
|
|
3392
|
+
for (const command2 of UPGRADE_COMMANDS[pm]) {
|
|
3393
|
+
const result = await ssh2.exec(command2, pipelineOptions);
|
|
3394
|
+
if (result.code !== 0) {
|
|
3395
|
+
return failedCommand(`[package.upgrade: ${date}] package upgrade failed`, result);
|
|
3396
|
+
}
|
|
3350
3397
|
}
|
|
3351
3398
|
await setVersionedFlag(ssh2, flagName, "package-upgrade-");
|
|
3352
3399
|
return { status: "changed" };
|
|
@@ -5841,4 +5888,4 @@ export {
|
|
|
5841
5888
|
ufw,
|
|
5842
5889
|
user
|
|
5843
5890
|
};
|
|
5844
|
-
//# sourceMappingURL=chunk-
|
|
5891
|
+
//# sourceMappingURL=chunk-7Y2RBVG4.js.map
|