cli / mcp for bitbucket
1import { addComment } from '@bitbucket-tool/core';
2import { defineCommand, unwrapOrExit } from '../utils/command-builder';
3
4export const registerPrCommentCommand = defineCommand({
5 name: 'pr:comment',
6 description: 'Add a comment to a pull request',
7 arguments: [
8 { syntax: '<pr-id>', description: 'Pull request ID', parser: parseInt },
9 { syntax: '<comment>', description: 'Comment text' },
10 ],
11 action: async ({ workspace, repoSlug, args }) => {
12 const [prId, comment] = args;
13
14 unwrapOrExit(await addComment({ workspace, repoSlug, prId, content: comment }));
15
16 console.log(`\nComment added to PR #${prId}\n`);
17 },
18});