This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
PUP (Project Utilities & Packager) is a PHP CLI utility built by StellarWP for automating WordPress plugin/theme builds, packaging, and deployment processes. It's distributed as a PHP archive (phar) and uses Symfony Console components.
- PHP 7.2+ / 8.0+: Primary language
- Symfony Components: Console, Process, Filesystem (v5.4)
- Testing: Codeception 4.2 with CLI module
- Static Analysis: PHPStan level 8 (highest strictness)
- Build Tool: Box for creating phar archives
# Run all tests
composer run cr
# Run static analysis
composer run test:analysis
# Build the phar file
composer run build-phar
# Run a specific test
vendor/bin/codecept run cli <TestName># Build the project
./pup build [--dev]
# Run all checks
./pup check
# Create a zip package
./pup zip
# Run a workflow
./pup workflow <workflow-name>
# or
./pup do <workflow-name>- Entry Point:
pupscript instantiatesApp(extends Symfony Application) - Configuration: Loaded from
.puprcfile viaConfigclass - Commands: Located in
src/Commands/, each extendingCommandbase class - Workflows: Custom command sequences defined in
.puprcunderworkflowskey - Checks: Validation system in
src/Check/with built-in and custom checks
src/Commands/: All CLI commands (Build, Check, Clean, Package, Zip, etc.)src/Check/: Check system for validation (TBD finder, version conflicts)src/Filesystem/: File sync operations and utilitiessrc/Workflow/: Workflow management systemtests/cli/: Codeception CLI teststests/_data/: Test fixtures and fake projects for testing
- Command Pattern: Each command is a separate class implementing execute()
- Collection Pattern: Used for managing checks (
Check\Collection) - Process Execution: Uses Symfony Process for running external commands
- Configuration Merging:
.puprcfiles merge with defaults from.puprc-defaults
- CLI Tests: Test commands against fake projects in
tests/_data/ - Snapshot Testing: Uses codeception-snapshot-assertions for output validation
- Test Isolation: Each test uses temporary directories to avoid conflicts
- Build Phase: Runs commands from
.puprcbuildarray - Check Phase: Validates code (TBD comments, version conflicts)
- Package Phase: Copies files based on
.distfilespatterns - Zip Phase: Creates final archive excluding
.distignorepatterns
-
Phar Context: Code must work both as phar and regular files. Check
App::$is_pharwhen needed. -
Process Execution: Always use Symfony Process component for external commands, never shell_exec().
-
Configuration Priority: CLI arguments >
.puprc>.puprc-defaults -
Error Handling: Commands should throw exceptions for errors, not exit directly.
-
Output Formatting: Use Symfony Console helpers (Table, ProgressBar) for consistent UI.
-
Path Resolution: Always resolve paths relative to the project root, not the phar location.
-
Check System: Checks can be simple (command-based) or complex (PHP classes implementing CheckInterface).
-
Workflow System: Workflows support argument passthrough using
--separator.