# Bootstrap scripts and extensions

Source: https://libtmux.org/en/csharp/latest/workspace/configuration/hooks/

> Run a checked bootstrap process before workspace commands.

Use `before_script` when setup must finish successfully before configured
windows are built. The command is split into an executable and arguments;
shell operators require an explicit shell.

```yaml title="hooks.yaml"
session_name: hooks-example
before_script: /bin/sh -c 'printf bootstrap-ready'
windows:
  - window_name: shell
    panes: [null]
```

The CLI checks the child process status. A failure stops that workspace's
build. The result describes retained effects; an earlier input or borrowed
session can still exist. A pane's `shell_command` only sends input and does
not provide this process-status guarantee.

## Paths and output

A relative script path beginning with `.` is resolved from the workspace file.
The script's working directory uses the configured session directory when
present, otherwise the invocation directory. The script runs before workspace
pane commands. Reusing an existing session does not replay its bootstrap.

Machine output captures or streams child output through the CLI protocol.
Read [output](https://libtmux.org/en/csharp/latest/workspace/reference/output/) before parsing bootstrap records.

## Prompt readiness

The `pane_readiness` setting under `workspace_builder_options` accepts `auto`,
`always` or `never`.
It controls a bounded wait before initial pane input. It does not wait for a
server process to accept connections. Commands can still be delivered when
the prompt wait expires.

## Optional extensions

Nonempty `plugins` or `workspace_builder` values select the optional Python
extension runtime. Set `TMUX_WORKSPACE_PYTHON` to an interpreter with a compatible
tmuxp 1.74 installation. Ordinary documents use the native builder.

Extensions run executable code and can make changes outside the CLI's own
tracked operations. Inspect reported effects and errors before retrying them.

[CLI source](https://github.com/libtmux/libtmux-dotnet/blob/f77fe776ba67a04abb20ddbbc26cf4a000d63b74/src/LibTmux.Workspace.Cli/README.md).
