@robota-sdk/agent-cli 3.0.0-beta.7 → 3.0.0-beta.9
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 +112 -4
- package/dist/node/bin.js +1 -1
- package/dist/node/{chunk-A2A66S6Q.js → chunk-CYMQY2IR.js} +113 -5
- package/dist/node/index.cjs +112 -4
- package/dist/node/index.js +1 -1
- package/package.json +3 -3
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
|
}
|
|
@@ -170,7 +171,8 @@ function scanSkillsDir(skillsDir) {
|
|
|
170
171
|
commands.push({
|
|
171
172
|
name: frontmatter?.name ?? entry.name,
|
|
172
173
|
description: frontmatter?.description ?? `Skill: ${entry.name}`,
|
|
173
|
-
source: "skill"
|
|
174
|
+
source: "skill",
|
|
175
|
+
skillContent: content
|
|
174
176
|
});
|
|
175
177
|
}
|
|
176
178
|
return commands;
|
|
@@ -774,6 +776,7 @@ var HELP_TEXT = [
|
|
|
774
776
|
" /compact [instr] \u2014 Compact context (optional focus instructions)",
|
|
775
777
|
" /mode [m] \u2014 Show/change permission mode",
|
|
776
778
|
" /cost \u2014 Show session info",
|
|
779
|
+
" /reset \u2014 Delete settings and exit",
|
|
777
780
|
" /exit \u2014 Exit CLI"
|
|
778
781
|
].join("\n");
|
|
779
782
|
function handleModeCommand(arg, session, addMessage) {
|
|
@@ -839,6 +842,19 @@ Messages: ${session.getMessageCount()}`
|
|
|
839
842
|
});
|
|
840
843
|
return true;
|
|
841
844
|
}
|
|
845
|
+
case "reset": {
|
|
846
|
+
const { existsSync: exists, unlinkSync: unlink } = await import("fs");
|
|
847
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
|
|
848
|
+
const settingsPath = `${home}/.robota/settings.json`;
|
|
849
|
+
if (exists(settingsPath)) {
|
|
850
|
+
unlink(settingsPath);
|
|
851
|
+
addMessage({ role: "system", content: `Deleted ${settingsPath}. Exiting...` });
|
|
852
|
+
} else {
|
|
853
|
+
addMessage({ role: "system", content: "No user settings found." });
|
|
854
|
+
}
|
|
855
|
+
setTimeout(() => exit(), 500);
|
|
856
|
+
return true;
|
|
857
|
+
}
|
|
842
858
|
case "exit":
|
|
843
859
|
exit();
|
|
844
860
|
return true;
|
|
@@ -925,7 +941,15 @@ function buildSkillPrompt(input, registry) {
|
|
|
925
941
|
const skillCmd = registry.getCommands().find((c) => c.name === cmd && c.source === "skill");
|
|
926
942
|
if (!skillCmd) return null;
|
|
927
943
|
const args = parts.slice(1).join(" ").trim();
|
|
928
|
-
|
|
944
|
+
const userInstruction = args || skillCmd.description;
|
|
945
|
+
if (skillCmd.skillContent) {
|
|
946
|
+
return `<skill name="${cmd}">
|
|
947
|
+
${skillCmd.skillContent}
|
|
948
|
+
</skill>
|
|
949
|
+
|
|
950
|
+
Execute the "${cmd}" skill: ${userInstruction}`;
|
|
951
|
+
}
|
|
952
|
+
return `Use the "${cmd}" skill: ${userInstruction}`;
|
|
929
953
|
}
|
|
930
954
|
function useSubmitHandler(session, addMessage, handleSlashCommand, clearStreamingText, setIsThinking, setContextPercentage, registry) {
|
|
931
955
|
return (0, import_react5.useCallback)(
|
|
@@ -1121,7 +1145,8 @@ function parseCliArgs() {
|
|
|
1121
1145
|
model: { type: "string" },
|
|
1122
1146
|
"permission-mode": { type: "string" },
|
|
1123
1147
|
"max-turns": { type: "string" },
|
|
1124
|
-
version: { type: "boolean", default: false }
|
|
1148
|
+
version: { type: "boolean", default: false },
|
|
1149
|
+
reset: { type: "boolean", default: false }
|
|
1125
1150
|
}
|
|
1126
1151
|
});
|
|
1127
1152
|
return {
|
|
@@ -1132,7 +1157,8 @@ function parseCliArgs() {
|
|
|
1132
1157
|
model: values["model"],
|
|
1133
1158
|
permissionMode: parsePermissionMode(values["permission-mode"]),
|
|
1134
1159
|
maxTurns: parseMaxTurns(values["max-turns"]),
|
|
1135
|
-
version: values["version"] ?? false
|
|
1160
|
+
version: values["version"] ?? false,
|
|
1161
|
+
reset: values["reset"] ?? false
|
|
1136
1162
|
};
|
|
1137
1163
|
}
|
|
1138
1164
|
var PrintTerminal = class {
|
|
@@ -1183,6 +1209,83 @@ var PrintTerminal = class {
|
|
|
1183
1209
|
} };
|
|
1184
1210
|
}
|
|
1185
1211
|
};
|
|
1212
|
+
function getUserSettingsPath() {
|
|
1213
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
|
|
1214
|
+
return (0, import_node_path2.join)(home, ".robota", "settings.json");
|
|
1215
|
+
}
|
|
1216
|
+
async function ensureConfig(cwd) {
|
|
1217
|
+
const userPath = getUserSettingsPath();
|
|
1218
|
+
const projectPath = (0, import_node_path2.join)(cwd, ".robota", "settings.json");
|
|
1219
|
+
const localPath = (0, import_node_path2.join)(cwd, ".robota", "settings.local.json");
|
|
1220
|
+
if ((0, import_node_fs2.existsSync)(userPath) || (0, import_node_fs2.existsSync)(projectPath) || (0, import_node_fs2.existsSync)(localPath)) {
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
process.stdout.write("\n");
|
|
1224
|
+
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1225
|
+
process.stdout.write(" No configuration found. Let's set up your API key.\n");
|
|
1226
|
+
process.stdout.write("\n");
|
|
1227
|
+
const apiKey = await new Promise((resolve) => {
|
|
1228
|
+
process.stdout.write(" Anthropic API key: ");
|
|
1229
|
+
let input = "";
|
|
1230
|
+
const stdin = process.stdin;
|
|
1231
|
+
const wasRaw = stdin.isRaw;
|
|
1232
|
+
stdin.setRawMode(true);
|
|
1233
|
+
stdin.resume();
|
|
1234
|
+
stdin.setEncoding("utf8");
|
|
1235
|
+
const onData = (data) => {
|
|
1236
|
+
for (const ch of data) {
|
|
1237
|
+
if (ch === "\r" || ch === "\n") {
|
|
1238
|
+
stdin.removeListener("data", onData);
|
|
1239
|
+
stdin.setRawMode(wasRaw ?? false);
|
|
1240
|
+
stdin.pause();
|
|
1241
|
+
process.stdout.write("\n");
|
|
1242
|
+
resolve(input.trim());
|
|
1243
|
+
return;
|
|
1244
|
+
} else if (ch === "\x7F" || ch === "\b") {
|
|
1245
|
+
if (input.length > 0) {
|
|
1246
|
+
input = input.slice(0, -1);
|
|
1247
|
+
process.stdout.write("\b \b");
|
|
1248
|
+
}
|
|
1249
|
+
} else if (ch === "") {
|
|
1250
|
+
process.stdout.write("\n");
|
|
1251
|
+
process.exit(0);
|
|
1252
|
+
} else if (ch.charCodeAt(0) >= 32) {
|
|
1253
|
+
input += ch;
|
|
1254
|
+
process.stdout.write("*");
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
stdin.on("data", onData);
|
|
1259
|
+
});
|
|
1260
|
+
if (!apiKey) {
|
|
1261
|
+
process.stderr.write("\n No API key provided. Exiting.\n");
|
|
1262
|
+
process.exit(1);
|
|
1263
|
+
}
|
|
1264
|
+
const settingsDir = (0, import_node_path2.dirname)(userPath);
|
|
1265
|
+
(0, import_node_fs2.mkdirSync)(settingsDir, { recursive: true });
|
|
1266
|
+
const settings = {
|
|
1267
|
+
provider: {
|
|
1268
|
+
name: "anthropic",
|
|
1269
|
+
model: "claude-sonnet-4-6",
|
|
1270
|
+
apiKey
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
(0, import_node_fs2.writeFileSync)(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
1274
|
+
process.stdout.write(`
|
|
1275
|
+
Config saved to ${userPath}
|
|
1276
|
+
|
|
1277
|
+
`);
|
|
1278
|
+
}
|
|
1279
|
+
function resetConfig() {
|
|
1280
|
+
const userPath = getUserSettingsPath();
|
|
1281
|
+
if ((0, import_node_fs2.existsSync)(userPath)) {
|
|
1282
|
+
(0, import_node_fs2.unlinkSync)(userPath);
|
|
1283
|
+
process.stdout.write(`Deleted ${userPath}
|
|
1284
|
+
`);
|
|
1285
|
+
} else {
|
|
1286
|
+
process.stdout.write("No user settings found.\n");
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1186
1289
|
async function startCli() {
|
|
1187
1290
|
const args = parseCliArgs();
|
|
1188
1291
|
if (args.version) {
|
|
@@ -1190,7 +1293,12 @@ async function startCli() {
|
|
|
1190
1293
|
`);
|
|
1191
1294
|
return;
|
|
1192
1295
|
}
|
|
1296
|
+
if (args.reset) {
|
|
1297
|
+
resetConfig();
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1193
1300
|
const cwd = process.cwd();
|
|
1301
|
+
await ensureConfig(cwd);
|
|
1194
1302
|
const [config, context, projectInfo] = await Promise.all([
|
|
1195
1303
|
(0, import_agent_sdk2.loadConfig)(cwd),
|
|
1196
1304
|
(0, import_agent_sdk2.loadContext)(cwd),
|
package/dist/node/bin.js
CHANGED
|
@@ -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
|
}
|
|
@@ -153,7 +154,8 @@ function scanSkillsDir(skillsDir) {
|
|
|
153
154
|
commands.push({
|
|
154
155
|
name: frontmatter?.name ?? entry.name,
|
|
155
156
|
description: frontmatter?.description ?? `Skill: ${entry.name}`,
|
|
156
|
-
source: "skill"
|
|
157
|
+
source: "skill",
|
|
158
|
+
skillContent: content
|
|
157
159
|
});
|
|
158
160
|
}
|
|
159
161
|
return commands;
|
|
@@ -757,6 +759,7 @@ var HELP_TEXT = [
|
|
|
757
759
|
" /compact [instr] \u2014 Compact context (optional focus instructions)",
|
|
758
760
|
" /mode [m] \u2014 Show/change permission mode",
|
|
759
761
|
" /cost \u2014 Show session info",
|
|
762
|
+
" /reset \u2014 Delete settings and exit",
|
|
760
763
|
" /exit \u2014 Exit CLI"
|
|
761
764
|
].join("\n");
|
|
762
765
|
function handleModeCommand(arg, session, addMessage) {
|
|
@@ -822,6 +825,19 @@ Messages: ${session.getMessageCount()}`
|
|
|
822
825
|
});
|
|
823
826
|
return true;
|
|
824
827
|
}
|
|
828
|
+
case "reset": {
|
|
829
|
+
const { existsSync: exists, unlinkSync: unlink } = await import("fs");
|
|
830
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
|
|
831
|
+
const settingsPath = `${home}/.robota/settings.json`;
|
|
832
|
+
if (exists(settingsPath)) {
|
|
833
|
+
unlink(settingsPath);
|
|
834
|
+
addMessage({ role: "system", content: `Deleted ${settingsPath}. Exiting...` });
|
|
835
|
+
} else {
|
|
836
|
+
addMessage({ role: "system", content: "No user settings found." });
|
|
837
|
+
}
|
|
838
|
+
setTimeout(() => exit(), 500);
|
|
839
|
+
return true;
|
|
840
|
+
}
|
|
825
841
|
case "exit":
|
|
826
842
|
exit();
|
|
827
843
|
return true;
|
|
@@ -908,7 +924,15 @@ function buildSkillPrompt(input, registry) {
|
|
|
908
924
|
const skillCmd = registry.getCommands().find((c) => c.name === cmd && c.source === "skill");
|
|
909
925
|
if (!skillCmd) return null;
|
|
910
926
|
const args = parts.slice(1).join(" ").trim();
|
|
911
|
-
|
|
927
|
+
const userInstruction = args || skillCmd.description;
|
|
928
|
+
if (skillCmd.skillContent) {
|
|
929
|
+
return `<skill name="${cmd}">
|
|
930
|
+
${skillCmd.skillContent}
|
|
931
|
+
</skill>
|
|
932
|
+
|
|
933
|
+
Execute the "${cmd}" skill: ${userInstruction}`;
|
|
934
|
+
}
|
|
935
|
+
return `Use the "${cmd}" skill: ${userInstruction}`;
|
|
912
936
|
}
|
|
913
937
|
function useSubmitHandler(session, addMessage, handleSlashCommand, clearStreamingText, setIsThinking, setContextPercentage, registry) {
|
|
914
938
|
return useCallback2(
|
|
@@ -1103,7 +1127,8 @@ function parseCliArgs() {
|
|
|
1103
1127
|
model: { type: "string" },
|
|
1104
1128
|
"permission-mode": { type: "string" },
|
|
1105
1129
|
"max-turns": { type: "string" },
|
|
1106
|
-
version: { type: "boolean", default: false }
|
|
1130
|
+
version: { type: "boolean", default: false },
|
|
1131
|
+
reset: { type: "boolean", default: false }
|
|
1107
1132
|
}
|
|
1108
1133
|
});
|
|
1109
1134
|
return {
|
|
@@ -1114,7 +1139,8 @@ function parseCliArgs() {
|
|
|
1114
1139
|
model: values["model"],
|
|
1115
1140
|
permissionMode: parsePermissionMode(values["permission-mode"]),
|
|
1116
1141
|
maxTurns: parseMaxTurns(values["max-turns"]),
|
|
1117
|
-
version: values["version"] ?? false
|
|
1142
|
+
version: values["version"] ?? false,
|
|
1143
|
+
reset: values["reset"] ?? false
|
|
1118
1144
|
};
|
|
1119
1145
|
}
|
|
1120
1146
|
var PrintTerminal = class {
|
|
@@ -1165,6 +1191,83 @@ var PrintTerminal = class {
|
|
|
1165
1191
|
} };
|
|
1166
1192
|
}
|
|
1167
1193
|
};
|
|
1194
|
+
function getUserSettingsPath() {
|
|
1195
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
|
|
1196
|
+
return join2(home, ".robota", "settings.json");
|
|
1197
|
+
}
|
|
1198
|
+
async function ensureConfig(cwd) {
|
|
1199
|
+
const userPath = getUserSettingsPath();
|
|
1200
|
+
const projectPath = join2(cwd, ".robota", "settings.json");
|
|
1201
|
+
const localPath = join2(cwd, ".robota", "settings.local.json");
|
|
1202
|
+
if (existsSync2(userPath) || existsSync2(projectPath) || existsSync2(localPath)) {
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
process.stdout.write("\n");
|
|
1206
|
+
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1207
|
+
process.stdout.write(" No configuration found. Let's set up your API key.\n");
|
|
1208
|
+
process.stdout.write("\n");
|
|
1209
|
+
const apiKey = await new Promise((resolve) => {
|
|
1210
|
+
process.stdout.write(" Anthropic API key: ");
|
|
1211
|
+
let input = "";
|
|
1212
|
+
const stdin = process.stdin;
|
|
1213
|
+
const wasRaw = stdin.isRaw;
|
|
1214
|
+
stdin.setRawMode(true);
|
|
1215
|
+
stdin.resume();
|
|
1216
|
+
stdin.setEncoding("utf8");
|
|
1217
|
+
const onData = (data) => {
|
|
1218
|
+
for (const ch of data) {
|
|
1219
|
+
if (ch === "\r" || ch === "\n") {
|
|
1220
|
+
stdin.removeListener("data", onData);
|
|
1221
|
+
stdin.setRawMode(wasRaw ?? false);
|
|
1222
|
+
stdin.pause();
|
|
1223
|
+
process.stdout.write("\n");
|
|
1224
|
+
resolve(input.trim());
|
|
1225
|
+
return;
|
|
1226
|
+
} else if (ch === "\x7F" || ch === "\b") {
|
|
1227
|
+
if (input.length > 0) {
|
|
1228
|
+
input = input.slice(0, -1);
|
|
1229
|
+
process.stdout.write("\b \b");
|
|
1230
|
+
}
|
|
1231
|
+
} else if (ch === "") {
|
|
1232
|
+
process.stdout.write("\n");
|
|
1233
|
+
process.exit(0);
|
|
1234
|
+
} else if (ch.charCodeAt(0) >= 32) {
|
|
1235
|
+
input += ch;
|
|
1236
|
+
process.stdout.write("*");
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
stdin.on("data", onData);
|
|
1241
|
+
});
|
|
1242
|
+
if (!apiKey) {
|
|
1243
|
+
process.stderr.write("\n No API key provided. Exiting.\n");
|
|
1244
|
+
process.exit(1);
|
|
1245
|
+
}
|
|
1246
|
+
const settingsDir = dirname(userPath);
|
|
1247
|
+
mkdirSync(settingsDir, { recursive: true });
|
|
1248
|
+
const settings = {
|
|
1249
|
+
provider: {
|
|
1250
|
+
name: "anthropic",
|
|
1251
|
+
model: "claude-sonnet-4-6",
|
|
1252
|
+
apiKey
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
writeFileSync(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
1256
|
+
process.stdout.write(`
|
|
1257
|
+
Config saved to ${userPath}
|
|
1258
|
+
|
|
1259
|
+
`);
|
|
1260
|
+
}
|
|
1261
|
+
function resetConfig() {
|
|
1262
|
+
const userPath = getUserSettingsPath();
|
|
1263
|
+
if (existsSync2(userPath)) {
|
|
1264
|
+
unlinkSync(userPath);
|
|
1265
|
+
process.stdout.write(`Deleted ${userPath}
|
|
1266
|
+
`);
|
|
1267
|
+
} else {
|
|
1268
|
+
process.stdout.write("No user settings found.\n");
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1168
1271
|
async function startCli() {
|
|
1169
1272
|
const args = parseCliArgs();
|
|
1170
1273
|
if (args.version) {
|
|
@@ -1172,7 +1275,12 @@ async function startCli() {
|
|
|
1172
1275
|
`);
|
|
1173
1276
|
return;
|
|
1174
1277
|
}
|
|
1278
|
+
if (args.reset) {
|
|
1279
|
+
resetConfig();
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1175
1282
|
const cwd = process.cwd();
|
|
1283
|
+
await ensureConfig(cwd);
|
|
1176
1284
|
const [config, context, projectInfo] = await Promise.all([
|
|
1177
1285
|
loadConfig(cwd),
|
|
1178
1286
|
loadContext(cwd),
|
package/dist/node/index.cjs
CHANGED
|
@@ -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
|
}
|
|
@@ -186,7 +187,8 @@ function scanSkillsDir(skillsDir) {
|
|
|
186
187
|
commands.push({
|
|
187
188
|
name: frontmatter?.name ?? entry.name,
|
|
188
189
|
description: frontmatter?.description ?? `Skill: ${entry.name}`,
|
|
189
|
-
source: "skill"
|
|
190
|
+
source: "skill",
|
|
191
|
+
skillContent: content
|
|
190
192
|
});
|
|
191
193
|
}
|
|
192
194
|
return commands;
|
|
@@ -790,6 +792,7 @@ var HELP_TEXT = [
|
|
|
790
792
|
" /compact [instr] \u2014 Compact context (optional focus instructions)",
|
|
791
793
|
" /mode [m] \u2014 Show/change permission mode",
|
|
792
794
|
" /cost \u2014 Show session info",
|
|
795
|
+
" /reset \u2014 Delete settings and exit",
|
|
793
796
|
" /exit \u2014 Exit CLI"
|
|
794
797
|
].join("\n");
|
|
795
798
|
function handleModeCommand(arg, session, addMessage) {
|
|
@@ -855,6 +858,19 @@ Messages: ${session.getMessageCount()}`
|
|
|
855
858
|
});
|
|
856
859
|
return true;
|
|
857
860
|
}
|
|
861
|
+
case "reset": {
|
|
862
|
+
const { existsSync: exists, unlinkSync: unlink } = await import("fs");
|
|
863
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
|
|
864
|
+
const settingsPath = `${home}/.robota/settings.json`;
|
|
865
|
+
if (exists(settingsPath)) {
|
|
866
|
+
unlink(settingsPath);
|
|
867
|
+
addMessage({ role: "system", content: `Deleted ${settingsPath}. Exiting...` });
|
|
868
|
+
} else {
|
|
869
|
+
addMessage({ role: "system", content: "No user settings found." });
|
|
870
|
+
}
|
|
871
|
+
setTimeout(() => exit(), 500);
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
858
874
|
case "exit":
|
|
859
875
|
exit();
|
|
860
876
|
return true;
|
|
@@ -941,7 +957,15 @@ function buildSkillPrompt(input, registry) {
|
|
|
941
957
|
const skillCmd = registry.getCommands().find((c) => c.name === cmd && c.source === "skill");
|
|
942
958
|
if (!skillCmd) return null;
|
|
943
959
|
const args = parts.slice(1).join(" ").trim();
|
|
944
|
-
|
|
960
|
+
const userInstruction = args || skillCmd.description;
|
|
961
|
+
if (skillCmd.skillContent) {
|
|
962
|
+
return `<skill name="${cmd}">
|
|
963
|
+
${skillCmd.skillContent}
|
|
964
|
+
</skill>
|
|
965
|
+
|
|
966
|
+
Execute the "${cmd}" skill: ${userInstruction}`;
|
|
967
|
+
}
|
|
968
|
+
return `Use the "${cmd}" skill: ${userInstruction}`;
|
|
945
969
|
}
|
|
946
970
|
function useSubmitHandler(session, addMessage, handleSlashCommand, clearStreamingText, setIsThinking, setContextPercentage, registry) {
|
|
947
971
|
return (0, import_react5.useCallback)(
|
|
@@ -1137,7 +1161,8 @@ function parseCliArgs() {
|
|
|
1137
1161
|
model: { type: "string" },
|
|
1138
1162
|
"permission-mode": { type: "string" },
|
|
1139
1163
|
"max-turns": { type: "string" },
|
|
1140
|
-
version: { type: "boolean", default: false }
|
|
1164
|
+
version: { type: "boolean", default: false },
|
|
1165
|
+
reset: { type: "boolean", default: false }
|
|
1141
1166
|
}
|
|
1142
1167
|
});
|
|
1143
1168
|
return {
|
|
@@ -1148,7 +1173,8 @@ function parseCliArgs() {
|
|
|
1148
1173
|
model: values["model"],
|
|
1149
1174
|
permissionMode: parsePermissionMode(values["permission-mode"]),
|
|
1150
1175
|
maxTurns: parseMaxTurns(values["max-turns"]),
|
|
1151
|
-
version: values["version"] ?? false
|
|
1176
|
+
version: values["version"] ?? false,
|
|
1177
|
+
reset: values["reset"] ?? false
|
|
1152
1178
|
};
|
|
1153
1179
|
}
|
|
1154
1180
|
var PrintTerminal = class {
|
|
@@ -1199,6 +1225,83 @@ var PrintTerminal = class {
|
|
|
1199
1225
|
} };
|
|
1200
1226
|
}
|
|
1201
1227
|
};
|
|
1228
|
+
function getUserSettingsPath() {
|
|
1229
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "/";
|
|
1230
|
+
return (0, import_node_path2.join)(home, ".robota", "settings.json");
|
|
1231
|
+
}
|
|
1232
|
+
async function ensureConfig(cwd) {
|
|
1233
|
+
const userPath = getUserSettingsPath();
|
|
1234
|
+
const projectPath = (0, import_node_path2.join)(cwd, ".robota", "settings.json");
|
|
1235
|
+
const localPath = (0, import_node_path2.join)(cwd, ".robota", "settings.local.json");
|
|
1236
|
+
if ((0, import_node_fs2.existsSync)(userPath) || (0, import_node_fs2.existsSync)(projectPath) || (0, import_node_fs2.existsSync)(localPath)) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
process.stdout.write("\n");
|
|
1240
|
+
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1241
|
+
process.stdout.write(" No configuration found. Let's set up your API key.\n");
|
|
1242
|
+
process.stdout.write("\n");
|
|
1243
|
+
const apiKey = await new Promise((resolve) => {
|
|
1244
|
+
process.stdout.write(" Anthropic API key: ");
|
|
1245
|
+
let input = "";
|
|
1246
|
+
const stdin = process.stdin;
|
|
1247
|
+
const wasRaw = stdin.isRaw;
|
|
1248
|
+
stdin.setRawMode(true);
|
|
1249
|
+
stdin.resume();
|
|
1250
|
+
stdin.setEncoding("utf8");
|
|
1251
|
+
const onData = (data) => {
|
|
1252
|
+
for (const ch of data) {
|
|
1253
|
+
if (ch === "\r" || ch === "\n") {
|
|
1254
|
+
stdin.removeListener("data", onData);
|
|
1255
|
+
stdin.setRawMode(wasRaw ?? false);
|
|
1256
|
+
stdin.pause();
|
|
1257
|
+
process.stdout.write("\n");
|
|
1258
|
+
resolve(input.trim());
|
|
1259
|
+
return;
|
|
1260
|
+
} else if (ch === "\x7F" || ch === "\b") {
|
|
1261
|
+
if (input.length > 0) {
|
|
1262
|
+
input = input.slice(0, -1);
|
|
1263
|
+
process.stdout.write("\b \b");
|
|
1264
|
+
}
|
|
1265
|
+
} else if (ch === "") {
|
|
1266
|
+
process.stdout.write("\n");
|
|
1267
|
+
process.exit(0);
|
|
1268
|
+
} else if (ch.charCodeAt(0) >= 32) {
|
|
1269
|
+
input += ch;
|
|
1270
|
+
process.stdout.write("*");
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
stdin.on("data", onData);
|
|
1275
|
+
});
|
|
1276
|
+
if (!apiKey) {
|
|
1277
|
+
process.stderr.write("\n No API key provided. Exiting.\n");
|
|
1278
|
+
process.exit(1);
|
|
1279
|
+
}
|
|
1280
|
+
const settingsDir = (0, import_node_path2.dirname)(userPath);
|
|
1281
|
+
(0, import_node_fs2.mkdirSync)(settingsDir, { recursive: true });
|
|
1282
|
+
const settings = {
|
|
1283
|
+
provider: {
|
|
1284
|
+
name: "anthropic",
|
|
1285
|
+
model: "claude-sonnet-4-6",
|
|
1286
|
+
apiKey
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
(0, import_node_fs2.writeFileSync)(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
1290
|
+
process.stdout.write(`
|
|
1291
|
+
Config saved to ${userPath}
|
|
1292
|
+
|
|
1293
|
+
`);
|
|
1294
|
+
}
|
|
1295
|
+
function resetConfig() {
|
|
1296
|
+
const userPath = getUserSettingsPath();
|
|
1297
|
+
if ((0, import_node_fs2.existsSync)(userPath)) {
|
|
1298
|
+
(0, import_node_fs2.unlinkSync)(userPath);
|
|
1299
|
+
process.stdout.write(`Deleted ${userPath}
|
|
1300
|
+
`);
|
|
1301
|
+
} else {
|
|
1302
|
+
process.stdout.write("No user settings found.\n");
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1202
1305
|
async function startCli() {
|
|
1203
1306
|
const args = parseCliArgs();
|
|
1204
1307
|
if (args.version) {
|
|
@@ -1206,7 +1309,12 @@ async function startCli() {
|
|
|
1206
1309
|
`);
|
|
1207
1310
|
return;
|
|
1208
1311
|
}
|
|
1312
|
+
if (args.reset) {
|
|
1313
|
+
resetConfig();
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1209
1316
|
const cwd = process.cwd();
|
|
1317
|
+
await ensureConfig(cwd);
|
|
1210
1318
|
const [config, context, projectInfo] = await Promise.all([
|
|
1211
1319
|
(0, import_agent_sdk2.loadConfig)(cwd),
|
|
1212
1320
|
(0, import_agent_sdk2.loadContext)(cwd),
|
package/dist/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robota-sdk/agent-cli",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.9",
|
|
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.
|
|
39
|
-
"@robota-sdk/agent-sdk": "3.0.0-beta.
|
|
38
|
+
"@robota-sdk/agent-core": "3.0.0-beta.9",
|
|
39
|
+
"@robota-sdk/agent-sdk": "3.0.0-beta.9"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/marked": "^6.0.0",
|