-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·106 lines (89 loc) · 3.35 KB
/
setup.sh
File metadata and controls
executable file
·106 lines (89 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# Smithers Project Setup Script
# Creates project structure with Smithers-specific files in .smithers/ subfolder
set -e
PROJECT_NAME=${1:-"my-project"}
echo "🚀 Setting up Smithers project: $PROJECT_NAME"
# Create project directory
mkdir -p "$PROJECT_NAME"
cd "$PROJECT_NAME"
# Determine templates directory location (checked AFTER cd into project)
# Check local ../templates first, then global ~/.smithers/templates
TEMPLATES_DIR=""
LIB_DIR=""
if [[ -d "../templates" ]]; then
TEMPLATES_DIR="../templates"
LIB_DIR="../lib"
elif [[ -d "$HOME/.smithers/templates" ]]; then
TEMPLATES_DIR="$HOME/.smithers/templates"
LIB_DIR="$HOME/.smithers/lib"
else
echo "❌ Error: Templates directory not found."
echo " Expected at: ../templates or ~/.smithers/templates"
echo " Please run ./install.sh first to install Smithers globally."
exit 1
fi
# Verify required template files exist
if [[ ! -f "$TEMPLATES_DIR/PROMPT.md" ]]; then
echo "❌ Error: Required template file PROMPT.md not found in $TEMPLATES_DIR"
exit 1
fi
# Create structure:
# - src/ stays at root for compatibility with existing tooling
# - All Smithers-specific files go in .smithers/ subfolder
mkdir -p src
mkdir -p .smithers/{specs/stdlib,examples,logs,docs/generated,memory}
# Copy templates to .smithers/
cp "$TEMPLATES_DIR/PROMPT.md" .smithers/
cp "$TEMPLATES_DIR/fix_plan.md" .smithers/fix_plan.md
cp "$TEMPLATES_DIR/AGENT.md" .smithers/AGENT.md
cp -r "$TEMPLATES_DIR/specs"/* .smithers/specs/ 2>/dev/null || true
# Generate .smithersrc configuration file
# Source enable_core.sh if available for generate_smithersrc(), otherwise create inline
if [[ -f "$LIB_DIR/enable_core.sh" ]]; then
# Temporarily disable colors for cleaner output
export ENABLE_USE_COLORS=false
source "$LIB_DIR/enable_core.sh"
# Generate .smithersrc and fix the generator label (library says "smithers enable")
generate_smithersrc "$PROJECT_NAME" "generic" "local" | sed 's/Generated by: smithers enable/Generated by: smithers-setup/' > .smithersrc
else
# Fallback: create minimal .smithersrc inline (same content as generate_smithersrc)
cat > .smithersrc << SMITHERSRCEOF
# .smithersrc - Smithers project configuration
# Generated by: smithers-setup
# Documentation: https://github.com/dapdevsoftware/smithers
# Project identification
PROJECT_NAME="${PROJECT_NAME}"
PROJECT_TYPE="generic"
# Loop settings
MAX_CALLS_PER_HOUR=100
CLAUDE_TIMEOUT_MINUTES=15
CLAUDE_OUTPUT_FORMAT="json"
# Tool permissions
# Comma-separated list of allowed tools
ALLOWED_TOOLS="Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)"
# Session management
SESSION_CONTINUITY=true
SESSION_EXPIRY_HOURS=24
# Task sources (for smithers enable --sync)
# Options: local, beads, github (comma-separated for multiple)
TASK_SOURCES="local"
GITHUB_TASK_LABEL="smithers-task"
BEADS_FILTER="status:open"
# Circuit breaker thresholds
CB_NO_PROGRESS_THRESHOLD=3
CB_SAME_ERROR_THRESHOLD=5
CB_OUTPUT_DECLINE_THRESHOLD=70
SMITHERSRCEOF
fi
# Initialize git
git init
echo "# $PROJECT_NAME" > README.md
git add .
git commit -m "Initial Smithers project setup"
echo "✅ Project $PROJECT_NAME created!"
echo "Next steps:"
echo " 1. Edit .smithers/PROMPT.md with your project requirements"
echo " 2. Update .smithers/specs/ with your project specifications"
echo " 3. Run: ../smithers_loop.sh"
echo " 4. Monitor: ../smithers_monitor.sh"