@iola_adm/iola-cli 0.1.43 → 0.1.44
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/package.json +1 -1
- package/src/cli.js +19 -11
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -622,6 +622,7 @@ async function runDefaultCli() {
|
|
|
622
622
|
}
|
|
623
623
|
|
|
624
624
|
async function startAgent() {
|
|
625
|
+
setTerminalTitle(`iola - ${path.basename(process.cwd()) || process.cwd()}`);
|
|
625
626
|
await showBanner();
|
|
626
627
|
await ensureAgentAiReady();
|
|
627
628
|
console.log("Интерактивный режим. Введите /help для списка команд, /exit для выхода.");
|
|
@@ -788,13 +789,7 @@ async function startAgentRawInput() {
|
|
|
788
789
|
if (key?.name === "return" || key?.name === "enter") {
|
|
789
790
|
const matches = currentSlashMatches(state);
|
|
790
791
|
const selected = matches[state.selected];
|
|
791
|
-
|
|
792
|
-
state.buffer = selected.command;
|
|
793
|
-
state.slashOpen = false;
|
|
794
|
-
render();
|
|
795
|
-
continue;
|
|
796
|
-
}
|
|
797
|
-
const line = state.buffer.trim();
|
|
792
|
+
const line = state.slashOpen && selected ? selected.command : state.buffer.trim();
|
|
798
793
|
state.buffer = "";
|
|
799
794
|
state.slashOpen = false;
|
|
800
795
|
clearAgentInputArea(state);
|
|
@@ -820,6 +815,8 @@ async function startAgentRawInput() {
|
|
|
820
815
|
}
|
|
821
816
|
} finally {
|
|
822
817
|
if (!wasRaw) input.setRawMode(false);
|
|
818
|
+
clearAgentInputArea(state);
|
|
819
|
+
output.write("\n");
|
|
823
820
|
}
|
|
824
821
|
}
|
|
825
822
|
|
|
@@ -1253,6 +1250,7 @@ function renderAgentInput(state) {
|
|
|
1253
1250
|
const prompt = "iola> ";
|
|
1254
1251
|
const lines = state.buffer.split("\n");
|
|
1255
1252
|
const inputLines = [`${prompt}${lines[0] || ""}`, ...lines.slice(1).map((line) => ` ${line}`)];
|
|
1253
|
+
const cwdLine = colorMuted(` ${process.cwd()}`);
|
|
1256
1254
|
const menuLines = [];
|
|
1257
1255
|
if (state.slashOpen) {
|
|
1258
1256
|
const matches = currentSlashMatches(state);
|
|
@@ -1269,16 +1267,16 @@ function renderAgentInput(state) {
|
|
|
1269
1267
|
}
|
|
1270
1268
|
}
|
|
1271
1269
|
|
|
1272
|
-
const renderedLines = [...inputLines, ...menuLines];
|
|
1270
|
+
const renderedLines = [...inputLines, cwdLine, ...menuLines];
|
|
1273
1271
|
output.write(renderedLines.join("\n"));
|
|
1274
|
-
if (
|
|
1275
|
-
output.write(`\x1b[${menuLines.length}A`);
|
|
1272
|
+
if (output.isTTY) {
|
|
1273
|
+
output.write(`\x1b[${1 + menuLines.length}A`);
|
|
1276
1274
|
}
|
|
1277
1275
|
if (output.isTTY) {
|
|
1278
1276
|
const cursorColumn = visibleLength(inputLines[inputLines.length - 1]);
|
|
1279
1277
|
output.write(`\x1b[${cursorColumn + 1}G`);
|
|
1280
1278
|
}
|
|
1281
|
-
state.renderedInputLines = inputLines.length;
|
|
1279
|
+
state.renderedInputLines = inputLines.length + 1;
|
|
1282
1280
|
}
|
|
1283
1281
|
|
|
1284
1282
|
function clearAgentInputArea(state = null) {
|
|
@@ -1294,6 +1292,16 @@ function colorSlashSelection(row) {
|
|
|
1294
1292
|
return `\x1b[38;5;213m${row}\x1b[0m`;
|
|
1295
1293
|
}
|
|
1296
1294
|
|
|
1295
|
+
function colorMuted(row) {
|
|
1296
|
+
if (!output.isTTY || process.env.NO_COLOR === "1") return row;
|
|
1297
|
+
return `\x1b[38;5;245m${row}\x1b[0m`;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
function setTerminalTitle(title) {
|
|
1301
|
+
if (!output.isTTY) return;
|
|
1302
|
+
output.write(`\x1b]0;${String(title).replace(/[\x00-\x1f\x7f]/g, "")}\x07`);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1297
1305
|
function readKeypress() {
|
|
1298
1306
|
return new Promise((resolve) => {
|
|
1299
1307
|
const handler = (str, key) => {
|