pub struct TargetPlan {Show 14 fields
pub clients: Vec<&'static str>,
pub scope: Scope,
pub project_id: Option<String>,
pub project: Option<PathBuf>,
pub kind: EntryKind,
pub file: PathBuf,
pub container: Vec<String>,
pub pointer: String,
pub before: Option<Vec<u8>>,
pub after: Option<Vec<u8>>,
pub entries: Vec<EntryPlan>,
pub problem: Option<CoreError>,
pub warnings: Vec<CoreError>,
pub read_only: Option<ReadOnlyKind>,
/* private fields */
}Expand description
One native file and container.
Fields§
§clients: Vec<&'static str>Every client whose entries go to this container, in table order.
scope: Scope§project_id: Option<String>The project of a project or project-local target.
project: Option<PathBuf>The project folder <P>, when known.
kind: EntryKindServer entries of a container, or members of a list (Claude Code
disabledMcpServers).
file: PathBuf§container: Vec<String>Container keys in the file.
pointer: String§before: Option<Vec<u8>>The file bytes planned against; None when it does not exist.
after: Option<Vec<u8>>The bytes to write; None when the file stays as it is.
entries: Vec<EntryPlan>§problem: Option<CoreError>The whole target is blocked (parse_error, unexpected_shape,
trust_required).
warnings: Vec<CoreError>§read_only: Option<ReadOnlyKind>This account cannot write the file (or create it): what the write
probe found while planning (SPEC 8.2 read_only_target). Entries
that would write it are blocked; the target is listed all the same.
Implementations§
Source§impl TargetPlan
impl TargetPlan
Sourcepub fn counts(&self) -> OpCounts
pub fn counts(&self) -> OpCounts
Counts of planned write actions: create, update, remove, disable.
Sourcepub fn unresolved(&self) -> usize
pub fn unresolved(&self) -> usize
Entries that need a decision that was not given.
Sourcepub fn is_blocked(&self) -> bool
pub fn is_blocked(&self) -> bool
Whether some entry or the whole target is blocked.
Sourcepub fn diff(&self) -> String
pub fn diff(&self) -> String
The change as a unified diff of the file text; empty when the file
stays as it is. Values written by inline delivery are masked
(SPEC 8.3).
Sourcepub fn mask(&self, text: &str) -> String
pub fn mask(&self, text: &str) -> String
text with every value to hide replaced, as written and as a JSON
or TOML string escape: the inline values this plan writes become
********; the values an inline entry holds now that this plan does
not write again (a rotation, a mode change, a removal) become
******** (before), so a changed value still shows as a change.
Values shorter than four characters are left alone: masking them
would garble the diff without hiding anything.
Sourcepub fn snippet(&self, name: &str, value: &NativeValue) -> Option<String>
pub fn snippet(&self, name: &str, value: &NativeValue) -> Option<String>
Entry name with native value value, alone under the innermost
key of this target’s container, as the file format writes it
({"mcpServers": {...}}, [mcp_servers.x]), with
TargetPlan::mask applied: the snippet the effective view and the
drift resolver show. Outer container keys are left out (Claude
Code’s per-project map is keyed by the folder path). None when the
format cannot hold it.