-
Notifications
You must be signed in to change notification settings - Fork 63
feat(al): add AL support #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tfenster
wants to merge
4
commits into
docker:main
Choose a base branch
from
tfenster:tfe/al
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+142
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| # al | ||
|
|
||
| A mixin kit (`kind: mixin`) that installs | ||
| [`altool`](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-al-tool), | ||
| the AL command-line compiler for | ||
| [Microsoft Dynamics 365 Business Central](https://learn.microsoft.com/en-us/dynamics365/business-central/), | ||
| so the agent can build, compile, and package AL extensions inside the | ||
| sandbox. | ||
|
|
||
| ## Usage | ||
|
|
||
| `al` is agent-agnostic — pair it with whichever agent you're using: | ||
|
|
||
| ```console | ||
| $ sbx run --kit "git+https://github.com/docker/sbx-kits-contrib.git#dir=al" claude ~/my-al-project | ||
| $ sbx run --kit "git+https://github.com/docker/sbx-kits-contrib.git#dir=al" shell ~/my-al-project | ||
| ``` | ||
|
|
||
| Or with a local clone of this repo: | ||
|
|
||
| ```console | ||
| $ sbx run --kit ./al/ claude ~/my-al-project | ||
| ``` | ||
|
|
||
| After install, the `al` command is available on `PATH`: | ||
|
|
||
| ```console | ||
| agent@sandbox:~$ al --help | ||
| agent@sandbox:~$ al compile /project:~/my-al-project /packagecachepath:~/.alpackages | ||
| ``` | ||
|
|
||
| ## How the install works | ||
|
|
||
| The install step runs as the agent user (`user: "1000"`) and does two | ||
| things: | ||
|
|
||
| 1. **Installs the .NET 8.0 runtime/SDK** via the upstream | ||
| `dotnet-install.sh` script, into `/home/agent/.dotnet`. `altool` | ||
| ships as a .NET global tool and needs the runtime to execute. | ||
| 2. **Installs `altool`** — the | ||
| `Microsoft.Dynamics.BusinessCentral.Development.Tools` global tool | ||
| — from NuGet into `~/.dotnet/tools`, which is on the agent's `PATH`. | ||
|
|
||
| ## Using the AL MCP Server | ||
|
|
||
| Beyond the command-line compiler, the `al` tool can run as a | ||
| [Model Context Protocol](https://modelcontextprotocol.io) server, exposing | ||
| AL-aware capabilities (compile, symbol lookup, project inspection) as tools | ||
| the agent can call directly. Launch it with: | ||
|
|
||
| ```console | ||
| agent@sandbox:~$ al launchmcpserver --transport stdio . | ||
| ``` | ||
|
|
||
| The trailing `.` is the AL project directory the server operates on. | ||
|
|
||
| To let an agent use it, register the server in an `.mcp.json` at the root | ||
| of your AL workspace. It should look like this: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "al": { | ||
| "command": "/home/agent/.dotnet/tools/al", | ||
| "args": ["launchmcpserver", "--transport", "stdio", "."], | ||
| "env": { | ||
| "DOTNET_ROOT": "/home/agent/.dotnet" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Notes: | ||
|
|
||
| - **`command`** is the absolute path to the `al` global tool | ||
| (`/home/agent/.dotnet/tools/al`) rather than a bare `al`, so the server | ||
| resolves regardless of the agent's `PATH` at launch time. | ||
| - **`DOTNET_ROOT`** must point at the .NET install (`/home/agent/.dotnet`) | ||
| so the tool can locate its runtime — the same directory the kit's | ||
| install step created. | ||
| - Agents that read a project-local `.mcp.json` (Claude Code among them) | ||
| pick the server up automatically when started with the project mounted | ||
| as the working directory. Drop the file into the AL project you mount, | ||
| or use the repo's example as a template. | ||
|
|
||
| ## Network policy | ||
|
|
||
| `allowedDomains` covers exactly the hosts the install needs: | ||
|
|
||
| | Host | Why | | ||
| | --- | --- | | ||
| | `dot.net` | Entry point for the `dotnet-install.sh` bootstrap script | | ||
| | `ci.dot.net` | Redirect target the install script resolves to | | ||
| | `builds.dotnet.microsoft.com` | Where the .NET runtime/SDK archives are hosted | | ||
| | `api.nuget.org` | NuGet feed the `altool` global tool package is pulled from | | ||
|
|
||
| If you need to restore AL project dependencies (symbol packages) at | ||
| runtime from other feeds — e.g. a corporate NuGet server or Business | ||
| Central's symbols API — add those hosts in a fork or via a per-sandbox | ||
| allow rule: | ||
|
|
||
| ```console | ||
| $ sbx policy allow network --sandbox <name> "your-nuget-feed.example.com" | ||
| ``` | ||
|
|
||
| ## Scope of this kit | ||
|
|
||
| This is a thin install layer. It provides the `altool` compiler and the | ||
| .NET runtime it depends on — it does **not** ship symbol packages, a | ||
| Business Central server connection, or project scaffolding. Those belong | ||
| in your AL project repo, not in a generic kit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| schemaVersion: "1" | ||
| kind: mixin | ||
| name: al | ||
| displayName: AL (Business Central) | ||
| description: altool installation | ||
|
|
||
| network: | ||
| allowedDomains: | ||
| - dot.net | ||
| - ci.dot.net | ||
| - builds.dotnet.microsoft.com | ||
| - dotnetcli.azureedge.net | ||
| - api.nuget.org | ||
| - globalcdn.nuget.org | ||
|
|
||
| commands: | ||
| install: | ||
| - command: | | ||
| set -euo pipefail | ||
| installer="$(mktemp)" | ||
| curl -fsSL https://dot.net/v1/dotnet-install.sh -o "$installer" | ||
| bash "$installer" --channel 8.0 | ||
| rm -f "$installer" | ||
| tool="Microsoft.Dynamics.BusinessCentral.Development.Tools" | ||
| # dotnet tool update installs when absent and upgrades otherwise, so | ||
| # reruns stay idempotent; fall back to install for older SDKs. | ||
| "$HOME/.dotnet/dotnet" tool update --global "$tool" \ | ||
| || "$HOME/.dotnet/dotnet" tool install --global "$tool" | ||
| user: "1000" | ||
| description: Install altool | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.