v0.20.3 align antigravity agent layering
This commit is contained in:
@@ -20,6 +20,7 @@ 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"
|
||||
ANTIGRAVITY_AGENTS_FILE = REPO_ROOT / ".agents" / "agents.md"
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -131,6 +132,27 @@ def copy_antigravity_workflows(dst: Path, *, force: bool, dry_run: bool = False)
|
||||
return result
|
||||
|
||||
|
||||
def copy_antigravity_agents_file(dst: Path, *, force: bool, dry_run: bool = False) -> DeployResult:
|
||||
result = DeployResult(platform="agents", target=dst)
|
||||
if not ANTIGRAVITY_AGENTS_FILE.exists():
|
||||
return result
|
||||
target = dst / "agents.md"
|
||||
if target.exists() and not force:
|
||||
result.skipped.append(target)
|
||||
return result
|
||||
result.planned.append(target)
|
||||
if dry_run:
|
||||
return result
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
if target.exists() and force:
|
||||
backup = target.with_name("agents.md.bak")
|
||||
shutil.copy2(target, backup)
|
||||
result.backups.append(backup)
|
||||
shutil.copy2(ANTIGRAVITY_AGENTS_FILE, target)
|
||||
result.written.append(target)
|
||||
return result
|
||||
|
||||
|
||||
def deploy_codex(
|
||||
*,
|
||||
target: Path | None = None,
|
||||
@@ -162,6 +184,7 @@ def deploy_antigravity(
|
||||
target: Path | None = None,
|
||||
force: bool = False,
|
||||
skip_skills: bool = False,
|
||||
skip_agents: bool = False,
|
||||
skip_rules: bool = False,
|
||||
skip_workflows: bool = False,
|
||||
dry_run: bool = False,
|
||||
@@ -175,6 +198,8 @@ def deploy_antigravity(
|
||||
"""
|
||||
workspace = (target or repo_root).expanduser()
|
||||
parts: list[DeployResult] = []
|
||||
if not skip_agents:
|
||||
parts.append(copy_antigravity_agents_file(workspace / ".agents", force=force, dry_run=dry_run))
|
||||
if not skip_skills:
|
||||
parts.append(copy_registered_skills(workspace / ".agents" / "skills", force=force, dry_run=dry_run))
|
||||
if not skip_rules:
|
||||
@@ -213,6 +238,7 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
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-agents", action="store_true", help="do not copy role definitions into target/.agents/agents.md")
|
||||
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")
|
||||
@@ -226,6 +252,7 @@ def main() -> int:
|
||||
result = deploy_codex(
|
||||
target=args.target,
|
||||
force=args.force,
|
||||
skip_agents=args.skip_agents,
|
||||
skip_skills=args.skip_skills,
|
||||
dry_run=args.dry_run,
|
||||
include_config=args.include_config,
|
||||
|
||||
Reference in New Issue
Block a user