Skip to content

Commit 9b3f4f1

Browse files
committed
feat: show DEXBot2 version in status command + suppress stderr noise
Shows `DEXBot2 v<version>` at the top of `node dexbot status|stat` output so the user always sees what's installed, regardless of whether bots are running. Also silences the `/bin/sh: pm2: not found` stderr message when PM2 is not installed, by redirecting stderr in the execSync call. ## Changes - `modules/config.ts`: add `Config.VERSION` read from root package.json - `dexbot.ts`: print version in `status` handler; add `2>/dev/null` to `pm2 jlist` execSync ## Testing - `node dexbot stat` shows version and clean output when PM2 absent
1 parent d12e9da commit 9b3f4f1

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

dexbot.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,8 @@ async function handleCLICommands() {
944944
return true;
945945
}
946946
case 'status': {
947+
console.log(`DEXBot2 v${Config.VERSION}`);
948+
console.log();
947949
const { spawnSync, execSync } = require('child_process');
948950
const MONOLITHIC_PID_FILE = PATHS.PROFILES.MONOLITHIC_PID;
949951
const SUPERVISOR_SOCK = PATHS.PROFILES.SUPERVISOR_SOCK;
@@ -980,7 +982,7 @@ async function handleCLICommands() {
980982
}
981983

982984
try {
983-
const output = execSync('pm2 jlist', { encoding: 'utf8', timeout: 5000 }).toString().trim();
985+
const output = execSync('pm2 jlist 2>/dev/null', { encoding: 'utf8', timeout: 5000 }).toString().trim();
984986
const jsonStart = output.indexOf('[');
985987
if (jsonStart === -1) {
986988
console.log('No DEXBot2 processes running.');

modules/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Browser: would be populated from URL params, localStorage, etc.
1111
*/
1212

13+
const path = require('path');
1314
const { hasProcess } = require('./env');
1415

1516
function str(key: string): string | undefined {
@@ -38,6 +39,7 @@ const Config: {
3839
BOT_NAME: string | undefined;
3940
PREFERRED_ACCOUNT: string | undefined;
4041
LIVE_BOT_NAME: string | undefined;
42+
VERSION: string;
4143

4244
// ── Feature flags ───────────────────────────────────────────────
4345
DEXBOT_SKIP_PROFILE_VALIDATION: boolean;
@@ -100,6 +102,7 @@ const Config: {
100102
BOT_NAME: str('BOT_NAME'),
101103
PREFERRED_ACCOUNT: str('PREFERRED_ACCOUNT'),
102104
LIVE_BOT_NAME: str('LIVE_BOT_NAME'),
105+
VERSION: hasProcess() ? require(path.join(__dirname, '..', '..', 'package.json')).version : '0.0.0',
103106

104107
// ── Feature flags ───────────────────────────────────────────────
105108
DEXBOT_SKIP_PROFILE_VALIDATION: bool('DEXBOT_SKIP_PROFILE_VALIDATION'),

0 commit comments

Comments
 (0)