Skip to content

Commit f0cbfef

Browse files
committed
fix: revert env, add arg
1 parent 5655621 commit f0cbfef

File tree

8 files changed

+26
-17
lines changed

8 files changed

+26
-17
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ BUMP ?= patch
1010

1111
install:
1212
$(UV) sync --all-extras
13-
$(UV) tool install --force --no-binary --no-cache --from . avrae-ls
13+
$(UV) tool install --force --no-cache --from . avrae-ls
1414

1515
lint:
1616
$(UV) run ruff check $(PY_SOURCES)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "avrae-ls"
7-
version = "0.6.3"
7+
version = "0.6.4"
88
description = "Language server for Avrae draconic aliases"
99
authors = [
1010
{ name = "1drturtle" }

src/avrae_ls/__main__.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def main(argv: list[str] | None = None) -> None:
4242
const=".",
4343
help="Run alias tests in PATH (defaults to current directory)",
4444
)
45+
parser.add_argument("--token", help="Avrae API token (overrides config)")
46+
parser.add_argument("--base-url", help="Avrae API base URL (overrides config)")
4547
parser.add_argument("--version", action="store_true", help="Print version and exit")
4648
args = parser.parse_args(argv)
4749

@@ -56,12 +58,12 @@ def main(argv: list[str] | None = None) -> None:
5658
parser.error("--run-tests cannot be combined with --tcp")
5759
if args.analyze:
5860
parser.error("--run-tests cannot be combined with --analyze")
59-
sys.exit(_run_alias_tests(Path(args.run_tests)))
61+
sys.exit(_run_alias_tests(Path(args.run_tests), token_override=args.token, base_url_override=args.base_url))
6062

6163
if args.analyze:
6264
if args.tcp:
6365
parser.error("--analyze cannot be combined with --tcp")
64-
sys.exit(_run_analysis(Path(args.analyze)))
66+
sys.exit(_run_analysis(Path(args.analyze), token_override=args.token, base_url_override=args.base_url))
6567

6668
server = create_server()
6769
if args.tcp:
@@ -80,7 +82,7 @@ def _configure_logging(level: str) -> None:
8082
)
8183

8284

83-
def _run_analysis(path: Path) -> int:
85+
def _run_analysis(path: Path, *, token_override: str | None = None, base_url_override: str | None = None) -> int:
8486
if not path.exists():
8587
print(f"File not found: {path}", file=sys.stderr)
8688
return 2
@@ -90,6 +92,10 @@ def _run_analysis(path: Path) -> int:
9092
log.info("Analyzing %s (workspace root: %s)", path, workspace_root)
9193

9294
config, warnings = load_config(workspace_root, default_enable_gvar_fetch=True)
95+
if token_override:
96+
config.service.token = token_override
97+
if base_url_override:
98+
config.service.base_url = base_url_override
9399
for warning in warnings:
94100
log.warning(warning)
95101

@@ -104,7 +110,9 @@ def _run_analysis(path: Path) -> int:
104110
return 1 if results else 0
105111

106112

107-
def _run_alias_tests(target: Path) -> int:
113+
def _run_alias_tests(
114+
target: Path, *, token_override: str | None = None, base_url_override: str | None = None
115+
) -> int:
108116
if not target.exists():
109117
print(f"Test path not found: {target}", file=sys.stderr)
110118
return 2
@@ -114,6 +122,10 @@ def _run_alias_tests(target: Path) -> int:
114122
log.info("Running alias tests in %s (workspace root: %s)", target, workspace_root)
115123

116124
config, warnings = load_config(workspace_root, default_enable_gvar_fetch=True)
125+
if token_override:
126+
config.service.token = token_override
127+
if base_url_override:
128+
config.service.base_url = base_url_override
117129
for warning in warnings:
118130
log.warning(warning)
119131

src/avrae_ls/config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@ def load_config(workspace_root: Path, *, default_enable_gvar_fetch: bool = False
393393
if not path.exists():
394394
cfg = AvraeLSConfig.default(workspace_root)
395395
cfg.enable_gvar_fetch = default_enable_gvar_fetch
396-
env_token = _coerce_optional_str(os.environ.get("AVRAE_TOKEN"))
397-
if env_token:
398-
cfg.service.token = env_token
399396
return cfg, []
400397

401398
try:
@@ -419,10 +416,9 @@ def load_config(workspace_root: Path, *, default_enable_gvar_fetch: bool = False
419416
enable_gvar_fetch = bool(raw.get("enableGvarFetch", default_enable_gvar_fetch))
420417

421418
service_cfg = raw.get("avraeService") or {}
422-
env_token = _coerce_optional_str(env.get("AVRAE_TOKEN"))
423419
service = AvraeServiceConfig(
424420
base_url=str(service_cfg.get("baseUrl") or AvraeServiceConfig.base_url),
425-
token=_coerce_optional_str(service_cfg.get("token")) or env_token,
421+
token=_coerce_optional_str(service_cfg.get("token")),
426422
)
427423

428424
diag_cfg = raw.get("diagnostics") or {}

src/avrae_ls/context.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import annotations
22

3-
import json
4-
import logging
53
import asyncio
64
import copy
5+
import json
6+
import logging
77
from dataclasses import dataclass, field
88
from pathlib import Path
99
from typing import Any, Dict, Iterable
@@ -320,6 +320,7 @@ async def _do_request(session: httpx.AsyncClient) -> httpx.Response:
320320
return True
321321

322322

323+
323324
def _read_json_file(path: Path) -> Dict[str, Any] | None:
324325
try:
325326
text = path.read_text()

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-extension/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "avrae-ls-client",
33
"displayName": "Avrae Draconic Alias Language Server",
44
"description": "VS Code client for avrae-ls (draconic alias diagnostics and mock execution).",
5-
"version": "0.6.3",
5+
"version": "0.6.4",
66
"engines": {
77
"vscode": "^1.84.0"
88
},

0 commit comments

Comments
 (0)