INNER CODE UNIT · Go

tryAutoPlanMode

umputun/ralphex · cmd/ralphex/main.go:400

func tryAutoPlanMode(ctx context.Context, err error, o opts, req executePlanRequest,
	selector *plan.Selector) (bool, error) {
	// only a missing-plans error is a candidate for auto-plan-mode; other errors propagate as-is.
	if !errors.Is(err, plan.ErrNoPlansFound) {
		return false, nil
	}

	// interactive plan creation only runs in full execution mode; explain when another mode suppresses it.
	if o.Review || o.ExternalOnly || o.CodexOnly || o.TasksOnly {
		return true, fmt.Errorf("interactive plan creation is not available in this mode; provide an existing plan file: %w", err)
	}

	isDefault, branchErr := req.GitSvc.IsDefaultBranch(req.DefaultBranch)
	if branchErr != nil {
		return true, fmt.Errorf(
			"cannot offer interactive plan creation: failed to determine current branch (%v); "+
				"pass a plan file or use --plan: %w", branchErr, err)
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…