troxy-cli 1.3.3 → 1.3.4

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/init.js +18 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "AI payment control — protect your agent's payments with policies",
5
5
  "type": "module",
6
6
  "bin": {
package/src/init.js CHANGED
@@ -89,8 +89,15 @@ export async function runInit({ key } = {}) {
89
89
  return fs.existsSync(p);
90
90
  });
91
91
 
92
- if (detected.length === 0) {
93
- console.log('\n No MCP clients detected (Claude Desktop, Cursor, Windsurf).');
92
+ // Detect OpenClaw via CLI
93
+ let hasOpenClaw = false;
94
+ try {
95
+ execSync('openclaw --version', { stdio: 'ignore' });
96
+ hasOpenClaw = true;
97
+ } catch {}
98
+
99
+ if (detected.length === 0 && !hasOpenClaw) {
100
+ console.log('\n No MCP clients detected (Claude Desktop, Cursor, Windsurf, OpenClaw).');
94
101
  console.log(' Troxy MCP server config:\n');
95
102
  console.log(JSON.stringify(mcpEntry(key), null, 4));
96
103
  console.log('\n Add the above to your MCP client\'s config under "mcpServers".\n');
@@ -105,6 +112,15 @@ export async function runInit({ key } = {}) {
105
112
  console.log(` • ${client.name} ✗ (${err.message})`);
106
113
  }
107
114
  }
115
+ if (hasOpenClaw) {
116
+ try {
117
+ const entry = JSON.stringify({ command: 'npx', args: ['troxy-cli', 'mcp'], env: { TROXY_API_KEY: key } });
118
+ execSync(`openclaw mcp set troxy '${entry}'`, { stdio: 'ignore' });
119
+ console.log(` • OpenClaw ✓`);
120
+ } catch (err) {
121
+ console.log(` • OpenClaw ✗ (${err.message})`);
122
+ }
123
+ }
108
124
  console.log('\n Restart your MCP client to activate Troxy.');
109
125
  }
110
126