Skip to content

feat(themes): add a new theme "shxll"#755

Open
pwnfo wants to merge 1 commit intoohmybash:masterfrom
pwnfo:add-shxll-theme
Open

feat(themes): add a new theme "shxll"#755
pwnfo wants to merge 1 commit intoohmybash:masterfrom
pwnfo:add-shxll-theme

Conversation

@pwnfo
Copy link
Copy Markdown

@pwnfo pwnfo commented Apr 21, 2026

No description provided.

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Add shxll theme with advanced prompt features

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Introduces new "shxll" theme with lambda character prompt
• Implements command execution time tracking and display
• Adds git branch status with dirty state detection
• Includes Python virtual environment display support
• Updates theme documentation with shxll preview
Diagram
flowchart LR
  A["shxll Theme Module"] --> B["Prompt Command Handler"]
  B --> C["Clock Display"]
  B --> D["Execution Time Tracking"]
  B --> E["Git Status Integration"]
  B --> F["Virtual Environment Display"]
  E --> G["Branch & Dirty State"]
  A --> H["Theme Documentation"]
Loading

Grey Divider

File Changes

1. themes/shxll/shxll.theme.sh ✨ Enhancement +158/-0

New shxll theme with advanced prompt features

• Creates new shxll theme with lambda character (λ) as prompt marker
• Implements DEBUG trap to track command execution timing
• Provides git integration showing branch name and dirty state detection
• Displays Python virtual environment information when active
• Includes clock display with time tracking for long-running commands
• Caches git and venv segments for performance optimization

themes/shxll/shxll.theme.sh


2. themes/THEMES.md 📝 Documentation +4/-0

Document shxll theme in themes list

• Adds shxll theme entry to theme documentation
• Includes preview image reference for shxll-dark theme
• Maintains alphabetical ordering in theme list

themes/THEMES.md


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects Bot commented Apr 21, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Unsupported printf time format 🐞 Bug ☼ Reliability
Description
_omb_theme_now / _omb_theme_print_clock use the Bash printf '%(... )T' time formatter, which
is not available on older Bash versions that Oh My Bash explicitly supports (>= 3.2). On those
systems, the theme will emit printf errors and the prompt can break.
Code

themes/shxll/shxll.theme.sh[R25-44]

+_omb_theme_now() {
+	if [[ -n ${EPOCHREALTIME-} ]]; then
+		local sec frac
+		sec=${EPOCHREALTIME%%[.,]*}
+		frac=${EPOCHREALTIME#*[.,]}
+		frac=${frac:0:3}
+		printf '%s%03d' "$sec" "$((10#${frac:-0}))"
+	else
+		printf '%(%s%3N)T' -1
+	fi
+}
+
+_omb_theme_print_clock() {
+	local clock_now
+	printf -v clock_now '%(%H:%M)T' -1
+
+	if [[ $__omb_theme_force_clock -eq 1 || $clock_now != $__omb_theme_last_clock ]]; then
+		printf '\033[90m⌞ %s ⌟\033[0m\n' "$clock_now"
+		__omb_theme_last_clock="$clock_now"
+	fi
Evidence
Oh My Bash supports Bash 3.2+, but the theme’s fallback clock/timer implementation relies on
printf time formatting (%(...)T). When EPOCHREALTIME is absent (common on older Bash), the
fallback path is taken and triggers unsupported printf formats.

themes/shxll/shxll.theme.sh[25-44]
oh-my-bash.sh[13-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The theme uses Bash `printf '%(... )T'` time formatting as a fallback for timing and for the clock. This is not supported on Bash versions that OMB supports (>= 3.2), so the prompt can error/break.

### Issue Context
OMB’s entrypoint explicitly supports Bash 3.2+, so themes must not depend on `printf '%(... )T'`.

### Fix Focus Areas
- themes/shxll/shxll.theme.sh[25-44]
- oh-my-bash.sh[13-22]

### Implementation notes
- Keep the fast path using `EPOCHREALTIME` when present.
- Replace the `printf '%(... )T'` fallback with a portable method (e.g., seconds-only using `$SECONDS` or `date +%s`), and gate millisecond precision behind feature detection.
- Similarly replace `printf -v clock_now '%(%H:%M)T' -1` with `clock_now=$(date +%H:%M)` (or equivalent) to support Bash 3.2/macOS.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. SCM segment goes stale 🐞 Bug ≡ Correctness
Description
_omb_theme_shxll_way_prompt_scm caches the git segment solely by PWD and also calls scm_char
without refreshing SCM, so the prompt can show outdated or incorrect SCM info (e.g., after `git
checkout/dirty changes, or after cd` to a non-repo). This can mislead users because the prompt
won’t reflect current repo state.
Code

themes/shxll/shxll.theme.sh[R69-94]

+_omb_theme_shxll_way_prompt_scm() {
+	if [[ $PWD == "$__omb_theme_last_pwd" ]]; then
+		printf '%s' "$__omb_theme_last_git_segment"
+		return
+	fi
+
+	local CHAR branch dirty color segment="" dirty_state=""
+	CHAR=$(scm_char)
+
+	if [[ $CHAR != "$SCM_NONE_CHAR" ]]; then
+		branch=$(git_current_branch)
+		dirty_state=$(git status --porcelain 2>/dev/null)
+
+		if [[ -n "$dirty_state" ]]; then
+			color="${_omb_prompt_yellow}"
+		else
+			color="${_omb_prompt_blue}"
+		fi
+
+		segment=" ϟ ${color}${branch}${_omb_prompt_normal}"
+	fi
+
+	__omb_theme_last_pwd=$PWD
+	__omb_theme_last_git_segment=$segment
+	printf '%s' "$segment"
+}
Evidence
The function returns the cached segment when PWD is unchanged, so git dirty/branch changes within
the same directory never update the prompt. Additionally, scm_char depends on scm_prompt_char,
which only calls scm when the global SCM variable is empty; since this theme doesn’t call
scm/scm_prompt_vars to refresh SCM per prompt, SCM state can remain stale across directory
changes.

themes/shxll/shxll.theme.sh[69-94]
lib/omb-prompt-base.sh[131-138]
lib/omb-prompt-base.sh[120-128]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The SCM segment logic can become stale/incorrect because it caches output purely by `PWD` and it uses `scm_char` without ensuring SCM state is refreshed for the current directory.

### Issue Context
Users commonly change git state (checkout, add, commit) without changing directories, so a PWD-only cache makes the prompt wrong. Also, `scm_prompt_char` only runs `scm` when the global `SCM` is empty; this theme doesn’t otherwise refresh `SCM` per prompt.

### Fix Focus Areas
- themes/shxll/shxll.theme.sh[69-94]
- lib/omb-prompt-base.sh[120-138]

### Implementation notes
- Either remove the PWD cache entirely, or include additional cache keys (e.g., git HEAD + dirty flag) so the segment updates when state changes.
- Ensure SCM state is refreshed per prompt: call `scm` (or `scm_prompt_vars` / `scm_prompt_info`) before checking SCM.
- Prefer using OMB’s existing SCM helpers (`scm_prompt_vars` / `scm_prompt_info`) instead of directly calling `git status` so behavior is consistent across themes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. PS1 branch injection 🐞 Bug ⛨ Security
Description
The theme injects git_current_branch output directly into PS1 without sanitizing/escaping, so a
malicious branch name containing $()/backticks/escapes can be evaluated when Bash expands the
prompt. This reintroduces the PS1 interpolation vulnerability that OMB mitigates via
git_clean_branch.
Code

themes/shxll/shxll.theme.sh[R75-90]

+	local CHAR branch dirty color segment="" dirty_state=""
+	CHAR=$(scm_char)
+
+	if [[ $CHAR != "$SCM_NONE_CHAR" ]]; then
+		branch=$(git_current_branch)
+		dirty_state=$(git status --porcelain 2>/dev/null)
+
+		if [[ -n "$dirty_state" ]]; then
+			color="${_omb_prompt_yellow}"
+		else
+			color="${_omb_prompt_blue}"
+		fi
+
+		segment=" ϟ ${color}${branch}${_omb_prompt_normal}"
+	fi
+
Evidence
Oh My Bash includes git_clean_branch specifically to avoid Bash prompt interpolation
vulnerabilities by stripping $, backticks and escapes. This theme uses git_current_branch
(unsanitized) and concatenates it into the displayed SCM segment, which is later included in PS1.

themes/shxll/shxll.theme.sh[75-90]
lib/git.sh[76-85]
lib/omb-prompt-base.sh[182-190]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The theme uses `git_current_branch` and inserts its output into PS1 without escaping, enabling prompt injection if the branch name contains `$()`, backticks, or escape sequences.

### Issue Context
OMB already provides `git_clean_branch` explicitly to prevent this class of PS1 interpolation vulnerability.

### Fix Focus Areas
- themes/shxll/shxll.theme.sh[75-90]
- lib/git.sh[76-85]
- lib/omb-prompt-base.sh[182-190]

### Implementation notes
- Replace `branch=$(git_current_branch)` with a sanitized alternative:
 - Prefer `branch=$(git_clean_branch)` (from `lib/omb-prompt-base.sh`) when in git.
 - Or, escape the branch string before embedding into PS1 using `_omb_string_escape_prompt`.
- Ensure the final string inserted into `PS1` cannot trigger command substitution or backslash prompt escapes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment on lines +25 to +44
_omb_theme_now() {
if [[ -n ${EPOCHREALTIME-} ]]; then
local sec frac
sec=${EPOCHREALTIME%%[.,]*}
frac=${EPOCHREALTIME#*[.,]}
frac=${frac:0:3}
printf '%s%03d' "$sec" "$((10#${frac:-0}))"
else
printf '%(%s%3N)T' -1
fi
}

_omb_theme_print_clock() {
local clock_now
printf -v clock_now '%(%H:%M)T' -1

if [[ $__omb_theme_force_clock -eq 1 || $clock_now != $__omb_theme_last_clock ]]; then
printf '\033[90m⌞ %s ⌟\033[0m\n' "$clock_now"
__omb_theme_last_clock="$clock_now"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Unsupported printf time format 🐞 Bug ☼ Reliability

_omb_theme_now / _omb_theme_print_clock use the Bash printf '%(... )T' time formatter, which
is not available on older Bash versions that Oh My Bash explicitly supports (>= 3.2). On those
systems, the theme will emit printf errors and the prompt can break.
Agent Prompt
### Issue description
The theme uses Bash `printf '%(... )T'` time formatting as a fallback for timing and for the clock. This is not supported on Bash versions that OMB supports (>= 3.2), so the prompt can error/break.

### Issue Context
OMB’s entrypoint explicitly supports Bash 3.2+, so themes must not depend on `printf '%(... )T'`.

### Fix Focus Areas
- themes/shxll/shxll.theme.sh[25-44]
- oh-my-bash.sh[13-22]

### Implementation notes
- Keep the fast path using `EPOCHREALTIME` when present.
- Replace the `printf '%(... )T'` fallback with a portable method (e.g., seconds-only using `$SECONDS` or `date +%s`), and gate millisecond precision behind feature detection.
- Similarly replace `printf -v clock_now '%(%H:%M)T' -1` with `clock_now=$(date +%H:%M)` (or equivalent) to support Bash 3.2/macOS.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +69 to +94
_omb_theme_shxll_way_prompt_scm() {
if [[ $PWD == "$__omb_theme_last_pwd" ]]; then
printf '%s' "$__omb_theme_last_git_segment"
return
fi

local CHAR branch dirty color segment="" dirty_state=""
CHAR=$(scm_char)

if [[ $CHAR != "$SCM_NONE_CHAR" ]]; then
branch=$(git_current_branch)
dirty_state=$(git status --porcelain 2>/dev/null)

if [[ -n "$dirty_state" ]]; then
color="${_omb_prompt_yellow}"
else
color="${_omb_prompt_blue}"
fi

segment=" ϟ ${color}${branch}${_omb_prompt_normal}"
fi

__omb_theme_last_pwd=$PWD
__omb_theme_last_git_segment=$segment
printf '%s' "$segment"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Scm segment goes stale 🐞 Bug ≡ Correctness

_omb_theme_shxll_way_prompt_scm caches the git segment solely by PWD and also calls scm_char
without refreshing SCM, so the prompt can show outdated or incorrect SCM info (e.g., after `git
checkout/dirty changes, or after cd` to a non-repo). This can mislead users because the prompt
won’t reflect current repo state.
Agent Prompt
### Issue description
The SCM segment logic can become stale/incorrect because it caches output purely by `PWD` and it uses `scm_char` without ensuring SCM state is refreshed for the current directory.

### Issue Context
Users commonly change git state (checkout, add, commit) without changing directories, so a PWD-only cache makes the prompt wrong. Also, `scm_prompt_char` only runs `scm` when the global `SCM` is empty; this theme doesn’t otherwise refresh `SCM` per prompt.

### Fix Focus Areas
- themes/shxll/shxll.theme.sh[69-94]
- lib/omb-prompt-base.sh[120-138]

### Implementation notes
- Either remove the PWD cache entirely, or include additional cache keys (e.g., git HEAD + dirty flag) so the segment updates when state changes.
- Ensure SCM state is refreshed per prompt: call `scm` (or `scm_prompt_vars` / `scm_prompt_info`) before checking SCM.
- Prefer using OMB’s existing SCM helpers (`scm_prompt_vars` / `scm_prompt_info`) instead of directly calling `git status` so behavior is consistent across themes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread themes/shxll/shxll.theme.sh Outdated
Comment on lines +75 to +90
local CHAR branch dirty color segment="" dirty_state=""
CHAR=$(scm_char)

if [[ $CHAR != "$SCM_NONE_CHAR" ]]; then
branch=$(git_current_branch)
dirty_state=$(git status --porcelain 2>/dev/null)

if [[ -n "$dirty_state" ]]; then
color="${_omb_prompt_yellow}"
else
color="${_omb_prompt_blue}"
fi

segment=" ϟ ${color}${branch}${_omb_prompt_normal}"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Ps1 branch injection 🐞 Bug ⛨ Security

The theme injects git_current_branch output directly into PS1 without sanitizing/escaping, so a
malicious branch name containing $()/backticks/escapes can be evaluated when Bash expands the
prompt. This reintroduces the PS1 interpolation vulnerability that OMB mitigates via
git_clean_branch.
Agent Prompt
### Issue description
The theme uses `git_current_branch` and inserts its output into PS1 without escaping, enabling prompt injection if the branch name contains `$()`, backticks, or escape sequences.

### Issue Context
OMB already provides `git_clean_branch` explicitly to prevent this class of PS1 interpolation vulnerability.

### Fix Focus Areas
- themes/shxll/shxll.theme.sh[75-90]
- lib/git.sh[76-85]
- lib/omb-prompt-base.sh[182-190]

### Implementation notes
- Replace `branch=$(git_current_branch)` with a sanitized alternative:
  - Prefer `branch=$(git_clean_branch)` (from `lib/omb-prompt-base.sh`) when in git.
  - Or, escape the branch string before embedding into PS1 using `_omb_string_escape_prompt`.
- Ensure the final string inserted into `PS1` cannot trigger command substitution or backslash prompt escapes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@pwnfo pwnfo force-pushed the add-shxll-theme branch from de9c201 to 3e0835f Compare April 21, 2026 19:52
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