hgxszhj/https-github.com-zhaoxuya520-reverse-skill / skills
reverse-skill-router
FlaggedRoutes reverse engineering, exploitation, penetration testing, malware, mobile, firmware, browser automation, documentation, and security tasks to the appropriate specialist skill. Use when a task spans modules or the correct reverse-skill entrypoint is unclear.
scripts/lib/HostRuntime.ps1
View on GitHubSet-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
# Resolves the PowerShell executable to use when a script must launch a child
# PowerShell process (e.g. to run another .ps1 in isolation with -NoProfile).
#
# Why not hard-code "powershell":
# - Modern Windows machines may install only PowerShell 7+ ("pwsh") and not
# ship Windows PowerShell 5.1 ("powershell.exe") on PATH.
# - Conversely, bare "powershell" resolves to 5.1, which mis-parses UTF-8
# scripts without BOM when nested from pwsh.
# Resolution order (highest confidence first):
# 1. Current process executable (the host that launched this script)
# 2. pwsh on PATH
# 3. powershell on PATH
# 4. %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe
# Returns the absolute path to the executable. Throws if nothing usable exists.
function Resolve-ReverseHostExe {
[CmdletBinding()]
[OutputType([string])]
param()
$hostExe = $null
try {
$procPath = (Get-Process -Id $PID -ErrorAction Stop).Path
if ($procPath -and (Test-Path -LiteralPath $procPath)) {
$hostExe = $procPath
}
} catch { }
if (-not $hostExe) {
$cmd = Get-Command pwsh -ErrorAction SilentlyContinue
if ($cmd -and $cmd.Source) {
$hostExe = $cmd.Source
}
}
if (-not $hostExe) {
$cmd = Get-Command powershell -ErrorAction SilentlyContinue
if ($cmd -and $cmd.Source) {
$hostExe = $cmd.Source
}
}
if (-not $hostExe -and $env:SystemRoot) {
$fallback = Join-Path $env:SystemRoot 'System32\WindowsPowerShell\v1.0\powershell.exe'
if (Test-Path -LiteralPath $fallback) {
$hostExe = $fallback
}
}
if (-not $hostExe) {
throw 'No usable PowerShell host executable found (tried current process, pwsh, powershell, Windows PowerShell fallback).'
}
return $hostExe
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |