twinclaw 1.1.2 → 1.1.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/dist/core/cli.js CHANGED
@@ -12,6 +12,7 @@ Commands:
12
12
  channels <subcmd> Manage messaging channels (e.g. login)
13
13
  gateway <subcmd> Manage the TwinClaw background service daemon
14
14
  logs [--follow] Stream daily structured memory logs from the daemon
15
+ update Check for and install the latest TwinClaw version
15
16
  --onboard Run the interactive AI persona-building session
16
17
 
17
18
  Options:
@@ -98,6 +99,7 @@ export function handleUnknownCommand(argv) {
98
99
  'channels',
99
100
  'gateway',
100
101
  'logs',
102
+ 'update',
101
103
  '--onboard',
102
104
  '--help',
103
105
  '-h',
@@ -111,3 +113,39 @@ export function handleUnknownCommand(argv) {
111
113
  process.exitCode = 1;
112
114
  return true;
113
115
  }
116
+ /**
117
+ * Handle the `update` command.
118
+ * Checks for and installs the latest TwinClaw version from npm.
119
+ * Returns `true` when the command was recognized and handled.
120
+ */
121
+ export function handleUpdateCli(argv) {
122
+ if (argv[0] !== 'update')
123
+ return false;
124
+ const { execSync } = require('child_process');
125
+ console.log('[TwinClaw] Checking for updates...');
126
+ try {
127
+ // Get current version
128
+ const currentVersion = require('../../package.json').version;
129
+ console.log(`[TwinClaw] Current version: ${currentVersion}`);
130
+ // Fetch latest version from npm
131
+ const latestVersion = execSync('npm view twinclaw version', { encoding: 'utf8' }).trim();
132
+ console.log(`[TwinClaw] Latest version: ${latestVersion}`);
133
+ if (currentVersion === latestVersion) {
134
+ console.log('[TwinClaw] You are already on the latest version.');
135
+ process.exitCode = 0;
136
+ return true;
137
+ }
138
+ console.log('[TwinClaw] Update available! Installing...');
139
+ // Install latest version globally
140
+ execSync('npm install -g twinclaw@latest', { stdio: 'inherit' });
141
+ console.log(`[TwinClaw] Successfully updated to version ${latestVersion}`);
142
+ console.log('[TwinClaw] Please restart TwinClaw to use the new version.');
143
+ process.exitCode = 0;
144
+ }
145
+ catch (error) {
146
+ const message = error instanceof Error ? error.message : String(error);
147
+ console.error(`[TwinClaw] Update failed: ${message}`);
148
+ process.exitCode = 1;
149
+ }
150
+ return true;
151
+ }
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from 'node:module';
3
3
  const require = createRequire(import.meta.url);
4
4
  import { handleOnboardCli, runOnboarding, runSetupWizard, runSimplifiedOnboarding, startBasicREPL } from './core/onboarding.js';
5
5
  import { Gateway } from './core/gateway.js';
6
- import { handleDoctorCli, handleHelpCli, handleUnknownCommand } from './core/cli.js';
6
+ import { handleDoctorCli, handleHelpCli, handleUnknownCommand, handleUpdateCli } from './core/cli.js';
7
7
  import { handleSelfImproveCli } from './core/self-improve-cli.js';
8
8
  import { HeartbeatService } from './core/heartbeat.js';
9
9
  import { Dispatcher } from './interfaces/dispatcher.js';
@@ -58,6 +58,9 @@ if (await handleSelfImproveCli(process.argv.slice(2))) {
58
58
  if (handleDoctorCli(process.argv.slice(2))) {
59
59
  process.exit(process.exitCode ?? 0);
60
60
  }
61
+ if (handleUpdateCli(process.argv.slice(2))) {
62
+ process.exit(process.exitCode ?? 0);
63
+ }
61
64
  if (handleSecretVaultCli(process.argv.slice(2), secretVault)) {
62
65
  process.exit(process.exitCode ?? 0);
63
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twinclaw",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Eagle-eyed agentic AI gateway with multi-modal hooks and proactive memory.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {