Coder Social home page Coder Social logo

janekbaraniewski / issuectl Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 2.49 MB

Streamline your work with multiple issues, repositories and git accounts. Supports GitHub, GitLab and Jira

License: MIT License

Go 90.44% Makefile 1.36% JavaScript 1.61% HTML 2.60% Vue 1.00% CSS 2.99%
github github-issues github-jira gitlab gitlab-issues issue-management issue-tracking issues jira jira-api

issuectl's Introduction

issuectl

Release License GH workflow Go Report Card Go Reference

Streamline your work with multiple repositories, issues and git accounts simultaneously. This tool will

  • Maintain a clean work directory for each of your issues using defined by you combination of RepositoryBackend (GitLah, GitHub, ...), IssueBackend (Jira, GitHub, GitLab, ...) and GitUser
  • When you start working on new issue it:
    • Clones all repositories you need to separate directory
    • Sets up branches in all repositories
    • Changes status of issue in issue backend to In Progress
  • Then it allows you with just one command to:
    • open Pull Request
    • link it to issue
  • And when youre done it:
    • cleanes up working directory
    • sets issue to Done

Install

On macOS:

➜ brew install janekbaraniewski/janekbaraniewski/issuectl

Quick start

issuectl init will create config file with minimal setup to get you going

➜ issuectl init
? Enter Git user name: John Doe
? Enter Git user email: [email protected]
? Enter SSH key path: /Users/johndoe/.ssh/id_rsa
? Do you want to configure a backend? Yes
? Select backend type: github
? Enter GitHub Host (Skip for https://api.github.com/):
? Enter GitHub Token: ****************
? Enter GitHub Username: johndoe
? Enter working directory for profile: /Users/johndoe/Workdir
? Enter repository name: my-repo
? Enter repository owner: johndoe
? Enter repository URL: [email protected]:johndoe/my-repo.git

To see generated config run

➜ issuectl config get
currentProfile: default
repositories:
  my-repo:
    name: my-repo
    owner: johndoe
    url: [email protected]:johndoe/my-repo.git
profiles:
  default:
    name: default
    workDir: /Users/johndoe/Workdir
    issueBackend: default
    repoBackend: default
    gituser: John Doe
    repositories:
    - my-repo
    defaultRepository: my-repo
backends:
  default:
    name: default
    backendType: github
    github:
      token: supersecrettoken
      username: johndoe
gitUsers:
  John Doe:
    name: John Doe
    email: [email protected]
    sshkey: /Users/johndoe/.ssh/id_rsa

Usage

issuectl allows you to

Start

➜ issuectl start [issueNumber]
➜ issuectl start XY-321
    🏗️	Preparing workspace for issue XY-321...
    🛬	Cloning repositories [my-secret-project]
    🫡	Marking issue as In Progress in my-org-jira
    🚀	Workspace for XY-321 ready!
    🧑‍💻	Run `issuectl workon XY-321` to open it in VS Code

This will:

  • create a new work directory for your issue
  • clone all repositories defined in active profile to issue work dir
  • setup branches in those repositories
  • move issue to In Progress state
  • leave a comment under issue:

on it!


List

List all your in progress issues simply by running

➜ issuectl list
ID    Name                      Repository Backend Issue Backend Branch                    Repositories    Profile
XY-69 XY-69-test-task-from-jira github-priv        my-org-jira   XY-69-test-task-from-jira [myRepo]        work
44    44-test-task-from-github  github-priv        github-priv   44-test-task-from-github  [myPrivProject] priv

Work

➜ issuectl workon [issueNumber]

This will open issue directory in your code editor (WARNING! ATM VSCODE IS HARDCODED)


Open PR

➜ issuectl openpr [issueNumber]
➜ issuectl openpr XY-321
    📂	Opening PR for issue XY-321 in my-org/my-project [github-work]
    🔗	Linking PR 321 to issue XY-321 in jira-work

This will:

  • create a Pull Request in RepositoryBackend
  • leave a comment under issue:

done!


Finish

➜ issuectl finish [issueNumber]
➜ issuectl finish XY-321
    🥂	Finishing work on XY-321
    🏁	Closing issue XY-321 in jira-priv
    🧹	Cleaning up issue workdir
    🫥	Removing issue config
    👍	All done!

This will:

  • delete issue work dir
  • move issue to Done state
  • leave a comment under issue:

Cool syntax!!!

If you want, you can add alias you tour .bashrc/.zshrc:

alias i=issuectl

this will make your interaction with CLI more natural! Check this out:

➜ i start OPS-123
    🏗️	Preparing workspace for issue OPS-123...
    🛬	Cloning repositories [my-secret-project]
    🫡	Marking issue as In Progress in my-org-jira
    🚀	Workspace for OPS-123 ready!
    🧑‍💻	Run `issuectl workon OPS-123` to open it in VS Code
➜ i workon OPS-123
➜ i openpr OPS-123
    📂	Opening PR for issue OPS-123 in janekbaraniewski/issuectl [github-priv]
    🔗	Linking PR 321 to issue OPS-123 in jira-priv
➜ i finish OPS-123
    🥂	Finishing work on OPS-123
    🏁	Closing issue OPS-123 in jira-priv
    🧹	Cleaning up issue workdir
    🫥	Removing issue config
    👍	All done!

This is a basic idea of workflow and what systems this can interact with at each step. diagram

Configuration

➜ issuectl --help

issuectl helps managing separate environments for work on multiple issues.

Start work on issue:
	issuectl start [issue_number]

Open PR and link it to issue
	issuectl openpr [issue_number]

Finish work, close the issue
	issuectl finish [issue_number]

Usage:
  issuectl [flags]
  issuectl [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  config      Manage config
  finish      Cleanup resources and close issue
  help        Help about any command
  init        Initialize configuration
  list        List all issues
  openpr      Opens a pull request for the specified issue
  start       Start work on issue
  workon      Open specified issue in the preferred code editor

Flags:
  -h, --help      help for issuectl
  -v, --version   version for issuectl

Use "issuectl [command] --help" for more information about a command.

Repositories

In order to work on code you need to define your repositories:

➜ issuectl config repo add \
    my-org \
    repoName \
    [email protected]:my-org/repoName.git

Backends

You'll also need to configure issue backend. ATM there is GitHub and Jira backend and untested GitLab backend.

➜ issuectl config backend add --help
Add a new backend

Usage:
  issuectl config backend add [name] [type] [flags]

Flags:
      --github-api string      GitHub API URL (default "https://api.github.com/")
      --github-token string    GitHub API Auth Token
      --gitlab-api string      GitLab API URL
      --gitlab-token string    GitLab API Token
  -h, --help                   help for add
      --jira-host string       Jira API URL
      --jira-token string      Jira API Token
      --jira-username string   Jira API Username

Let's configure GitHub backend for our repository:

➜ issuectl config backend add \
    --github-token mysupersecrettoken \
    my-org-github \
    github

And Jira backend for our issues:

Please remember you have to use Jira with language set to English (US)

➜ issuectl config backend add \
    --jira-host https://my-org.atlassian.net/ \
    --jira-token "${JIRA_API_TOKEN}" \
    --jira-username "${JIRA_USERNAME}" \
    my-org-jira \
    jira

Git Users

➜ issuectl config gituser add \
    "John Doe" \
    [email protected] \
    /Users/johndoe/.ssh/work

Profiles

Once you've set all of this up, you can create your default profile:

➜ issuectl config profile add
Usage:
  issuectl config profile add [name] [workdir] [issue backend] [repo backend] [git user] [default repo] [flags]

Flags:
  -h, --help            help for add
  -r, --repos strings   A list of repositories to clone
➜ issuectl config profile add \
    -r repoName \
    work \
    /Users/johndoe/Workspace/myorg \
    my-org-jira \
    my-org-github \
    "John Doe" \
    repoName

➜ issuectl config profile use work

This will create a profile which will clone repoName for each issue. You might want to clone multiple repositories, depending on your environment. For this, run

➜ issuectl config profile addRepo repoName2

This will add repoName2 to your profile and clone it when starting work on new issue.

issuectl's People

Contributors

janekbaraniewski avatar

Stargazers

 avatar

Watchers

 avatar

issuectl's Issues

Add option for custom issue name when starting issue

this way we can use it for dir name and have more descriptive headers:

Screenshot 2023-07-24 at 13 29 00

ENG-306 here is dir name, it could be ENG-306-my-custom-title and with multiple windows open I'd easily know which one is for which task

add option to "suspend" working on issue

i suspend XY-123 -m <reason for suspend>

This should result in:

  • issue being moved back to TODO
  • comment left Stopped working on it for now: <reason for suspend>

Also, maybe it's worth to track issue status in issuectl?

make cli aware of issue and repo

While inside issue work dir we should know from context (pwd?) which issue in which project we're working on, so commands like openpr could work without arguments

Add repository to existing issue

command should

  • take repo name and issue id as input
  • check if repo defined
  • check if issue defined
  • add repo to issue repos
  • clone repo
  • create branch

update readme

Some initial description, how to install, basic use cases

use backend abstraction

ATM everything uses GitHub and backend abstraction doesn't really make sense. Add some other integration (Jira? Trelo? Mock?) for managing issues

Fix PR number in logs

➜ i openpr I-1
    📂	Opening PR for issue I-1 in org/repo [github-priv]
    🔗	Linking PR 0x140002d9cc0 to issue I-1 in jira-org

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.