(a) Except as provided by Subsection (b), on a determination that a defendant is incompetent to stand trial, the court shall:
(1) if the defendant is charged with an offense punishable as a Class B misdemeanor:
(A) release the defendant on bail under Article 46B.0711; or
(B) commit the defendant to:
(i) a jail-based competency restoration program under Article 46B.073(e); or
(ii) a mental health facility or residential care facility under Article 46B.073(f); or
(2) if the defendant is charged with an offense punishable as a Class A misdemeanor or any higher category of offense:
(A) release the defendant on bail under Article 46B.072; or
(B) commit the defendant to a facility or a jail-based competency restoration program under Article 46B.073(c) or (d).
(b) On a determination that a defendant is incompetent to stand trial and is unlikely to be restored to competency in the foreseeable future, the court shall:
(1) proceed under Subchapter E or F; or
(2) release the defendant on bail as permitted under Chapter 17.