Developer Guide
Verzeichnisstruktur
Section titled “Verzeichnisstruktur”Alle Collective Context Projekte befinden sich unter:
~/prog/ai/git/collective-context/├── ccc/ # CCC Commander├── collective-context.github.io/ # Website & Docs└── other-projects/ # Weitere CC ProjekteDevelopment Setup
Section titled “Development Setup”1. Workspace vorbereiten
Section titled “1. Workspace vorbereiten”# Basis-Verzeichnis erstellenmkdir -p ~/prog/ai/git/collective-contextcd ~/prog/ai/git/collective-context
# Repositories klonengit clone https://github.com/collective-context/ccc.gitgit clone https://github.com/collective-context/collective-context.github.io.git2. CCC Development Installation
Section titled “2. CCC Development Installation”cd ~/prog/ai/git/collective-context/ccc
# Virtual Environment (empfohlen)python3 -m venv venvsource venv/bin/activate
# Development Dependenciespip install -e ".[dev]"
# Tests ausführenpytestnpm test # für TypeScript Tests3. XDG-konforme Entwicklung
Section titled “3. XDG-konforme Entwicklung”CCC folgt der XDG Base Directory Specification:
import osfrom pathlib import Path
class CCCPaths: @property def data_home(self) -> Path: """XDG_DATA_HOME oder ~/.local/share/ccc""" xdg_data = os.environ.get('XDG_DATA_HOME') if xdg_data: return Path(xdg_data) / 'ccc' return Path.home() / '.local' / 'share' / 'ccc'
@property def config_home(self) -> Path: """XDG_CONFIG_HOME oder ~/.config/ccc""" xdg_config = os.environ.get('XDG_CONFIG_HOME') if xdg_config: return Path(xdg_config) / 'ccc' return Path.home() / '.config' / 'ccc'Development Workflow
Section titled “Development Workflow”Branch-Strategie
Section titled “Branch-Strategie”# Feature entwickelngit checkout -b feature/neue-funktion
# Regelmäßige Commitsgit add .git commit -m "feat: neue Funktion implementiert"
# Pull Request erstellengit push origin feature/neue-funktionTesting
Section titled “Testing”# Python Testspytest tests/pytest --cov=ccc tests/ # Mit Coverage
# TypeScript Testsnpm testnpm run test:coverage
# Integration Testspytest tests/integration/Code Quality
Section titled “Code Quality”# Lintingruff check .black .mypy ccc/
# Pre-commit Hooks (empfohlen)pre-commit installPackaging & Distribution
Section titled “Packaging & Distribution”Development Build
Section titled “Development Build”# Lokaler Buildpython -m build
# Test Installationpip install dist/cccmd-*.whlRelease Process
Section titled “Release Process”# Version bumpensed -i 's/version = "0.2.0"/version = "0.3.0"/' pyproject.toml
# Build für PyPIpython -m buildtwine check dist/*
# Upload zu TestPyPItwine upload --repository testpypi dist/*
# Upload zu PyPItwine upload dist/*XDG Standards Implementation
Section titled “XDG Standards Implementation”Verzeichnisse automatisch erstellen
Section titled “Verzeichnisse automatisch erstellen”def ensure_xdg_directories(): """Stelle sicher, dass alle XDG-Verzeichnisse existieren""" paths = CCCPaths()
# Erstelle benötigte Verzeichnisse paths.data_home.mkdir(parents=True, exist_ok=True) paths.config_home.mkdir(parents=True, exist_ok=True) (paths.data_home / "sessions").mkdir(exist_ok=True) (paths.data_home / "cache").mkdir(exist_ok=True)Migration Helper
Section titled “Migration Helper”def migrate_old_config(): """Migriere alte ~/.ccc Konfiguration zu XDG""" old_config = Path.home() / ".ccc" new_paths = CCCPaths()
if old_config.exists(): # Konfiguration migrieren if (old_config / "config.yaml").exists(): shutil.copy2(old_config / "config.yaml", new_paths.config_home / "config.json")
# Sessions migrieren if (old_config / "sessions").exists(): shutil.copytree(old_config / "sessions", new_paths.data_home / "sessions")Environment Setup für Developer
Section titled “Environment Setup für Developer”Development Environment Variables
Section titled “Development Environment Variables”# Development-spezifische Einstellungenexport CCC_ENV="development"export CCC_LOG_LEVEL="DEBUG"export CCC_CONFIG="./config-json/dev/config.json"
# Für Testingexport CCC_TEST_MODE="true"export CCC_DATA_HOME="./test-data"IDE Konfiguration
Section titled “IDE Konfiguration”VSCode (.vscode/settings.json)
Section titled “VSCode (.vscode/settings.json)”{ "python.defaultInterpreterPath": "./venv/bin/python", "python.linting.enabled": true, "python.linting.ruffEnabled": true, "python.formatting.provider": "black", "python.testing.pytestEnabled": true}Pre-commit Configuration (.pre-commit-config.yaml)
Section titled “Pre-commit Configuration (.pre-commit-config.yaml)”repos: - repo: https://github.com/psf/black rev: 23.9.1 hooks: - id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit rev: v0.1.0 hooks: - id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy rev: v1.6.1 hooks: - id: mypyDocumentation Development
Section titled “Documentation Development”Docs lokal entwickeln
Section titled “Docs lokal entwickeln”cd ~/prog/ai/git/collective-context/collective-context.github.io
# Dependencies installierennpm install
# Development Server startennpm run dev
# Build für Produktionnpm run buildMigration von alten Pfaden
Section titled “Migration von alten Pfaden”Entwickler die noch ~/prog/claude/git/ nutzen, sollten auf die neue Struktur wechseln:
# Die Migration wurde bereits durchgeführt# Arbeite jetzt in:cd ~/prog/ai/git/collective-context/Debugging & Troubleshooting
Section titled “Debugging & Troubleshooting”Common Issues
Section titled “Common Issues”# Python Path Problemsexport PYTHONPATH="${PYTHONPATH}:$(pwd)/lib"
# XDG Directory Creation Issuesmkdir -p ~/.local/share/ccc ~/.config/ccc ~/.cache/ccc
# Permission Problemschmod -R 755 ~/.local/share/cccchmod -R 700 ~/.config/cccDebug Utilities
Section titled “Debug Utilities”def debug_xdg_paths(): """Debug XDG Path Resolution""" paths = CCCPaths() print(f"Data Home: {paths.data_home}") print(f"Config Home: {paths.config_home}") print(f"Cache Home: {paths.cache_home}")