# Quick Fix Formula
#
# Streamlined workflow for well-understood bugs and small fixes.
# Skips the deep research and planning phases of RPI - get in, fix, get out.
#
# Use when:
#   - Bug is well-understood (you know what's broken)
#   - Fix is straightforward (no architectural decisions)
#   - Change is small (< 100 lines)
#
# Use RPI instead when:
#   - Root cause is unclear
#   - Multiple approaches possible
#   - Significant design decisions needed

formula = "quick-fix"
description = """
Streamlined workflow for bugs and small fixes.

A faster alternative to RPI for well-understood issues:
1. Quick investigation to confirm understanding
2. Implement the fix
3. Verify with tests
4. Commit and close

No human gates - designed for quick turnaround on obvious fixes.
"""
version = 1
type = "workflow"

# === Variables ===

[vars.title]
required = true
description = "Brief description of the bug/fix"

[vars.bead_id]
description = "Existing bead ID (creates new if not provided)"

[vars.test_cmd]
default = "make test"
description = "Command to verify the fix"

# === Steps ===

[[steps]]
id = "investigate"
title = "Investigate: {{title}}"
description = """
Quick investigation to confirm understanding of the bug.

Goals:
- Locate the problematic code
- Confirm root cause matches expectations
- Identify files that need changes

This is NOT deep research - spend 5-10 minutes max.
If the bug is more complex than expected, pivot to RPI workflow.

Output: Mental model of what to fix (no artifact needed).
"""

[[steps]]
id = "fix"
title = "Fix: {{title}}"
needs = ["investigate"]
description = """
Implement the fix.

Guidelines:
- Make minimal changes to fix the issue
- Follow existing code patterns
- Add/update tests if appropriate
- Keep changes focused (no drive-by refactors)

If the fix grows beyond expectations, pause and consider:
- Should this be an RPI workflow instead?
- Should we split into multiple changes?
"""

[[steps]]
id = "verify"
title = "Verify fix"
needs = ["fix"]
description = """
Verify the fix works correctly.

Run: {{test_cmd}}

Also check:
- Bug is actually fixed (manual verification)
- No obvious regressions introduced
- Code compiles/builds cleanly

If tests fail, iterate on the fix step.
"""

[[steps]]
id = "commit"
title = "Commit and close"
needs = ["verify"]
description = """
Commit the fix and close the bead.

Actions:
1. Stage changes: git add -A
2. Commit with descriptive message: git commit -m "fix: {{title}}"
3. Push to remote: git push
4. Close the bead: bd close {{bead_id}}

Commit message should explain:
- What was broken
- How it was fixed
- Any relevant context
"""
