troxy-cli 1.4.2 → 1.4.3

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/bin/troxy.js CHANGED
@@ -299,6 +299,7 @@ switch (command) {
299
299
  troxy policies list
300
300
  troxy policies describe --name "Block Amazon"
301
301
  troxy mcps list
302
+ troxy mcps rename --name "new-name"
302
303
  troxy activity [--limit 50] [--mine]
303
304
  troxy insights [--period 7]
304
305
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "AI payment control — protect your agent's payments with policies",
5
5
  "type": "module",
6
6
  "bin": {
package/src/api.js CHANGED
@@ -58,8 +58,9 @@ export const api = {
58
58
  // MCP heartbeat (agent API key)
59
59
  mcpHeartbeat: (apiKey, agentName) => request('POST', '/mcp/heartbeat', { apiKey, body: agentName ? { agent_name: agentName } : undefined }),
60
60
 
61
- // MCP status / pause / resume (agent API key)
62
- mcpStatus: (apiKey) => request('GET', '/mcp/status', { apiKey }),
61
+ // MCP status / rename / pause / resume (agent API key)
62
+ mcpStatus: (apiKey) => request('GET', '/mcp/status', { apiKey }),
63
+ mcpRename: (apiKey, name) => request('PATCH', '/mcp/name', { apiKey, body: { name } }),
63
64
  mcpPause: (apiKey) => request('POST', '/mcp/pause', { apiKey }),
64
65
  mcpResume: (apiKey) => request('POST', '/mcp/resume', { apiKey }),
65
66
 
package/src/mcps.js CHANGED
@@ -1,13 +1,12 @@
1
- import { api } from './api.js';
2
- import { loadConfig } from './config.js';
3
- import { requireJwt } from './auth.js';
4
- import { table } from './print.js';
1
+ import { api } from './api.js';
2
+ import { loadConfig, saveConfig } from './config.js';
3
+ import { requireJwt } from './auth.js';
4
+ import { table } from './print.js';
5
5
 
6
6
  export async function runMcps([sub], flags) {
7
- const jwt = requireJwt();
8
-
9
7
  switch (sub || 'list') {
10
8
  case 'list': {
9
+ const jwt = requireJwt();
11
10
  const data = await api.agentMcps(jwt);
12
11
  const mcps = data?.mcps || [];
13
12
  if (!mcps.length) { console.log('\n No MCP connections yet.\n'); return; }
@@ -27,9 +26,29 @@ export async function runMcps([sub], flags) {
27
26
  break;
28
27
  }
29
28
 
29
+ case 'rename': {
30
+ const name = flags.name;
31
+ if (!name) {
32
+ console.error('\n Usage: troxy mcps rename --name "new-name"\n');
33
+ process.exit(1);
34
+ }
35
+ const config = loadConfig();
36
+ const apiKey = process.env.TROXY_API_KEY || config?.apiKey;
37
+ if (!apiKey) {
38
+ console.error('\n No API key found. Run: troxy init --key txy-...\n');
39
+ process.exit(1);
40
+ }
41
+ process.stdout.write(`\n Renaming MCP to "${name}"... `);
42
+ await api.mcpRename(apiKey, name);
43
+ saveConfig({ ...config, agentName: name });
44
+ console.log('✓');
45
+ console.log(' Dashboard and future heartbeats will use the new name.\n');
46
+ break;
47
+ }
48
+
30
49
  default:
31
50
  console.error(` Unknown subcommand: ${sub}`);
32
- console.error(' Usage: troxy mcps [list]\n');
51
+ console.error(' Usage: troxy mcps [list|rename]\n');
33
52
  process.exit(1);
34
53
  }
35
54
  }