Skip to content

Enhance 'stc commit' to Fetch and Select GitHub Issues Automatically #36

Description

@YagoBorba

The current stc commit command requires the user to manually find and type the number of an open issue. This process can be slow and prone to typos. We can significantly improve the user experience by integrating directly with the GitHub API.

Proposed User Experience (UX):

  1. The prompt ? Esta mudança afeta alguma issue aberta? should be changed to a confirm type (Yes/No).
  2. If the user answers No, the process finishes as it does today.
  3. If the user answers Yes:
    • The tool will automatically call the GitHub API to fetch a list of all open issues for the current repository.
    • The user will be presented with a searchable list of these issues (e.g., #123: Fix login button).
    • The user can select the relevant issue from the list.
  4. After selecting an issue, the user will be prompted to choose a keyword (e.g., closes, fixes, resolves).
  5. The tool will then automatically construct the correct footer for the commit message (e.g., closes #123).

Technical Requirements:

  • GitHub API Integration: Use a library like @octokit/rest to communicate with the GitHub API.
  • Repo Detection: The tool needs to automatically detect the repository owner and name from the local Git configuration (e.g., git remote get-url origin).
  • Authentication: Implement a way to handle GitHub API authentication, likely by looking for a Personal Access Token (PAT) in an environment variable (GITHUB_TOKEN) or a configuration file.
  • UI Prompts: Use inquirer to implement the new confirm and list prompts.

Metadata

Metadata

Assignees

Labels

apiIssues related to interacting with external APIsenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions