This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
PHP CLI tool for Buddy.works CI/CD pipelines, built on buddy-works/buddy-works-php-api and symfony/console. Package name: jtsternberg/buddy-cli.
- Use 'bd' for task tracking
- Test-Driven Development (TDD) — For new behavior and bugfixes, write or update a failing test first, implement the smallest change that makes it pass, then refactor. Do not add production code without a test that defines the expected behavior (unless the user explicitly asks otherwise).
# Install dependencies
composer install
# Run the CLI
buddy <command> # Global (after self:install)
./bin/buddy <command> # Development
# Run tests
./vendor/bin/phpunit
# Run a single test
./vendor/bin/phpunit tests/Path/To/TestFile.php
./vendor/bin/phpunit --filter testMethodName
# Code style (if configured)
./vendor/bin/php-cs-fixer fix
./vendor/bin/phpstan analysebin/buddy # Entry point
src/
├── Application.php # Symfony Console application bootstrap
├── Commands/ # Command classes organized by resource
│ ├── Pipelines/ # pipelines:list, pipelines:run, pipelines:show, etc.
│ ├── Executions/ # executions:list, executions:show, executions:failed
│ ├── Projects/ # projects:list, projects:show
│ └── Config/ # config:show, config:set, config:clear
├── Services/
│ ├── BuddyService.php # Wraps buddy-works/buddy-works-php-api SDK
│ └── ConfigService.php # Manages config from env vars and config files
└── Output/
├── JsonFormatter.php # --json flag output
└── TableFormatter.php # Human-readable table output
buddy-works/buddy-works-php-api: Handles all Buddy API calls. Throws BuddyResponseException (API errors) and BuddySDKException (SDK errors). Read vendor source for actual method signatures.
symfony/console: Command framework. Commands extend Symfony\Component\Console\Command\Command. Use InputInterface for args/options, OutputInterface for output.
- Command-line flags (
--workspace,--project) - Environment variables (
BUDDY_TOKEN,BUDDY_WORKSPACE,BUDDY_PROJECT) - Project config (
.buddy-cli.json) - User config (
~/.config/buddy-cli/config.json)
All commands support --json flag. Default is human-readable tables. JSON output must be valid and parseable for tool integration.
WORKSPACE, EXECUTION_INFO, EXECUTION_RUN
When ending a work session, you MUST complete ALL steps below. Work is NOT complete until git push succeeds.
MANDATORY WORKFLOW:
- File issues for remaining work - Create issues for anything that needs follow-up
- Run quality gates (if code changed) - Tests, linters, builds
- Update issue status - Close finished work, update in-progress items
- PUSH TO REMOTE - This is MANDATORY:
git pull --rebase bd sync git push git status # MUST show "up to date with origin" - Clean up - Clear stashes, prune remote branches
- Verify - All changes committed AND pushed
- Hand off - Provide context for next session
CRITICAL RULES:
- Work is NOT complete until
git pushsucceeds - NEVER stop before pushing - that leaves work stranded locally
- NEVER say "ready to push when you are" - YOU must push
- If push fails, resolve and retry until it succeeds
This project uses beads_viewer for issue tracking. Issues are stored in .beads/ and tracked in git.
# View issues (launches TUI - avoid in automated sessions)
bv
# CLI commands for agents (use these instead)
bd ready # Show issues ready to work (no blockers)
bd list --status=open # All open issues
bd show <id> # Full issue details with dependencies
bd create --title="..." --type=task --priority=2
bd update <id> --status=in_progress
bd close <id> --reason="Completed"
bd close <id1> <id2> # Close multiple issues at once
bd sync # Commit and push changes- Start: Run
bd readyto find actionable work - Claim: Use
bd update <id> --status=in_progress - Work: Implement the task
- Complete: Use
bd close <id> - Sync: Always run
bd syncat session end
- Dependencies: Issues can block other issues.
bd readyshows only unblocked work. - Priority: P0=critical, P1=high, P2=medium, P3=low, P4=backlog (use numbers, not words)
- Types: task, bug, feature, epic, question, docs
- Blocking:
bd dep add <issue> <depends-on>to add dependencies
Before ending any session, run this checklist:
git status # Check what changed
git add <files> # Stage code changes
bd sync # Commit beads changes
git commit -m "..." # Commit code
bd sync # Commit any new beads changes
git push # Push to remote- Check
bd readyat session start to find available work - Update status as you work (in_progress → closed)
- Create new issues with
bd createwhen you discover tasks - Use descriptive titles and set appropriate priority/type
- Always
bd syncbefore ending session
IMPORTANT: This project uses bd (beads) for ALL issue tracking. Do NOT use markdown TODOs, task lists, or other tracking methods.
- Dependency-aware: Track blockers and relationships between issues
- Git-friendly: Auto-syncs to JSONL for version control
- Agent-optimized: JSON output, ready work detection, discovered-from links
- Prevents duplicate tracking systems and confusion
Check for ready work:
bd ready --jsonCreate new issues:
bd create "Issue title" --description="Detailed context" -t bug|feature|task -p 0-4 --json
bd create "Issue title" --description="What this issue is about" -p 1 --deps discovered-from:bd-123 --jsonClaim and update:
bd update bd-42 --status in_progress --json
bd update bd-42 --priority 1 --jsonComplete work:
bd close bd-42 --reason "Completed" --jsonbug- Something brokenfeature- New functionalitytask- Work item (tests, docs, refactoring)epic- Large feature with subtaskschore- Maintenance (dependencies, tooling)
0- Critical (security, data loss, broken builds)1- High (major features, important bugs)2- Medium (default, nice-to-have)3- Low (polish, optimization)4- Backlog (future ideas)
- Check ready work:
bd readyshows unblocked issues - Claim your task:
bd update <id> --status in_progress - Work on it: Implement, test, document
- Discover new work? Create linked issue:
bd create "Found bug" --description="Details about what was found" -p 1 --deps discovered-from:<parent-id>
- Complete:
bd close <id> --reason "Done"
bd automatically syncs with git:
- Exports to
.beads/issues.jsonlafter changes (5s debounce) - Imports from JSONL when newer (e.g., after
git pull) - No manual export/import needed!
- ✅ Use bd for ALL task tracking
- ✅ Always use
--jsonflag for programmatic use - ✅ Link discovered work with
discovered-fromdependencies - ✅ Check
bd readybefore asking "what should I work on?" - ❌ Do NOT create markdown TODO lists
- ❌ Do NOT use external issue trackers
- ❌ Do NOT duplicate tracking systems
For more details, see README.md and docs/QUICKSTART.md.