provenance: env var based tagging via POC_PROVENANCE
upsert() now checks POC_PROVENANCE env var for provenance label, falling back to Manual. This lets external callers (Claude sessions, scripts) tag writes without needing to use the internal upsert_provenance() API. Add from_env() and from_label() to Provenance for parsing.
This commit is contained in:
parent
d3075dc235
commit
5e78e5be3f
2 changed files with 30 additions and 1 deletions
|
|
@ -29,8 +29,12 @@ impl Store {
|
|||
|
||||
/// Upsert a node: update if exists (and content changed), create if not.
|
||||
/// Returns: "created", "updated", or "unchanged".
|
||||
///
|
||||
/// Provenance is determined by the POC_PROVENANCE env var if set,
|
||||
/// otherwise defaults to Manual.
|
||||
pub fn upsert(&mut self, key: &str, content: &str) -> Result<&'static str, String> {
|
||||
self.upsert_provenance(key, content, Provenance::Manual)
|
||||
let prov = Provenance::from_env().unwrap_or(Provenance::Manual);
|
||||
self.upsert_provenance(key, content, prov)
|
||||
}
|
||||
|
||||
/// Upsert with explicit provenance (for agent-created nodes).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue