feat(logging): add C5 — Logging & Capture opinionated guard #39

Merged
rootiest merged 10 commits from feat/logging-toggle-c5 into main 2026-06-11 02:05:07 +00:00
Owner

Summary

  • Introduces __fish_config_op_logging as C5 — Logging & Capture in the opinionated-component guard system, controlling all scrollback and AUR-helper logging
  • Real-time sync via --on-variable event handlers: toggling the variable immediately removes/restores paru/yay wrappers and creates/removes a sentinel file in every running shell
  • Kitty's watcher.py checks the sentinel file ($XDG_CONFIG_HOME/fish/.logging_disabled) at the top of save_scrollback_safely, so the Python-side capture also respects the toggle without any subprocess coordination
  • Composes cleanly with existing guards: C3 (__fish_config_op_overrides) controls the smart_exit wrapper itself; C5 controls only the scrollback-capture block inside it; master __fish_config_opinionated=0 disables all five categories at once

Files Changed

File Change
.gitignore Add .logging_disabled sentinel
functions/__fish_config_sync_logging.fish New: shared enable/disable logic (sentinel + wrapper generate/remove)
functions/__fish_config_logging_changed.fish New: --on-variable __fish_config_op_logging event handler
functions/__fish_config_opinionated_changed.fish New: --on-variable __fish_config_opinionated event handler
functions/smart_exit.fish Add C5 guard wrapping scrollback capture block only
conf.d/paru-wrapper.fish Add C5 guard: remove generated wrapper and return when logging off
conf.d/yay-wrapper.fish Same as paru
docs/fish-config.md Add __fish_config_op_logging to variable table; update category count
README.md Add C5 row to Minimal Mode table; update "four" → "five"

Note: ~/.config/kitty/watcher.py was updated in a separate commit to the kitty config repo (commit 3f7eab7).

Manual Verification

  • In a new fish shell: set -U __fish_config_op_logging 0 — confirm ~/.local/bin/paru (if present) is removed and ~/.config/fish/.logging_disabled is created
  • Re-enable: set -Ue __fish_config_op_logging — confirm sentinel is removed and paru wrapper is regenerated (if /usr/bin/paru exists)
  • With logging disabled, run exit — confirm shell exits cleanly without attempting scrollback capture
  • With logging disabled, close a Kitty window — confirm no new file appears in ~/.terminal_history/
  • set -U __fish_config_opinionated 0 — confirm master switch also disables C5 (sentinel created, wrappers removed)
  • help config opinionated — confirm __fish_config_op_logging appears in the variable table
## Summary - Introduces `__fish_config_op_logging` as **C5 — Logging & Capture** in the opinionated-component guard system, controlling all scrollback and AUR-helper logging - Real-time sync via `--on-variable` event handlers: toggling the variable immediately removes/restores paru/yay wrappers and creates/removes a sentinel file in every running shell - Kitty's `watcher.py` checks the sentinel file (`$XDG_CONFIG_HOME/fish/.logging_disabled`) at the top of `save_scrollback_safely`, so the Python-side capture also respects the toggle without any subprocess coordination - Composes cleanly with existing guards: C3 (`__fish_config_op_overrides`) controls the `smart_exit` wrapper itself; C5 controls only the scrollback-capture block inside it; master `__fish_config_opinionated=0` disables all five categories at once ## Files Changed | File | Change | |---|---| | `.gitignore` | Add `.logging_disabled` sentinel | | `functions/__fish_config_sync_logging.fish` | New: shared enable/disable logic (sentinel + wrapper generate/remove) | | `functions/__fish_config_logging_changed.fish` | New: `--on-variable __fish_config_op_logging` event handler | | `functions/__fish_config_opinionated_changed.fish` | New: `--on-variable __fish_config_opinionated` event handler | | `functions/smart_exit.fish` | Add C5 guard wrapping scrollback capture block only | | `conf.d/paru-wrapper.fish` | Add C5 guard: remove generated wrapper and return when logging off | | `conf.d/yay-wrapper.fish` | Same as paru | | `docs/fish-config.md` | Add `__fish_config_op_logging` to variable table; update category count | | `README.md` | Add C5 row to Minimal Mode table; update "four" → "five" | Note: `~/.config/kitty/watcher.py` was updated in a separate commit to the kitty config repo (commit `3f7eab7`). ## Manual Verification - [x] In a new fish shell: `set -U __fish_config_op_logging 0` — confirm `~/.local/bin/paru` (if present) is removed and `~/.config/fish/.logging_disabled` is created - [x] Re-enable: `set -Ue __fish_config_op_logging` — confirm sentinel is removed and paru wrapper is regenerated (if `/usr/bin/paru` exists) - [x] With logging disabled, run `exit` — confirm shell exits cleanly without attempting scrollback capture - [x] With logging disabled, close a Kitty window — confirm no new file appears in `~/.terminal_history/` - [x] `set -U __fish_config_opinionated 0` — confirm master switch also disables C5 (sentinel created, wrappers removed) - [x] `help config opinionated` — confirm `__fish_config_op_logging` appears in the variable table
rootiest added 8 commits 2026-06-11 01:50:18 +00:00
Add C5 (Logging & Capture) guard to wrapper generation in both
conf.d/paru-wrapper.fish and conf.d/yay-wrapper.fish. When C5 logging
is disabled, the guard removes any generated wrapper and returns early,
allowing the system to fall back to the bare binary.

Also replaces stale Task #4 comment references with C5 classification.
Add __fish_config_op_logging (C5 — Logging & Capture) to the opinionated
components variable table and update the master-disable example comment
from "four categories" to "five categories".

AGENTS.md and opinionated_catalog.md are git-ignored per project policy;
those files were updated on disk but cannot be tracked in this repo.
rootiest added 1 commit 2026-06-11 01:55:03 +00:00
--on-variable handlers in functions/ are only autoloaded on explicit call,
so they never fire when a universal variable changes. Moving the definitions
to conf.d/logging-events.fish ensures they are registered at shell init.

Also adds a startup __fish_config_sync_logging call so pre-set variable
values (e.g. set before this shell was opened) take effect immediately
without requiring a re-set.
rootiest added 1 commit 2026-06-11 02:00:02 +00:00
When smart_exit skips fish-side capture due to the C5 guard, it now sets
logged_by_shell=true on the Kitty window before calling builtin exit. This
prevents watcher.py's on_close handler from capturing the scrollback even
if the sentinel file is absent, providing a second layer of protection.

Also restructures the capture block to be flat (no wrapper if-true) after
the early-exit guard.
rootiest merged commit 0cced863f8 into main 2026-06-11 02:05:07 +00:00
rootiest deleted branch feat/logging-toggle-c5 2026-06-11 02:05:07 +00:00
Sign in to join this conversation.