30 lines
874 B
Bash
Executable File
30 lines
874 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Startet claude für ein Projekt genau wie das eingebaute ai-control-Terminal:
|
|
# cwd = Projektordner (Registry ~/.config/ai-control/projects.json),
|
|
# CLAUDE_CONFIG_DIR = Pool-Ordner (Zuordnung in <projekt>/ai-control.json),
|
|
# Kommando aus ~/.config/ai-control/settings.json (claudeCommand, Default claude).
|
|
set -euo pipefail
|
|
|
|
project="$1"
|
|
config="$HOME/.config/ai-control"
|
|
|
|
dir=$(jq -r --arg p "$project" '.[$p] // empty' "$config/projects.json")
|
|
if [ -z "$dir" ]; then
|
|
echo "Projekt nicht registriert: $project" >&2
|
|
exit 1
|
|
fi
|
|
dir="${dir/#\~/$HOME}"
|
|
|
|
cmd=$(jq -r '.claudeCommand // "claude"' "$config/settings.json")
|
|
|
|
pool=""
|
|
if [ -f "$dir/ai-control.json" ]; then
|
|
pool=$(jq -r '.pool // empty' "$dir/ai-control.json")
|
|
fi
|
|
if [ -n "$pool" ]; then
|
|
export CLAUDE_CONFIG_DIR="$config/pools/$pool"
|
|
fi
|
|
|
|
cd "$dir"
|
|
exec "${SHELL:-/bin/bash}" -ic "$cmd"
|