Switch from `PathBuf` to `relative-path` crate for cross-platform configuration storage
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16
- Forks
- 3
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 121
Description
Replace PathBuf usage with the relative-path crate to ensure cross-platform compatibility for paths stored in configuration files and JSON files in .jp/.
Context
Currently, JP uses std::path::PathBuf throughout the codebase for handling paths, including those that are persisted in configuration files and JSON files stored in the .jp/ directory. This creates cross-platform compatibility issues because:
PathBufcan accidentally store absolute paths in configuration files, making them non-portable between different user environments- Platform-specific path separators (backslash on Windows, forward slash on Unix) can get persisted in configuration files
- Paths that work on one platform may fail on another when configuration files are shared
The relative-path crate (32M+ downloads) solves these issues by providing portable relative UTF-8 paths that use forward slashes regardless of platform and require explicit specification of what paths are relative to at runtime, preventing accidental absolute path storage.
Alternatives
We could continue using PathBuf and implement manual path normalization, but this would be error-prone and the relative-path crate already provides a well-tested solution. According to the crate's documentation, it was specifically designed to solve the portability issues that PathBuf creates when paths are stored in configuration files.
Tasks
- Add
relative-pathcrate dependency withserdefeature - Replace
config_load_pathsfield inConfigstruct to useRelativePathBuf - Modify configuration parsing to resolve relative paths at runtime using workspace root
- Update CLI path handling to convert between
PathBufandRelativePathBuf - Add migration logic for existing configuration files with absolute paths
- Update documentation with examples of relative path usage
- Test cross-platform compatibility with sample configuration files
Resources
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/jp_config/src/config.rs, then inspect path handling in crates/jp_mcp/src/transport.rs and crates/jp_cli/src/lib.rs. Trace how configuration and .jp/ JSON paths are parsed and passed to the CLI, including existing absolute-path data. Done means portable relative paths are serialized, resolved from the workspace root, migrated where needed, documented, and checked across platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100