Scala CLI Adding Directives
Developmentscala-cli-adding-directivesScala CLI Adding Directives is an Agent Skill for development published in the VirtusLab/scala-cli repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Add or change using directives in Scala CLI. Use when adding a new //> using directive, registering a directive handler, or editing directive preprocessing.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/VirtusLab/scala-cli/blob/HEAD/agentskills/adding-directives/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/scala-cli-adding-directives, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Adding a new directive (Scala CLI)
-
Create a case class in
modules/directives/src/main/scala/scala/build/preprocessing/directives/extending one of:HasBuildOptions— producesBuildOptionsdirectlyHasBuildOptionsWithRequirements— producesBuildOptionswith scoped requirements (e.g.test.dep)HasBuildRequirements— producesBuildRequirements(for//> require)
-
Annotate:
@DirectiveLevel(SpecificationLevel.EXPERIMENTAL),@DirectiveDescription("…"),@DirectiveUsage("…"),@DirectiveExamples("…"),@DirectiveName("key")on fields. -
Companion:
val handler: DirectiveHandler[YourDirective] = DirectiveHandler.derive -
Register in
modules/build/.../DirectivesPreprocessingUtils.scalain the right list:usingDirectiveHandlers,usingDirectiveWithReqsHandlers, orrequireDirectiveHandlers. -
Regenerate reference docs:
./mill -i 'generate-reference-doc[]'.run
CLI options always override directive values when both set the same thing.