v0.20.2 harden antigravity research workflow

This commit is contained in:
Deep Research System
2026-05-07 12:57:11 +08:00
parent 68e45bcf41
commit e991b26af9
11 changed files with 532 additions and 33 deletions
+78
View File
@@ -18,6 +18,8 @@ if str(REPO_ROOT) not in sys.path:
from scripts.runtime.skills import SkillRegistry
CODEX_TEMPLATE = REPO_ROOT / "codex_adapter_templates" / "codex"
ANTIGRAVITY_RULES_DIR = REPO_ROOT / ".agents" / "rules"
ANTIGRAVITY_WORKFLOWS_DIR = REPO_ROOT / ".agents" / "workflows"
@dataclass
@@ -105,6 +107,30 @@ def copy_registered_skills(dst: Path, *, force: bool, dry_run: bool = False) ->
return result
def copy_antigravity_rules(dst: Path, *, force: bool, dry_run: bool = False) -> DeployResult:
result = DeployResult(platform="rules", target=dst)
if not ANTIGRAVITY_RULES_DIR.exists():
return result
part = copy_tree_contents(ANTIGRAVITY_RULES_DIR, dst, force=force, dry_run=dry_run)
result.written.extend(part.written)
result.skipped.extend(part.skipped)
result.planned.extend(part.planned)
result.backups.extend(part.backups)
return result
def copy_antigravity_workflows(dst: Path, *, force: bool, dry_run: bool = False) -> DeployResult:
result = DeployResult(platform="workflows", target=dst)
if not ANTIGRAVITY_WORKFLOWS_DIR.exists():
return result
part = copy_tree_contents(ANTIGRAVITY_WORKFLOWS_DIR, dst, force=force, dry_run=dry_run)
result.written.extend(part.written)
result.skipped.extend(part.skipped)
result.planned.extend(part.planned)
result.backups.extend(part.backups)
return result
def deploy_codex(
*,
target: Path | None = None,
@@ -131,6 +157,33 @@ def deploy_codex(
return _merge_results("codex", codex_home, parts)
def deploy_antigravity(
*,
target: Path | None = None,
force: bool = False,
skip_skills: bool = False,
skip_rules: bool = False,
skip_workflows: bool = False,
dry_run: bool = False,
repo_root: Path = REPO_ROOT,
) -> DeployResult:
"""Deploy Antigravity workspace rules and skills into a workspace root.
This intentionally deploys to a workspace-local `.agents` directory, not
global Antigravity/Gemini settings, so existing user configuration is not
touched. Existing files are skipped unless `force=True`.
"""
workspace = (target or repo_root).expanduser()
parts: list[DeployResult] = []
if not skip_skills:
parts.append(copy_registered_skills(workspace / ".agents" / "skills", force=force, dry_run=dry_run))
if not skip_rules:
parts.append(copy_antigravity_rules(workspace / ".agents" / "rules", force=force, dry_run=dry_run))
if not skip_workflows:
parts.append(copy_antigravity_workflows(workspace / ".agents" / "workflows", force=force, dry_run=dry_run))
return _merge_results("antigravity", workspace, parts)
def print_result(result: DeployResult) -> None:
action = "planned" if result.planned and not result.written else "written"
print(f"{result.platform} adapter deployment")
@@ -156,6 +209,14 @@ def build_parser() -> argparse.ArgumentParser:
codex.add_argument("--skip-skills", action="store_true", help="do not copy canonical skills into target/skills")
codex.add_argument("--include-config", action="store_true", help="also copy config.toml; off by default to avoid overwriting global Codex config")
codex.add_argument("--dry-run", action="store_true", help="show files that would be written")
antigravity = sub.add_parser("antigravity", help="Deploy Antigravity workspace rules and skills")
antigravity.add_argument("--target", type=Path, help="Workspace root; defaults to this repository")
antigravity.add_argument("--force", action="store_true", help="overwrite existing files and create .bak backups")
antigravity.add_argument("--skip-skills", action="store_true", help="do not copy canonical skills into target/.agents/skills")
antigravity.add_argument("--skip-rules", action="store_true", help="do not copy workspace rules into target/.agents/rules")
antigravity.add_argument("--skip-workflows", action="store_true", help="do not copy workflows into target/.agents/workflows")
antigravity.add_argument("--dry-run", action="store_true", help="show files that would be written without writing")
return parser
@@ -178,6 +239,23 @@ def main() -> int:
print(" codex")
print("Note: config.toml is not copied by default. Use --include-config only if you want the bundled profile.")
return 0
if args.platform == "antigravity":
result = deploy_antigravity(
target=args.target,
force=args.force,
skip_skills=args.skip_skills,
skip_rules=args.skip_rules,
skip_workflows=args.skip_workflows,
dry_run=args.dry_run,
)
print_result(result)
print()
print("Open the target workspace in Antigravity and enable/mention the workspace rule if needed:")
print(" .agents/rules/deep-research-antigravity.md")
print("Workflow installed when supported by your Antigravity build:")
print(" .agents/workflows/deep-research-native.md")
print("Existing files are skipped by default. Use --force only when you want .bak backups and replacement.")
return 0
raise SystemExit(f"unsupported platform: {args.platform}")