pub struct ProjectConfig(/* private fields */);Expand description
The main manifest file structure representing a complete agpm.toml file.
This struct encapsulates all configuration for a AGPM project, including
source repositories, installation targets, and resource dependencies.
It provides the foundation for declarative dependency management similar
to Cargo’s Cargo.toml.
§Structure
- Sources: Named Git repositories that can be referenced by dependencies
- Target: Installation directories for different resource types
- Agents: AI agent dependencies (
.mdfiles with agent definitions) - Snippets: Code snippet dependencies (
.mdfiles with reusable code) - Commands: Claude Code command dependencies (
.mdfiles with slash commands)
§Serialization
The struct uses Serde for TOML serialization/deserialization with these behaviors:
- Empty collections are omitted from serialized output for cleaner files
- Default values are automatically applied for missing fields
- Field names match TOML section names exactly
§Thread Safety
This struct is thread-safe and can be shared across async tasks safely.
§Examples
use agpm_cli::manifest::{Manifest, ResourceDependency};
// Create a new empty manifest
let mut manifest = Manifest::new();
// Add a source repository
manifest.add_source(
"community".to_string(),
"https://github.com/claude-community/resources.git".to_string()
);
// Add a dependency
manifest.add_dependency(
"helper".to_string(),
ResourceDependency::Simple("../local/helper.md".to_string()),
true // is_agent = true
);Project-specific template variables for AI coding assistants.
An arbitrary map of user-defined variables that can be referenced in resource templates. This provides maximum flexibility for teams to organize project context however they want, without imposing any predefined structure.
§Use Case: AI Agent Context
When AI agents work on your codebase, they need context about:
- Where to find coding standards and style guides
- What conventions to follow (formatting, naming, patterns)
- Where architecture and design docs are located
- Project-specific requirements (testing, security, performance)
§Template Access
All variables are accessible in templates under the agpm.project namespace.
The structure is completely user-defined.
§Examples
§Flexible Structure - Organize However You Want
[project]
# Top-level variables
style_guide = "docs/STYLE_GUIDE.md"
max_line_length = 100
test_framework = "pytest"
# Nested sections (optional, just for organization)
[project.paths]
architecture = "docs/ARCHITECTURE.md"
conventions = "docs/CONVENTIONS.md"
[project.standards]
indent_style = "spaces"
indent_size = 4§Template Usage
# Code Reviewer
Follow guidelines at: {{ agpm.project.style_guide }}
Max line length: {{ agpm.project.max_line_length }}
Architecture: {{ agpm.project.paths.architecture }}§Any Structure Works
[project]
whatever = "you want"
numbers = 42
arrays = ["work", "too"]
[project.deeply.nested.structure]
is_allowed = trueImplementations§
Source§impl ProjectConfig
impl ProjectConfig
Sourcepub fn to_json_value(&self) -> Value
pub fn to_json_value(&self) -> Value
Convert this ProjectConfig to a serde_json::Value for template rendering.
This method handles conversion of TOML values to JSON values, which is necessary for proper Tera template rendering.
§Examples
use agpm_cli::manifest::ProjectConfig;
let mut config_map = toml::map::Map::new();
config_map.insert("style_guide".to_string(), toml::Value::String("docs/STYLE.md".into()));
let config = ProjectConfig::from(config_map);
let json = config.to_json_value();
// Use json in Tera template contextTrait Implementations§
Source§impl Clone for ProjectConfig
impl Clone for ProjectConfig
Source§fn clone(&self) -> ProjectConfig
fn clone(&self) -> ProjectConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more