npm package: @snipkode/apkit
Description: Standalone CLI for SaaS APK Builder - Build Android apps with ease
Latest version: 0.3.0

# Apkit CLI

Standalone CLI for SaaS APK Builder - Build Android apps with ease.

## 🚀 Installation

```bash
# Install globally
npm install -g @snipkode/apkit

# Or use via npx
npx @snipkode/apkit <command>
```

## 📦 Usage

### Create New Project

```bash
# Create from default template
apkit create my-app

# Create from custom template
apkit create my-app --template git@github.com:user/template.git

# Create using HTTPS
apkit create my-app --https
```

### Initialize in Existing Project

```bash
# Navigate to your Android project
cd my-android-project

# Initialize Apkit
apkit init

# Start developing
./dev.sh
```

### Commands

| Command | Description |
|---------|-------------|
| `apkit create` | Create new project from template |
| `apkit init` | Initialize Apkit in current directory |
| `apkit dev` | Run development mode with hot reload |
| `apkit build` | Build debug APK |
| `apkit build:release` | Build release APK with signing |
| `apkit build:aab` | Build AAB for Google Play Store |
| `apkit doctor` | Check environment setup |
| `apkit keystore` | Create/manage signing keystore |
| `apkit clean` | Clean build artifacts |
| `apkit install` | Install APK to connected device |
| `apkit serve` | Serve IDE UI (coming soon) |

### Examples

```bash
# Development mode with hot reload
apkit dev

# Build debug APK
apkit build

# Build release APK (signed)
apkit build:release

# Build AAB for Play Store
apkit build:aab

# Check environment
apkit doctor

# Create keystore
apkit keystore --create

# Clean build
apkit clean --all
```

## 📁 Structure

```
packages/cli/
├── bin/
│   └── apkit.js          # CLI entry point
├── src/
│   └── scripts/          # Embedded shell scripts
│       ├── build.sh
│       ├── dev.sh
│       ├── keystore.sh
│       ├── setup-check.sh
│       ├── install-apk.sh
│       └── clean.sh
├── package.json
└── README.md
```

## 🔧 Development

```bash
# Navigate to CLI package
cd packages/cli

# Install dependencies
npm install

# Link globally for testing
npm link

# Test CLI
apkit --help
apkit init
```

## 🎯 How It Works

1. **`apkit init`** copies embedded scripts to your project's `scripts/` directory
2. Wrapper scripts in project root call the scripts in `scripts/`
3. All build logic is in the shell scripts - CLI is just an orchestrator
4. Scripts are self-contained and can run independently

## 📝 Script Options

### build.sh
- `--debug, -d` - Build debug APK (default)
- `--release, -r` - Build release APK
- `--aab, -a` - Build AAB bundle
- `--no-sign` - Skip signing
- `--install, -i` - Auto-install after build

### dev.sh
- `--no-inotify` - Use polling instead of inotify
- `--interval <sec>` - Polling interval
- `--package <pkg>` - App package name

### keystore.sh
- `--create, -c` - Create new keystore
- `--info, -i` - View keystore info
- `--check, -t` - Check signing tools
- `--sign, -s` - Sign APK manually

## 📋 Requirements

- Java 17+
- ADB (Android Debug Bridge)
- Gradle wrapper (included in Android projects)
- Optional: `inotify-tools` for instant file watching

Install on Termux:
```bash
pkg install openjdk-17 git android-tools inotify-tools apksigner
```

## 🔮 Future Features

- **`apkit create <name>`** - Create new project from template
- **`apkit serve`** - Serve IDE UI for web-based development
- **Custom templates** - Support for project templates
- **Plugin system** - Extend CLI with custom commands

## 📄 License

MIT