Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions aai_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ def validate_profile(name: str) -> None:
tripping over it at keyring-write time.
"""
if not _PROFILE_RE.match(name):
from aai_cli.errors import CLIError

raise CLIError(
f"Invalid profile name {name!r}.",
error_type="invalid_profile",
Expand Down Expand Up @@ -132,8 +130,6 @@ def _load() -> Config:
try:
data = tomllib.load(fh)
except tomllib.TOMLDecodeError as exc:
from aai_cli.errors import CLIError

raise CLIError(
f"Config file at {path} is not valid TOML ({exc}). Fix or delete it.",
error_type="invalid_config",
Expand All @@ -142,8 +138,6 @@ def _load() -> Config:
try:
cfg = Config.model_validate(data)
except ValidationError as exc:
from aai_cli.errors import CLIError

raise CLIError(
f"Config file at {path} has an unexpected shape "
f"({_validation_summary(exc)}). Fix or delete it.",
Expand Down Expand Up @@ -459,8 +453,6 @@ def _resolve_api_key(*, profile: str | None, api_key_flag: str | None) -> str:
if api_key_flag is not None:
flag_key = api_key_flag.strip()
if not flag_key:
from aai_cli.errors import CLIError

raise CLIError(
"Empty --api-key provided.",
error_type="invalid_key",
Expand Down
2 changes: 0 additions & 2 deletions aai_cli/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ def resolve_session(self) -> tuple[int, str]:
key. Raises NotAuthenticated when the active profile has no stored session
(e.g. it was set up with `assembly login --api-key`, or the session expired).
"""
from aai_cli.errors import NotAuthenticated

profile = self.resolve_profile()
session = config.get_session(profile)
account_id = config.get_account_id(profile)
Expand Down
4 changes: 1 addition & 3 deletions aai_cli/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ def is_agentic() -> bool:
env var is set. Used to suppress *interactivity* (the spinner) — never to change the
output *shape*; `resolve_json` keeps text the default regardless (see its docstring).
"""
if not _stdout_is_tty():
return True
return any(os.environ.get(var) for var in _AGENT_ENV_VARS)
return not _stdout_is_tty() or any(os.environ.get(var) for var in _AGENT_ENV_VARS)


def set_color_mode(mode: choices.ColorMode) -> None:
Expand Down
Loading