| 1 | # print_style.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `print_style.py` helper module. |
| 6 | - This module formats console/debug output consistently. |
| 7 | - Keep this file-level DOX profile synchronized with `print_style.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `print_style.py` owns the runtime implementation. |
| 12 | - `print_style.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Classes: |
| 14 | - `PrintStyle` (no explicit base class) |
| 15 | - `get(self, *args, sep=..., **kwargs)` |
| 16 | - `print(self, *args, sep=..., end=..., flush=...)` |
| 17 | - `stream(self, *args, sep=..., flush=...)` |
| 18 | - `is_last_line_empty(self)` |
| 19 | - `standard(*args, sep=..., end=..., flush=...)` |
| 20 | - `hint(*args, sep=..., end=..., flush=...)` |
| 21 | - `info(*args, sep=..., end=..., flush=...)` |
| 22 | - `success(*args, sep=..., end=..., flush=...)` |
| 23 | - Top-level functions: |
| 24 | - `_get_runtime()` |
| 25 | |
| 26 | ## Runtime Contracts |
| 27 | |
| 28 | - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together. |
| 29 | - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change. |
| 30 | - `PrintStyle` emits sanitized, secret-masked console output and does not create filesystem log files. |
| 31 | - `get()` preserves its plain-text, ANSI-styled, and HTML-styled return values for existing callers. |
| 32 | - Imported dependency areas include: `collections.abc`, `files`, `html`, `strings`, `sys`, `webcolors`. |
| 33 | |
| 34 | ## Key Concepts |
| 35 | |
| 36 | - Important called helpers/classes observed in the source: `self._get_rgb_color_code`, `html.escape.replace`, `sep.join`, `self._format_args`, `sanitize_string`, `self._add_padding_if_needed`, `end.endswith`, `sys.stdin.readlines`, `PrintStyle._prefixed_args`, `self.secrets_mgr.mask_values`, `self._get_styled_text`, `self._get_html_styled_text`. |
| 37 | - Keep request/response, tool, or helper semantics documented here at the same time as source changes. |
| 38 | |
| 39 | ## Work Guidance |
| 40 | |
| 41 | - Preserve public helper APIs used by core code and plugins unless every caller is updated. |
| 42 | - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded. |
| 43 | - Prefer adding cohesive helper functions here only when behavior is reused across modules. |
| 44 | |
| 45 | ## Verification |
| 46 | |
| 47 | - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers. |
| 48 | - Related tests observed by source search: |
| 49 | - `tests/test_print_style.py` |
| 50 | - `tests/test_tool_action_contracts.py` |
| 51 | - `tests/test_ws_manager.py` |
| 52 | |
| 53 | ## Child DOX Index |
| 54 | |
| 55 | No child DOX files. |