feat(cli): export — patch a local agent back to its source-of-truth repo - #180
Open
matheusmlopess wants to merge 3 commits into
Open
feat(cli): export — patch a local agent back to its source-of-truth repo#180matheusmlopess wants to merge 3 commits into
matheusmlopess wants to merge 3 commits into
Conversation
`agentfactory-gen export <name>` clones the agent's source repo, applies this
project's .ai/agents/<name>/ over the agent's location (auto-detected agent/
subpath or repo root), commits on a branch (agentfactory/export-<name>),
pushes, and opens a PR — the inverse of `import`.
- import now records the source ({"git": url} / {"registry": slug}) in the
agent manifest so export defaults to it; override with --git URL.
- --git also accepts local paths / file:// (offline + testable); --no-push
emits a .patch; --no-pr stops after pushing the branch.
- tests: push-to-recorded-source, explicit --git, no-source error,
--no-push patch, missing-agent error.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- docs/FEATURE-EXPORT-CLI.md — feature + operational doc: round-trip diagram, execution flow, all scenarios (happy/edge/failure), validation/error/recovery, before/after tree + behaviour comparison. Box-drawing, terminal-safe. - docs/TESTING-EXPORT-CLI-E2E.md — E2E guide using a local bare repo: preconditions, steps, expected results, validation checks, failure indicators. - docs/reviews/REVIEW-EXPORT-CLI.md — consolidated analysis: design/trade-offs, assumptions, gaps/risks, missing scenarios, enhancements, safeguards; doc- tracking verification; honest infra-alignment audit (CLI-only → no compose/ ansible drift; operator-console/routes N/A with reasoning) + PR checklist. - README: export added to the command list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
agentfactory-gen export— patch a local agent back to its source repoThe inverse of
import. When you've edited an imported agent in.ai/agents/<name>/,exportflows those changes back upstream to theagent's source-of-truth repo as a reviewable PR.
flowchart LR A[".ai/agents/<name>/<br/>(local edits)"] --> E([agentfactory-gen export]) E --> C[clone source repo] C --> P["apply over agent/ subpath<br/>(auto-detected)"] P --> B["branch agentfactory/export-<name><br/>commit + push"] B --> R([gh pr create])What it does
--git URL, else the source recorded at import.agent/subpath or repo root).agent-manifest.json+ tracked dirs (skills/ commands/ docs/ scripts/ orchestration/) over it.agentfactory/export-<name>, pushes, opens a PR.Options
--git URL·--subpath·--branch·-m/--message·--project-root·--push/--no-push(writes a.patch) ·--pr/--no-pr.Also in this PR
importrecords the source ({"git": url}/{"registry": slug}) in the agentmanifest, so
exportdefaults to it (no need to retype the URL).--gitaccepts local paths /file://— offline use + makes the feature testableagainst a bare repo. (Also a step toward AgentFactory#179 gap 2.)
Tests
src/tests/test_export.py— 5 tests (push-to-recorded-source, explicit--git,no-source error,
--no-pushpatch, missing-agent error). All pass.🤖 Generated with Claude Code