feat: added configurable base directory.#826
feat: added configurable base directory.#826mcking-07 wants to merge 8 commits intopingdotgg:mainfrom
Conversation
…` env and --base-dir flag.
…` env and --base-dir flag.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can disable poems in the walkthrough.Disable the |
There was a problem hiding this comment.
Pull request overview
Adds a configurable “base directory” for T3 Code data storage (~/.t3 by default), exposing it via T3CODE_BASE_DIR and a --base-dir CLI flag, and updates the server/dev-runner/test harnesses so state/worktrees paths become relative to this base.
Changes:
- Introduce
baseDirinto server config and CLI/env resolution with documented precedence (--base-dir>T3CODE_BASE_DIR> default). - Move worktree location under
<baseDir>/worktreesand make default state dir relative to base (<baseDir>/userdata). - Update dev-runner + extensive test layers/harnesses to pass and use
baseDir.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| turbo.json | Adds T3CODE_BASE_DIR to turbo global env passthrough. |
| scripts/dev-runner.ts | Adds base dir flag/env support and resolves derived dev state dir. |
| scripts/dev-runner.test.ts | Updates dev-runner env tests for new base dir behavior. |
| apps/server/src/wsServer.test.ts | Extends test server options to include baseDir. |
| apps/server/src/telemetry/Layers/AnalyticsService.test.ts | Updates test config layer to pass baseDir. |
| apps/server/src/provider/Layers/CodexAdapter.test.ts | Updates ServerConfig.layerTest calls for new signature. |
| apps/server/src/os-jank.ts | Adds resolveBaseDir + updates resolveStateDir to be base-dir aware. |
| apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts | Updates ServerConfig.layerTest calls for new signature. |
| apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts | Updates harness to manage temp base dirs and pass baseDir. |
| apps/server/src/orchestration/Layers/ProjectionPipeline.test.ts | Updates projection pipeline test layers to include baseDir and temp dir cleanup. |
| apps/server/src/orchestration/Layers/OrchestrationEngine.test.ts | Updates ServerConfig.layerTest calls for new signature. |
| apps/server/src/orchestration/Layers/CheckpointReactor.test.ts | Updates ServerConfig.layerTest calls for new signature. |
| apps/server/src/main.ts | Adds --base-dir + T3CODE_BASE_DIR env parsing and resolves base/state dirs with precedence. |
| apps/server/src/git/Layers/GitManager.test.ts | Provides ServerConfig layer to satisfy GitCore’s new dependency. |
| apps/server/src/git/Layers/GitCore.ts | Moves default worktrees directory under <baseDir>/worktrees. |
| apps/server/src/git/Layers/GitCore.test.ts | Provides ServerConfig layer for GitCore tests. |
| apps/server/src/git/Layers/CodexTextGeneration.test.ts | Updates test layer creation to pass baseDir/stateDir. |
| apps/server/src/config.ts | Adds baseDir to ServerConfigShape and updates layerTest signature. |
| apps/server/integration/OrchestrationEngineHarness.integration.ts | Updates integration harness to pass base dir into test config layer. |
| apps/desktop/src/main.ts | Derives desktop state dir from T3CODE_BASE_DIR and forwards it to backend env. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
i feel like we have too many flags already 😆, would be down to just have |
|
nice, much cleaner... let me confirm the plan, removing
introducing
quick question on naming... should I go with |
|
|
|
…and `--home-dir` flag.
|
@juliusmarminge, i have updated the PR to use the simplified approach we discussed: changes made:
behavior:
|
|
Can we update the pr title based on the current solution please |
~/.t3) with T3CODE_BASE_DIR env and --base-dir flag. Fixes #748~/.t3) with T3CODE_HOME env and --home-dir flag. Fixes #748
|
Lets change the title to: |
~/.t3) with T3CODE_HOME env and --home-dir flag. Fixes #748
What Changed
Added a configurable base directory for T3 Code data storage via:
T3CODE_BASE_DIRenvironment variable--base-dirCLI flagThe base directory defaults to
~/.t3, with the following paths now relative tobaseDir:userdata-> application state and SQLite databaseworktrees-> git worktree directories (existing, now uses baseDir)Path precedence:
baseDir: CLI (--base-dir) > env (T3CODE_BASE_DIR) > default (~/.t3)stateDir: CLI (--state-dir) > env (T3CODE_STATE_DIR) > default (<baseDir>/userdata)Note: If
stateDiris set explicitly (via CLI or env), it takes full priority and can be anywhere, independent ofbaseDir.Changes include:
baseDirtoServerConfigShaperesolveBaseDir()for base directory resolutionresolveStateDir()to acceptbaseDirparameter--base-dirflag to CLI (server + dev-runner)T3CODE_BASE_DIRenv var supportbaseDirWhy
Previously, all T3 Code data (worktrees, userdata, etc.) was hardcoded to
~/.t3. This change introducesT3CODE_BASE_DIR(--base-dirCLI flag) to allow users to customize the base directory.This enables:
~/.t3).t3folder in their home directory cough myself coughFixes #748
Checklist
Note
Replace
T3CODE_STATE_DIRwithT3CODE_HOMEas the configurable base directorybaseDirconcept (defaulting to~/.t3) that serves as the root from whichstateDiris derived as{baseDir}/userdata(or{baseDir}/devwhen a dev URL is set).--state-dirCLI flag with--home-dir(mapping toT3CODE_HOME) across both the server (main.ts) and dev-runner (dev-runner.ts).{baseDir}/worktrees/{repo}/{branch}instead of under the user home directory.resolveBaseDirto os-jank.ts and updatesresolveStateDirto acceptbaseDiras its first argument.T3CODE_STATE_DIRor--state-dirmust switch toT3CODE_HOME/--home-dir.Macroscope summarized 6de5527.