Skip to content

Self-improving AI Employees for everyone

chore: end-user hardening and strictness guards (phases 5-6)

trohitgb02c4a10b0ae
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1feafd0c..09a4e3a2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,7 +5,7 @@ name: CI
on:
push:
- branches: [main, pnpm-phased-migration]
+ branches: [main]
pull_request:
branches: [main]
diff --git a/.github/workflows/predeploy.yml b/.github/workflows/predeploy.yml
index 25bc03f0..edbe4fee 100644
--- a/.github/workflows/predeploy.yml
+++ b/.github/workflows/predeploy.yml
@@ -17,7 +17,7 @@ jobs:
uses: ./.github/actions/setup
- name: Install dependencies
- run: pnpm install
+ run: pnpm install --frozen-lockfile
- name: Build all services
run: pnpm run build
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 536bec82..194e6408 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -17,10 +17,25 @@ jobs:
predeploy:
uses: ./.github/workflows/predeploy.yml
+ # Audit production dependencies before publishing
+ audit:
+ name: Security Audit
+ needs: predeploy
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup environment
+ uses: ./.github/actions/setup
+
+ - name: Audit production dependencies
+ run: pnpm audit --prod || true
+
# Build client once after predeploy passes, share with publish jobs
build-for-publish:
name: Build for Publishing
- needs: predeploy
+ needs: [predeploy, audit]
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -31,7 +46,7 @@ jobs:
- name: Install and build client
run: |
- pnpm install
+ pnpm install --frozen-lockfile
pnpm --filter react-flow-client run build
- name: Upload built client
diff --git a/.npmrc b/.npmrc
index 91c91576..fad2c003 100644
--- a/.npmrc
+++ b/.npmrc
@@ -4,9 +4,9 @@
# npm 7+ behavior). Removes manual peer-dep management for contributors.
auto-install-peers=true
-# strict-peer-dependencies: set to false during migration so existing peer
-# warnings don't block `pnpm install`. Tighten to true in Phase 6.
-strict-peer-dependencies=false
+# strict-peer-dependencies: true catches mismatched peer deps at install time.
+# Allowed exceptions are in package.json pnpm.peerDependencyRules.
+strict-peer-dependencies=true
# shamefully-hoist: keep false (pnpm default). Strict node_modules layout
# catches phantom deps. If a specific library breaks (e.g., some Babel
diff --git a/bin/cli.js b/bin/cli.js
index 0cef62c8..1df425e5 100755
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -14,6 +14,7 @@ const COMMANDS = {
stop: 'Stop all running services',
build: 'Build the project for production',
clean: 'Clean build artifacts',
+ doctor: 'Check system dependencies and project health',
help: 'Show this help message',
version: 'Show version number',
};
@@ -102,6 +103,29 @@ function checkDeps() {
}
}
+function doctor() {
+ console.log('\nMachinaOS Doctor\n');
+ try {
+ execSync('npx envinfo --system --binaries --npmPackages concurrently,edgymeow,temporal-server', {
+ cwd: ROOT, stdio: 'inherit', shell: true,
+ });
+ } catch { /* envinfo not available, continue with manual checks */ }
+
+ console.log(' Additional checks:');
+ const checks = [
+ ['uv', getVersion('uv --version')],
+ ['temporal-server', getVersion('temporal-server --version')],
+ ];
+ for (const [name, ver] of checks) {
+ console.log(ver ? ` ${name}: ${ver}` : ` ${name}: Not Found`);
+ }
+
+ const has = (f) => { try { readFileSync(resolve(ROOT, f)); return true; } catch { return false; } };
+ console.log(has('pnpm-lock.yaml') ? ' Lockfile: pnpm-lock.yaml' : has('package-lock.json') ? ' Lockfile: package-lock.json' : ' Lockfile: Not Found');
+ console.log(has('server/.venv/pyvenv.cfg') ? ' Python venv: OK' : ' Python venv: Missing (run machina build)');
+ console.log('');
+}
+
function run(script, extraArgs = []) {
const npmArgs = ['run', script];
if (extraArgs.length) npmArgs.push('--', ...extraArgs);
@@ -123,6 +147,8 @@ if (cmd === 'help' || cmd === '--help' || cmd === '-h') {
printHelp();
} else if (cmd === 'version' || cmd === '--version' || cmd === '-v') {
console.log(`machina v${PKG.version}`);
+} else if (cmd === 'doctor') {
+ doctor();
} else if (cmd === 'start' || cmd === 'dev' || cmd === 'build') {
checkDeps();
run(cmd, process.argv.slice(3));
diff --git a/install.ps1 b/install.ps1
index ee708f08..cb8f9985 100644
--- a/install.ps1
+++ b/install.ps1
@@ -195,6 +195,12 @@ function Main {
Write-Host " Open in browser:"
Write-Host " http://localhost:3000"
Write-Host ""
+ Write-Host " For development from source, install pnpm:"
+ Write-Host " npm install -g pnpm"
+ Write-Host ""
+ Write-Host " Run diagnostics:"
+ Write-Host " machina doctor"
+ Write-Host ""
}
# Run main
diff --git a/install.sh b/install.sh
index 45fdfa29..f2ec71c3 100755
--- a/install.sh
+++ b/install.sh
@@ -302,6 +302,12 @@ main() {
echo " Optional: Enable JS-rendered web scraping:"
echo " playwright install chromium"
echo ""
+ echo " For development from source, install pnpm:"
+ echo " npm install -g pnpm"
+ echo ""
+ echo " Run diagnostics:"
+ echo " machina doctor"
+ echo ""
}
# Run main
diff --git a/scripts/preinstall.js b/scripts/preinstall.js
index 3686dfe7..984aecda 100755
--- a/scripts/preinstall.js
+++ b/scripts/preinstall.js
@@ -20,6 +20,20 @@ if (process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true') {
process.exit(0);
}
+// Enforce pnpm for source checkouts (pnpm-workspace.yaml exists).
+// Skipped for global npm installs (end users) which don't have the workspace file.
+try {
+ statSync(resolve(__dirname, '..', 'pnpm-workspace.yaml'));
+ const agent = process.env.npm_config_user_agent || '';
+ if (!agent.startsWith('pnpm')) {
+ console.error('This project requires pnpm. Install it: npm install -g pnpm');
+ console.error('Then run: pnpm install');
+ process.exit(1);
+ }
+} catch {
+ // No pnpm-workspace.yaml = global npm install, allow npm
+}
+
function getGlobalNodeModules() {
try {
const prefix = execSync('npm config get prefix', {