Skip to content

Add PowerShell 7.6.8 with enhanced console configuration and Nerd Font support - #33

Merged
jwaisner merged 4 commits into
mainfrom
7.6.8
Oct 23, 2026
Merged

jwaisner merged 4 commits into
mainfrom
7.6.8

Conversation

@N6REJ

@N6REJ N6REJ commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

…t support

- Add powershell.bat launcher with automatic font detection and registry configuration
- Implement register-fonts.ps1 for Nerd Font installation and registration
- Configure Microsoft.PowerShell_profile.ps1 with Oh My Posh, PSReadLine, and Terminal-Icons
- Add deps.properties defining Oh My Posh, Nerd Fonts, and PowerShell module dependencies
- Configure bearsampp.conf with PowerShell 7.6.8 settings and CaskaydiaMono NF font
- Update bundle.release to 2026.10.23
@N6REJ
N6REJ requested a review from jwaisner October 23, 2026 11:01
@N6REJ N6REJ added the enhancement ✨ Improve program label Oct 23, 2026
Auto-generated from release 2026.10.23
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add PowerShell 7.6.8 bundle with configured Nerd Font console

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Add a PowerShell 7.6.8 bundle and advance the bundle release to 2026.10.23.
• Bundle a Nerd Font and configure console font registration during launch.
• Provide a profile with Oh My Posh, Terminal-Icons, and PSReadLine settings.
Diagram

graph TD
  Build["Gradle build"] --> Bundle["7.6.8 bundle"] --> Launcher["Batch launcher"] --> Check{"Font setup?"} --> Installer["Font registrar"] --> Registry["Console registry"] --> Pwsh["PowerShell"] --> Profile["Custom profile"]
  Check -- "Skip" --> Pwsh
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Generate version files from shared templates
  • ➕ Reduces duplication of launcher and profile logic across PowerShell versions.
  • ➖ Requires build-system changes and testing across existing bundles for a single-version release.

Recommendation: Keep the existing version-specific bundle approach for this release: it fits the current Gradle packaging flow and limits changes to older versions. Consider shared templates separately if launcher and profile changes must regularly be repeated across versions.

Files changed (8) +469 / -1

Enhancement (3) +376 / -0
Microsoft.PowerShell_profile.ps1Configure the enhanced PowerShell session +52/-0

Configure the enhanced PowerShell session

• Sets bundled module paths, initializes the Oh My Posh paradox theme, and imports Terminal-Icons. Configures PSReadLine history, colors, and keys, with an interactive-console banner.

bin/powershell7.6.8/config/Microsoft.PowerShell_profile.ps1

register-fonts.ps1Install and register bundled Nerd Fonts +152/-0

Install and register bundled Nerd Fonts

• Discovers font families, copies font files into the per-user font directory when needed, and registers them with Windows and Console Host. Reports installation failures and returns the selected font name to the launcher.

bin/powershell7.6.8/config/register-fonts.ps1

powershell.batLaunch PowerShell with console and font setup +172/-0

Launch PowerShell with console and font setup

• Adds a version-specific launcher that accepts title and starting-directory options, detects or registers a Nerd Font, and configures Windows console settings. Starts PowerShell with UTF-8 encoding and the bundled profile.

bin/powershell7.6.8/powershell.bat

Documentation (1) +67 / -0
README.mdDocument font setup and profile customization +67/-0

Document font setup and profile customization

• Explains Nerd Font configuration for Windows Terminal and Console Host, and describes the profile's features and customization points.

bin/powershell7.6.8/config/README.md

Other (4) +26 / -1
bearsampp.confDeclare PowerShell 7.6.8 bundle settings +9/-0

Declare PowerShell 7.6.8 bundle settings

• Defines the executable, launcher, profile, console dimensions, and CaskaydiaMono NF font for the new version. Includes the release-version placeholder used during packaging.

bin/powershell7.6.8/bearsampp.conf

deps.propertiesDeclare prompt and PowerShell module dependencies +16/-0

Declare prompt and PowerShell module dependencies

• Specifies download sources for Oh My Posh, its paradox theme, Terminal-Icons, and PSReadLine. Supplies the font family name used by the build.

bin/powershell7.6.8/deps.properties

CaskaydiaMonoNerdFont-Regular.ttfBundle CaskaydiaMono Nerd Font +0/-0

Bundle CaskaydiaMono Nerd Font

• Adds the font asset used for prompt glyphs and available to the build's bundled-font packaging path.

bin/powershell7.6.8/vendor/fonts/CaskaydiaMonoNerdFont-Regular.ttf

build.propertiesAdvance the bundle release date +1/-1

Advance the bundle release date

• Changes the release identifier from 2026.9.19 to 2026.10.23 for generated bundle artifacts.

build.properties

@qodo-code-review

qodo-code-review Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Nested launches omit the custom profile ✓ Resolved
Description
The BEARSAMPP_SHELL branch jumps to skip_registry_config before argument parsing and before
PS_CUSTOM_PROFILE, PS_START_DIR, and PS_WINDOW_TITLE are assigned. Launching this batch file
from a shell it previously started therefore ignores its arguments and builds a PowerShell command
containing Set-Location -LiteralPath ''; . ''.
Code

bin/powershell7.6.8/powershell.bat[33]

+if defined BEARSAMPP_SHELL goto skip_registry_config
Evidence
The launcher sets the marker for its spawned shell, while the early jump skips both the argument
parser and the assignments consumed by the final command.

bin/powershell7.6.8/powershell.bat[26-33]
bin/powershell7.6.8/powershell.bat[47-72]
bin/powershell7.6.8/powershell.bat[94-99]
bin/powershell7.6.8/powershell.bat[140-164]

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

## Issue description
A nested launch bypasses argument parsing and the assignments needed to build the PowerShell command.

## Fix Focus Areas
- bin/powershell7.6.8/powershell.bat[32-33]
- bin/powershell7.6.8/powershell.bat[94-99]
- bin/powershell7.6.8/powershell.bat[140-154]

## Recommended Fix
Parse arguments and prepare the PowerShell path variables on every invocation. Place the marker check immediately before the registry-only work, so it cannot skip launch preparation.

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



Remediation recommended

2. A failed font install appears successful later ✓ Resolved
Description
register-fonts.ps1 writes the font file and registry value before checking whether
AddFontResourceEx succeeds. If that call fails, the next launch sees the matching file and
registry value, skips the API call, and reports successful registration without retrying it.
Code

bin/powershell7.6.8/config/register-fonts.ps1[R100-103]

+                    Copy-Item -LiteralPath $fontFile -Destination $destFile -Force -ErrorAction Stop
+                    Set-ItemProperty -Path $regPath -Name $regValueName -Value $destFile -Force -ErrorAction Stop
+                    if ($gdi32::AddFontResourceEx($destFile, 0, [IntPtr]::Zero) -eq 0) {
+                        throw "AddFontResourceEx failed for font $internalName"
Evidence
The repeat-run test checks only the copied file and registry value, both of which are already
written before the API can fail.

bin/powershell7.6.8/config/register-fonts.ps1[79-109]
bin/powershell7.6.8/config/register-fonts.ps1[112-145]

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

## Issue description
A failed font API call leaves file and registry state that makes the next run skip registration.

## Fix Focus Areas
- bin/powershell7.6.8/config/register-fonts.ps1[79-109]
- bin/powershell7.6.8/config/register-fonts.ps1[112-145]

## Recommended Fix
Keep a failed installation eligible for retry, either by rolling back its registry value on failure or by invoking the registration API when an existing file and value do not establish that registration succeeded.

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


3. Apostrophes in paths prevent font setup ✓ Resolved
Description
The generated POWERSHELL_SCRIPT inserts FONTS_SRC, FONTS_DEST, and REGISTER_FONTS_PS1 into
PowerShell single-quoted strings without escaping apostrophes. An installation directory or user
profile path containing an apostrophe breaks the discovery command, leaving the bundled font
unregistered while the launcher continues.
Code

bin/powershell7.6.8/powershell.bat[88]

+set "POWERSHELL_SCRIPT=$fontName = '%FONT_NAME%'; if (-not (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name '*%FONT_NAME%*' -ErrorAction SilentlyContinue)) { $fallbacks = @('CaskaydiaMono NF', 'CaskaydiaCove NF', 'JetBrainsMono NF', 'MesloLGS NF', 'Cascadia Mono NF'); foreach ($f in $fallbacks) { if (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name '*$f*' -ErrorAction SilentlyContinue) { $fontName = $f; break } } }; if ('%FONTS_SRC%' -ne '' -and (Test-Path '%REGISTER_FONTS_PS1%')) { $captured = & '%PS_EXE%' -NoProfile -ExecutionPolicy Bypass -File '%REGISTER_FONTS_PS1%' '%FONTS_SRC%' '%FONTS_DEST%'; if ($LASTEXITCODE -eq 0 -and $captured -and $captured -notmatch 'WARNING:|ERROR:') { $fontName = $captured } }; $fontName"
Evidence
The source and script paths derive from the installation directory and the destination derives from
LOCALAPPDATA; all three are embedded as unescaped single-quoted PowerShell literals.

bin/powershell7.6.8/powershell.bat[12-14]
bin/powershell7.6.8/powershell.bat[77-90]

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

## Issue description
Font paths containing apostrophes break the generated PowerShell command.

## Fix Focus Areas
- bin/powershell7.6.8/powershell.bat[77-90]

## Recommended Fix
Pass the paths as arguments or environment variables rather than interpolating them into PowerShell string literals. Ensure paths containing apostrophes reach `register-fonts.ps1` unchanged.

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


4. A custom title executes shell commands ✓ Resolved
Description
The launcher interpolates WINDOW_TITLE into unquoted title commands, allowing command separators
in a --title value to be interpreted by cmd.exe. For example, --title "QA & Test" executes
Test as a separate command rather than setting that complete title.
Code

bin/powershell7.6.8/powershell.bat[117]

+    title %WINDOW_TITLE%
Evidence
The argument parser accepts the title verbatim, and multiple later title commands expand it
without quoting or escaping.

bin/powershell7.6.8/powershell.bat[47-54]
bin/powershell7.6.8/powershell.bat[106-123]
bin/powershell7.6.8/powershell.bat[137-157]

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

## Issue description
A caller-controlled title is expanded into `cmd.exe` commands without protecting command metacharacters.

## Fix Focus Areas
- bin/powershell7.6.8/powershell.bat[50-54]
- bin/powershell7.6.8/powershell.bat[116-117]
- bin/powershell7.6.8/powershell.bat[137-157]

## Recommended Fix
Validate or safely escape the title before using it in batch commands. Apply the same treatment to every `title` invocation and verify titles containing `&` remain a single title.

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


View medium (1)
5. Installed fallback fonts are overlooked ✓ Resolved
Description
The fallback query in POWERSHELL_SCRIPT passes '*$f*' as a single-quoted PowerShell string, so
it searches for the literal characters $f instead of the current font name. If the default font is
absent and font registration does not supply a replacement, an installed font from the fallback list
is not selected.
Code

bin/powershell7.6.8/powershell.bat[88]

+set "POWERSHELL_SCRIPT=$fontName = '%FONT_NAME%'; if (-not (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name '*%FONT_NAME%*' -ErrorAction SilentlyContinue)) { $fallbacks = @('CaskaydiaMono NF', 'CaskaydiaCove NF', 'JetBrainsMono NF', 'MesloLGS NF', 'Cascadia Mono NF'); foreach ($f in $fallbacks) { if (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name '*$f*' -ErrorAction SilentlyContinue) { $fontName = $f; break } } }; if ('%FONTS_SRC%' -ne '' -and (Test-Path '%REGISTER_FONTS_PS1%')) { $captured = & '%PS_EXE%' -NoProfile -ExecutionPolicy Bypass -File '%REGISTER_FONTS_PS1%' '%FONTS_SRC%' '%FONTS_DEST%'; if ($LASTEXITCODE -eq 0 -and $captured -and $captured -notmatch 'WARNING:|ERROR:') { $fontName = $captured } }; $fontName"
Evidence
The same expression iterates $f over fallback names but places it inside single quotes in the
registry query; replacement from the bundled font is conditional on successful registration.

bin/powershell7.6.8/powershell.bat[29-30]
bin/powershell7.6.8/powershell.bat[77-91]
bin/powershell7.6.8/config/register-fonts.ps1[112-118]

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 fallback registry lookup uses a literal `$f` pattern instead of the font being tested.

## Fix Focus Areas
- bin/powershell7.6.8/powershell.bat[88-88]

## Recommended Fix
Construct the fallback `-Name` pattern with an interpolated PowerShell string, and verify the selected name when only a non-default fallback font is installed.

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


Grey Divider

Context sources
Review mode: Auto: ⚖️ Balanced: Downgraded extended -> standard: change is below the extended eligibility bar (hunks 7/18, lines 470/200; both must reach the floor). Router rationale: Multiple independent PowerShell, batch, registry, font-installation, and packaging paths introduce dense subtle risks.

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread bin/powershell7.6.8/powershell.bat Resolved
Comment thread bin/powershell7.6.8/powershell.bat Resolved
Comment thread bin/powershell7.6.8/powershell.bat Resolved
Comment thread bin/powershell7.6.8/powershell.bat Resolved
N6REJ added 2 commits October 23, 2026 17:31
… error handling

- Use environment variables instead of string interpolation in PowerShell font discovery script to prevent parsing issues
- Add proper escaping for special characters in window title to prevent command injection
- Implement rollback mechanism in font installation on failure (remove copied file and registry entry)
- Move BEARSAMPP_SHELL check earlier to skip unnecessary registry configuration in sub-shells
@jwaisner
jwaisner merged commit 9b370ef into main Oct 23, 2026
2 checks passed
@jwaisner
jwaisner deleted the 7.6.8 branch October 23, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ Improve program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants