home / skills / openclaw / skills / frappecli

frappecli skill

/skills/pasogott/frappecli

This skill helps you manage Frappe and ERPNext instances via a powerful CLI, simplifying sites, documents, files, reports, and RPC calls.

npx playbooks add skill openclaw/skills --skill frappecli

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.3 KB
---
name: frappecli
version: 0.1.0
description: CLI for Frappe Framework / ERPNext instances. Use when user asks about "Frappe", "ERPNext", "doctypes", "Frappe API", or needs to manage documents, files, reports, or call RPC methods on a Frappe site.
tools: [bash]
---

# frappecli

CLI for managing Frappe Framework instances via REST API.

## Installation

```bash
brew tap pasogott/tap
brew install frappecli
```

Or from source:
```bash
git clone https://github.com/pasogott/frappecli.git
cd frappecli && uv sync && uv pip install -e .
```

## Configuration

Create `~/.config/frappecli/config.yaml`:

```yaml
sites:
  production:
    url: https://erp.company.com
    api_key: your_api_key
    api_secret: your_api_secret
  staging:
    url: https://staging.company.com
    api_key: your_staging_key
    api_secret: your_staging_secret

default_site: production
```

## Commands

### Site Management
```bash
frappecli site doctypes                    # List all doctypes
frappecli site doctypes --module "Core"    # Filter by module
frappecli site info "User"                 # Get doctype details
```

### Document CRUD
```bash
# List documents
frappecli doc list Customer
frappecli doc list Customer --filters '{"status":"Active"}' --limit 10

# Get single document
frappecli doc get Customer CUST-001
frappecli doc get Customer CUST-001 --fields name,customer_name,status

# Create document
frappecli doc create Customer --data '{"customer_name":"Acme","customer_type":"Company"}'

# Update document
frappecli doc update Customer CUST-001 --data '{"status":"Inactive"}'

# Delete document
frappecli doc delete Customer CUST-001
```

### File Management
```bash
# Upload file (private by default)
frappecli file upload invoice.pdf --doctype "Sales Invoice" --docname "INV-001"

# Upload public file
frappecli file upload logo.png --public

# Download file
frappecli file download /private/files/invoice.pdf -o ./downloads/

# List files for document
frappecli file list --doctype "Sales Invoice" --docname "INV-001"
```

### Reports
```bash
# Run report (JSON output)
frappecli report run "General Ledger" --filters '{"company":"My Company"}'

# Export to CSV
frappecli report run "Accounts Receivable" --format csv -o report.csv
```

### RPC Methods
```bash
# Call custom method
frappecli rpc frappe.ping

# With arguments
frappecli rpc myapp.api.process_data --args '{"doc_id":"DOC-001"}'
```

### Multi-Site
```bash
# Use specific site
frappecli --site staging doc list Customer

# Switch default site
frappecli config set default_site staging
```

## Output Formats

```bash
frappecli doc list Customer --format table   # Pretty table (default)
frappecli doc list Customer --format json    # JSON
frappecli doc list Customer --format csv     # CSV
```

## Examples

### Bulk Operations
```bash
# Export all active customers
frappecli doc list Customer --filters '{"status":"Active"}' --format csv > customers.csv

# Get document with child tables
frappecli doc get "Sales Invoice" INV-001 --fields '*'
```

### Integration with jq
```bash
# Get customer names only
frappecli doc list Customer --format json | jq -r '.[].customer_name'

# Count by status
frappecli doc list Customer --format json | jq 'group_by(.status) | map({status: .[0].status, count: length})'
```

## Links

- **Repository:** https://github.com/pasogott/frappecli
- **Homebrew:** `brew install pasogott/tap/frappecli`

Overview

This skill provides a command-line interface for managing Frappe Framework and ERPNext sites via the REST API. It consolidates site management, document CRUD, file handling, reports, and RPC calls into a single tool. Use it to automate routine admin tasks, bulk operations, or integrate Frappe interactions into scripts and CI pipelines.

How this skill works

The CLI reads a local configuration with named site entries (URL, api_key, api_secret) and targets a default or specified site for requests. It maps common Frappe REST endpoints into intuitive commands for listing doctypes, manipulating documents, uploading/downloading files, running reports, and invoking RPC methods. Output supports table, JSON, and CSV formats for easy scripting and human reading.

When to use it

  • Perform CRUD operations on Doctypes and documents from the terminal or scripts.
  • Upload, download, or list files attached to Frappe documents.
  • Run saved reports or export report results to CSV for analysis.
  • Call custom RPC methods on a site without writing client code.
  • Manage multiple Frappe/ERPNext environments (production, staging) from one config.

Best practices

  • Store site credentials in the config file (~/.config/frappecli/config.yaml) and avoid embedding secrets in scripts.
  • Use --format json for piping output to jq or other processors in automation.
  • Test RPC and update commands on staging before running against production.
  • Limit result sets with --limit and filters to avoid large payloads and timeouts.
  • Use named sites and frappecli --site to target non-default environments safely.

Example use cases

  • Export all active customers to CSV for data migration: doc list Customer --filters '{"status":"Active"}' --format csv > customers.csv
  • Bulk-update document status using a script that calls doc update for each ID.
  • Upload invoice PDFs to their Sales Invoice documents during an invoicing workflow.
  • Run the General Ledger report filtered by company and save JSON for reconciliation scripts.
  • Invoke a custom server method for data processing: rpc myapp.api.process_data --args '{"doc_id":"DOC-001"}'

FAQ

How do I configure multiple sites?

Add multiple entries under sites in ~/.config/frappecli/config.yaml and set default_site, or use --site to target a specific site.

Can I use this tool in CI pipelines?

Yes. Use JSON/CSV output formats and store API keys as secure variables; limit results and test on staging first.