From ea88882cc8ce0f57441f14129191f9735b215aec Mon Sep 17 00:00:00 2001 From: DreamCoder08 Date: Mon, 28 Sep 2026 14:09:24 -0500 Subject: [PATCH 1/4] fix(theme): keep sourced shell snippets from setting shell options The LS_COLORS, fzf and bat snippets started with set -euo pipefail; .zshrc sources them, which turned errexit/nounset on in the interactive shell so the first failing command closed the terminal. --- DreamcoderThemes/bat-dreamcoder.sh | 2 +- .../dreamcoder/bat-dreamcoder-dark.sh | 2 +- .../dreamcoder/bat-dreamcoder-light.sh | 2 +- .../dreamcoder/bat-dreamcoder-night.sh | 2 +- .../dreamcoder/ls-colors-dreamcoder-dark.sh | 2 +- .../dreamcoder/ls-colors-dreamcoder-light.sh | 2 +- .../dreamcoder/ls-colors-dreamcoder-night.sh | 2 +- DreamcoderThemes/fzf-dreamcoder.sh | 2 +- DreamcoderThemes/ls-colors-dreamcoder.sh | 2 +- .../renderers_extra_bat_delta.py | 2 +- src/dreamcoder_theme/renderers_extra_shell.py | 4 +-- tests/test_sourced_snippets_shell_options.py | 27 +++++++++++++++++++ 12 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 tests/test_sourced_snippets_shell_options.py diff --git a/DreamcoderThemes/bat-dreamcoder.sh b/DreamcoderThemes/bat-dreamcoder.sh index b9329212..f00852a8 100644 --- a/DreamcoderThemes/bat-dreamcoder.sh +++ b/DreamcoderThemes/bat-dreamcoder.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark — Bat theme; run 'bat cache --build' after installing the tmTheme. export BAT_THEME="Dreamcoder-Dark" export BAT_STYLE="auto,changes,header,grid" diff --git a/DreamcoderThemes/dreamcoder/bat-dreamcoder-dark.sh b/DreamcoderThemes/dreamcoder/bat-dreamcoder-dark.sh index b9329212..f00852a8 100644 --- a/DreamcoderThemes/dreamcoder/bat-dreamcoder-dark.sh +++ b/DreamcoderThemes/dreamcoder/bat-dreamcoder-dark.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark — Bat theme; run 'bat cache --build' after installing the tmTheme. export BAT_THEME="Dreamcoder-Dark" export BAT_STYLE="auto,changes,header,grid" diff --git a/DreamcoderThemes/dreamcoder/bat-dreamcoder-light.sh b/DreamcoderThemes/dreamcoder/bat-dreamcoder-light.sh index 8015efb1..d606deae 100644 --- a/DreamcoderThemes/dreamcoder/bat-dreamcoder-light.sh +++ b/DreamcoderThemes/dreamcoder/bat-dreamcoder-light.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Light — Bat theme; run 'bat cache --build' after installing the tmTheme. export BAT_THEME="Dreamcoder-Light" export BAT_STYLE="auto,changes,header,grid" diff --git a/DreamcoderThemes/dreamcoder/bat-dreamcoder-night.sh b/DreamcoderThemes/dreamcoder/bat-dreamcoder-night.sh index abe524aa..65f82c79 100644 --- a/DreamcoderThemes/dreamcoder/bat-dreamcoder-night.sh +++ b/DreamcoderThemes/dreamcoder/bat-dreamcoder-night.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark Night — Bat theme; run 'bat cache --build' after installing the tmTheme. export BAT_THEME="Dreamcoder-Night" export BAT_STYLE="auto,changes,header,grid" diff --git a/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-dark.sh b/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-dark.sh index 948d96d8..b41ddb1e 100644 --- a/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-dark.sh +++ b/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-dark.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark — LS_COLORS / eza export LS_COLORS='di=38;2;165;180;252:ex=38;2;212;181;253:ln=38;2;125;211;252:or=48;2;251;191;36;38;2;0;0;0:so=38;2;52;211;153:pi=38;2;251;191;36:bd=38;2;251;133;133:cd=38;2;251;133;133:su=48;2;0;0;0;38;2;212;181;253:sg=48;2;0;0;0;38;2;212;181;253:tw=38;2;165;180;252;48;2;11;11;11:ow=38;2;165;180;252;48;2;11;11;11:st=38;2;165;180;252;48;2;11;11;11:*.sh=38;2;212;181;253:*.bash=38;2;212;181;253:*.zsh=38;2;212;181;253:*.fish=38;2;212;181;253:*.py=38;2;212;181;253:*.rb=38;2;212;181;253:*.rs=38;2;212;181;253:*.go=38;2;212;181;253:*.ts=38;2;212;181;253:*.js=38;2;212;181;253:*.jpg=38;2;216;180;254:*.jpeg=38;2;216;180;254:*.png=38;2;216;180;254:*.gif=38;2;216;180;254:*.bmp=38;2;216;180;254:*.svg=38;2;216;180;254:*.webp=38;2;216;180;254:*.ico=38;2;216;180;254:*.mp3=38;2;216;180;254:*.wav=38;2;216;180;254:*.flac=38;2;216;180;254:*.ogg=38;2;216;180;254:*.m4a=38;2;216;180;254:*.mp4=38;2;216;180;254:*.mkv=38;2;216;180;254:*.webm=38;2;216;180;254:*.mov=38;2;216;180;254:*.pdf=38;2;199;199;199:*.doc=38;2;199;199;199:*.docx=38;2;199;199;199:*.odt=38;2;199;199;199:*.xls=38;2;199;199;199:*.xlsx=38;2;199;199;199:*.ppt=38;2;199;199;199:*.pptx=38;2;199;199;199:*.txt=38;2;199;199;199:*.cfg=38;2;199;199;199:*.conf=38;2;199;199;199:*.json=38;2;199;199;199:*.yaml=38;2;199;199;199:*.yml=38;2;199;199;199:*.toml=38;2;199;199;199:*.xml=38;2;199;199;199:*.css=38;2;199;199;199:*.html=38;2;199;199;199:*.c=38;2;199;199;199:*.h=38;2;199;199;199:*.cpp=38;2;199;199;199:*.hpp=38;2;199;199;199:*.swp=38;2;199;199;199:*.swo=38;2;199;199;199:*.bak=38;2;199;199;199:*.orig=38;2;199;199;199:*.md=#A5B4FC' export EZA_COLORS='di=38;2;165;180;252:ex=38;2;212;181;253:ln=38;2;125;211;252:so=38;2;52;211;153:pi=38;2;251;191;36:bd=38;2;251;133;133:cd=38;2;251;133;133:uw=38;2;251;191;36:ux=38;2;251;133;133:gwx=38;2;251;191;36:*.md=#A5B4FC' diff --git a/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-light.sh b/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-light.sh index 15cf0ad1..67fc12f2 100644 --- a/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-light.sh +++ b/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-light.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Light — LS_COLORS / eza export LS_COLORS='di=38;2;130;79;22:ex=38;2;167;71;28:ln=38;2;13;74;104:or=48;2;101;67;0;38;2;243;234;220:so=38;2;49;91;49:pi=38;2;101;67;0:bd=38;2;132;47;36:cd=38;2;132;47;36:su=48;2;243;234;220;38;2;167;71;28:sg=48;2;243;234;220;38;2;167;71;28:tw=38;2;130;79;22;48;2;255;247;234:ow=38;2;130;79;22;48;2;255;247;234:st=38;2;130;79;22;48;2;255;247;234:*.tar=38;2;87;71;139:*.tgz=38;2;87;71;139:*.gz=38;2;87;71;139:*.bz2=38;2;87;71;139:*.xz=38;2;87;71;139:*.zst=38;2;87;71;139:*.zip=38;2;87;71;139:*.7z=38;2;87;71;139:*.rar=38;2;87;71;139:*.iso=38;2;87;71;139:*.dmg=38;2;87;71;139:*.jpg=38;2;125;62;100:*.jpeg=38;2;125;62;100:*.png=38;2;125;62;100:*.gif=38;2;125;62;100:*.bmp=38;2;125;62;100:*.svg=38;2;125;62;100:*.webp=38;2;125;62;100:*.ico=38;2;125;62;100:*.mp3=38;2;125;62;100:*.wav=38;2;125;62;100:*.flac=38;2;125;62;100:*.ogg=38;2;125;62;100:*.m4a=38;2;125;62;100:*.mp4=38;2;125;62;100:*.mkv=38;2;125;62;100:*.webm=38;2;125;62;100:*.mov=38;2;125;62;100:*.pdf=38;2;53;46;34:*.doc=38;2;53;46;34:*.docx=38;2;53;46;34:*.odt=38;2;53;46;34:*.xls=38;2;53;46;34:*.xlsx=38;2;53;46;34:*.ppt=38;2;53;46;34:*.pptx=38;2;53;46;34:*.txt=38;2;53;46;34:*.cfg=38;2;53;46;34:*.conf=38;2;53;46;34:*.json=38;2;53;46;34:*.yaml=38;2;53;46;34:*.yml=38;2;53;46;34:*.toml=38;2;53;46;34:*.xml=38;2;53;46;34:*.css=38;2;53;46;34:*.html=38;2;53;46;34:*.c=38;2;53;46;34:*.h=38;2;53;46;34:*.cpp=38;2;53;46;34:*.hpp=38;2;53;46;34:*.swp=38;2;53;46;34:*.swo=38;2;53;46;34:*.bak=38;2;53;46;34:*.orig=38;2;53;46;34:*.sh=38;2;167;71;28:*.bash=38;2;167;71;28:*.zsh=38;2;167;71;28:*.fish=38;2;167;71;28:*.py=38;2;167;71;28:*.rb=38;2;167;71;28:*.rs=38;2;167;71;28:*.go=38;2;167;71;28:*.ts=38;2;167;71;28:*.js=38;2;167;71;28:*.md=#824f16' export EZA_COLORS='di=38;2;130;79;22:ex=38;2;167;71;28:ln=38;2;13;74;104:so=38;2;49;91;49:pi=38;2;101;67;0:bd=38;2;132;47;36:cd=38;2;132;47;36:uw=38;2;101;67;0:ux=38;2;132;47;36:gwx=38;2;101;67;0:*.md=#824f16' diff --git a/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-night.sh b/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-night.sh index 8a5701dc..01a82b8b 100644 --- a/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-night.sh +++ b/DreamcoderThemes/dreamcoder/ls-colors-dreamcoder-night.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark Night — LS_COLORS / eza export LS_COLORS='di=38;2;164;175;238:ex=38;2;180;140;233:ln=38;2;98;185;226:or=48;2;209;161;38;38;2;0;0;0:so=38;2;67;180;139:pi=38;2;209;161;38:bd=38;2;232;132;132:cd=38;2;232;132;132:su=48;2;0;0;0;38;2;180;140;233:sg=48;2;0;0;0;38;2;180;140;233:tw=38;2;164;175;238;48;2;9;9;9:ow=38;2;164;175;238;48;2;9;9;9:st=38;2;164;175;238;48;2;9;9;9:*.sh=38;2;180;140;233:*.bash=38;2;180;140;233:*.zsh=38;2;180;140;233:*.fish=38;2;180;140;233:*.py=38;2;180;140;233:*.rb=38;2;180;140;233:*.rs=38;2;180;140;233:*.go=38;2;180;140;233:*.ts=38;2;180;140;233:*.js=38;2;180;140;233:*.jpg=38;2;185;139;235:*.jpeg=38;2;185;139;235:*.png=38;2;185;139;235:*.gif=38;2;185;139;235:*.bmp=38;2;185;139;235:*.svg=38;2;185;139;235:*.webp=38;2;185;139;235:*.ico=38;2;185;139;235:*.mp3=38;2;185;139;235:*.wav=38;2;185;139;235:*.flac=38;2;185;139;235:*.ogg=38;2;185;139;235:*.m4a=38;2;185;139;235:*.mp4=38;2;185;139;235:*.mkv=38;2;185;139;235:*.webm=38;2;185;139;235:*.mov=38;2;185;139;235:*.pdf=38;2;171;171;171:*.doc=38;2;171;171;171:*.docx=38;2;171;171;171:*.odt=38;2;171;171;171:*.xls=38;2;171;171;171:*.xlsx=38;2;171;171;171:*.ppt=38;2;171;171;171:*.pptx=38;2;171;171;171:*.txt=38;2;171;171;171:*.cfg=38;2;171;171;171:*.conf=38;2;171;171;171:*.json=38;2;171;171;171:*.yaml=38;2;171;171;171:*.yml=38;2;171;171;171:*.toml=38;2;171;171;171:*.xml=38;2;171;171;171:*.css=38;2;171;171;171:*.html=38;2;171;171;171:*.c=38;2;171;171;171:*.h=38;2;171;171;171:*.cpp=38;2;171;171;171:*.hpp=38;2;171;171;171:*.swp=38;2;171;171;171:*.swo=38;2;171;171;171:*.bak=38;2;171;171;171:*.orig=38;2;171;171;171:*.md=#a4afee' export EZA_COLORS='di=38;2;164;175;238:ex=38;2;180;140;233:ln=38;2;98;185;226:so=38;2;67;180;139:pi=38;2;209;161;38:bd=38;2;232;132;132:cd=38;2;232;132;132:uw=38;2;209;161;38:ux=38;2;232;132;132:gwx=38;2;209;161;38:*.md=#a4afee' diff --git a/DreamcoderThemes/fzf-dreamcoder.sh b/DreamcoderThemes/fzf-dreamcoder.sh index 9cfcf070..7883c922 100644 --- a/DreamcoderThemes/fzf-dreamcoder.sh +++ b/DreamcoderThemes/fzf-dreamcoder.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark — fzf export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS:-} --color=bg:#000000,bg+:#0D0D0F,fg:#E6E6E6,fg+:#E6E6E6,hl:#A5B4FC,hl+:#A5B4FC,info:#7DD3FC,marker:#34D399,prompt:#A5B4FC,spinner:#D4B5FD,pointer:#D4B5FD,header:#C7C7C7,border:#6B6B6B,label:#C7C7C7,query:#E6E6E6,gutter:#0D0D0F,scrollbar:#6B6B6B,separator:#6B6B6B,preview-bg:#0D0D0F,preview-border:#6B6B6B" diff --git a/DreamcoderThemes/ls-colors-dreamcoder.sh b/DreamcoderThemes/ls-colors-dreamcoder.sh index 948d96d8..b41ddb1e 100644 --- a/DreamcoderThemes/ls-colors-dreamcoder.sh +++ b/DreamcoderThemes/ls-colors-dreamcoder.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark — LS_COLORS / eza export LS_COLORS='di=38;2;165;180;252:ex=38;2;212;181;253:ln=38;2;125;211;252:or=48;2;251;191;36;38;2;0;0;0:so=38;2;52;211;153:pi=38;2;251;191;36:bd=38;2;251;133;133:cd=38;2;251;133;133:su=48;2;0;0;0;38;2;212;181;253:sg=48;2;0;0;0;38;2;212;181;253:tw=38;2;165;180;252;48;2;11;11;11:ow=38;2;165;180;252;48;2;11;11;11:st=38;2;165;180;252;48;2;11;11;11:*.sh=38;2;212;181;253:*.bash=38;2;212;181;253:*.zsh=38;2;212;181;253:*.fish=38;2;212;181;253:*.py=38;2;212;181;253:*.rb=38;2;212;181;253:*.rs=38;2;212;181;253:*.go=38;2;212;181;253:*.ts=38;2;212;181;253:*.js=38;2;212;181;253:*.jpg=38;2;216;180;254:*.jpeg=38;2;216;180;254:*.png=38;2;216;180;254:*.gif=38;2;216;180;254:*.bmp=38;2;216;180;254:*.svg=38;2;216;180;254:*.webp=38;2;216;180;254:*.ico=38;2;216;180;254:*.mp3=38;2;216;180;254:*.wav=38;2;216;180;254:*.flac=38;2;216;180;254:*.ogg=38;2;216;180;254:*.m4a=38;2;216;180;254:*.mp4=38;2;216;180;254:*.mkv=38;2;216;180;254:*.webm=38;2;216;180;254:*.mov=38;2;216;180;254:*.pdf=38;2;199;199;199:*.doc=38;2;199;199;199:*.docx=38;2;199;199;199:*.odt=38;2;199;199;199:*.xls=38;2;199;199;199:*.xlsx=38;2;199;199;199:*.ppt=38;2;199;199;199:*.pptx=38;2;199;199;199:*.txt=38;2;199;199;199:*.cfg=38;2;199;199;199:*.conf=38;2;199;199;199:*.json=38;2;199;199;199:*.yaml=38;2;199;199;199:*.yml=38;2;199;199;199:*.toml=38;2;199;199;199:*.xml=38;2;199;199;199:*.css=38;2;199;199;199:*.html=38;2;199;199;199:*.c=38;2;199;199;199:*.h=38;2;199;199;199:*.cpp=38;2;199;199;199:*.hpp=38;2;199;199;199:*.swp=38;2;199;199;199:*.swo=38;2;199;199;199:*.bak=38;2;199;199;199:*.orig=38;2;199;199;199:*.md=#A5B4FC' export EZA_COLORS='di=38;2;165;180;252:ex=38;2;212;181;253:ln=38;2;125;211;252:so=38;2;52;211;153:pi=38;2;251;191;36:bd=38;2;251;133;133:cd=38;2;251;133;133:uw=38;2;251;191;36:ux=38;2;251;133;133:gwx=38;2;251;191;36:*.md=#A5B4FC' diff --git a/src/dreamcoder_theme/renderers_extra_bat_delta.py b/src/dreamcoder_theme/renderers_extra_bat_delta.py index 63798081..74560147 100644 --- a/src/dreamcoder_theme/renderers_extra_bat_delta.py +++ b/src/dreamcoder_theme/renderers_extra_bat_delta.py @@ -14,7 +14,7 @@ def bat_content(c: dict[str, str]) -> str: theme = f"Dreamcoder-{'Night' if 'Night' in c.get('name', '') else mode_name.title()}" return ( "#!/usr/bin/env bash\n" - "set -euo pipefail\n" + "# Sourced snippet: never set shell options here.\n" f"# {c['name']} — Bat theme; run 'bat cache --build' after installing the tmTheme.\n" f'export BAT_THEME="{theme}"\n' 'export BAT_STYLE="auto,changes,header,grid"\n' diff --git a/src/dreamcoder_theme/renderers_extra_shell.py b/src/dreamcoder_theme/renderers_extra_shell.py index df5dd5a1..1b2dc6ab 100644 --- a/src/dreamcoder_theme/renderers_extra_shell.py +++ b/src/dreamcoder_theme/renderers_extra_shell.py @@ -185,7 +185,7 @@ def g(key: str) -> str: "gwx": _fg(g("warning")), "*.md": g("accent"), } - return f"#!/usr/bin/env bash\nset -euo pipefail\n# {c['name']} — LS_COLORS / eza\nexport LS_COLORS='{':'.join(entries)}'\nexport EZA_COLORS='{':'.join(f'{k}={v}' for k, v in eza.items())}'\n" + return f"#!/usr/bin/env bash\n# Sourced snippet: never set shell options here.\n# {c['name']} — LS_COLORS / eza\nexport LS_COLORS='{':'.join(entries)}'\nexport EZA_COLORS='{':'.join(f'{k}={v}' for k, v in eza.items())}'\n" def fzf_content(c: dict[str, str]) -> str: @@ -218,7 +218,7 @@ def fzf_content(c: dict[str, str]) -> str: f"preview-bg:{preview_bg}", f"preview-border:{c['border']}", ] - return f'#!/usr/bin/env bash\nset -euo pipefail\n# {c["name"]} — fzf\nexport FZF_DEFAULT_OPTS="${{FZF_DEFAULT_OPTS:-}} --color={",".join(parts)}"\n' + return f'#!/usr/bin/env bash\n# Sourced snippet: never set shell options here.\n# {c["name"]} — fzf\nexport FZF_DEFAULT_OPTS="${{FZF_DEFAULT_OPTS:-}} --color={",".join(parts)}"\n' # --- Hexagonal-architecture-v2: adjacent immutable registrations (design §5) --- diff --git a/tests/test_sourced_snippets_shell_options.py b/tests/test_sourced_snippets_shell_options.py new file mode 100644 index 00000000..c9e5734f --- /dev/null +++ b/tests/test_sourced_snippets_shell_options.py @@ -0,0 +1,27 @@ +"""Snippets meant to be ``source``d must never change the caller's shell options. + +``.zshrc`` sources the LS_COLORS, fzf and bat snippets directly; a +``set -euo pipefail`` inside them turned errexit/nounset on in the interactive +shell, so the first failing command closed the terminal. +""" + +from __future__ import annotations + +import re + +import pytest + +from dreamcoder_theme.palette import load_variants +from dreamcoder_theme.palette_tokens import VARIANTS as DEFAULT_VARIANTS +from dreamcoder_theme.renderers_extra_bat_delta import bat_content +from dreamcoder_theme.renderers_extra_shell import fzf_content, ls_colors_content +from dreamcoder_theme.settings import theme_paths + +SHELL_OPTION = re.compile(r"^\s*set\s+[-+][a-z]", re.MULTILINE) + + +@pytest.mark.parametrize("render", [ls_colors_content, fzf_content, bat_content]) +@pytest.mark.parametrize("mode", ["light", "dark"]) +def test_sourced_snippet_sets_no_shell_options(render, mode): + palette = load_variants(DEFAULT_VARIANTS, theme_paths().tokens_file)[mode] + assert not SHELL_OPTION.search(render(palette)) From b342eb73cab3690c128ea3e9bb64e88c8eaf674e Mon Sep 17 00:00:00 2001 From: DreamCoder08 Date: Mon, 28 Sep 2026 14:10:04 -0500 Subject: [PATCH 2/4] fix(shell): drop errexit from zshrc and start in the persisted mode An interactive .zshrc with set -euo pipefail closes the terminal on the first failing command and breaks plugins. Resolve the theme mode from the persisted live record before an inherited value, matching fish. --- DreamcoderShell/.zshrc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DreamcoderShell/.zshrc b/DreamcoderShell/.zshrc index 5b62ebd4..38de89a7 100644 --- a/DreamcoderShell/.zshrc +++ b/DreamcoderShell/.zshrc @@ -1,5 +1,6 @@ # Dreamcoder interactive Zsh ergonomics. -set -euo pipefail +# No errexit/nounset here: in an interactive shell they close the terminal on +# the first failing command and break plugins and the Starship init. [[ -o interactive ]] || return export EDITOR="nvim" VISUAL="nvim" COLORTERM="${COLORTERM:-truecolor}" @@ -12,7 +13,12 @@ export BUN_INSTALL # ── Dreamcoder Theme Hooks ───────────────────────────────────── # Source shell-level theme snippets based on current mode. -_dc_mode="${DREAMCODER_THEME_MODE:-light}" +# The persisted live mode wins over an inherited value, which a long-lived +# parent (e.g. a Herdr server started before the last switch) may carry stale. +_dc_mode_cache="${XDG_CACHE_HOME:-${HOME}/.cache}/dreamcoder/cursor-cli.env" +_dc_mode="$([[ -r "${_dc_mode_cache}" ]] && sed -nE 's/^(export )?DREAMCODER_THEME_MODE="?(light|dark)"?$/\2/p' "${_dc_mode_cache}" | tail -n1)" +_dc_mode="${_dc_mode:-${DREAMCODER_THEME_MODE:-dark}}" +export DREAMCODER_THEME_MODE="${_dc_mode}" _dc_theme_dir="${DREAMCODER_DOTS_DIR:-${HOME}/Documents/PROYECTOS/dreamcoder-dots}/themes/dreamcoder" [[ -f "${_dc_theme_dir}/ls-colors-dreamcoder-${_dc_mode}.sh" ]] && source "${_dc_theme_dir}/ls-colors-dreamcoder-${_dc_mode}.sh" From 2cb140f21dc244353c79cd9dea59a3b7324cc573 Mon Sep 17 00:00:00 2001 From: DreamCoder08 Date: Mon, 28 Sep 2026 14:10:40 -0500 Subject: [PATCH 3/4] fix(theme): regenerate the fzf snippets without shell options Completes c9cf723: the fzf variants were left out of that commit. --- DreamcoderThemes/dreamcoder/fzf-dreamcoder-dark.sh | 2 +- DreamcoderThemes/dreamcoder/fzf-dreamcoder-light.sh | 2 +- DreamcoderThemes/dreamcoder/fzf-dreamcoder-night.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DreamcoderThemes/dreamcoder/fzf-dreamcoder-dark.sh b/DreamcoderThemes/dreamcoder/fzf-dreamcoder-dark.sh index 9cfcf070..7883c922 100644 --- a/DreamcoderThemes/dreamcoder/fzf-dreamcoder-dark.sh +++ b/DreamcoderThemes/dreamcoder/fzf-dreamcoder-dark.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark — fzf export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS:-} --color=bg:#000000,bg+:#0D0D0F,fg:#E6E6E6,fg+:#E6E6E6,hl:#A5B4FC,hl+:#A5B4FC,info:#7DD3FC,marker:#34D399,prompt:#A5B4FC,spinner:#D4B5FD,pointer:#D4B5FD,header:#C7C7C7,border:#6B6B6B,label:#C7C7C7,query:#E6E6E6,gutter:#0D0D0F,scrollbar:#6B6B6B,separator:#6B6B6B,preview-bg:#0D0D0F,preview-border:#6B6B6B" diff --git a/DreamcoderThemes/dreamcoder/fzf-dreamcoder-light.sh b/DreamcoderThemes/dreamcoder/fzf-dreamcoder-light.sh index 4a398cf3..8dda4890 100644 --- a/DreamcoderThemes/dreamcoder/fzf-dreamcoder-light.sh +++ b/DreamcoderThemes/dreamcoder/fzf-dreamcoder-light.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Light — fzf export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS:-} --color=bg:#f3eadc,bg+:#fff7ea,fg:#17120d,fg+:#17120d,hl:#824f16,hl+:#824f16,info:#0d4a68,marker:#315b31,prompt:#824f16,spinner:#57478b,pointer:#a7471c,header:#352e22,border:#8a7358,label:#352e22,query:#17120d,gutter:#f3eadc,scrollbar:#8a7358,separator:#8a7358,preview-bg:#f3eadc,preview-border:#8a7358" diff --git a/DreamcoderThemes/dreamcoder/fzf-dreamcoder-night.sh b/DreamcoderThemes/dreamcoder/fzf-dreamcoder-night.sh index 4bf9deb7..30b55ca8 100644 --- a/DreamcoderThemes/dreamcoder/fzf-dreamcoder-night.sh +++ b/DreamcoderThemes/dreamcoder/fzf-dreamcoder-night.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced snippet: never set shell options here. # Dreamcoder Dark Night — fzf export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS:-} --color=bg:#000000,bg+:#0b0b0d,fg:#c6c6c6,fg+:#c6c6c6,hl:#a4afee,hl+:#a4afee,info:#62b9e2,marker:#43b48b,prompt:#a4afee,spinner:#b48ce9,pointer:#b48ce9,header:#ababab,border:#5c5c5c,label:#ababab,query:#c6c6c6,gutter:#0b0b0d,scrollbar:#5c5c5c,separator:#5c5c5c,preview-bg:#0b0b0d,preview-border:#5c5c5c" From c9bc0bcda023db91ab92b60ed202c64f580286bc Mon Sep 17 00:00:00 2001 From: DreamCoder08 Date: Mon, 28 Sep 2026 14:13:43 -0500 Subject: [PATCH 4/4] fix(shell): stop the icons alias lib from enabling errexit in interactive shells dreamcoder-icons.sh is sourced by .zshrc and .bashrc; its set -euo pipefail closed the terminal on the first failing command. --- .../.config/shell/aliases/dreamcoder-icons.sh | 2 +- tests/shell/test_sourced_shell_lib.bats | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 tests/shell/test_sourced_shell_lib.bats diff --git a/DreamcoderShell/.config/shell/aliases/dreamcoder-icons.sh b/DreamcoderShell/.config/shell/aliases/dreamcoder-icons.sh index 71b84a24..01203c74 100644 --- a/DreamcoderShell/.config/shell/aliases/dreamcoder-icons.sh +++ b/DreamcoderShell/.config/shell/aliases/dreamcoder-icons.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +# Sourced by interactive shells: never set shell options here. if command -v eza >/dev/null 2>&1; then alias ls='eza --icons=always --group-directories-first' alias ll='eza --icons=always --group-directories-first --long --git' diff --git a/tests/shell/test_sourced_shell_lib.bats b/tests/shell/test_sourced_shell_lib.bats new file mode 100644 index 00000000..a75dadd5 --- /dev/null +++ b/tests/shell/test_sourced_shell_lib.bats @@ -0,0 +1,11 @@ +#!/usr/bin/env bats +# ============================================================================ +# Files under DreamcoderShell/.config/shell are sourced by the interactive +# .zshrc and .bashrc; they must never turn on errexit/nounset/pipefail. +# ============================================================================ + +@test "sourcing every shell lib file leaves bash options untouched" { + run bash -c 'for f in DreamcoderShell/.config/shell/*/*.sh; do source "$f" >/dev/null 2>&1; done + shopt -qo errexit && echo errexit; shopt -qo nounset && echo nounset; shopt -qo pipefail && echo pipefail; echo done' + [ "$output" = "done" ] +}