Skip to content

List and emmoji parameters not working as expected #46

@matthiasguentert

Description

@matthiasguentert

Super cool project. I found a bug, though. The following works and I can select from the list.

21:53:14 in demo on  main at ☸️ minikube
➜ echo "foobar" >> README.md

21:53:30 in demo on  main [!] at ☸️ minikube
➜ git add .

21:53:33 in demo on  main [+] at ☸️ minikube
➜ ai-commit --list --emmoji
? Select a commit message
  ✨ feat: add "foobar" content to README.md
  📝 docs: update README.md with "foobar" content
  🔧 chore: include "foobar" in README.md
  💄 style: incorporate "foobar" into README.md
  ♻️ refactor: modify README.md to feature "foobar"

❯ ♻️ Regenerate Commit Messages

However, if I accidentally select the empty line between "refactor..." and "regenerate." it crashes with.

Aborting commit due to empty commit message.
node:internal/errors:983
  const err = new Error(message);
              ^

Error: Command failed: git commit -F -
Aborting commit due to empty commit message.

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:882:11)
    at execSync (node:child_process:954:15)
    at makeCommit (file:///opt/homebrew/lib/node_modules/ai-commit/index.js:30:3)
    at generateListCommits (file:///opt/homebrew/lib/node_modules/ai-commit/index.js:103:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async generateAICommit (file:///opt/homebrew/lib/node_modules/ai-commit/index.js:127:7)
    at async file:///opt/homebrew/lib/node_modules/ai-commit/index.js:131:1 {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(0) [Uint8Array] [],
    Buffer(45) [Uint8Array] [
       65,  98, 111, 114, 116, 105, 110, 103,  32,
       99, 111, 109, 109, 105, 116,  32, 100, 117,
      101,  32, 116, 111,  32, 101, 109, 112, 116,
      121,  32,  99, 111, 109, 109, 105, 116,  32,
      109, 101, 115, 115,  97, 103, 101,  46,  10
    ]
  ],
  pid: 30326,
  stdout: Buffer(0) [Uint8Array] [],
  stderr: Buffer(45) [Uint8Array] [
     65,  98, 111, 114, 116, 105, 110, 103,  32,
     99, 111, 109, 109, 105, 116,  32, 100, 117,
    101,  32, 116, 111,  32, 101, 109, 112, 116,
    121,  32,  99, 111, 109, 109, 105, 116,  32,
    109, 101, 115, 115,  97, 103, 101,  46,  10
  ]
}

Node.js v22.13.1

Also, if I switch the parameters, scrolling up and down with the arrow keys is entirely broken.

21:58:53 in demo on  main [+] at ☸️ minikube  took 2m 21.0s
➜ ai-commit --emmoji --list
? Select a commit message
2. docs: update README with information about ai-commit
3. style: format README.md according to conventions
4. refactor: reorganize content in README.md
5. test: add test case for the 'foobar' addition
  ♻️ Regenerate Commit Messages
❯ ✨ feat: add 'foobar' to README.md

(Move up and down to reveal more choices)

Also it would be nice to have a --help parameter showing the available options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions