claude

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package claude builds and runs the sandboxed `claude` command: it parses the launcher's arguments, constructs the `nono wrap … claude …` invocation (including the hook settings injected in hook mode), and executes it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildArgs

func BuildArgs(cfg *config.Config, opts Options, snapshotPath string) (string, []string, error)

BuildArgs constructs the nono executable path and the argv used to launch Claude under the sandbox for cfg. In hook mode it grants read-only access to the frozen policy snapshot at snapshotPath and injects the PreToolUse hook via `claude --settings`, routing it through that snapshot; otherwise it disables the Bash and Monitor tools.

func Run

func Run(cfg *config.Config, opts Options) error

Run ensures the sandbox is up, launches Claude under it, and — if this call started the sandbox — tears it down when Claude exits. It replaces the old syscall.Exec approach so the launcher can outlive Claude and run teardown.

func ValidatePassthrough

func ValidatePassthrough(claudeOpts []string) error

ValidatePassthrough rejects claude passthrough options that agent-sandbox reserves for itself (currently --settings, used to inject the hook config).

Types

type Options

type Options struct {
	NonoOpts   []string
	ClaudeOpts []string
}

Options is the split invocation for the claude launcher: options passed through to `nono wrap` and options passed through to `claude`.

func ParseArgs

func ParseArgs(args []string, defaultConfig string) (configFile string, opts Options)

ParseArgs splits the raw args passed to the claude/debug command into the config-file path and the nono/claude passthrough options. The first standalone "--" separates nono options (before) from claude options (after); with no "--", every token is a nono option. A "--config <val>" or "--config=<val>" appearing in the nono region sets the config path and is removed from the nono options. defaultConfig is used when no "--config" is given. This is needed because the command disables cobra flag parsing to pass options verbatim.

Jump to

Keyboard shortcuts

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