1jehuang / 1jehuang/jcode

Support XDG Base Directory Specification for config/data/cache paths

Open
#159 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement priority: medium triage: needs-decision
Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
30

Description

Summary

Jcode currently stores all user data under ~/.jcode, mixing configuration, runtime data, caches, and state in a single directory. This conflicts with the XDG Base Directory Specification which is widely adopted on Linux and increasingly respected on macOS.

Proposed Behavior

Respect XDG environment variables (with sensible defaults) to separate concerns:

Purpose XDG Variable Default (Linux) Default (macOS) Current
Config (config.toml) XDG_CONFIG_HOME ~/.config/jcode ~/Library/Application Support/jcode or ~/.config/jcode ~/.jcode/config.toml
Data (sessions, todos, auth) XDG_DATA_HOME ~/.local/share/jcode ~/.local/share/jcode ~/.jcode/
Cache (builds, logs) XDG_CACHE_HOME ~/.cache/jcode ~/Library/Caches/jcode ~/.jcode/
Runtime (PIDs, sockets) XDG_RUNTIME_DIR /run/user/$UID/jcode $TMPDIR/jcode ~/.jcode/

Migration

  • On first run with the new version, automatically migrate from ~/.jcode to the new locations (or provide a jcode migrate command).
  • Continue to respect ~/.jcode as a fallback if it exists and XDG dirs do not, for backward compatibility.
  • Optionally support JCODE_HOME as an override that preserves the single-directory layout.

Motivation

  • Keeps $HOME clean for users who care about dotfile hygiene.
  • Allows caches to be excluded from backups without excluding config.
  • Aligns with community expectations (see: similar issues in countless CLI tools).
  • Enables proper separation on multi-user or containerized systems.

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named in the issue. Start by locating the current ~/.jcode path handling and its config, data, cache, and runtime call sites, then review the XDG specification and platform defaults; done means separated paths, migration or fallback behavior, and optional JCODE_HOME support work without breaking existing users.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.