Add MPAK_HOME env var to make base directory configurable
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- cli
Research direction
Read cache.ts, config-manager.ts, and run.ts at the locations listed in the issue, then trace how cache, temporary, and config paths are built. Update the named tests in cache.test.ts, run.test.ts, config-manager.test.ts, and outdated.test.ts to cover the environment override and default path. Done when all listed paths use MPAK_HOME and the tests verify both behaviors.
Written by the indexing model from the issue text.
Description
Problem
The mpak base directory (~/.mpak/) is hardcoded. Runtimes like NimbleBrain that embed mpak want to co-locate bundle cache, config, and temp files under their own state tree (e.g., ~/.nimblebrain/apps/) rather than scattering state across two dotfile directories.
Currently users see:
~/.mpak/cache/ # bundle code
~/.mpak/config.json # bundle credentials
~/.mpak/tmp/ # download temp files
~/.nimblebrain/data/ # app data
With this change, NimbleBrain sets MPAK_HOME=~/.nimblebrain/apps and everything consolidates:
~/.nimblebrain/
├── apps/cache/ # bundle code (MPAK_HOME/cache)
├── apps/config.json # bundle credentials
├── data/{app}/ # app data (per-bundle MPAK_WORKSPACE)
Proposal
Add a MPAK_HOME environment variable that overrides the base ~/.mpak/ directory. All subdirectories (cache/, tmp/, config.json) remain relative to the base. Falls back to ~/.mpak/ when unset.
Implementation
Add a shared helper in cache.ts:
export function getMpakHome(): string {
return process.env.MPAK_HOME || join(homedir(), ".mpak");
}
Update 4 production code locations:
cache.ts:getCacheDir()(line 34) —join(getMpakHome(), "cache")instead ofjoin(homedir(), ".mpak", "cache")cache.ts:listCachedBundles()(line 119) — same changecache.ts:downloadAndExtract()(line 227) — temp path usesjoin(getMpakHome(), "tmp", ...)config-manager.ts:ConfigManagerconstructor (line 140) —this.configDir = getMpakHome()run.ts:getLocalCacheDir()(line 183) —join(getMpakHome(), "cache", "_local", hash)
Update tests in cache.test.ts, run.test.ts, config-manager.test.ts, outdated.test.ts to set/mock MPAK_HOME.
Behavior
MPAK_HOME |
Base directory |
|---|---|
| unset | ~/.mpak/ (unchanged, backwards compatible) |
/path/to/dir |
/path/to/dir/ |
Subdirectory layout under the base is unchanged: cache/, cache/_local/, tmp/, config.json.
Context
NimbleBrain recently moved to per-bundle data isolation (MPAK_WORKSPACE set per-bundle). This is the companion change on the code/cache side — letting the runtime own the full directory tree so users have one dotfile directory to reason about.
- Dominant language
- TypeScript
- Stars
- 14
- Forks
- 13
- Avg merge
- 16m
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
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.
More from NimbleBrainInc/mpak
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
NimbleBrainInc/mpak#180 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NimbleBrainInc/mpak#175 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
NimbleBrainInc/mpak#159 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
NimbleBrainInc/mpak#120 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
NimbleBrainInc/mpak#112 ·
All issues in NimbleBrainInc/mpak
Similar issues
-
bug documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Potential Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Comfy-Org/ComfyUI_frontend#23773 ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
lingdojo/kana-dojo#34301 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
github/gh-aw-firewall#11797 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
code-yeongyu/senpi#7007 ·
Maintainers usually reply within 1 day