sweet-commit
Advanced tools
| # Contributing to sweet-commit | ||
| Thanks for taking an interest in contributing! To keep collaboration smooth, | ||
| please follow this simple process before opening a pull request: | ||
| 1. Create an Issue first | ||
| - Open an issue describing the bug or feature request. | ||
| - Use a clear title and include these details in the body: | ||
| - **Summary**: Short description of the problem or feature. | ||
| - **Steps to reproduce** (for bugs): exact steps, environment, and | ||
| expected vs actual behaviour. | ||
| - **Proposed solution** (for features): what you think should change, | ||
| notes about API/UX, and any alternatives you considered. | ||
| - **Screenshots / logs**: attach if applicable. | ||
| - Wait for maintainers to triage and label the issue. You can comment | ||
| in the issue with questions or additional info. | ||
| 2. Work on the issue | ||
| - Create a topic branch off of `dev` named with the pattern: | ||
| - `fix/<short-description>` for bug fixes | ||
| - `feat/<short-description>` for new features | ||
| - `chore/<short-description>` for maintenance | ||
| - Keep commits focused and well described. Prefer multiple small commits | ||
| over one big change. | ||
| 3. Open a Pull Request (PR) | ||
| - Target branch: **base = `dev`** (PRs must be opened against `dev`). | ||
| - In the PR description, reference the related issue, e.g. `Closes #123`. | ||
| - Include a summary of changes, testing steps, and any manual checks. | ||
| - Add screenshots or logs if the change affects UI or output. | ||
| 4. PR Checklist | ||
| - [ ] The PR targets the `dev` branch | ||
| - [ ] The related issue is linked in the PR description | ||
| - [ ] Tests added or updated where appropriate | ||
| - [ ] Linter/formatting passes locally | ||
| - [ ] Documentation updated if public behavior changed | ||
| 5. Reviews and Merging | ||
| - A maintainer will review your PR and may request changes. | ||
| - Address review feedback by pushing follow-up commits to the same branch. | ||
| - Once approved, maintainers will merge the PR into `dev`. | ||
| Notes | ||
| - If your change is large or risky, open a draft PR early so maintainers | ||
| can give feedback during implementation. | ||
| - If you need help picking an issue to work on, ask in the relevant issue | ||
| or open a short discussion issue describing what you'd like to attempt. | ||
| Thank you — your contributions make this project better! |
+475
| GNU AFFERO GENERAL PUBLIC LICENSE | ||
| Version 3, 19 November 2007 | ||
| Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> | ||
| Everyone is permitted to copy and distribute verbatim copies | ||
| of this license document, but changing it is not allowed. | ||
| Preamble | ||
| The GNU Affero General Public License is a free, copyleft license for | ||
| software and other kinds of works, specifically designed to ensure | ||
| cooperation with the community in the case of network server software. | ||
| The licenses for most software and other practical works are designed | ||
| to take away your freedom to share and change the works. By contrast, | ||
| our General Public Licenses are intended to guarantee your freedom to | ||
| share and change all versions of a program--to make sure it remains | ||
| free software for all its users. | ||
| When we speak of free software, we are referring to freedom, not | ||
| price. Our General Public Licenses are designed to make sure that you | ||
| have the freedom to distribute copies of free software (and charge for | ||
| them if you wish), that you receive source code or can get it if you | ||
| want it, that you can change the software or use pieces of it in new | ||
| free programs, and that you know you can do these things. | ||
| Developers that use our General Public Licenses protect your rights | ||
| with two steps: (1) assert copyright on the software, and (2) offer | ||
| you this License which gives you legal permission to copy, distribute | ||
| and/or modify the software. | ||
| An additional provision, the Affero clause, ensures that users who | ||
| interact with the software remotely through a network also have the | ||
| right to receive the source code for the version that runs on the | ||
| server. This is important for server-side and web-hosted software. | ||
| This License is a version of the GNU General Public License, with an | ||
| additional requirement that the source code of modified versions be | ||
| made available to all users who interact with the modified program | ||
| over a network. | ||
| TERMS AND CONDITIONS | ||
| 0. Definitions. | ||
| "This License" refers to version 3 of the GNU Affero General Public | ||
| License. | ||
| "Copyright" also means copyright-like laws that apply to other kinds | ||
| of works, such as semiconductor mask works. | ||
| "The Program" refers to any copyrightable work licensed under this | ||
| License. Each licensee is addressed as "you". "Licensees" and | ||
| "recipients" may be individuals or organizations. | ||
| To "modify" a work means to copy from or adapt all or part of the | ||
| work in a fashion requiring copyright permission, other than the | ||
| making of an exact copy. The resulting work is called a "modified | ||
| version" of the earlier work or a work "based on" the earlier work. | ||
| A "covered work" means either the unmodified Program or a work based | ||
| on the Program. | ||
| To "propagate" a work means to do anything with it that, without | ||
| permission, would make you directly or secondarily liable for | ||
| infringement under applicable copyright law, except executing it on a | ||
| computer or modifying a private copy. Propagation includes copying, | ||
| distribution (with or without modification), making available to the | ||
| public, and in some countries other activities as well. | ||
| To "convey" a work means any kind of propagation that enables other | ||
| parties to make or receive copies. Mere interaction with a user through | ||
| a computer network, with no transfer of a copy, is not conveying. | ||
| An interactive user interface displays "Appropriate Legal Notices" | ||
| to the extent that it includes a convenient and prominently visible | ||
| feature that (1) displays an appropriate copyright notice, and (2) | ||
| tells the user that there is no warranty for the work (except to the | ||
| extent that warranties are provided), that licensees may convey the | ||
| work under this License, and how to view a copy of this License. If | ||
| the interface presents a list of user commands or options, such as a | ||
| menu, a prominent item in the list meets this criterion. | ||
| 1. Source Code. | ||
| The "source code" for a work means the preferred form of the work | ||
| for making modifications to it. "Object code" means any non-source | ||
| form of a work. | ||
| A "Standard Interface" means an interface that either is an official | ||
| standard defined by a recognized standards body, or, in the case of | ||
| interfaces specified for a particular programming language, one that | ||
| is widely used among developers working in that language. | ||
| The "System Libraries" of an executable work include anything, other | ||
| than the work as a whole, that (a) is included in the normal form of | ||
| packaging a Major Component, but which is not part of that Major | ||
| Component, and (b) serves only to enable use of the work with that | ||
| Major Component, or to implement a Standard Interface for which an | ||
| implementation is available to the public in source code form. A | ||
| "Major Component", in this context, means a major essential component | ||
| (kernel, window system, and so on) of the specific operating system | ||
| (if any) on which the executable work runs, or a compiler used to | ||
| produce the work, or an object code interpreter used to run it. | ||
| 2. Basic Permissions. | ||
| All rights granted under this License are granted for the term of | ||
| copyright on the Program, and are irrevocable provided the stated | ||
| conditions are met. This License explicitly affirms your unlimited | ||
| permission to run the unmodified Program. The output from running a | ||
| covered work is covered by this License only if the output, given its | ||
| content, constitutes a covered work. This License acknowledges your | ||
| rights of fair use or other equivalent, as provided by copyright law. | ||
| You may make, run and propagate covered works that you do not | ||
| convey, without conditions so long as your license otherwise remains | ||
| in force. You may convey covered works to others for the sole purpose | ||
| of having them make modifications exclusively for you, or provide you | ||
| with facilities for running those works, provided that you comply | ||
| with the terms of this License in conveying all material for which | ||
| you do not control the copyright. | ||
| Conveying under any other circumstances is permitted solely under the | ||
| conditions stated below. Sublicensing is not allowed; section 10 | ||
| makes it unnecessary. | ||
| 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | ||
| No covered work shall be deemed part of an effective technological | ||
| measure under any applicable law fulfilling obligations under article | ||
| 11 of the WIPO copyright treaty adopted on 20 December 1996, or | ||
| similar laws prohibiting or restricting circumvention of such | ||
| measures. | ||
| When you convey a covered work, you waive any legal power to forbid | ||
| circumvention of technological measures to the extent such circumvention | ||
| is effected by exercising rights under this License with respect to | ||
| the covered work, and you disclaim any intention to limit operation or | ||
| modification of the work as a means of enforcing, against the work's | ||
| users, your or third parties' legal rights to forbid circumvention of | ||
| technological measures. | ||
| 4. Conveying Verbatim Copies. | ||
| You may convey verbatim copies of the Program's source code as you | ||
| receive it, in any medium, provided that you conspicuously and | ||
| appropriately publish on each copy an appropriate copyright notice; | ||
| keep intact all notices stating that this License and any | ||
| non-permissive terms added in accord with section 7 apply to the code; | ||
| keep intact all notices of the absence of any warranty; and give all | ||
| recipients a copy of this License along with the Program. | ||
| You may charge any price or no price for each copy that you convey, | ||
| and you may offer support or warranty protection for a fee. | ||
| 5. Conveying Modified Source Versions. | ||
| You may convey a work based on the Program, or the modifications to | ||
| produce it from the Program, in the form of source code under the | ||
| terms of section 4, provided that you also meet all of these | ||
| conditions: | ||
| a) The work must carry prominent notices stating that you modified | ||
| it, and giving a relevant date. | ||
| b) The work must carry prominent notices stating that it is released | ||
| under this License and any relevant additional terms. | ||
| c) You must license the entire work, as a whole, under this License | ||
| to anyone who comes into possession of a copy. This License gives | ||
| no permission to license the work in any other way, but it does not | ||
| invalidate such permission if you have separately received it. | ||
| d) If the work has interactive user interfaces, each must display | ||
| Appropriate Legal Notices; however, if the Program has interactive | ||
| interfaces that do not display Appropriate Legal Notices, your | ||
| work need not make them do so. | ||
| A compilation of a covered work with other separate and independent | ||
| works, which are not by their nature extensions of the covered work, | ||
| and which are not combined with it such as to form a larger program, | ||
| in or on a volume of a storage or distribution medium, is called an | ||
| "aggregate" if the compilation and its resulting copyright are not | ||
| used to limit the access or legal rights of the compilation's users | ||
| beyond what the separate works permit. Inclusion of a covered work | ||
| in an aggregate does not cause this License to apply to the other | ||
| parts of the aggregate. | ||
| 6. Conveying Non-Source Forms. | ||
| You may convey a covered work in object code form under the terms | ||
| of sections 4 and 5, provided that you also convey the machine-readable | ||
| Corresponding Source under the terms of this License, in one of the | ||
| following ways: | ||
| a) Convey the object code in, or embodied in, a physical product | ||
| (including a physical distribution medium), accompanied by the | ||
| Corresponding Source fixed on a durable physical medium customarily | ||
| used for software interchange. | ||
| b) Accompany the object code with a written offer, valid for at | ||
| least three years, to give anyone who possesses the object code a | ||
| copy of the Corresponding Source for a price no more than your | ||
| reasonable cost of physically performing this distribution. | ||
| c) Convey the object code by offering access from a designated place | ||
| (gratis or for a charge), and offer equivalent access to the | ||
| Corresponding Source in the same way through the same place at no | ||
| further charge. You need not require recipients to copy the | ||
| Corresponding Source along with the object code. | ||
| d) Convey the object code using peer-to-peer transmission, provided | ||
| you inform other peers where the object code and Corresponding Source | ||
| of the work are being offered to the public in the same way as | ||
| required by section 6c. | ||
| A separable portion of the object code, whose source code is excluded | ||
| from the Corresponding Source as a System Library, need not be | ||
| included in conveying the object code work. | ||
| 7. Additional Terms. | ||
| "Additional permissions" are terms that supplement the terms of this | ||
| License by making exceptions from one or more of its conditions. | ||
| Additional permissions that are applicable to the entire Program shall | ||
| be treated as though they were included in this License, to the extent | ||
| that they are valid under applicable law. If additional permissions | ||
| apply only to part of the Program, that part may be used separately | ||
| under those permissions, but the entire Program remains governed by | ||
| this License without regard to the additional permissions. | ||
| When you convey a copy of a covered work, you may at your option | ||
| remove any additional permissions from that copy, or from any part | ||
| of it. (Additional permissions may be written to require their own | ||
| removal in certain cases when you modify the work.) You may place | ||
| additional permissions on material, added by you to a covered work, | ||
| for which you have or can give appropriate copyright permission. | ||
| Notwithstanding any other provision of this License, for material you | ||
| add to a covered work, you may (if permitted by the relevant law) | ||
| supplement the terms of this License with terms: | ||
| a) Disclaiming warranty or limiting liability differently from this | ||
| License; or | ||
| b) Requiring preservation of specified reasonable legal notices or | ||
| author attributions in that material or in the Appropriate Legal | ||
| Notices displayed by works containing it; or | ||
| c) Prohibiting misrepresentation of the origin of that material, or | ||
| requiring that modified versions of such material be marked in | ||
| reasonable ways as different from the original; or | ||
| d) Limiting the use for publicity purposes of names of licensors or | ||
| authors; or | ||
| e) Declining to grant rights under trademark law for use of some | ||
| trade names, trademarks, or service marks; or | ||
| f) Requiring indemnification of licensors and authors of that | ||
| material by anyone who conveys the material (or modified versions of | ||
| it) with contractual assumptions of liability to the recipient, for | ||
| any liability that these contractual assumptions directly impose on | ||
| those licensors and authors. | ||
| All other non-permissive additional terms are considered "further | ||
| restrictions" within the meaning of section 10. If the Program as | ||
| you received it, or any part of it, contains a notice stating that it | ||
| is governed by this License along with a term that is a further | ||
| restriction, you may remove that term. If a license document | ||
| contains a further restriction but permits relicensing or conveying | ||
| under this License, you may add to the covered work material licensed | ||
| under the terms of that license, provided that the further | ||
| restriction does not survive such relicensing. | ||
| 8. Termination. | ||
| You may not propagate or modify a covered work except as expressly | ||
| provided under this License. Any attempt otherwise to propagate or | ||
| modify it is void, and will automatically terminate your rights under | ||
| this License (including any patent licenses granted under the third | ||
| paragraph of section 11). | ||
| However, if you cease all violation of this License, then your | ||
| license from a particular copyright holder is reinstated (a) | ||
| provisionally, unless and until the copyright holder explicitly and | ||
| finally terminates your license, and (b) permanently, if the | ||
| copyright holder fails to notify you of the violation by some | ||
| appropriate means prior to 60 days after the cessation. | ||
| Moreover, your license from a particular copyright holder is | ||
| reinstated permanently if the copyright holder notifies you of the | ||
| violation by some appropriate means, this is the first time you have | ||
| received notice of violation of this License, and you cure the | ||
| violation within 30 days of your receipt of the notice. | ||
| 9. Acceptance Not Required for Having Copies. | ||
| You are not required to accept this License in order to receive or | ||
| run a copy of the Program. Ancillary propagation of a covered work | ||
| occurring solely as a consequence of using peer-to-peer transmission | ||
| to receive a copy likewise does not require acceptance. However, | ||
| nothing other than this License grants you permission to propagate or | ||
| modify any covered work. These actions infringe copyright if you do | ||
| not accept this License. Therefore, by modifying or propagating a | ||
| covered work, you indicate your acceptance of this License to do so. | ||
| 10. Automatic Licensing of Downstream Recipients. | ||
| Each time you convey a covered work, the recipient automatically | ||
| receives a license from the original licensors, to run, modify and | ||
| propagate that work, subject to this License. You are not | ||
| responsible for enforcing compliance by third parties with this | ||
| License. | ||
| 11. Patents. | ||
| A "contributor" is a copyright holder who authorizes use under this | ||
| License of the Program or a work on which the Program is based. The | ||
| work thus licensed is called the contributor's "contributor version". | ||
| A contributor's "essential patent claims" are all patent claims | ||
| owned or controlled by the contributor, whether already acquired or | ||
| hereafter acquired, that would be infringed by some manner, permitted | ||
| by this License, of making, using, or selling its contributor | ||
| version, but do not include claims that would be infringed only as a | ||
| consequence of further modification of the contributor version. | ||
| Each contributor grants you a non-exclusive, worldwide, royalty-free | ||
| patent license under the contributor's essential patent claims, to | ||
| make, use, sell, offer for sale, import and otherwise run, modify and | ||
| propagate the contributor version. | ||
| In the following three paragraphs, a "patent license" is any | ||
| express agreement or commitment, however denominated, not to enforce a | ||
| patent (such as an express permission to practice a patent or covenant | ||
| not to sue). To "grant" such a patent license to a party means to | ||
| make such an agreement or commitment not to enforce a patent against | ||
| the party. | ||
| If you convey a covered work, knowingly relying on a patent license, | ||
| and the Corresponding Source of the work is not available for anyone | ||
| to copy, free of charge and under the terms of this License, through | ||
| a publicly available network server or other readily accessible means, | ||
| then you must either (1) cause the Corresponding Source to be so | ||
| available, or (2) arrange to deprive yourself of the benefit of the | ||
| patent license for this particular work, or (3) arrange, in a manner | ||
| consistent with the requirements of this License, to extend the patent | ||
| license to downstream recipients. "Knowingly relying" means you have | ||
| actual knowledge that, but for the patent license, your conveying the | ||
| covered work in a country, or your recipient's use of the work in a | ||
| country, would infringe one or more identifiable patents in that | ||
| country that you have reason to believe are valid. | ||
| If, pursuant to or in connection with a single transaction or | ||
| arrangement, you convey, or propagate by procuring conveyance of, a | ||
| covered work, and grant a patent license to some of the parties | ||
| receiving the covered work authorizing them to use, propagate, modify | ||
| or convey a specific copy of the covered work, then the patent | ||
| license you grant is automatically extended to all recipients of the | ||
| covered work and applies to the covered work in the form received by | ||
| them. | ||
| Notwithstanding any other provision of this License, you may not | ||
| propagate or modify a covered work if you are a party to an | ||
| arrangement with a third party that is in the business of distributing | ||
| software, under which you make payments to the third party to distribute | ||
| the work, and the third party has a policy of refusing to distribute | ||
| source code for works that it distributes or of imposing further | ||
| restrictions on recipients' exercise of the rights granted herein. | ||
| 12. No Surrender of Others' Freedom. | ||
| If conditions are imposed on you (whether by court order, agreement or | ||
| otherwise) that contradict the conditions of this License, they do not | ||
| excuse you from the conditions of this License. If you cannot convey | ||
| a covered work so as to satisfy simultaneously your obligations under | ||
| this License and any other pertinent obligations, then as a | ||
| consequence you may not convey it at all. For example, if you agree | ||
| to terms that obligate you to collect a royalty for further conveying | ||
| from those to whom you convey the Program, the only way you could | ||
| satisfy both those terms and this License would be to refrain from | ||
| conveying the Program. | ||
| 13. Use with the GNU General Public License. | ||
| Notwithstanding any other provision of this License, you have | ||
| permission to link or combine any covered work with a work licensed | ||
| under version 3 of the GNU General Public License into a single | ||
| combined work, and to convey the resulting work. The terms of this | ||
| License will continue to apply to the part which is the covered work, | ||
| but the work with which it is combined will remain governed by GPLv3. | ||
| 14. Revised Versions of this License. | ||
| The Free Software Foundation may publish revised and/or new versions | ||
| of the GNU Affero General Public License from time to time. Such new | ||
| versions will be similar in spirit to the present version, but may | ||
| differ in detail to address new problems or concerns. | ||
| Each version is given a distinguishing version number. If the | ||
| Program specifies that a certain numbered version of this License "or | ||
| any later version" applies to it, you have the option of following | ||
| the terms and conditions either of that specified version or of any | ||
| later version that has been published (not as a draft) by the Free | ||
| Software Foundation. If the Program does not specify a version | ||
| number of this License, you may choose any version ever published | ||
| (not as a draft) by the Free Software Foundation. | ||
| If the Program specifies that a proxy can decide which future | ||
| versions of the License can be used, that proxy's public statement of | ||
| acceptance of a version permanently authorizes you to choose that | ||
| version for the Program. | ||
| 15. Disclaimer of Warranty. | ||
| THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | ||
| APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | ||
| HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT | ||
| WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND | ||
| PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE | ||
| DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR | ||
| CORRECTION. | ||
| 16. Limitation of Liability. | ||
| IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
| WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR | ||
| CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | ||
| INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES | ||
| ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT | ||
| NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSS | ||
| OF PROFIT OR BUSINESS INTERRUPTION), EVEN IF SUCH HOLDER OR OTHER | ||
| PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | ||
| 17. Termination of the AGPL for Certain Non-Public Deployment. | ||
| If you modify the Program and run the modified Program on a server | ||
| where users interact with it remotely through a network, you must | ||
| provide those users with access to the Corresponding Source of the | ||
| modified Program. Failure to do so constitutes a violation of this | ||
| License and terminates the rights granted to you under this License. | ||
| END OF TERMS AND CONDITIONS | ||
| How to Apply These Terms to Your New Programs | ||
| If you develop a new program, and you want it to be of the greatest | ||
| possible use to the public, the best way to achieve this is to make it | ||
| free software which everyone can redistribute and change under these | ||
| terms. | ||
| To do so, attach the following notices to the program. It is safest | ||
| to attach them to the start of each source file to most effectively | ||
| state the exclusion of warranty; and each file should have at least | ||
| the "copyright" line and a pointer to where the full notice is found. | ||
| <one line to give the program's name and a brief idea of what it does.> | ||
| Copyright (C) 2025 d3xfoo | ||
| This program is free software: you can redistribute it and/or modify | ||
| it under the terms of the GNU Affero General Public License as | ||
| published by the Free Software Foundation, either version 3 of the | ||
| License, or (at your option) any later version. | ||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU Affero General Public License for more details. | ||
| You should have received a copy of the GNU Affero General Public License | ||
| along with this program. If not, see <https://www.gnu.org/licenses/>. |
+3
-3
| { | ||
| "name": "sweet-commit", | ||
| "version": "2.1.0", | ||
| "version": "2.2.0", | ||
| "description": "AI-powered commit messages that just work. One command, perfect commits, every time.", | ||
@@ -24,4 +24,4 @@ "main": "index.js", | ||
| ], | ||
| "author": "d3xfoo", | ||
| "license": "ISC", | ||
| "author": "nhdfr", | ||
| "license": "AGPL-3.0", | ||
| "repository": { | ||
@@ -28,0 +28,0 @@ "type": "git", |
+29
-13
@@ -13,15 +13,28 @@ # sweet-commit | ||
| ## Update | ||
| To update to the latest version: | ||
| ```bash | ||
| npm update -g sweet-commit | ||
| ``` | ||
| Check your current version: | ||
| ```bash | ||
| npm list -g sweet-commit | ||
| ``` | ||
| ## Usage | ||
| 1. Stage your changes: | ||
| 1. Generate and commit (will prompt to stage if needed): | ||
| ```bash | ||
| git add . | ||
| ``` | ||
| 2. Generate and commit: | ||
| ```bash | ||
| scom | ||
| ``` | ||
| The tool will analyze your staged changes, generate a conventional commit message using AI, show it to you, and commit after confirmation. | ||
| The tool will: | ||
| - Check for unstaged changes and offer to stage them automatically | ||
| - Analyze your changes using AI | ||
| - Generate 3 different commit message options with colored headings | ||
| - Let you choose your preferred message | ||
| - Commit after confirmation | ||
@@ -62,8 +75,11 @@ ## Setup | ||
| - Automatic analysis of staged git changes | ||
| - Generates conventional commit messages following best practices | ||
| - Uses Gemini AI for intelligent commit message creation | ||
| - Clean, minimal interface with no unnecessary output | ||
| - Zero configuration required after API key setup | ||
| - Supports both environment variables and .env files | ||
| - **Multiple commit message options**: Generate 3 variations with different perspectives and detail levels | ||
| - **Auto-stage prompt**: Automatically offers to stage unstaged changes | ||
| - **Intelligent message generation**: Comprehensive bodies for complex changes, concise for simple ones | ||
| - **Automatic analysis**: Analyzes staged git changes with smart optimization for large changesets | ||
| - **Conventional commits**: Follows best practices and conventional commit format | ||
| - **Gemini AI powered**: Uses latest Gemini AI for intelligent commit message creation | ||
| - **Clean interface**: Minimal, beautiful CLI with no unnecessary output | ||
| - **Zero configuration**: Works immediately after API key setup | ||
| - **Flexible setup**: Supports environment variables and .env files | ||
@@ -70,0 +86,0 @@ ## Dependencies |
+113
-19
@@ -50,6 +50,49 @@ import fs from "fs/promises"; | ||
| if (!hasStagedChanges) { | ||
| p.cancel( | ||
| "No staged changes found. Stage your changes first with: git add .", | ||
| ); | ||
| process.exit(1); | ||
| const hasUnstagedChanges = stdout | ||
| .split("\n") | ||
| .some( | ||
| (line) => | ||
| line.startsWith(" M") || | ||
| line.startsWith("??") || | ||
| line.startsWith(" D") || | ||
| line.startsWith("AM") || | ||
| line.startsWith("MM"), | ||
| ); | ||
| if (hasUnstagedChanges) { | ||
| p.note( | ||
| "No staged changes found, but you have unstaged changes.", | ||
| "Nothing to commit", | ||
| ); | ||
| let shouldStageAll; | ||
| try { | ||
| shouldStageAll = await p.confirm({ | ||
| message: "Do you want to stage all changes?", | ||
| initialValue: true, | ||
| }); | ||
| } catch (error) { | ||
| p.cancel("Operation cancelled."); | ||
| process.exit(130); | ||
| } | ||
| if (p.isCancel(shouldStageAll) || shouldStageAll !== true) { | ||
| p.cancel("Stage your changes first with: git add <files>"); | ||
| process.exit(0); | ||
| } | ||
| const spinner = p.spinner(); | ||
| spinner.start("Staging all changes..."); | ||
| try { | ||
| await execGit("git add ."); | ||
| spinner.stop("All changes staged!"); | ||
| } catch (error) { | ||
| spinner.stop("Failed to stage changes."); | ||
| p.cancel(`Unable to stage changes: ${error.message}`); | ||
| process.exit(1); | ||
| } | ||
| } else { | ||
| p.cancel("No changes found. Make some changes first."); | ||
| process.exit(1); | ||
| } | ||
| } | ||
@@ -250,5 +293,5 @@ } catch (error) { | ||
| async function generateCommitMessage(apiKey, diff) { | ||
| async function generateCommitMessage(apiKey, diff, count = 3) { | ||
| const spinner = p.spinner(); | ||
| spinner.start("Analyzing changes and generating commit message..."); | ||
| spinner.start("Analyzing changes and generating commit messages..."); | ||
@@ -265,3 +308,3 @@ try { | ||
| const prompt = `Generate a conventional commit message based on this git ${isOptimized ? "change summary" : "diff"}. | ||
| const prompt = `Generate ${count} different conventional commit messages based on this git ${isOptimized ? "change summary" : "diff"}. | ||
@@ -271,7 +314,17 @@ Rules: | ||
| - Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build | ||
| - Keep description under 50 characters | ||
| - Keep the subject line (first line) under 72 characters | ||
| - Use imperative mood (add, fix, update, not added, fixed, updated) | ||
| - Add a body with bullet points if needed, max 72 chars per line | ||
| - IMPORTANT: For significant or complex changes, add a detailed body explaining: | ||
| * What changed and why | ||
| * Key implementation details | ||
| * Breaking changes if any | ||
| * Related components or files affected | ||
| - Body lines should wrap at 72 characters | ||
| - Separate subject from body with a blank line | ||
| - Use bullet points (- or *) in body for multiple points | ||
| - No markdown formatting, just plain text | ||
| ${isOptimized ? "- This is a summarized view of a large changeset, focus on the overall impact" : ""} | ||
| - Provide ${count} variations with different perspectives, detail levels, or focus areas | ||
| - One option should be concise (2-3 lines), others can be more detailed if changes warrant it | ||
| - Separate each commit message with "---" on its own line | ||
@@ -281,3 +334,3 @@ ${isOptimized ? "Change summary" : "Git diff"}: | ||
| Return only the commit message, nothing else.`; | ||
| Return only the ${count} commit messages separated by ---, nothing else.`; | ||
@@ -289,9 +342,14 @@ const result = await client.models.generateContent({ | ||
| let message = result.text.trim(); | ||
| let response = result.text.trim(); | ||
| message = message.replace(/^```[\s\S]*?\n/, "").replace(/\n```$/, ""); | ||
| message = message.replace(/\*\*(.*?)\*\*/g, "$1"); | ||
| response = response.replace(/^```[\s\S]*?\n/, "").replace(/\n```$/, ""); | ||
| response = response.replace(/\*\*(.*?)\*\*/g, "$1"); | ||
| spinner.stop("Commit message generated!"); | ||
| return message; | ||
| const messages = response | ||
| .split(/\n---\n|^---$|---$/gm) | ||
| .map((msg) => msg.trim()) | ||
| .filter((msg) => msg.length > 0); | ||
| spinner.stop("Commit messages generated!"); | ||
| return messages.length > 0 ? messages : [response]; | ||
| } catch (error) { | ||
@@ -390,3 +448,3 @@ spinner.stop("Failed to generate commit message."); | ||
| process.on("unhandledRejection", (reason, promise) => { | ||
| process.on("unhandledRejection", (reason) => { | ||
| p.cancel(`Unexpected error: ${reason}`); | ||
@@ -451,6 +509,42 @@ process.exit(1); | ||
| const message = await generateCommitMessage(apiKey, diff); | ||
| const messages = await generateCommitMessage(apiKey, diff, 3); | ||
| p.note(message, "Generated commit message"); | ||
| let selectedMessage; | ||
| if (messages.length === 1) { | ||
| p.note(messages[0], "Generated commit message"); | ||
| selectedMessage = messages[0]; | ||
| } else { | ||
| const colors = ["\x1b[36m", "\x1b[33m", "\x1b[35m"]; | ||
| const reset = "\x1b[0m"; | ||
| messages.forEach((msg, idx) => { | ||
| const colorCode = colors[idx % colors.length]; | ||
| p.note(msg, `${colorCode}Option ${idx + 1}${reset}`); | ||
| }); | ||
| const choices = messages.map((msg, idx) => ({ | ||
| value: msg, | ||
| label: `Option ${idx + 1}`, | ||
| hint: | ||
| msg.split("\n")[0].substring(0, 60) + | ||
| (msg.split("\n")[0].length > 60 ? "..." : ""), | ||
| })); | ||
| try { | ||
| selectedMessage = await p.select({ | ||
| message: "Select a commit message:", | ||
| options: choices, | ||
| }); | ||
| } catch (error) { | ||
| p.cancel("Operation cancelled."); | ||
| process.exit(130); | ||
| } | ||
| if (p.isCancel(selectedMessage)) { | ||
| p.cancel("Operation cancelled."); | ||
| process.exit(0); | ||
| } | ||
| } | ||
| let shouldCommit; | ||
@@ -468,3 +562,3 @@ try { | ||
| if (shouldCommit === true) { | ||
| await commitChanges(message); | ||
| await commitChanges(selectedMessage); | ||
| p.outro("Done!"); | ||
@@ -471,0 +565,0 @@ } else { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Copyleft License
LicenseCopyleft license information was found.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Non-permissive License
LicenseA license not known to be considered permissive was found.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
45937
177.9%6
50%485
20.95%94
20.51%2
-33.33%2
Infinity%70
-30%6
20%