Skip to main content

mix.exs

defmodule AshJido.MixProject do
  use Mix.Project

  @version "1.0.0"
  @source_url "https://github.com/agentjido/ash_jido"
  @description "Integration between the Ash Framework and the Jido Agent ecosystem."

  def project do
    [
      app: :ash_jido,
      version: @version,
      elixir: "~> 1.18",
      start_permanent: Mix.env() == :prod,
      elixirc_paths: elixirc_paths(Mix.env()),
      consolidate_protocols: Mix.env() != :test,
      deps: deps(),
      aliases: aliases(),

      # Documentation
      name: "AshJido",
      description: @description,
      source_url: @source_url,
      homepage_url: @source_url,
      package: package(),
      docs: docs(),

      # Test Coverage
      test_coverage: [
        tool: ExCoveralls,
        summary: [threshold: 90],
        export: "cov"
      ],

      # Dialyzer
      dialyzer: [
        plt_add_apps: [:mix],
        plt_local_path: "priv/plts/project.plt",
        plt_core_path: "priv/plts/core.plt"
      ]
    ]
  end

  def cli do
    [
      preferred_envs: [
        coveralls: :test,
        "coveralls.detail": :test,
        "coveralls.github": :test,
        "coveralls.html": :test
      ]
    ]
  end

  def application do
    [
      extra_applications: [:logger]
    ]
  end

  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  defp deps do
    [
      # Runtime dependencies
      {:ash, "~> 3.12"},
      {:jido, "~> 2.3"},
      {:jido_action, "~> 2.3"},
      {:jido_signal, "~> 2.2"},
      {:splode, "~> 0.3"},
      {:zoi, "~> 0.18"},

      # Dev/Test dependencies
      {:credo, "~> 1.7", only: [:dev, :test], runtime: false},
      {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
      {:doctor, "~> 0.22", only: :dev, runtime: false},
      {:ex_doc, "~> 0.31", only: :dev, runtime: false},
      {:excoveralls, "~> 0.18", only: [:dev, :test]},
      {:git_hooks, "~> 0.8", only: [:dev, :test], runtime: false},
      {:git_ops, "~> 2.9", only: :dev, runtime: false},
      {:igniter, "~> 0.7", only: [:dev, :test]},
      {:picosat_elixir, "~> 0.2", only: [:dev, :test], runtime: false},
      {:usage_rules, "~> 1.2", only: [:dev]}
    ]
  end

  defp aliases do
    [
      setup: ["deps.get"],
      install_hooks: ["git_hooks.install"],
      test: "test --exclude flaky",
      q: ["quality"],
      quality: [
        "format --check-formatted",
        "compile --warnings-as-errors",
        "credo --min-priority higher",
        "dialyzer",
        "doctor --raise"
      ]
    ]
  end

  defp package do
    [
      files: ["lib", "mix.exs", "README.md", "LICENSE", "CHANGELOG.md", "usage-rules.md"],
      maintainers: ["Matt Hostetler"],
      licenses: ["Apache-2.0"],
      links: %{
        "Changelog" => "https://hexdocs.pm/ash_jido/changelog.html",
        "Discord" => "https://agentjido.xyz/discord",
        "Documentation" => "https://hexdocs.pm/ash_jido",
        "GitHub" => @source_url,
        "Website" => "https://agentjido.xyz"
      }
    ]
  end

  defp docs do
    [
      main: "readme",
      source_ref: "v#{@version}",
      extras: [
        {"README.md", title: "Home"},
        {"guides/getting-started.md", title: "Getting Started"},
        {"guides/ash-jido-demo.livemd", title: "Livebook Demo"},
        {"guides/walkthrough-resource-to-action.md", title: "Resource to Action"},
        {"guides/walkthrough-policy-scope-auth.md", title: "Policy, Scope, and Auth"},
        {"guides/walkthrough-ash-postgres-consumer.md", title: "AshPostgres Consumer Harness"},
        {"guides/walkthrough-signals-telemetry-sensors.md", title: "Signals, Telemetry, and Sensors"},
        {"guides/walkthrough-failure-semantics.md", title: "Failure Semantics"},
        {"guides/walkthrough-tools-and-ai.md", title: "Tools and AI Integration"},
        {"guides/walkthrough-agent-tool-wiring.md", title: "Agent Tool Wiring"},
        {"guides/release-notes-0-2-0.md", title: "0.2.0 Release Notes"},
        {"CHANGELOG.md", title: "Changelog"},
        {"CONTRIBUTING.md", title: "Contributing"},
        {"usage-rules.md", title: "Usage Rules"}
      ],
      groups_for_extras: [
        "Start Here": [
          "README.md",
          "guides/getting-started.md",
          "guides/ash-jido-demo.livemd"
        ],
        "Walkthroughs: Core": [
          "guides/walkthrough-resource-to-action.md",
          "guides/walkthrough-policy-scope-auth.md",
          "guides/walkthrough-ash-postgres-consumer.md"
        ],
        "Walkthroughs: Operations": [
          "guides/walkthrough-signals-telemetry-sensors.md",
          "guides/walkthrough-failure-semantics.md"
        ],
        "Walkthroughs: Agent Integration": [
          "guides/walkthrough-tools-and-ai.md",
          "guides/walkthrough-agent-tool-wiring.md"
        ],
        Project: [
          "guides/release-notes-0-2-0.md",
          "CHANGELOG.md",
          "CONTRIBUTING.md",
          "usage-rules.md"
        ]
      ]
    ]
  end
end