Juggernaut.Install (Juggernaut v0.4.0)

Copy Markdown View Source

The file edits behind mix juggernaut.install (design notes §3), as pure functions of file contents, so they are tested without Igniter and the installer stays a thin layer over them. Each edit detects its own earlier application, which keeps the installer idempotent.

Summary

Functions

AGENTS.md with the Juggernaut section: replaced in place from its start marker to the first end marker after it, or to the end of the file when that end marker is missing; appended when there is no start marker; or the whole file when there is none (nil).

The marked AGENTS.md section.

The contents of a new .juggernaut.exs. Options: :ecto? adds the Ecto compile-time macros to raw_calls; :raw_calls and :skip_calls add converted routes; :integration_tags (found by integration_tags/1) join :integration as the tags of the integration test lane (test_lanes).

The raw_calls written when the project depends on ecto_sql.

.gitignore with /_build/juggernaut/ appended, or :unchanged when _build (or _build/juggernaut) is already ignored. The committed triage file is never ignored.

What the installer prints when Igniter is not available.

The conventional integration tags (integration, external, e2e, end_to_end, acceptance, feature, browser, db, database, network, system) that the test files sources (their contents) set with @tag, @describetag or @moduletag, as :name or name: true; sorted. Other tags are left out.

The agent skill (.claude/skills/juggernaut/SKILL.md): how to use Juggernaut, choose a lane, read the agent output, and tell when a fresh boot or the integration tests are needed. The file is Juggernaut's: mix juggernaut.install --agents writes it again when it differs.

The skill file's new contents given its current ones (nil when there is none), or :unchanged when it is current.

Where the agent skill is installed, relative to the project root.

Writes the agent guidance under root without Igniter: the AGENTS.md section (agents/1) and the skill (skill_file/1), each only when it differs. Returns each path with :created, :updated or :unchanged. It is what mix juggernaut.install --agents does, for a project that has no Igniter.

Functions

agents(contents)

@spec agents(String.t() | nil) :: String.t()

AGENTS.md with the Juggernaut section: replaced in place from its start marker to the first end marker after it, or to the end of the file when that end marker is missing; appended when there is no start marker; or the whole file when there is none (nil).

agents_section()

@spec agents_section() :: String.t()

The marked AGENTS.md section.

config_file(opts \\ [])

@spec config_file(keyword()) :: String.t()

The contents of a new .juggernaut.exs. Options: :ecto? adds the Ecto compile-time macros to raw_calls; :raw_calls and :skip_calls add converted routes; :integration_tags (found by integration_tags/1) join :integration as the tags of the integration test lane (test_lanes).

ecto_raw_calls()

@spec ecto_raw_calls() :: [tuple()]

The raw_calls written when the project depends on ecto_sql.

gitignore(contents)

@spec gitignore(String.t()) :: {:ok, String.t()} | :unchanged

.gitignore with /_build/juggernaut/ appended, or :unchanged when _build (or _build/juggernaut) is already ignored. The committed triage file is never ignored.

igniter_missing_message()

@spec igniter_missing_message() :: String.t()

What the installer prints when Igniter is not available.

integration_tags(sources)

@spec integration_tags([String.t()]) :: [atom()]

The conventional integration tags (integration, external, e2e, end_to_end, acceptance, feature, browser, db, database, network, system) that the test files sources (their contents) set with @tag, @describetag or @moduletag, as :name or name: true; sorted. Other tags are left out.

skill()

@spec skill() :: String.t()

The agent skill (.claude/skills/juggernaut/SKILL.md): how to use Juggernaut, choose a lane, read the agent output, and tell when a fresh boot or the integration tests are needed. The file is Juggernaut's: mix juggernaut.install --agents writes it again when it differs.

skill_file(current)

@spec skill_file(String.t() | nil) :: {:ok, String.t()} | :unchanged

The skill file's new contents given its current ones (nil when there is none), or :unchanged when it is current.

skill_path()

@spec skill_path() :: String.t()

Where the agent skill is installed, relative to the project root.

write_agents(root)

@spec write_agents(Path.t()) :: [{String.t(), :created | :updated | :unchanged}]

Writes the agent guidance under root without Igniter: the AGENTS.md section (agents/1) and the skill (skill_file/1), each only when it differs. Returns each path with :created, :updated or :unchanged. It is what mix juggernaut.install --agents does, for a project that has no Igniter.