Rawi (راوي) Documentation | Getting Started Building and installing the rawi CLI from source
Building and Installing Rawi CLI from Source
Section titled “Building and Installing Rawi CLI from Source”This guide describes how to build and install the latest release of the Rawi CLI from source on supported operating systems.
Why Build from Source?
Section titled “Why Build from Source?”- You want to contribute to Rawi or test unreleased features.
- You need to patch or customize the CLI.
- You are packaging Rawi for a distribution.
- You require a build for a non-standard environment.
Quick Steps
Section titled “Quick Steps”All commands are assumed to run from the root of the Rawi source directory.
-
Setup Requirements
- Node.js: v18.0.0 or higher
- pnpm (recommended), or npm/yarn
- Git (to clone the repository)
-
Clone the Repository
Terminal window git clone https://github.com/withrawi/rawi.gitcd rawi -
Install Dependencies
Terminal window pnpm installTerminal window npm installTerminal window yarn install -
Build the CLI
Terminal window pnpm buildTerminal window npm run buildTerminal window yarn build -
(Optional) Run Tests
Terminal window pnpm testTerminal window npm testTerminal window yarn test -
Link the CLI Locally This makes the
rawi
command available globally on your system for development and testing.Terminal window pnpm link --globalTerminal window npm linkTerminal window yarn link -
Verify Installation
Terminal window rawi --versionrawi info
Advanced: Custom Build/Install Locations
Section titled “Advanced: Custom Build/Install Locations”If you want to install Rawi in a custom location or as part of a CI/CD pipeline, you can use the following:
# Install dependencies and buildpnpm install && pnpm build
# Use npx to run without global installnpx rawi ask "Hello from source build!"
Workflow Example
Section titled “Workflow Example”# Clone, build, and link in one gogit clone https://github.com/withrawi/rawi.gitcd rawipnpm installpnpm buildpnpm link --global
# Now use Rawi anywhererawi ask "What is AstroJS Starlight?"
Troubleshooting
Section titled “Troubleshooting”- If you encounter issues, see Troubleshooting Guide.
- For permission errors, try running with
sudo
or adjust your npm global directory. - For dependency issues, ensure you are using Node.js 18+ and a supported package manager.