Command Overview
pb-cli provides six primary commands for managing the complete development lifecycle:Default
Build frontend + start dev server
--install
Install dependencies + build + run
--build-only
Build frontend + generate specs
--run-only
Start server without building
--production
Full production build to dist/
--test-only
Run tests with coverage reports
Default Mode (Development)
What It Does
- Validates system requirements (Go, Node.js, npm)
- Builds frontend assets (
npm run build) - Copies build output to
pb_public/ - Prepares server environment
- Starts development server (
go run ./cmd/server --dev serve)
Use Cases
Standard Development Workflow
Standard Development Workflow
Use this as your primary development command. It ensures frontend changes are built before the server starts.Server runs at
http://127.0.0.1:8090 by default.- Admin panel:
/_/ - pb-ext dashboard:
/_/_
First Time Setup
First Time Setup
When cloning a repository for the first time, use
--install instead:Output
In development mode, OpenAPI specs are generated at runtime via AST parsing—no disk files needed.
—install
What It Does
- Installs Go dependencies (
go mod tidy,go mod download) - Installs npm dependencies (
npm ciornpm install) - Builds frontend assets
- Starts development server
Use Cases
Fresh Clone
Fresh Clone
First command to run after cloning a repository:
After Dependency Updates
After Dependency Updates
When
package.json or go.mod changes:Clean Environment
Clean Environment
Reset dependencies after corruption or conflicts:
Dependency Installation Logic
Go Dependencies:package.json exists):
—build-only
What It Does
- Validates system requirements
- Builds frontend assets
- Generates OpenAPI specs (
--generate-specs-dir) - Validates OpenAPI specs (
--validate-specs-dir) - Exits without starting server
Use Cases
CI/CD Pipeline
CI/CD Pipeline
Build and validate assets in continuous integration:
Frontend Development
Frontend Development
Rebuild frontend after changes without restarting the server:Terminal 1:Terminal 2 (when frontend changes):Refresh browser to see changes.
Pre-commit Hook
Pre-commit Hook
Validate builds before committing:
OpenAPI Spec Generation
This command generates versioned OpenAPI JSON files:—run-only
What It Does
- Validates system requirements
- Validates server setup (checks
cmd/server/main.go) - Prepares server environment (creates
pb_public/if missing) - Starts development server without building frontend
Use Cases
Backend-Only Development
Backend-Only Development
When working exclusively on Go code:No frontend build overhead—server starts immediately.
Rapid Restart Cycles
Rapid Restart Cycles
During debugging when frontend hasn’t changed:
Separate Build Process
Separate Build Process
Use with external frontend dev server:Terminal 1 (frontend dev server):Terminal 2 (backend server):
—production
What It Does
- Cleans and creates
dist/directory - Validates system requirements
- Installs dependencies (if
--installalso specified) - Builds frontend for production
- Generates and validates OpenAPI specs
- Compiles optimized server binary
- Copies all assets to
dist/ - Runs test suite with coverage
- Creates production archive (
.tar.gz)
Use Cases
Deployment Build
Deployment Build
Create production-ready artifacts for deployment:Deploy the
dist/ directory to your server.Release Pipeline
Release Pipeline
Automated release builds in CI/CD:
Custom Output Directory
Custom Output Directory
Specify a different output directory:Output:
release/ instead of dist/Production Build Output
Binary Optimization
The production binary is compiled with:-s: Strip symbol table (reduces debugging info)-w: Strip DWARF debugging information
For deployment automation, see the pb-deployer project.
—test-only
What It Does
- Validates system requirements
- Auto-discovers test packages (walks project directory)
- Runs tests with coverage tracking
- Generates multiple report formats:
test-summary.txt- Human-readable summarytest-report.json- Machine-readable JSONcoverage.html- Interactive HTML coverage reportcoverage-summary.txt- Function-level coverage
Use Cases
Pre-commit Validation
Pre-commit Validation
Verify all tests pass before committing:Add to pre-commit hook:
CI/CD Testing
CI/CD Testing
Automated testing in continuous integration:
Coverage Analysis
Coverage Analysis
Generate detailed coverage reports:
Test Discovery
pb-cli automatically discovers test packages by:- Walking the project directory
- Finding all
*_test.gofiles - Extracting unique package paths
- Skipping:
vendor/,node_modules/,dist/,pb_data/,pb_public/,frontend/
Output Example
Report Formats
test-summary.txt:Interactive HTML report with line-by-line coverage visualization
—help
Combining Flags
Install + Default
Production + Custom Output
release/ instead of dist/.
Troubleshooting
Command not found
Command not found
Problem: Or use local execution:
pb-cli: command not foundSolution: Ensure $GOPATH/bin is in your PATH:Frontend build failed
Frontend build failed
Problem:
npm run build failedSolution:- Check
package.jsonexists infrontend/ - Run
npm installmanually to check for errors - Verify Node.js version:
node --version - Check build script exists in
package.json:
Server compilation failed
Server compilation failed
Problem:
go build failedSolution:- Run
go mod tidyto resolve dependencies - Verify
cmd/server/main.goexists - Check Go version:
go version(requires 1.19+) - Review compiler errors for missing imports
Permission denied
Permission denied
Problem:
permission denied when writing to pb_public/ or dist/Solution:Tests failing in CI but passing locally
Tests failing in CI but passing locally
Problem: Tests pass locally but fail in CI pipelineSolution:
- Check for environment-specific dependencies
- Ensure CI uses same Go/Node versions:
- Review test isolation (check for shared state)