pub struct PrivateLockFile {
pub version: u32,
pub agents: Vec<PrivateLockedResource>,
pub snippets: Vec<PrivateLockedResource>,
pub commands: Vec<PrivateLockedResource>,
pub scripts: Vec<PrivateLockedResource>,
pub mcp_servers: Vec<PrivateLockedResource>,
pub hooks: Vec<PrivateLockedResource>,
}
Expand description
Private lockfile tracking user-level patches.
This file is gitignored and contains patches from agpm.private.toml
only.
It works alongside agpm.lock
to provide full reproducibility while keeping
team lockfiles deterministic.
Uses the same array-based format as agpm.lock
for consistency.
Fields§
§version: u32
Lockfile format version
agents: Vec<PrivateLockedResource>
Private patches for agents
snippets: Vec<PrivateLockedResource>
Private patches for snippets
commands: Vec<PrivateLockedResource>
Private patches for commands
scripts: Vec<PrivateLockedResource>
Private patches for scripts
mcp_servers: Vec<PrivateLockedResource>
Private patches for MCP servers
hooks: Vec<PrivateLockedResource>
Private patches for hooks
Implementations§
Source§impl PrivateLockFile
impl PrivateLockFile
Sourcepub fn load(project_dir: &Path) -> Result<Option<Self>>
pub fn load(project_dir: &Path) -> Result<Option<Self>>
Load private lockfile from disk.
Returns Ok(None)
if the file doesn’t exist (no private patches).
§Example
use agpm_cli::lockfile::private_lock::PrivateLockFile;
use std::path::Path;
let project_dir = Path::new(".");
match PrivateLockFile::load(project_dir)? {
Some(lock) => println!("Loaded {} private patches", lock.total_patches()),
None => println!("No private lockfile found"),
}
Sourcepub fn save(&self, project_dir: &Path) -> Result<()>
pub fn save(&self, project_dir: &Path) -> Result<()>
Save private lockfile to disk.
Deletes the file if the lockfile is empty (no private patches).
§Example
use agpm_cli::lockfile::private_lock::PrivateLockFile;
use std::path::Path;
let mut lock = PrivateLockFile::new();
// ... add patches ...
lock.save(Path::new("."))?;
Sourcepub fn total_patches(&self) -> usize
pub fn total_patches(&self) -> usize
Count total number of resources with private patches.
Sourcepub fn add_private_patches(
&mut self,
resource_type: &str,
name: &str,
patches: HashMap<String, Value>,
)
pub fn add_private_patches( &mut self, resource_type: &str, name: &str, patches: HashMap<String, Value>, )
Add private patches for a resource.
If patches is empty, this is a no-op. If a resource with the same name already exists, its patches are replaced.
§Example
use agpm_cli::lockfile::private_lock::PrivateLockFile;
use std::collections::HashMap;
let mut lock = PrivateLockFile::new();
let patches = HashMap::from([
("model".to_string(), toml::Value::String("haiku".into())),
]);
lock.add_private_patches("agents", "my-agent", patches);
Trait Implementations§
Source§impl Clone for PrivateLockFile
impl Clone for PrivateLockFile
Source§fn clone(&self) -> PrivateLockFile
fn clone(&self) -> PrivateLockFile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more