Authors:
About
Pinoc is a command-line tool designed to make it easy to set up and manage Pinocchio projects on Solana. It automates common development tasks including project initialization, building, testing, and deployment with simple commands.
Features
- ๐ Fast Project Scaffolding - Create new projects with best practices in seconds
- ๐ Proper Directory Structure - Solana/Pinocchio development structure out of the box
- ๐จ Simple Commands - Build, test, and deploy with intuitive commands
- ๐งน Smart Project Cleaning - Clean build artifacts while preserving keypairs
- ๐ฆ Package Management - Add dependencies and search for Pinocchio packages
- ๐ป Comprehensive Testing - Built-in testing environment with mollusk-svm
- ๐ Automatic Keypair Management - Generate and manage program keypairs
- ๐ Program Key Sync - Keep your program IDs consistent with smart checking
- โ๏ธ Configuration Management - Use Pinoc.toml for deployment settings
Installation
From crates.io (Recommended)
From GitHub
From Source
-
Clone the repository
-
Build the tool
-
Install globally
Quick Start
# Install pinoc
# Create a new project
# Navigate to your project
# Build and test
# Deploy to Solana
# Create a new project without git initialization
# This will skip git repository initialization.
Usage
Available Commands
| Command | Description |
|---|---|
pinoc init <project-name> [--no-git] [--no-boilerplate] |
Initialize a new Pinocchio project (skip git init with --no-git, minimal structure with --no-boilerplate) |
pinoc build |
Build your Solana program |
pinoc test |
Run project tests |
pinoc deploy [--cluster] [--wallet] |
Deploy your program to Solana (uses Pinoc.toml config, optional overrides) |
pinoc clean [--no-preserve] |
Clean target directory (preserves keypairs by default) |
pinoc add <package-name> |
Add a package to your project |
pinoc search [query] |
Search for Pinocchio packages |
pinoc keys list |
List all program keypairs |
pinoc keys sync |
Sync program ID in lib.rs with keypair |
pinoc --help |
Get help and see all available commands |
pinoc help |
Display custom help banner with all commands |
Complete Workflow Example
# Create a new project
# Create a new project without git initialization
# Create a minimal project without tests and boilerplate
# Navigate to your project
# Build your project
# Run tests
# List program keys
# Sync program keys (checks consistency first)
# Clean build artifacts (preserves keypairs)
# Add a package
# Search for packages
# Get help
# Deploy your program
# Deploy with custom cluster and wallet
Project Structure
When you initialize a project with pinoc init, it creates the following structure:
my_project/
โโโ Cargo.toml # Project configuration with Pinocchio dependencies
โโโ README.md # Project documentation
โโโ .gitignore # Git ignore file
โโโ Pinoc.toml # Deployment configuration
โโโ src/
โ โโโ lib.rs # Library crate using no_std
โ โโโ entrypoint.rs # Program entrypoint
โ โโโ errors.rs # Error definitions
โ โโโ instructions/ # Program instructions
โ โ โโโ mod.rs
โ โ โโโ initialize.rs # Initialize instruction
โ โโโ states/ # Account state definitions
โ โโโ mod.rs
โ โโโ state.rs # State structure
โ โโโ utils.rs # State management utilities
โโโ tests/ # Test files
โ โโโ tests.rs # Unit tests using mollusk-svm
โโโ target/
โโโ deploy/
โโโ my_project-keypair.json # Generated program keypair
Minimal Project
When you initialize a project with pinoc init --no-boilerplate, it creates a minimal structure:
my_minimal_project/
โโโ Cargo.toml # Minimal configuration with only pinocchio dependency
โโโ README.md # Basic documentation
โโโ .gitignore # Git ignore file
โโโ Pinoc.toml # Deployment configuration
โโโ src/
โ โโโ lib.rs # Minimal program with just program ID and basic structure
โโโ target/
โโโ deploy/
โโโ my_minimal_project-keypair.json # Generated program keypair
Minimal Project Features:
- No Tests: No test directory or test dependencies
- No Boilerplate: No instructions, states, or utility files
- Essential Only: Just the core files needed to build and deploy
- Fast Setup: Perfect for quick prototypes or learning
Key Features in Detail
๐งน Smart Project Cleaning
The pinoc clean command intelligently manages your build artifacts:
# Clean target directory while preserving keypairs (default)
# Clean everything including keypairs
Why preserve keypairs? Your program keypair is essential for deployment. The default behavior ensures you don't accidentally lose your deployment credentials.
๐ฆ Package Management
Easily add dependencies and discover new packages:
# Add a package to your project
# Search for Pinocchio-related packages
๐ Automatic Keypair Management
- Generation: Keypairs are automatically created during project initialization
- Preservation: Clean commands preserve keypairs by default
- Security: Keypairs are stored securely in
target/deploy/
๐ Program Key Management
Manage your program keys with consistency checks:
# List all program keypairs
# Sync program ID in lib.rs with keypair
Key Sync Features:
- Consistency Check: Verifies if the program ID in
declare_id!matches the keypair's public key - Smart Updates: Only updates the file if there's a mismatch
- Clear Feedback: Shows current state and any changes made
- No Unnecessary Writes: Prevents file updates when keys are already consistent
Example Output:
# When keys are already consistent
# When keys need syncing
โ๏ธ Configuration Management
Pinoc uses a Pinoc.toml configuration file to manage deployment settings. This file is automatically created when you initialize a new project.
Pinoc.toml Structure:
[]
= "localhost"
= "~/.config/solana/id.json"
Configuration Options:
cluster: The Solana cluster URL to deploy to (e.g., "localhost", "devnet", "mainnet-beta")wallet: Path to your Solana wallet keypair file (supports~for home directory expansion)
Deployment Process:
When you run pinoc deploy, the tool will:
- Read the
Pinoc.tomlconfiguration file - Display the cluster and wallet being used
- Deploy your program using the specified settings
Command-Line Overrides:
You can override the configuration from Pinoc.toml using command-line arguments:
# Override cluster only
# Override wallet only
# Override both cluster and wallet
Example Deployment Output:
Customizing Configuration:
You can edit the Pinoc.toml file to change deployment settings, or use command-line arguments for one-time overrides:
# For mainnet deployment
[]
= "mainnet-beta"
= "~/.config/solana/mainnet-keypair.json"
# For local development
[]
= "localhost"
= "~/.config/solana/id.json"
Command-Line Override Examples:
# Use different cluster for this deployment
# Use different wallet for this deployment
# Override both settings
Prerequisites
Before using Pinoc, make sure you have the following installed:
- Rust and Cargo - Install Rust
- Solana CLI Tools - Install Solana CLI
- Git - For version control
Contributing
Contributions are welcome! Here's how you can contribute:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests to ensure everything works
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
-
Clone and Build
-
Install Locally
-
Test Your Changes
# Test the CLI # Create a test project
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- ๐ Documentation: This README and the Pinocchio documentation
- ๐ Issues: Report bugs and request features on GitHub Issues