feat: build infrastructure

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-24 11:51:44 +02:00
parent 213b3fc652
commit b4c995049f
13 changed files with 416 additions and 10 deletions

View File

@@ -21,16 +21,24 @@ defmodule BDS.MCP.AgentConfig do
def config_path(:claude_code, home_dir), do: Path.join(home_dir, ".claude.json")
def config_path(:github_copilot, home_dir), do: Path.join([home_dir, "Library", "Application Support", "Code", "User", "mcp.json"])
def packaged_executable_path(install_root, platform) when is_binary(install_root) do
executable_name =
case normalize_platform(platform) do
:windows -> "bds-mcp.bat"
_other -> "bds-mcp"
end
Path.join([install_root, "mcp", "bin", executable_name])
end
defp default_command(opts) do
Keyword.get(opts, :script_path, repo_script_path())
install_root = Keyword.fetch!(opts, :install_root)
platform = Keyword.get(opts, :platform, current_platform())
packaged_executable_path(install_root, platform)
end
defp default_args(_opts), do: []
defp repo_script_path do
Path.expand("../../../bin/bds-mcp", __DIR__)
end
defp read_config(path) do
if File.exists?(path) do
path
@@ -51,4 +59,15 @@ defmodule BDS.MCP.AgentConfig do
servers = Map.get(config, "mcpServers", %{})
Map.put(config, "mcpServers", Map.put(servers, @server_name, %{"command" => command, "args" => args}))
end
defp current_platform do
case :os.type() do
{:win32, _type} -> :windows
{:unix, :darwin} -> :macos
{:unix, _type} -> :linux
end
end
defp normalize_platform(:darwin), do: :macos
defp normalize_platform(platform), do: platform
end