diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..cdb69f48 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Prepare release assets + run: | + mkdir -p release-assets + cp install-from-release.sh release-assets/ + cp ralph.sh release-assets/ + cp prompt.md release-assets/ + cp skills/prd/SKILL.md release-assets/prd-SKILL.md + cp skills/ralph/SKILL.md release-assets/ralph-SKILL.md + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: | + release-assets/* diff --git a/README.md b/README.md index 67d98d16..0693dbae 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,41 @@ Based on [Geoffrey Huntley's Ralph pattern](https://ghuntley.com/ralph/). ## Setup -### Option 1: Copy to your project +### Option 1: Install from release (recommended) -Copy the ralph files into your project: +Install from the latest stable release: ```bash -# From your project root -mkdir -p scripts/ralph -cp /path/to/ralph/ralph.sh scripts/ralph/ -cp /path/to/ralph/prompt.md scripts/ralph/ -chmod +x scripts/ralph/ralph.sh +curl -sSL https://github.com/snarktank/ralph/releases/latest/download/install-from-release.sh | bash ``` -### Option 2: Install skills globally +Or download and inspect first: + +```bash +curl -O https://github.com/snarktank/ralph/releases/latest/download/install-from-release.sh +less install-from-release.sh # inspect the script +bash install-from-release.sh +``` + +Or install a specific version: + +```bash +curl -sSL https://github.com/snarktank/ralph/releases/download/v1.0.0/install-from-release.sh | bash -s 1.0.0 +``` + +This will create a `scripts/ralph` directory in your project with the necessary files. + +### Option 2: Install from main branch (for testing) + +Install the latest development version from the main branch: + +```bash +curl -sSL https://raw.githubusercontent.com/snarktank/ralph/main/install.sh | bash +``` + +> ⚠️ This pulls from the main branch which may contain untested changes. + +### Option 3: Install skills globally Copy the skills to your Amp config for use across all projects: diff --git a/install-from-release.sh b/install-from-release.sh new file mode 100644 index 00000000..f1ffa726 --- /dev/null +++ b/install-from-release.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# Installer for Ralph - The autonomous AI agent +# Installs from GitHub Releases for stable, versioned installation +set -e + +# Configuration +INSTALL_DIR="scripts/ralph" +GITHUB_REPO="snarktank/ralph" +VERSION="${1:-latest}" + +# Resolve version to release URL +if [ "$VERSION" = "latest" ]; then + RELEASE_URL="https://github.com/$GITHUB_REPO/releases/latest/download" +else + RELEASE_URL="https://github.com/$GITHUB_REPO/releases/download/v$VERSION" +fi + +FILES_TO_INSTALL=("ralph.sh" "prompt.md") +SKILLS=("prd" "ralph") + +# Welcome message +echo "Installing Ralph from release: $VERSION" +echo "This will create a '$INSTALL_DIR' directory in your current project." +echo "" + +# Create installation directory +mkdir -p "$INSTALL_DIR" +echo "✔ Created directory: $INSTALL_DIR" + +# Download and install files +for file in "${FILES_TO_INSTALL[@]}"; do + URL="$RELEASE_URL/$file" + DEST="$INSTALL_DIR/$file" + + echo -n " - Downloading $file..." + if curl -fsSL "$URL" -o "$DEST"; then + echo " ✔" + else + echo " ✖ FAILED" + echo "Error: Could not download $URL" + echo "Please check the version exists and your internet connection." + exit 1 + fi +done + +# Make ralph.sh executable +chmod +x "$INSTALL_DIR/ralph.sh" +echo "✔ Made ralph.sh executable" +echo "" + +# Configure Amp auto-handoff +AMP_CONFIG_DIR="$HOME/.config/amp" +AMP_SETTINGS_FILE="$AMP_CONFIG_DIR/settings.json" + +echo "Configuring Amp auto-handoff..." + +# Check for jq +if ! command -v jq &> /dev/null; then + echo " - jq is not installed. Please install it to auto-configure Amp." + echo " (e.g., 'brew install jq' on macOS)" + echo " - Skipping auto-configuration." +else + # Ensure config directory and file exist + mkdir -p "$AMP_CONFIG_DIR" + [ -f "$AMP_SETTINGS_FILE" ] || echo "{}" > "$AMP_SETTINGS_FILE" + + # Check if autoHandoff is already configured + if jq -e '."amp.experimental.autoHandoff"' "$AMP_SETTINGS_FILE" > /dev/null; then + echo "✔ Amp auto-handoff is already configured." + else + # Add the autoHandoff setting + jq '."amp.experimental.autoHandoff" = {"context": 90}' "$AMP_SETTINGS_FILE" > "$AMP_SETTINGS_FILE.tmp" && mv "$AMP_SETTINGS_FILE.tmp" "$AMP_SETTINGS_FILE" + echo "✔ Enabled Amp auto-handoff for large stories." + fi +fi +echo "" + +# Install skills globally +AMP_SKILLS_DIR="$HOME/.config/amp/skills" +mkdir -p "$AMP_SKILLS_DIR" +echo "Installing skills globally to $AMP_SKILLS_DIR..." + +for skill in "${SKILLS[@]}"; do + mkdir -p "$AMP_SKILLS_DIR/$skill" + + echo -n " - Downloading $skill skill..." + TEMP_FILE=$(mktemp) + # Skills are uploaded with prefixed names (e.g., prd-SKILL.md, ralph-SKILL.md) + if curl -fsSL "$RELEASE_URL/$skill-SKILL.md" -o "$TEMP_FILE" 2>/dev/null && mv "$TEMP_FILE" "$AMP_SKILLS_DIR/$skill/SKILL.md"; then + echo " ✔" + else + echo " ✖ FAILED (skipping)" + rm -f "$TEMP_FILE" + fi +done +echo "" + +# Success message +echo "" +echo "============================================" +echo " Ralph installed successfully!" +echo " Version: $VERSION" +echo "============================================" +echo "" +echo "Next steps:" +echo "" +echo "1. Create a PRD" +echo " Load the prd skill and create a PRD for [your feature description]" +echo " Answer the clarifying questions. The skill saves output to tasks/prd-[feature-name].md." +echo "" +echo "2. Convert PRD to Ralph format" +echo " Load the ralph skill and convert tasks/prd-[feature-name].md to prd.json" +echo "" +echo "3. Run Ralph" +echo " ./scripts/ralph/ralph.sh [max_iterations]" +echo "" +echo "For more details, see: https://github.com/snarktank/ralph" diff --git a/install.sh b/install.sh new file mode 100644 index 00000000..1258b088 --- /dev/null +++ b/install.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# Installer for Ralph - The autonomous AI agent +# NOTE: This installs from the main branch (latest development version). +# For stable releases, use install-from-release.sh instead. +set -e + +# Configuration +INSTALL_DIR="scripts/ralph" +GITHUB_REPO="https://raw.githubusercontent.com/snarktank/ralph/main" +FILES_TO_INSTALL=("ralph.sh" "prompt.md") + +# Welcome message +echo "Installing Ralph..." +echo "This will create a '$INSTALL_DIR' directory in your current project." +echo "" + +# Create installation directory +mkdir -p "$INSTALL_DIR" +echo "✔ Created directory: $INSTALL_DIR" + +# Download and install files +for file in "${FILES_TO_INSTALL[@]}"; do + URL="$GITHUB_REPO/$file" + DEST="$INSTALL_DIR/$file" + + echo -n " - Downloading $file..." + if curl -fsSL "$URL" -o "$DEST"; then + echo " ✔" + else + echo " ✖ FAILED" + echo "Error: Could not download $URL" + echo "Please check the URL and your internet connection." + exit 1 + fi +done + +# Make ralph.sh executable +chmod +x "$INSTALL_DIR/ralph.sh" +echo "✔ Made ralph.sh executable" +echo "" + +# Configure Amp auto-handoff +AMP_CONFIG_DIR="$HOME/.config/amp" +AMP_SETTINGS_FILE="$AMP_CONFIG_DIR/settings.json" + +echo "Configuring Amp auto-handoff..." + +# Check for jq +if ! command -v jq &> /dev/null; then + echo " - jq is not installed. Please install it to auto-configure Amp." + echo " (e.g., 'brew install jq' on macOS)" + echo " - Skipping auto-configuration." +else + # Ensure config directory and file exist + mkdir -p "$AMP_CONFIG_DIR" + [ -f "$AMP_SETTINGS_FILE" ] || echo "{}" > "$AMP_SETTINGS_FILE" + + # Check if autoHandoff is already configured + if jq -e '."amp.experimental.autoHandoff"' "$AMP_SETTINGS_FILE" > /dev/null; then + echo "✔ Amp auto-handoff is already configured." + else + # Add the autoHandoff setting + jq '."amp.experimental.autoHandoff" = {"context": 90}' "$AMP_SETTINGS_FILE" > "$AMP_SETTINGS_FILE.tmp" && mv "$AMP_SETTINGS_FILE.tmp" "$AMP_SETTINGS_FILE" + echo "✔ Enabled Amp auto-handoff for large stories." + fi +fi +echo "" + +# Install skills globally +AMP_SKILLS_DIR="$HOME/.config/amp/skills" +mkdir -p "$AMP_SKILLS_DIR" +echo "Installing skills globally to $AMP_SKILLS_DIR..." + +for skill in "prd" "ralph"; do + mkdir -p "$AMP_SKILLS_DIR/$skill" + + echo -n " - Downloading $skill skill..." + TEMP_FILE=$(mktemp) + if curl -fsSL "$GITHUB_REPO/skills/$skill/SKILL.md" -o "$TEMP_FILE" 2>/dev/null && mv "$TEMP_FILE" "$AMP_SKILLS_DIR/$skill/SKILL.md"; then + echo " ✔" + else + echo " ✖ FAILED (skipping)" + rm -f "$TEMP_FILE" + fi +done +echo "" + +# Success message +echo "" +echo "============================================" +echo " Ralph installed successfully!" +echo "============================================" +echo "" +echo "Next steps:" +echo "" +echo "1. Create a PRD" +echo " Load the prd skill and create a PRD for [your feature description]" +echo " Answer the clarifying questions. The skill saves output to tasks/prd-[feature-name].md." +echo "" +echo "2. Convert PRD to Ralph format" +echo " Load the ralph skill and convert tasks/prd-[feature-name].md to prd.json" +echo "" +echo "3. Run Ralph" +echo " ./scripts/ralph/ralph.sh [max_iterations]" +echo "" +echo "For more details, see: https://github.com/snarktank/ralph" diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 00000000..c2fc9b11 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Helper script to create a new release +set -e + +# Get current version from git tags +CURRENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") +echo "Current version: $CURRENT_VERSION" + +# Parse version components +VERSION_REGEX="v([0-9]+)\.([0-9]+)\.([0-9]+)" +if [[ $CURRENT_VERSION =~ $VERSION_REGEX ]]; then + MAJOR="${BASH_REMATCH[1]}" + MINOR="${BASH_REMATCH[2]}" + PATCH="${BASH_REMATCH[3]}" +else + MAJOR=0 + MINOR=0 + PATCH=0 +fi + +# Determine bump type +BUMP_TYPE="${1:-patch}" +case $BUMP_TYPE in + major) + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + ;; + minor) + MINOR=$((MINOR + 1)) + PATCH=0 + ;; + patch) + PATCH=$((PATCH + 1)) + ;; + *) + echo "Usage: $0 [major|minor|patch]" + echo " major: Breaking changes (v1.0.0 -> v2.0.0)" + echo " minor: New features (v1.0.0 -> v1.1.0)" + echo " patch: Bug fixes (v1.0.0 -> v1.0.1)" + exit 1 + ;; +esac + +NEW_VERSION="v$MAJOR.$MINOR.$PATCH" +echo "New version: $NEW_VERSION" +echo "" + +# Confirm +read -p "Create release $NEW_VERSION? [y/N] " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Cancelled." + exit 0 +fi + +# Create and push tag +git tag -a "$NEW_VERSION" -m "Release $NEW_VERSION" +git push origin "$NEW_VERSION" + +echo "" +echo "✔ Tag $NEW_VERSION created and pushed." +echo "✔ GitHub Actions will create the release automatically." +echo "" +echo "View release at: https://github.com/snarktank/ralph/releases/tag/$NEW_VERSION"