fix(resolvers): stop env-var hosts from doubling $HOME in the binary fallback path

The browse/design/make-pdf setup resolvers built the fallback binary path as
"$HOME" + dir.replace(/^~/, ''), which is only correct for ~-rooted dirs.
Env-var hosts carry an absolute $GSTACK_* dir, so the generated fallback
became $HOME$GSTACK_.../browse — a path that never exists. New toShellPath()
in scripts/resolvers/types.ts expands ~ to $HOME and passes absolute
env-var dirs through untouched; all five call sites route through it.

Claude-host generated output is byte-identical, so no SKILL.md regeneration
is needed here.

Closes #2055.

Contributed by @simjak (PR #2056).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-14 20:20:58 -07:00
co-authored by Claude Fable 5
parent da6fd8bf25
commit dcdd28ce34
4 changed files with 18 additions and 8 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import type { TemplateContext } from './types';
import { type TemplateContext, toShellPath } from './types';
/**
* {{MAKE_PDF_SETUP}} — emits the shell preamble that resolves $P to the
@@ -19,7 +19,7 @@ _ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
P=""
[ -n "$MAKE_PDF_BIN" ] && [ -x "$MAKE_PDF_BIN" ] && P="$MAKE_PDF_BIN"
[ -z "$P" ] && [ -n "$_ROOT" ] && [ -x "$_ROOT/${ctx.paths.localSkillRoot}/make-pdf/dist/pdf" ] && P="$_ROOT/${ctx.paths.localSkillRoot}/make-pdf/dist/pdf"
[ -z "$P" ] && P="$HOME${ctx.paths.makePdfDir.replace(/^~/, '')}/pdf"
[ -z "$P" ] && P="${toShellPath(ctx.paths.makePdfDir)}/pdf"
if [ -x "$P" ]; then
echo "MAKE_PDF_READY: $P"
alias _p_="$P" # shellcheck alias helper (not exported)