file

Stage file changes for the next contree run. Pending files are automatically included without needing --file flags.

Examples

# Edit a file from the image in $EDITOR
contree file edit /etc/nginx/nginx.conf

# Stage a local file at a specific path
contree file cp ./config.yaml /etc/app/config.yaml

# Both edits apply on the next run
contree run nginx -t

Help output

$ contree file --help usage: contree file [-h] {edit,e,cp} ... Manage files in the session image. Subcommands:   edit (e)  Download a file from the session image, open it in $EDITOR             (or vi), and upload the modified version as a pending file             attachment. The change takes effect on the next `run`.   cp        Copy a local file into the session image as a pending file             attachment. The file is uploaded immediately but injected             into the sandbox on the next `run`. Pending files are branch-aware — switching branches changes which files are visible. positional arguments:   {edit,e,cp}     edit (e)   Edit a file in the session image     cp         Copy a local file into the session image options:   -h, --help   show this help message and exit for coding agents:   mutating command (stages pending file changes for next run)   file edit PATH uses local editor and uploads on change   file cp SRC DEST uploads local file and stages DEST path agent note:   Before using this command in an automated workflow, read:     contree agent

Subcommands

file edit

Downloads a file from the session image, opens it in $EDITOR (defaults to vi), and stages the changes if the file was modified. If the file does not exist in the image, an empty file is created.

file cp

Copies a local file and stages it at the given path inside the image. The file is uploaded immediately but only applied to the sandbox on the next contree run.

Pending files

Pending files accumulate until the next contree run consumes them. Explicit --file flags on contree run take priority over pending files at the same path.

Files are uploaded with SHA256 dedup – identical content is not re-uploaded.

See also

  • Working with Files – full tutorial on file injection and editing

  • run – the --file syntax for inline file injection