Class: AntigravityFormatter¶
Defined in: formatters/src/formatters/antigravity.ts:63
Formatter for Google Antigravity rules. Outputs: .agent/rules/project.md
Antigravity Rules are stored as Markdown files in .agent/rules/ folder. Each rule can be manually activated, always on, model-decided, or glob-based.
Supports two versions: - simple (default): Plain Markdown without frontmatter - frontmatter: Markdown with YAML frontmatter for activation type
Supports output convention: - 'markdown': Uses Markdown headers and formatting (default, only supported convention)
Example¶
# Simple format (default)
targets:
- antigravity
# Frontmatter format with activation
targets:
- antigravity:
version: frontmatter
Extends¶
Constructors¶
Constructor¶
new AntigravityFormatter():
AntigravityFormatter
Returns¶
AntigravityFormatter
Inherited from¶
Properties¶
defaultConvention¶
readonlydefaultConvention:"markdown"='markdown'
Defined in: formatters/src/formatters/antigravity.ts:67
Default convention for this formatter
Overrides¶
BaseFormatter.defaultConvention
description¶
readonlydescription:"Google Antigravity rules (Markdown)"='Google Antigravity rules (Markdown)'
Defined in: formatters/src/formatters/antigravity.ts:66
Human-readable description
Overrides¶
name¶
readonlyname:"antigravity"='antigravity'
Defined in: formatters/src/formatters/antigravity.ts:64
Unique formatter identifier
Overrides¶
outputPath¶
readonlyoutputPath:".agent/rules/project.md"='.agent/rules/project.md'
Defined in: formatters/src/formatters/antigravity.ts:65
Default output file path
Overrides¶
standardsExtractor¶
protectedreadonlystandardsExtractor:StandardsExtractor
Defined in: formatters/src/base-formatter.ts:27
Shared standards extractor for consistent extraction across all formatters.
Inherited from¶
BaseFormatter.standardsExtractor
Methods¶
createRenderer()¶
protectedcreateRenderer(options?):ConventionRenderer
Defined in: formatters/src/base-formatter.ts:33
Create a convention renderer for this formatter. Uses the provided convention from options or falls back to the default.
Parameters¶
options?¶
Returns¶
Inherited from¶
dedent()¶
protecteddedent(text):string
Defined in: formatters/src/base-formatter.ts:451
Remove common leading whitespace from all lines (dedent). Handles the case where trim() was already called, causing the first line to lose its indentation while subsequent lines retain theirs. Calculates minimum indent from lines 2+ only.
Parameters¶
text¶
string
Returns¶
string
Inherited from¶
extractSectionWithCodeBlock()¶
protectedextractSectionWithCodeBlock(text,header):string|null
Defined in: formatters/src/base-formatter.ts:175
Safe extraction of a section that contains a header + content + code block + content Avoids ReDoS by using string search instead of backtracking regex. Matches pattern: Header ... ...
Parameters¶
text¶
string
header¶
string
Returns¶
string | null
Inherited from¶
BaseFormatter.extractSectionWithCodeBlock
extractText()¶
protectedextractText(content):string
Defined in: formatters/src/base-formatter.ts:68
Extract text from block content.
Parameters¶
content¶
Returns¶
string
Inherited from¶
findBlock()¶
protectedfindBlock(ast,name):Block|undefined
Defined in: formatters/src/base-formatter.ts:61
Find a block by name, ignoring internal blocks (starting with __).
Parameters¶
ast¶
name¶
string
Returns¶
Block | undefined
Inherited from¶
format()¶
format(
ast,options?):FormatterOutput
Defined in: formatters/src/formatters/antigravity.ts:76
Transform AST to tool-specific format
Parameters¶
ast¶
options?¶
Returns¶
Overrides¶
formatArray()¶
protectedformatArray(arr):string
Defined in: formatters/src/base-formatter.ts:119
Format an array as comma-separated string.
Parameters¶
arr¶
unknown[]
Returns¶
string
Inherited from¶
formatStandardsList()¶
protectedformatStandardsList(items):string[]
Defined in: formatters/src/base-formatter.ts:111
Format standards list from array of values (pass-through). Returns array of strings for rendering as bullet list.
Parameters¶
items¶
Returns¶
string[]
Inherited from¶
BaseFormatter.formatStandardsList
getArrayElements()¶
protectedgetArrayElements(content):Value[]
Defined in: formatters/src/base-formatter.ts:143
Extract array elements from block content.
Parameters¶
content¶
Returns¶
Value[]
Inherited from¶
BaseFormatter.getArrayElements
getMetaField()¶
protectedgetMetaField(ast,key):string|undefined
Defined in: formatters/src/base-formatter.ts:133
Get meta field value as string.
Parameters¶
ast¶
key¶
string
Returns¶
string | undefined
Inherited from¶
getOutputPath()¶
protectedgetOutputPath(options?):string
Defined in: formatters/src/base-formatter.ts:54
Get the output path, respecting options override.
Parameters¶
options?¶
Returns¶
string
Inherited from¶
getPrettierOptions()¶
protectedgetPrettierOptions(options?):Required\<PrettierMarkdownOptions>
Defined in: formatters/src/base-formatter.ts:44
Get resolved Prettier options, merging provided options with defaults.
Parameters¶
options?¶
Returns¶
Required\<PrettierMarkdownOptions>
Inherited from¶
BaseFormatter.getPrettierOptions
getProp()¶
protectedgetProp(content,key):Value|undefined
Defined in: formatters/src/base-formatter.ts:82
Get a specific property from block content.
Parameters¶
content¶
key¶
string
Returns¶
Value | undefined
Inherited from¶
getProps()¶
protectedgetProps(content):Record\<string,Value>
Defined in: formatters/src/base-formatter.ts:96
Get all properties from block content.
Parameters¶
content¶
Returns¶
Record\<string, Value>
Inherited from¶
normalizeMarkdownForPrettier()¶
protectednormalizeMarkdownForPrettier(content):string
Defined in: formatters/src/base-formatter.ts:203
Normalize markdown content to match Prettier formatting. - Strips common leading indentation from lines - Trims trailing whitespace from lines - Normalizes markdown table formatting - Adds blank lines before lists when preceded by text - Adds blank lines before code blocks when preceded by text - Escapes markdown special characters in paths
Parameters¶
content¶
string
Returns¶
string
Inherited from¶
BaseFormatter.normalizeMarkdownForPrettier
stripAllIndent()¶
protectedstripAllIndent(content):string
Defined in: formatters/src/base-formatter.ts:347
Strip all leading indentation from markdown content. Used for AGENTS.md where content from multiple sources has inconsistent indentation. Preserves indentation inside code blocks.
Parameters¶
content¶
string
Returns¶
string
Inherited from¶
truncate()¶
protectedtruncate(str,max):string
Defined in: formatters/src/base-formatter.ts:126
Truncate string to max length with ellipsis.
Parameters¶
str¶
string
max¶
number
Returns¶
string
Inherited from¶
valueToString()¶
protectedvalueToString(value):string
Defined in: formatters/src/base-formatter.ts:153
Convert value to string representation.
Parameters¶
value¶
Returns¶
string
Inherited from¶
getSupportedVersions()¶
staticgetSupportedVersions():object
Defined in: formatters/src/formatters/antigravity.ts:72
Get supported versions for this formatter.
Returns¶
object
frontmatter¶
readonlyfrontmatter:object
frontmatter.description¶
readonlydescription:"Markdown with YAML frontmatter for activation"='Markdown with YAML frontmatter for activation'
frontmatter.name¶
readonlyname:"frontmatter"='frontmatter'
frontmatter.outputPath¶
readonlyoutputPath:".agent/rules/project.md"='.agent/rules/project.md'
simple¶
readonlysimple:object
simple.description¶
readonlydescription:"Plain Markdown without frontmatter"='Plain Markdown without frontmatter'
simple.name¶
readonlyname:"simple"='simple'
simple.outputPath¶
readonlyoutputPath:".agent/rules/project.md"='.agent/rules/project.md'