MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / build_provenance

Method build_provenance

atomic-cli/src/commands/record/provenance.rs:80–91  ·  view source on GitHub ↗

Build AI provenance from CLI flags and environment variables. The shared parts (see [`Self::authorship_parts`]), plus the fields only the local body carries today (cost): the wire carries the parts; this fills what only a local caller knows.

(&self)

Source from the content-addressed store, hash-verified

78 /// only the local body carries today (cost): the wire carries the
79 /// parts; this fills what only a local caller knows.
80 pub(super) fn build_provenance(&self) -> Option<Provenance> {
81 let mut provenance = Provenance::from_authorship_parts(&self.authorship_parts()?);
82 let cost = self.ai_cost_usd.or_else(|| {
83 std::env::var("ATOMIC_AI_COST_USD")
84 .ok()
85 .and_then(|s| s.parse().ok())
86 });
87 if let Some(cost_usd) = cost {
88 provenance.cost = Cost::from_usd(cost_usd);
89 }
90 Some(provenance)
91 }
92
93 /// Build RecordOptions from command-line arguments.
94 pub(super) fn build_options(&self) -> CliResult<RecordOptions> {

Calls 3

authorship_partsMethod · 0.80
okMethod · 0.45
parseMethod · 0.45