@robota-sdk/agent-cli 3.0.0-beta.7 → 3.0.0-beta.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/node/bin.cjs CHANGED
@@ -119,6 +119,7 @@ function createBuiltinCommands() {
119
119
  { name: "cost", description: "Show session info", source: "builtin" },
120
120
  { name: "context", description: "Context window info", source: "builtin" },
121
121
  { name: "permissions", description: "Permission rules", source: "builtin" },
122
+ { name: "reset", description: "Delete settings and exit", source: "builtin" },
122
123
  { name: "exit", description: "Exit CLI", source: "builtin" }
123
124
  ];
124
125
  }
@@ -774,6 +775,7 @@ var HELP_TEXT = [
774
775
  " /compact [instr] \u2014 Compact context (optional focus instructions)",
775
776
  " /mode [m] \u2014 Show/change permission mode",
776
777
  " /cost \u2014 Show session info",
778
+ " /reset \u2014 Delete settings and exit",
777
779
  " /exit \u2014 Exit CLI"
778
780
  ].join("\n");
779
781
  function handleModeCommand(arg, session, addMessage) {
@@ -839,6 +841,19 @@ Messages: ${session.getMessageCount()}`
839
841
  });
840
842
  return true;
841
843
  }
844
+ case "reset": {
845
+ const { existsSync: exists, unlinkSync: unlink } = await import("fs");
846
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
847
+ const settingsPath = `${home}/.robota/settings.json`;
848
+ if (exists(settingsPath)) {
849
+ unlink(settingsPath);
850
+ addMessage({ role: "system", content: `Deleted ${settingsPath}. Exiting...` });
851
+ } else {
852
+ addMessage({ role: "system", content: "No user settings found." });
853
+ }
854
+ setTimeout(() => exit(), 500);
855
+ return true;
856
+ }
842
857
  case "exit":
843
858
  exit();
844
859
  return true;
@@ -1121,7 +1136,8 @@ function parseCliArgs() {
1121
1136
  model: { type: "string" },
1122
1137
  "permission-mode": { type: "string" },
1123
1138
  "max-turns": { type: "string" },
1124
- version: { type: "boolean", default: false }
1139
+ version: { type: "boolean", default: false },
1140
+ reset: { type: "boolean", default: false }
1125
1141
  }
1126
1142
  });
1127
1143
  return {
@@ -1132,7 +1148,8 @@ function parseCliArgs() {
1132
1148
  model: values["model"],
1133
1149
  permissionMode: parsePermissionMode(values["permission-mode"]),
1134
1150
  maxTurns: parseMaxTurns(values["max-turns"]),
1135
- version: values["version"] ?? false
1151
+ version: values["version"] ?? false,
1152
+ reset: values["reset"] ?? false
1136
1153
  };
1137
1154
  }
1138
1155
  var PrintTerminal = class {
@@ -1183,6 +1200,83 @@ var PrintTerminal = class {
1183
1200
  } };
1184
1201
  }
1185
1202
  };
1203
+ function getUserSettingsPath() {
1204
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
1205
+ return (0, import_node_path2.join)(home, ".robota", "settings.json");
1206
+ }
1207
+ async function ensureConfig(cwd) {
1208
+ const userPath = getUserSettingsPath();
1209
+ const projectPath = (0, import_node_path2.join)(cwd, ".robota", "settings.json");
1210
+ const localPath = (0, import_node_path2.join)(cwd, ".robota", "settings.local.json");
1211
+ if ((0, import_node_fs2.existsSync)(userPath) || (0, import_node_fs2.existsSync)(projectPath) || (0, import_node_fs2.existsSync)(localPath)) {
1212
+ return;
1213
+ }
1214
+ process.stdout.write("\n");
1215
+ process.stdout.write(" Welcome to Robota CLI!\n");
1216
+ process.stdout.write(" No configuration found. Let's set up your API key.\n");
1217
+ process.stdout.write("\n");
1218
+ const apiKey = await new Promise((resolve) => {
1219
+ process.stdout.write(" Anthropic API key: ");
1220
+ let input = "";
1221
+ const stdin = process.stdin;
1222
+ const wasRaw = stdin.isRaw;
1223
+ stdin.setRawMode(true);
1224
+ stdin.resume();
1225
+ stdin.setEncoding("utf8");
1226
+ const onData = (data) => {
1227
+ for (const ch of data) {
1228
+ if (ch === "\r" || ch === "\n") {
1229
+ stdin.removeListener("data", onData);
1230
+ stdin.setRawMode(wasRaw ?? false);
1231
+ stdin.pause();
1232
+ process.stdout.write("\n");
1233
+ resolve(input.trim());
1234
+ return;
1235
+ } else if (ch === "\x7F" || ch === "\b") {
1236
+ if (input.length > 0) {
1237
+ input = input.slice(0, -1);
1238
+ process.stdout.write("\b \b");
1239
+ }
1240
+ } else if (ch === "") {
1241
+ process.stdout.write("\n");
1242
+ process.exit(0);
1243
+ } else if (ch.charCodeAt(0) >= 32) {
1244
+ input += ch;
1245
+ process.stdout.write("*");
1246
+ }
1247
+ }
1248
+ };
1249
+ stdin.on("data", onData);
1250
+ });
1251
+ if (!apiKey) {
1252
+ process.stderr.write("\n No API key provided. Exiting.\n");
1253
+ process.exit(1);
1254
+ }
1255
+ const settingsDir = (0, import_node_path2.dirname)(userPath);
1256
+ (0, import_node_fs2.mkdirSync)(settingsDir, { recursive: true });
1257
+ const settings = {
1258
+ provider: {
1259
+ name: "anthropic",
1260
+ model: "claude-sonnet-4-6",
1261
+ apiKey
1262
+ }
1263
+ };
1264
+ (0, import_node_fs2.writeFileSync)(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
1265
+ process.stdout.write(`
1266
+ Config saved to ${userPath}
1267
+
1268
+ `);
1269
+ }
1270
+ function resetConfig() {
1271
+ const userPath = getUserSettingsPath();
1272
+ if ((0, import_node_fs2.existsSync)(userPath)) {
1273
+ (0, import_node_fs2.unlinkSync)(userPath);
1274
+ process.stdout.write(`Deleted ${userPath}
1275
+ `);
1276
+ } else {
1277
+ process.stdout.write("No user settings found.\n");
1278
+ }
1279
+ }
1186
1280
  async function startCli() {
1187
1281
  const args = parseCliArgs();
1188
1282
  if (args.version) {
@@ -1190,7 +1284,12 @@ async function startCli() {
1190
1284
  `);
1191
1285
  return;
1192
1286
  }
1287
+ if (args.reset) {
1288
+ resetConfig();
1289
+ return;
1290
+ }
1193
1291
  const cwd = process.cwd();
1292
+ await ensureConfig(cwd);
1194
1293
  const [config, context, projectInfo] = await Promise.all([
1195
1294
  (0, import_agent_sdk2.loadConfig)(cwd),
1196
1295
  (0, import_agent_sdk2.loadContext)(cwd),
package/dist/node/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startCli
4
- } from "./chunk-A2A66S6Q.js";
4
+ } from "./chunk-ICKV3U6G.js";
5
5
 
6
6
  // src/bin.ts
7
7
  startCli().catch((err) => {
@@ -1,6 +1,6 @@
1
1
  // src/cli.ts
2
2
  import { parseArgs } from "util";
3
- import { readFileSync as readFileSync2 } from "fs";
3
+ import { readFileSync as readFileSync2, existsSync as existsSync2, mkdirSync, writeFileSync, unlinkSync } from "fs";
4
4
  import { join as join2, dirname } from "path";
5
5
  import { fileURLToPath } from "url";
6
6
  import * as readline from "readline";
@@ -102,6 +102,7 @@ function createBuiltinCommands() {
102
102
  { name: "cost", description: "Show session info", source: "builtin" },
103
103
  { name: "context", description: "Context window info", source: "builtin" },
104
104
  { name: "permissions", description: "Permission rules", source: "builtin" },
105
+ { name: "reset", description: "Delete settings and exit", source: "builtin" },
105
106
  { name: "exit", description: "Exit CLI", source: "builtin" }
106
107
  ];
107
108
  }
@@ -757,6 +758,7 @@ var HELP_TEXT = [
757
758
  " /compact [instr] \u2014 Compact context (optional focus instructions)",
758
759
  " /mode [m] \u2014 Show/change permission mode",
759
760
  " /cost \u2014 Show session info",
761
+ " /reset \u2014 Delete settings and exit",
760
762
  " /exit \u2014 Exit CLI"
761
763
  ].join("\n");
762
764
  function handleModeCommand(arg, session, addMessage) {
@@ -822,6 +824,19 @@ Messages: ${session.getMessageCount()}`
822
824
  });
823
825
  return true;
824
826
  }
827
+ case "reset": {
828
+ const { existsSync: exists, unlinkSync: unlink } = await import("fs");
829
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
830
+ const settingsPath = `${home}/.robota/settings.json`;
831
+ if (exists(settingsPath)) {
832
+ unlink(settingsPath);
833
+ addMessage({ role: "system", content: `Deleted ${settingsPath}. Exiting...` });
834
+ } else {
835
+ addMessage({ role: "system", content: "No user settings found." });
836
+ }
837
+ setTimeout(() => exit(), 500);
838
+ return true;
839
+ }
825
840
  case "exit":
826
841
  exit();
827
842
  return true;
@@ -1103,7 +1118,8 @@ function parseCliArgs() {
1103
1118
  model: { type: "string" },
1104
1119
  "permission-mode": { type: "string" },
1105
1120
  "max-turns": { type: "string" },
1106
- version: { type: "boolean", default: false }
1121
+ version: { type: "boolean", default: false },
1122
+ reset: { type: "boolean", default: false }
1107
1123
  }
1108
1124
  });
1109
1125
  return {
@@ -1114,7 +1130,8 @@ function parseCliArgs() {
1114
1130
  model: values["model"],
1115
1131
  permissionMode: parsePermissionMode(values["permission-mode"]),
1116
1132
  maxTurns: parseMaxTurns(values["max-turns"]),
1117
- version: values["version"] ?? false
1133
+ version: values["version"] ?? false,
1134
+ reset: values["reset"] ?? false
1118
1135
  };
1119
1136
  }
1120
1137
  var PrintTerminal = class {
@@ -1165,6 +1182,83 @@ var PrintTerminal = class {
1165
1182
  } };
1166
1183
  }
1167
1184
  };
1185
+ function getUserSettingsPath() {
1186
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
1187
+ return join2(home, ".robota", "settings.json");
1188
+ }
1189
+ async function ensureConfig(cwd) {
1190
+ const userPath = getUserSettingsPath();
1191
+ const projectPath = join2(cwd, ".robota", "settings.json");
1192
+ const localPath = join2(cwd, ".robota", "settings.local.json");
1193
+ if (existsSync2(userPath) || existsSync2(projectPath) || existsSync2(localPath)) {
1194
+ return;
1195
+ }
1196
+ process.stdout.write("\n");
1197
+ process.stdout.write(" Welcome to Robota CLI!\n");
1198
+ process.stdout.write(" No configuration found. Let's set up your API key.\n");
1199
+ process.stdout.write("\n");
1200
+ const apiKey = await new Promise((resolve) => {
1201
+ process.stdout.write(" Anthropic API key: ");
1202
+ let input = "";
1203
+ const stdin = process.stdin;
1204
+ const wasRaw = stdin.isRaw;
1205
+ stdin.setRawMode(true);
1206
+ stdin.resume();
1207
+ stdin.setEncoding("utf8");
1208
+ const onData = (data) => {
1209
+ for (const ch of data) {
1210
+ if (ch === "\r" || ch === "\n") {
1211
+ stdin.removeListener("data", onData);
1212
+ stdin.setRawMode(wasRaw ?? false);
1213
+ stdin.pause();
1214
+ process.stdout.write("\n");
1215
+ resolve(input.trim());
1216
+ return;
1217
+ } else if (ch === "\x7F" || ch === "\b") {
1218
+ if (input.length > 0) {
1219
+ input = input.slice(0, -1);
1220
+ process.stdout.write("\b \b");
1221
+ }
1222
+ } else if (ch === "") {
1223
+ process.stdout.write("\n");
1224
+ process.exit(0);
1225
+ } else if (ch.charCodeAt(0) >= 32) {
1226
+ input += ch;
1227
+ process.stdout.write("*");
1228
+ }
1229
+ }
1230
+ };
1231
+ stdin.on("data", onData);
1232
+ });
1233
+ if (!apiKey) {
1234
+ process.stderr.write("\n No API key provided. Exiting.\n");
1235
+ process.exit(1);
1236
+ }
1237
+ const settingsDir = dirname(userPath);
1238
+ mkdirSync(settingsDir, { recursive: true });
1239
+ const settings = {
1240
+ provider: {
1241
+ name: "anthropic",
1242
+ model: "claude-sonnet-4-6",
1243
+ apiKey
1244
+ }
1245
+ };
1246
+ writeFileSync(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
1247
+ process.stdout.write(`
1248
+ Config saved to ${userPath}
1249
+
1250
+ `);
1251
+ }
1252
+ function resetConfig() {
1253
+ const userPath = getUserSettingsPath();
1254
+ if (existsSync2(userPath)) {
1255
+ unlinkSync(userPath);
1256
+ process.stdout.write(`Deleted ${userPath}
1257
+ `);
1258
+ } else {
1259
+ process.stdout.write("No user settings found.\n");
1260
+ }
1261
+ }
1168
1262
  async function startCli() {
1169
1263
  const args = parseCliArgs();
1170
1264
  if (args.version) {
@@ -1172,7 +1266,12 @@ async function startCli() {
1172
1266
  `);
1173
1267
  return;
1174
1268
  }
1269
+ if (args.reset) {
1270
+ resetConfig();
1271
+ return;
1272
+ }
1175
1273
  const cwd = process.cwd();
1274
+ await ensureConfig(cwd);
1176
1275
  const [config, context, projectInfo] = await Promise.all([
1177
1276
  loadConfig(cwd),
1178
1277
  loadContext(cwd),
@@ -135,6 +135,7 @@ function createBuiltinCommands() {
135
135
  { name: "cost", description: "Show session info", source: "builtin" },
136
136
  { name: "context", description: "Context window info", source: "builtin" },
137
137
  { name: "permissions", description: "Permission rules", source: "builtin" },
138
+ { name: "reset", description: "Delete settings and exit", source: "builtin" },
138
139
  { name: "exit", description: "Exit CLI", source: "builtin" }
139
140
  ];
140
141
  }
@@ -790,6 +791,7 @@ var HELP_TEXT = [
790
791
  " /compact [instr] \u2014 Compact context (optional focus instructions)",
791
792
  " /mode [m] \u2014 Show/change permission mode",
792
793
  " /cost \u2014 Show session info",
794
+ " /reset \u2014 Delete settings and exit",
793
795
  " /exit \u2014 Exit CLI"
794
796
  ].join("\n");
795
797
  function handleModeCommand(arg, session, addMessage) {
@@ -855,6 +857,19 @@ Messages: ${session.getMessageCount()}`
855
857
  });
856
858
  return true;
857
859
  }
860
+ case "reset": {
861
+ const { existsSync: exists, unlinkSync: unlink } = await import("fs");
862
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
863
+ const settingsPath = `${home}/.robota/settings.json`;
864
+ if (exists(settingsPath)) {
865
+ unlink(settingsPath);
866
+ addMessage({ role: "system", content: `Deleted ${settingsPath}. Exiting...` });
867
+ } else {
868
+ addMessage({ role: "system", content: "No user settings found." });
869
+ }
870
+ setTimeout(() => exit(), 500);
871
+ return true;
872
+ }
858
873
  case "exit":
859
874
  exit();
860
875
  return true;
@@ -1137,7 +1152,8 @@ function parseCliArgs() {
1137
1152
  model: { type: "string" },
1138
1153
  "permission-mode": { type: "string" },
1139
1154
  "max-turns": { type: "string" },
1140
- version: { type: "boolean", default: false }
1155
+ version: { type: "boolean", default: false },
1156
+ reset: { type: "boolean", default: false }
1141
1157
  }
1142
1158
  });
1143
1159
  return {
@@ -1148,7 +1164,8 @@ function parseCliArgs() {
1148
1164
  model: values["model"],
1149
1165
  permissionMode: parsePermissionMode(values["permission-mode"]),
1150
1166
  maxTurns: parseMaxTurns(values["max-turns"]),
1151
- version: values["version"] ?? false
1167
+ version: values["version"] ?? false,
1168
+ reset: values["reset"] ?? false
1152
1169
  };
1153
1170
  }
1154
1171
  var PrintTerminal = class {
@@ -1199,6 +1216,83 @@ var PrintTerminal = class {
1199
1216
  } };
1200
1217
  }
1201
1218
  };
1219
+ function getUserSettingsPath() {
1220
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
1221
+ return (0, import_node_path2.join)(home, ".robota", "settings.json");
1222
+ }
1223
+ async function ensureConfig(cwd) {
1224
+ const userPath = getUserSettingsPath();
1225
+ const projectPath = (0, import_node_path2.join)(cwd, ".robota", "settings.json");
1226
+ const localPath = (0, import_node_path2.join)(cwd, ".robota", "settings.local.json");
1227
+ if ((0, import_node_fs2.existsSync)(userPath) || (0, import_node_fs2.existsSync)(projectPath) || (0, import_node_fs2.existsSync)(localPath)) {
1228
+ return;
1229
+ }
1230
+ process.stdout.write("\n");
1231
+ process.stdout.write(" Welcome to Robota CLI!\n");
1232
+ process.stdout.write(" No configuration found. Let's set up your API key.\n");
1233
+ process.stdout.write("\n");
1234
+ const apiKey = await new Promise((resolve) => {
1235
+ process.stdout.write(" Anthropic API key: ");
1236
+ let input = "";
1237
+ const stdin = process.stdin;
1238
+ const wasRaw = stdin.isRaw;
1239
+ stdin.setRawMode(true);
1240
+ stdin.resume();
1241
+ stdin.setEncoding("utf8");
1242
+ const onData = (data) => {
1243
+ for (const ch of data) {
1244
+ if (ch === "\r" || ch === "\n") {
1245
+ stdin.removeListener("data", onData);
1246
+ stdin.setRawMode(wasRaw ?? false);
1247
+ stdin.pause();
1248
+ process.stdout.write("\n");
1249
+ resolve(input.trim());
1250
+ return;
1251
+ } else if (ch === "\x7F" || ch === "\b") {
1252
+ if (input.length > 0) {
1253
+ input = input.slice(0, -1);
1254
+ process.stdout.write("\b \b");
1255
+ }
1256
+ } else if (ch === "") {
1257
+ process.stdout.write("\n");
1258
+ process.exit(0);
1259
+ } else if (ch.charCodeAt(0) >= 32) {
1260
+ input += ch;
1261
+ process.stdout.write("*");
1262
+ }
1263
+ }
1264
+ };
1265
+ stdin.on("data", onData);
1266
+ });
1267
+ if (!apiKey) {
1268
+ process.stderr.write("\n No API key provided. Exiting.\n");
1269
+ process.exit(1);
1270
+ }
1271
+ const settingsDir = (0, import_node_path2.dirname)(userPath);
1272
+ (0, import_node_fs2.mkdirSync)(settingsDir, { recursive: true });
1273
+ const settings = {
1274
+ provider: {
1275
+ name: "anthropic",
1276
+ model: "claude-sonnet-4-6",
1277
+ apiKey
1278
+ }
1279
+ };
1280
+ (0, import_node_fs2.writeFileSync)(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
1281
+ process.stdout.write(`
1282
+ Config saved to ${userPath}
1283
+
1284
+ `);
1285
+ }
1286
+ function resetConfig() {
1287
+ const userPath = getUserSettingsPath();
1288
+ if ((0, import_node_fs2.existsSync)(userPath)) {
1289
+ (0, import_node_fs2.unlinkSync)(userPath);
1290
+ process.stdout.write(`Deleted ${userPath}
1291
+ `);
1292
+ } else {
1293
+ process.stdout.write("No user settings found.\n");
1294
+ }
1295
+ }
1202
1296
  async function startCli() {
1203
1297
  const args = parseCliArgs();
1204
1298
  if (args.version) {
@@ -1206,7 +1300,12 @@ async function startCli() {
1206
1300
  `);
1207
1301
  return;
1208
1302
  }
1303
+ if (args.reset) {
1304
+ resetConfig();
1305
+ return;
1306
+ }
1209
1307
  const cwd = process.cwd();
1308
+ await ensureConfig(cwd);
1210
1309
  const [config, context, projectInfo] = await Promise.all([
1211
1310
  (0, import_agent_sdk2.loadConfig)(cwd),
1212
1311
  (0, import_agent_sdk2.loadContext)(cwd),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startCli
3
- } from "./chunk-A2A66S6Q.js";
3
+ } from "./chunk-ICKV3U6G.js";
4
4
 
5
5
  // src/index.ts
6
6
  import { Session, SessionStore, query, TRUST_TO_MODE } from "@robota-sdk/agent-sdk";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-cli",
3
- "version": "3.0.0-beta.7",
3
+ "version": "3.0.0-beta.8",
4
4
  "description": "AI coding assistant CLI built on Robota SDK",
5
5
  "type": "module",
6
6
  "bin": {
@@ -35,8 +35,8 @@
35
35
  "marked-terminal": "^7.3.0",
36
36
  "react": "19.2.4",
37
37
  "string-width": "^8.2.0",
38
- "@robota-sdk/agent-core": "3.0.0-beta.7",
39
- "@robota-sdk/agent-sdk": "3.0.0-beta.7"
38
+ "@robota-sdk/agent-core": "3.0.0-beta.8",
39
+ "@robota-sdk/agent-sdk": "3.0.0-beta.8"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/marked": "^6.0.0",