Skip to content

Self-improving AI Employees for everyone

fix: Add --version flag to CLI and fix Windows CI path issue

trohitg7351cd9581bf
diff --git a/.github/workflows/predeploy.yml b/.github/workflows/predeploy.yml
index 9b6db6c6..ec3c660c 100644
--- a/.github/workflows/predeploy.yml
+++ b/.github/workflows/predeploy.yml
@@ -193,7 +193,13 @@ jobs:
if: runner.os == 'Windows'
shell: pwsh
run: |
- $job = Start-Job -ScriptBlock { machinaos start }
+ # Get the npm global bin path and pass it to the job
+ $npmBin = npm prefix -g
+ $job = Start-Job -ScriptBlock {
+ param($binPath)
+ $env:PATH = "$binPath;$env:PATH"
+ machinaos start
+ } -ArgumentList $npmBin
Start-Sleep -Seconds 15
# Check if backend is responding
diff --git a/bin/cli.js b/bin/cli.js
index 7c5dd5dd..350978ad 100644
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -3,8 +3,10 @@
import { spawn, execSync } from 'child_process';
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
+import { readFileSync } from 'fs';
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const PKG = JSON.parse(readFileSync(resolve(ROOT, 'package.json'), 'utf-8'));
const COMMANDS = {
start: 'Start the development server',
@@ -16,6 +18,7 @@ const COMMANDS = {
'docker:build': 'Build Docker images',
'docker:logs': 'View Docker logs',
help: 'Show this help message',
+ version: 'Show version number',
};
function printHelp() {
@@ -114,6 +117,8 @@ const cmd = process.argv[2] || 'help';
if (cmd === 'help' || cmd === '--help' || cmd === '-h') {
printHelp();
+} else if (cmd === 'version' || cmd === '--version' || cmd === '-v') {
+ console.log(`machinaos v${PKG.version}`);
} else if (cmd === 'start' || cmd === 'build') {
checkDeps();
run(cmd);