Problem
The CLI's config directory is hardcoded to the real user home dir with no override, and the unit tests delete it. Running bun test destroys the developer's real Asana credentials.
Evidence
src/lib/config.ts:6 — const CONFIG_DIR = join(homedir(), '.asana-cli') — no environment override; always points at the real home directory.
test/lib/asana-client.test.ts:8 — const TEST_CONFIG_DIR = join(homedir(), '.asana-cli')
test/lib/asana-client.test.ts:18,29 — rmSync(TEST_CONFIG_DIR, { recursive: true, force: true }) in beforeEach/afterEach.
So the "test" config dir is the real config dir. Any bun test run wipes ~/.asana-cli/config.json, forcing the developer to re-authenticate (asana auth login). This was observed in practice while working on #43/#44/#45.
Impact
- Destroys real user/developer credentials on every local test run.
- Fragile in CI if
$HOME is shared or persisted.
- Tests are not isolated (violates FIRST principles in
dev-docs/TESTING.md).
Proposed fix
- Make the config directory overridable, e.g. honor
ASANA_CONFIG_DIR (fall back to join(homedir(), '.asana-cli')).
src/lib/config.ts: resolve CONFIG_DIR/CONFIG_FILE from process.env.ASANA_CONFIG_DIR ?? join(homedir(), '.asana-cli').
- Point the tests at an isolated temp dir instead of the real home:
test/lib/asana-client.test.ts: set ASANA_CONFIG_DIR (or HOME) to mkdtempSync(...) in setup, and only rmSync that temp dir.
- Add a guard/regression test asserting the resolved config dir is not the real home when the override is set.
Acceptance criteria
bun test never reads or deletes the real ~/.asana-cli.
ASANA_CONFIG_DIR (documented in skills/asana-cli/references/commands.md env-vars section) overrides the config location.
- Regression test covers the override path.
Problem
The CLI's config directory is hardcoded to the real user home dir with no override, and the unit tests delete it. Running
bun testdestroys the developer's real Asana credentials.Evidence
src/lib/config.ts:6—const CONFIG_DIR = join(homedir(), '.asana-cli')— no environment override; always points at the real home directory.test/lib/asana-client.test.ts:8—const TEST_CONFIG_DIR = join(homedir(), '.asana-cli')test/lib/asana-client.test.ts:18,29—rmSync(TEST_CONFIG_DIR, { recursive: true, force: true })inbeforeEach/afterEach.So the "test" config dir is the real config dir. Any
bun testrun wipes~/.asana-cli/config.json, forcing the developer to re-authenticate (asana auth login). This was observed in practice while working on #43/#44/#45.Impact
$HOMEis shared or persisted.dev-docs/TESTING.md).Proposed fix
ASANA_CONFIG_DIR(fall back tojoin(homedir(), '.asana-cli')).src/lib/config.ts: resolveCONFIG_DIR/CONFIG_FILEfromprocess.env.ASANA_CONFIG_DIR ?? join(homedir(), '.asana-cli').test/lib/asana-client.test.ts: setASANA_CONFIG_DIR(orHOME) tomkdtempSync(...)in setup, and onlyrmSyncthat temp dir.Acceptance criteria
bun testnever reads or deletes the real~/.asana-cli.ASANA_CONFIG_DIR(documented inskills/asana-cli/references/commands.mdenv-vars section) overrides the config location.