MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / from_current

Method from_current

crates/opencode-session/src/system.rs:127–141  ·  view source on GitHub ↗

Build from the current runtime environment.

(
        model_api_id: impl Into<String>,
        provider_id: impl Into<String>,
        working_directory: impl Into<String>,
    )

Source from the content-addressed store, hash-verified

125impl EnvironmentContext {
126 /// Build from the current runtime environment.
127 pub fn from_current(
128 model_api_id: impl Into<String>,
129 provider_id: impl Into<String>,
130 working_directory: impl Into<String>,
131 ) -> Self {
132 let wd: String = working_directory.into();
133 let is_git = std::path::Path::new(&wd).join(".git").exists();
134 Self {
135 model_api_id: model_api_id.into(),
136 provider_id: provider_id.into(),
137 working_directory: wd,
138 is_git_repo: is_git,
139 platform: std::env::consts::OS.to_string(),
140 }
141 }
142}
143
144fn trim_for_prompt(input: &str, max_chars: usize) -> (&str, bool) {

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected