@iola_adm/iola-cli 0.1.36 → 0.1.37
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 +109 -79
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -264,6 +264,71 @@ const DATASETS = {
|
|
|
264
264
|
endpoint: "kindergartens",
|
|
265
265
|
},
|
|
266
266
|
};
|
|
267
|
+
const SLASH_COMMANDS = [
|
|
268
|
+
{ command: "/help", description: "список slash-команд" },
|
|
269
|
+
{ command: "/health", description: "проверка публичного API/MCP" },
|
|
270
|
+
{ command: "/doctor", description: "диагностика CLI" },
|
|
271
|
+
{ command: "/wizard", description: "мастер настройки" },
|
|
272
|
+
{ command: "/db status", description: "статус локальной SQLite-БД" },
|
|
273
|
+
{ command: "/sessions", description: "AI-сессии" },
|
|
274
|
+
{ command: "/resume SESSION_ID", description: "продолжить сессию" },
|
|
275
|
+
{ command: "/features list", description: "feature flags" },
|
|
276
|
+
{ command: "/gosuslugi status", description: "личное подключение Госуслуг" },
|
|
277
|
+
{ command: "/wiki", description: "ссылки на документацию" },
|
|
278
|
+
{ command: "/context list", description: "локальный контекст проекта" },
|
|
279
|
+
{ command: "/skills list", description: "skills" },
|
|
280
|
+
{ command: "/permissions", description: "разрешения" },
|
|
281
|
+
{ command: "/tools", description: "tools и toolsets" },
|
|
282
|
+
{ command: "/files status", description: "локальные файловые операции" },
|
|
283
|
+
{ command: "/archive doctor", description: "архиватор" },
|
|
284
|
+
{ command: "/changes list", description: "подготовленные изменения" },
|
|
285
|
+
{ command: "/index status", description: "индекс документов" },
|
|
286
|
+
{ command: "/reports list", description: "пакеты отчетов" },
|
|
287
|
+
{ command: "/plugins list", description: "plugins" },
|
|
288
|
+
{ command: "/workspace status", description: "workspace" },
|
|
289
|
+
{ command: "/tasks list", description: "задачи" },
|
|
290
|
+
{ command: "/artifacts list", description: "artifacts" },
|
|
291
|
+
{ command: "/trace last", description: "последние tools trace" },
|
|
292
|
+
{ command: "/policy use safe", description: "переключить policy" },
|
|
293
|
+
{ command: "/cron list", description: "cron-задачи" },
|
|
294
|
+
{ command: "/daemon status", description: "локальный daemon" },
|
|
295
|
+
{ command: "/rpc call status", description: "RPC status" },
|
|
296
|
+
{ command: "/memory show", description: "память агента" },
|
|
297
|
+
{ command: "/hooks list", description: "hooks" },
|
|
298
|
+
{ command: "/agents list", description: "agents" },
|
|
299
|
+
{ command: "/mcp status", description: "MCP" },
|
|
300
|
+
{ command: "/cache status", description: "cache" },
|
|
301
|
+
{ command: "/sync", description: "обновить локальные данные" },
|
|
302
|
+
{ command: "/diff", description: "изменения данных" },
|
|
303
|
+
{ command: "/card школа 29", description: "карточка объекта" },
|
|
304
|
+
{ command: "/quality", description: "качество данных" },
|
|
305
|
+
{ command: "/views", description: "saved views" },
|
|
306
|
+
{ command: "/config get", description: "конфигурация" },
|
|
307
|
+
{ command: "/layers", description: "слои данных" },
|
|
308
|
+
{ command: "/data schools --limit 10", description: "данные слоя" },
|
|
309
|
+
{ command: "/schools --limit 10", description: "школы" },
|
|
310
|
+
{ command: "/kindergartens --search 29", description: "детские сады" },
|
|
311
|
+
{ command: "/search лицей --limit 3", description: "поиск" },
|
|
312
|
+
{ command: "/mcp-info", description: "публичный MCP" },
|
|
313
|
+
{ command: "/profiles", description: "AI-профили" },
|
|
314
|
+
{ command: "/models openrouter --search qwen", description: "модели" },
|
|
315
|
+
{ command: "/ai doctor", description: "AI diagnostics" },
|
|
316
|
+
{ command: "/ai setup ollama", description: "настройка Ollama" },
|
|
317
|
+
{ command: "/use openai", description: "выбрать OpenAI" },
|
|
318
|
+
{ command: "/use ollama", description: "выбрать Ollama" },
|
|
319
|
+
{ command: "/key status", description: "API-ключи" },
|
|
320
|
+
{ command: "/history", description: "история текущей сессии" },
|
|
321
|
+
{ command: "/new", description: "новая agent-сессия" },
|
|
322
|
+
{ command: "/retry", description: "повторить последний вопрос" },
|
|
323
|
+
{ command: "/undo", description: "удалить последний обмен" },
|
|
324
|
+
{ command: "/compact", description: "сжать контекст" },
|
|
325
|
+
{ command: "/usage", description: "использование контекста" },
|
|
326
|
+
{ command: "/clear", description: "очистить историю agent-сессии" },
|
|
327
|
+
{ command: "/banner", description: "показать баннер" },
|
|
328
|
+
{ command: "/update", description: "проверить обновления" },
|
|
329
|
+
{ command: "/init", description: "проверить окружение" },
|
|
330
|
+
{ command: "/exit", description: "выйти" },
|
|
331
|
+
];
|
|
267
332
|
const BANNER = `\x1b[38;5;45m┌────────────────────────────────────────────────────────────────────────────┐
|
|
268
333
|
│ │
|
|
269
334
|
│\x1b[38;5;51m ____ _ ___ __ ______ ____ _ _ _ __ _ ____ \x1b[38;5;45m│
|
|
@@ -616,9 +681,19 @@ async function handleAgentLine(line, state) {
|
|
|
616
681
|
return false;
|
|
617
682
|
}
|
|
618
683
|
|
|
684
|
+
if (line === "/") {
|
|
685
|
+
printSlashMenu("");
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
|
|
619
689
|
const [command, ...args] = splitCommandLine(line.slice(1));
|
|
620
690
|
state.lastCommand = { command, args };
|
|
621
691
|
|
|
692
|
+
if (!command) {
|
|
693
|
+
printSlashMenu("");
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
|
|
622
697
|
if (command === "exit" || command === "quit") {
|
|
623
698
|
return true;
|
|
624
699
|
}
|
|
@@ -968,8 +1043,13 @@ async function handleAgentLine(line, state) {
|
|
|
968
1043
|
}[command];
|
|
969
1044
|
|
|
970
1045
|
if (!mapped) {
|
|
971
|
-
|
|
972
|
-
|
|
1046
|
+
const matches = getSlashCommandMatches(command);
|
|
1047
|
+
if (matches.length > 0) {
|
|
1048
|
+
printSlashMenu(command);
|
|
1049
|
+
} else {
|
|
1050
|
+
console.log(`Неизвестная slash-команда: /${command}`);
|
|
1051
|
+
printSlashMenu(command);
|
|
1052
|
+
}
|
|
973
1053
|
return false;
|
|
974
1054
|
}
|
|
975
1055
|
|
|
@@ -979,83 +1059,33 @@ async function handleAgentLine(line, state) {
|
|
|
979
1059
|
}
|
|
980
1060
|
|
|
981
1061
|
function printAgentHelp() {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
/daemon status
|
|
1010
|
-
/rpc call status
|
|
1011
|
-
/memory show
|
|
1012
|
-
/hooks list
|
|
1013
|
-
/agents list
|
|
1014
|
-
/mcp status
|
|
1015
|
-
/cache status
|
|
1016
|
-
/sync
|
|
1017
|
-
/diff
|
|
1018
|
-
/card школа 29
|
|
1019
|
-
/quality
|
|
1020
|
-
/views
|
|
1021
|
-
/config get
|
|
1022
|
-
/config set api.baseUrl URL
|
|
1023
|
-
/layers
|
|
1024
|
-
/data schools --limit 10
|
|
1025
|
-
/schools --limit 10
|
|
1026
|
-
/schools get --inn 1215067180
|
|
1027
|
-
/kindergartens --search 29
|
|
1028
|
-
/kindergartens get --inn 1215077421
|
|
1029
|
-
/search лицей --limit 3
|
|
1030
|
-
/mcp-info
|
|
1031
|
-
/context школа 29
|
|
1032
|
-
/profiles
|
|
1033
|
-
/profile use local
|
|
1034
|
-
/models openrouter --search qwen
|
|
1035
|
-
/ai doctor
|
|
1036
|
-
/ai setup ollama
|
|
1037
|
-
/use openai
|
|
1038
|
-
/use ollama
|
|
1039
|
-
/key status
|
|
1040
|
-
/key set openai
|
|
1041
|
-
/config
|
|
1042
|
-
/provider
|
|
1043
|
-
/model
|
|
1044
|
-
/history
|
|
1045
|
-
/history --limit 20
|
|
1046
|
-
/new
|
|
1047
|
-
/reset
|
|
1048
|
-
/retry
|
|
1049
|
-
/undo
|
|
1050
|
-
/compact
|
|
1051
|
-
/usage
|
|
1052
|
-
/clear
|
|
1053
|
-
/banner
|
|
1054
|
-
/update
|
|
1055
|
-
/init
|
|
1056
|
-
/exit
|
|
1057
|
-
|
|
1058
|
-
Обычный текст без slash-команды отправляется в настроенный AI-провайдер.`);
|
|
1062
|
+
printSlashMenu("");
|
|
1063
|
+
console.log("");
|
|
1064
|
+
console.log("Обычный текст без slash-команды отправляется в настроенный AI-провайдер.");
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
function printSlashMenu(filter = "") {
|
|
1068
|
+
const normalized = String(filter || "").replace(/^\//, "");
|
|
1069
|
+
const rows = getSlashCommandMatches(normalized)
|
|
1070
|
+
.slice(0, 30)
|
|
1071
|
+
.map((item) => ({ command: item.command, description: item.description }));
|
|
1072
|
+
if (rows.length === 0) {
|
|
1073
|
+
console.log(`Нет slash-команд по фильтру: ${filter}`);
|
|
1074
|
+
console.log("Введите / для списка команд.");
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
console.log(normalized ? `Slash-команды по фильтру "${filter}":` : "Slash-команды:");
|
|
1078
|
+
printTable(rows, [["command", "Команда"], ["description", "Описание"]]);
|
|
1079
|
+
if (SLASH_COMMANDS.length > rows.length && !normalized) {
|
|
1080
|
+
console.log(`Показано ${rows.length} из ${SLASH_COMMANDS.length}. Введите /текст для фильтра.`);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
function getSlashCommandMatches(filter = "") {
|
|
1085
|
+
const normalized = String(filter || "").replace(/^\//, "").toLocaleLowerCase("ru-RU");
|
|
1086
|
+
return SLASH_COMMANDS.filter((item) => !normalized
|
|
1087
|
+
|| item.command.toLocaleLowerCase("ru-RU").includes(normalized)
|
|
1088
|
+
|| item.description.toLocaleLowerCase("ru-RU").includes(normalized));
|
|
1059
1089
|
}
|
|
1060
1090
|
|
|
1061
1091
|
function printAgentHistory(history) {
|