Skip to content

Commit 603376d

Browse files
taylaandclaude
andcommitted
refactor: consolidate install scripts into single install.sh
Merged install-tools.sh into install.sh. One script handles everything: - ./scripts/install.sh full interactive install - ./scripts/install.sh --non-interactive for Ansible/CI (no prompts) - ./scripts/install.sh --tools-only just CLI tools globally - ./scripts/install.sh --agents-only just agent definitions Deleted scripts/install-tools.sh (functionality folded in). Updated README and setup-guide with new flags and Ansible playbook example. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dc24a78 commit 603376d

4 files changed

Lines changed: 97 additions & 57 deletions

File tree

‎README.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,17 @@ graph LR
103103
git clone https://github.com/NetDevAutomate/Socratic-Study-Mentor.git
104104
cd Socratic-Study-Mentor
105105
./scripts/install.sh
106+
```
107+
108+
This installs packages, registers CLI tools globally (`studyctl`, `session-export`, `session-sync`, etc.), sets up agent definitions for any detected AI tools, and optionally downloads the voice model for TTS support.
106109

107-
# Or install all CLI tools globally (studyctl, session-export, etc.)
108-
./scripts/install-tools.sh
110+
For Ansible or CI (no interactive prompts):
111+
112+
```bash
113+
./scripts/install.sh --non-interactive
109114
```
110115

111-
This installs both packages, sets up agent definitions for any detected AI tools, and optionally downloads the voice model for TTS support. The `install-tools.sh` script registers all workspace packages as global `uv` tools so they're available without activating a venv.
116+
Other modes: `--tools-only` (just CLI tools), `--agents-only` (just agent definitions).
112117

113118
Then run the interactive setup wizard:
114119

‎docs/setup-guide.md‎

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,38 @@ This will:
4646
git clone https://github.com/NetDevAutomate/Socratic-Study-Mentor.git
4747
cd Socratic-Study-Mentor
4848

49-
# Install both packages in the workspace
50-
uv sync
49+
# Full install (interactive — prompts for TTS voice model)
50+
./scripts/install.sh
51+
52+
# Full install without prompts (for Ansible/CI)
53+
./scripts/install.sh --non-interactive
5154

52-
# Install as global CLI tools (studyctl, session-export, etc.)
53-
./scripts/install-tools.sh
55+
# Just reinstall/upgrade CLI tools globally
56+
./scripts/install.sh --tools-only
5457

55-
# Reinstall / upgrade existing tools
56-
./scripts/install-tools.sh --force
58+
# Just reinstall agent definitions
59+
./scripts/install.sh --agents-only
5760

5861
# Install optional extras
5962
uv pip install studyctl[notebooklm]
6063
uv pip install agent-session-tools[semantic]
64+
```
6165

62-
# Install agents separately
63-
./scripts/install-agents.sh
66+
For **Ansible playbooks**, clone the repo then run the install script:
67+
68+
```yaml
69+
- name: Install Socratic Study Mentor
70+
hosts: study_machines
71+
tasks:
72+
- name: Clone repo
73+
git:
74+
repo: https://github.com/NetDevAutomate/Socratic-Study-Mentor.git
75+
dest: ~/code/personal/tools/Socratic-Study-Mentor
76+
77+
- name: Run installer
78+
command: ./scripts/install.sh --non-interactive
79+
args:
80+
chdir: ~/code/personal/tools/Socratic-Study-Mentor
6481
```
6582
6683
## Configuration

‎scripts/install-tools.sh‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

‎scripts/install.sh‎

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
#!/usr/bin/env bash
2-
# install.sh — Full installation of Socratic Study Mentor
2+
# install.sh — Install Socratic Study Mentor
33
#
44
# Usage:
5-
# ./scripts/install.sh
5+
# ./scripts/install.sh # Full install (interactive)
6+
# ./scripts/install.sh --non-interactive # Full install (no prompts — for Ansible/CI)
7+
# ./scripts/install.sh --tools-only # Just install CLI tools globally
8+
# ./scripts/install.sh --agents-only # Just install agent definitions
9+
#
10+
# After cloning the repo, this is the only script you need to run.
11+
# For Ansible: clone the repo, then run ./scripts/install.sh --non-interactive
612
set -euo pipefail
713

814
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; BOLD='\033[1m'; NC='\033[0m'
@@ -14,6 +20,37 @@ step() { printf "\n${BOLD}▸ %s${NC}\n" "$1"; }
1420
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
1521
REPO_DIR=$(dirname "$SCRIPT_DIR")
1622

23+
# --- Parse flags ---
24+
TOOLS_ONLY=false
25+
AGENTS_ONLY=false
26+
NON_INTERACTIVE=false
27+
28+
for arg in "$@"; do
29+
case "$arg" in
30+
--tools-only) TOOLS_ONLY=true ;;
31+
--agents-only) AGENTS_ONLY=true ;;
32+
--non-interactive) NON_INTERACTIVE=true ;;
33+
--help|-h)
34+
echo "Usage: ./scripts/install.sh [OPTIONS]"
35+
echo ""
36+
echo "Options:"
37+
echo " --non-interactive Skip all prompts (for Ansible/CI)"
38+
echo " --tools-only Only install CLI tools globally"
39+
echo " --agents-only Only install agent definitions"
40+
echo " -h, --help Show this help"
41+
exit 0
42+
;;
43+
*) err "Unknown option: $arg"; exit 1 ;;
44+
esac
45+
done
46+
47+
# --- Shortcut: agents only ---
48+
if $AGENTS_ONLY; then
49+
step "Installing agent definitions"
50+
bash "${SCRIPT_DIR}/install-agents.sh"
51+
exit 0
52+
fi
53+
1754
# --- Prerequisites ---
1855
step "Checking prerequisites"
1956

@@ -49,16 +86,30 @@ else
4986
fi
5087

5188
# --- Install packages ---
52-
step "Installing Python packages"
53-
cd "$REPO_DIR"
54-
uv sync
55-
info "Packages installed"
89+
if ! $TOOLS_ONLY; then
90+
step "Installing Python packages"
91+
cd "$REPO_DIR"
92+
uv sync
93+
info "Packages installed"
94+
fi
5695

5796
# --- Install CLI tools globally ---
58-
step "Installing CLI tools to ~/.local/bin"
59-
uv tool install --force --from "${REPO_DIR}/packages/agent-session-tools" agent-session-tools
60-
uv tool install --force --from "${REPO_DIR}/packages/studyctl" studyctl
61-
info "CLI tools installed (session-export, session-query, session-sync, session-maint, tutor-checkpoint, studyctl)"
97+
step "Installing CLI tools globally"
98+
for pkg in "${REPO_DIR}"/packages/*/; do
99+
pkg_name=$(basename "$pkg")
100+
uv tool install "$pkg" --editable --force 2>&1 | while read -r line; do
101+
echo " $line"
102+
done
103+
done
104+
info "CLI tools installed (studyctl, session-export, session-query, session-sync, session-maint, tutor-checkpoint, study-speak)"
105+
106+
# --- Shortcut: tools only ---
107+
if $TOOLS_ONLY; then
108+
echo ""
109+
printf "${BOLD}${GREEN}Tools installed!${NC}\n"
110+
uv tool list 2>/dev/null | grep -E "^(studyctl|agent-session-tools)" | sed 's/^/ /'
111+
exit 0
112+
fi
62113

63114
# --- Install agents ---
64115
step "Installing agent definitions"
@@ -95,7 +146,7 @@ EOF
95146
info "Topics template appended to ${CONFIG_FILE}"
96147
fi
97148
else
98-
if command -v studyctl &>/dev/null; then
149+
if command -v studyctl &>/dev/null && ! $NON_INTERACTIVE; then
99150
studyctl config init 2>/dev/null && info "Config created via studyctl" || true
100151
fi
101152
if [ ! -f "$CONFIG_FILE" ]; then
@@ -124,6 +175,8 @@ KOKORO_BASE="https://github.com/thewh1teagle/kokoro-onnx/releases/download/model
124175

125176
if [ -f "$KOKORO_MODEL" ] && [ -f "$KOKORO_VOICES" ]; then
126177
info "Voice model already downloaded"
178+
elif $NON_INTERACTIVE; then
179+
info "Skipped voice model download (non-interactive mode)"
127180
else
128181
echo ""
129182
printf "${BOLD}▸ Voice output (optional)${NC}\n"

0 commit comments

Comments
 (0)