docs: add user guide and example projects (#139)

New users were confused about which files they write vs. which Ralph
manages, and how PROMPT.md, specs/, and fix_plan.md relate to each other.

Added:
- docs/user-guide/ with quick start tutorial, file reference, and
  requirements writing guide
- examples/simple-cli-tool/ showing minimal Ralph configuration
- examples/rest-api/ demonstrating when to use specs/
- README section explaining Ralph files and their relationships

Also documents specs/stdlib/ purpose for reusable patterns.
This commit is contained in:
Test User 2026-01-29 13:51:10 -07:00
parent dbb27d89e9
commit dff2d358f6
13 changed files with 1386 additions and 2 deletions

View file

@ -0,0 +1,57 @@
# Ralph Development Instructions
## Context
You are Ralph, building a command-line todo application in Node.js. This is a personal productivity tool that stores tasks locally and provides simple commands for task management.
## Current Objectives
1. Create a CLI that supports add, list, complete, and delete commands
2. Store todos in ~/.todos.json with automatic file creation
3. Provide clear, helpful output for all operations
4. Handle errors gracefully with actionable messages
## Technology Stack
- Node.js 18+
- commander.js for CLI argument parsing
- Native fs/promises for file operations
- Jest for testing
## Key Principles
- Single responsibility: each command does one thing well
- Fail gracefully: missing file = empty list, not an error
- Clear output: users should always know what happened
- Testable: core logic separated from CLI layer
## Command Specifications
### `todo add "task description"`
- Adds a new task with auto-incrementing ID
- Outputs: "Added task #3: Buy groceries"
### `todo list`
- Shows all tasks with status indicators
- [ ] for pending, [x] for completed
- Outputs: "No tasks yet" if empty
### `todo complete <id>`
- Marks task as done
- Errors if ID doesn't exist
### `todo delete <id>`
- Removes task permanently
- Errors if ID doesn't exist
## Data Format
```json
{
"nextId": 4,
"tasks": [
{"id": 1, "text": "Buy groceries", "completed": false},
{"id": 2, "text": "Call mom", "completed": true}
]
}
```
## Quality Standards
- All commands have --help documentation
- Unit tests for storage module
- Integration tests for CLI commands

View file

@ -0,0 +1,22 @@
# Fix Plan - Todo CLI
## Priority 1: Foundation
- [ ] Set up package.json with commander and jest dependencies
- [ ] Create src/storage.js with load/save functions for ~/.todos.json
- [ ] Create src/index.js entry point with commander setup
## Priority 2: Core Commands
- [ ] Implement `todo add "description"` command
- [ ] Implement `todo list` command with status indicators
- [ ] Implement `todo complete <id>` command
- [ ] Implement `todo delete <id>` command
## Priority 3: Polish
- [ ] Add comprehensive --help text for each command
- [ ] Handle edge cases (empty list, invalid ID, negative ID)
- [ ] Write unit tests for storage.js module
- [ ] Write integration tests for CLI commands
- [ ] Add a `todo clear` command to remove all completed tasks
## Discovered
<!-- Ralph will add discovered tasks here -->

View file

@ -0,0 +1,68 @@
# Example: Simple CLI Tool
This example shows a minimal Ralph configuration for a command-line todo application built with Node.js.
## What This Example Demonstrates
- **Minimal PROMPT.md** - Just enough context for a focused project
- **Specific fix_plan.md** - Concrete, actionable tasks
- **No specs/ needed** - Simple enough that PROMPT.md covers everything
## Project Structure
```
simple-cli-tool/
├── .ralph/
│ ├── PROMPT.md # Project goals and principles
│ └── fix_plan.md # Task list
├── .ralphrc # Configuration (auto-generated)
└── README.md # This file
```
## How to Use This Example
1. Copy this directory to a new location:
```bash
cp -r examples/simple-cli-tool ~/my-todo-app
cd ~/my-todo-app
```
2. Initialize git and npm:
```bash
git init
npm init -y
```
3. Run Ralph:
```bash
ralph --monitor
```
## Key Points
### PROMPT.md is Focused
Notice how PROMPT.md:
- States exactly what the tool should do
- Specifies the technology (Node.js, commander.js)
- Defines key behaviors (where data is stored, error handling)
### fix_plan.md Uses Priorities
Tasks are grouped by priority:
- Priority 1: Foundation (must work before anything else)
- Priority 2: Core features (the main functionality)
- Priority 3: Polish (nice-to-have improvements)
### No specs/ Directory
This project is simple enough that PROMPT.md provides all necessary context. specs/ would be overkill here.
## When to Add More Files
Consider adding specs/ if you need:
- Complex command behavior documentation
- Data format specifications
- External service integration details
For this simple example, PROMPT.md is sufficient.