Packages
llm_db
2026.5.2
2026.7.3
2026.7.2
2026.7.1
2026.7.0
2026.6.4
2026.6.3
2026.6.2
2026.6.1
2026.6.0
2026.5.2
2026.5.1
2026.5.0
2026.4.8
2026.4.7
2026.4.6
2026.4.5
2026.4.4
2026.4.3
2026.4.2
2026.4.1
2026.4.0
2026.3.3
2026.3.2
2026.3.1
2026.3.0
2026.2.9
2026.2.8
2026.2.7
2026.2.6
2026.2.5
2026.2.4
2026.2.3
2026.2.2
2026.2.1
2026.2.0
2026.1.5
2026.1.4
2026.1.3
2026.1.2
2026.1.1
2026.1.0
2025.12.4
2025.12.3
2025.12.2
2025.12.1
2025.11.18-preview
2025.11.14-preview
2025.11.7-preview
LLM model metadata catalog with fast, capability-aware lookups.
Current section
Files
Jump to
Current section
Files
lib/mix/tasks/llm_db.version.ex
defmodule Mix.Tasks.LlmDb.Version do
@moduledoc """
Updates the version in mix.exs to CalVer format (YYYY.M.PATCH).
- If current version is from a different month, resets to YYYY.M.0
- If current version is from the same month, increments PATCH
## Usage
mix llm_db.version
## Examples
# Current: 2025.11.5, Today: December 2025
# Result: 2025.12.0
# Current: 2025.12.0, Today: December 2025
# Result: 2025.12.1
"""
use Mix.Task
@shortdoc "Bump version using CalVer (YYYY.M.PATCH)"
@impl Mix.Task
def run(_args) do
mix_exs_path = "mix.exs"
content = File.read!(mix_exs_path)
current_version = extract_version(content)
new_version = compute_next_version(current_version)
updated = Regex.replace(~r/@version ".*"/, content, "@version \"#{new_version}\"")
File.write!(mix_exs_path, updated)
Mix.shell().info("Updated version: #{current_version} → #{new_version}")
end
defp extract_version(content) do
case Regex.run(~r/@version "([^"]+)"/, content) do
[_, version] -> version
_ -> "0.0.0"
end
end
defp compute_next_version(current_version) do
today = Date.utc_today()
current_year = today.year
current_month = today.month
case parse_calver(current_version) do
{:ok, ^current_year, ^current_month, patch} ->
# Same month: increment patch
"#{current_year}.#{current_month}.#{patch + 1}"
_ ->
# Different month or invalid: start fresh
"#{current_year}.#{current_month}.0"
end
end
defp parse_calver(version) do
# Handle versions like "2025.12.5" or "2025.12.5-preview"
case Regex.run(~r/^(\d{4})\.(\d{1,2})\.(\d+)/, version) do
[_, year, month, patch] ->
{:ok, String.to_integer(year), String.to_integer(month), String.to_integer(patch)}
_ ->
:error
end
end
end