Here are my attempts to script an IntelliJ-based IDE.
IDE Scripting Console is backed by JSR-223 (javax.script.*) API.
Groovy, Clojure, JavaScript and other scripting languages may be used.
Open IDE Scripting Console, type a statement, hit Ctrl-Enter to execute the current line or selection.
.profile.language-extension file in the same directory will be executed along with it if present.