Complete reference for all commands available in the Pika CLI tool.
Installation
Section titled “Installation”# Install globallynpm install -g pika-app
# Or use with npx (no installation)npx pika-app --helpGlobal Options
Section titled “Global Options”Available for all commands:
| Option | Description |
|---|---|
--help, -h | Display help information |
--version, -v | Display CLI version |
Commands
Section titled “Commands”pika create-app
Section titled “pika create-app”Creates a new Pika chat application with interactive setup.
Usage:
pika create-app [name] [options]Arguments:
| Argument | Type | Required | Description |
|---|---|---|---|
name | string | No | Project name (prompted if not provided) |
Options:
| Option | Type | Default | Description |
|---|---|---|---|
-t, --template <template> | string | default | Template to use (default, minimal, enterprise) |
-d, --directory <directory> | string | ./{name} | Output directory for the project |
--skip-install | boolean | false | Skip installing dependencies |
--skip-git | boolean | false | Skip initializing git repository |
Examples:
# Interactive setuppika create-app
# Create with specific namepika create-app my-chat-app
# Use minimal templatepika create-app simple-chat --template minimal
# Custom directorypika create-app --directory ./projects/my-chat-app
# Skip automatic stepspika create-app --skip-install --skip-gitTemplates:
default- Full-featured Pika app with all capabilitiesminimal- Minimal setup with basic features onlyenterprise- Enterprise template with advanced security and compliance features
pika sync
Section titled “pika sync”Synchronizes your project with the latest Pika Framework updates while protecting your customizations.
Usage:
pika sync [options]Options:
| Option | Type | Default | Description |
|---|---|---|---|
--version <version> | string | latest | Specific framework version to sync to |
--dry-run | boolean | false | Preview changes without applying them |
--force | boolean | false | Force sync even if there are conflicts |
Examples:
# Sync to latest versionpika sync
# Preview changes first (recommended)pika sync --dry-run
# Sync to specific versionpika sync --version 1.2.0
# Force sync with conflictspika sync --forceProtected Areas:
The sync command never modifies:
apps/pika-chat/src/lib/server/auth-provider/apps/pika-chat/src/lib/client/features/chat/message-segments/custom-components/services/custom/apps/custom/- Environment files (
.env*) pika-config.ts.pika-sync.json- Any path starting with
custom-
Best Practice Workflow:
# 1. Check what will changepika sync --dry-run
# 2. Commit your workgit add .git commit -m "Save work before sync"
# 3. Perform syncpika sync
# 4. Test changespnpm dev
# 5. Commit sync resultsgit add .git commit -m "Sync to framework version X.Y.Z"pika component
Section titled “pika component”Manages custom markdown components for your chat application.
Usage:
pika component [action] [options]Actions:
| Action | Description |
|---|---|
add <name> | Add a new custom component |
list | List all registered components |
validate | Validate component registry |
Examples:
# Interactive component managementpika component
# Add a new componentpika component add order-status
# List all componentspika component list
# Validate component configurationpika component validateGenerated Files:
When adding a component named order-status, the CLI creates:
apps/pika-chat/src/lib/client/features/chat/└── message-segments/ └── custom-components/ ├── order-status.svelte # Component implementation └── index.ts # Updated registryComponent Template:
<script lang="ts"> export let orderId: string; export let status: string = 'pending';</script>
<div class="order-status"> <h3>Order #{orderId}</h3> <p>Status: {status}</p></div>
<style> .order-status { border: 1px solid #e2e8f0; padding: 16px; border-radius: 8px; }</style>pika auth
Section titled “pika auth”Manages authentication configuration for your project.
Usage:
pika auth [action] [provider] [options]Actions:
| Action | Description |
|---|---|
setup <provider> | Setup authentication provider |
status | Show current authentication status |
Providers:
| Provider | Description | Use Case |
|---|---|---|
mock | Simple mock authentication | Development and testing |
auth-js | OAuth providers (Google, GitHub, etc.) | Standard OAuth authentication |
custom | Custom authentication system | Existing auth infrastructure |
enterprise-sso | SAML/OIDC enterprise SSO | Enterprise single sign-on |
Examples:
# Interactive auth managementpika auth
# Setup Google OAuth via Auth.jspika auth setup auth-js
# Setup custom authpika auth setup custom
# Check current auth statuspika auth statusSetup Process:
- Choose Provider - Select authentication strategy
- Configure Settings - Provider-specific configuration
- Install Dependencies - CLI auto-installs required packages
- Set Environment Variables - Configure provider credentials
- Test - Verify authentication works
Custom Auth Implementation:
After running pika auth setup custom, implement these methods inapps/pika-chat/src/lib/server/auth-provider/custom-auth.ts:
interface AuthProvider { authenticate(): Promise<User>; logout(): Promise<void>; getCurrentUser(): Promise<User | null>; isAuthenticated(): Promise<boolean>;}Environment Variables
Section titled “Environment Variables”The CLI respects these environment variables:
| Variable | Description | Default |
|---|---|---|
DEBUG | Enable debug logging | - |
PIKA_DEBUG | Enable Pika-specific debug output | false |
PIKA_HOME | Custom Pika home directory | ~/.pika |
NO_COLOR | Disable colored output | false |
Debug Mode:
# Enable all debug loggingDEBUG=pika:* pika create-app
# Enable Pika debug onlyPIKA_DEBUG=true pika syncConfiguration Files
Section titled “Configuration Files”The CLI uses and creates these configuration files:
.pika-sync.json
Section titled “.pika-sync.json”Tracks sync status and protected areas.
{ "version": "1.0.0", "lastSync": "2024-01-15T10:00:00Z", "userProtectedAreas": [ "my-custom-file.ts", "apps/my-custom-app/" ], "userUnprotectedAreas": [ "apps/pika-chat/infra/bin/pika-chat.ts" ]}| Field | Description |
|---|---|
version | Last synced framework version |
lastSync | ISO 8601 timestamp of last sync |
userProtectedAreas | Additional files to protect from updates |
userUnprotectedAreas | Default protected files to allow updates |
pika-config.ts
Section titled “pika-config.ts”Generated during create-app with project names and feature configuration.
See Platform Settings Reference for complete documentation.
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | Success |
1 | General error |
2 | Invalid arguments |
3 | File system error |
4 | Network error |
5 | Validation error |
Troubleshooting
Section titled “Troubleshooting”Command Not Found
Section titled “Command Not Found”# Solution 1: Install globallynpm install -g pika-app
# Solution 2: Use npxnpx pika-app --helpPermission Errors
Section titled “Permission Errors”# On macOS/Linux, use sudo for global installsudo npm install -g pika-app
# Or use a Node version manager (recommended)nvm use 18npm install -g pika-appSync Conflicts
Section titled “Sync Conflicts”# View what would changepika sync --dry-run
# Stash your changesgit stash
# Perform syncpika sync
# Restore your changesgit stash pop
# Resolve any conflicts manuallyAuthentication Setup Issues
Section titled “Authentication Setup Issues”# Check current statuspika auth status
# Reconfigure providerpika auth setup <provider>
# Verify environment variables are setcat .env.localComponent Not Rendering
Section titled “Component Not Rendering”# Validate component registrypika component validate
# List all componentspika component list
# Check component is registered in index.tsSystem Requirements
Section titled “System Requirements”- Node.js: 18.0.0 or higher
- Git: Required for project initialization and sync
- Package Manager: npm (included), pnpm (recommended), or yarn
- Operating System: macOS, Linux, or Windows
Check Requirements:
node --version # Should be 18.0.0+git --version # Should be installedpnpm --version # RecommendedUpdating the CLI
Section titled “Updating the CLI”# Update to latest versionnpm update -g pika-app
# Check current versionpika --version
# Or use npx to always get latestnpx pika-app@latest --helpGetting Help
Section titled “Getting Help”Command Help
Section titled “Command Help”# General helppika --help
# Command-specific helppika create-app --helppika sync --helppika component --helppika auth --helpVerbose Output
Section titled “Verbose Output”# Enable verbose loggingpika create-app --verbose
# Enable debug modeDEBUG=* pika syncSupport Resources
Section titled “Support Resources”- Documentation: https://pika.tools
- GitHub Issues: Report bugs and request features
- Discussions: Community Q&A
Related Documentation
Section titled “Related Documentation”- Quick Start - Get started with Pika
- Installation Guide - Detailed installation instructions
- Project Structure - Understanding the generated project
- Customization Guide - Customizing your Pika app
- Authentication Setup - Authentication configuration
API for Programmatic Use
Section titled “API for Programmatic Use”The CLI can be used programmatically:
import { createApp, sync } from 'pika-app';
// Create a new appawait createApp({ name: 'my-app', template: 'default', directory: './my-app', skipInstall: false, skipGit: false});
// Sync frameworkawait sync({ version: 'latest', dryRun: false, force: false});