troxy-cli 1.21.0 → 1.21.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/bin/troxy.js +21 -2
- package/package.json +1 -1
package/bin/troxy.js
CHANGED
|
@@ -500,7 +500,7 @@ switch (command) {
|
|
|
500
500
|
// is its picture of which checkpoints exist, and that lives on the server.
|
|
501
501
|
// This is a no-op on a machine with an MCP client, which gets a fresh tool
|
|
502
502
|
// list from the MCP handshake every session anyway.
|
|
503
|
-
const { refreshHostedInstructions } = await import('../src/init.js');
|
|
503
|
+
const { refreshHostedInstructions, reprovisionKeyConsumers } = await import('../src/init.js');
|
|
504
504
|
const refresh = async () => {
|
|
505
505
|
try {
|
|
506
506
|
return await refreshHostedInstructions((loadConfig() || {}).apiKey);
|
|
@@ -531,7 +531,26 @@ switch (command) {
|
|
|
531
531
|
}
|
|
532
532
|
// Also refresh the npx cache so MCP servers (e.g. OpenClaw) pick up the new version
|
|
533
533
|
try { execSync(`npx --yes troxy-cli@${latest} --version`, { stdio: 'pipe' }); } catch { /* non-fatal */ }
|
|
534
|
-
console.log(`✓\n\n Updated to ${latest}
|
|
534
|
+
console.log(`✓\n\n Updated to ${latest}.`);
|
|
535
|
+
|
|
536
|
+
// Re-run the exact same client/hook provisioning `troxy init` does,
|
|
537
|
+
// using the key already saved on this machine - a version bump can
|
|
538
|
+
// change what gets registered (e.g. 1.21.0 added a PreToolUse hook
|
|
539
|
+
// alongside the existing Stop hook), and `update` silently leaving
|
|
540
|
+
// that unregistered meant the new version was installed but inert
|
|
541
|
+
// until someone thought to re-run `init` by hand. Best-effort: a
|
|
542
|
+
// failure here must not make `update` itself look like it failed when
|
|
543
|
+
// the actual package upgrade already succeeded.
|
|
544
|
+
const savedConfig = loadConfig();
|
|
545
|
+
if (savedConfig?.apiKey) {
|
|
546
|
+
try {
|
|
547
|
+
await reprovisionKeyConsumers(savedConfig.apiKey, savedConfig.agentName);
|
|
548
|
+
} catch (err) {
|
|
549
|
+
console.error(`\n Could not refresh MCP client config: ${err.message}`);
|
|
550
|
+
console.error(' Run "troxy init --key <your-key>" by hand to finish updating.\n');
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
console.log('\n Restart your terminal and any MCP clients to use the new version.');
|
|
535
554
|
if (!await refresh()) console.log('');
|
|
536
555
|
} catch (err) {
|
|
537
556
|
const stderr = err.stderr?.toString() || err.message || '';
|
package/package.json
CHANGED