Skip to main content

build_turn_metadata_header

Function build_turn_metadata_header 

Source
pub fn build_turn_metadata_header(cwd: &Path) -> Result<String>
Expand description

Build the turn metadata header value for the given working directory.

This function collects git information from the workspace and formats it as a JSON string suitable for use as the X-Turn-Metadata header value.

§Arguments

  • cwd - The working directory to collect metadata from

§Returns

A JSON string containing the turn metadata, or an empty string if metadata collection fails or the directory is not in a git repository.

§Example

use std::path::Path;
use vtcode_core::turn_metadata::build_turn_metadata_header;

let metadata = build_turn_metadata_header(Path::new(".")).unwrap();
// metadata will be a JSON string like:
// {"workspace":{"remote_urls":{"origin":"https://github.com/user/repo.git"},"commit_hash":"abc1234"}}