@atlashub/smartstack-cli 1.11.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.documentation/agents.html +7 -2
- package/.documentation/apex.html +7 -2
- package/.documentation/business-analyse.html +7 -2
- package/.documentation/cli-commands.html +871 -0
- package/.documentation/commands.html +7 -2
- package/.documentation/efcore.html +7 -2
- package/.documentation/gitflow.html +7 -2
- package/.documentation/hooks.html +7 -2
- package/.documentation/index.html +7 -2
- package/.documentation/init.html +7 -2
- package/.documentation/installation.html +7 -2
- package/.documentation/ralph-loop.html +7 -2
- package/.documentation/test-web.html +7 -2
- package/dist/index.js +1932 -336
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
- package/templates/agents/efcore/squash.md +67 -31
- package/templates/agents/gitflow/finish.md +68 -56
- package/templates/commands/business-analyse/0-orchestrate.md +72 -556
- package/templates/commands/business-analyse/1-init.md +23 -193
- package/templates/commands/business-analyse/2-discover.md +85 -462
- package/templates/commands/business-analyse/3-analyse.md +40 -342
- package/templates/commands/business-analyse/4-specify.md +72 -537
- package/templates/commands/business-analyse/5-validate.md +43 -237
- package/templates/commands/business-analyse/6-handoff.md +93 -682
- package/templates/commands/business-analyse/7-doc-html.md +45 -544
- package/templates/commands/business-analyse/_shared.md +176 -0
- package/templates/commands/business-analyse/bug.md +50 -257
- package/templates/commands/business-analyse/change-request.md +59 -283
- package/templates/commands/business-analyse/hotfix.md +36 -120
- package/templates/commands/business-analyse.md +55 -574
- package/templates/commands/efcore/_shared.md +206 -0
- package/templates/commands/efcore/conflicts.md +39 -201
- package/templates/commands/efcore/db-deploy.md +28 -237
- package/templates/commands/efcore/db-reset.md +41 -390
- package/templates/commands/efcore/db-seed.md +44 -323
- package/templates/commands/efcore/db-status.md +31 -210
- package/templates/commands/efcore/migration.md +45 -368
- package/templates/commands/efcore/rebase-snapshot.md +38 -241
- package/templates/commands/efcore/scan.md +35 -204
- package/templates/commands/efcore/squash.md +158 -251
- package/templates/commands/efcore.md +49 -177
- package/templates/commands/gitflow/1-init.md +94 -1318
- package/templates/commands/gitflow/10-start.md +86 -990
- package/templates/commands/gitflow/11-finish.md +264 -454
- package/templates/commands/gitflow/12-cleanup.md +40 -213
- package/templates/commands/gitflow/2-status.md +51 -386
- package/templates/commands/gitflow/3-commit.md +108 -801
- package/templates/commands/gitflow/4-plan.md +42 -13
- package/templates/commands/gitflow/5-exec.md +60 -5
- package/templates/commands/gitflow/6-abort.md +54 -277
- package/templates/commands/gitflow/7-pull-request.md +74 -717
- package/templates/commands/gitflow/8-review.md +51 -178
- package/templates/commands/gitflow/9-merge.md +74 -404
- package/templates/commands/gitflow/_shared.md +196 -0
- package/templates/commands/quickstart.md +154 -0
- package/templates/commands/ralph-loop/ralph-loop.md +104 -2
- package/templates/hooks/hooks.json +13 -0
- package/templates/hooks/ralph-mcp-logger.sh +46 -0
- package/templates/hooks/ralph-session-end.sh +69 -0
- package/templates/ralph/README.md +91 -0
- package/templates/ralph/ralph.config.yaml +113 -0
- package/templates/scripts/setup-ralph-loop.sh +173 -0
- package/templates/skills/_shared.md +117 -0
- package/templates/skills/ai-prompt/SKILL.md +87 -654
- package/templates/skills/application/SKILL.md +76 -499
- package/templates/skills/controller/SKILL.md +38 -165
- package/templates/skills/documentation/SKILL.md +2 -1
- package/templates/skills/feature-full/SKILL.md +107 -732
- package/templates/skills/notification/SKILL.md +85 -474
- package/templates/skills/ui-components/SKILL.md +62 -762
- package/templates/skills/workflow/SKILL.md +85 -489
- package/templates/commands/gitflow/rescue.md +0 -867
- package/templates/skills/business-analyse/SKILL.md +0 -191
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# GitFlow - Fonctions Partagées
|
|
2
|
+
|
|
3
|
+
> **Usage:** Ce fichier contient les fonctions réutilisables. Référencer avec `{{REF:section_name}}` dans les autres fichiers.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## DETECT_PROVIDER
|
|
8
|
+
|
|
9
|
+
Détecte GitHub ou Azure DevOps depuis le remote.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
detect_git_provider() {
|
|
13
|
+
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
|
|
14
|
+
|
|
15
|
+
if [[ "$REMOTE_URL" == *"dev.azure.com"* ]] || [[ "$REMOTE_URL" == *"visualstudio.com"* ]]; then
|
|
16
|
+
GIT_PROVIDER="azuredevops"
|
|
17
|
+
[[ "$REMOTE_URL" =~ dev\.azure\.com/([^/]+)/([^/]+)/_git/([^/]+) ]] && {
|
|
18
|
+
AZURE_ORG="${BASH_REMATCH[1]}"
|
|
19
|
+
AZURE_PROJECT="${BASH_REMATCH[2]}"
|
|
20
|
+
AZURE_REPO="${BASH_REMATCH[3]}"
|
|
21
|
+
}
|
|
22
|
+
elif [[ "$REMOTE_URL" == *"github.com"* ]]; then
|
|
23
|
+
GIT_PROVIDER="github"
|
|
24
|
+
else
|
|
25
|
+
GIT_PROVIDER="unknown"
|
|
26
|
+
fi
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## NORMALIZE_NAME
|
|
33
|
+
|
|
34
|
+
Normalise un nom de branche (accents, espaces, caractères spéciaux).
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
normalize_branch_name() {
|
|
38
|
+
local input="$1" max_length="${2:-50}"
|
|
39
|
+
echo "$input" | tr '[:upper:]' '[:lower:]' | \
|
|
40
|
+
sed 'y/àâäéèêëïîôùûüçœæ/aaaeeeeiioouucoa/' | \
|
|
41
|
+
sed "s/[ _']/-/g" | sed 's/[^a-z0-9-]//g' | \
|
|
42
|
+
sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-$max_length | sed 's/-$//'
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## DETECT_WORKTREE_MODE
|
|
49
|
+
|
|
50
|
+
Détecte le mode worktree (organized, adjacent, none).
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
detect_worktree_mode() {
|
|
54
|
+
if [ -d "../features" ] && [ -d "../releases" ] && [ -d "../hotfixes" ]; then
|
|
55
|
+
WORKTREE_MODE="organized"
|
|
56
|
+
elif [ -d "../01-Main" ] && [ -d "../02-Develop" ]; then
|
|
57
|
+
WORKTREE_MODE="organized"
|
|
58
|
+
elif [ -d "../worktrees" ]; then
|
|
59
|
+
WORKTREE_MODE="adjacent"
|
|
60
|
+
else
|
|
61
|
+
CONFIG_FILE=".claude/gitflow/config.json"
|
|
62
|
+
[ -f "$CONFIG_FILE" ] && WORKTREE_MODE=$(grep -oP '"mode":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
|
|
63
|
+
WORKTREE_MODE=${WORKTREE_MODE:-adjacent}
|
|
64
|
+
fi
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## CLEANUP_WORKTREE
|
|
71
|
+
|
|
72
|
+
Nettoie un worktree pour une branche donnée.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cleanup_worktree_for_branch() {
|
|
76
|
+
local BRANCH=$1 WORKTREE_BASE="../worktrees" WORKTREE_PATH=""
|
|
77
|
+
|
|
78
|
+
case "$BRANCH" in
|
|
79
|
+
feature/*) WORKTREE_PATH="$WORKTREE_BASE/features/${BRANCH#feature/}" ;;
|
|
80
|
+
release/*) WORKTREE_PATH="$WORKTREE_BASE/releases/${BRANCH#release/}" ;;
|
|
81
|
+
hotfix/*) WORKTREE_PATH="$WORKTREE_BASE/hotfixes/${BRANCH#hotfix/}" ;;
|
|
82
|
+
esac
|
|
83
|
+
|
|
84
|
+
# Mode organized
|
|
85
|
+
[ -d "../features" ] && case "$BRANCH" in
|
|
86
|
+
feature/*) WORKTREE_PATH="../features/${BRANCH#feature/}" ;;
|
|
87
|
+
release/*) WORKTREE_PATH="../releases/${BRANCH#release/}" ;;
|
|
88
|
+
hotfix/*) WORKTREE_PATH="../hotfixes/${BRANCH#hotfix/}" ;;
|
|
89
|
+
esac
|
|
90
|
+
|
|
91
|
+
[ -d "$WORKTREE_PATH" ] && {
|
|
92
|
+
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || rm -rf "$WORKTREE_PATH"
|
|
93
|
+
git worktree prune
|
|
94
|
+
echo "✓ Worktree nettoyé: $WORKTREE_PATH"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## SYNC_REMOTE
|
|
102
|
+
|
|
103
|
+
Synchronise avec le remote et affiche l'état.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
sync_with_remote() {
|
|
107
|
+
git fetch --all --quiet
|
|
108
|
+
local BRANCH=$(git branch --show-current)
|
|
109
|
+
local AHEAD=$(git rev-list --count origin/$BRANCH..HEAD 2>/dev/null || echo "0")
|
|
110
|
+
local BEHIND=$(git rev-list --count HEAD..origin/$BRANCH 2>/dev/null || echo "0")
|
|
111
|
+
|
|
112
|
+
[ "$BEHIND" -gt 0 ] && echo "⚠️ $BRANCH: $BEHIND commit(s) en retard"
|
|
113
|
+
[ "$AHEAD" -gt 0 ] && echo "ℹ️ $BRANCH: $AHEAD commit(s) non poussé(s)"
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## READ_GITFLOW_CONFIG
|
|
120
|
+
|
|
121
|
+
Lit la configuration GitFlow.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
read_gitflow_config() {
|
|
125
|
+
local CONFIG_FILE=".claude/gitflow/config.json"
|
|
126
|
+
[ ! -f "$CONFIG_FILE" ] && return 1
|
|
127
|
+
|
|
128
|
+
# Variables exportées
|
|
129
|
+
GF_LANG=$(grep -oP '"code":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
|
|
130
|
+
GF_WORKTREE_MODE=$(grep -oP '"mode":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
|
|
131
|
+
GF_MAIN_BRANCH=$(grep -oP '"main":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
|
|
132
|
+
GF_DEVELOP_BRANCH=$(grep -oP '"develop":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
|
|
133
|
+
|
|
134
|
+
GF_LANG=${GF_LANG:-en}
|
|
135
|
+
GF_WORKTREE_MODE=${GF_WORKTREE_MODE:-adjacent}
|
|
136
|
+
GF_MAIN_BRANCH=${GF_MAIN_BRANCH:-main}
|
|
137
|
+
GF_DEVELOP_BRANCH=${GF_DEVELOP_BRANCH:-develop}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## CONFIG_TEMPLATE
|
|
144
|
+
|
|
145
|
+
Template JSON de configuration GitFlow (version minimale).
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"version": "1.3.0",
|
|
150
|
+
"branches": { "main": "main", "develop": "develop" },
|
|
151
|
+
"prefixes": { "feature": "feature/", "release": "release/", "hotfix": "hotfix/" },
|
|
152
|
+
"worktrees": { "mode": "organized" },
|
|
153
|
+
"language": { "code": "fr" }
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Options worktrees.mode:**
|
|
158
|
+
- `organized`: `../features/`, `../releases/`, `../hotfixes/`
|
|
159
|
+
- `adjacent`: `../worktrees/{type}/`
|
|
160
|
+
- `disabled`: Pas de worktrees
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## PR_COMMANDS
|
|
165
|
+
|
|
166
|
+
Commandes PR par provider.
|
|
167
|
+
|
|
168
|
+
### GitHub
|
|
169
|
+
```bash
|
|
170
|
+
gh pr create --title "$TITLE" --body "$BODY" --base "$BASE"
|
|
171
|
+
gh pr view $NUMBER --json state,mergeable,reviews
|
|
172
|
+
gh pr merge $NUMBER --squash --delete-branch
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Azure DevOps
|
|
176
|
+
```bash
|
|
177
|
+
az repos pr create --title "$TITLE" --description "$BODY" --source-branch "$SOURCE" --target-branch "$BASE"
|
|
178
|
+
az repos pr show --id $NUMBER --query "{status:status,mergeStatus:mergeStatus}"
|
|
179
|
+
az repos pr update --id $NUMBER --status completed --squash true --delete-source-branch true
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## OUTPUT_FORMAT
|
|
185
|
+
|
|
186
|
+
Format de sortie standard (remplace ASCII art).
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
output_header() { echo -e "\n## $1\n"; }
|
|
190
|
+
output_section() { echo "### $1"; }
|
|
191
|
+
output_item() { echo "- $1"; }
|
|
192
|
+
output_success() { echo "✓ $1"; }
|
|
193
|
+
output_warning() { echo "⚠️ $1"; }
|
|
194
|
+
output_error() { echo "❌ $1"; }
|
|
195
|
+
output_next() { echo "→ Prochain: $1"; }
|
|
196
|
+
```
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Quick start guide for SmartStack CLI"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# SmartStack Quick Start Guide
|
|
6
|
+
|
|
7
|
+
## Installation (3 steps)
|
|
8
|
+
|
|
9
|
+
### Step 1: Install SmartStack CLI
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @atlashub/smartstack-cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Step 2: Activate License
|
|
15
|
+
```bash
|
|
16
|
+
smartstack license activate <your-license-key>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Step 3: Install Templates
|
|
20
|
+
```bash
|
|
21
|
+
smartstack install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Verify Setup
|
|
25
|
+
|
|
26
|
+
Run the doctor command to verify everything is configured:
|
|
27
|
+
```bash
|
|
28
|
+
smartstack doctor
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Expected output:
|
|
32
|
+
```
|
|
33
|
+
✓ License valid
|
|
34
|
+
✓ Node.js v20.x.x
|
|
35
|
+
✓ Claude Code CLI installed
|
|
36
|
+
✓ MCP: context7 available
|
|
37
|
+
✓ MCP: smartstack available
|
|
38
|
+
✓ SmartStack Commands installed
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## MCP Servers
|
|
42
|
+
|
|
43
|
+
SmartStack requires two MCP servers for full functionality:
|
|
44
|
+
|
|
45
|
+
### Check MCP Status
|
|
46
|
+
```bash
|
|
47
|
+
smartstack check-mcp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Install Missing MCPs
|
|
51
|
+
```bash
|
|
52
|
+
smartstack check-mcp --install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or manually:
|
|
56
|
+
```bash
|
|
57
|
+
claude mcp add context7
|
|
58
|
+
claude mcp add smartstack
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Create Your First Project
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Create a new SmartStack project
|
|
65
|
+
smartstack init MyProject
|
|
66
|
+
|
|
67
|
+
# Navigate to the project
|
|
68
|
+
cd MyProject
|
|
69
|
+
|
|
70
|
+
# Start backend
|
|
71
|
+
dotnet run --project src/MyProject.Api
|
|
72
|
+
|
|
73
|
+
# Start frontend (in another terminal)
|
|
74
|
+
cd web/myproject-web
|
|
75
|
+
npm install
|
|
76
|
+
npm run dev
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Ralph Automation
|
|
80
|
+
|
|
81
|
+
Ralph Weegund is an AI-powered iterative development loop.
|
|
82
|
+
|
|
83
|
+
### Setup Ralph
|
|
84
|
+
```bash
|
|
85
|
+
# Verify Ralph prerequisites
|
|
86
|
+
smartstack ralph start
|
|
87
|
+
|
|
88
|
+
# Initialize Ralph in your project (if not done by init)
|
|
89
|
+
smartstack ralph init
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Use Ralph in Claude Code
|
|
93
|
+
```
|
|
94
|
+
/ralph-loop "Implement user authentication with JWT"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Monitor Ralph
|
|
98
|
+
```bash
|
|
99
|
+
# Check status
|
|
100
|
+
smartstack ralph status
|
|
101
|
+
|
|
102
|
+
# View logs
|
|
103
|
+
smartstack ralph logs
|
|
104
|
+
|
|
105
|
+
# View reports
|
|
106
|
+
smartstack ralph report --list
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Common Commands
|
|
110
|
+
|
|
111
|
+
| Command | Description |
|
|
112
|
+
|---------|-------------|
|
|
113
|
+
| `smartstack doctor` | Full system diagnostic |
|
|
114
|
+
| `smartstack check-mcp` | Verify MCP servers |
|
|
115
|
+
| `smartstack status` | Show installation status |
|
|
116
|
+
| `smartstack ralph start` | Prepare Ralph for use |
|
|
117
|
+
| `/gitflow` | GitFlow workflow |
|
|
118
|
+
| `/apex` | APEX methodology |
|
|
119
|
+
| `/ralph-loop` | Start automation loop |
|
|
120
|
+
|
|
121
|
+
## Troubleshooting
|
|
122
|
+
|
|
123
|
+
### "License required" error
|
|
124
|
+
```bash
|
|
125
|
+
smartstack license activate <key>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### "MCP server not found"
|
|
129
|
+
```bash
|
|
130
|
+
smartstack check-mcp --install
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### "Ralph not configured"
|
|
134
|
+
```bash
|
|
135
|
+
smartstack ralph init
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Full diagnostic
|
|
139
|
+
```bash
|
|
140
|
+
smartstack doctor --verbose
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Next Steps
|
|
144
|
+
|
|
145
|
+
1. **Explore Commands**: `smartstack docs commands`
|
|
146
|
+
2. **Learn GitFlow**: `smartstack docs gitflow`
|
|
147
|
+
3. **Try APEX**: `/apex "Build a feature"`
|
|
148
|
+
4. **Use Ralph**: `/ralph-loop "Your task"`
|
|
149
|
+
|
|
150
|
+
## Resources
|
|
151
|
+
|
|
152
|
+
- Documentation: https://docs.smartstack.app
|
|
153
|
+
- Support: https://github.com/atlashub/smartstack-cli/issues
|
|
154
|
+
- Website: https://smartstack.app
|
|
@@ -13,6 +13,108 @@ Execute the setup script to initialize the Ralph loop:
|
|
|
13
13
|
"${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## RALPH WEEGUND - AUTOMATED DEVELOPMENT LOOP
|
|
19
|
+
|
|
20
|
+
You are now operating in **Ralph Weegund** mode - an iterative AI development loop for SmartStack projects.
|
|
21
|
+
|
|
22
|
+
### MANDATORY MCP VALIDATION
|
|
23
|
+
|
|
24
|
+
**BEFORE STARTING ANY WORK**, you MUST verify MCP servers are available:
|
|
25
|
+
|
|
26
|
+
1. **Check context7 MCP**: Use `mcp__plugin_context7_context7__resolve-library-id` to verify connectivity
|
|
27
|
+
2. **Check smartstack MCP**: Use `mcp__smartstack__validate_conventions` with a simple check
|
|
28
|
+
|
|
29
|
+
**IF ANY MCP SERVER IS UNAVAILABLE:**
|
|
30
|
+
- DO NOT proceed with the task
|
|
31
|
+
- Log the failure to `.ralph/logs/`
|
|
32
|
+
- Output a clear error message explaining which MCP is down
|
|
33
|
+
- Suggest running `smartstack check-mcp` to diagnose
|
|
34
|
+
|
|
35
|
+
### STRICT MCP USAGE REQUIREMENTS
|
|
36
|
+
|
|
37
|
+
Throughout your work, you MUST:
|
|
38
|
+
|
|
39
|
+
1. **Use SmartStack MCP for all validations**:
|
|
40
|
+
- `mcp__smartstack__validate_conventions` - Before any commit
|
|
41
|
+
- `mcp__smartstack__check_migrations` - Before any EF Core changes
|
|
42
|
+
- `mcp__smartstack__scaffold_extension` - For code generation
|
|
43
|
+
- `mcp__smartstack__api_docs` - For API documentation
|
|
44
|
+
|
|
45
|
+
2. **Use Context7 MCP for documentation**:
|
|
46
|
+
- `mcp__plugin_context7_context7__resolve-library-id` - Find library docs
|
|
47
|
+
- `mcp__plugin_context7_context7__query-docs` - Query specific documentation
|
|
48
|
+
|
|
49
|
+
3. **Track all MCP calls** by logging them mentally for the final report
|
|
50
|
+
|
|
51
|
+
### LOGGING PROTOCOL
|
|
52
|
+
|
|
53
|
+
For each significant action, maintain an internal log:
|
|
54
|
+
- MCP tool calls (which tool, parameters, success/failure)
|
|
55
|
+
- Files created/modified
|
|
56
|
+
- Validations performed
|
|
57
|
+
- Errors encountered
|
|
58
|
+
|
|
59
|
+
### ITERATION BEHAVIOR
|
|
60
|
+
|
|
61
|
+
When you try to exit, the Ralph loop will feed the SAME PROMPT back to you for the next iteration. You'll see your previous work in files and git history, allowing you to iterate and improve.
|
|
62
|
+
|
|
63
|
+
**CRITICAL RULE**: If a completion promise is set, you may ONLY output it when the statement is completely and unequivocally TRUE. Do not output false promises to escape the loop, even if you think you're stuck or should exit for other reasons. The loop is designed to continue until genuine completion.
|
|
64
|
+
|
|
65
|
+
### COMPLETION REPORT
|
|
66
|
+
|
|
67
|
+
When the task is GENUINELY COMPLETE, generate a feature report in `.ralph/reports/`:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
# Feature Report: [Feature Name]
|
|
71
|
+
|
|
72
|
+
## Summary
|
|
73
|
+
- **Date**: YYYY-MM-DD HH:MM
|
|
74
|
+
- **Duration**: X iterations
|
|
75
|
+
- **Status**: COMPLETE
|
|
76
|
+
|
|
77
|
+
## MCP Usage Statistics
|
|
78
|
+
| Tool | Calls | Success | Failures |
|
|
79
|
+
|------|-------|---------|----------|
|
|
80
|
+
| validate_conventions | X | X | 0 |
|
|
81
|
+
| check_migrations | X | X | 0 |
|
|
82
|
+
| scaffold_extension | X | X | 0 |
|
|
83
|
+
| context7 query-docs | X | X | 0 |
|
|
84
|
+
|
|
85
|
+
## Files Created
|
|
86
|
+
- path/to/file1.cs
|
|
87
|
+
- path/to/file2.tsx
|
|
88
|
+
|
|
89
|
+
## Files Modified
|
|
90
|
+
- path/to/existing1.cs
|
|
91
|
+
- path/to/existing2.ts
|
|
92
|
+
|
|
93
|
+
## Validations Performed
|
|
94
|
+
- [ ] SmartStack conventions validated
|
|
95
|
+
- [ ] EF Core migrations checked
|
|
96
|
+
- [ ] No conflicts detected
|
|
97
|
+
|
|
98
|
+
## Notes
|
|
99
|
+
Any relevant observations about the implementation.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### ERROR HANDLING
|
|
103
|
+
|
|
104
|
+
If you encounter an error:
|
|
105
|
+
1. Log the error details
|
|
106
|
+
2. Attempt recovery if possible
|
|
107
|
+
3. If MCP server fails mid-task:
|
|
108
|
+
- Save current progress
|
|
109
|
+
- Log the MCP failure
|
|
110
|
+
- DO NOT continue without MCP
|
|
111
|
+
- Request manual intervention
|
|
112
|
+
|
|
113
|
+
### COMMANDS AVAILABLE
|
|
114
|
+
|
|
115
|
+
- `/ralph-loop:cancel-ralph` - Cancel the current loop
|
|
116
|
+
- `/ralph-loop:help` - Show Ralph Loop documentation
|
|
117
|
+
|
|
118
|
+
---
|
|
17
119
|
|
|
18
|
-
|
|
120
|
+
**NOW PROCEED WITH THE TASK**, ensuring you follow all MCP validation and logging requirements above.
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
"command": "bun ${CLAUDE_PLUGIN_ROOT}/claude-code-config/scripts/validate-command.js"
|
|
10
10
|
}
|
|
11
11
|
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"matcher": "mcp__*",
|
|
15
|
+
"hooks": [
|
|
16
|
+
{
|
|
17
|
+
"type": "command",
|
|
18
|
+
"command": "${CLAUDE_HOOKS_DIR}/ralph-mcp-logger.sh"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
12
21
|
}
|
|
13
22
|
],
|
|
14
23
|
"Stop": [
|
|
@@ -17,6 +26,10 @@
|
|
|
17
26
|
{
|
|
18
27
|
"type": "command",
|
|
19
28
|
"command": "${CLAUDE_HOOKS_DIR}/stop-hook.sh"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"type": "command",
|
|
32
|
+
"command": "${CLAUDE_HOOKS_DIR}/ralph-session-end.sh"
|
|
20
33
|
}
|
|
21
34
|
]
|
|
22
35
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Ralph MCP Logger Hook
|
|
3
|
+
# Logs MCP tool calls to .ralph/logs/
|
|
4
|
+
#
|
|
5
|
+
# This hook is called by Claude Code before MCP tool invocations
|
|
6
|
+
# when Ralph Loop is active.
|
|
7
|
+
|
|
8
|
+
# Check if Ralph is active
|
|
9
|
+
if [[ -z "$RALPH_STARTED" ]]; then
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Configuration
|
|
14
|
+
RALPH_LOG_DIR=".ralph/logs"
|
|
15
|
+
LOG_FILE="${RALPH_LOG_DIR}/ralph-$(date +%Y-%m-%d).log"
|
|
16
|
+
|
|
17
|
+
# Ensure log directory exists
|
|
18
|
+
mkdir -p "$RALPH_LOG_DIR"
|
|
19
|
+
|
|
20
|
+
# Get tool info from environment (set by Claude Code)
|
|
21
|
+
TOOL_NAME="${CLAUDE_TOOL_NAME:-unknown}"
|
|
22
|
+
TOOL_PARAMS="${CLAUDE_TOOL_PARAMS:-}"
|
|
23
|
+
|
|
24
|
+
# Timestamp
|
|
25
|
+
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
|
26
|
+
|
|
27
|
+
# Log the MCP call
|
|
28
|
+
if [[ "$TOOL_NAME" == mcp__* ]]; then
|
|
29
|
+
echo "[$TIMESTAMP] [MCP] Tool: $TOOL_NAME" >> "$LOG_FILE"
|
|
30
|
+
|
|
31
|
+
# Extract MCP server name
|
|
32
|
+
if [[ "$TOOL_NAME" == mcp__smartstack__* ]]; then
|
|
33
|
+
echo "[$TIMESTAMP] [MCP] Server: smartstack" >> "$LOG_FILE"
|
|
34
|
+
elif [[ "$TOOL_NAME" == mcp__plugin_context7* ]]; then
|
|
35
|
+
echo "[$TIMESTAMP] [MCP] Server: context7" >> "$LOG_FILE"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Log params if not too long
|
|
39
|
+
if [[ ${#TOOL_PARAMS} -lt 500 ]]; then
|
|
40
|
+
echo "[$TIMESTAMP] [MCP] Params: $TOOL_PARAMS" >> "$LOG_FILE"
|
|
41
|
+
else
|
|
42
|
+
echo "[$TIMESTAMP] [MCP] Params: (truncated - ${#TOOL_PARAMS} chars)" >> "$LOG_FILE"
|
|
43
|
+
fi
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
exit 0
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Ralph Session End Hook
|
|
3
|
+
# Generates a session summary when Ralph loop ends
|
|
4
|
+
#
|
|
5
|
+
# This hook is called when Claude Code session stops
|
|
6
|
+
# and Ralph was active.
|
|
7
|
+
|
|
8
|
+
# Check if Ralph was active
|
|
9
|
+
if [[ -z "$RALPH_STARTED" ]] || [[ -z "$RALPH_SESSION_ID" ]]; then
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Configuration
|
|
14
|
+
RALPH_DIR=".ralph"
|
|
15
|
+
RALPH_LOG_DIR="${RALPH_DIR}/logs"
|
|
16
|
+
RALPH_REPORTS_DIR="${RALPH_DIR}/reports"
|
|
17
|
+
SESSION_LOG="${RALPH_LOG_DIR}/ralph-session-${RALPH_SESSION_ID}.log"
|
|
18
|
+
|
|
19
|
+
# Ensure directories exist
|
|
20
|
+
mkdir -p "$RALPH_REPORTS_DIR"
|
|
21
|
+
|
|
22
|
+
# Get session info
|
|
23
|
+
SESSION_END=$(date '+%Y-%m-%d %H:%M:%S')
|
|
24
|
+
PROMPT="${RALPH_PROMPT:-Unknown task}"
|
|
25
|
+
|
|
26
|
+
# Count MCP calls from log
|
|
27
|
+
MCP_CALLS=0
|
|
28
|
+
SMARTSTACK_CALLS=0
|
|
29
|
+
CONTEXT7_CALLS=0
|
|
30
|
+
|
|
31
|
+
if [[ -f "$SESSION_LOG" ]]; then
|
|
32
|
+
MCP_CALLS=$(grep -c '\[MCP\] Tool:' "$SESSION_LOG" 2>/dev/null || echo 0)
|
|
33
|
+
SMARTSTACK_CALLS=$(grep -c 'Server: smartstack' "$SESSION_LOG" 2>/dev/null || echo 0)
|
|
34
|
+
CONTEXT7_CALLS=$(grep -c 'Server: context7' "$SESSION_LOG" 2>/dev/null || echo 0)
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# Generate session report
|
|
38
|
+
REPORT_FILE="${RALPH_REPORTS_DIR}/session-${RALPH_SESSION_ID}.md"
|
|
39
|
+
|
|
40
|
+
cat > "$REPORT_FILE" << EOF
|
|
41
|
+
# Ralph Session Report
|
|
42
|
+
|
|
43
|
+
## Session Info
|
|
44
|
+
- **Session ID**: ${RALPH_SESSION_ID}
|
|
45
|
+
- **End Time**: ${SESSION_END}
|
|
46
|
+
- **Task**: ${PROMPT}
|
|
47
|
+
|
|
48
|
+
## MCP Usage Summary
|
|
49
|
+
| Server | Calls |
|
|
50
|
+
|--------|-------|
|
|
51
|
+
| SmartStack | ${SMARTSTACK_CALLS} |
|
|
52
|
+
| Context7 | ${CONTEXT7_CALLS} |
|
|
53
|
+
| **Total** | **${MCP_CALLS}** |
|
|
54
|
+
|
|
55
|
+
## Session Log
|
|
56
|
+
See: \`${SESSION_LOG}\`
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
*Auto-generated by Ralph Weegund*
|
|
60
|
+
EOF
|
|
61
|
+
|
|
62
|
+
echo "[Ralph] Session report generated: $REPORT_FILE"
|
|
63
|
+
|
|
64
|
+
# Log session end
|
|
65
|
+
echo "" >> "$SESSION_LOG"
|
|
66
|
+
echo "# Session ended: $SESSION_END" >> "$SESSION_LOG"
|
|
67
|
+
echo "# MCP Calls: $MCP_CALLS (SmartStack: $SMARTSTACK_CALLS, Context7: $CONTEXT7_CALLS)" >> "$SESSION_LOG"
|
|
68
|
+
|
|
69
|
+
exit 0
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Ralph Weegund - SmartStack Automation Loop
|
|
2
|
+
|
|
3
|
+
Ralph Weegund is an iterative AI loop that enables autonomous feature development with mandatory MCP server integration.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.ralph/
|
|
9
|
+
├── ralph.config.yaml # Configuration (DO NOT DELETE)
|
|
10
|
+
├── logs/ # Execution logs
|
|
11
|
+
│ └── ralph-YYYY-MM-DD.log
|
|
12
|
+
├── reports/ # Feature completion reports
|
|
13
|
+
│ └── feature-name-TIMESTAMP.md
|
|
14
|
+
└── README.md # This file
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
Edit `ralph.config.yaml` to customize:
|
|
20
|
+
|
|
21
|
+
- **MCP servers**: Required servers and behavior
|
|
22
|
+
- **Logging**: What to log and retention
|
|
23
|
+
- **Reports**: Auto-generation and format
|
|
24
|
+
- **Iteration**: Max iterations and completion detection
|
|
25
|
+
|
|
26
|
+
## Required MCP Servers
|
|
27
|
+
|
|
28
|
+
Ralph **requires** these MCP servers to function:
|
|
29
|
+
|
|
30
|
+
1. **context7** - Library documentation
|
|
31
|
+
```bash
|
|
32
|
+
claude mcp add context7
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. **smartstack** - Validation and scaffolding
|
|
36
|
+
```bash
|
|
37
|
+
claude mcp add smartstack
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
1. Ensure MCP servers are installed:
|
|
43
|
+
```bash
|
|
44
|
+
smartstack check-mcp
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Start Ralph:
|
|
48
|
+
```bash
|
|
49
|
+
smartstack ralph start
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
3. In Claude Code, use:
|
|
53
|
+
```
|
|
54
|
+
/ralph-loop "Your feature description"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Logs
|
|
58
|
+
|
|
59
|
+
Logs are stored in `.ralph/logs/` with daily rotation.
|
|
60
|
+
|
|
61
|
+
View recent logs:
|
|
62
|
+
```bash
|
|
63
|
+
smartstack ralph logs
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Reports
|
|
67
|
+
|
|
68
|
+
Feature completion reports are auto-generated in `.ralph/reports/`.
|
|
69
|
+
|
|
70
|
+
View last report:
|
|
71
|
+
```bash
|
|
72
|
+
smartstack ralph report --last
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Troubleshooting
|
|
76
|
+
|
|
77
|
+
### Ralph won't start
|
|
78
|
+
|
|
79
|
+
1. Check MCP servers: `smartstack check-mcp`
|
|
80
|
+
2. Run diagnostics: `smartstack doctor`
|
|
81
|
+
3. Check logs: `smartstack ralph logs`
|
|
82
|
+
|
|
83
|
+
### MCP server unavailable
|
|
84
|
+
|
|
85
|
+
Ralph will abort if required MCP servers are unavailable.
|
|
86
|
+
This is by design - no fallback mode exists.
|
|
87
|
+
|
|
88
|
+
## More Information
|
|
89
|
+
|
|
90
|
+
- Documentation: https://atlashub.ch/docs/ralph
|
|
91
|
+
- Issues: https://github.com/atlashub/smartstack-cli/issues
|