zuke.tools._tooling
The settings every wrapper's settings extend: @zuke/core's tooling base.
zuke on PyPI ↗ 3 symbols
Symbols
class DynamicToolSettings(ToolSettings) Fluent settings for a defineTool tool: build the argv with DynamicToolSettings.arg/DynamicToolSettings.flag/DynamicToolSettings.option (in call order), plus all the shared chainers (cwd, env, noThrow, quiet, toolPath, args).
-
arg(*values: str | float) -> SelfAppend raw positional/argument tokens.
-
flag(name: str) -> SelfAppend a boolean flag, e.g.
flag("verbose")→--verbose(or-v). -
option(name: str, value: str | float) -> SelfAppend a flag and its value as two tokens, e.g.
--output dist.
class SubcommandSettings(ToolSettings) Base for a wrapper over a CLI organised into subcommand groups — a command path built with command plus repeatable --flag [value] options built with flag. The agent and cloud wrappers (gh, gcloud, claude, gemini, codex) share this shape; each sets its binary via ToolSettings.defaultTool and, when needed, a fixed prefix via leadingTokens or between-command global flags via middleTokens.
The argv is assembled as [...leadingTokens(), ...command, ...middleTokens(), ...flags], keeping every token a discrete argv entry so command construction stays injection-free.
-
command(*parts: str | float) -> SelfAppend command-path tokens — the group, verb, and operands — in order.
-
flag(name: str, value: str | float | None=None) -> SelfAdd an arbitrary flag. With a value it renders
--name value; without one the bare--name. Repeatable.
class ToolSettings(Settings) Abstract fluent base for tool settings. Subclasses provide the binary (defaultTool) and the pure subcommand argv (buildArgs); the base provides the shared chainers and run.
-
env(record: Mapping[str, str]) -> SelfMerge additional environment variables for the process.
-
cwd(path: str) -> SelfSet the working directory for the process.
-
no_throw() -> SelfDo not throw on a non-zero exit; inspect
codeon the output instead. -
quiet() -> SelfSuppress live stdout/stderr streaming to the terminal.
-
kill_after(ms: float) -> SelfKill the tool if it runs longer than
msmilliseconds, raising aCommandTimeoutError. Fires even under noThrow. -
max_captured_bytes(bytes: float) -> SelfCap how much of each captured stream the run keeps in memory, in bytes (default 8 MiB). Once the cap is reached the oldest bytes are dropped,
CommandOutput.truncatedis set, andCommandOutput.textprefixes a notice. Raise it for a tool whose whole output must be parsed — a coverage report, a--jsondump — and lower it to bound a chatty one. Live streaming to the terminal is never capped. -
tool_path(path: str) -> SelfOverride the binary to run (e.g. an absolute path to the tool).
-
from_node_modules() -> SelfResolve the binary npx-style: walk up from the working directory looking for
node_modules/.bin/<tool>, falling back toPATHon a miss. Overrides both the wrapper default and the ambientZUKE_TOOL_RESOLUTION. Has no effect once toolPath is set (an explicit path always wins). -
from_path() -> SelfResolve the binary from
PATHonly, ignoring anynode_modules/.bin. -
args(*extra: str | float) -> SelfEscape hatch: append raw arguments after all typed options.