Skip to content

Command Cheatsheets

Quick reference for common commands. Bookmark this page.

Quick Reference Updated

Wrangler (Cloudflare Workers CLI)

Development

Command Description
npx wrangler dev Start local dev server (default: port 8787)
npx wrangler dev --env local Start with local environment config
npx wrangler dev --port 8788 Use custom port
npx wrangler dev --remote Debug against remote environment

🔥 FireBreak Tip

Add --remote when debugging issues that only happen in production. It uses your deployed worker.

Deployment

Command Description
npx wrangler deploy Deploy to production
npx wrangler deploy --env staging Deploy to staging environment
npx wrangler deploy --dry-run Test deployment without publishing
npx wrangler rollback Rollback to previous version

Debugging

Command Description
npx wrangler tail Stream live logs from deployed worker
npx wrangler tail --env staging Tail logs from staging
npx wrangler tail --format json JSON-formatted logs
npx wrangler kv:key get <key> Get KV value for debugging

Secrets Management

Command Description
npx wrangler secret put API_KEY Set a secret (will prompt for value)
npx wrangler secret list List all secret names
npx wrangler secret delete API_KEY Delete a secret

âš  Secrets vs Environment Variables

Use secrets for sensitive data (API keys, tokens). Use environment variables for non-sensitive config (feature flags, URLs).


Git Workflow

Daily Workflow

Command Description
git status Check what changed
git add -A Stage all changes
git commit -m "message" Commit with message
git push Push to remote
git pull Pull latest changes

Branching

Command Description
git checkout -b feature/my-feature Create new feature branch
git checkout main Switch to main branch
git merge feature/my-feature Merge feature into current branch
git branch -d feature/my-feature Delete branch locally

🤓 Branch Naming Convention

We use prefixes: - feature/ - New features - fix/ - Bug fixes - docs/ - Documentation changes - refactor/ - Code refactoring - test/ - Test additions/changes

Undoing Changes

Command Description
git reset HEAD~1 Undo last commit (keep changes)
git reset --hard HEAD~1 Undo last commit (discard changes)
git checkout -- file.ts Discard changes to file
git revert <commit> Create new commit that undoes a commit

âš  Destructive Commands

--hard and --force can't be undone. Double-check before running.


npm (Package Management)

Package Management

Command Description
npm install Install all dependencies from package.json
npm install <package> Install a package
npm install <package> --save-dev Install as dev dependency
npm uninstall <package> Remove a package
npm update Update all packages

Scripts

Command Description
npm run dev Start development server
npm run build Build for production
npm test Run tests
npm run lint Run linter
npm run format Format code (Prettier)

🔥 FireBreak Tip

Check available scripts: npm run

Troubleshooting

Command Description
rm -rf node_modules package-lock.json && npm install Nuclear option - reinstall everything
npm cache clean --force Clear npm cache
npm audit Check for security vulnerabilities
npm audit fix Auto-fix vulnerabilities

Python / pip

Package Management

Command Description
pip install -r requirements.txt Install all requirements
pip install <package> Install a package
pip install <package>==1.2.3 Install specific version
pip uninstall <package> Remove a package
pip list List installed packages
pip freeze > requirements.txt Save current packages to file

Virtual Environments

Command Description
python -m venv venv Create virtual environment
source venv/bin/activate Activate (Linux/Mac)
venv\Scripts\activate Activate (Windows)
deactivate Deactivate virtual environment

🤓 Why Virtual Environments?

Isolate project dependencies. Prevents version conflicts between projects.


pytest (Testing)

Running Tests

Command Description
pytest Run all tests
pytest tests/unit/ Run tests in directory
pytest tests/test_risk.py Run specific test file
pytest -k "test_calculate" Run tests matching pattern
pytest -v Verbose output
pytest -x Stop on first failure
pytest --lf Run last failed tests

Coverage

Command Description
pytest --cov Run with coverage report
pytest --cov=backend Coverage for specific module
pytest --cov --cov-report=html Generate HTML coverage report

🔥 FireBreak Tip

Aim for >80% coverage. Don't game the metric, write meaningful tests.


Playwright (E2E Testing)

Running Tests

Command Description
npx playwright test Run all E2E tests
npx playwright test --headed Run with browser visible
npx playwright test --debug Run in debug mode
npx playwright test --project=chromium Run on specific browser
npx playwright test tests/login.spec.ts Run specific test file

Debugging

Command Description
npx playwright codegen Record new test
npx playwright show-report View last test report
npx playwright test --trace on Record trace for debugging

MkDocs (Documentation)

Development

Command Description
mkdocs serve Start local docs server (port 8000)
mkdocs build Build static site to site/
mkdocs build --strict Build with stricter error checking

Deployment

Command Description
mkdocs gh-deploy Deploy to GitHub Pages
mike deploy v3.0 latest Deploy versioned docs
mike set-default latest Set default version

Common Task Combinations

Start Full Stack Locally

# Terminal 1: Backend
cd backend && npx wrangler dev --env local

# Terminal 2: Frontend
cd frontend/core && npm run dev

# Terminal 3: Watch tests
cd backend && pytest --watch

Deploy Everything to Staging

# Backend
cd backend && npx wrangler deploy --env staging

# Frontend
cd frontend/core && npm run build && npx wrangler pages deploy dist --env staging

# Run smoke tests
cd qa && npx playwright test tests/smoke/ --env staging

Clean Slate (When Nothing Works)

# Backend
cd backend
rm -rf node_modules package-lock.json
npm install
cd ..

# Frontend
cd frontend/core
rm -rf node_modules package-lock.json dist
npm install
cd ../..

# Python
cd backend
rm -rf venv
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt -r requirements-dev.txt
cd ..

# Now try again

☕ The Nuclear Option

When in doubt, delete node_modules and start fresh. It fixes more than you'd expect.


Keyboard Shortcuts (VS Code)

General

Shortcut Description
Cmd+P / Ctrl+P Quick file open
Cmd+Shift+P / Ctrl+Shift+P Command palette
Cmd+B / Ctrl+B Toggle sidebar
Cmd+J / Ctrl+J Toggle terminal

Editing

Shortcut Description
Cmd+D / Ctrl+D Select next occurrence
Cmd+Shift+L / Ctrl+Shift+L Select all occurrences
Alt+Up/Down Move line up/down
Shift+Alt+Up/Down Copy line up/down
Cmd+/ / Ctrl+/ Toggle line comment

✅ Pro Tip

Print this page or keep it open in a tab. You'll reference it daily.

Related Pages: - Glossary - Definitions and explanations - CLI Tools Reference - Full CLI documentation - Configuration Reference - All config options