Documentation
¶
Overview ¶
Package whatif implements scenario-based what-if planning for cloop. It applies a natural-language mutation to an in-memory copy of the plan, re-runs velocity forecasting, and feeds the before/after diff to the AI to narrate timeline, risk, and mitigation consequences.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildNarrativePrompt ¶
BuildNarrativePrompt constructs the AI prompt for narrating what-if consequences.
func FormatMarkdown ¶
FormatMarkdown renders a complete Markdown what-if report suitable for stdout.
Types ¶
type Report ¶
type Report struct {
Scenario string `json:"scenario"`
// Before state
BeforeForecast *forecast.Forecast `json:"before_forecast"`
// After (mutated) state
MutatedPlan *pm.Plan `json:"mutated_plan"`
AfterForecast *forecast.Forecast `json:"after_forecast"`
// Structural diff
TasksAdded []*pm.Task `json:"tasks_added,omitempty"`
TasksRemoved []*pm.Task `json:"tasks_removed,omitempty"`
TasksChanged []TaskChange `json:"tasks_changed,omitempty"`
// AI narrative
Narrative string `json:"narrative"`
// Removed tasks flagged by planedit
RemovedTaskWarnings []*pm.Task `json:"removed_task_warnings,omitempty"`
}
Report holds the full what-if analysis — before/after forecasts, structural diff, and the AI narrative.
func Run ¶
func Run(ctx context.Context, prov provider.Provider, opts provider.Options, s *state.ProjectState, scenario string, streamFn func(string)) (*Report, error)
Run executes the full what-if pipeline:
- Clone plan.
- Apply mutation via AI (using planedit).
- Build before/after forecasts (no AI).
- Build diff.
- Generate AI narrative (streamed via streamFn).
Click to show internal directories.
Click to hide internal directories.