Skip to content

[codex] Preserve legacy sync behavior without state - #15

Merged
felipe0328 merged 2 commits into
mainfrom
codex/preserve-legacy-sync
Jun 24, 2026
Merged

[codex] Preserve legacy sync behavior without state#15
felipe0328 merged 2 commits into
mainfrom
codex/preserve-legacy-sync

Conversation

@felipe0328

@felipe0328 felipe0328 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Restores backward-compatible ./sync.sh behavior for machines configured before the v1.2 component-state system existed, including the repository Git-hook refresh performed by the legacy sync command.

Previously, a pre-v1.2 machine had no ~/.config/power_mac/state, so the same no-argument ./sync.sh command that used to refresh configs exited with an error after upgrading to v1.2.

What changed

When sync.sh runs without explicit selection flags, it now follows this order:

  1. Use the saved component state when available.
  2. If state is missing, detect component configs already symlinked to this repository.
  3. If managed symlinks are detected, sync only those components.
  4. If nothing can be detected, fall back to the exact legacy config set: Shell, WezTerm, Neovim, and AeroSpace.
  5. Reinstall this repository's Git hooks after every successful sync.
  6. After hooks succeed, save the detected or fallback selection for future runs.

Tmux is intentionally excluded from the fallback because the pre-v1.2 sync.sh did not manage Tmux configuration.

Safety and compatibility

  • Detection is generic and derives ownership from each component's declared config mappings.
  • Both absolute and repository-managed symlink targets are matched without changing unrelated files.
  • Hook failure makes the sync fail and prevents migrated state from being persisted.
  • State is written only after every selected config and the Git-hook setup succeed.
  • --dry-run reports config and hook operations without persisting state or invoking the hook installer.
  • Explicit --all and --components behavior remains unchanged.

Validation

  • bash -n install.sh sync.sh lib/*.sh components/*.sh tmux-installer/tmux-installer.sh tests/installer_test.sh
  • shellcheck install.sh sync.sh lib/*.sh components/*.sh tmux-installer/tmux-installer.sh tests/installer_test.sh
  • ./tests/installer_test.sh — 22/22 tests passing

Regression coverage verifies detected legacy migration, the exact legacy fallback set, exclusion of Tmux, Git-hook installation, hook-failure state safety, and dry-run non-persistence.

@github-actions

Copy link
Copy Markdown
Contributor

Version preview

Current Expected after merge Bump
1.2.0 1.2.1 patch

This PR will trigger a version bump after it is merged into main.

conventional commits require patch bump.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4c456b6f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sync.sh
@felipe0328
felipe0328 merged commit 1f635f9 into main Jun 24, 2026
6 checks passed
@felipe0328
felipe0328 deleted the codex/preserve-legacy-sync branch June 24, 2026 15:45
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.

1 participant