defmodule Baton.MixProject do use Mix.Project @version "0.27.4" @source_url "https://github.com/RudeWalrus/Baton" def cli do # precommit ends in `mix test`, which refuses to run outside :test. [preferred_envs: [precommit: :test]] end def project do [ app: :baton, version: @version, elixir: "~> 1.15", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), aliases: aliases(), description: description(), package: package(), docs: docs(), name: "Baton", source_url: @source_url, dialyzer: [plt_add_apps: [:ex_unit, :mix]] ] end def application do [extra_applications: [:logger], mod: {Baton.Application, []}] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] defp deps do [ # ── Core (required) ────────────────────────────────────────────────── {:oban, "~> 2.17"}, {:ecto_sql, "~> 3.10"}, {:jason, "~> 1.4"}, {:nimble_options, "~> 1.0"}, {:telemetry, "~> 1.2"}, # ── Optional features ──────────────────────────────────────────────── # Cost/stats tracking needs Decimal (usually present via Ecto, declared # explicitly and optional so a minimal install can skip it). # Allow 3.0+, which patches GHSA-rhv4-8758-jx7v (unbounded-exponent DoS in # Decimal.new). 2.x is still permitted for hosts pinned to it. {:decimal, "~> 2.0 or ~> 3.0", optional: true}, # Live dashboard + PubSub step events. {:phoenix_pubsub, "~> 2.1", optional: true}, {:phoenix_live_view, "~> 1.0", optional: true}, # ── Tooling (dev/test only) ────────────────────────────────────────── {:postgrex, "~> 0.17", only: [:test]}, {:ex_doc, "~> 0.34", only: :dev, runtime: false}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev], runtime: false}, {:mix_audit, "~> 2.1", only: [:dev, :test], runtime: false} ] end defp aliases do [ # The test suite creates storage and runs its own migration module # (Baton.Test.Migrations) from test/test_helper.exs, so the only alias # step needed here is creating the database. test: ["ecto.create --quiet", "test"], # Dialyzer is excluded: its PLT build is too slow for a per-commit # check. Run `mix dialyzer` directly when touching specs. precommit: [ "format --check-formatted", "compile --warnings-as-errors", "credo", "deps.audit", "test" ] ] end defp description do "DAG-based job workflows for Oban: dependency ordering, fan-out/fan-in " <> "(over a fixed collection or one computed mid-run), result passing, " <> "retry idempotency, and per-step LLM cost tracking — without Oban Pro." end defp package do [ licenses: ["MIT"], maintainers: ["RudeWalrus"], links: %{"GitHub" => @source_url, "Changelog" => "#{@source_url}/blob/main/CHANGELOG.md"}, files: ~w(lib priv guides .formatter.exs mix.exs README.md CHANGELOG.md LICENSE) ] end defp docs do [ main: "readme", logo: "guides/assets/baton-mark.svg", assets: %{"guides/assets" => "guides/assets"}, source_ref: "v#{@version}", source_url: @source_url, extras: [ "README.md", "guides/getting_started.md", "guides/building_a_workflow.md", "guides/multi_model.md", "guides/batch_mode.md", "guides/multi_node.md", "guides/flow_compiler.md", "CHANGELOG.md" ], groups_for_extras: [ Guides: ~r/guides\/.*/ ], groups_for_modules: [ "Building Workflows": [Baton, Baton.MultiModel], "Portable Flows": [ Baton.Flow, Baton.Flow.Compiler, Baton.Flow.Definition, Baton.Flow.NodeSpec, Baton.Flow.FanOutSpec, Baton.Flow.Binding, Baton.Flow.Validator, Baton.Flow.Compiled, Baton.Flow.Step, Baton.Flow.FanOut, Baton.Flow.ContextProvider, Baton.Flow.PromptResolver, Baton.Flow.Registry, Baton.Flow.Action, Baton.Flow.LLMAdapter, Baton.Flow.Workers.LLM, Baton.Flow.Workers.Action ], Execution: [Baton.Worker, Baton.LLMWorker, Baton.Check, Baton.Results], "LLM Steps": [Baton.LLMStep, Baton.LLMClient, Baton.RateLimiter], Observability: [ Baton.Telemetry, Baton.Events, Baton.Stats, Baton.Debug, Baton.Query ], Infrastructure: [ Baton.Plugin, Baton.Migration, Baton.Retention, Baton.Pricing, Baton.Config ], Internals: [ Baton.DAG, Baton.Node, Baton.Nodes, Baton.Reschedule, Baton.Completion ] ] ] end end