diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0f61e50 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,46 @@ +# EditorConfig for Ralph Ultra +# https://editorconfig.org + +root = true + +# Default settings for all files +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +# Shell scripts +[*.sh] +indent_size = 2 + +# Bash scripts +[*.{bash,bats}] +indent_size = 2 + +# Markdown files +[*.md] +trim_trailing_whitespace = false +max_line_length = off + +# JSON files +[*.json] +indent_size = 2 + +# YAML files +[*.{yml,yaml}] +indent_size = 2 + +# Makefiles +[Makefile] +indent_style = tab + +# Python files +[*.py] +indent_size = 4 + +# JavaScript/TypeScript +[*.{js,ts,jsx,tsx}] +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4be7d69 --- /dev/null +++ b/.gitignore @@ -0,0 +1,97 @@ +# Ralph Ultra .gitignore + +# OS files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +*.swp +*.swo +*~ + +# IDE files +.vscode/ +.idea/ +*.sublime-* +*.code-workspace + +# Logs +*.log +logs/ +*.log.* +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Temporary files +tmp/ +temp/ +.tmp/ +.temp/ + +# Build outputs +dist/ +build/ +out/ +*.o +*.so +*.dylib +*.exe + +# Dependencies +node_modules/ +jspm_packages/ +vendor/ +.vendor/ + +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +venv/ +env/ +ENV/ +.venv + +# Testing +coverage/ +.nyc_output/ +.coverage +.pytest_cache/ +.tox/ + +# Ralph Ultra specific +.ralph/ +.ralph-cache/ +ralph-session-*.json +ralph-cost-*.txt +*.ralph.bak + +# Local configuration +.env +.env.local +.env.*.local +local.config.json + +# Package manager files +package-lock.json +yarn.lock +Gemfile.lock + +# Security +*.pem +*.key +*.crt +secrets/ +credentials/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..fb0ad9c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,305 @@ +# Contributing to Ralph Ultra + +First off, thank you for considering contributing to Ralph Ultra! It's people like you that make Ralph Ultra such a great tool for autonomous development. + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [How Can I Contribute?](#how-can-i-contribute) +- [Getting Started](#getting-started) +- [Development Workflow](#development-workflow) +- [Skill Development](#skill-development) +- [Coding Standards](#coding-standards) +- [Testing](#testing) +- [Pull Request Process](#pull-request-process) + +## Code of Conduct + +This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. + +## How Can I Contribute? + +### Reporting Bugs + +Before creating bug reports, please check existing issues to avoid duplicates. When you create a bug report, include as many details as possible: + +- **Use a clear and descriptive title** +- **Describe the exact steps to reproduce the problem** +- **Provide specific examples** to demonstrate the steps +- **Describe the behavior you observed** and what behavior you expected +- **Include logs** from `~/.ralph/logs/` if available +- **Specify your environment**: OS, shell version, Claude Code version + +### Suggesting Enhancements + +Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion: + +- **Use a clear and descriptive title** +- **Provide a step-by-step description** of the suggested enhancement +- **Provide specific examples** of how the enhancement would be used +- **Explain why this enhancement would be useful** to most Ralph Ultra users + +### Creating New Skills + +Ralph Ultra's power comes from its modular skill system. New skills are always welcome! See the [Skill Development](#skill-development) section for details. + +## Getting Started + +1. **Fork the repository** on GitHub +2. **Clone your fork** locally: + ```bash + git clone https://github.com/YOUR-USERNAME/Ralph-Loop-Ultra.git + cd Ralph-Loop-Ultra + ``` +3. **Install Ralph Ultra** in development mode: + ```bash + sudo ./install.sh + ``` +4. **Create a branch** for your changes: + ```bash + git checkout -b feature/your-feature-name + ``` + +## Development Workflow + +### Directory Structure + +``` +Ralph-Loop-Ultra/ +├── bin/ # Main executable scripts +├── lib/ # Core library modules +│ ├── core/ # Core functionality +│ ├── observability/# Monitoring and logging +│ └── skills/ # Skill runner and utilities +├── skills/ # Individual skill implementations +├── templates/ # Project templates +├── docs/ # Documentation +├── tests/ # BATS test suite +└── examples/ # Example configurations +``` + +### Making Changes + +1. **Keep changes focused**: One feature or fix per pull request +2. **Follow existing patterns**: Look at similar files for style guidance +3. **Test your changes**: Run the test suite before submitting +4. **Update documentation**: Keep docs in sync with code changes +5. **Add tests**: New features should include tests + +## Skill Development + +Skills are modular components that extend Ralph Ultra's capabilities. Each skill lives in `skills/SKILL-NAME/`. + +### Skill Structure + +``` +skills/your-skill-name/ +├── SKILL.md # Skill documentation (required) +├── skill.sh # Main skill script (optional) +├── prompts/ # Sub-agent prompts (optional) +└── tests/ # Skill-specific tests (recommended) +``` + +### SKILL.md Format + +Every skill must have a `SKILL.md` file with frontmatter: + +```markdown +--- +name: your-skill-name +description: Brief description of what the skill does +allowed-tools: Bash, Read, Edit, Grep # Tools the skill can use +--- + +## Skill Name + +Detailed description... + +### When to Use + +- Bullet point list of scenarios + +### How It Works + +Step-by-step explanation... + +### Usage + +Example commands and output... +``` + +### Skill Development Guidelines + +1. **Single Responsibility**: Each skill should do one thing well +2. **Idempotent**: Skills should be safe to run multiple times +3. **Error Handling**: Always handle errors gracefully +4. **Logging**: Use the logger from `lib/core/logger.sh` +5. **Documentation**: Clear examples and use cases in SKILL.md + +## Coding Standards + +### Shell Scripts + +- **Use `#!/usr/bin/env bash`** for portability +- **Set strict mode**: `set -euo pipefail` at the start of scripts +- **Quote variables**: Always use `"$var"` not `$var` +- **Use `[[` for conditionals**: Prefer `[[ ]]` over `[ ]` +- **Functions over scripts**: Modularize with functions +- **Comments**: Explain why, not what +- **Error messages**: Always include context in error messages + +### Bash 3.2 Compatibility + +Ralph Ultra supports macOS with its default Bash 3.2. Avoid: +- Associative arrays (bash 4+) +- `mapfile`/`readarray` (bash 4+) +- `**` globstar (bash 4+) + +Use instead: +- Traditional indexed arrays +- `while read` loops +- Explicit `find` commands + +### Code Style + +```bash +#!/usr/bin/env bash +set -euo pipefail + +# Good: descriptive function name, error handling +function validate_config() { + local config_file="$1" + + if [[ ! -f "$config_file" ]]; then + echo "Error: Config file not found: $config_file" >&2 + return 1 + fi + + # Validate JSON + if ! jq empty "$config_file" 2>/dev/null; then + echo "Error: Invalid JSON in $config_file" >&2 + return 1 + fi + + return 0 +} + +# Usage +if ! validate_config "prd.json"; then + exit 1 +fi +``` + +## Testing + +Ralph Ultra uses [BATS](https://github.com/bats-core/bats-core) for testing. + +### Running Tests + +```bash +# Run all tests +bats tests/ + +# Run specific test file +bats tests/test_json.bats + +# Run specific test +bats tests/test_json.bats --filter "parse valid JSON" +``` + +### Writing Tests + +Create test files in `tests/` with `.bats` extension: + +```bash +#!/usr/bin/env bats + +load test_helper + +@test "function name: successful case" { + run your_function "arg1" "arg2" + assert_success + assert_output "expected output" +} + +@test "function name: error case" { + run your_function "bad_arg" + assert_failure + assert_output --partial "Error:" +} +``` + +### Test Coverage + +- **Core modules**: 100% coverage required +- **Skills**: Test happy path and error cases +- **Integration tests**: For end-to-end scenarios + +## Pull Request Process + +### Before Submitting + +1. **Run tests**: `bats tests/` +2. **Run shellcheck**: `shellcheck bin/* lib/**/*.sh` +3. **Test manually**: Verify your changes work in real scenarios +4. **Update docs**: Keep README and docs/ in sync +5. **Update CHANGELOG**: Add entry under "Unreleased" + +### PR Guidelines + +1. **Clear title**: Describe what the PR does +2. **Description**: Explain why this change is needed +3. **Link issues**: Reference related issues with "Fixes #123" +4. **Small PRs**: Keep changes focused and reviewable +5. **Clean commits**: Squash work-in-progress commits + +### PR Template + +Your PR should include: + +```markdown +## Description +Brief description of changes + +## Motivation +Why is this change needed? + +## Changes +- Bullet list of changes + +## Testing +How was this tested? + +## Checklist +- [ ] Tests pass +- [ ] Documentation updated +- [ ] CHANGELOG updated +- [ ] Follows coding standards +``` + +### Review Process + +1. **Automated checks**: GitHub Actions will run tests +2. **Code review**: Maintainers will review your code +3. **Address feedback**: Make requested changes +4. **Approval**: Once approved, maintainers will merge + +## Questions? + +- **Documentation**: Check [docs/](docs/) +- **Examples**: See [examples/](examples/) +- **Issues**: Search existing [issues](https://github.com/kimhons/Ralph-Loop-Ultra/issues) +- **Discussions**: Start a [discussion](https://github.com/kimhons/Ralph-Loop-Ultra/discussions) + +## License + +By contributing, you agree that your contributions will be licensed under the MIT License. + +## Recognition + +Contributors will be recognized in: +- GitHub contributors page +- CHANGELOG.md for significant contributions +- Special mentions in release notes + +Thank you for making Ralph Ultra better! 🚀 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ad32d97 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Kimal Honour Djam + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.