planmode

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package planmode persists planning state for interactive Codog sessions.

Package planmode stores the workspace-scoped plan-mode state used to keep tool execution read-only until the user exits planning.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path(workspace string) string

Path returns the workspace-local plan-mode state file.

func RenderPrompt

func RenderPrompt(state State) string

RenderPrompt returns the system-prompt fragment that enforces plan-mode behavior, or an empty string when plan mode is inactive.

func RenderText

func RenderText(w io.Writer, report Report)

RenderText writes a human-readable plan-mode report.

Types

type Report

type Report struct {
	Kind        string `json:"kind"`
	Action      string `json:"action"`
	Status      string `json:"status"`
	Path        string `json:"path"`
	State       State  `json:"state"`
	Opened      bool   `json:"opened,omitempty"`
	Editor      string `json:"editor,omitempty"`
	EditorError string `json:"editor_error,omitempty"`
}

Report describes a plan-mode operation and the resulting workspace state.

func Clear

func Clear(workspace string) (Report, error)

Clear removes any persisted plan-mode state for the workspace.

func Enter

func Enter(workspace string, plan string) (Report, error)

Enter activates plan mode and optionally records plan text.

func Exit

func Exit(workspace string) (Report, error)

Exit deactivates plan mode while preserving the last stored plan.

func Set

func Set(workspace string, plan string) (Report, error)

Set replaces the stored plan text and keeps plan mode active.

func Show

func Show(workspace string) (Report, error)

Show returns the current plan-mode state without mutating it.

type State

type State struct {
	Active    bool   `json:"active"`
	Plan      string `json:"plan,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
	ExitedAt  string `json:"exited_at,omitempty"`
}

State is the persisted plan-mode state for one workspace.

func Load

func Load(workspace string) (State, error)

Load reads the persisted plan-mode state, returning an inactive state when no plan file exists.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL