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
+40 -1
View File
@@ -7,7 +7,7 @@ REPO_ROOT = Path(__file__).resolve().parents[1]
if str(REPO_ROOT) not in sys.path:
sys.path.insert(0, str(REPO_ROOT))
from scripts.deploy_adapters import default_codex_home, deploy_codex
from scripts.deploy_adapters import default_codex_home, deploy_antigravity, deploy_codex
def test_default_codex_home_is_external_to_project(tmp_path: Path) -> None:
@@ -49,3 +49,42 @@ def test_deploy_codex_dry_run_does_not_write(tmp_path: Path) -> None:
assert result.planned
assert not target.exists()
def test_deploy_antigravity_writes_workspace_rules_and_skills(tmp_path: Path) -> None:
target = tmp_path / "workspace"
result = deploy_antigravity(target=target, repo_root=REPO_ROOT)
assert result.written
assert (target / ".agents" / "rules" / "deep-research-antigravity.md").exists()
assert (target / ".agents" / "workflows" / "deep-research-native.md").exists()
assert (target / ".agents" / "skills" / "antigravity-surface-adapter" / "SKILL.md").exists()
assert (target / ".agents" / "skills" / "search-strategy" / "SKILL.md").exists()
assert result.target == target
def test_deploy_antigravity_skips_existing_files_by_default(tmp_path: Path) -> None:
target = tmp_path / "workspace"
existing = target / ".agents" / "rules" / "deep-research-antigravity.md"
existing.parent.mkdir(parents=True)
existing.write_text("custom rule\n", encoding="utf-8")
result = deploy_antigravity(target=target, repo_root=REPO_ROOT)
assert existing.read_text(encoding="utf-8") == "custom rule\n"
assert existing in result.skipped
assert not existing.with_name("deep-research-antigravity.md.bak").exists()
def test_deploy_antigravity_force_backs_up_existing_files(tmp_path: Path) -> None:
target = tmp_path / "workspace"
existing = target / ".agents" / "rules" / "deep-research-antigravity.md"
existing.parent.mkdir(parents=True)
existing.write_text("custom rule\n", encoding="utf-8")
result = deploy_antigravity(target=target, repo_root=REPO_ROOT, force=True)
assert existing.read_text(encoding="utf-8") != "custom rule\n"
assert existing.with_name("deep-research-antigravity.md.bak").read_text(encoding="utf-8") == "custom rule\n"
assert existing.with_name("deep-research-antigravity.md.bak") in result.backups