@clawcard/cli 1.0.9 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawcard/cli",
3
- "version": "1.0.9",
3
+ "version": "1.1.1",
4
4
  "description": "The ClawCard CLI — manage your agent keys, billing, and setup from the terminal",
5
5
  "bin": {
6
6
  "clawcard": "./bin/clawcard.mjs"
@@ -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",
@@ -1,8 +1,11 @@
1
1
  import * as p from "@clack/prompts";
2
+ import chalk from "chalk";
2
3
  import open from "open";
3
4
  import crypto from "crypto";
4
5
  import { saveConfig, isLoggedIn, getConfig, BASE_URL } from "../config.js";
5
6
 
7
+ const orange = chalk.hex("#FF6B35");
8
+
6
9
  export async function loginCommand() {
7
10
  if (isLoggedIn()) {
8
11
  const config = getConfig();
@@ -31,6 +34,26 @@ export async function loginCommand() {
31
34
  });
32
35
 
33
36
  p.log.success(`Logged in as ${result.email}`);
37
+
38
+ // Show referral banner
39
+ try {
40
+ const meRes = await fetch(`${BASE_URL}/api/me`, {
41
+ headers: { Authorization: `Bearer ${result.token}` },
42
+ });
43
+ const me = await meRes.json();
44
+ if (me.referralCode) {
45
+ p.note(
46
+ [
47
+ `Your invite code: ${orange.bold(me.referralCode)}`,
48
+ "",
49
+ chalk.dim("Share it — you both get $5 in credits when they top up!"),
50
+ ].join("\n"),
51
+ "Earn $5"
52
+ );
53
+ }
54
+ } catch {
55
+ // non-critical
56
+ }
34
57
  } catch (err) {
35
58
  s.stop("Login failed");
36
59
  p.log.error(err.message);
@@ -19,7 +19,7 @@ export async function referralCommand() {
19
19
  [
20
20
  `Your code: ${orange.bold(me.referralCode || "N/A")}`,
21
21
  "",
22
- chalk.dim("Share this code — you both get $10 credit!"),
22
+ chalk.dim("Share this code — you both get $5 when they top up!"),
23
23
  ].join("\n"),
24
24
  "Referral"
25
25
  );