Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
9df2715
the 'scripts/install-windows-auto-commit.ps1' file has been changed
noneandundefined May 10, 2025
527bc9d
the 'bin/auto-commit' file has been changed | the 'scripts/install-li…
noneandundefined May 10, 2025
3bfcf1e
the 'scripts/install-linux-auto-commit.sh' file has been changed
noneandundefined May 10, 2025
41fdd69
the 'Makefile' file has been changed | the 'bin/auto-commit' file has…
noneandundefined May 10, 2025
ed2274b
the 'bin/auto-commit' file has been changed | the 'go.mod' file has b…
noneandundefined May 10, 2025
aaeb168
added function GetTest
noneandundefined May 10, 2025
4a1538d
the 'bin/auto-commit' file has been changedthe 'bin/auto-commit' file…
noneandundefined May 10, 2025
4802574
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
8978872
the 'bin/auto-commit' file has been changed | changed value in variab…
noneandundefined May 10, 2025
81e30cc
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
65d6725
the 'bin/auto-commit' file has been changed | renamed function Auto -…
noneandundefined May 10, 2025
c2a4464
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
83ed5ce
the 'bin/auto-commit' file has been changed
noneandundefined May 10, 2025
d6f1366
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
e01d8cf
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
92b93ec
the 'bin/auto-commit' file has been changed
noneandundefined May 10, 2025
272e26a
the 'bin/auto-commit' file has been changed
noneandundefined May 10, 2025
7883fad
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
d8937d4
the 'bin/auto-commit' file has been changed
noneandundefined May 10, 2025
1c6c5dd
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
dece0fd
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
dcc887f
the 'bin/auto-commit' file has been changed
noneandundefined May 10, 2025
13e91dc
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
cc01a14
added function name
noneandundefined May 10, 2025
2dddb45
added function name1, added function nam1
noneandundefined May 10, 2025
650f2d8
deleted function name, deleted function name1, deleted function nam1
noneandundefined May 10, 2025
a6bd8dd
the '.github/workflows/release.yml' file has been changed | the 'bin/…
noneandundefined May 10, 2025
4d03244
the 'bin/auto-commit' file has been changed
noneandundefined May 10, 2025
68ab0e1
the 'README.md' file has been changed
noneandundefined May 10, 2025
e080179
the 'bin/auto-commit' file has been changed
noneandundefined May 10, 2025
c2a5492
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
a4714af
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
1487ff8
the 'bin/auto-commit' file has been changed
noneandundefined May 10, 2025
3283ece
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
e17dbce
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
1a194a8
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
32f0f2a
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
d0f7790
renamed variable pathRoot -> path
noneandundefined May 10, 2025
601a28f
changed value in variable if err
noneandundefined May 10, 2025
84b15f6
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
9464ee2
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
de50aed
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
c85ff3a
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
dcb85ec
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
69184d5
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
be7f8b9
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
6bd1f35
changed value in variable m, changed value in variable m
noneandundefined May 10, 2025
53a39fa
changed value in variable m, changed value in variable m, changed val…
noneandundefined May 10, 2025
d795b10
changed value in variable m
noneandundefined May 10, 2025
712efcd
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
1a8e988
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
322c665
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
b7aec3a
changed value in variable m, changed value in variable m, changed val…
noneandundefined May 10, 2025
3d2636a
changed value in variable m, changed value in variable m
noneandundefined May 10, 2025
da4a0c4
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
196fdf8
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
561688e
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
1626fcf
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
ae31bd1
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
1265a37
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
8004ab5
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
7a3a7c0
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
009e561
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
a3cc166
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
6789246
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
b01df13
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
0a26718
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
d986da9
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
c3bd11d
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
61d2064
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
0b32a56
the 'go.mod' file has been changed | the 'go.sum' file has been chang…
noneandundefined May 10, 2025
085b154
the 'Makefile' file has been changed | changed value in variable m, c…
noneandundefined May 10, 2025
dffcf25
changed the 'v2.0.x-pre' branch
noneandundefined May 10, 2025
9a0acde
deleted type of
noneandundefined May 10, 2025
c9060ed
added function ParseToStructureClass, added function parseTSJSClass, …
noneandundefined May 11, 2025
bf23c89
added function FormattedImport | added switch: lang (cases: 'python',…
noneandundefined May 11, 2025
0559ef0
build 'binary file' for release/push bin/auto-commit
noneandundefined May 11, 2025
60ea932
include 'fmt' in auto-import.go
noneandundefined May 11, 2025
374911e
include 'go' in auto-logic.go | the 'auto-commit' file has been chang…
noneandundefined May 11, 2025
d9a96ce
the 'auto-commit' file has been changed
noneandundefined May 11, 2025
53f40ff
added variable ls
noneandundefined May 11, 2025
0f9043d
added variable ls | the 'auto-commit' file has been changed
noneandundefined May 11, 2025
6f99c77
added variable ls | added logic to the 'auto-logic.go' file
noneandundefined May 11, 2025
f247c61
changed the 'v2.0.x-pre' branch
noneandundefined May 11, 2025
be62f4f
the 'auto-commit' file has been changed
noneandundefined May 11, 2025
5ad1718
build 'binary file' for release/push bin/auto-commit
noneandundefined May 11, 2025
2bc542f
added logic to the 'auto-oop.go' file | the 'auto-commit' file has be…
noneandundefined May 11, 2025
67a7799
build 'binary file' for release/push bin/auto-commit
noneandundefined May 11, 2025
3646a87
added functions: Test, Sys | the 'auto-commit' file has been changed
noneandundefined May 11, 2025
4a774df
deleted function Sys
noneandundefined May 11, 2025
7bfe097
added function Test1 | renamed function Test -> Test11
noneandundefined May 11, 2025
180a13d
added function Test1 | deleted function Test11 | renamed function Tes…
noneandundefined May 11, 2025
2dd08a1
added function Test1 | deleted function Test11 | renamed function Tes…
noneandundefined May 11, 2025
9c9f960
renamed function Test11 -> Test
noneandundefined May 11, 2025
e33761b
deleted functions: Test, Test1
noneandundefined May 11, 2025
31a4f75
added logic to the 'auto-import.go' file | the 'auto-commit' file has…
noneandundefined May 11, 2025
7a7f2d9
added variable name
noneandundefined May 11, 2025
19bc60b
added variables: single, multiple
noneandundefined May 11, 2025
6252bdf
added variable singleKLK | renamed variable single -> singleKLK
noneandundefined May 11, 2025
4d757ac
added variable ageIs | renamed variable multiple -> nameIs | deleted …
noneandundefined May 11, 2025
2cb4742
changed the 'v2.0.x-pre' branch
noneandundefined May 11, 2025
e250bd7
changed the 'v2.0.x-pre' branch
noneandundefined May 11, 2025
7a258a5
changed the 'v2.0.x-pre' branch
noneandundefined May 11, 2025
bde9439
changed value in variable m | added logic to the 'auto-variables.go' …
noneandundefined May 11, 2025
482604c
added variables: artemiikShort, artemiikLong, artemiikAvg
noneandundefined May 11, 2025
59ed6c6
changed value in variable artemiikShort
noneandundefined May 11, 2025
1b11532
changed type of variable artemiikLong (string -> int)
noneandundefined May 11, 2025
0f67c81
added variables: quoted, quoted, quoted, quoted, quoted, quoted, quot…
noneandundefined May 11, 2025
f189d50
build 'binary file' for release/push bin/auto-commit
noneandundefined May 11, 2025
29c05a3
changed the 'v2.0.x-pre' branch
noneandundefined May 11, 2025
d53e818
build 'binary file' for release/push bin/auto-commit
noneandundefined May 11, 2025
18ec5fc
the 'LGPL-2.1' file has been changed
noneandundefined May 11, 2025
c1a417e
build 'binary file' for release/push bin/auto-commit
noneandundefined May 11, 2025
8700039
added variable replacements | added function describeCondition | adde…
noneandundefined May 12, 2025
2b24858
renamed function describeCondition -> _
noneandundefined May 12, 2025
2de8acb
build 'binary file' for release/push bin/auto-commit
noneandundefined May 12, 2025
332eef3
Merge remote-tracking branch 'origin/v2.0.x-pre' into redo-accumulati…
noneandundefined May 12, 2025
fdc490c
added limit commit 255+ length
noneandundefined May 12, 2025
630e8f3
Merge pull request #32 from thefuture-industries/redo-accumulation-co…
noneandundefined May 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,55 @@ jobs:
tag_name: ${{ steps.version.outputs.version }}
name: '${{ steps.version.outputs.version }}'
body: |
A new version of git-auto-commit is available "${{ steps.version.outputs.version }}"! A command-line utility that analyzes changes and automatically generates the name of the commit it.
## Git auto-commit - automatic commit generation tool

> A new version of git-auto-commit is available `${{ steps.version.outputs.version }}`! A command-line utility that analyzes changes and automatically generates the name of the commit it.

Git Auto-Commit is an extension for the Git version control system designed to automatically generate meaningful and context—sensitive commit messages based on changes made to the codebase. The tool simplifies developers' workflows by allowing them to focus on the content of edits rather than on the formulation of descriptions for commits.

The development is conducted as an open source project and is distributed under the MIT license (or other compatible licensing, depending on the implementation). Git Auto-Commit can be integrated into CI/CD pipelines, hook scripts, or used manually via the command line.

Main features:

- Analysis of changes in the work tree and automatic generation of commit messages in natural language.
- Integration with Git via the `git auto` sub-command or configuration of user aliases.
- Support for templates and configurations for configuring the message structure in accordance with project standards (Conventional Commits, Semantic Commit Messages, etc.).
- Scalability: works both in small projects and in large monorepositories.

### Install

#### If you're on windows

Go to the root of the project and run the command.

```bash
iex ((New-Object Net.WebClient).DownloadString('https://github.com/thefuture-industries/git-auto-commit/blob/main/scripts/install-windows-auto-commit.ps1?raw=true'))
```

#### If you're on linux

Go to the root of the project and run the command.

```bash
curl -fsSL https://github.com/thefuture-industries/git-auto-commit/blob/main/scripts/install-linux-auto-commit.sh?raw=true | bash
```

### Setting up

#### Launch

Everything is ready now, after making changes to the code, just run:

```bash
git add .
git auto
git push
```

${{ steps.changelog.outputs.changelog_issues_by_label }}

### Pull Requests

${{ steps.changelog.outputs.changelog_pr }}

[©thefuture-industries](https://github.com/thefuture-industries)
Expand Down
17 changes: 17 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
set -e

REPO_ROOT=$(git rev-parse --show-toplevel)

echo "Running pre-push hook..."

cd "$REPO_ROOT"
make fmt
make lint
make check
make buildrelease

git add .
git commit -m "build 'binary file' for release/push bin/auto-commit"

echo "[+] Success pre-push!"
511 changes: 511 additions & 0 deletions LGPL-2.1

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ build:
@echo "Running build..."
@go build -o bin/auto-commit .

buildrelease:
@echo "Running release build..."
@go build -ldflags="-s -w" -trimpath -o bin/auto-commit .
@upx.exe --best --lzma bin/auto-commit

test:
@go test -v ./...

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ curl -fsSL https://github.com/thefuture-industries/git-auto-commit/blob/main/scr

Everything is ready now, after making changes to the code, just run:

- 1 Option

```bash
git add .
git auto
git push
```

- 2 Option

```bash
git auto -w OR git auto --watch - Comit observer, you don't have to think and write more `git auto` -w (--watch) will figure it out when to make a comit and commit it yourself!
```
134 changes: 97 additions & 37 deletions auto-function.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package main

import (
"fmt"
"git-auto-commit/types"
"regexp"
"strings"
)

var (
functionRegexGo = regexp.MustCompile(`func\s+(\w+)\s*\(([^)]*)\)`)
functionRegexPython = regexp.MustCompile(`def\s+(\w+)\s*\(([^)]*)\)`)
functionRegexTSJS = regexp.MustCompile(`function\s+(\w+)\s*\(([^)]*)\)(:\s*(\w+))?`)
functionRegexTSJSConst = regexp.MustCompile(`(const|let|var)\s+(\w+)\s*=\s*(?:function)?\s*\(([^)]*)\)\s*=>?`)
functionRegexCJava = regexp.MustCompile(`(\w+)\s+(\w+)\s*\(([^)]*)\)`)
functionRegexCSharp = regexp.MustCompile(`(public|private|protected|internal)?\s*(static)?\s*(\w+)\s+(\w+)\s*\(([^)]*)\)`)
)

func ParseToStructureFunction(line, lang string) *types.FunctionSignature {
switch lang {
case "go":
Expand All @@ -25,6 +33,7 @@ func ParseToStructureFunction(line, lang string) *types.FunctionSignature {
}

func FormattedFunction(diff, lang string) string {
var addedFuncs, deletedFuncs, renamedFuncs, changedParams, changedTypes []string
var oldFunc, newFunc *types.FunctionSignature

lines := strings.Split(diff, "\n")
Expand All @@ -41,14 +50,14 @@ func FormattedFunction(diff, lang string) string {
newFunc = nil

if oldFunc != nil {
return fmt.Sprintf("deleted function %s", oldFunc.Name)
deletedFuncs = append(deletedFuncs, oldFunc.Name)
}
}
} else if strings.HasPrefix(line, "+") {
newFunc = ParseToStructureFunction(line[1:], lang)

if oldFunc == nil && newFunc != nil {
return fmt.Sprintf("added function %s", newFunc.Name)
addedFuncs = append(addedFuncs, newFunc.Name)
}
} else {
oldFunc, newFunc = nil, nil
Expand All @@ -57,17 +66,17 @@ func FormattedFunction(diff, lang string) string {

if oldFunc != nil && newFunc != nil {
if oldFunc.Name != newFunc.Name {
return fmt.Sprintf("renamed function %s -> %s", oldFunc.Name, newFunc.Name)
renamedFuncs = append(renamedFuncs, oldFunc.Name+" -> "+newFunc.Name)
}

if len(oldFunc.Params) == len(newFunc.Params) {
for i := range oldFunc.Params {
if oldFunc.Params[i].Name != newFunc.Params[i].Name && oldFunc.Params[i].Type == newFunc.Params[i].Type {
return fmt.Sprintf("changed parameter in %s function", oldFunc.Name)
changedParams = append(changedParams, oldFunc.Name+" function")
}

if oldFunc.Params[i].Name == newFunc.Params[i].Name && oldFunc.Params[i].Type != newFunc.Params[i].Type {
return fmt.Sprintf("changed type '%s %s' -> '%s %s'", oldFunc.Params[i].Name, oldFunc.Params[i].Type, newFunc.Params[i].Name, newFunc.Params[i].Type)
changedTypes = append(changedTypes, oldFunc.Params[i].Name+" in "+oldFunc.Name+" function")
}
}
}
Expand All @@ -76,12 +85,46 @@ func FormattedFunction(diff, lang string) string {
}
}

return ""
var results []string
if len(addedFuncs) == 1 {
results = append(results, "added function "+addedFuncs[0])
} else if len(addedFuncs) > 1 {
results = append(results, "added functions: "+strings.Join(addedFuncs, ", "))
}

if len(deletedFuncs) == 1 {
results = append(results, "deleted function "+deletedFuncs[0])
} else if len(deletedFuncs) > 1 {
results = append(results, "deleted functions: "+strings.Join(deletedFuncs, ", "))
}

if len(renamedFuncs) == 1 {
results = append(results, "renamed function "+renamedFuncs[0])
} else if len(renamedFuncs) > 1 {
results = append(results, "renamed functions: "+strings.Join(renamedFuncs, ", "))
}

if len(changedParams) == 1 {
results = append(results, "changed parameter in "+changedParams[0])
} else if len(changedParams) > 1 {
results = append(results, "changed parameters in functions: "+strings.Join(changedParams, ", "))
}

if len(changedTypes) == 1 {
results = append(results, "changed parameter type "+changedTypes[0])
} else if len(changedTypes) > 1 {
results = append(results, "changed parameter types: "+strings.Join(changedTypes, ", "))
}

if len(results) == 0 {
return ""
}

return strings.Join(results, " | ")
}

func parseGoFunction(line string) *types.FunctionSignature {
functionRegex := regexp.MustCompile(`func\s+(\w+)\s*\(([^)]*)\)`)
m := functionRegex.FindStringSubmatch(line)
m := functionRegexGo.FindStringSubmatch(line)
if m == nil {
return nil
}
Expand All @@ -106,8 +149,7 @@ func parseGoFunction(line string) *types.FunctionSignature {
}

func parsePythonFunction(line string) *types.FunctionSignature {
functionRegex := regexp.MustCompile(`def\s+(\w+)\s*\(([^)]*)\)`)
m := functionRegex.FindStringSubmatch(line)
m := functionRegexPython.FindStringSubmatch(line)
if m == nil {
return nil
}
Expand All @@ -133,39 +175,59 @@ func parsePythonFunction(line string) *types.FunctionSignature {
}

func parseTSJSFunction(line string) *types.FunctionSignature {
functionRegex := regexp.MustCompile(`function\s+(\w+)\s*\(([^)]*)\)(:\s*(\w+))?`)
m := functionRegex.FindStringSubmatch(line)
if m == nil {
return nil
}
m := functionRegexTSJS.FindStringSubmatch(line)
if m != nil {
name := m[1]
returnType := ""
if len(m) > 4 {
returnType = m[4]
}

name := m[1]
returnType := ""
if len(m) > 4 {
returnType = m[4]
}
params := []types.FunctionParameters{}
for _, p := range strings.Split(m[2], ",") {
p = strings.TrimSpace(p)
if p == "" {
continue
}

params := []types.FunctionParameters{}
for _, p := range strings.Split(m[2], ",") {
p = strings.TrimSpace(p)
if p == "" {
continue
parts := strings.Split(p, ":")
if len(parts) == 2 {
params = append(params, types.FunctionParameters{Name: strings.TrimSpace(parts[0]), Type: strings.TrimSpace(parts[1])})
} else {
params = append(params, types.FunctionParameters{Name: p, Type: ""})
}
}

parts := strings.Split(p, ":")
if len(parts) == 2 {
params = append(params, types.FunctionParameters{Name: strings.TrimSpace(parts[0]), Type: strings.TrimSpace(parts[1])})
} else {
params = append(params, types.FunctionParameters{Name: p, Type: ""})
return &types.FunctionSignature{Name: name, Params: params, ReturnType: returnType}
}

m = functionRegexTSJSConst.FindStringSubmatch(line)
if m != nil {
name := m[2]

params := []types.FunctionParameters{}
for _, p := range strings.Split(m[3], ",") {
p = strings.TrimSpace(p)
if p == "" {
continue
}

parts := strings.Split(p, ":")
if len(parts) == 2 {
params = append(params, types.FunctionParameters{Name: strings.TrimSpace(parts[0]), Type: strings.TrimSpace(parts[1])})
} else {
params = append(params, types.FunctionParameters{Name: p, Type: ""})
}
}

return &types.FunctionSignature{Name: name, Params: params, ReturnType: ""}
}

return &types.FunctionSignature{Name: name, Params: params, ReturnType: returnType}
return nil
}

func parseCJavaFunction(line string) *types.FunctionSignature {
functionRegex := regexp.MustCompile(`(\w+)\s+(\w+)\s*\(([^)]*)\)`)
m := functionRegex.FindStringSubmatch(line)
m := functionRegexCJava.FindStringSubmatch(line)
if m == nil {
return nil
}
Expand All @@ -192,9 +254,7 @@ func parseCJavaFunction(line string) *types.FunctionSignature {
}

func parseCSharpFunction(line string) *types.FunctionSignature {
functionRegex := regexp.MustCompile(`(public|private|protected|internal)?\s*(static)?\s*(\w+)\s+(\w+)\s*\(([^)]*)\)`)

m := functionRegex.FindStringSubmatch(line)
m := functionRegexCSharp.FindStringSubmatch(line)
if m == nil {
return nil
}
Expand Down
Loading
Loading