Skip to content

Commit 2239649

Browse files
author
James Zhu
committed
fix: copy config.yaml to user directory during installation
Update installation process to copy config.yaml to user directory: Changes: - Modified install.sh setup_config() to copy config.yaml * Copies to ~/.config/code-assistant-manager/config.yaml * Only copies if file doesn't exist (no overwrite) * Informs user they can edit the file - Simplified repo_loader.py _load_config() * Removed runtime auto-copy logic * Simply tries user config first, fallback to bundled * Config copying now handled at install time - Added MANIFEST.in * Ensures config.yaml is included in package distribution * Includes all .json and .yaml files from package - Updated documentation * docs/multi-source-repos.md now mentions installation behavior Benefits: - User gets editable config.yaml at install time - No runtime copying/creation - Clear separation: install = setup, runtime = use - User can edit config before first use Testing: - Verified config.yaml is copied during installation - Verified existing config.yaml is not overwritten - Verified fallback to bundled config works
1 parent ad57a77 commit 2239649

4 files changed

Lines changed: 33 additions & 4 deletions

File tree

MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include README.md
2+
include LICENSE
3+
include INSTALL.md
4+
include requirements.txt
5+
recursive-include code_assistant_manager *.json
6+
recursive-include code_assistant_manager *.yaml
7+
recursive-include code_assistant_manager *.txt

code_assistant_manager/repo_loader.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ def __init__(self, config_dir: Optional[Path] = None):
4545
self.cache_enabled = cache_config.get("enabled", True)
4646

4747
def _load_config(self) -> Dict:
48-
"""Load config.yaml file."""
49-
# Try user config first
48+
"""Load config.yaml file.
49+
50+
Tries user config first, then falls back to bundled config.
51+
"""
5052
user_config_path = self.config_dir / "config.yaml"
51-
52-
# Try bundled config as fallback
5353
package_dir = Path(__file__).parent
5454
bundled_config_path = package_dir / "config.yaml"
5555

56+
# Try to load user config first, fallback to bundled
5657
config_path = user_config_path if user_config_path.exists() else bundled_config_path
5758

5859
if not config_path.exists():
@@ -62,6 +63,7 @@ def _load_config(self) -> Dict:
6263
try:
6364
with open(config_path, "r", encoding="utf-8") as f:
6465
config = yaml.safe_load(f)
66+
logger.debug(f"Loaded config from: {config_path}")
6567
return config or {}
6668
except Exception as e:
6769
logger.error(f"Failed to load config from {config_path}: {e}")

docs/multi-source-repos.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
Code Assistant Manager now supports loading repository configurations from multiple sources, allowing you to use both local custom repos and community-maintained remote repos.
44

5+
## Installation
6+
7+
When you install code-assistant-manager, the `config.yaml` file is automatically copied to:
8+
```
9+
~/.config/code-assistant-manager/config.yaml
10+
```
11+
12+
You can edit this file to customize repository sources, add your own remote sources, or disable sources you don't need.
13+
514
## How It Works
615

716
Repository configurations (for skills, agents, and plugins) are loaded from multiple sources in priority order:

install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,17 @@ setup_config() {
177177
pkg_dir=$(python3 -c "import code_assistant_manager; import os; print(os.path.dirname(code_assistant_manager.__file__))" 2>/dev/null || echo "")
178178
fi
179179

180+
# Copy config.yaml (multi-source repository configuration)
181+
if [ -n "$pkg_dir" ] && [ -f "$pkg_dir/config.yaml" ]; then
182+
if [ ! -f ~/.config/code-assistant-manager/config.yaml ]; then
183+
cp "$pkg_dir/config.yaml" ~/.config/code-assistant-manager/config.yaml
184+
print_success "Created config.yaml (multi-source repo configuration)"
185+
print_info " You can edit ~/.config/code-assistant-manager/config.yaml to customize sources"
186+
else
187+
print_info "config.yaml already exists, skipping"
188+
fi
189+
fi
190+
180191
if [ -n "$pkg_dir" ] && [ -f "$pkg_dir/providers.json" ]; then
181192
cp "$pkg_dir/providers.json" ~/.config/code-assistant-manager/providers.json
182193
print_success "Created providers.json"

0 commit comments

Comments
 (0)