backlog-cli
npx skills add https://github.com/simochee/backlog-cli --skill backlog-cli
Agent 安装分布
Skill 文档
backlog-cli
CLI tool for managing Backlog projects via the backlog command.
Authentication
Run backlog auth login before use. Verify with backlog auth status.
Switch between spaces with --space <hostname> or BACKLOG_SPACE env var.
Key Concepts
Avoid Interactive Prompts
Some commands prompt interactively for missing required fields. Always specify all required flags explicitly to prevent hanging.
Name Resolution
The CLI automatically resolves human-readable names to IDs:
- Status names â status ID
- Issue type names â issue type ID
- Priority names (
é«/ä¸/ä½) â priority ID - Usernames â user ID (
@merefers to the authenticated user)
Status and issue type names are project-specific. Query them first if unknown:
backlog issue-type list -p PROJECT_KEY
backlog status-type list -p PROJECT_KEY
Issue Keys
Format: PROJECT_KEY-number (e.g., PROJ-123). Since the key embeds the project, --project is not needed for issue view / issue edit.
Project Key
Specify with --project (-p) flag or BACKLOG_PROJECT env var.
Environment Variables
Environment variables provide defaults that can be overridden by CLI flags:
BACKLOG_SPACEâ Default space hostname (e.g.,example.backlog.com)BACKLOG_PROJECTâ Default project key (e.g.,MYAPP)BACKLOG_API_KEYâ API key for CI/CD environments (requiresBACKLOG_SPACE)
Priority order: CLI flag > Environment variable > Config file (~/.backlogrc)
# Set project for session
export BACKLOG_PROJECT=MYAPP
# Now -p flag can be omitted
backlog issue list
backlog milestone list
# CLI flag overrides environment variable
backlog issue list -p OTHER_PROJECT
JSON Output
Most commands support --json flag for machine-readable output:
--jsonâ output all fields in JSON format--json field1,field2â output only specified fields (e.g.,--json issueKey,summary,status)- Combine with
jqfor advanced filtering:
# Extract issue keys only
backlog issue list -p PROJ --json | jq '.[].issueKey'
# Filter by specific status
backlog issue list -p PROJ --json | jq '[.[] | select(.status.name == "å¦çä¸")]'
# Combine field filtering with jq
backlog issue list -p PROJ --json issueKey,summary | jq '.[].summary'
Always use --json in agent workflows to parse output reliably.
Common Workflows
Issues
# List my open issues
backlog issue list -p PROJ -a @me -S "æªå¯¾å¿,å¦çä¸"
# View details with comments
backlog issue view PROJ-123 --comments
# Create (required: -p, -t, -T, -P)
backlog issue create -p PROJ -t "Title" -T "ã¿ã¹ã¯" -P "ä¸" -a @me -d "Description"
# Update status with comment
backlog issue edit PROJ-123 -S "å¦çä¸" -c "Starting work"
# Close
backlog issue close PROJ-123 -c "Done"
# Add comment
backlog issue comment PROJ-123 -b "Progress update"
Pull Requests
# Create (required: -p, -R, -t, -B, --branch)
backlog pr create -p PROJ -R repo -t "PR title" -B main --branch feat/xxx --issue PROJ-123
# List open PRs
backlog pr list -p PROJ -R repo
# View with comments
backlog pr view -p PROJ -R repo 42 --comments
# Merge
backlog pr merge -p PROJ -R repo 42
Project Info
backlog project list # List projects
backlog project users PROJECT_KEY # List members
backlog category list -p PROJ # List categories
backlog milestone list -p PROJ # List milestones
Wiki
backlog wiki list -p PROJ
backlog wiki view <wiki-id>
backlog wiki create -p PROJ -n "Page title" -b "Content"
backlog wiki edit <wiki-id> -b "Updated content"
Raw API
For operations not covered by CLI commands. The /api/v2 prefix can be omitted.
backlog api /issues -X POST -f "projectId=123" -f "summary=New issue"
backlog api /issues --paginate -f "projectId[]=123"
Common Issues
Authentication Failed
If you encounter authentication errors:
# Check current authentication status
backlog auth status
# Re-authenticate
backlog auth login
“Status name not found” or “Issue type not found”
Status names and issue type names are project-specific. Always query them first:
# Get available statuses for a project
backlog status-type list -p PROJECT_KEY
# Get available issue types for a project
backlog issue-type list -p PROJECT_KEY
# Get available priorities (these are global)
# Built-in values: é« (High), ä¸ (Normal), ä½ (Low)
Before creating or editing issues:
- Query status names:
backlog status-type list -p PROJECT - Query issue types:
backlog issue-type list -p PROJECT - Use exact names from the query results
Missing Required Fields
If a command hangs or prompts for input:
- You’re missing a required field
- Specify all required flags explicitly (see command help with
--help) - Never rely on interactive prompts in agent workflows
Project Not Found
Ensure the project key is correct and you have access:
# List available projects
backlog project list
# Use exact project key from the list
References
- Full command options: references/commands.md
- Data model schemas: references/schema.md