Skip to content

CLI Reference

Complete reference for all commands available in the Pika CLI tool.

Terminal window
# Install globally
npm install -g pika-app
# Or use with npx (no installation)
npx pika-app --help

Available for all commands:

OptionDescription
--help, -hDisplay help information
--version, -vDisplay CLI version

Creates a new Pika chat application with interactive setup.

Usage:

Terminal window
pika create-app [name] [options]

Arguments:

ArgumentTypeRequiredDescription
namestringNoProject name (prompted if not provided)

Options:

OptionTypeDefaultDescription
-t, --template <template>stringdefaultTemplate to use (default, minimal, enterprise)
-d, --directory <directory>string./{name}Output directory for the project
--skip-installbooleanfalseSkip installing dependencies
--skip-gitbooleanfalseSkip initializing git repository

Examples:

Terminal window
# Interactive setup
pika create-app
# Create with specific name
pika create-app my-chat-app
# Use minimal template
pika create-app simple-chat --template minimal
# Custom directory
pika create-app --directory ./projects/my-chat-app
# Skip automatic steps
pika create-app --skip-install --skip-git

Templates:

  • default - Full-featured Pika app with all capabilities
  • minimal - Minimal setup with basic features only
  • enterprise - Enterprise template with advanced security and compliance features

Synchronizes your project with the latest Pika Framework updates while protecting your customizations.

Usage:

Terminal window
pika sync [options]

Options:

OptionTypeDefaultDescription
--version <version>stringlatestSpecific framework version to sync to
--dry-runbooleanfalsePreview changes without applying them
--forcebooleanfalseForce sync even if there are conflicts

Examples:

Terminal window
# Sync to latest version
pika sync
# Preview changes first (recommended)
pika sync --dry-run
# Sync to specific version
pika sync --version 1.2.0
# Force sync with conflicts
pika sync --force

Protected 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:

Terminal window
# 1. Check what will change
pika sync --dry-run
# 2. Commit your work
git add .
git commit -m "Save work before sync"
# 3. Perform sync
pika sync
# 4. Test changes
pnpm dev
# 5. Commit sync results
git add .
git commit -m "Sync to framework version X.Y.Z"

Manages custom markdown components for your chat application.

Usage:

Terminal window
pika component [action] [options]

Actions:

ActionDescription
add <name>Add a new custom component
listList all registered components
validateValidate component registry

Examples:

Terminal window
# Interactive component management
pika component
# Add a new component
pika component add order-status
# List all components
pika component list
# Validate component configuration
pika component validate

Generated 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 registry

Component 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>

Manages authentication configuration for your project.

Usage:

Terminal window
pika auth [action] [provider] [options]

Actions:

ActionDescription
setup <provider>Setup authentication provider
statusShow current authentication status

Providers:

ProviderDescriptionUse Case
mockSimple mock authenticationDevelopment and testing
auth-jsOAuth providers (Google, GitHub, etc.)Standard OAuth authentication
customCustom authentication systemExisting auth infrastructure
enterprise-ssoSAML/OIDC enterprise SSOEnterprise single sign-on

Examples:

Terminal window
# Interactive auth management
pika auth
# Setup Google OAuth via Auth.js
pika auth setup auth-js
# Setup custom auth
pika auth setup custom
# Check current auth status
pika auth status

Setup Process:

  1. Choose Provider - Select authentication strategy
  2. Configure Settings - Provider-specific configuration
  3. Install Dependencies - CLI auto-installs required packages
  4. Set Environment Variables - Configure provider credentials
  5. Test - Verify authentication works

Custom Auth Implementation:

After running pika auth setup custom, implement these methods in
apps/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>;
}

The CLI respects these environment variables:

VariableDescriptionDefault
DEBUGEnable debug logging-
PIKA_DEBUGEnable Pika-specific debug outputfalse
PIKA_HOMECustom Pika home directory~/.pika
NO_COLORDisable colored outputfalse

Debug Mode:

Terminal window
# Enable all debug logging
DEBUG=pika:* pika create-app
# Enable Pika debug only
PIKA_DEBUG=true pika sync

The CLI uses and creates these configuration files:

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"
]
}
FieldDescription
versionLast synced framework version
lastSyncISO 8601 timestamp of last sync
userProtectedAreasAdditional files to protect from updates
userUnprotectedAreasDefault protected files to allow updates

Generated during create-app with project names and feature configuration.

See Platform Settings Reference for complete documentation.

CodeMeaning
0Success
1General error
2Invalid arguments
3File system error
4Network error
5Validation error
Terminal window
# Solution 1: Install globally
npm install -g pika-app
# Solution 2: Use npx
npx pika-app --help
Terminal window
# On macOS/Linux, use sudo for global install
sudo npm install -g pika-app
# Or use a Node version manager (recommended)
nvm use 18
npm install -g pika-app
Terminal window
# View what would change
pika sync --dry-run
# Stash your changes
git stash
# Perform sync
pika sync
# Restore your changes
git stash pop
# Resolve any conflicts manually
Terminal window
# Check current status
pika auth status
# Reconfigure provider
pika auth setup <provider>
# Verify environment variables are set
cat .env.local
Terminal window
# Validate component registry
pika component validate
# List all components
pika component list
# Check component is registered in index.ts
  • 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:

Terminal window
node --version # Should be 18.0.0+
git --version # Should be installed
pnpm --version # Recommended
Terminal window
# Update to latest version
npm update -g pika-app
# Check current version
pika --version
# Or use npx to always get latest
npx pika-app@latest --help
Terminal window
# General help
pika --help
# Command-specific help
pika create-app --help
pika sync --help
pika component --help
pika auth --help
Terminal window
# Enable verbose logging
pika create-app --verbose
# Enable debug mode
DEBUG=* pika sync

The CLI can be used programmatically:

import { createApp, sync } from 'pika-app';
// Create a new app
await createApp({
name: 'my-app',
template: 'default',
directory: './my-app',
skipInstall: false,
skipGit: false
});
// Sync framework
await sync({
version: 'latest',
dryRun: false,
force: false
});