@ducci/jarvis 1.0.13 → 1.0.14

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/index.js +24 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ducci/jarvis",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "A fully automated agent system that lives on a server.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -180,6 +180,30 @@ program
180
180
  }
181
181
  });
182
182
 
183
+ program
184
+ .command('restart')
185
+ .description('Restart the Jarvis server (starts it if not running).')
186
+ .action(async () => {
187
+ preflight();
188
+ try {
189
+ await connectPm2();
190
+ const desc = await pm2Describe().catch(() => []);
191
+ const isRunning = desc.length > 0 && desc[0].pm2_env?.status === 'online';
192
+ if (isRunning) {
193
+ await pm2Restart();
194
+ console.log('Jarvis server restarted.');
195
+ } else {
196
+ await pm2Start();
197
+ console.log('Jarvis server started.');
198
+ }
199
+ pm2.disconnect();
200
+ } catch (e) {
201
+ console.error('Failed to restart Jarvis server:', e.message);
202
+ pm2.disconnect();
203
+ process.exit(1);
204
+ }
205
+ });
206
+
183
207
  program
184
208
  .command('status')
185
209
  .description('Display the status of the Jarvis server.')