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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ and versions are tracked in the repo-root `VERSION` file.
Base-shaped `UserConfig` types from the public package facade.
- Make command-filter normalization consumer-neutral by default. Consumers
can provide a normalizer callback for legacy prefixes or aliases.
- Remove the Base-branded logger formatter and IDE schema parser from the
standalone package; those consumer-specific concerns now belong to adapters.
- Make command protocol schemas consumer-owned. The generic protocol now ships
only framing and validation, with `COMMAND_PROTOCOL_V1` as its default
header; consumers can register schemas and preserve a legacy header through
Expand Down
49 changes: 0 additions & 49 deletions lib/python/base_cli/ide_schema.py

This file was deleted.

4 changes: 2 additions & 2 deletions lib/python/base_cli/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _user_stream_level(debug: bool, quiet: bool) -> int:
def _handler_formatter(formatter: logging.Formatter | None, *, use_color: bool) -> logging.Formatter:
if formatter is not None:
return formatter
return BaseCliFormatter(use_color=use_color)
return CliFormatter(use_color=use_color)


def _use_color(stream: TextIO) -> bool:
Expand Down Expand Up @@ -102,7 +102,7 @@ def _secure_log_file_open_flags(mode: str) -> int:
return flags | os.O_APPEND | os.O_WRONLY


class BaseCliFormatter(logging.Formatter):
class CliFormatter(logging.Formatter):
def __init__(self, *, use_utc: bool | None = None, use_color: bool = False) -> None:
self.use_utc = use_utc if use_utc is not None else os.environ.get("LOG_UTC") == "1"
self.use_color = use_color
Expand Down
7 changes: 7 additions & 0 deletions tests/test_generic_core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import importlib.util
import json
import logging
import tempfile
Expand Down Expand Up @@ -71,3 +72,9 @@ def test_base_specific_path_helpers_are_not_in_generic_module(self) -> None:
self.assertFalse(hasattr(paths, "discover_manifest"))
self.assertFalse(hasattr(paths, "normalize_runtime_owner"))
self.assertFalse(hasattr(base_cli.CliProfile, "legacy_base"))

def test_consumer_specific_ide_schema_and_formatter_are_not_in_generic_module(self) -> None:
import base_cli.logging as logging_module

self.assertIsNone(importlib.util.find_spec("base_cli.ide_schema"))
self.assertFalse(hasattr(logging_module, "BaseCliFormatter"))
41 changes: 0 additions & 41 deletions tests/test_ide_schema.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import base_cli
import base_cli.logging as logging_module
from base_cli.logging import BaseCliFormatter
from base_cli.logging import CliFormatter


class ConfigureLoggerTests(unittest.TestCase):
Expand Down Expand Up @@ -45,7 +45,7 @@ def test_configure_logger_defaults_to_stderr_and_base_formatter(self) -> None:
logger.info("hello default")

handler = logger.handlers[0]
self.assertIsInstance(handler.formatter, BaseCliFormatter)
self.assertIsInstance(handler.formatter, CliFormatter)
self.assertIn("INFO", stream.getvalue())
self.assertIn("hello default", stream.getvalue())
self.assertRegex(stream.getvalue(), r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [+-]\d{4} INFO")
Expand Down