Documentation
¶
Overview ¶
Package coding assembles the reusable local coding-agent tool bundle.
The package is intentionally a thin SDK layer over the lower-level filesystem, shell, git, and executor primitives. Products such as Peggy should configure this package instead of owning coding-agent tool wiring directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultAllowedBinaries = []string{"go", "git", "make", "node", "npm", "python", "python3"}
DefaultAllowedBinaries is the conservative shell_exec allowlist used when Options.AllowedBinaries is empty.
Functions ¶
func ExpandPath ¶
ExpandPath resolves leading "~" plus "$HOME" and "${HOME}" placeholders. Other environment variables are deliberately left untouched.
func NormalizeAllowedBinaries ¶
NormalizeAllowedBinaries trims, drops empties, and deduplicates a shell binary allowlist while preserving first-seen order.
Types ¶
type Options ¶
type Options struct {
// Enabled gates the whole bundle. Disabled returns no tools and does
// not validate the rest of the options.
Enabled bool
// WorkDir is the workspace root for every tool. Empty uses the
// process working directory. Leading ~ and $HOME are expanded.
WorkDir string
// AllowedBinaries is the shell_exec basename allowlist. Empty falls
// back to DefaultAllowedBinaries.
AllowedBinaries []string
// AllowOverwrite is the host-level write_file overwrite policy.
AllowOverwrite bool
// Executor runs shell_exec commands. Nil uses glue.LocalExecutor.
Executor glue.Executor
// Env is the exact child process environment for shell_exec. Nil
// means the child inherits no environment.
Env []string
// Blocklist refuses secret-shaped paths for read_file and write_file.
// Nil uses tools/fs.Default().
Blocklist toolsfs.Blocklist
// ReadMaxBytes caps read_file output. Zero uses the fs package default.
ReadMaxBytes int
// WriteMaxBytes caps write_file content. Zero uses the fs package default.
WriteMaxBytes int
// ShellTimeout caps shell_exec calls. Zero uses the shell package default.
ShellTimeout time.Duration
// ShellMaxOutputBytes caps shell_exec stdout and stderr independently.
// Zero uses the glue executor default.
ShellMaxOutputBytes int
// GitDefaultBase is the default base ref for git_diff_branch and
// git_log_branch. Empty uses the git package default.
GitDefaultBase string
// GitDiffMaxBytes caps git_diff_branch output. Zero uses the git
// package default.
GitDiffMaxBytes int
// GitLogLimit caps git_log_branch commit count. Zero uses the git
// package default.
GitLogLimit int
// GitTimeout caps each git invocation. Zero uses the git package default.
GitTimeout time.Duration
}
Options configures the reusable coding-agent tool bundle.
func ResolveOptions ¶
ResolveOptions validates and fills defaults for enabled coding tools.
func Tools ¶
Tools builds the standard local coding tool bundle: read_file, write_file, edit_file, list_dir, find_files, grep, shell_exec, git_diff_branch, and git_log_branch.
The returned Options contain the resolved absolute WorkDir, normalized AllowedBinaries, copied Env, and effective Blocklist.