resolvepath

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package resolvepath resolves user-supplied resource paths the way Pi's resolvePath does. It sits below internal/codingagent and coding/packagecontent so both share one implementation. Ports packages/coding-agent/src/utils/paths.ts:75-106.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(path string) (string, error)

Normalize applies Pi's default path normalization: a leading "~" or "~/" expands to the home directory and a file:// URL becomes its path through Node's fileURLToPath, whose errors it returns. An empty path stays empty.

func NormalizeWindowsShellPath

func NormalizeWindowsShellPath(filePath string) string

NormalizeWindowsShellPath converts a Git Bash, MSYS, Cygwin or WSL drive path to the form native Windows APIs accept.

upstream: utils/paths.ts normalizeWindowsShellPath

func Resolve

func Resolve(input, baseDir string) (string, error)

Resolve normalizes input and baseDir, then resolves the input to an absolute path. An empty baseDir uses the process working directory.

func ResolvePackagePath

func ResolvePackagePath(input, baseDir string) (string, error)

ResolvePackagePath uses the package manager's HOME || homedir() tilde expansion and trims the input, without changing normalization of baseDir. Ports packages/coding-agent/src/core/package-manager.ts:221-223,2145-2151.

func ResolveTrimmed

func ResolveTrimmed(input, baseDir string) (string, error)

ResolveTrimmed is Resolve after String.prototype.trim, the { trim: true } option Pi's resource loader and package manager pass.

func Trim

func Trim(input string) string

Trim applies String.prototype.trim, including BOM but excluding NEL.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL