# Test bd comments command

bd init --prefix test

# Create an issue
bd create 'Issue for comments'
cp stdout issue.txt
exec sh -c 'grep -oE "test-[a-z0-9]+" issue.txt > id.txt'

# Add a comment
exec sh -c 'bd comments add $(cat id.txt) "This is a test comment"'
stdout 'Comment added'

# List comments
exec sh -c 'bd comments $(cat id.txt)'
stdout 'This is a test comment'

# Add another comment with author
exec sh -c 'bd comments add $(cat id.txt) "Second comment" --author tester'
stdout 'Comment added'

# Comments on nonexistent issue should fail
! bd comments nonexistent-id
stderr 'no issue found'
