Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR on Start Work operation in Home view (#3621) #3698

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

sergeibbb
Copy link
Member

@sergeibbb sergeibbb commented Oct 25, 2024

Description

This PR introduces initial Start Work flow that:

  • adds a "Start Work" shortcut to the home view
  • lets user to select a GitHub issue and then starts a create-branch flow
  • suggests the repository of the selected issue as default repository for creating a branch
  • suggests a default branch name based on issue title

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

@sergeibbb sergeibbb self-assigned this Oct 25, 2024
@gitkraken gitkraken deleted a comment Oct 28, 2024
Copy link
Contributor

@axosoft-ramint axosoft-ramint left a comment

Choose a reason for hiding this comment

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

Mostly nitpicks - the only major suggestion would be to set up a provider that manages the issue querying and includes caching and error handling as we have with Launchpad. Most of this would be for future-proofing purposes - we don't automatically query for issues with this feature like we do for Launchpad - but the need for that may arise sooner than we think (for example - some UX on the Home view showing a count of how many issues we have, etc.)

@@ -196,7 +197,7 @@ export class BranchGitCommand extends QuickCommand {
}
}

if (args?.state?.repo != null) {
if (!(args?.state as CreateState)?.suggestRepoOnly && args?.state?.repo != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about writing an assertion/check for the type and then using that here instead of as?

0,
0,
createDirectiveQuickPickItem(Directive.Noop, undefined, {
label: 'Start work lets you quickly create a branch and initial code for a selected issue',
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, but we might want to mention worktrees in here somehow since this flow will, most likely, at least heavily encourage creating one.

@@ -776,7 +776,7 @@ export class GitProviderService implements Disposable {
return { allowed: subscription.account?.verified !== false, subscription: { current: subscription } };
}

if (feature === 'launchpad') {
if (feature === 'launchpad' || feature === 'startWork') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to follow up with @justinrobots if you haven't already since I think there was some confusion on whether this gating applies to "Start Work" the same way it does for Launchpad.

};

export const StartWorkQuickInputButton: QuickInputButton = {
iconPath: new ThemeIcon('beaker'),
Copy link
Contributor

Choose a reason for hiding this comment

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

I put the 'beaker' icon as a placeholder in my WIP, but we should probably check in with the team on what would make a good representative icon for this feature in general, as well as for actions like this.

async function updateContextItems(container: Container, context: Context) {
context.result = {
items:
(await container.integrations.getMyIssues([HostingIntegrationId.GitHub]))?.map(i => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we can do one of the following:

  1. Create a startWorkProvider
  2. Rename the launchpadProvider to be a bit more flexible outside the domain of Launchpad itself and extend it

And then we can add functions to the provider to:

  1. Get searched issues, with caching and error handling like we do for Launchpad items, and the ability to filter out stale ones and other post-processing like we do with PRs for Launchpad (not that we have to implement any post-processing now, just the caching and error handling parts)
  2. Complete actions on "start work" items, like creating a branch, etc.
  3. Set up other utilities that we want in the future for Start Work so that the command file doesn't get out of hand.
  4. Use those functions here as needed, like launchpad does with launchpadProvider.

@sergeibbb sergeibbb linked an issue Nov 5, 2024 that may be closed by this pull request
@sergeibbb sergeibbb force-pushed the feature/3621-start-work branch 6 times, most recently from ac890d2 to c333a9c Compare November 7, 2024 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Start Work operation in Home view
2 participants