nolo-cli 0.5.2 → 0.7.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/index.js +85 -20
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -108103,24 +108103,79 @@ function renderStatusLine(state4) {
|
|
|
108103
108103
|
if (!surface) return body;
|
|
108104
108104
|
return `${surface} ${body} \x1B[49m`;
|
|
108105
108105
|
}
|
|
108106
|
-
function
|
|
108106
|
+
function buildPlainScene(isDark, frame = 0, maxFrames = 0) {
|
|
108107
|
+
let skyLine = ` ${isDark ? "\u{1F319}" : "\u2600"}`;
|
|
108108
|
+
if (isDark) {
|
|
108109
|
+
const star1 = frame % 6 < 3 ? "\u2726" : "\u22C6";
|
|
108110
|
+
const star2 = frame % 4 < 2 ? "\u22C6" : "\xB7";
|
|
108111
|
+
const star3 = frame % 5 < 2 ? "\xB7" : "\u2726";
|
|
108112
|
+
skyLine = ` ${star1} \u{1F319} ${star2} ${star3}`;
|
|
108113
|
+
}
|
|
108114
|
+
const wavePattern = "_.~^~.";
|
|
108115
|
+
const longWave = wavePattern.repeat(10);
|
|
108116
|
+
const offset = frame % wavePattern.length;
|
|
108117
|
+
const wave2 = longWave.slice(offset, offset + 25);
|
|
108118
|
+
return [
|
|
108119
|
+
skyLine,
|
|
108120
|
+
" \u2571\u2572 \u2588\u2584 \u2588 \u2584\u2580\u2580\u2584 \u2588 \u2584\u2580\u2580\u2584",
|
|
108121
|
+
" \u2571 \u2572 \u2571\u2572 \u2588 \u2580\u2588 \u2588 \u2588 \u2588 \u2588 \u2588",
|
|
108122
|
+
" \u2571 \u2572\u2571 \u2572 \u2580 \u2580 \u2580\u2580 \u2580\u2580\u2580\u2580 \u2580\u2580",
|
|
108123
|
+
` \u2571 \u2660 \u2572 ${wave2}`,
|
|
108124
|
+
" \u2581\u2581\u2581\u2581\u2581\u2581\u2571 \u2660 \u2660 \u2572\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"
|
|
108125
|
+
].join("\n");
|
|
108126
|
+
}
|
|
108127
|
+
function buildColoredScene(isDark, frame = 0, maxFrames = 0) {
|
|
108128
|
+
const pk = themeColorSequence("chrome");
|
|
108129
|
+
const sk = themeColorSequence("warning");
|
|
108130
|
+
const tr = themeColorSequence("success");
|
|
108131
|
+
const wv = themeColorSequence("info");
|
|
108132
|
+
const ac = themeColorSequence("accent");
|
|
108133
|
+
const mu = themeColorSequence("muted");
|
|
108134
|
+
const r = "\x1B[39m";
|
|
108135
|
+
const b = "\x1B[1m";
|
|
108136
|
+
const rs = "\x1B[0m";
|
|
108137
|
+
let skyLine = ` ${sk}${isDark ? "\u{1F319}" : "\u2600"}${r}`;
|
|
108138
|
+
if (isDark) {
|
|
108139
|
+
const star1 = frame % 6 < 3 ? "\u2726" : "\u22C6";
|
|
108140
|
+
const star2 = frame % 4 < 2 ? "\u22C6" : "\xB7";
|
|
108141
|
+
const star3 = frame % 5 < 2 ? "\xB7" : "\u2726";
|
|
108142
|
+
skyLine = ` ${mu}${star1}${r} ${sk}\u{1F319}${r} ${mu}${star2}${r} ${mu}${star3}${r}`;
|
|
108143
|
+
}
|
|
108144
|
+
const wavePattern = "_.~^~.";
|
|
108145
|
+
const longWave = wavePattern.repeat(10);
|
|
108146
|
+
const offset = frame % wavePattern.length;
|
|
108147
|
+
const wave2 = longWave.slice(offset, offset + 25);
|
|
108148
|
+
const waveStr = `${wv}${wave2.slice(0, 20)}${r}${mu}${wave2.slice(20, 25)}${r}`;
|
|
108149
|
+
const line1 = "\u2588\u2584 \u2588 \u2584\u2580\u2580\u2584 \u2588 \u2584\u2580\u2580\u2584";
|
|
108150
|
+
const line2 = "\u2588 \u2580\u2588 \u2588 \u2588 \u2588 \u2588 \u2588";
|
|
108151
|
+
const line3 = "\u2580 \u2580 \u2580\u2580 \u2580\u2580\u2580\u2580 \u2580\u2580";
|
|
108152
|
+
const sweepEndFrame = maxFrames > 3 ? maxFrames - 3 : maxFrames;
|
|
108153
|
+
const sweepLen = maxFrames === 0 ? 21 : Math.min(21, Math.floor(frame / sweepEndFrame * 21));
|
|
108154
|
+
const colorLine = (str, bold) => {
|
|
108155
|
+
const active = str.slice(0, sweepLen);
|
|
108156
|
+
const dimmed = str.slice(sweepLen);
|
|
108157
|
+
return `${bold ? b : ""}${ac}${active}${r}${mu}${dimmed}${r}${bold ? rs : ""}`;
|
|
108158
|
+
};
|
|
108159
|
+
const nolo1 = colorLine(line1, true);
|
|
108160
|
+
const nolo2 = colorLine(line2, false);
|
|
108161
|
+
const nolo3 = colorLine(line3, false);
|
|
108162
|
+
return [
|
|
108163
|
+
skyLine,
|
|
108164
|
+
` ${pk}\u2571\u2572${r} ${nolo1}`,
|
|
108165
|
+
` ${pk}\u2571 \u2572 \u2571\u2572${r} ${nolo2}`,
|
|
108166
|
+
` ${pk}\u2571 \u2572\u2571 \u2572${r} ${nolo3}`,
|
|
108167
|
+
` ${pk}\u2571${r} ${tr}\u2660${r} ${pk}\u2572${r} ${waveStr}`,
|
|
108168
|
+
` ${pk}\u2581\u2581\u2581\u2581\u2581\u2581\u2571${r} ${tr}\u2660${r} ${tr}\u2660${r} ${pk}\u2572\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581${r}`
|
|
108169
|
+
].join("\n");
|
|
108170
|
+
}
|
|
108171
|
+
function renderWelcome(state4, frame = 0, maxFrames = 0) {
|
|
108107
108172
|
const colorEnabled = resolveCliColorEnabled();
|
|
108108
|
-
const
|
|
108109
|
-
|
|
108110
|
-
|
|
108111
|
-
{ mark: "\u2580 \u2580 \u2580\u2580 \u2580\u2580\u2580\u2580 \u2580\u2580", ridge: "\u2571 \u2572\u2582\u2581\u2581\u2660 \u2570\u256E~", token: "chrome", bold: false }
|
|
108112
|
-
];
|
|
108113
|
-
const MARK_WIDTH = 19;
|
|
108114
|
-
const GUTTER = " ";
|
|
108115
|
-
const logoArt = logoRows.map(({ mark, ridge, token, bold }) => {
|
|
108116
|
-
const padded = mark.padEnd(MARK_WIDTH);
|
|
108117
|
-
if (!colorEnabled) return `${padded}${GUTTER}${ridge}`;
|
|
108118
|
-
const markText = bold ? `\x1B[1m${themeColorSequence(token)}${padded}\x1B[0m` : themeText(padded, token, colorEnabled);
|
|
108119
|
-
return `${markText}${GUTTER}${themeText(ridge, "chrome", colorEnabled)}`;
|
|
108120
|
-
}).join("\n");
|
|
108173
|
+
const brightness = resolveTuiBrightness();
|
|
108174
|
+
const isDark = brightness === "dark";
|
|
108175
|
+
const sceneArt = colorEnabled ? buildColoredScene(isDark, frame, maxFrames) : buildPlainScene(isDark, frame, maxFrames);
|
|
108121
108176
|
const versionLine = colorEnabled ? `\x1B[1m${themeColorSequence("accent")}nolo\x1B[0m ${state4.cliVersion ?? ""} | server ${state4.serverUrl}`.replace(" |", " |") : `nolo ${state4.cliVersion ?? ""} | server ${state4.serverUrl}`.replace(" |", " |");
|
|
108122
108177
|
return [
|
|
108123
|
-
|
|
108178
|
+
sceneArt,
|
|
108124
108179
|
versionLine,
|
|
108125
108180
|
t("welcomeHint"),
|
|
108126
108181
|
""
|
|
@@ -109950,8 +110005,9 @@ function createFixedInput(output2, config) {
|
|
|
109950
110005
|
for (const line of queueLines) {
|
|
109951
110006
|
sections.push(fitAnsiLine(line.replace(/\r?\n/g, " "), cols));
|
|
109952
110007
|
}
|
|
109953
|
-
const
|
|
109954
|
-
const promptWidth = displayWidth2(
|
|
110008
|
+
const promptRaw = t("promptLabel");
|
|
110009
|
+
const promptWidth = displayWidth2(promptRaw);
|
|
110010
|
+
const prompt = colorEnabled ? `${themeColorSequence("accent")}${promptRaw}\x1B[39m` : promptRaw;
|
|
109955
110011
|
const contentWidth = Math.max(1, cols - promptWidth);
|
|
109956
110012
|
const logicalLines = buffer.length === 0 ? [""] : buffer.split("\n");
|
|
109957
110013
|
const targetPos = Math.max(0, Math.min(buffer.length, cursorPos ?? buffer.length));
|
|
@@ -109965,7 +110021,7 @@ function createFixedInput(output2, config) {
|
|
|
109965
110021
|
const isFirst = i === 0;
|
|
109966
110022
|
const prefix = isFirst ? prompt : " ".repeat(promptWidth);
|
|
109967
110023
|
if (buffer.length === 0) {
|
|
109968
|
-
const placeholder =
|
|
110024
|
+
const placeholder = themeText(t("placeholder"), "chrome", colorEnabled);
|
|
109969
110025
|
sections.push(fitAnsiLine(`${prefix}${placeholder}`, cols));
|
|
109970
110026
|
cursorCol = promptWidth;
|
|
109971
110027
|
cursorRow = 0;
|
|
@@ -109984,7 +110040,7 @@ function createFixedInput(output2, config) {
|
|
|
109984
110040
|
if (targetPos <= charOffset + rowLen || j === rows.length - 1 && i === logicalLines.length - 1) {
|
|
109985
110041
|
const subOffset = Math.max(0, Math.min(rowLen, targetPos - charOffset));
|
|
109986
110042
|
const subStr = rowText.slice(0, subOffset);
|
|
109987
|
-
cursorCol =
|
|
110043
|
+
cursorCol = promptWidth + displayWidth2(subStr);
|
|
109988
110044
|
cursorRow = inputRows;
|
|
109989
110045
|
cursorFound = true;
|
|
109990
110046
|
}
|
|
@@ -110608,7 +110664,16 @@ async function startTuiWorkspace(options) {
|
|
|
110608
110664
|
stdout: output2
|
|
110609
110665
|
});
|
|
110610
110666
|
if (detected) setActiveBrightness(detected);
|
|
110611
|
-
|
|
110667
|
+
const frames = 15;
|
|
110668
|
+
output2.write("\x1B[?25l");
|
|
110669
|
+
for (let i = 0; i < frames; i++) {
|
|
110670
|
+
output2.write(renderWelcome(state4, i, frames));
|
|
110671
|
+
if (i < frames - 1) {
|
|
110672
|
+
await new Promise((resolve9) => setTimeout(resolve9, 100));
|
|
110673
|
+
output2.write("\r\x1B[8A\x1B[0J");
|
|
110674
|
+
}
|
|
110675
|
+
}
|
|
110676
|
+
output2.write("\x1B[?25h");
|
|
110612
110677
|
let fixedInput = createNoopFixedInput();
|
|
110613
110678
|
let buffer = "";
|
|
110614
110679
|
let cursorPos = 0;
|