├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── need-help.md ├── dependabot.yml └── workflows │ ├── go.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── .talismanrc ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── assets ├── docs │ ├── installation.md │ ├── integration.md │ ├── shell-completion.md │ └── usage.md ├── tu_logo.ai ├── tu_logo.ico ├── tu_logo.png ├── tu_social.ai └── tu_social.png ├── cmd ├── check.go ├── check_test.go ├── commit.go ├── commit_test.go ├── completion.go ├── completion_test.go ├── log-filter.go ├── log.go ├── new.go ├── new_test.go ├── release.go ├── release_test.go ├── root.go ├── version.go └── version_test.go ├── go.mod ├── go.sum ├── internal └── cmdbuilder │ ├── prerun.go │ └── repository.go ├── main.go ├── pkg ├── constants │ └── string.go ├── format │ ├── branch.go │ ├── branch_test.go │ ├── commit.go │ └── commit_test.go ├── git │ ├── commit.go │ ├── commit_test.go │ ├── hooks.go │ ├── hooks_test.go │ ├── remote.go │ ├── remote_test.go │ ├── repo.go │ ├── repo_test.go │ ├── stage.go │ └── stage_test.go ├── integrations │ ├── gitlab.go │ ├── gitlab_test.go │ ├── issue.go │ ├── issue_test.go │ ├── jira.go │ ├── jira_test.go │ ├── openai.go │ ├── provider.go │ └── provider_test.go └── test │ ├── common.go │ ├── git.go │ └── time.go └── scripts └── gen-doc.go /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug, need-investigation 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Describe the bug 11 | 12 | 13 | 14 | ## To Reproduce 15 | 16 | **Steps** 17 | 18 | 19 | **Expected behavior** 20 | 21 | 22 | **Actual behavior** 23 | 24 | 25 | ## Versions 26 | 27 | 28 | - *tug*: 29 | 30 | - *OS*: 31 | 32 | ## Additional context 33 | 34 | 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEAT]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | 12 | 13 | **Describe the solution you'd like** 14 | 15 | 16 | **Additional context** 17 | 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/need-help.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Need help 3 | about: Ask anything about usage or contribution. 4 | title: "[HELP]" 5 | labels: help wanted 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gomod 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "04:00" 8 | open-pull-requests-limit: 10 9 | reviewers: 10 | - b4nst 11 | -------------------------------------------------------------------------------- /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | name: Go 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | go: 11 | name: Build and test 12 | strategy: 13 | matrix: 14 | os: 15 | - ubuntu 16 | - macos 17 | # TODO: https://github.com/b4nst/turbogit/issues/48 18 | # - windows 19 | include: 20 | # - os: windows 21 | # shell: msys2 {0} 22 | - os: ubuntu 23 | shell: bash 24 | - os: macos 25 | shell: bash 26 | runs-on: ${{ matrix.os }}-latest 27 | defaults: 28 | run: 29 | shell: ${{ matrix.shell }} 30 | steps: 31 | - name: Install windows dependencies 32 | uses: msys2/setup-msys2@v2 33 | if: matrix.os == 'windows' 34 | with: 35 | update: true 36 | msystem: CLANG64 37 | install: >- 38 | pkg-config 39 | make 40 | path-type: inherit 41 | 42 | - name: Set up Go 1.x 43 | uses: actions/setup-go@v2 44 | with: 45 | go-version: ^1.17 46 | id: go 47 | 48 | - name: Check out code into the Go module directory 49 | uses: actions/checkout@v2 50 | with: 51 | submodules: recursive 52 | 53 | - name: Build 54 | run: make build 55 | 56 | - name: Download codeclimate reporter 57 | if: matrix.os == 'ubuntu' 58 | run: wget -O cc-reporter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 && chmod +x cc-reporter 59 | 60 | - name: Prepare code coverage 61 | if: matrix.os == 'ubuntu' 62 | run: ./cc-reporter before-build 63 | 64 | - name: Test 65 | run: make test 66 | 67 | - name: Upload code coverage 68 | if: matrix.os == 'ubuntu' 69 | env: 70 | CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} 71 | run: ./cc-reporter after-build --coverage-input-type gocov -p github.com/b4nst/turbogit 72 | 73 | doc: 74 | name: Deploy documentation 75 | runs-on: ubuntu-latest 76 | steps: 77 | - name: Check out code into the Go module directory 78 | uses: actions/checkout@v2 79 | with: 80 | submodules: recursive 81 | - name: Set up Go 1.x 82 | uses: actions/setup-go@v2 83 | with: 84 | go-version: ^1.17 85 | id: go 86 | - name: Install doctave 87 | run: | 88 | mkdir -p $GITHUB_WORKSPACE/bin 89 | curl -sSL https://github.com/Doctave/doctave/releases/download/0.4.2/doctave-0.4.2-x86_64-unknown-linux-musl.tar.gz | tar xvz 90 | mv doctave-0.4.2-x86_64-unknown-linux-musl/doctave $GITHUB_WORKSPACE/bin/doctave 91 | chmod +x $GITHUB_WORKSPACE/bin/doctave 92 | echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH 93 | - uses: supplypike/setup-bin@v1 94 | name: Install doctave 95 | with: 96 | uri: https://github.com/Doctave/doctave/releases/download/0.4.2/doctave-0.4.2-x86_64-unknown-linux-musl.tar.gz 97 | name: doctave 98 | version: 0.4.2 99 | - name: Build 100 | run: make doc 101 | - name: Deploy (dry-run) 102 | if: success() 103 | uses: crazy-max/ghaction-github-pages@v3 104 | with: 105 | target_branch: gh-pages 106 | build_dir: dist/doc/site 107 | dry_run: true 108 | env: 109 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 110 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*" 7 | 8 | jobs: 9 | create_release: 10 | name: Create release 11 | runs-on: ubuntu-latest 12 | outputs: 13 | upload_url: ${{ steps.create_release.outputs.upload_url }} 14 | raw_tag: ${{ steps.get_version.outputs.VERSION }} 15 | tag: ${{ steps.get_version.outputs.VERSION_NO_PREFIX }} 16 | steps: 17 | - name: Checkout code 18 | uses: actions/checkout@v2 19 | - name: Create Release 20 | id: create_release 21 | uses: actions/create-release@v1 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | with: 25 | tag_name: ${{ github.event.ref }} 26 | release_name: Release ${{ github.event.ref }} 27 | draft: false 28 | prerelease: false 29 | - name: Get the version 30 | id: get_version 31 | run: | 32 | echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} 33 | echo ::set-output name=VERSION_NO_PREFIX::${GITHUB_REF#refs/tags/v} 34 | 35 | build: 36 | name: Build binaries 37 | strategy: 38 | matrix: 39 | os: [ubuntu-latest, macos-latest] 40 | goarch: [amd64] 41 | runs-on: ${{ matrix.os }} 42 | needs: create_release 43 | env: 44 | GOARCH: ${{ matrix.goarch }} 45 | steps: 46 | - name: Set up Go 1.x 47 | uses: actions/setup-go@v2 48 | with: 49 | go-version: ^1.17 50 | id: go 51 | - name: Check out code into the Go module directory 52 | uses: actions/checkout@v2 53 | with: 54 | submodules: recursive 55 | - name: Build 56 | id: build 57 | env: 58 | TUG_COMMIT: ${{ github.sha }} 59 | TUG_VERSION: ${{ needs.create_release.outputs.tag }} 60 | RAW_TAG: ${{ needs.create_release.outputs.raw_tag }} 61 | run: | 62 | make build 63 | echo ::set-output name=ASSET_NAME::turbogit_${RAW_TAG}_$(go env GOOS)_$(go env GOARCH).tar.gz 64 | - name: Package 65 | env: 66 | ASSET_NAME: ${{ steps.build.outputs.ASSET_NAME }} 67 | run: tar -zcvf ${ASSET_NAME} -C dist/bin/ . 68 | - name: Upload Release Asset 69 | uses: actions/upload-release-asset@v1 70 | env: 71 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 72 | ASSET_NAME: ${{ steps.build.outputs.ASSET_NAME }} 73 | with: 74 | upload_url: ${{ needs.create_release.outputs.upload_url }} 75 | asset_path: ./${{ env.ASSET_NAME }} 76 | asset_name: ${{ env.ASSET_NAME }} 77 | asset_content_type: application/octet-stream 78 | 79 | doc: 80 | name: Deploy documentation 81 | runs-on: ubuntu-latest 82 | steps: 83 | - name: Check out code into the Go module directory 84 | uses: actions/checkout@v2 85 | with: 86 | submodules: recursive 87 | - name: Set up Go 1.x 88 | uses: actions/setup-go@v2 89 | with: 90 | go-version: ^1.17 91 | id: go 92 | - name: Install doctave 93 | run: | 94 | mkdir -p $GITHUB_WORKSPACE/bin 95 | curl -sSL https://github.com/Doctave/doctave/releases/download/0.4.2/doctave-0.4.2-x86_64-unknown-linux-musl.tar.gz | tar xvz 96 | mv doctave-0.4.2-x86_64-unknown-linux-musl/doctave $GITHUB_WORKSPACE/bin/doctave 97 | chmod +x $GITHUB_WORKSPACE/bin/doctave 98 | echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH 99 | - name: Build 100 | run: make doc 101 | - name: Deploy 102 | if: success() 103 | uses: crazy-max/ghaction-github-pages@v3 104 | with: 105 | target_branch: gh-pages 106 | build_dir: dist/doc/site 107 | env: 108 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 109 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/macos,vscode,go 3 | # Edit at https://www.gitignore.io/?templates=macos,vscode,go 4 | 5 | ### Go ### 6 | # Binaries for programs and plugins 7 | *.exe 8 | *.exe~ 9 | *.dll 10 | *.so 11 | *.dylib 12 | 13 | # Test binary, built with `go test -c` 14 | *.test 15 | 16 | # Output of the go coverage tool, specifically when used with LiteIDE 17 | *.out 18 | 19 | # Dependency directories (remove the comment below to include it) 20 | # vendor/ 21 | 22 | ### Go Patch ### 23 | /vendor/ 24 | /Godeps/ 25 | 26 | ### macOS ### 27 | # General 28 | .DS_Store 29 | .AppleDouble 30 | .LSOverride 31 | 32 | # Icon must end with two \r 33 | Icon 34 | 35 | # Thumbnails 36 | ._* 37 | 38 | # Files that might appear in the root of a volume 39 | .DocumentRevisions-V100 40 | .fseventsd 41 | .Spotlight-V100 42 | .TemporaryItems 43 | .Trashes 44 | .VolumeIcon.icns 45 | .com.apple.timemachine.donotpresent 46 | 47 | # Directories potentially created on remote AFP share 48 | .AppleDB 49 | .AppleDesktop 50 | Network Trash Folder 51 | Temporary Items 52 | .apdisk 53 | 54 | #!! ERROR: vscode is undefined. Use list command to see defined gitignore types !!# 55 | 56 | # End of https://www.gitignore.io/api/macos,vscode,go 57 | 58 | /bin 59 | dist 60 | # Created by https://www.toptal.com/developers/gitignore/api/vim 61 | # Edit at https://www.toptal.com/developers/gitignore?templates=vim 62 | 63 | ### Vim ### 64 | # Swap 65 | [._]*.s[a-v][a-z] 66 | !*.svg # comment out if you don't need vector files 67 | [._]*.sw[a-p] 68 | [._]s[a-rt-v][a-z] 69 | [._]ss[a-gi-z] 70 | [._]sw[a-p] 71 | 72 | # Session 73 | Session.vim 74 | Sessionx.vim 75 | 76 | # Temporary 77 | .netrwhist 78 | *~ 79 | # Auto-generated tag files 80 | tags 81 | # Persistent undo 82 | [._]*.un~ 83 | 84 | # End of https://www.toptal.com/developers/gitignore/api/vim 85 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "git2go"] 2 | path = git2go 3 | url = https://github.com/libgit2/git2go 4 | -------------------------------------------------------------------------------- /.talismanrc: -------------------------------------------------------------------------------- 1 | fileignoreconfig: 2 | - filename: go.sum 3 | checksum: b8c74270b3988878ec79282883af9835e5936994b79afc72ad76ebb25d1a69a7 4 | ignore_detectors: [] 5 | - filename: assets/tu_logo.ai 6 | checksum: 914c8f4d7cefc065c7826d91ca686825382b8a49b52c23c6a10a445df16869b6 7 | ignore_detectors: [] 8 | - filename: assets/tu_social.ai 9 | checksum: b8093b4dd7767038ad955b9a2352a664877940dd4efebfdfa85e12d709044db5 10 | ignore_detectors: [] 11 | scopeconfig: [] -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at bastyen.a@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Turbogit 2 | 3 | We would love for you to contribute to Turbogit and help make it even better than it is 4 | today! As a contributor, here are the guidelines we would like you to follow: 5 | 6 | ## Code of Conduct 7 | Help us keep Turbogit open and inclusive. Please read and follow our [Code of Conduct](/code-of-conduct). 8 | 9 | ## Got a Question or Problem? 10 | If you have any questions regarding how to use Turbogit or contributing to this repo 11 | please [submit an issue](/contributing#submitting-an-issue) using the **Need help** template. 12 | 13 | ## Found a Bug? 14 | If you find a bug in the source code, you can help us by 15 | [submitting an issue](/contributing#submitting-an-issue) using the **Bug report** template. Even better, you can 16 | [submit a Pull Request](/contributing#submitting-a-pull-request) with a fix. 17 | 18 | ## Missing a Feature? 19 | You can *request* a new feature by [submitting an issue](/contributing#submitting-an-issue) to our GitHub 20 | Repository using the **Feature request** template. If you would like to *implement* a new feature, please submit an issue with 21 | a proposal for your work first, to be sure that we can use it. 22 | Please consider what kind of change it is: 23 | 24 | * For a **Major Feature**, first open an issue and outline your proposal so that it can be 25 | discussed. This will also allow us to better coordinate our efforts, prevent duplication of work, 26 | and help you to craft the change so that it is successfully accepted into the project. 27 | * **Small Features** can be crafted and directly [submitted as a Pull Request](/contributing#submitting-a-pull-request). 28 | 29 | ## Submission Guidelines 30 | 31 | ### Submitting an Issue 32 | 33 | Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available. 34 | 35 | We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs, please fill the *To Reproduce* section when possible. 36 | Having a reproducible scenario gives us a wealth of important information without going back & forth to you with additional questions like: 37 | 38 | - version of Turbogit used 39 | - general system information 40 | - and most importantly - a use-case that fails 41 | 42 | A minimal reproduce scenarion allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem. 43 | 44 | We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal plunk. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it. 45 | 46 | Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that doesn't have enough info to be reproduced. 47 | 48 | You can file new issues by filling out our [new issue form](https://github.com/b4nst/turbogit/issues/new/choose) using the **Bug report** template. 49 | 50 | 51 | ### Submitting a Pull Request 52 | Before you submit your Pull Request (PR) consider the following guidelines: 53 | 54 | 1. Search [GitHub](https://github.com/angular/angular/pulls) for an open or closed PR 55 | that relates to your submission. You don't want to duplicate effort. 56 | 1. Fork the b4nst/turbogit repo. 57 | 1. Make your changes in a new git branch: 58 | 59 | ```shell 60 | git checkout -b my-fix-branch main 61 | ``` 62 | 63 | 1. Create your patch, **including appropriate test cases**. 64 | 1. Follow our [Coding Rules](/contributing#coding-rules). 65 | 1. Commit your changes using a descriptive commit message that follows our 66 | [commit message conventions](/contributing#commit-message-format). Adherence to these conventions 67 | is necessary because release notes will be automatically generated from these messages (eventually). 68 | 69 | ```shell 70 | tug commit 71 | ``` 72 | 73 | 1. Push your branch to GitHub: 74 | 75 | ```shell 76 | git push origin my-fix-branch 77 | ``` 78 | 79 | 1. In GitHub, send a pull request to `turbogit:main`. 80 | * If we suggest changes, or the ci fail then: 81 | * Make the required updates. 82 | * Rebase your branch and force push to your GitHub repository (this will update your Pull Request): 83 | 84 | ```shell 85 | git rebase main -i 86 | git push -f 87 | ``` 88 | 89 | That's it! Thank you for your contribution! 90 | 91 | #### After your pull request is merged 92 | 93 | After your pull request is merged, you can safely delete your branch and pull the changes 94 | from the main (upstream) repository: 95 | 96 | * Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows: 97 | 98 | ```shell 99 | git push origin --delete my-fix-branch 100 | ``` 101 | 102 | * Check out the main branch: 103 | 104 | ```shell 105 | git checkout main -f 106 | ``` 107 | 108 | * Delete the local branch: 109 | 110 | ```shell 111 | git branch -D my-fix-branch 112 | ``` 113 | 114 | * Update your main with the latest upstream version: 115 | 116 | ```shell 117 | git pull --ff upstream main 118 | ``` 119 | 120 | ## Coding Rules 121 | To ensure consistency throughout the source code, keep these rules in mind as you are working: 122 | 123 | * All features or bug fixes **must be tested** by one or more specs (unit-tests). 124 | * All commands **must be documented** using cobra generated documentation. 125 | 126 | ## Commit Message Guidelines 127 | 128 | We follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for out commit messages. This leads to **more 129 | readable messages** that are easy to follow when looking through the **project history**. 130 | 131 | ### Commit Message Format 132 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special 133 | format that includes a **type**, a **scope** and a **subject**: 134 | 135 | ``` 136 | (): 137 | 138 | 139 | 140 |