Ash Weekly: Issue #18 Recap

AshPhoenix.Plug.CheckCodegenStatus, mix ash.codegen --dev, Shared Action Context, UsageRules, ash_ai.gen.chat improvements, Igniter.Scribe.

View count: -

Ash Weekly: Issue #18 Recap

Ash is currently the hottest and fast-becoming standard declarative framework in Elixir. Ash Weekly delivers weekly updates on what's happening in the Ash ecosystem, and here is a summary.

Original: Ash Weekly: Issue #18

AshPhoenix.Plug.CheckCodegenStatus

With the AshPhoenix.Plug.CheckCodegenStatus plug, you get a friendly notification screen in Ash when code generation is required due to code changes, similar to how Phoenix notifies you about pending DB migrations.
You can also perform the required action directly by clicking the provided button.

CheckCodegenStatus Page

--dev migrations

When running mix ash.codegen with the --dev option, you can accumulate codegen tasks without naming them. Later, when you run mix ash.codegen with a name, it bundles all accumulated tasks and performs codegen at once.

At DevAllCompany, we had implemented a similar feature ourselves, so it's nice to see it officially supported.

# Accumulate tasks
$ mix ash.codegen --dev

$ mix ash.codegen --dev

# Then generate all at once
$ mix ash.codegen create_user

Shared Action Context

A new shared key has been added to the context used in Ash actions. This key is passed down to nested actions called within the main action.
Since this value is propagated, avoid putting large data in it. Also, be cautious with concurrency, as values are copied between processes.

MyApp.Domain.Resource.action(..., context: %{shared: %{key: "value"}})

usage-rules.md

Are you into vibe coding these days? In Elixir, rapid changes and limited training data can make LLM-generated code less satisfactory.
The UsageRules project aims to help with this.

UsageRules works simply:
It collects each library's usage-rules.md files and combines them into a single file, making it easy for LLMs to use as context.
For example, Ash's usage-rules.md explains how to understand and use Ash.
If you use Ash and Ash AI in your project, you can run the following to combine their usage rules:

$ mix usage_rules.sync CLAUDE.md ash, ash_ai

Now, when using Claude, you can provide this combined context for better vibe coding.
You can also use the --all option to gather usage rules from all libraries in use.

ash_ai.gen.chat improvements

Code generated by mix ash_ai.gen.chat now stores LLM tool calls and tool results.
Previously, if this information was missing when loading past conversations, much of the context was lost. This change should significantly improve the ability to continue conversations.
However, sometimes tool results can be very large, so it's worth considering whether saving and passing all of them to the LLM is always the best approach.

Igniter.Scribe

Igniter is a library that helps automate code changes needed for installing other libraries.
Previously, manual guides did not update automatically with code changes and had to be edited manually, but this has now been improved.

Great news for those who use Igniter while developing their own libraries.