@agentfile/cli
v0.3.0
Published
CLI for agentfile — init, migrate, sync, validate, watch, diff, clean, and rollback
Maintainers
Readme
@agentfile/cli
One contract. Every AI agent. Zero clutter.
CLI for agentfile — scaffold, migrate, generate, validate, diff, clean, and rollback AI agent instruction files from a single contract.yaml.
Usage
npx @agentfile/cli initWalks you through setup and scaffolds everything — ai/contract.yaml, agent templates, .ai-agents.example, and a CI workflow.
npx @agentfile/cli watchWatches ai/ for changes and automatically re-runs sync. Runs an initial sync on start. No more running sync manually after every contract change.
npx @agentfile/cli syncReads your personal .ai-agents file and generates the correct instruction file for each agent in its native format.
npx @agentfile/cli validateValidates ai/contract.yaml against the schema. Exits 0 or 1. Designed for CI.
npx @agentfile/cli migrate --from .github/copilot-instructions.md --from CLAUDE.mdImports existing instruction files into a draft ai/contract.yaml.
npx @agentfile/cli migrate --from CLAUDE.md --replace-policy archive
npx @agentfile/cli migrate --from CLAUDE.md --targets claude,copilotnpx @agentfile/cli diffChecks generated files against .agentfile-manifest.json; exits non-zero when drift is found.
npx @agentfile/cli clean --dry-run
npx @agentfile/cli cleanRemoves generated files and updates manifest ownership records.
npx @agentfile/cli rollback --list
npx @agentfile/cli rollback --tag migrate-1700000000000Restores files from .agentfile-backup/.
What it generates
| Agent | File |
|---|---|
| claude | CLAUDE.md |
| copilot | .github/copilot-instructions.md |
| cursor | .cursor/rules/main.mdc + one .mdc per skill |
| agents-md | AGENTS.md — read natively by Codex and Windsurf |
Generated files are gitignored. Each developer picks which agents they use without touching the repo.
Your contract
version: 1
project:
name: My Project
stack: [typescript, react]
rules:
coding:
- Prefer small composable functions
architecture:
- Follow feature-based folder structure
skills:
- name: create-component
description: Creates a new React component with tests
steps:
- Create /src/components/{feature}/{Name}.tsx
- Create matching test file
- Export from index.tsLinks
License
MIT
