synth-shell-theme 1.3.9__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {synth_shell_theme-1.3.9/src/synth_shell_theme.egg-info → synth_shell_theme-1.4.0}/PKG-INFO +1 -1
  2. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/pyproject.toml +1 -1
  3. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/__init__.py +1 -1
  4. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/assets/studio.html +84 -51
  5. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/cli.py +2 -2
  6. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/core.py +64 -20
  7. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/ecosystem.py +17 -18
  8. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/patches.py +74 -16
  9. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/server.py +55 -7
  10. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/02-current-live-theme.conf +1 -1
  11. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes.py +35 -9
  12. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/tui.py +1 -1
  13. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0/src/synth_shell_theme.egg-info}/PKG-INFO +1 -1
  14. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/tests/test_synth_shell_theme.py +151 -1
  15. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/LICENSE +0 -0
  16. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/MANIFEST.in +0 -0
  17. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/README.md +0 -0
  18. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/setup.cfg +0 -0
  19. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/__main__.py +0 -0
  20. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/paths.py +0 -0
  21. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/separators.py +0 -0
  22. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/01-screenshot-match.conf +0 -0
  23. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/03-dracula-punch.conf +0 -0
  24. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/04-nord-ice.conf +0 -0
  25. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/05-matrix-green.conf +0 -0
  26. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/06-amber-heat.conf +0 -0
  27. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/07-cloud-ops.conf +0 -0
  28. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/08-catppuccin-mauve.conf +0 -0
  29. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/09-solarized-night.conf +0 -0
  30. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/10-gruvbox-dark.conf +0 -0
  31. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/11-monokai-neon.conf +0 -0
  32. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/12-tokyo-night.conf +0 -0
  33. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/13-synthwave-pink.conf +0 -0
  34. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/14-forest-mint.conf +0 -0
  35. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/15-ruby-steel.conf +0 -0
  36. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/16-ice-gold.conf +0 -0
  37. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/17-aqua-slate.conf +0 -0
  38. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/18-cyber-lime.conf +0 -0
  39. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/19-lavender-sunset.conf +0 -0
  40. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/20-minimal-mono.conf +0 -0
  41. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/21-rose-pine.conf +0 -0
  42. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/22-kanagawa.conf +0 -0
  43. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/23-everforest.conf +0 -0
  44. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/24-one-dark.conf +0 -0
  45. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/25-ayu-dark.conf +0 -0
  46. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/26-nightfox.conf +0 -0
  47. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/27-palenight.conf +0 -0
  48. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/28-cyberdream.conf +0 -0
  49. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/29-moonlight.conf +0 -0
  50. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/30-poimandres.conf +0 -0
  51. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/31-tokyo-storm.conf +0 -0
  52. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/32-catppuccin-mocha.conf +0 -0
  53. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/33-nordic-aurora.conf +0 -0
  54. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/34-horizon-synth.conf +0 -0
  55. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/35-gruvbox-material.conf +0 -0
  56. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/36-oxocarbon.conf +0 -0
  57. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/37-catppuccin-latte.conf +0 -0
  58. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/38-tokyo-twilight.conf +0 -0
  59. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/39-solarized-ocean.conf +0 -0
  60. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/40-vaporwave-sunset.conf +0 -0
  61. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/41-deep-abyss.conf +0 -0
  62. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/42-sakura-blossom.conf +0 -0
  63. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/43-emerald-forest.conf +0 -0
  64. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/44-vesper.conf +0 -0
  65. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/45-cobalt-neon.conf +0 -0
  66. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/46-desert-dunes.conf +0 -0
  67. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/47-cyber-samurai.conf +0 -0
  68. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/48-glacier-mint.conf +0 -0
  69. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/49-carbon-titanium.conf +0 -0
  70. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/50-matcha-latte.conf +0 -0
  71. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/51-volcanic-magma.conf +0 -0
  72. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/52-catppuccin-frappe.conf +0 -0
  73. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/53-bioluminescence.conf +0 -0
  74. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/54-mocha-caramel.conf +0 -0
  75. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/55-neon-genesis.conf +0 -0
  76. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/56-midnight-amethyst.conf +0 -0
  77. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/57-andromeda.conf +0 -0
  78. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/58-golden-velvet.conf +0 -0
  79. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/59-miami-vice.conf +0 -0
  80. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/60-zen-garden.conf +0 -0
  81. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/61-google-cloud.conf +0 -0
  82. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/62-github-dark.conf +0 -0
  83. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/63-cyberpunk-edgerunners.conf +0 -0
  84. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme/themes/64-vscode-dark.conf +0 -0
  85. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme.egg-info/SOURCES.txt +0 -0
  86. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme.egg-info/dependency_links.txt +0 -0
  87. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme.egg-info/entry_points.txt +0 -0
  88. {synth_shell_theme-1.3.9 → synth_shell_theme-1.4.0}/src/synth_shell_theme.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synth-shell-theme
3
- Version: 1.3.9
3
+ Version: 1.4.0
4
4
  Summary: Interactive 256-color Prompt Theme Picker (64 themes), Dual Powerline Separator Editor (48 presets + 60+ Nerd Font glyphs), Runtime Optimizer, and Live Web Studio for synth-shell.
5
5
  Author: Marcus Vinícius Soares
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "synth-shell-theme"
7
- version = "1.3.9"
7
+ version = "1.4.0"
8
8
  description = "Interactive 256-color Prompt Theme Picker (64 themes), Dual Powerline Separator Editor (48 presets + 60+ Nerd Font glyphs), Runtime Optimizer, and Live Web Studio for synth-shell."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -2,6 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- __version__ = "1.3.9"
5
+ __version__ = "1.4.0"
6
6
 
7
7
  __all__ = ["__version__"]
@@ -797,7 +797,7 @@
797
797
  </div>
798
798
 
799
799
  <div class="panel-box">
800
- <h3>Speed, Git &amp; Runtime Patches (v1.1)</h3>
800
+ <h3>Speed, Git &amp; Runtime Patches</h3>
801
801
  <p>Idempotent zero-fork optimizations &amp; WSL2/monorepo Git guards for <code>synth-shell-prompt.sh</code>.</p>
802
802
  <div style="display:flex;flex-direction:column;gap:9px;margin-bottom:14px;">
803
803
  <label class="toggle-label">
@@ -821,7 +821,7 @@
821
821
  </div>
822
822
  <div id="patches-list"></div>
823
823
  <div style="margin-top:14px;">
824
- <button class="primary" id="btn-run-patches">Apply All v1.1 Runtime Patches</button>
824
+ <button class="primary" id="btn-run-patches">Apply All Runtime Patches</button>
825
825
  </div>
826
826
  </div>
827
827
 
@@ -1554,6 +1554,50 @@
1554
1554
  state.keepInput = e.target.checked;
1555
1555
  });
1556
1556
 
1557
+ function contrastFg(hexBg) {
1558
+ const clean = String(hexBg || "#222222").replace("#", "");
1559
+ if (clean.length !== 6) return "white";
1560
+ const r = parseInt(clean.slice(0, 2), 16);
1561
+ const g = parseInt(clean.slice(2, 4), 16);
1562
+ const b = parseInt(clean.slice(4, 6), 16);
1563
+ return (0.299 * r + 0.587 * g + 0.114 * b) >= 140 ? "black" : "white";
1564
+ }
1565
+
1566
+ function collectLayoutPayload() {
1567
+ return {
1568
+ format: state.formatSegments,
1569
+ right_format: state.rightSegments,
1570
+ right_fill_char: state.rightFillChar,
1571
+ enable_osc133: state.enableOsc133,
1572
+ enable_osc7: state.enableOsc7,
1573
+ enable_terminal_sanitize: state.enableTerminalSanitize,
1574
+ kube_show_namespace: state.kubeShowNamespace,
1575
+ kube_prod_warning: state.kubeProdWarning,
1576
+ git_dynamic_color: state.gitDynamicColor,
1577
+ ssh_host_color: state.sshHostColor,
1578
+ pwd_style: state.pwdStyle,
1579
+ notify_duration_sec: Number(document.getElementById("inp-notify-sec").value || 0),
1580
+ custom_segment_text: document.getElementById("inp-custom-badge").value || "",
1581
+ git_show_state: state.gitShowState,
1582
+ enable_command_on_new_line: state.twoLine,
1583
+ enable_vertical_padding: state.verticalPadding,
1584
+ max_pwd_char: state.maxPwdChar,
1585
+ max_git_char: state.maxGitChar,
1586
+ max_pyenv_char: state.maxPyenvChar,
1587
+ max_kube_char: state.maxKubeChar,
1588
+ compact_width: state.compactWidth,
1589
+ git_show_counts: state.gitShowCounts,
1590
+ transient_prompt: state.transientPrompt,
1591
+ prompt_prefix: state.promptPrefix,
1592
+ font_effect: state.fontEffect,
1593
+ enable_terminal_title: state.enableTerminalTitle,
1594
+ git_skip_untracked_on_slow_fs: state.gitSkipUntracked,
1595
+ git_timeout_ms: Number(document.getElementById("inp-git-timeout").value || 0),
1596
+ git_async_cache: state.gitAsyncCache,
1597
+ min_duration_ms: Number(document.getElementById("inp-min-duration").value || 2000)
1598
+ };
1599
+ }
1600
+
1557
1601
  document.getElementById("btn-apply-active").addEventListener("click", () => {
1558
1602
  applyChanges({
1559
1603
  theme: state.selectedThemeId,
@@ -1561,10 +1605,7 @@
1561
1605
  keep_input: state.keepInput,
1562
1606
  internal_separator: state.internalSep.code,
1563
1607
  end_separator: state.endSep.code,
1564
- format: state.formatSegments,
1565
- enable_command_on_new_line: state.twoLine,
1566
- enable_vertical_padding: state.verticalPadding,
1567
- max_pwd_char: state.maxPwdChar
1608
+ ...collectLayoutPayload()
1568
1609
  });
1569
1610
  });
1570
1611
 
@@ -1722,6 +1763,16 @@
1722
1763
  });
1723
1764
 
1724
1765
  document.getElementById("btn-toggle-theme").addEventListener("click", async () => {
1766
+ if (state.staticDemo) {
1767
+ const cur = getSelectedTheme();
1768
+ const isLight = cur && (cur.slug.includes("latte") || cur.slug.includes("light"));
1769
+ const target = state.themes.find(t => t.slug === (isLight ? "tokyo-night" : "catppuccin-latte")) || state.themes[0];
1770
+ if (target) { state.selectedThemeId = target.id; state.activeThemeId = target.id; }
1771
+ renderWorkbench();
1772
+ renderThemeGrid();
1773
+ showToast(`Static Demo: previewing ${target ? target.name : "theme"} (CLI: synth-shell-theme --toggle-theme)`);
1774
+ return;
1775
+ }
1725
1776
  const resp = await fetch("/api/toggle-theme", {
1726
1777
  method: "POST",
1727
1778
  headers: { "Content-Type": "application/json" },
@@ -1740,21 +1791,28 @@
1740
1791
  });
1741
1792
 
1742
1793
  document.getElementById("btn-save-custom-theme").addEventListener("click", async () => {
1794
+ if (state.staticDemo) { showToast("Static Demo: saving custom themes requires local `synth-shell-theme web`."); return; }
1743
1795
  const name = document.getElementById("ct-name").value.trim() || "My TrueColor Theme";
1744
1796
  const description = document.getElementById("ct-desc").value.trim();
1797
+ const bgHost = document.getElementById("ct-bg-host").value;
1798
+ const bgPwd = document.getElementById("ct-bg-pwd").value;
1799
+ const bgGit = document.getElementById("ct-bg-git").value;
1800
+ const bgPyenv = document.getElementById("ct-bg-pyenv").value;
1801
+ const bgTf = document.getElementById("ct-bg-tf").value;
1802
+ const bgKube = document.getElementById("ct-bg-kube").value;
1745
1803
  const colors = {
1746
- font_color_host: "white",
1747
- background_host: document.getElementById("ct-bg-host").value,
1748
- font_color_pwd: "black",
1749
- background_pwd: document.getElementById("ct-bg-pwd").value,
1750
- font_color_git: "black",
1751
- background_git: document.getElementById("ct-bg-git").value,
1752
- font_color_pyenv: "black",
1753
- background_pyenv: document.getElementById("ct-bg-pyenv").value,
1754
- font_color_tf: "black",
1755
- background_tf: document.getElementById("ct-bg-tf").value,
1756
- font_color_kube: "black",
1757
- background_kube: document.getElementById("ct-bg-kube").value,
1804
+ font_color_host: contrastFg(bgHost),
1805
+ background_host: bgHost,
1806
+ font_color_pwd: contrastFg(bgPwd),
1807
+ background_pwd: bgPwd,
1808
+ font_color_git: contrastFg(bgGit),
1809
+ background_git: bgGit,
1810
+ font_color_pyenv: contrastFg(bgPyenv),
1811
+ background_pyenv: bgPyenv,
1812
+ font_color_tf: contrastFg(bgTf),
1813
+ background_tf: bgTf,
1814
+ font_color_kube: contrastFg(bgKube),
1815
+ background_kube: bgKube,
1758
1816
  font_color_input: document.getElementById("ct-fg-input").value,
1759
1817
  background_input: "none"
1760
1818
  };
@@ -1776,6 +1834,7 @@
1776
1834
  });
1777
1835
 
1778
1836
  document.getElementById("btn-run-bench").addEventListener("click", async () => {
1837
+ if (state.staticDemo) { showToast("Run locally: synth-shell-theme bench"); return; }
1779
1838
  const out = document.getElementById("bench-result");
1780
1839
  out.textContent = "Benchmarking…";
1781
1840
  const resp = await fetch("/api/bench", {
@@ -1814,41 +1873,11 @@
1814
1873
  });
1815
1874
 
1816
1875
  document.getElementById("btn-save-layout").addEventListener("click", () => {
1817
- applyChanges({
1818
- format: state.formatSegments,
1819
- right_format: state.rightSegments,
1820
- right_fill_char: state.rightFillChar,
1821
- enable_osc133: state.enableOsc133,
1822
- enable_osc7: state.enableOsc7,
1823
- enable_terminal_sanitize: state.enableTerminalSanitize,
1824
- kube_show_namespace: state.kubeShowNamespace,
1825
- kube_prod_warning: state.kubeProdWarning,
1826
- git_dynamic_color: state.gitDynamicColor,
1827
- ssh_host_color: state.sshHostColor,
1828
- pwd_style: state.pwdStyle,
1829
- notify_duration_sec: Number(document.getElementById("inp-notify-sec").value || 0),
1830
- custom_segment_text: document.getElementById("inp-custom-badge").value || "",
1831
- git_show_state: state.gitShowState,
1832
- enable_command_on_new_line: state.twoLine,
1833
- enable_vertical_padding: state.verticalPadding,
1834
- max_pwd_char: state.maxPwdChar,
1835
- max_git_char: state.maxGitChar,
1836
- max_pyenv_char: state.maxPyenvChar,
1837
- max_kube_char: state.maxKubeChar,
1838
- compact_width: state.compactWidth,
1839
- git_show_counts: state.gitShowCounts,
1840
- transient_prompt: state.transientPrompt,
1841
- prompt_prefix: state.promptPrefix,
1842
- font_effect: state.fontEffect,
1843
- enable_terminal_title: state.enableTerminalTitle,
1844
- git_skip_untracked_on_slow_fs: state.gitSkipUntracked,
1845
- git_timeout_ms: Number(document.getElementById("inp-git-timeout").value || 0),
1846
- git_async_cache: state.gitAsyncCache,
1847
- min_duration_ms: Number(document.getElementById("inp-min-duration").value || 2000)
1848
- });
1876
+ applyChanges(collectLayoutPayload());
1849
1877
  });
1850
1878
 
1851
1879
  document.getElementById("btn-ascii-safe").addEventListener("click", async () => {
1880
+ if (state.staticDemo) { showToast("Run locally: synth-shell-theme --ascii-safe"); return; }
1852
1881
  const resp = await fetch("/api/ascii-safe", {
1853
1882
  method: "POST",
1854
1883
  headers: { "Content-Type": "application/json" },
@@ -1862,6 +1891,7 @@
1862
1891
  });
1863
1892
 
1864
1893
  document.getElementById("btn-sync-root").addEventListener("click", async () => {
1894
+ if (state.staticDemo) { showToast("Run locally: synth-shell-theme --sync-root"); return; }
1865
1895
  const resp = await fetch("/api/sync-root", {
1866
1896
  method: "POST",
1867
1897
  headers: { "Content-Type": "application/json" },
@@ -1875,6 +1905,7 @@
1875
1905
  });
1876
1906
 
1877
1907
  document.getElementById("btn-sync-greeter").addEventListener("click", async () => {
1908
+ if (state.staticDemo) { showToast("Run locally: synth-shell-theme --sync-greeter"); return; }
1878
1909
  const resp = await fetch("/api/greeter", {
1879
1910
  method: "POST",
1880
1911
  headers: { "Content-Type": "application/json" },
@@ -1888,6 +1919,7 @@
1888
1919
  });
1889
1920
 
1890
1921
  document.getElementById("btn-greeter-hide-swap").addEventListener("click", async () => {
1922
+ if (state.staticDemo) { showToast("Run locally: synth-shell-theme --sync-greeter --hide-swap"); return; }
1891
1923
  const resp = await fetch("/api/greeter", {
1892
1924
  method: "POST",
1893
1925
  headers: { "Content-Type": "application/json" },
@@ -1901,6 +1933,7 @@
1901
1933
  });
1902
1934
 
1903
1935
  document.getElementById("btn-run-patches").addEventListener("click", async () => {
1936
+ if (state.staticDemo) { showToast("Run locally: synth-shell-theme init"); return; }
1904
1937
  const resp = await fetch("/api/patches", {
1905
1938
  method: "POST",
1906
1939
  headers: { "Content-Type": "application/json" },
@@ -1910,7 +1943,7 @@
1910
1943
  if (data.ok) {
1911
1944
  syncFromServerState(data.state, data.backups, data.greeter);
1912
1945
  const count = (data.changes || []).length;
1913
- showToast(count ? `Applied ${count} runtime patch(es)` : "All v1.1 runtime patches already active!");
1946
+ showToast(count ? `Applied ${count} runtime patch(es)` : "All runtime patches already active!");
1914
1947
  }
1915
1948
  });
1916
1949
 
@@ -1,4 +1,4 @@
1
- """Command-line interface for `synth-shell-theme` and `synth-shell-separator` (v1.1.0)."""
1
+ """Command-line interface for `synth-shell-theme` and `synth-shell-separator`."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
@@ -543,7 +543,7 @@ def main(argv: list[str] | None = None) -> int:
543
543
  " synth-shell-theme Launch interactive 2-column TUI\n"
544
544
  " synth-shell-theme web Launch live browser-based Web Studio (port 7778)\n"
545
545
  " synth-shell-theme sep Launch interactive Dual Separator & 60+ Glyph Editor\n"
546
- " synth-shell-theme init Apply all v1.2 runtime, speed, TrueColor & hook-chaining patches\n"
546
+ " synth-shell-theme init Apply all runtime, speed, TrueColor, smart safety & hook-chaining patches\n"
547
547
  " synth-shell-theme doctor Check config, locale, Nerd Fonts, TERM, backups & patch health\n"
548
548
  " synth-shell-theme bench Measure live prompt_command_hook latency (p50 / p95 ms)\n"
549
549
  " synth-shell-theme completion Print Bash tab-completion script\n"
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  import json
6
6
  import os
7
7
  import re
8
+ import shlex
8
9
  import shutil
9
10
  import statistics
10
11
  import subprocess
@@ -173,17 +174,36 @@ def _strip_inline_comment(val: str) -> str:
173
174
 
174
175
 
175
176
  def _unquote(val: str) -> str:
176
- """Remove surrounding Bash quotes (`\"...\"`, `'...'`, or `$'...'`)."""
177
+ """Remove surrounding Bash quotes (`\"...\"`, `'...'`, or `$'...'`) and unescape double-quoted specials."""
177
178
  s = _strip_inline_comment(val)
178
179
  if s.startswith("$'") and s.endswith("'"):
179
180
  return s[2:-1]
180
- if len(s) >= 2 and s[0] == s[-1] and s[0] in ('"', "'"):
181
+ if len(s) >= 2 and s[0] == "'" and s[-1] == "'":
181
182
  return s[1:-1]
183
+ if len(s) >= 2 and s[0] == '"' and s[-1] == '"':
184
+ inner = s[1:-1]
185
+ out: list[str] = []
186
+ i = 0
187
+ while i < len(inner):
188
+ if inner[i] == "\\" and i + 1 < len(inner) and inner[i + 1] in ('\\', '"', "$", "`"):
189
+ out.append(inner[i + 1])
190
+ i += 2
191
+ else:
192
+ out.append(inner[i])
193
+ i += 1
194
+ return "".join(out)
182
195
  return s
183
196
 
184
197
 
185
198
  def _escape_bash_dq(val: str) -> str:
186
- return val.replace("\\", "\\\\").replace('"', '\\"')
199
+ """Safely escape a string for a Bash double-quoted config assignment (`key=\"...\"`)."""
200
+ clean = str(val).replace("\r", " ").replace("\n", " ")
201
+ return (
202
+ clean.replace("\\", "\\\\")
203
+ .replace('"', '\\"')
204
+ .replace("$", "\\$")
205
+ .replace("`", "\\`")
206
+ )
187
207
 
188
208
 
189
209
  def _upsert_kv_lines(lines: list[str], updates: dict[str, str]) -> list[str]:
@@ -344,7 +364,7 @@ def detect_current_theme(
344
364
 
345
365
  for raw_line in lines:
346
366
  line = raw_line.strip()
347
- m_hdr = re.match(r"^#\s*Theme\s+\d+:\s*(.+)$", line)
367
+ m_hdr = re.match(r"^#\s*Theme(?:\s+\d+)?:\s*(.+)$", line)
348
368
  if m_hdr and header_title is None:
349
369
  header_title = m_hdr.group(1).strip()
350
370
  continue
@@ -625,7 +645,7 @@ def apply_theme(
625
645
  bak = backup_config(base) if (create_backup and cfg.is_file()) else None
626
646
 
627
647
  theme_id = int(theme.get("id", 0) or 0)
628
- theme_title = str(theme.get("name") or theme.get("_name") or "Custom")
648
+ theme_title = " ".join(str(theme.get("name") or theme.get("_name") or "Custom").replace("\r", " ").replace("\n", " ").split())
629
649
  header_comment = (
630
650
  f"# Theme {theme_id}: {theme_title}" if theme_id else f"# Theme: {theme_title}"
631
651
  )
@@ -699,10 +719,11 @@ def apply_theme(
699
719
  val = str(theme[key])
700
720
  if force_white and key.startswith("font_color_") and key != "font_color_input":
701
721
  val = "white"
722
+ safe_val = _escape_bash_dq(val)
702
723
  if "'" in line and '"' not in line:
703
- new_lines.append(f"{key}='{val}'")
724
+ new_lines.append(f"{key}='{val.replace(chr(39), '')}'")
704
725
  else:
705
- new_lines.append(f'{key}="{val}"')
726
+ new_lines.append(f'{key}="{safe_val}"')
706
727
  updated.add(key)
707
728
  else:
708
729
  new_lines.append(line)
@@ -722,7 +743,7 @@ def apply_theme(
722
743
  val = str(theme[key])
723
744
  if force_white and key.startswith("font_color_") and key != "font_color_input":
724
745
  val = "white"
725
- new_lines.append(f'{key}="{val}"')
746
+ new_lines.append(f'{key}="{_escape_bash_dq(val)}"')
726
747
 
727
748
  _atomic_write(cfg, "\n".join(new_lines) + "\n")
728
749
  return {
@@ -746,7 +767,7 @@ def apply_separators(
746
767
  ensure_dual_separator_support(base)
747
768
 
748
769
  if not cfg.is_file():
749
- themes = load_themes()
770
+ themes = load_themes(config_dir=base)
750
771
  apply_theme(themes[1] if len(themes) > 1 else themes[0], create_backup=False, config_dir=base)
751
772
 
752
773
  bak = backup_config(base) if create_backup else None
@@ -930,6 +951,21 @@ def apply_layout_options(
930
951
 
931
952
  return {
932
953
  "format": clean_format,
954
+ "right_format": clean_right_format,
955
+ "right_fill_char": right_fill_char,
956
+ "enable_osc133": enable_osc133,
957
+ "enable_osc7": enable_osc7,
958
+ "enable_terminal_sanitize": enable_terminal_sanitize,
959
+ "kube_show_namespace": kube_show_namespace,
960
+ "kube_prod_warning": kube_prod_warning,
961
+ "kube_prod_pattern": kube_prod_pattern,
962
+ "git_dynamic_color": git_dynamic_color,
963
+ "ssh_host_color": ssh_host_color,
964
+ "pwd_style": pwd_style,
965
+ "notify_duration_sec": notify_duration_sec,
966
+ "custom_segment_text": custom_segment_text,
967
+ "git_show_state": git_show_state,
968
+ "battery_threshold": battery_threshold,
933
969
  "enable_command_on_new_line": new_line,
934
970
  "enable_vertical_padding": vertical_padding,
935
971
  "max_pwd_char": max_pwd_char,
@@ -963,7 +999,7 @@ def apply_ascii_safe_mode(
963
999
  cfg = get_config_path(base)
964
1000
 
965
1001
  if not cfg.is_file():
966
- themes = load_themes()
1002
+ themes = load_themes(config_dir=base)
967
1003
  apply_theme(themes[1] if len(themes) > 1 else themes[0], create_backup=False, config_dir=base)
968
1004
 
969
1005
  bak = backup_config(base) if create_backup else None
@@ -993,7 +1029,7 @@ def sync_root_config(
993
1029
  """Generate/sync `synth-shell-prompt.root.config` matching active theme with a root warning accent."""
994
1030
  base = config_dir if config_dir is not None else get_config_dir()
995
1031
  root_cfg = get_root_config_path(base)
996
- catalog = load_themes()
1032
+ catalog = load_themes(config_dir=base)
997
1033
  state = read_current_state(catalog, base)
998
1034
 
999
1035
  if theme is None:
@@ -1022,7 +1058,7 @@ def sync_root_config(
1022
1058
  "",
1023
1059
  "# High-visibility root warning accent on USER & HOST",
1024
1060
  'font_color_user="white"',
1025
- f'background_user="{root_accent}"',
1061
+ f'background_user="{_escape_bash_dq(root_accent)}"',
1026
1062
  'texteffect_user="bold"',
1027
1063
  'font_color_host="white"',
1028
1064
  'background_host="52"',
@@ -1030,16 +1066,18 @@ def sync_root_config(
1030
1066
  "",
1031
1067
  "# Remaining segments synced from active theme",
1032
1068
  ]
1033
- for seg in ("pwd", "git", "pyenv", "tf", "kube", "clock", "status", "duration", "aws", "gcp", "docker", "node", "ssh"):
1069
+ for seg in SEGMENT_KEYS:
1070
+ if seg in ("user", "host", "input"):
1071
+ continue
1034
1072
  def_fg, def_bg = DEFAULT_SEGMENT_COLORS[seg]
1035
1073
  fg = str(theme.get(f"font_color_{seg}", def_fg))
1036
1074
  bg = str(theme.get(f"background_{seg}", def_bg))
1037
- lines.append(f'font_color_{seg}="{fg}"')
1038
- lines.append(f'background_{seg}="{bg}"')
1075
+ lines.append(f'font_color_{seg}="{_escape_bash_dq(fg)}"')
1076
+ lines.append(f'background_{seg}="{_escape_bash_dq(bg)}"')
1039
1077
 
1040
1078
  lines.extend(
1041
1079
  [
1042
- f'font_color_input="{root_accent}"',
1080
+ f'font_color_input="{_escape_bash_dq(root_accent)}"',
1043
1081
  'background_input="none"',
1044
1082
  'texteffect_input="bold"',
1045
1083
  ]
@@ -1102,7 +1140,7 @@ def sync_greeter_theme(
1102
1140
  """Sync active prompt theme colors and/or monitor visibility into `synth-shell-greeter.config`."""
1103
1141
  base = config_dir if config_dir is not None else get_config_dir()
1104
1142
  gcfg = get_greeter_config_path(base)
1105
- catalog = load_themes()
1143
+ catalog = load_themes(config_dir=base)
1106
1144
  state = read_current_state(catalog, base)
1107
1145
 
1108
1146
  if theme is None:
@@ -1198,6 +1236,11 @@ def export_preset(dest_path: Path, config_dir: Path | None = None) -> Path:
1198
1236
  "max_git_char": state["max_git_char"],
1199
1237
  "max_pyenv_char": state["max_pyenv_char"],
1200
1238
  "max_kube_char": state["max_kube_char"],
1239
+ "compact_width": state["compact_width"],
1240
+ "git_show_counts": state["git_show_counts"],
1241
+ "transient_prompt": state["transient_prompt"],
1242
+ "light_theme": state["light_theme"],
1243
+ "dark_theme": state["dark_theme"],
1201
1244
  "prompt_prefix": state["prompt_prefix"],
1202
1245
  "font_effect": state["font_effect"],
1203
1246
  "enable_terminal_title": state["enable_terminal_title"],
@@ -1233,7 +1276,7 @@ def import_preset(src_path: Path, config_dir: Path | None = None) -> dict[str, o
1233
1276
  pseudo_theme[str(k)] = str(v)
1234
1277
  apply_theme(pseudo_theme, create_backup=False, config_dir=base)
1235
1278
  elif data.get("active_theme"):
1236
- themes = load_themes()
1279
+ themes = load_themes(config_dir=base)
1237
1280
  found, _ = find_theme(str(data["active_theme"]), themes)
1238
1281
  if found:
1239
1282
  apply_theme(found, create_backup=False, config_dir=base)
@@ -1424,7 +1467,7 @@ def benchmark_prompt(
1424
1467
  bench_sh = Path(tmp) / "bench_prompt.sh"
1425
1468
  bench_sh.write_text(stripped + "\n", encoding="utf-8", newline="\n")
1426
1469
  driver = (
1427
- f'source "{bench_sh}" >/dev/null 2>&1; '
1470
+ f"source {shlex.quote(str(bench_sh))} >/dev/null 2>&1; "
1428
1471
  'declare -F prompt_command_hook >/dev/null 2>&1 || exit 2; '
1429
1472
  "prompt_command_hook; " # warm-up
1430
1473
  f"for ((i=0; i<{runs}; i++)); do "
@@ -1432,11 +1475,12 @@ def benchmark_prompt(
1432
1475
  "prompt_command_hook; "
1433
1476
  't1="${EPOCHREALTIME:-}"; '
1434
1477
  'if [[ -n "$t0" && -n "$t1" ]]; then '
1435
- 'echo "$(( (${t1/./} - ${t0/./}) ))"; '
1478
+ 'echo "$(( (${t1/[.,]/} - ${t0/[.,]/}) ))"; '
1436
1479
  "else echo 0; fi; "
1437
1480
  "done"
1438
1481
  )
1439
1482
  bench_env = dict(os.environ)
1483
+ bench_env["LC_NUMERIC"] = "C"
1440
1484
  if not bench_env.get("TERM") or bench_env.get("TERM") == "dumb":
1441
1485
  bench_env["TERM"] = "xterm-256color"
1442
1486
  t_wall0 = time.perf_counter()
@@ -190,15 +190,13 @@ def export_starship_toml(
190
190
  f'"$schema" = "https://starship.rs/config-schema.json"\n\n'
191
191
  f'format = """\n'
192
192
  f"$hostname\\\n"
193
- f"[ {int_sep}](fg:{host_bg} bg:{pwd_bg})\\\n"
193
+ f"[{int_sep}](fg:{host_bg} bg:{pwd_bg})\\\n"
194
194
  f"$directory\\\n"
195
- f"[{int_sep}](fg:{pwd_bg} bg:{git_bg})\\\n"
195
+ f"[{end_sep}](fg:{pwd_bg})\\\n"
196
196
  f"$git_branch$git_status\\\n"
197
- f"[{int_sep}](fg:{git_bg} bg:{py_bg})\\\n"
198
197
  f"$python\\\n"
199
- f"[{int_sep}](fg:{py_bg} bg:{kube_bg})\\\n"
200
198
  f"$kubernetes\\\n"
201
- f"[{end_sep}](fg:{kube_bg})\\\n"
199
+ f"$cmd_duration\\\n"
202
200
  f"{nl}$character\"\"\"\n\n"
203
201
  f"[hostname]\n"
204
202
  f"ssh_only = false\n"
@@ -210,21 +208,21 @@ def export_starship_toml(
210
208
  f"truncation_length = 3\n\n"
211
209
  f"[git_branch]\n"
212
210
  f'style = "bg:{git_bg} fg:{git_fg} bold"\n'
213
- f'format = "[ $symbol$branch ]($style)"\n\n'
211
+ f'format = " [ $symbol$branch ]($style)"\n\n'
214
212
  f"[git_status]\n"
215
213
  f'style = "bg:{git_bg} fg:{git_fg} bold"\n'
216
- f'format = "[$all_status$ahead_behind ]($style)"\n\n'
214
+ f'format = "([$all_status$ahead_behind ]($style))[{end_sep}](fg:{git_bg})"\n\n'
217
215
  f"[python]\n"
218
216
  f'style = "bg:{py_bg} fg:{py_fg} bold"\n'
219
- f'format = "[ $virtualenv ]($style)"\n\n'
217
+ f'format = " [ $virtualenv ]($style)[{end_sep}](fg:{py_bg})"\n\n'
220
218
  f"[kubernetes]\n"
221
219
  f"disabled = false\n"
222
220
  f'style = "bg:{kube_bg} fg:{kube_fg} bold"\n'
223
- f'format = "[ ☸ $context ($namespace) ]($style)"\n\n'
221
+ f'format = " [ ☸ $context ($namespace) ]($style)[{end_sep}](fg:{kube_bg})"\n\n'
224
222
  f"[cmd_duration]\n"
225
223
  f"min_time = {int(state.get('min_duration_ms', 2000))}\n"
226
224
  f'style = "bg:{dur_bg} fg:{dur_fg} bold"\n'
227
- f'format = "[ ⏱ $duration ]($style)"\n\n'
225
+ f'format = " [ ⏱ $duration ]($style)[{end_sep}](fg:{dur_bg})"\n\n'
228
226
  f"[character]\n"
229
227
  f'success_symbol = "[❯](bold {input_fg})"\n'
230
228
  f'error_symbol = "[✗](bold #f7768e)"\n'
@@ -243,6 +241,7 @@ def ssh_install_remote(
243
241
  config_dir: Path | None = None,
244
242
  ) -> dict[str, object]:
245
243
  """Deploy the patched `synth-shell-prompt.sh` + active config to a remote host over SSH (zero Python/Git needed remotely)."""
244
+ from synth_shell_theme.core import ASCII_SAFE_GIT_SYMBOLS, _upsert_kv_lines
246
245
  from synth_shell_theme.paths import get_config_path, get_prompt_script_path
247
246
 
248
247
  base = config_dir if config_dir is not None else get_config_dir()
@@ -256,15 +255,15 @@ def ssh_install_remote(
256
255
  sh_bytes = prompt_sh.read_text(encoding="utf-8", errors="replace").replace("\r\n", "\n").encode("utf-8")
257
256
  cfg_text = cfg_path.read_text(encoding="utf-8", errors="replace").replace("\r\n", "\n")
258
257
 
259
- extra_lines: list[str] = []
258
+ cfg_updates: dict[str, str] = {}
260
259
  if ssh_host_color and "ssh_host_color=" not in cfg_text:
261
- extra_lines.append('ssh_host_color="true"')
260
+ cfg_updates["ssh_host_color"] = "true"
262
261
  if ascii_safe:
263
- cfg_text = re.sub(r'^separator_char=.*$', 'separator_char=">"', cfg_text, flags=re.MULTILINE)
264
- cfg_text = re.sub(r'^separator_char_end=.*$', 'separator_char_end=">"', cfg_text, flags=re.MULTILINE)
265
- extra_lines.append('git_symbol_dirty=" *"')
266
- if extra_lines:
267
- cfg_text = cfg_text.rstrip() + "\n" + "\n".join(extra_lines) + "\n"
262
+ cfg_updates["separator_char"] = ">"
263
+ cfg_updates["separator_char_end"] = ">"
264
+ cfg_updates.update(ASCII_SAFE_GIT_SYMBOLS)
265
+ if cfg_updates:
266
+ cfg_text = "\n".join(_upsert_kv_lines(cfg_text.splitlines(), cfg_updates)) + "\n"
268
267
  cfg_bytes = cfg_text.encode("utf-8")
269
268
 
270
269
  b64_sh = base64.b64encode(sh_bytes).decode("ascii")
@@ -276,7 +275,7 @@ def ssh_install_remote(
276
275
  f"printf '%s' {shlex.quote(b64_sh)} | base64 -d > \"$HOME/.config/synth-shell/synth-shell-prompt.sh\"\n"
277
276
  f"printf '%s' {shlex.quote(b64_cfg)} | base64 -d > \"$HOME/.config/synth-shell/synth-shell-prompt.config\"\n"
278
277
  'chmod +x "$HOME/.config/synth-shell/synth-shell-prompt.sh"\n'
279
- 'HOOK=\'if [ -f "$HOME/.config/synth-shell/synth-shell-prompt.sh" ] && [ -n "$( echo $- | grep i )" ]; then source "$HOME/.config/synth-shell/synth-shell-prompt.sh"; fi\'\n'
278
+ 'HOOK=\'if [[ -f "$HOME/.config/synth-shell/synth-shell-prompt.sh" && $- == *i* ]]; then source "$HOME/.config/synth-shell/synth-shell-prompt.sh"; fi\'\n'
280
279
  'touch "$HOME/.bashrc"\n'
281
280
  'grep -q "synth-shell-prompt.sh" "$HOME/.bashrc" || printf "\\n# synth-shell-theme remote prompt\\n%s\\n" "$HOOK" >> "$HOME/.bashrc"\n'
282
281
  'echo "SYNTH_SSH_DEPLOY_OK"\n'