In this lesson, we implement the final piece of our MVP by automatically creating Git commits using the LLM-generated messages. We create a new `CommitWithMessage` function in our git package that uses the exec package to call `git commit -e` with the generated message. The `-e` flag is crucial here—it opens the commit message in the user's text editor, allowing them to review and modify the AI-generated message before committing, rather than blindly accepting it.
During implementation, we encounter an interesting issue where the application hangs after generating the message. This happens because the git process opens a text editor subprocess, but we haven't connected its standard input/output streams to our terminal. We solve this by setting the command's stdin, stdout, and stderr to the OS's standard streams, allowing users to interact with the editor. With this working, we successfully complete our MVP—we can now stage changes, generate commit messages via LLM, and commit them through the normal Git workflow. Next, we'll polish the application by adding UI improvements like a loading spinner.