Skip to content

Conversation

@umputun
Copy link
Owner

@umputun umputun commented Jan 26, 2026

Summary

When running ralphex without arguments on master/main branch and no plans exist in docs/plans/, automatically prompt for plan description and switch to plan creation mode instead of erroring with "no plans found".

Changes

  • Add errNoPlansFound sentinel error for detecting empty/missing plans directory
  • Add isMainBranch() helper to check for main/master branches
  • Add promptPlanDescription(io.Reader, colors) with injectable reader for testability
  • Add tryAutoPlanMode() to orchestrate auto-plan-mode detection logic
  • Treat missing plans directory same as empty directory (both trigger auto-plan-mode)
  • Update documentation in README.md and llms.txt

Behavior

  • On master/main with no plans: prompts "no plans found. what would you like to implement?"
  • User enters description → enters plan creation mode
  • User presses Ctrl+D or Enter without text → graceful exit
  • On feature branch with no plans → still errors with "no plans found"
  • --review and --codex-only modes → skip auto-plan-mode (plan is optional)

When running `ralphex` without arguments on master/main branch and no
plans exist in docs/plans/, automatically prompt for plan description
and switch to plan creation mode instead of erroring.

- add errNoPlansFound sentinel error for detecting empty plans dir
- add isMainBranch() helper to check for main/master branches
- add promptPlanDescription() with io.Reader for testability
- add tryAutoPlanMode() to orchestrate auto-plan-mode detection
- treat missing plans directory same as empty directory
- update documentation in README.md and llms.txt
Copilot AI review requested due to automatic review settings January 26, 2026 21:28
@cloudflare-workers-and-pages
Copy link

Deploying ralphex with  Cloudflare Pages  Cloudflare Pages

Latest commit: db71db7
Status: ✅  Deploy successful!
Preview URL: https://9a1b8aa0.ralphex.pages.dev
Branch Preview URL: https://auto-plan-mode-detection.ralphex.pages.dev

View logs

@umputun umputun merged commit 5a56cc1 into master Jan 26, 2026
9 checks passed
@umputun umputun deleted the auto-plan-mode-detection branch January 26, 2026 21:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds auto-plan-mode detection that automatically prompts users to create a plan when running ralphex without arguments on main/master branches with no existing plans, instead of erroring out. This improves the user experience for fresh repositories.

Changes:

  • Introduces sentinel error errNoPlansFound for detecting empty/missing plans directory
  • Adds helper functions isMainBranch(), promptPlanDescription(), and tryAutoPlanMode() to implement auto-plan-mode logic
  • Updates selectPlanWithFzf() to return the sentinel error in both missing directory and empty directory cases
  • Updates documentation in README.md and llms.txt to reflect the new behavior

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
cmd/ralphex/main.go Core implementation of auto-plan-mode detection with sentinel error, branch checking, user prompting, and orchestration logic
cmd/ralphex/main_test.go Comprehensive test coverage for new functions and integration tests for auto-plan-mode behavior on different branches and modes
README.md Documentation update to mention auto-detection feature in plan creation methods
llms.txt Updated comment to clarify that running without arguments can create plans interactively if none exist

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants