@botbuddy/cli 1.1.0 → 1.2.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/commands.mjs +38 -54
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbuddy/cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
package/src/commands.mjs CHANGED
@@ -4,16 +4,18 @@ import { runBridge } from "./codex-bridge.mjs";
4
4
  import { loadConfig, getConfig, clearConfig, saveConfig, getConfigPath } from "./config.mjs";
5
5
  import { green, red, cyan, dim, bold, die } from "./utils.mjs";
6
6
 
7
- const VERSION = "1.0.0";
7
+ const VERSION = "1.1.0";
8
8
 
9
- export function run(argv) {
9
+ export async function run(argv) {
10
10
  loadConfig();
11
11
  const [command, ...args] = argv;
12
12
 
13
13
  switch (command) {
14
+ case "start": return cmdStart(args);
14
15
  case "login": return doLogin();
15
16
  case "logout": return cmdLogout();
16
17
  case "status": return cmdStatus();
18
+ // Agent-only commands (used by MCP agents, not humans)
17
19
  case "register": return cmdRegister(args);
18
20
  case "heartbeat": return cmdHeartbeat(args);
19
21
  case "lock": return cmdLock(args);
@@ -39,52 +41,39 @@ function cmdHelp() {
39
41
  console.log(`${bold("botbuddy")} ${dim(`v${VERSION}`)} — Swarm coordination CLI
40
42
 
41
43
  ${bold("USAGE")}
42
- botbuddy <command> [options]
44
+ botbuddy start Start BotBuddy (login + codex server + bridge)
45
+
46
+ ${bold("OPTIONS")}
47
+ start [options]
48
+ -p, --port <port> WebSocket port (default: 4500)
49
+ -r, --repo <path> Repository path (default: cwd)
50
+ -m, --model <model> Default model (default: gpt-5.4)
51
+ --no-server Don't auto-start codex app-server
43
52
 
44
53
  ${bold("AUTH")}
45
- login Authenticate via OAuth (PKCE)
46
- logout Remove saved credentials
47
- status Show current auth status
48
-
49
- ${bold("AGENTS")}
50
- register <name> [type] Register a new agent (type: codex|claude|gpt|custom)
51
- agents List all agents
52
- heartbeat [task] Send a heartbeat
53
-
54
- ${bold("RESOURCES")}
55
- lock <name> <type> Acquire a single lock (type: port|mcp_server|file|...)
56
- locks [options] Batch-acquire resources (auto-assigns free ones)
57
- -p, --port [type] Request a port (frontend|backend, default: frontend)
58
- -m, --mcp Request an MCP server slot
59
- -t, --ticket <id> Ticket ID (shared across all locks)
60
- --pr <id> PR ID (shared across all locks)
61
- unlock <name> Release a lock
62
- resources List all resources and locks
63
-
64
- ${bold("TASKS")}
65
- task create <title> [-d description] [-p priority]
66
- task claim <id> Claim a pending task
67
- task done <id> Mark a task as done
68
- tasks List all tasks
69
-
70
- ${bold("SWARM")}
71
- hours Get current working hours
72
- hours derive Derive working hours from activity
73
- hours set <json> Set working hours manually
74
-
75
- ${bold("BROWSE")}
76
- browse agents|tasks|resources|activity|settings
77
-
78
- ${bold("CODEX")}
79
- codex bridge [options] Start Codex app-server + bridge (single command)
80
- -p, --port <port> WebSocket port (default: 4500)
81
- -r, --repo <path> Repository path (default: cwd)
82
- -m, --model <model> Default model (default: gpt-5.4)
83
- --no-server Don't auto-start app-server (if already running)
54
+ login Re-authenticate via OAuth
55
+ logout Remove saved credentials
56
+ status Show current auth status
84
57
 
85
58
  ${bold("OTHER")}
86
- help Show this help
87
- version Show version`);
59
+ help Show this help
60
+ version Show version`);
61
+ }
62
+
63
+ async function cmdStart(args) {
64
+ const cfg = getConfig();
65
+
66
+ // Auto-login if not authenticated
67
+ if (!cfg.access_token && !cfg.api_key) {
68
+ console.log(dim("→ No credentials found. Starting login...\n"));
69
+ await doLogin();
70
+ } else if (cfg.token_expires_at && cfg.token_expires_at <= Date.now()) {
71
+ console.log(dim("→ Token expired. Re-authenticating...\n"));
72
+ await doLogin();
73
+ }
74
+
75
+ // Start the bridge (which auto-starts codex app-server)
76
+ return runBridge(args);
88
77
  }
89
78
 
90
79
  function cmdStatus() {
@@ -96,7 +85,7 @@ function cmdStatus() {
96
85
  if (cfg.token_expires_at) {
97
86
  const remaining = cfg.token_expires_at - Date.now();
98
87
  if (remaining <= 0) {
99
- console.log(` Token: ${red("EXPIRED")} — run ${cyan("botbuddy login")}`);
88
+ console.log(` Token: ${red("EXPIRED")} — run ${cyan("botbuddy start")}`);
100
89
  } else {
101
90
  const mins = Math.round(remaining / 60000);
102
91
  const label = mins > 60 ? `${Math.round(mins / 60)}h ${mins % 60}m` : `${mins}m`;
@@ -109,7 +98,7 @@ function cmdStatus() {
109
98
  if (cfg.agent_name) console.log(` Agent: ${cyan(cfg.agent_name)}`);
110
99
  } else {
111
100
  console.log(`${red("✗")} Not authenticated`);
112
- console.log(` Run: ${cyan("botbuddy login")}`);
101
+ console.log(` Run: ${cyan("botbuddy start")}`);
113
102
  }
114
103
  }
115
104
 
@@ -214,12 +203,7 @@ function cmdBrowse(args) {
214
203
  }
215
204
 
216
205
  function cmdCodex(args) {
217
- const sub = args[0];
218
- if (!sub) die("Usage: botbuddy codex <bridge> [options]");
219
- switch (sub) {
220
- case "bridge":
221
- return runBridge(args.slice(1));
222
- default:
223
- die(`Unknown codex subcommand: ${sub}. Try: botbuddy codex bridge`);
224
- }
206
+ // Legacy alias — redirect to start
207
+ console.log(dim("Note: 'botbuddy codex bridge' is now 'botbuddy start'\n"));
208
+ return runBridge(args.slice(1));
225
209
  }