src/praisonai/scripts/ folder contains automation scripts for development, testing, and release workflows.
Script Overview
One-Liner Installer
The installer scripts provide a frictionless installation experience: macOS/Linux:Features
- OS Detection - Automatically detects macOS, Linux (various distros), Windows, WSL
- Isolation Backend - Auto-selects
uv tool→pipx→ venv fallback; override with--backend - Python Management - Installs Python 3.10+ if not available (venv path only)
- Package Manager Support - brew, apt, dnf, pacman, winget, chocolatey
- PATH Shim - Drops
~/.local/bin/praisonaiso the CLI is available without activating a venv - Idempotent PATH Block - Appends a clearly-marked
# >>> PraisonAI PATH >>>block to shell rc; skip with--no-modify-path - Shell Completions - Offers to install bash/zsh/fish completions via
praisonai completion <shell> - Interactive Onboarding - Prompts for LLM setup and bot configuration after installation
- Dry Run Mode - Preview changes before applying
Environment Variables
Examples
Version Management
bump_version.py
Updates version across all package files:praisonai/version.pypyproject.toml
check_version_sync.py
Verifies all packages have consistent versions:Release Workflow
bump_and_release.py
Automated release pipeline:- Bumps version
- Updates changelog
- Creates git tag
- Pushes to GitHub
- Triggers PyPI release
release.py
Manual PyPI release:Smoke Testing
test-install-smoke.sh
Tests the installer in isolated Docker containers:- Ubuntu 22.04
- Debian 12
- Alpine Linux
Docker Test Files
Located inscripts/docker/install-smoke/:
Adding New Scripts
When adding new scripts:- Location: Place in
src/praisonai/scripts/ - Permissions: Make executable with
chmod +x script.sh - Documentation: Update this page
- Testing: Add to CI/CD if applicable
TypeScript SDK Scripts
Thesrc/praisonai-ts/scripts/ folder holds Node scripts that run as part of the TypeScript SDK’s dual-build pipeline.
clean (prebuild)
- Runs before every build via the
prebuildhook (npm run build→prebuild→clean). - Implemented as a Node one-liner:
node -e "require('fs').rmSync('dist',{recursive:true,force:true})". - Needs no installed
devDependencies— it runs even beforenpm installhas populatednode_modules. This letsnpm cisucceed in a fresh worktree when a sibling package (e.g.praisonai-mobile) pullspraisonai-tsin via afile:link and triggers itspreparehook. force: truemakes it idempotent (no error whendist/is absent), andfs.rmSyncis cross-platform (Windows-safe).- Changed from
rimraf distin PR #4849.
src/praisonai-ts/package-lock.json is committed (since PR #4884) so that npm install in CI reproduces the exact dependency tree the mobile bundle gate measures. pnpm-lock.yaml is also kept for local pnpm workflows.esm-shim.js
- Runs after the ESM build (
npm run build:esm→tsc -p tsconfig.esm.json && node scripts/esm-shim.js). - Prepends a
createRequirebanner only to files that genuinely use CJS. - The banner is browser-safe: it uses guarded top-level
await import('module' | 'url' | 'path').catch(() => null), so a bundler defers the imports rather than failing on them. Node behaviour is byte-identical. - In a browser,
requireis stubbed to a function that throws only if a lazy provider path is actually taken — the shim imposes no runtime cost on the webview path. - Fixed in PR #4484; the previous static-import form broke browser bundles of
dist/esm/mobile.js. - Detection uses
stripStringsAndCommentsto blank literal text and comments, but keeps template-literal${...}interpolations intact so a realrequire(...)inside one is still detected. - Regression tests:
src/praisonai-ts/tests/unit/packaging/esm-shim-banner.test.ts.
webview-gate.mjs
- Inspects both the TypeScript sources (
src/mobile.ts,src/agent/simple.ts) and the built artifacts (dist/esm/mobile.js,dist/esm/agent/simple.js) whendist/exists. - On a fresh clone with no
dist/, the gate prints a note and continues with the source-only check. - CI runs
npm run buildbefore the gate, so the built-artifact check runs on every PR — the gate sees exactly what ships.
The two checks per entry
The
chrome58 check is the one to reach for when a merge suddenly turns praisonai/mobile unbuildable on Android 8. The most common cause is that a source file added a require() or a __dirname, which made scripts/esm-shim.js prepend the createRequire banner to the emitted ESM file — and the banner IS a top-level await, so the entry stops parsing at chrome58. The gate reports the file and line; the fix is to convert the require() to a static import (no cycle) or to await import(…) (inside a function, not at module scope).
Related
Local Development
Setting up dev environment
Testing
Running tests
ESM/CJS build and the createRequire banner

