@iola_adm/iola-cli 0.1.86 → 0.1.87

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "description": "CLI и AI-агент городского округа Йошкар-Ола.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/adm-iola/iola-cli#readme",
package/src/cli.js CHANGED
@@ -298,6 +298,7 @@ const SLASH_COMMANDS = [
298
298
  { command: "/quality", description: "качество данных" },
299
299
  { command: "/views", description: "saved views" },
300
300
  { command: "/config get", description: "конфигурация" },
301
+ { command: "/uninstall --yes", description: "удалить локальные данные iola-cli" },
301
302
  { command: "/layers", description: "слои данных" },
302
303
  { command: "/data schools --limit 10", description: "данные слоя" },
303
304
  { command: "/schools --limit 10", description: "школы" },
@@ -389,6 +390,8 @@ const COMMANDS = new Map([
389
390
  ["alias", handleAlias],
390
391
  ["run", runNaturalLanguage],
391
392
  ["config", handleConfig],
393
+ ["uninstall", handleUninstall],
394
+ ["purge", handleUninstall],
392
395
  ["banner", showBanner],
393
396
  ["agent", startAgent],
394
397
  ["chat", startAgent],
@@ -576,6 +579,7 @@ Usage:
576
579
  iola config set api.baseUrl URL
577
580
  iola config set api.mcpBaseUrl URL
578
581
  iola config reset
582
+ iola uninstall --yes
579
583
  iola update
580
584
  iola ask TEXT [--profile NAME] [--model MODEL] [--tools] [--files] [--plan] [--trace] [--reasoning fast|verify|vote] [--output FILE] [--schema json|table] [--events] [--no-history] [--bare] [--quiet] [--no-color] [--fail-on-empty]
581
585
  iola data LAYER [--limit 10] [--search TEXT] [--where FIELD=VALUE] [--columns a,b,c] [--format table|json|csv]
@@ -2116,6 +2120,79 @@ async function handleConfig(args) {
2116
2120
  throw new Error("Команды config: get, set, validate, schema, reset.");
2117
2121
  }
2118
2122
 
2123
+ async function handleUninstall(args = []) {
2124
+ const options = parseOptions(args);
2125
+ const targets = [
2126
+ {
2127
+ label: "user data",
2128
+ path: CONFIG_DIR,
2129
+ description: "config, secrets, SQLite-БД, модель IOLA, Python/browser runtime, cache, history",
2130
+ },
2131
+ ];
2132
+
2133
+ if (options.project) {
2134
+ targets.push({
2135
+ label: "project data",
2136
+ path: PROJECT_IOLA_DIR,
2137
+ description: "локальная папка .iola текущего проекта",
2138
+ });
2139
+ }
2140
+
2141
+ const safeTargets = targets.map((target) => ({
2142
+ ...target,
2143
+ path: path.resolve(target.path),
2144
+ }));
2145
+ const home = path.resolve(os.homedir());
2146
+ for (const target of safeTargets) {
2147
+ const isUserConfig = target.path === path.resolve(CONFIG_DIR) && target.path.startsWith(home);
2148
+ const isProjectConfig = target.path === path.resolve(PROJECT_IOLA_DIR) && target.path.startsWith(path.resolve(process.cwd()));
2149
+ if (!isUserConfig && !isProjectConfig) {
2150
+ throw new Error(`Небезопасный путь удаления: ${target.path}`);
2151
+ }
2152
+ }
2153
+
2154
+ if (options["dry-run"] || options.json) {
2155
+ const payload = {
2156
+ willDelete: safeTargets.map((target) => ({
2157
+ label: target.label,
2158
+ path: target.path,
2159
+ exists: existsSync(target.path),
2160
+ description: target.description,
2161
+ })),
2162
+ willKeep: ["Codex CLI", "Codex auth/config", "npm package files"],
2163
+ reinstall: "npm install -g @iola_adm/iola-cli@latest",
2164
+ };
2165
+ if (options.json) printJson(payload);
2166
+ else printKeyValue(Object.fromEntries(payload.willDelete.map((item) => [item.label, `${item.path} (${item.exists ? "exists" : "missing"})`])));
2167
+ return;
2168
+ }
2169
+
2170
+ if (!options.yes) {
2171
+ console.log("Будет удалено:");
2172
+ for (const target of safeTargets) {
2173
+ console.log(`- ${target.path}`);
2174
+ console.log(` ${target.description}`);
2175
+ }
2176
+ console.log("");
2177
+ console.log("Codex CLI и его настройки не удаляются.");
2178
+ const confirmed = await confirm("Удалить локальные данные iola-cli? [y/N] ");
2179
+ if (!confirmed) {
2180
+ console.log("Удаление отменено.");
2181
+ return;
2182
+ }
2183
+ }
2184
+
2185
+ for (const target of safeTargets) {
2186
+ await rm(target.path, { recursive: true, force: true });
2187
+ }
2188
+
2189
+ console.log("Локальные данные iola-cli удалены.");
2190
+ console.log("Codex CLI не тронут.");
2191
+ console.log("Для полной переустановки npm-пакета:");
2192
+ console.log(" npm uninstall -g @iola_adm/iola-cli");
2193
+ console.log(" npm install -g @iola_adm/iola-cli@latest");
2194
+ }
2195
+
2119
2196
  async function handleDb(args) {
2120
2197
  const [action = "status"] = args;
2121
2198
  const options = parseOptions(args);
@@ -7764,7 +7841,7 @@ function parseOptions(args) {
7764
7841
 
7765
7842
  for (let index = 0; index < args.length; index += 1) {
7766
7843
  const arg = args[index];
7767
- if (arg === "--json" || arg === "--yes" || arg === "--silent" || arg === "--events" || arg === "--stream-json" || arg === "--stdio" || arg === "--system" || arg === "--headed" || arg === "--headless" || arg === "--no-history" || arg === "--summary" || arg === "--all" || arg === "--full" || arg === "--unread" || arg === "--once" || arg === "--local" || arg === "--cache" || arg === "--tools" || arg === "--files" || arg === "--plan" || arg === "--trace" || arg === "--diff" || arg === "--stage" || arg === "--fts" || arg === "--bare" || arg === "--quiet" || arg === "--optional" || arg === "--no-color" || arg === "--fail-on-empty" || arg === "--debug" || arg === "--fix" || arg === "--append") {
7844
+ if (arg === "--json" || arg === "--yes" || arg === "--silent" || arg === "--events" || arg === "--stream-json" || arg === "--stdio" || arg === "--system" || arg === "--headed" || arg === "--headless" || arg === "--no-history" || arg === "--summary" || arg === "--all" || arg === "--full" || arg === "--unread" || arg === "--once" || arg === "--local" || arg === "--cache" || arg === "--tools" || arg === "--files" || arg === "--plan" || arg === "--trace" || arg === "--diff" || arg === "--stage" || arg === "--fts" || arg === "--bare" || arg === "--quiet" || arg === "--optional" || arg === "--project" || arg === "--dry-run" || arg === "--no-color" || arg === "--fail-on-empty" || arg === "--debug" || arg === "--fix" || arg === "--append") {
7768
7845
  result[arg.slice(2)] = true;
7769
7846
  } else if (arg === "--check" || arg === "--upgrade-node") {
7770
7847
  result.check = true;
@@ -48,6 +48,7 @@ assertIncludes(help, "iola ask", "help");
48
48
  const commands = await runCli(["commands"]);
49
49
  assertIncludes(commands, "iola browser status|install|open|text|html|screenshot|pdf|click|type|eval", "commands");
50
50
  assertIncludes(commands, "iola mcp list|status|install|remove|serve [--stdio]", "commands");
51
+ assertIncludes(commands, "iola uninstall --yes", "commands");
51
52
  assertNotIncludes(commands, "Госуслуг", "commands");
52
53
  assertNotIncludes(commands, "gosuslugi", "commands");
53
54
 
@@ -61,4 +62,9 @@ assertIncludes(skills, "open-data", "skills list");
61
62
  assertIncludes(skills, "reports", "skills list");
62
63
  assertNotIncludes(skills, "gosuslugi", "skills list");
63
64
 
65
+ const uninstallPlan = JSON.parse(await runCli(["uninstall", "--dry-run", "--json"]));
66
+ if (!Array.isArray(uninstallPlan.willDelete) || !uninstallPlan.willKeep.includes("Codex CLI")) {
67
+ throw new Error("uninstall dry-run should list delete targets and keep Codex CLI");
68
+ }
69
+
64
70
  console.log("smoke tests passed");