avrae-ls 0.7.1__tar.gz → 0.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/PKG-INFO +5 -3
  2. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/README.md +4 -2
  3. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/pyproject.toml +1 -1
  4. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/context.py +48 -1
  5. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/.gitignore +0 -0
  6. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/LICENSE +0 -0
  7. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/__init__.py +0 -0
  8. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/__main__.py +0 -0
  9. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/alias_preview.py +0 -0
  10. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/alias_tests.py +0 -0
  11. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/api.py +0 -0
  12. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/argparser.py +0 -0
  13. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/argument_parsing.py +0 -0
  14. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/ast_utils.py +0 -0
  15. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/code_actions.py +0 -0
  16. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/codes.py +0 -0
  17. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/completions.py +0 -0
  18. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/config.py +0 -0
  19. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/cvars.py +0 -0
  20. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/diagnostics.py +0 -0
  21. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/dice.py +0 -0
  22. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/lsp_utils.py +0 -0
  23. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/parser.py +0 -0
  24. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/runtime.py +0 -0
  25. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/server.py +0 -0
  26. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/signature_help.py +0 -0
  27. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/source_context.py +0 -0
  28. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/symbols.py +0 -0
  29. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/type_inference.py +0 -0
  30. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/avrae_ls/type_system.py +0 -0
  31. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/LICENSE +0 -0
  32. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/__init__.py +0 -0
  33. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/exceptions.py +0 -0
  34. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/helpers.py +0 -0
  35. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/interpreter.py +0 -0
  36. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/string.py +0 -0
  37. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/types.py +0 -0
  38. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/utils.py +0 -0
  39. {avrae_ls-0.7.1 → avrae_ls-0.8.1}/src/draconic/versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: avrae-ls
3
- Version: 0.7.1
3
+ Version: 0.8.1
4
4
  Summary: Language server for Avrae draconic aliases
5
5
  Author: 1drturtle
6
6
  License: MIT License
@@ -40,6 +40,8 @@ Description-Content-Type: text/markdown
40
40
 
41
41
  # Avrae Draconic Alias Language Server
42
42
 
43
+ [![Tests](https://github.com/1drturtle/avrae-ls/actions/workflows/ci.yml/badge.svg)](https://github.com/1drturtle/avrae-ls/actions/workflows/ci.yml)
44
+
43
45
  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!
44
46
 
45
47
  ## Install (released package)
@@ -105,12 +107,12 @@ Language Server Protocol (LSP) implementation targeting Avrae-style draconic ali
105
107
 
106
108
  - Mock execution never writes back to Avrae: cvar/uvar/gvar mutations only live for the current run and reset before the next.
107
109
  - Network is limited to gvar fetches (when `enableGvarFetch` is true) and `verify_signature`; other Avrae/Discord calls are replaced with mocked context data from `.avraels.json`.
108
- - `get_gvar`/`using` values are pulled from local var files first; remote fetches go to `https://api.avrae.io/customizations/gvars/<id>` (or your `avraeService.baseUrl`) using `avraeService.token` and are cached for the session.
110
+ - `get_gvar`/`using` values are pulled from local var files first; remote fetches go to `https://api.avrae.io/customizations/gvars/<id>` (or your `avraeService.baseUrl`) using `avraeService.token` and are cached for the session. In var files, a gvar can be a direct value or a `{ "filePath": "relative/or/absolute/path" }` object (also supports `"path"`) that loads file contents as the gvar value.
109
111
  - `signature()` returns a mock string (`mock-signature:<int>`). `verify_signature()` POSTs to `/bot/signature/verify`, reuses the last successful response per signature, and includes `avraeService.token` if present.
110
112
 
111
113
  ## Troubleshooting gvar fetch / verify_signature
112
114
 
113
- - `get_gvar` returns `None` or `using(...)` raises `ModuleNotFoundError`: ensure the workspace `.avraels.json` sets `enableGvarFetch: true`, includes a valid `avraeService.token`, or seed the gvar in a var file referenced by `varFiles`.
115
+ - `get_gvar` returns `None` or `using(...)` raises `ModuleNotFoundError`: ensure the workspace `.avraels.json` sets `enableGvarFetch: true`, includes a valid `avraeService.token`, or seed the gvar in a var file referenced by `varFiles` (including `filePath` gvar entries).
114
116
  - HTTP 401/403/404 from fetch/verify calls: check the token (401/403) and the gvar/signature id (404). Override `avraeService.baseUrl` if you mirror the API.
115
117
  - Slow or flaky calls: disable remote fetches by flipping `enableGvarFetch` off to rely purely on local vars.
116
118
 
@@ -1,5 +1,7 @@
1
1
  # Avrae Draconic Alias Language Server
2
2
 
3
+ [![Tests](https://github.com/1drturtle/avrae-ls/actions/workflows/ci.yml/badge.svg)](https://github.com/1drturtle/avrae-ls/actions/workflows/ci.yml)
4
+
3
5
  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!
4
6
 
5
7
  ## Install (released package)
@@ -65,12 +67,12 @@ Language Server Protocol (LSP) implementation targeting Avrae-style draconic ali
65
67
 
66
68
  - Mock execution never writes back to Avrae: cvar/uvar/gvar mutations only live for the current run and reset before the next.
67
69
  - Network is limited to gvar fetches (when `enableGvarFetch` is true) and `verify_signature`; other Avrae/Discord calls are replaced with mocked context data from `.avraels.json`.
68
- - `get_gvar`/`using` values are pulled from local var files first; remote fetches go to `https://api.avrae.io/customizations/gvars/<id>` (or your `avraeService.baseUrl`) using `avraeService.token` and are cached for the session.
70
+ - `get_gvar`/`using` values are pulled from local var files first; remote fetches go to `https://api.avrae.io/customizations/gvars/<id>` (or your `avraeService.baseUrl`) using `avraeService.token` and are cached for the session. In var files, a gvar can be a direct value or a `{ "filePath": "relative/or/absolute/path" }` object (also supports `"path"`) that loads file contents as the gvar value.
69
71
  - `signature()` returns a mock string (`mock-signature:<int>`). `verify_signature()` POSTs to `/bot/signature/verify`, reuses the last successful response per signature, and includes `avraeService.token` if present.
70
72
 
71
73
  ## Troubleshooting gvar fetch / verify_signature
72
74
 
73
- - `get_gvar` returns `None` or `using(...)` raises `ModuleNotFoundError`: ensure the workspace `.avraels.json` sets `enableGvarFetch: true`, includes a valid `avraeService.token`, or seed the gvar in a var file referenced by `varFiles`.
75
+ - `get_gvar` returns `None` or `using(...)` raises `ModuleNotFoundError`: ensure the workspace `.avraels.json` sets `enableGvarFetch: true`, includes a valid `avraeService.token`, or seed the gvar in a var file referenced by `varFiles` (including `filePath` gvar entries).
74
76
  - HTTP 401/403/404 from fetch/verify calls: check the token (401/403) and the gvar/signature id (404). Override `avraeService.baseUrl` if you mirror the API.
75
77
  - Slow or flaky calls: disable remote fetches by flipping `enableGvarFetch` off to rely purely on local vars.
76
78
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "avrae-ls"
7
- version = "0.7.1"
7
+ version = "0.8.1"
8
8
  description = "Language server for Avrae draconic aliases"
9
9
  authors = [
10
10
  { name = "1drturtle" }
@@ -14,6 +14,7 @@ from .config import AvraeLSConfig, ContextProfile, VarSources
14
14
  from .cvars import derive_character_cvars
15
15
 
16
16
  log = logging.getLogger(__name__)
17
+ _SKIP_GVAR = object()
17
18
 
18
19
 
19
20
  @dataclass
@@ -63,7 +64,7 @@ class ContextBuilder:
63
64
  data = _read_json_file(path)
64
65
  if data is None:
65
66
  continue
66
- merged = merged.merge(VarSources.from_data(data))
67
+ merged = merged.merge(_var_sources_from_file(path, data))
67
68
  return merged
68
69
 
69
70
  def _merge_character_cvars(self, character: Dict[str, Any], vars: VarSources) -> VarSources:
@@ -366,3 +367,49 @@ def _read_json_file(path: Path) -> Dict[str, Any] | None:
366
367
  except json.JSONDecodeError as exc:
367
368
  log.warning("Failed to parse var file %s: %s", path, exc)
368
369
  return None
370
+
371
+
372
+ def _var_sources_from_file(path: Path, data: Dict[str, Any]) -> VarSources:
373
+ parsed = VarSources.from_data(data)
374
+ return VarSources(
375
+ cvars=parsed.cvars,
376
+ uvars=parsed.uvars,
377
+ svars=parsed.svars,
378
+ gvars=_resolve_gvar_file_refs(path, parsed.gvars),
379
+ )
380
+
381
+
382
+ def _resolve_gvar_file_refs(var_file: Path, gvars: Dict[str, Any]) -> Dict[str, Any]:
383
+ resolved: dict[str, Any] = {}
384
+ for key, value in gvars.items():
385
+ parsed = _parse_gvar_value(var_file, key, value)
386
+ if parsed is _SKIP_GVAR:
387
+ continue
388
+ resolved[str(key)] = parsed
389
+ return resolved
390
+
391
+
392
+ def _parse_gvar_value(var_file: Path, key: Any, value: Any) -> Any:
393
+ if not isinstance(value, dict):
394
+ return value
395
+
396
+ file_path = value.get("filePath")
397
+ if file_path is None:
398
+ file_path = value.get("path")
399
+ if file_path is None:
400
+ return value
401
+ if not isinstance(file_path, str) or not file_path.strip():
402
+ log.warning("Invalid gvar file path for '%s' in %s; expected a non-empty string.", key, var_file)
403
+ return _SKIP_GVAR
404
+
405
+ gvar_path = Path(file_path)
406
+ if not gvar_path.is_absolute():
407
+ gvar_path = var_file.parent / gvar_path
408
+ try:
409
+ return gvar_path.read_text()
410
+ except FileNotFoundError:
411
+ log.warning("Gvar content file not found for '%s': %s", key, gvar_path)
412
+ return _SKIP_GVAR
413
+ except OSError as exc:
414
+ log.warning("Failed to read gvar content file for '%s' (%s): %s", key, gvar_path, exc)
415
+ return _SKIP_GVAR
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes