toolcmd

package
v0.126.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package toolcmd reads the command a tool call ran out of the input it was stored with, for every place in the daemon that describes a call in one line: the Now screen's phrase, a notification's subject, a loop alert's sample, a subagent's current call.

Codex is the reason it exists. Its `exec` tool does not run a command: it runs a JavaScript script that calls Codex's own tools — `tools.exec_command({cmd: "git status"})` for a shell command, `tools.apply_patch(…)` for an edit — and the script is what the call carries under `command`. Shown as sent, every one of those lines read as a wall of JavaScript. The chat reads the command out (ui/src/lib/chat.ts codexScript); this is the same reading for the daemon, and the two must say the same thing (testdata in toolcmd_test.go and chat.test.ts match).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(tool, command string) string

Command is the command line a call's stored `command` stands for: for Codex's `exec`, what its script ran (Script); a Codex input stored before the daemon unwrapped it — the arguments' JSON string under `command`, a `shell` argv inside — read as it is stored now; anything else as it is.

func Script

func Script(script string) (line string, ok bool)

Script is what a Codex `exec` script ran, as one line: the first line of the shell command it passed to `tools.exec_command`, `apply_patch <file>` for a patch, else the name of the tool it called (`web__run`). ok is false when the script calls no tool at all.

func ScriptCall

func ScriptCall(script string) (tool, arg string, ok bool)

ScriptCall is the first of Codex's tools a script calls and what it was given, where that can be read: the first line of `exec_command`'s `cmd`, the file an `apply_patch` patches; "" otherwise. ok is false when the script calls no tool.

func ShellLine

func ShellLine(argv []string) string

ShellLine is the line an argv runs: the script of `<shell> -lc <script>`, how Codex runs nearly everything, else the words joined with spaces.

Types

This section is empty.

Jump to

Keyboard shortcuts

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