Skip to content

fix(antigravity-plugin): give the plugin root rule an always_on trigger - #3546

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-issue-2666
Oct 18, 2026
Merged

dyoshikawa merged 2 commits into
mainfrom
resolve-issue-2666

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Antigravity requires a valid trigger on every .md file inside a rules/ directory (https://antigravity.google/docs/rules), and since CLI 1.4.1 agy plugin validate, which uses the loader's own rules (1.4.0), reports a plugin rule without one as an error. antigravity-plugin wrote its root rule as bare rules/AGENTS.md, so it now gets trigger: always_on frontmatter. This resolves the "plugin root rule rules/AGENTS.md trigger" item from the 2026-10-18 upstream update on #2666.

Changes

  • AntigravityIdeRule gets a getRootRuleFrontmatter() hook. It returns {} for the IDE/CLI root files (project AGENTS.md, global GEMINI.md, which stay plain). AntigravityPluginRule overrides it with { trigger: "always_on" }.
  • Import reads rules/AGENTS.md with or without that frontmatter and keeps only the body, so the canonical overview rule never picks up trigger. ToolRule.toRulesyncRuleDefault takes an optional body for this.
  • RulesProcessor.mergeRulesByOutputPath: several root fragments landing on one path still compose when every fragment starts with the same frontmatter block. The block is written once and the bodies are concatenated. Without this, two root rules failed with the "cannot safely compose a collision involving a root rule" error. The composition decision and the concatenation move into small helpers to stay under the complexity limit.
  • Docs: docs/guide/plugin-packaging.md and the Antigravity rules note in docs/reference/file-formats.md (plus the regenerated src/generated/docs-content.ts).

Test plan

  • New unit tests in antigravity-plugin-rule.test.ts: generated root rule content, importing with and without frontmatter.
  • New rules-processor.test.ts case: two root fragments compose into one rules/AGENTS.md under a single trigger block. The existing "multiple root fragments across every target" test passes.
  • Manual generate --targets antigravity-plugin --features rules --output-roots <dir>: rules/AGENTS.md starts with trigger: always_on.
  • pnpm cicheck

Refs #2666

🤖 Generated with Claude Code

https://claude.ai/code/session_01XcU6mYjWis3a6YpqCW2xgB

dyoshikawa and others added 2 commits October 18, 2026 23:06
Antigravity requires a valid `trigger` on every `.md` file in a `rules/`
directory, and since CLI 1.4.1 `agy plugin validate` reports a plugin rule
without one as an error. The plugin root rule `rules/AGENTS.md` was written
as bare markdown, so it is now written with `trigger: always_on`.

- AntigravityIdeRule gains a `getRootRuleFrontmatter()` hook (empty for the
  IDE/CLI root files); AntigravityPluginRule overrides it.
- Import accepts `rules/AGENTS.md` with or without the frontmatter and keeps
  only the body.
- Multiple root fragments still compose into one `rules/AGENTS.md`: a group of
  root fragments sharing an identical leading frontmatter block keeps it once
  and concatenates the bodies.
- Docs: plugin-packaging guide and file-formats Antigravity rules note.

Refs #2666

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XcU6mYjWis3a6YpqCW2xgB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant