Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/greentic-bundle-reader"]
resolver = "2"

[workspace.package]
version = "0.4.28"
version = "0.4.29"

[workspace.dependencies]
anyhow = "1"
Expand Down
30 changes: 20 additions & 10 deletions registries/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"i18n_key": "provider.messaging.teams",
"fallback": "MS-Teams"
},
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-teams:latest"
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-teams:latest",
"required_capabilities": ["greentic:state/state-store"]
},
{
"id": "messaging-slack",
Expand All @@ -96,7 +97,8 @@
"i18n_key": "provider.messaging.slack",
"fallback": "Slack"
},
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-slack:latest"
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-slack:latest",
"required_capabilities": ["greentic:state/state-store"]
},
{
"id": "messaging-webex",
Expand All @@ -105,7 +107,8 @@
"i18n_key": "provider.messaging.webex",
"fallback": "WebEx"
},
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-webex:latest"
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-webex:latest",
"required_capabilities": ["greentic:state/state-store"]
},
{
"id": "messaging-webchat",
Expand All @@ -114,7 +117,8 @@
"i18n_key": "provider.messaging.webchat",
"fallback": "WebChat"
},
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-webchat:latest"
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-webchat:latest",
"required_capabilities": ["greentic:state/state-store"]
},
{
"id": "messaging-webchat-gui",
Expand All @@ -123,7 +127,8 @@
"i18n_key": "provider.messaging.webchat-gui",
"fallback": "WebChat (GUI)"
},
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-webchat-gui:latest"
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-webchat-gui:latest",
"required_capabilities": ["greentic:state/state-store"]
},
{
"id": "messaging-whatsapp",
Expand All @@ -132,7 +137,8 @@
"i18n_key": "provider.messaging.whatsapp",
"fallback": "WhatsApp"
},
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-whatsapp:latest"
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-whatsapp:latest",
"required_capabilities": ["greentic:state/state-store"]
},
{
"id": "messaging-telegram",
Expand All @@ -141,7 +147,8 @@
"i18n_key": "provider.messaging.telegram",
"fallback": "Telegram"
},
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-telegram:latest"
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-telegram:latest",
"required_capabilities": ["greentic:state/state-store"]
},
{
"id": "messaging-email",
Expand All @@ -150,7 +157,8 @@
"i18n_key": "provider.messaging.email",
"fallback": "Email"
},
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-email:latest"
"ref": "oci://ghcr.io/greenticai/packs/messaging/messaging-email:latest",
"required_capabilities": ["greentic:state/state-store"]
},
{
"id": "events-webhook",
Expand Down Expand Up @@ -375,7 +383,8 @@
"i18n_key": "provider.state.memory",
"fallback": "In-Memory State"
},
"ref": "oci://ghcr.io/greenticai/packs/state/state-memory:latest"
"ref": "oci://ghcr.io/greenticai/packs/state/state-memory:latest",
"provided_capabilities": ["greentic:state/state-store"]
},
{
"id": "state-redis",
Expand All @@ -384,7 +393,8 @@
"i18n_key": "provider.state.redis",
"fallback": "Redis State"
},
"ref": "oci://ghcr.io/greenticai/packs/state/state-redis:latest"
"ref": "oci://ghcr.io/greenticai/packs/state/state-redis:latest",
"provided_capabilities": ["greentic:state/state-store"]
},
{
"id": "component-pack2flow",
Expand Down
76 changes: 76 additions & 0 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ pub struct UnbundleResult {

pub fn build_workspace(root: &Path, output: Option<&Path>, dry_run: bool) -> Result<BuildResult> {
let state = plan::build_state(root)?;

// Validate pack dependencies at build time.
let dep_warnings = validate_bundle_dependencies(root);
for warning in &dep_warnings {
eprintln!(" [dependency] {warning}");
}

let artifact = output
.map(|path| path.to_path_buf())
.unwrap_or_else(|| default_artifact_path(root, &state.manifest.bundle_id));
Expand Down Expand Up @@ -116,6 +123,8 @@ fn doctor_workspace(root: &Path) -> Result<DoctorReport> {
let drift_ok = lock::lock_matches_manifest(&state.lock, &state.manifest);
let reader_validation = open_workspace_build_dir(root);
let reader_ok = reader_validation.is_ok();
let dep_warnings = validate_bundle_dependencies(root);
let deps_ok = dep_warnings.is_empty();
let checks = vec![
DoctorCheck {
name: "bundle.yaml".to_string(),
Expand Down Expand Up @@ -150,6 +159,15 @@ fn doctor_workspace(root: &Path) -> Result<DoctorReport> {
)
},
},
DoctorCheck {
name: "pack dependencies".to_string(),
ok: deps_ok,
details: if deps_ok {
None
} else {
Some(dep_warnings.join("; "))
},
},
];
Ok(DoctorReport {
target: root.display().to_string(),
Expand Down Expand Up @@ -215,6 +233,64 @@ pub fn unbundle_artifact(artifact: &Path, output_dir: &Path) -> Result<UnbundleR
})
}

/// Validate pack dependencies using catalog metadata.
///
/// Matches extension providers listed in `bundle.yaml` against the bundled
/// catalog registry to check that all `required_capabilities` are satisfied
/// by some other provider in the bundle. Returns human-readable warnings.
fn validate_bundle_dependencies(root: &Path) -> Vec<String> {
let catalog_entries = match crate::catalog::registry::bundled_provider_registry_entries() {
Ok(entries) => entries,
Err(_) => return Vec::new(),
};

// Read the workspace definition to get the list of extension providers.
let workspace = match crate::project::read_bundle_workspace(root) {
Ok(ws) => ws,
Err(_) => return Vec::new(),
};

// Build set of provider IDs present in the bundle.
let included_ids: std::collections::BTreeSet<String> = workspace
.extension_providers
.iter()
.filter_map(|reference| {
catalog_entries
.iter()
.find(|e| e.reference == *reference)
.map(|e| e.id.clone())
})
.collect();

// Also include capabilities provided by included packs.
let mut provided_caps = std::collections::BTreeSet::new();
for entry in &catalog_entries {
if included_ids.contains(&entry.id) {
for cap in &entry.provided_capabilities {
provided_caps.insert(cap.clone());
}
}
}

// Check required capabilities for each included provider.
let mut warnings = Vec::new();
for entry in &catalog_entries {
if !included_ids.contains(&entry.id) {
continue;
}
for cap in &entry.required_capabilities {
if !provided_caps.contains(cap) {
warnings.push(format!(
"{} requires capability '{}' but no provider in the bundle satisfies it",
entry.id, cap,
));
}
}
}

warnings
}

pub fn default_artifact_path(root: &Path, bundle_id: &str) -> PathBuf {
root.join("dist")
.join(format!("{bundle_id}{FUTURE_ARTIFACT_EXTENSION}"))
Expand Down
Loading
Loading