If you really want to do this non-interactively, assuming these commits are the latest 2 on your branch, you could do the following, making sure your working tree is clean first:
git reset --soft HEAD~2
git commit -m "$(git log --reverse --oneline --format="%B" ...@{1})"
This resets the branch back to the commit before the ones you want to squash, then commits the combined changes using a concatenation of the commit messages. This is flexible, so HEAD~n goes back n parents.
If your commits are anywhere but the latest commits on your branch, this won't be possible without using interactive rebase, or basically recreating the functionality of interactive rebase.
Relevant question: Is there a way to squash a number of commits non-interactively?
GIT_SEQUENCE_EDITORto any shell command you want, it doesn't have to be an ineractive editor; the pick-list manipulation doesn't have to interact with you. And there's--autosquash.git commit --squash abc123when creating a commit, you can then usegit rebase --autosquash <some relevant commit>to do what you want.