Skip to content

fix: all append blocks reuse managed config files instead of inlining#26

Merged
ChangeHow merged 3 commits intomainfrom
copilot/fix-append-logic-in-suitup-init
Mar 21, 2026
Merged

fix: all append blocks reuse managed config files instead of inlining#26
ChangeHow merged 3 commits intomainfrom
copilot/fix-append-logic-in-suitup-init

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

The append mode blocks inlined config file content directly into .zshrc instead of reusing suitup's managed config files under ~/.config/zsh/. This caused duplicate loading if users later ran setup, and specifically for tools-init, the wrong fzf/atuin order broke atuin's Ctrl-R binding.

Changes

  • src/append.js: All append blocks now consistently copy config files to ~/.config/zsh/ via copyIfNotExists and source them with source_if_exists, instead of inlining content. Affected blocks:
    • tools-init: replaced inline eval commands with sourcing shared/tools.zsh (fixes fzf/atuin order and adds caching)
    • zsh-options: replaced inlined options.zsh content with copy+source of core/options.zsh
    • env-vars: replaced inlined env.zsh content with copy+source of core/env.zsh
    • perf: replaced inlined perf.zsh content with copy+source of core/perf.zsh
    • fzf-config: replaced inlined fzf.zsh content with copy+source of shared/fzf.zsh
  • tests/append.test.js: Updated test fixtures to match new source-based format; added tests verifying no content is inlined for each fixed block.

Before (example — tools-init):

# >>> suitup/tools-init >>>
command -v atuin  &>/dev/null && eval "$(atuin init zsh)"   # ← wrong order
command -v fzf    &>/dev/null && eval "$(fzf --zsh)"        # ← steals Ctrl-R
command -v zoxide &>/dev/null && eval "$(zoxide init zsh)"
command -v fnm    &>/dev/null && eval "$(fnm env ...)"
# <<< suitup/tools-init <<<

After (all blocks follow this pattern):

# >>> suitup/tools-init >>>
source_if_exists "$HOME/.config/zsh/shared/tools.zsh"
[[ -s "$HOME/.bun/_bun" ]] && source "$HOME/.bun/_bun"
# <<< suitup/tools-init <<<

tools.zsh already loads fzf before atuin (so atuin keeps Ctrl-R) and uses _source_cached_tool_init for faster startup. All other blocks similarly source their respective managed files, preventing duplication if the user later migrates to full setup mode.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Fixes #25 — the append mode now sources ~/.config/zsh/shared/tools.zsh
(which has the correct fzf-before-atuin order and caching) instead of
generating inline eval commands with the wrong order that broke atuin's
Ctrl-R binding.

Co-authored-by: ChangeHow <23733347+ChangeHow@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ChangeHow/suitup/sessions/c4e1ed01-6e6f-4627-8e2a-6713a92a1d55
Copilot AI changed the title [WIP] Fix append logic in suitup initialization fix: tools-init append reuses managed tools.zsh instead of inline evals Mar 21, 2026
Copilot AI requested a review from ChangeHow March 21, 2026 16:27
@ChangeHow ChangeHow marked this pull request as ready for review March 21, 2026 16:29
@ChangeHow
Copy link
Owner

@copilot 其他的 append 都没有问题了吗?检查过了吗?

…lining

zsh-options, env-vars, perf, and fzf-config blocks now copy config
files to ~/.config/zsh/ and source them, consistent with tools-init.
Prevents duplication if user later runs setup.

Co-authored-by: ChangeHow <23733347+ChangeHow@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ChangeHow/suitup/sessions/a9f7a54f-f6ca-4022-89ec-c7daa9cd773b
Copy link
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot 其他的 append 都没有问题了吗?检查过了吗?

已全面检查并修复。除了 tools-init,还有 4 个 block 存在同样的问题——直接把配置内容 inline 到 .zshrc 而不是复用 ~/.config/zsh/ 下的托管文件:

  • zsh-options:内联 options.zsh → 改为 copy+source core/options.zsh
  • env-vars:内联 env.zsh → 改为 copy+source core/env.zsh
  • perf:内联 perf.zsh → 改为 copy+source core/perf.zsh
  • fzf-config:内联 fzf.zsh → 改为 copy+source shared/fzf.zsh

所有 block 现在统一使用 copyIfNotExists + source_if_exists 模式,与 template 保持一致,避免后续执行 setup 时产生重复加载。见 commit 36e119a

Copilot AI changed the title fix: tools-init append reuses managed tools.zsh instead of inline evals fix: all append blocks reuse managed config files instead of inlining Mar 21, 2026
@ChangeHow ChangeHow merged commit 11eb276 into main Mar 21, 2026
1 check passed
@ChangeHow
Copy link
Owner

/close #25

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