Skip to content

Commit 45c47ef

Browse files
add feature support of antigravity,with unit test and integration test, with make changes in supported files
1 parent e7ee93e commit 45c47ef

5 files changed

Lines changed: 79 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Get started in minutes:
5454
## How It Works
5555

5656
1. **Security rules** are written in unified markdown format (`sources/` directory)
57-
2. **Conversion tools** translate rules to IDE-specific formats (Cursor, Windsurf, Copilot, Claude Code)
57+
2. **Conversion tools** translate rules to IDE-specific formats (Cursor, Windsurf, Copilot, Claude Code,antigravity)
5858
3. **Release automation** packages rules into downloadable ZIP files
5959
4. **AI assistants** reference these rules when generating or reviewing code
6060
5. **Secure code** is produced automatically without developer intervention

docs/getting-started.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Before you begin, familiarize yourself with how rules work in your IDE:
3131

3232
:material-book-open-page-variant: [GitHub Copilot Instructions](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions)
3333

34+
=== "Google AntiGravity"
35+
Google AntiGravity uses `.agent/rules` for rule configuration.
36+
37+
:material-book-open-page-variant: [Google AntiGravity Instructions](https://codelabs.developers.google.com/getting-started-google-antigravity#6)
38+
3439
## Installation
3540

3641
### Option 1: Download Pre-built Rules (Recommended)
@@ -95,6 +100,7 @@ uv run python src/convert_to_ide_formats.py --source core owasp
95100
cp -r dist/.cursor/ /path/to/your/project/
96101
cp -r dist/.windsurf/ /path/to/your/project/
97102
cp -r dist/.github/ /path/to/your/project/
103+
cp -r dist/.agent/ /path/to/your/project/
98104
```
99105

100106
## Verify Installation
@@ -103,6 +109,8 @@ After installation, your project structure should include:
103109

104110
```
105111
your-project/
112+
├── .agent/
113+
│ └── rules/
106114
├── .cursor/
107115
│ └── rules/
108116
├── .windsurf/

src/convert_to_ide_formats.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import defaultdict
1717

1818
from converter import RuleConverter
19-
from formats import CursorFormat, WindsurfFormat, CopilotFormat, ClaudeCodeFormat
19+
from formats import CursorFormat, WindsurfFormat, CopilotFormat, ClaudeCodeFormat, AntigravityFormat
2020
from utils import get_version_from_pyproject
2121
from validate_versions import set_plugin_version, set_marketplace_version
2222

@@ -128,6 +128,7 @@ def convert_rules(input_path: str, output_dir: str = "dist", include_claudecode:
128128
CursorFormat(version),
129129
WindsurfFormat(version),
130130
CopilotFormat(version),
131+
AntigravityFormat(version),
131132
]
132133

133134
# Only include Claude Code for core rules (committed plugin)

src/formats/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from formats.windsurf import WindsurfFormat
3131
from formats.copilot import CopilotFormat
3232
from formats.claudecode import ClaudeCodeFormat
33+
from formats.antigravity import AntigravityFormat
3334

3435
__all__ = [
3536
"BaseFormat",
@@ -38,4 +39,5 @@
3839
"WindsurfFormat",
3940
"CopilotFormat",
4041
"ClaudeCodeFormat",
42+
"AntigravityFormat",
4143
]

src/formats/antigravity.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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

Comments
 (0)