Repository navigation
Proposal: Fix cross-platform tilde expansion for Windows backslash paths in CLI installer (CLI-WIN-002) #2401
Closed
KatkamKoushik
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Context & Note
Problem Statement
During a CLI installer audit of
sickn33/agentic-awesome-skillsagainst upstreammainat commit12c0d66d3c007b8109edb0e7211812119be09d84(v20.11.0), passing a destination path with Windows backslashes (e.g.~\.gemini\antigravity) fails to expand the tilde prefix:Observed Behavior:
The path resolves to:
When evaluated under
--dry-run,resolveDirresolves the destination to a relative path prefixed with~in the current working directory. In a live installation without--dry-run, this unintended path resolution would target<cwd>\~for file writes rather than expanding to the user's home directory (C:\Users\<user>\.gemini\antigravity).Root Cause Analysis
In
tools/bin/install.js:23,resolveDirperforms tilde substitution using a forward-slash-only regex:On Windows CMD and PowerShell, backslash
\is standard. Whenpstarts with~\, the regex/^~($|\/)/does not match because the character following~is\rather than/or end-of-string. The unexpanded string~\...is then passed topath.resolve(), which treats~as a relative folder name in the current working directory.Proposed Minimal Patch
Modify
tools/bin/install.js:23to recognize both path separators:Validation & Test Evidence
1. Executed Windows Path Resolution Tests
We verified this patch across path variants on Windows:
~\.gemini\skills<cwd>\~\.gemini\skillsC:\Users\<user>\.gemini\skillsC:\Users\<user>\.gemini\skills~/.gemini/skillsC:\Users\<user>\.gemini\skillsC:\Users\<user>\.gemini\skillsC:\Users\<user>\.gemini\skills~(bare tilde)C:\Users\<user>C:\Users\<user>C:\Users\<user>relative/path<cwd>\relative\path<cwd>\relative\path<cwd>\relative\pathAdditionally, all 12 existing assertions in
tools/scripts/tests/installer_cli_args.test.jspass on Windows.2. Linux / POSIX Compatibility Analysis (Static & Spec Analysis)
On Linux/macOS,
path.sepis/.[\\/]matches/and substitutesHOME + "/", preserving identical behavior for POSIX paths (~/skills->/home/<user>/skills). Live Linux test execution was not performed in this session; this evaluation is based on standard Node path API specifications.3. Negative Regression & Boundary Tests
~otheruser/path): Not expanded (matches existing POSIX behavior, leaving~otheruseras a literal relative path).HOMEenvironment variable: Defaults to empty string""per line 14 (HOME = process.env.HOME || process.env.USERPROFILE || "").4. Remaining Test Gaps
\\server\share\~) remain unverified.Reason for Maintainer Sponsorship
Under
workflow-contract.jsand repository policy (CONTRIBUTING.md),tools/bin/**is classified as restricted installer tooling. External contributor fork pull requests cannot touch files intools/bin/.We respectfully submit this finding and minimal patch for maintainer review, and request an owner-sponsored PR through the documented intake process to land this fix into upstream
main.All reactions