dryrun

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPreviewArgs added in v0.6.0

func BuildPreviewArgs(args map[string]any) map[string]any

BuildPreviewArgs extracts all keys ending in "_id" except "workspace_id" from args and returns a new map containing only those fields.

func Enabled

func Enabled(args map[string]any) bool

func MinimalResult

func MinimalResult(toolName string, args map[string]any) map[string]any

MinimalResult produces a dry-run envelope when no preview data is available.

func NotDestructiveError added in v0.6.0

func NotDestructiveError(toolName string) error

NotDestructiveError returns an error for non-destructive tools that received a dry_run flag.

func NotSupported added in v0.6.0

func NotSupported(tool string) error

func Preview

func Preview(tool string, args map[string]any) map[string]any

func PreviewToolFor added in v0.6.0

func PreviewToolFor(toolName string) (string, bool)

PreviewToolFor returns the GET counterpart for a destructive tool.

func WrapResult

func WrapResult(result any, toolName string) map[string]any

WrapResult wraps an API result in a dry-run envelope.

Types

type Action added in v0.6.0

type Action int
const (
	ConfirmPattern  Action = iota // remove confirm flag and return a minimal preview envelope without executing the handler
	PreviewTool                   // call GET counterpart instead of DELETE
	MinimalFallback               // echo parameters, no API call
	NotDestructive                // error: dry_run on non-destructive tool
)

func CheckDryRun added in v0.6.0

func CheckDryRun(toolName string, args map[string]any, isDestructive bool) (Action, bool)

CheckDryRun inspects args for a dry_run flag and determines the interception strategy for destructive tools. For non-destructive tools, it leaves the flag in args and returns (0, false) so the handler's own dry-run logic can run. For destructive tools, it consumes the flag and returns the appropriate interception action.

type Config added in v0.6.0

type Config struct {
	Enabled bool
}

func ConfigFromEnv added in v0.6.0

func ConfigFromEnv() Config

ConfigFromEnv reads CLOCKIFY_DRY_RUN. Enabled by default. Set to "off", "disabled", "0", or "false" to disable.

Jump to

Keyboard shortcuts

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