pinoc 0.1.7

A CLI tool for setting up pinocchio program project
<div align="center">
  <img src="assets/logo.png" alt="Pinoc CLI Logo" width="20%">
  <h1>Pinoc</h1>
  <p><strong>Setup Solana Pinocchio projects blazingly fast โšก</strong></p>

[![Crates.io](https://img.shields.io/crates/v/pinoc)](https://crates.io/crates/pinoc)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-yellow.svg)](https://opensource.org/licenses/Apache-2.0)
[![Rust](https://img.shields.io/badge/rust-1.70+-blue.svg)](https://www.rust-lang.org)
[![Downloads](https://img.shields.io/crates/d/pinoc)](https://crates.io/crates/pinoc)

**Built by:**

  <a class="header-badge" target="_blank" href="https://twitter.com/AyushAgr91">
    <img alt="Twitter" src="https://img.shields.io/badge/@AyushAgr91-000000?style=for-the-badge&logo=x&logoColor=white">
  </a>
  <a class="header-badge" target="_blank" href="https://twitter.com/4rjunc">
    <img alt="Twitter" src="https://img.shields.io/badge/@4rjunc-000000?style=for-the-badge&logo=x&logoColor=white">
  </a>
</div>

---

## ๐Ÿš€ What is Pinoc?

A modern Rust CLI to bootstrap Solana [Pinocchio](https://github.com/anza-xyz/pinocchio) programs with built-in build, deploy, and testing tools.

### Why Pinoc?

- **Zero Configuration**: Get started in seconds with sensible defaults
- **Best Practices**: Project structure follows Solana development conventions
- **Developer Experience**: Intuitive commands that feel natural
- **Production Ready**: Built-in testing, deployment, and key management

## โœจ Key Features

- ๐Ÿ—๏ธ **Instant Project Scaffolding** - Create production-ready projects in seconds
- ๐Ÿ“ **Optimized Structure** - Best-practice directory layout out of the box
- ๐Ÿ”จ **Unified Commands** - Build, test, and deploy with simple commands
- ๐Ÿงน **Smart Cleaning** - Clean build artifacts while preserving keypairs
- ๐Ÿ“ฆ **Package Discovery** - Find and add Pinocchio packages effortlessly
- ๐Ÿงช **Built-in Testing** - Comprehensive testing with mollusk-svm
- ๐Ÿ” **Keypair Management** - Automatic generation and secure storage
- ๐Ÿ”‘ **Program ID Sync** - Keep your program IDs consistent automatically
- โš™๏ธ **Configuration Management** - Simple deployment configuration with Pinoc.toml

## ๐Ÿ“ฆ Installation

### Quick Install (Recommended)

```bash
cargo install pinoc
```

### Alternative Methods

<details>
<summary>From GitHub (Latest)</summary>

```bash
cargo install --git https://github.com/a91y/pinoc --force
```

</details>

<details>
<summary>From Source</summary>

```bash
git clone https://github.com/a91y/pinoc.git
cd pinoc
cargo build --release
cargo install --path .
```

</details>

## ๐ŸŽฏ Quick Start

```bash
# Install pinoc
cargo install pinoc

# Create a new project
pinoc init my_awesome_app

# Navigate to your project
cd my_awesome_app

# Build and test
pinoc build
pinoc test

# Deploy to Solana
pinoc deploy
```

That's it! You now have a fully functional Solana program ready for development.

## ๐Ÿ“‹ Command Reference

| Command                | Description           | Example                         |
| ---------------------- | --------------------- | ------------------------------- |
| `pinoc init <name>`    | Create a new project  | `pinoc init my_app`             |
| `pinoc build`          | Build your program    | `pinoc build`                   |
| `pinoc test`           | Run tests             | `pinoc test`                    |
| `pinoc deploy`         | Deploy to Solana      | `pinoc deploy --cluster devnet` |
| `pinoc clean`          | Clean build artifacts | `pinoc clean`                   |
| `pinoc add <package>`  | Add a package         | `pinoc add some_package`        |
| `pinoc search [query]` | Search packages       | `pinoc search database`         |
| `pinoc keys list`      | List program keypairs | `pinoc keys list`               |
| `pinoc keys sync`      | Sync program IDs      | `pinoc keys sync`               |
| `pinoc help`           | Show help             | `pinoc help`                    |

### Command Options

- `pinoc init <name> --no-git` - Skip git initialization
- `pinoc init <name> --no-boilerplate` - Create minimal project structure
- `pinoc clean --no-preserve` - Clean everything including keypairs
- `pinoc deploy --cluster <cluster> --wallet <path>` - Override deployment settings

## ๐Ÿ“‚ Project Structure

### Standard Project

```
my_project/
โ”œโ”€โ”€ Cargo.toml              # Project configuration
โ”œโ”€โ”€ README.md               # Documentation
โ”œโ”€โ”€ .gitignore              # Git ignore rules
โ”œโ”€โ”€ Pinoc.toml              # Deployment configuration
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ lib.rs              # Main library
โ”‚   โ”œโ”€โ”€ entrypoint.rs       # Program entrypoint
โ”‚   โ”œโ”€โ”€ errors.rs           # Error definitions
โ”‚   โ”œโ”€โ”€ instructions/       # Program instructions
โ”‚   โ”‚   โ”œโ”€โ”€ mod.rs
โ”‚   โ”‚   โ””โ”€โ”€ initialize.rs
โ”‚   โ””โ”€โ”€ states/             # Account states
โ”‚       โ”œโ”€โ”€ mod.rs
โ”‚       โ”œโ”€โ”€ state.rs
โ”‚       โ””โ”€โ”€ utils.rs
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ tests.rs            # Unit tests
โ””โ”€โ”€ target/deploy/
    โ””โ”€โ”€ my_project-keypair.json  # Program keypair
```

### Minimal Project (`--no-boilerplate`)

Perfect for quick prototypes or learning:

```
my_minimal_project/
โ”œโ”€โ”€ Cargo.toml              # Minimal configuration
โ”œโ”€โ”€ README.md               # Basic documentation
โ”œโ”€โ”€ .gitignore              # Git ignore rules
โ”œโ”€โ”€ Pinoc.toml              # Deployment configuration
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ lib.rs              # Minimal program structure
โ””โ”€โ”€ target/deploy/
    โ””โ”€โ”€ my_minimal_project-keypair.json
```

## ๐Ÿ”ง Advanced Usage

### Configuration Management

Pinoc uses `Pinoc.toml` for deployment settings:

```toml
[provider]
cluster = "localhost"
wallet = "~/.config/solana/id.json"
```

Override settings per deployment:

```bash
# Deploy to devnet with custom wallet
pinoc deploy --cluster devnet --wallet ./custom-keypair.json
```

### Key Management

Keep your program IDs synchronized:

```bash
# Check key consistency
pinoc keys list

# Sync program ID in lib.rs with keypair
pinoc keys sync
```

Example output:

```
โœ… Program key is already consistent!
๐Ÿ”‘ Program ID: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
๐Ÿ“ No update needed in src/lib.rs
```

### Smart Cleaning

Clean build artifacts while preserving important files:

```bash
# Clean target directory (preserves keypairs)
pinoc clean

# Clean everything including keypairs
pinoc clean --no-preserve
```

## ๐Ÿ”— Prerequisites

Ensure you have these tools installed:

- **Rust** (1.70+) - [Install here]https://rustup.rs/
- **Solana CLI** - [Install guide]https://docs.solana.com/cli/install-solana-cli-tools
- **Git** - For version control

## ๐Ÿค Contributing

We welcome contributions! Here's how to get started:

1. **Fork** the repository
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
3. **Make** your changes
4. **Test** thoroughly
5. **Commit** with clear messages (`git commit -m 'Add amazing feature'`)
6. **Push** to your branch (`git push origin feature/amazing-feature`)
7. **Open** a Pull Request

### Development Setup

```bash
git clone https://github.com/a91y/pinoc.git
cd pinoc
cargo build --release
cargo install --path .

# Test your changes
pinoc init test-project
cd test-project
pinoc build
```

## ๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ†˜ Support & Community

- ๐Ÿ“– **Documentation**: [Pinocchio Docs]https://github.com/anza-xyz/pinocchio
- ๐Ÿ› **Issues**: [GitHub Issues]https://github.com/a91y/pinoc/issues
- ๐Ÿ’ฌ **Discussions**: [GitHub Discussions]https://github.com/a91y/pinoc/discussions
- ๐Ÿ“ฆ **Crates.io**: [pinoc]https://crates.io/crates/pinoc

---

<div align="center">
  <p>Made with โค๏ธ by the Solana community</p>
  <p>โญ Star us on GitHub if Pinoc helps you build faster!</p>
</div>