Skip to content
Merged
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
17 changes: 15 additions & 2 deletions validate-a2ml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,25 @@ validate_a2ml() {
is_manifest=true
fi

if [[ "$has_identity" == "false" && "$is_manifest" == "false" ]]; then
# Contractile-shape A2ML files use `@directive:` syntax instead of
# TOML `key = value`. Trustfile.a2ml, Intentfile.a2ml, Mustfile.a2ml,
# Adjustfile.a2ml etc. are policy / trust / intent / abstract files
# whose identity is implicit in their @-prefixed directives
# (`@trust-level`, `@intent`, ...) rather than a TOML name/version
# pair. Treating them as manifest-shape produces 100% false positives —
# they're a different A2ML doc type. Detected by the presence of any
# contractile directive in the file body.
local is_contractile_shape=false
if grep -qE '^@(abstract|trust-level|trust-boundary|trust-actions|trust-deny|intent|must|adjust|end)([[:space:]]*:|$)' "$file"; then
is_contractile_shape=true
fi

if [[ "$has_identity" == "false" && "$is_manifest" == "false" && "$is_contractile_shape" == "false" ]]; then
report_issue "error" "$file" 1 \
"Missing required identity field (agent-id, name, or project)"
fi

if [[ "$has_version" == "false" && "$is_manifest" == "false" ]]; then
if [[ "$has_version" == "false" && "$is_manifest" == "false" && "$is_contractile_shape" == "false" ]]; then
report_issue "warning" "$file" 1 \
"Missing version or schema_version field"
fi
Expand Down
Loading