feat: Add --global flag to use ~/.claude settings directly#86
Open
ahmet-cetinkaya wants to merge 1 commit into
Open
feat: Add --global flag to use ~/.claude settings directly#86ahmet-cetinkaya wants to merge 1 commit into
ahmet-cetinkaya wants to merge 1 commit into
Conversation
Add support for running Claudebox in global mode instead of project-specific mode. When --global flag is used, the system: - Uses global configuration at ~/.claudebox/global/ - Mounts user's home directories directly instead of project slot directories - Provides a fixed container name for global sessions - Skips project-specific MCP configuration This allows users to maintain a single, persistent Claudebox environment across all projects, useful for development environments that need consistent configuration regardless of the specific project directory.
Reviewer's GuideIntroduces a new global mode via the --global flag to mount and manage a single ~/.claudebox configuration across projects, implemented by extending CLI parsing, project scripts, Docker mounts, config handlers, and main initialization while preserving existing project isolation. Sequence diagram for --global flag initialization and configuration setupsequenceDiagram
actor User
participant CLI as "CLI Parser (cli.sh)"
participant Main as "Main Script (main.sh)"
participant Project as "Project Logic (project.sh)"
participant Docker as "Docker Mounting (docker.sh)"
participant Config as "Config Handler (config.sh)"
User->>CLI: Run `claudebox --global`
CLI->>Main: Set GLOBAL_MODE=true
Main->>Project: use_global_mode() check
Project->>Project: init_global_mode()
Project->>Main: get_global_dir()
Main->>Docker: Prepare Docker args for global mode
Docker->>Docker: Mount ~/.claudebox, ~/.claude, ~/.config, ~/.cache
Docker->>Config: Use global profiles.ini
Config->>Config: get_profile_file_path() (global dir)
User->>CLI: Run profile commands (e.g. add, profiles)
CLI->>Config: get_current_profiles() (global dir)
Class diagram for new and modified functions supporting global modeclassDiagram
class CLI {
+process_host_flags()
HOST_ONLY_FLAGS: [--verbose, rebuild, --global]
}
class Main {
+main()
+PROJECT_PARENT_DIR
+PROJECT_SLOT_DIR
}
class Project {
+use_global_mode()
+init_global_mode()
+get_global_dir()
+get_global_container_name()
+should_use_slots()
+get_project_folder_name()
+get_image_name()
}
class Docker {
+run_claudebox_container()
+Mounting logic (global vs project)
}
class Config {
+get_profile_file_path()
+get_current_profiles()
}
CLI --> Main
Main --> Project
Main --> Docker
Docker --> Config
Project --> Docker
Project --> Config
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Author
|
I'm having a timeout issue with the Custom API URL, it's not ready for merge until it's resolved. |
|
No operation ID found for this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a new
--globalflag that allows ClaudeBox to use the user's global~/.claude/configuration directly instead of creating isolated project configurations.Problem
Previously, users had to manually copy their global configuration from
~/.claude/into each project's.claude/directory. This was inconvenient and not scalable for users who prefer a single, global setup.Solution
Added a
--globalflag that:~/.claude,~/.config,~/.cache)~/.claudebox/global/claudebox-globalDocker imageChanges Made
CLI Parser (
lib/cli.sh)--globaltoHOST_ONLY_FLAGSarrayGLOBAL_MODE=trueGlobal Mode Logic (
lib/project.sh)use_global_mode(),init_global_mode(),get_global_dir()functionsget_project_folder_name()to return "global" in global modeget_image_name()to return "claudebox-global" for global modeDocker Mounting (
lib/docker.sh)Configuration Handling (
lib/config.sh)Main Script Integration (
main.sh)Usage
Testing
✅ CLI parser correctly recognizes
--globalflag✅ Global mode creates separate
claudebox-globalDocker image✅ Configuration stored in
~/.claudebox/global/with proper symlinks✅ Profile management works in global mode
✅ Project mode continues to work without changes
✅ Complete separation between global and project configurations
✅ Docker mounting works correctly for both modes
Backward Compatibility
All existing functionality works exactly as before when the
--globalflag is not specified. No breaking changes.Resolves #85
Summary by Sourcery
Enable a new global mode via
--globalthat mounts and uses the user's home-based ClaudeBox configuration and cache directly, backed by a dedicated Docker image, while preserving the existing per-project isolation workflow by default.New Features:
--globalflag to enable using a single shared~/.claudeboxconfiguration across all projects~/.claudebox,~/.claude,~/.config,~/.cache) directly in global modeclaudebox-globalDocker image for global modeEnhancements:
--globalis not specified