Avrae Draconic Alias Language Server
Language Server Protocol (LSP) implementation targeting Avrae-style draconic aliases. It provides syntax/semantic diagnostics, a mocked execution command, and a thin configuration layer driven by a workspace .avraels.json file. Credit to Avrae team for all code yoinked!
VS Code extension
- Install from VSIX: download
avrae-ls-client.vsixfrom the GitHub releases page, then in VS Code run “Extensions: Install from VSIX” and select the file. The VSIX already containsavrae-lsand its runtime dependencies; nouv,pip, or separate server installation is required. - Python 3.11 or newer must be available as
python3on macOS/Linux orpythonon Windows. The extension uses that interpreter only to run its bundled server package. - To use a development or custom server instead, set
avraeLS.server.pathto the absolute path of anavrae-lsexecutable (for example, a virtual environment'sbin/avrae-ls). A configured path takes precedence over the bundled server. - Open your alias workspace; commands like
Avrae: Show Alias PreviewandAvrae: Run Aliaswill be available. - With a
.alias-test,.aliastest,.gvar-test, or.gvartestfile active, runAvrae: Run Test Filefrom the Command Palette. The extension saves the file, runs that file only, and shows the full report in theAvrae Test Resultsoutput window. - Files ending with
.alias-moduleare treated as full-file draconic modules under theavrae-modulelanguage id (no<drac2>tags; mock run/preview commands stay tied to.aliasfiles).
Install Just the LSP
- CLI/server via
uv tool(preferred):uv tool install avrae-lsthenavrae-ls --helpto see stdio/TCP options (same aspython -m avrae_ls).
Developing locally
- Prereqs: uv and Node.js.
- Install deps:
uv sync --all-extrasthenmake vscode-deps. - Build everything locally:
make package(wheel + VSIX indist/). - Run tests/lint:
make check. - Run via uv tool from source:
uv tool install --from . avrae-ls. - Run diagnostics for a single file (stdout + stderr logs):
avrae-ls --analyze path/to/alias.txt --log-level DEBUG.
How to test
- Quick check (ruff + pytest):
make check(usesuv run ruffanduv run pytestunder the hood). - Lint only:
make lintoruv run ruff check src tests. - Tests only (with coverage):
make testoruv run pytest tests --cov=src. - CLI smoke test without installing:
uv run python -m avrae_ls --analyze path/to/alias.txt.
Alias and gvar tests
avrae-ls --run-tests [path]discovers both alias tests and gvar tests and exits non-zero on failures; repeat--run-teststo add more scan roots.- Alias tests use
.alias-testor.aliastestnext to your alias file. Each test starts with an invocation, followed by---and the expected result; you can stack multiple tests in one file by repeating this pattern (optional metadata after a second---per test).!my-alias -b example args --- expected text or numbers - Gvar tests use
.gvar-testor.gvartestnext to a sibling.gvarfile with the same stem. The test body runs after an implicitusing(...)import of that module under a sanitized local binding name.return my_module.constant --- expected value - A gvar named
foo-bar.gvaris exposed to tests asfoo_bar; a leading digit becomesgvar_<stem>. - Multi-case
.gvar-testfiles are supported. Separate cases with a second---, then a blank line before the next test body. Metadata after the second---is optional. - For embed aliases, put a YAML/JSON dictionary after the separator to compare against the embed preview (partial dictionaries are allowed).
!embedtest --- title: Hello description: World - Embed fields lists can be partial: only the listed fields (in order) are matched; extra fields in the alias do not fail the test.
- Use regex expectations by wrapping strings in
/.../(orre:...). You can also mix literals with regex segments (e.g.,Hello /world.*/) so only the delimited part is treated as regex. - Optional second
---section can carry metadata:name: critical-hit vars: cvars: hp: 12 character: name: Testernameis a label for reporting,varsare merged into cvars/uvars/svars/gvars, andcharacterkeys are deep-merged into the mock character. - Gvar tests compare the direct execution result of the test body, not alias preview/embed output.
Config variable substitution
.avraels.jsonvalues support environment variable substitution with$NAMEor${NAME}.workspaceRootandworkspaceFolderare injected automatically. Missing variables are replaced with an empty string and logged as warnings.
Runtime differences (mock vs. live Avrae)
- Mock execution never writes back to Avrae: cvar/uvar/gvar mutations only live for the current run and reset before the next.
- Network is limited to gvar fetches (when
enableGvarFetchis true) andverify_signature; other Avrae/Discord calls are replaced with mocked context data from.avraels.json. get_gvar/usingvalues are pulled from local var files first; remote fetches go tohttps://api.avrae.io/customizations/gvars/<id>(or youravraeService.baseUrl) usingavraeService.tokenand are cached for the session. In var files, a gvar can be a direct value, a{ "value": "..." }object, or a{ "filePath": "relative/or/absolute/path" }object (also supports"path"). Add"scriptWritable": trueto either object form to allowset_gvar(...)during mock execution.- Mock scripting now supports
create_gvar(value, script_writable=False)andset_gvar(address, value). Gvar writes only affect the current run; they do not persist to Avrae or local var files. signature()returns a mock string (mock-signature:<int>).verify_signature()POSTs to/bot/signature/verify, reuses the last successful response per signature, and includesavraeService.tokenif present.
Troubleshooting gvar fetch / verify_signature
get_gvarreturnsNoneorusing(...)raisesModuleNotFoundError: ensure the workspace.avraels.jsonsetsenableGvarFetch: true, includes a validavraeService.token, or seed the gvar in a var file referenced byvarFiles(includingfilePathgvar entries).- HTTP 401/403/404 from fetch/verify calls: check the token (401/403) and the gvar/signature id (404). Override
avraeService.baseUrlif you mirror the API. - Slow or flaky calls: disable remote fetches by flipping
enableGvarFetchoff to rely purely on local vars.
Other editors (stdio)
- Any client can launch the server with stdio:
avrae-ls --stdio(flag accepted for client compatibility) orpython -m avrae_ls. The server will also auto-discover.avraels.jsonin parent folders. - Neovim (nvim-lspconfig example):
require("lspconfig").avraels.setup({ cmd = { "avrae-ls", "--stdio" }, filetypes = { "avrae" }, root_dir = require("lspconfig.util").root_pattern(".avraels.json", ".git"), })
- Emacs (lsp-mode snippet):
(lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection '("avrae-ls" "--stdio")) :major-modes '(fundamental-mode) ;; bind to your Avrae alias mode :server-id 'avrae-ls))
- VS Code commands to mirror:
Avrae: Run Alias (Mock),Avrae: Run Test File,Avrae: Show Alias Preview,Avrae: Refresh GVARs, andAvrae: Reload Workspace Configrun against the same server binary.
Releasing (maintainers)
- Bump
pyproject.toml/package.json - Create Github release
Metadata
Release files for avrae-ls 0.14.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| avrae_ls-0.14.2.tar.gz | 117.1 kB | Without provenance | Details for avrae_ls-0.14.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| avrae_ls-0.14.2-py3-none-any.whl | Python 3 | none | any | Details for avrae_ls-0.14.2-py3-none-any.whl |
Total release size: 254.2 kB
Release files / avrae_ls-0.14.2.tar.gz
| Download URL | avrae_ls-0.14.2.tar.gz |
|---|---|
| Size | 117.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc1f4b7bfdbcfe4e54dc004b28629c1ccfcc216b8a910dd517bfc6648259e706
|
|
BLAKE2b-256 checksum How to use checksums |
e0e0a604d128178305f0833708c4bac24528f916cf7e96d95fc1827ec6bbb738
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / avrae_ls-0.14.2-py3-none-any.whl
| Download URL | avrae_ls-0.14.2-py3-none-any.whl |
|---|---|
| Size | 137.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b32993d8835b5402c6f298e419c8c7806261a345ff7ff66b5360a62d66208e0
|
|
BLAKE2b-256 checksum How to use checksums |
1e9df2eddef623c87547476affbad5339256e637b69b46370c542902a2c68caf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for avrae-ls 0.14.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.