Skip to content

Conversation

@JacksonFergusonDev
Copy link
Owner

Summary

This refactor decouples logic from configuration by converting constants.py into a pure data module and centralizing all magic strings (file paths, app labels, ignore patterns).

It also resolves a critical "split-brain" logging issue where the CLI and Daemon were reading/writing to different log files.

Changes

  • Core Refactor (constants.py):

    • Removed _get_state_dir function; path resolution is now handled via top-level constants.
    • Centralized APP_LABEL, DEFAULT_IGNORES, and GIT_LOCK_FILES.
    • Added explicit Path type hints to satisfy strict static analysis.
  • Bug Fix (cli.py):

    • Pointed tail_log to the centralized LOG_FILE constant (XDG State) instead of the hardcoded legacy path (~/.git_pulsar_log).
    • Replaced hardcoded .gitignore defaults with the centralized list.
  • Daemon & Service:

    • Updated daemon.py and service.py to import APP_LABEL and paths from constants rather than defining them locally.
    • Added explicit type casting in system.py to prevent Returning Any errors in strict mode.

Verification

  1. Logging: Run git-pulsar log. It should now correctly tail the active daemon log located in ~/.local/state/git-pulsar/daemon.log (or equivalent XDG path).
  2. Constants: Verify constants.py contains no def statements.

@JacksonFergusonDev JacksonFergusonDev merged commit b23f122 into main Jan 19, 2026
2 checks passed
@JacksonFergusonDev JacksonFergusonDev deleted the refactor branch January 19, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants