Is it possible to execute apex like you'd do via stdin in cli?
It would be very helpful to inline apex straight into JS, almost like you do in cli:
echo "update new User(Id = UserInfo.getUserId(), UserPreferencesUserDebugModePref=true);" | sfdx force:apex:execute
Specifying apexcodefile means if you need to pass a record Id, you need to modify file on each run which wouldn't be very parallel safe, etc.