fix(config): read Windows user-profile config#533
Conversation
Greptile SummaryThis PR fixes global config discovery on Windows by falling back to
Confidence Score: 5/5Safe to merge — the change is a one-line fallback that only activates when HOME is absent, with no effect on existing Linux/macOS behaviour. The fix is minimal and well-scoped: a single || operand in resolveUserConfigDir that is already exercised by two new tests covering both the raw path-resolution layer and the full config-loading pipeline. Existing tests are unaffected. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[resolveUserConfigDir] --> B{XDG_CONFIG_HOME set?}
B -- Yes --> C[return XDG_CONFIG_HOME]
B -- No --> D{HOME set?}
D -- Yes --> E[return HOME + /.config]
D -- No --> F{USERPROFILE set?}
F -- Yes --> G[return USERPROFILE + /.config]
F -- No --> H[return undefined]
C --> I[resolveGlobalConfigPath + /hunk/config.toml]
E --> I
G --> I
C --> J[resolveHunkStatePath + /hunk/state.json]
E --> J
G --> J
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[resolveUserConfigDir] --> B{XDG_CONFIG_HOME set?}
B -- Yes --> C[return XDG_CONFIG_HOME]
B -- No --> D{HOME set?}
D -- Yes --> E[return HOME + /.config]
D -- No --> F{USERPROFILE set?}
F -- Yes --> G[return USERPROFILE + /.config]
F -- No --> H[return undefined]
C --> I[resolveGlobalConfigPath + /hunk/config.toml]
E --> I
G --> I
C --> J[resolveHunkStatePath + /hunk/state.json]
E --> J
G --> J
Reviews (1): Last reviewed commit: "fix(config): resolve Windows user profil..." | Re-trigger Greptile |
Summary
USERPROFILEwhenHOMEis unavailable, preserving Hunk’s documented.config/hunk/config.tomllocation on WindowsCloses #522
Testing
bun test src/core/paths.test.ts src/core/config.test.tsbun run typecheckbun test(timed out after 120 seconds; all reported tests passed before timeout)This PR description was generated by Pi using GPT-5