@clawcard/cli 1.1.0 → 1.1.1
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/commands/keys.js +20 -0
package/package.json
CHANGED
package/src/commands/keys.js
CHANGED
|
@@ -34,6 +34,26 @@ export async function keysCommand() {
|
|
|
34
34
|
export async function keysCreateCommand() {
|
|
35
35
|
requireAuth();
|
|
36
36
|
|
|
37
|
+
// Check if user already has an active key
|
|
38
|
+
try {
|
|
39
|
+
const existing = await listAgents();
|
|
40
|
+
const active = existing.filter((a) => a.status === "active");
|
|
41
|
+
if (active.length > 0) {
|
|
42
|
+
p.log.warn(
|
|
43
|
+
`You already have an active key: ${orange(active[0].name || "unnamed")} (${active[0].keyPrefix}...)`
|
|
44
|
+
);
|
|
45
|
+
p.log.info(
|
|
46
|
+
`To create a new key, first revoke the existing one with: ${chalk.dim("clawcard keys revoke")}`
|
|
47
|
+
);
|
|
48
|
+
p.log.info(
|
|
49
|
+
chalk.dim("This will close all cards, delete credentials, and return allocated budget to your account balance.")
|
|
50
|
+
);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
} catch {
|
|
54
|
+
// couldn't check — proceed and let the API handle it
|
|
55
|
+
}
|
|
56
|
+
|
|
37
57
|
const name = await p.text({
|
|
38
58
|
message: "Key name",
|
|
39
59
|
placeholder: "my-agent",
|