paratix 0.12.6 → 0.12.8
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-CWGQ2MYN.js → chunk-M3ZQJNKM.js} +4 -2
- package/dist/chunk-M3ZQJNKM.js.map +1 -0
- package/dist/cli.js +58 -25
- package/dist/cli.js.map +1 -1
- package/dist/index.js +50 -22
- package/dist/index.js.map +1 -1
- package/dist/modules/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-CWGQ2MYN.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1108,6 +1108,9 @@ var MODULE_NAME_WIDTH = 56;
|
|
|
1108
1108
|
var MIN_MODULE_NAME_WIDTH = 12;
|
|
1109
1109
|
var OUTPUT_INDENT_UNIT = " ";
|
|
1110
1110
|
var SPINNER_FRAME_INTERVAL_MS = 80;
|
|
1111
|
+
var ASCII_ESC = 27;
|
|
1112
|
+
var ANSI_HIDE_CURSOR = `${String.fromCharCode(ASCII_ESC)}[?25l`;
|
|
1113
|
+
var ANSI_SHOW_CURSOR = `${String.fromCharCode(ASCII_ESC)}[?25h`;
|
|
1111
1114
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
1112
1115
|
var STATUS_ICONS = {
|
|
1113
1116
|
changed: pc.yellow("\u21BA"),
|
|
@@ -1126,10 +1129,22 @@ var CLI_HEADER_LINES = [
|
|
|
1126
1129
|
" | | ",
|
|
1127
1130
|
" |_| "
|
|
1128
1131
|
];
|
|
1129
|
-
var
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1132
|
+
var LIVE_OUTPUT_STATE_KEY = /* @__PURE__ */ Symbol.for("paratix.output.liveState");
|
|
1133
|
+
function getSharedLiveOutputState() {
|
|
1134
|
+
const registry = globalThis;
|
|
1135
|
+
const existing = registry[LIVE_OUTPUT_STATE_KEY];
|
|
1136
|
+
if (existing != null) return existing;
|
|
1137
|
+
const created = {
|
|
1138
|
+
activeRecipeGuideDepths: [],
|
|
1139
|
+
activeSpinner: null,
|
|
1140
|
+
cursorHidden: false,
|
|
1141
|
+
pendingRecipeClosureGuideDepths: [],
|
|
1142
|
+
recipeOutputDepth: -1
|
|
1143
|
+
};
|
|
1144
|
+
registry[LIVE_OUTPUT_STATE_KEY] = created;
|
|
1145
|
+
return created;
|
|
1146
|
+
}
|
|
1147
|
+
var liveOutputState = getSharedLiveOutputState();
|
|
1133
1148
|
function renderCliHeader(version) {
|
|
1134
1149
|
const versionText = pc.dim(`v${version}`);
|
|
1135
1150
|
return `${pc.cyan(CLI_HEADER_LINES.join("\n"))}${versionText}
|
|
@@ -1164,7 +1179,7 @@ function getModuleStatusText(status) {
|
|
|
1164
1179
|
}
|
|
1165
1180
|
}
|
|
1166
1181
|
function getCurrentOutputDepth() {
|
|
1167
|
-
return Math.max(recipeOutputDepth, 0);
|
|
1182
|
+
return Math.max(liveOutputState.recipeOutputDepth, 0);
|
|
1168
1183
|
}
|
|
1169
1184
|
function getGuideDot(depth) {
|
|
1170
1185
|
return depth % 2 === 0 ? pc.gray("\xB7") : pc.cyan("\xB7");
|
|
@@ -1172,7 +1187,7 @@ function getGuideDot(depth) {
|
|
|
1172
1187
|
function buildGuideIndent(baseIndent, options) {
|
|
1173
1188
|
const indentCharacters = Array.from(baseIndent);
|
|
1174
1189
|
const guideDepths = [
|
|
1175
|
-
...options?.activeGuideDepths ?? activeRecipeGuideDepths,
|
|
1190
|
+
...options?.activeGuideDepths ?? liveOutputState.activeRecipeGuideDepths,
|
|
1176
1191
|
...options?.extraGuideDepths ?? []
|
|
1177
1192
|
];
|
|
1178
1193
|
for (const guideDepth of guideDepths) {
|
|
@@ -1183,16 +1198,16 @@ function buildGuideIndent(baseIndent, options) {
|
|
|
1183
1198
|
return indentCharacters.join("");
|
|
1184
1199
|
}
|
|
1185
1200
|
function clearPendingRecipeClosureGuides() {
|
|
1186
|
-
pendingRecipeClosureGuideDepths = [];
|
|
1201
|
+
liveOutputState.pendingRecipeClosureGuideDepths = [];
|
|
1187
1202
|
}
|
|
1188
1203
|
function getModuleIndent() {
|
|
1189
|
-
if (recipeOutputDepth < 0) {
|
|
1204
|
+
if (liveOutputState.recipeOutputDepth < 0) {
|
|
1190
1205
|
return OUTPUT_INDENT_UNIT;
|
|
1191
1206
|
}
|
|
1192
1207
|
return OUTPUT_INDENT_UNIT.repeat(getCurrentOutputDepth() + 2);
|
|
1193
1208
|
}
|
|
1194
1209
|
function getRecipeHeaderIndent() {
|
|
1195
|
-
if (recipeOutputDepth < 0) return "";
|
|
1210
|
+
if (liveOutputState.recipeOutputDepth < 0) return "";
|
|
1196
1211
|
return OUTPUT_INDENT_UNIT.repeat(getCurrentOutputDepth() + 1);
|
|
1197
1212
|
}
|
|
1198
1213
|
function getErrorIndent() {
|
|
@@ -1202,13 +1217,13 @@ function getContinuationIndent() {
|
|
|
1202
1217
|
return `${getModuleIndent()} `;
|
|
1203
1218
|
}
|
|
1204
1219
|
async function withRecipeOutputScope(scopedOperation) {
|
|
1205
|
-
recipeOutputDepth += 1;
|
|
1220
|
+
liveOutputState.recipeOutputDepth += 1;
|
|
1206
1221
|
try {
|
|
1207
1222
|
return await scopedOperation();
|
|
1208
1223
|
} finally {
|
|
1209
|
-
activeRecipeGuideDepths = activeRecipeGuideDepths.filter((depth) => depth !== recipeOutputDepth);
|
|
1210
|
-
pendingRecipeClosureGuideDepths = [recipeOutputDepth];
|
|
1211
|
-
recipeOutputDepth -= 1;
|
|
1224
|
+
liveOutputState.activeRecipeGuideDepths = liveOutputState.activeRecipeGuideDepths.filter((depth) => depth !== liveOutputState.recipeOutputDepth);
|
|
1225
|
+
liveOutputState.pendingRecipeClosureGuideDepths = [liveOutputState.recipeOutputDepth];
|
|
1226
|
+
liveOutputState.recipeOutputDepth -= 1;
|
|
1212
1227
|
}
|
|
1213
1228
|
}
|
|
1214
1229
|
function renderModuleLine(parameters) {
|
|
@@ -1221,15 +1236,28 @@ function renderModuleLine(parameters) {
|
|
|
1221
1236
|
const alignedNameWidth = Math.max(MODULE_NAME_WIDTH - baseIndent.length, MIN_MODULE_NAME_WIDTH);
|
|
1222
1237
|
return `${indent}${icon} ${name.padEnd(alignedNameWidth)} ${statusText}${detailSuffix}`;
|
|
1223
1238
|
}
|
|
1239
|
+
function hideCursor() {
|
|
1240
|
+
if (liveOutputState.cursorHidden) return;
|
|
1241
|
+
if (!supportsAnimatedModuleOutput()) return;
|
|
1242
|
+
process.stdout.write(ANSI_HIDE_CURSOR);
|
|
1243
|
+
liveOutputState.cursorHidden = true;
|
|
1244
|
+
}
|
|
1245
|
+
function showCursor() {
|
|
1246
|
+
if (!liveOutputState.cursorHidden) return;
|
|
1247
|
+
process.stdout.write(ANSI_SHOW_CURSOR);
|
|
1248
|
+
liveOutputState.cursorHidden = false;
|
|
1249
|
+
}
|
|
1224
1250
|
function writeAnimatedModuleLine(line) {
|
|
1251
|
+
hideCursor();
|
|
1225
1252
|
process.stdout.clearLine(0);
|
|
1226
1253
|
process.stdout.cursorTo(0);
|
|
1227
1254
|
process.stdout.write(fitAnimatedModuleLine(line, process.stdout.columns));
|
|
1228
1255
|
}
|
|
1229
1256
|
function stopAnimatedModuleLine(clearCurrentLine = false) {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
activeSpinner
|
|
1257
|
+
showCursor();
|
|
1258
|
+
if (liveOutputState.activeSpinner == null) return;
|
|
1259
|
+
clearInterval(liveOutputState.activeSpinner.interval);
|
|
1260
|
+
liveOutputState.activeSpinner = null;
|
|
1233
1261
|
if (clearCurrentLine && supportsAnimatedModuleOutput()) {
|
|
1234
1262
|
process.stdout.clearLine(0);
|
|
1235
1263
|
process.stdout.cursorTo(0);
|
|
@@ -1267,7 +1295,7 @@ function startModuleSpinner(name, detail) {
|
|
|
1267
1295
|
}, SPINNER_FRAME_INTERVAL_MS)
|
|
1268
1296
|
};
|
|
1269
1297
|
if (typeof spinner.interval.unref === "function") spinner.interval.unref();
|
|
1270
|
-
activeSpinner = spinner;
|
|
1298
|
+
liveOutputState.activeSpinner = spinner;
|
|
1271
1299
|
writeAnimatedModuleLine(
|
|
1272
1300
|
renderModuleLine({
|
|
1273
1301
|
detail: displayModule.detail,
|
|
@@ -1282,8 +1310,8 @@ function printRecipeHeader(name) {
|
|
|
1282
1310
|
clearPendingRecipeClosureGuides();
|
|
1283
1311
|
const header = pc.bold(pc.blue(`[${name}]`));
|
|
1284
1312
|
console.log(`${buildGuideIndent(getRecipeHeaderIndent())}${header}`);
|
|
1285
|
-
if (recipeOutputDepth >= 0) {
|
|
1286
|
-
activeRecipeGuideDepths = [...activeRecipeGuideDepths, recipeOutputDepth];
|
|
1313
|
+
if (liveOutputState.recipeOutputDepth >= 0) {
|
|
1314
|
+
liveOutputState.activeRecipeGuideDepths = [...liveOutputState.activeRecipeGuideDepths, liveOutputState.recipeOutputDepth];
|
|
1287
1315
|
}
|
|
1288
1316
|
}
|
|
1289
1317
|
function printRunContext(parameters) {
|
|
@@ -1344,7 +1372,7 @@ function printRenderedModuleResult(parameters) {
|
|
|
1344
1372
|
status: parameters.status
|
|
1345
1373
|
});
|
|
1346
1374
|
const diffLines = parameters.diff == null ? [] : renderDiffLines(parameters.diff);
|
|
1347
|
-
const usesSpinner = supportsAnimatedModuleOutput() && activeSpinner != null;
|
|
1375
|
+
const usesSpinner = supportsAnimatedModuleOutput() && liveOutputState.activeSpinner != null;
|
|
1348
1376
|
if (usesSpinner) {
|
|
1349
1377
|
stopAnimatedModuleLine();
|
|
1350
1378
|
writeAnimatedModuleLine(line);
|
|
@@ -2878,6 +2906,8 @@ async function sftpUploadContent(client, content, remotePath, timeout = SFTP_TIM
|
|
|
2878
2906
|
// src/terminal.ts
|
|
2879
2907
|
import { createInterface } from "readline";
|
|
2880
2908
|
import { Writable } from "stream";
|
|
2909
|
+
var ASCII_ESC2 = 27;
|
|
2910
|
+
var ANSI_SHOW_CURSOR2 = `${String.fromCharCode(ASCII_ESC2)}[?25h`;
|
|
2881
2911
|
function normalizePromptAbortReason(reason) {
|
|
2882
2912
|
return reason instanceof Error ? reason : new Error(String(reason));
|
|
2883
2913
|
}
|
|
@@ -2934,6 +2964,9 @@ async function promptTerminal(question, hidden = false, options) {
|
|
|
2934
2964
|
const output = hidden ? createHiddenPromptOutput(process.stderr) : process.stderr;
|
|
2935
2965
|
const rl = createInterface({ input: process.stdin, output });
|
|
2936
2966
|
const abortSignal = options?.abortSignal;
|
|
2967
|
+
if (process.stderr.isTTY) {
|
|
2968
|
+
process.stderr.write(ANSI_SHOW_CURSOR2);
|
|
2969
|
+
}
|
|
2937
2970
|
if (hidden) {
|
|
2938
2971
|
process.stderr.write(question);
|
|
2939
2972
|
}
|
|
@@ -4551,8 +4584,8 @@ trap - EXIT
|
|
|
4551
4584
|
};
|
|
4552
4585
|
|
|
4553
4586
|
// src/runner.ts
|
|
4554
|
-
var
|
|
4555
|
-
var
|
|
4587
|
+
var ASCII_ESC3 = 27;
|
|
4588
|
+
var ANSI_SHOW_CURSOR3 = `${String.fromCharCode(ASCII_ESC3)}[?25h`;
|
|
4556
4589
|
function performShutdownBestEffortCleanup() {
|
|
4557
4590
|
try {
|
|
4558
4591
|
stopLiveModuleOutput(true);
|
|
@@ -4565,7 +4598,7 @@ function performShutdownBestEffortCleanup() {
|
|
|
4565
4598
|
} catch {
|
|
4566
4599
|
}
|
|
4567
4600
|
try {
|
|
4568
|
-
process.stdout.write(
|
|
4601
|
+
process.stdout.write(ANSI_SHOW_CURSOR3);
|
|
4569
4602
|
} catch {
|
|
4570
4603
|
}
|
|
4571
4604
|
try {
|
|
@@ -5521,7 +5554,7 @@ async function runApplyCommand(file, options, run = runPlaybook) {
|
|
|
5521
5554
|
if (options.diff && !options.dryRun) {
|
|
5522
5555
|
throw new CliUsageError("--diff requires --dry-run");
|
|
5523
5556
|
}
|
|
5524
|
-
printCliHeader("0.12.
|
|
5557
|
+
printCliHeader("0.12.8-a236f80");
|
|
5525
5558
|
const environmentOverrides = applyCliEnvironmentOverrides(options.env, {
|
|
5526
5559
|
firstRun: options.firstRun
|
|
5527
5560
|
});
|
|
@@ -5550,7 +5583,7 @@ function exitAfterApplyError(error, verbose) {
|
|
|
5550
5583
|
process.exit(exitCode);
|
|
5551
5584
|
}
|
|
5552
5585
|
var program = new Command();
|
|
5553
|
-
program.name("paratix").description("Idempotent VPS setup tool in TypeScript").version("0.12.
|
|
5586
|
+
program.name("paratix").description("Idempotent VPS setup tool in TypeScript").version("0.12.8-a236f80");
|
|
5554
5587
|
program.command("apply <file>").description("Apply a server definition").option(
|
|
5555
5588
|
"--diff",
|
|
5556
5589
|
"When combined with --dry-run, show a unified diff per module that would change.",
|