1+ # Copyright 2025 Cisco Systems, Inc. and its affiliates
2+ #
3+ # SPDX-License-Identifier: Apache-2.0
4+
5+ """
6+ Antigravity Format Implementation
7+
8+ Generates .md workflow files for Google Antigravity with YAML frontmatter.
9+ """
10+
11+ from formats .base import BaseFormat , ProcessedRule
12+
13+
14+ class AntigravityFormat (BaseFormat ):
15+ """
16+ Google Antigravity format implementation (.md workflow files).
17+
18+ Antigravity uses .md files with YAML frontmatter containing:
19+ - description: Rule description (required by Antigravity spec)
20+
21+ Workflows are stored in .agent/workflows/ and can be triggered
22+ on-demand with /workflow-name in the Antigravity interface.
23+ """
24+
25+ def get_format_name (self ) -> str :
26+ """Return Antigravity format identifier."""
27+ return "antigravity"
28+
29+ def get_file_extension (self ) -> str :
30+ """Return Antigravity format file extension."""
31+ return ".md"
32+
33+ def get_output_subpath (self ) -> str :
34+ """Return Antigravity output subdirectory."""
35+ return ".agent/rules"
36+
37+ def generate (self , rule : ProcessedRule , globs : str ) -> str :
38+ """
39+ Generate Antigravity .md format with YAML frontmatter.
40+
41+ Args:
42+ rule: The processed rule to format
43+ globs: Glob patterns for file matching (not used by Antigravity)
44+
45+ Returns:
46+ Formatted .md content with minimal frontmatter
47+
48+ 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.
52+ """
53+ yaml_lines = []
54+
55+ # Add description (required by Antigravity spec)
56+ desc = self ._format_yaml_field ("description" , rule .description )
57+ if desc :
58+ 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 } " )
65+
66+ return self ._build_yaml_frontmatter (yaml_lines , rule .content )
0 commit comments