Skip to content

state.json (and extensions dir) hardcoded under $XDG_CONFIG_HOME instead of $XDG_STATE_HOME #821

Closed

Description

@agraboso

What happened?

hunk stores its state file in $XDG_CONFIG_HOME/hunk/state.json right alongside its config file $XDG_CONFIG_HOME/hunk/config.toml.

Per the XDG Base Directory spec, $XDG_CONFIG_HOME is for user-editable configuration, while $XDG_STATE_HOME (defaulting to ~/.local/state) is for data that "should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME" — which, seems to me, describes state.json's contents exactly.

Steps to reproduce

Open $XDG_CONFIG_HOME/hunk and find state.json inside.

Expected behavior

state.jsonshould live in $XDG_STATE_HOME/hunk.

Version

0.19.0

Activity

  1. mikemikimike commented on Aug 30, 2026

    @mikemikimike
    Contributor

    I opened PR #920 to fix this. It separates Hunk user-editable configuration from persistent state: state.json, globally discovered extensions, and managed extension installs now use XDG_STATE_HOME (falling back to the home state directory), while config.toml remains under XDG_CONFIG_HOME. The change reuses the existing path-resolution and extension discovery/install flow and adds regression coverage for both explicit XDG variables and fallbacks. Focused tests, typecheck, lint, dependency-boundary checks, changed-file formatting, and diff checks pass locally.

  2. mikemikimike commented on Oct 4, 2026

    @mikemikimike
    Contributor

    PR #920 has been updated with the latest upstream main merge and the XDG state directory implementation: #920

    The focused regression suite passed (65 tests), as did typecheck, lint, dependency checks, and the repository-wide format check. The broader unit and PTY runs still report unrelated failures; the affected tests were reproduced against upstream main and are described in the PR body.

    For head bb82114, the GitHub Actions CI, Website, and Nix runs require workflow approval. The Vercel authorization check failed and its deployment check remains pending. This account has read-only permission on modem-dev/hunk and cannot approve those checks. Existing state and extension data under the old configuration directory are not migrated automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions