Description:
Context
Currently, workflow definitions are authored in standard .kt files. We are moving to Kotlin Script (.kts) files to provide a cleaner, boilerplate-free DSL. While the Kotlin compiler already successfully
processes these scripts with implicit imports and DSL receivers, IntelliJ IDEA lacks the context to resolve them. This results in false-positive "unresolved reference" (red code) errors in the editor. We need to
configure the Kotlin Scripting environment so the IDE properly understands the DSL context globally across the project.
Goals
- Migrate existing workflow definitions from .kt to .kts (e.g., *.workflow.kts).
- Provide seamless, auto-resolving IDE support (syntax highlighting, autocomplete) for workflow scripts in IntelliJ.
- Ensure the script definition is globally recognized anywhere in the repository, not just within a specific dsl package.
- Achieve a developer UX identical to build.gradle.kts (no boilerplate imports, implicit receivers pre-configured).
Non-goals
- Modifying the underlying execution semantics or compiler logic of the workflows.
- Building custom IDE plugins from scratch (we should rely on standard JetBrains Kotlin scripting support).
- Expanding support to non-JetBrains IDEs in this iteration.
Acceptance criteria
- Existing workflow files are renamed to the new *.workflow.kts extension and stripped of boilerplate.
- Opening a *.workflow.kts file anywhere in the project tree in IntelliJ displays no red code / unresolved reference errors.
- Implicit DSL receivers and standard imports are automatically available in the IDE context.
- Autocomplete functions correctly for the workflow DSL.
- The IDE automatically discovers the script configuration without requiring manual user setup per file.
Implementation notes
- Leverage kotlin-scripting-jvm and kotlin-scripting-jvm-host artifacts to establish the script definition environment.
- Create a custom @KotlinScript annotation with a ScriptCompilationConfiguration supplying implicit receivers and default imports to the IDE.
- Use KotlinScriptHostConfiguration if needed to bridge classpath resolution.
- Register the script definition's FQN in META-INF/kotlin/script/templates/ for IDE auto-discovery.
- Mirror Gradle's .gradle.kts wiring so the definition is available globally regardless of package depth.
Description:
Context
Currently, workflow definitions are authored in standard .kt files. We are moving to Kotlin Script (.kts) files to provide a cleaner, boilerplate-free DSL. While the Kotlin compiler already successfully
processes these scripts with implicit imports and DSL receivers, IntelliJ IDEA lacks the context to resolve them. This results in false-positive "unresolved reference" (red code) errors in the editor. We need to
configure the Kotlin Scripting environment so the IDE properly understands the DSL context globally across the project.
Goals
Non-goals
Acceptance criteria
Implementation notes