Package: mkcommit
mkcommitmkcommitis an extremely simple tool made for commit message generation.Runmkcommitinstead ofgit commitand you will be asked questions that keep your commits tidy even when it's 3 AM.Why?Why would anybody need this? Aren't editors enough?When working in teams it's hard to enforce proper Git commit message style from everyone. This CLI tool asks you questions to build a commit message that you can configure for yourself and your team with a very simple Python script.commitlintexists. Whymkcommit?commitlintis a great tool. But it has considerable learning curve if you want to leverage its full potential. This tool strives to be the exact opposite: provide bare minimum with almost no overhead for your teammates. All they will need to learn is this one command:mkcommit.mkcommitis:Easy to install - all you need is Python (at least version 3.6).Easy to configure - all you need is basic Python skills or advanced copy-pasting skills.Easy to use - all you need is one command to trigger the commit prompt.Scalable - it can be as complex as you want it, with full Git Hook integration and complex validation rules or just with a plain default Conventional Commit generation out-of-the-box.Pythonic - might suit you better if you're familiar with Python and don't want to venture into the world of JavaScript.InstallationIf you have Python set up, you're good to go. Runpip install mkcommitand you're done.ConfigurationAt the root of your repository create a Python file named.mkcommit.py.Compose the script:A built-inconventional commitsuite can be used:frommkcommitimportCommitMessage,to_stdoutfrommkcommit.suitesimportconventionaldefcommit():returnCommitMessage(*conventional.default())if__name__=="__main__":to_stdout(commit())If you're not familiar with Conventional Commits, here's aquick guide.If you need to define your own keywords and commit message template, readConfigurationin our Wiki.If you want to learn how to use the hook mode, readHooksin our Wiki.When you have implemented the file in one repo and want to use theexact samefile in another repo, you should useincludee.g.frommkcommitimportto_stdout,includecommit,on_commit=include("https://raw.githubusercontent.com/kjczarne/mkcommit/master/test/res/example.semantic.mkcommit.py")if__name__=="__main__":to_stdout(commit())Runmkcommit. Select the discovered configuration file for the list and follow the interactive prompt.UsageRunmkcommitto generate a Git commit message and commit changes (callsgit commit -munderneath).Runmkcommit -sto generate a Git commit message and print it to standard output.Runmkcommit -cto generate a Git commmit message and copy it to your clipboard.Usemkcommit -x "some commit message"to validate an existing commit message from the command line or as a Git Hook command (requireson_commit(msg)function to be implemented in the configuration file).If you wish to pointmkcommitto a specific configuration file, usemkcommit -f /path/to/.mkcommit.py. You can combine the-fflag with all the other available flags.Of course you may usemkcommitwithVSCode tasks.Input validationThe most basic validation strategy we use isvalidation at the time of message generation.For validation of commit messages that aren't originally generated withmkcommityou can useHooks.Built-in suitesA list of suites that are supported out-of-the-box can be found in ourWiki.