bashkit

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(bashScript string) error

Check inspects bashScript and returns an error if it ought not be executed. Check DOES NOT PROVIDE SECURITY against malicious actors. It is intended to catch straightforward mistakes in which a model does things despite having been instructed not to do them.

func ExtractCommands

func ExtractCommands(command string) ([]string, error)

ExtractCommands parses a bash command and extracts individual command names that are candidates for auto-installation.

Returns only simple command names (no paths, no builtins, no variable assignments) that could potentially be missing tools that need installation.

Filtering logic: - Excludes commands with paths (./script.sh, /usr/bin/tool, ../build.sh) - Excludes shell builtins (echo, cd, test, [, etc.) - Excludes variable assignments (FOO=bar) - Deduplicates repeated command names

Examples:

"ls -la && echo done" → ["ls"] (echo filtered as builtin)
"./deploy.sh && curl api.com" → ["curl"] (./deploy.sh filtered as path)
"yamllint config.yaml" → ["yamllint"] (candidate for installation)

func ResetSketchWipWarning added in v0.0.17

func ResetSketchWipWarning()

ResetSketchWipWarning resets the warning state for testing purposes

func WillRunGitCommit

func WillRunGitCommit(bashScript string) (bool, error)

WillRunGitCommit checks if the provided bash script will run 'git commit'. It returns true if any command in the script is a git commit command.

Types

This section is empty.

Jump to

Keyboard shortcuts

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