Documentation
¶
Overview ¶
claude.go builds the claude -p command for job execution. It embeds task-preamble.txt and summary-prompt.txt via //go:embed, constructs the full prompt (preamble + user prompt + optional summary injection), and assembles CLI flags (--model, --permission-mode bypassPermissions, --output-format json, --effort, --no-session-persistence). The prompt is passed via stdin to avoid OS argument length limits and process list exposure. BuildCommand returns an exec.Cmd ready to run, and BuildResult holds the combined prompt text along with the constructed command.
executor.go orchestrates the full lifecycle of a scheduled job execution. Run validates the working directory, creates a database log entry, sets up stdout/stderr capture files, applies a context timeout, builds and runs the claude command, determines the result status (success, failed, or timeout), parses JSON usage data from stdout, and updates the database log with the outcome. It also defines the claudeOutput struct for JSON parsing, the Result struct returned to callers, and the parseUsage helper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildResult ¶
BuildResult holds the constructed command and any metadata from the build process.
func BuildCommand ¶
BuildCommand constructs the `claude -p` command for a job.
type Result ¶
type Result struct {
ExitCode int
StdoutPath string
StderrPath string
SummaryPath string // path to summary file (if summary_enabled)
Output string // claude's result text from JSON output
Status string
ErrorMsg string
Duration time.Duration
CostUSD float64
InputTokens int
OutputTokens int
CacheReadTokens int
CacheCreationTokens int
}
Result captures the outcome of a job execution.