CLI - Getting Started
The Loopress CLI (lps) is a Node.js command-line tool for version-controlling WordPress data and syncing it between your local machine and any WordPress instance.
Installation
Section titled “Installation”npm install -g @loopress/cliOr with pnpm:
pnpm add -g @loopress/cliVerify the installation:
lps --versionRequirements
Section titled “Requirements”- Node.js 18+
- A WordPress installation with the Code Snippets plugin active (for snippet commands)
- A WordPress Application Password for authentication
Configure a site
Section titled “Configure a site”Before running any command, register your WordPress site:
lps site configYou will be prompted for:
| Prompt | Description |
|---|---|
| Site name | A local identifier (e.g. production, staging) |
| WordPress URL | Full URL including scheme (https://example.com) |
| Username | Your WordPress administrator username |
| Application password | Generated in Users → Profile → Application Passwords |
Manage multiple sites
Section titled “Manage multiple sites”Loopress stores site configurations in ~/.config/loopress/sites.json and keeps track of the currently active site.
lps site config # Add or update a sitelps site switch # Interactively pick the active sitelps site remove <name> # Remove a saved siteAll commands operate against the active site unless overridden via environment variables.
Environment variable fallback
Section titled “Environment variable fallback”For CI/CD pipelines where interactive prompts are not available, you can bypass the site configuration entirely using environment variables:
export WP_URL=https://example.comexport WP_USERNAME=adminexport WP_APP_PASSWORD="xxxx xxxx xxxx xxxx xxxx xxxx"
lps snippets pushDry run
Section titled “Dry run”Most commands accept a --dryRun (-d) flag that shows what would happen without making any changes:
lps snippets push --dryRunlps snippets pull --dryRunlps acf pull --dryRun