@@ -16,10 +16,14 @@ class AntigravityFormat(BaseFormat):
1616 Google Antigravity format implementation (.md rule files).
1717
1818 Antigravity uses .md files with YAML frontmatter containing:
19- - description: Rule description (required by Antigravity spec)
19+ - trigger: 'always_on' or 'glob' (activation type)
20+ - globs: (if trigger is 'glob') File matching patterns
21+ - description: Rule description
22+ - version: Rule version
2023
21- Rules are stored in .agent/rules/ and can be triggered
22- on-demand with /rule-name in the Antigravity interface.
24+ Rules use activation types (Always On or Glob) to determine when
25+ they apply, similar to Windsurf's implementation.
26+ See: https://antigravity.google/docs/rules-workflows
2327 """
2428
2529 def get_format_name (self ) -> str :
@@ -40,27 +44,31 @@ def generate(self, rule: ProcessedRule, globs: str) -> str:
4044
4145 Args:
4246 rule: The processed rule to format
43- globs: Glob patterns for file matching (not used by Antigravity)
47+ globs: Glob patterns for file matching
4448
4549 Returns:
46- Formatted .md content with minimal frontmatter
50+ Formatted .md content with trigger, globs, description, and version
4751
4852 Note:
49- Antigravity workflows use simple markdown with description-only
50- frontmatter. Language/glob information is not needed as workflows
51- are triggered manually by the user.
53+ Antigravity rules use activation types:
54+ - 'always_on': Rule applies to all files (when alwaysApply is true)
55+ - 'glob': Rule applies to files matching glob patterns (language-specific)
5256 """
5357 yaml_lines = []
5458
59+ # Use trigger: always_on for rules that should always apply
60+ if rule .always_apply :
61+ yaml_lines .append ("trigger: always_on" )
62+ else :
63+ yaml_lines .append ("trigger: glob" )
64+ yaml_lines .append (f"globs: { globs } " )
65+
5566 # Add description (required by Antigravity spec)
5667 desc = self ._format_yaml_field ("description" , rule .description )
5768 if desc :
5869 yaml_lines .append (desc )
59-
60- # Optional: Add tags for categorization (if Antigravity supports it)
61- if rule .tags :
62- yaml_lines .append ("tags:" )
63- for tag in rule .tags :
64- yaml_lines .append (f"- { tag } " )
6570
66- return self ._build_yaml_frontmatter (yaml_lines , rule .content )
71+ # Add version
72+ yaml_lines .append (f"version: { self .version } " )
73+
74+ return self ._build_yaml_frontmatter (yaml_lines , rule .content )
0 commit comments