Skip to content

chore(Fork): add custom command#717

Merged
ArgoZhang merged 1 commit intomasterfrom
chore-fork
Nov 25, 2025
Merged

chore(Fork): add custom command#717
ArgoZhang merged 1 commit intomasterfrom
chore-fork

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Nov 25, 2025

Link issues

fixes #716

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Chores:

  • Introduce a new .fork/custom-commands.json configuration file to define custom commands.

Copilot AI review requested due to automatic review settings November 25, 2025 02:29
@bb-auto bb-auto Bot added the chore label Nov 25, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Nov 25, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Nov 25, 2025

🧙 Sourcery has finished reviewing your pull request!


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang ArgoZhang merged commit e0679ff into master Nov 25, 2025
5 of 6 checks passed
@ArgoZhang ArgoZhang deleted the chore-fork branch November 25, 2025 02:29
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds custom commands for the Fork Git client to streamline common multi-remote operations. The configuration enables developers to manage branches and synchronize code across three Git remotes (origin, gitcode.com, and gitee.com) through convenient custom commands.

Key Changes

  • Adds a new .fork/custom-commands.json configuration file with three custom commands: "Delete All", "Fetch All", and "Push All"
  • Enables batch operations across multiple remote repositories (origin, gitcode.com, gitee.com)
  • Automates common workflows for branch deletion, fetching, and pushing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

},
{
"action" : {
"script" : "git push origin refs/heads/${ref} --verbose\ngit push gitcode.com refs/heads/${ref} --verbose\ngit push gitee.com refs/heads/${ref} --verbose",
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With showOutput set to false and --verbose flags in the git commands, the verbose output won't be visible to users. Either remove the --verbose flags since the output is hidden, or set showOutput to true to make the verbose output useful.

Suggested change
"script" : "git push origin refs/heads/${ref} --verbose\ngit push gitcode.com refs/heads/${ref} --verbose\ngit push gitee.com refs/heads/${ref} --verbose",
"script" : "git push origin refs/heads/${ref}\ngit push gitcode.com refs/heads/${ref}\ngit push gitee.com refs/heads/${ref}",

Copilot uses AI. Check for mistakes.
},
{
"action" : {
"script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}",
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Delete All" command chains multiple destructive git operations without error handling. If any of the remote delete operations fail (e.g., remote doesn't exist or branch not found), the subsequent commands will still execute, potentially leading to unexpected behavior. Consider adding error handling or splitting this into separate commands for better control and feedback.

Suggested change
"script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}",
"script" : "git push gitcode.com --delete refs/heads/${ref} || { echo 'Failed to delete branch ${ref} from gitcode.com'; exit 1; }\ngit push gitee.com --delete refs/heads/${ref} || { echo 'Failed to delete branch ${ref} from gitee.com'; exit 1; }\ngit checkout main || { echo 'Failed to checkout main'; exit 1; }\ngit branch --delete --force ${ref} || { echo 'Failed to delete local branch ${ref}'; exit 1; }",

Copilot uses AI. Check for mistakes.
},
{
"action" : {
"script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}",
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using git branch --delete --force is potentially dangerous as it will delete the local branch even if it contains unmerged changes. Consider using --delete without --force to prevent accidental loss of work, or add a confirmation prompt before executing this destructive operation.

Suggested change
"script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}",
"script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete ${ref}",

Copilot uses AI. Check for mistakes.
{
"action" : {
"script" : "git push gitcode.com --delete refs/heads/${ref}\ngit push gitee.com --delete refs/heads/${ref}\ngit checkout main\ngit branch --delete --force ${ref}",
"showOutput" : false,
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With showOutput set to false, users won't see error messages if any of the destructive delete operations fail. This can lead to confusion about whether the operations succeeded or failed. Consider setting this to true for better user feedback, especially for destructive operations.

Suggested change
"showOutput" : false,
"showOutput" : true,

Copilot uses AI. Check for mistakes.
{
"action" : {
"script" : "git push origin refs/heads/${ref} --verbose\ngit push gitcode.com refs/heads/${ref} --verbose\ngit push gitee.com refs/heads/${ref} --verbose",
"showOutput" : false,
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Push All" command chains multiple push operations without error handling. If one push fails (e.g., network issues, authentication problems), subsequent pushes will still be attempted but the user may not be aware of the failure since showOutput is false. Consider enabling output visibility or adding error handling between commands.

Suggested change
"showOutput" : false,
"showOutput" : true,

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(Fork): add custom command

2 participants