feat: implement extends resolution, --force update, and parent merge in export#55
feat: implement extends resolution, --force update, and parent merge in export#55tianhaocui wants to merge 2 commits into
Conversation
The `export` and `import` commands each registered the same required option twice (once for gemini, once for codex), causing commander to throw on startup and making the entire CLI unusable. Additionally, `case 'codex'` was placed inside the `default` branch in both switch statements, so it could never be matched correctly. Changes: - Merge duplicate `.requiredOption()` calls into a single call listing all supported formats - Move `case 'codex'` out of `default` as an independent case with its own `break` Fixes open-gitagent#53 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The spec (Section 15) defines inheritance via `extends` with clear merge rules, but the implementation was missing. This commit adds: 1. `install` now resolves `extends` — clones the parent agent repo into `.gitagent/parent/` alongside existing dependency handling. 2. `install --force` — removes existing installations before re-cloning, enabling updates without manual `rm -rf`. 3. `export --format claude-code` now merges parent content per spec: - SOUL.md: child replaces parent entirely - RULES.md: parent + child appended (union) - skills/: union with child shadowing parent on name collision 4. Git source detection now supports Bitbucket and GitLab URLs in addition to GitHub. Closes open-gitagent#53 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… export (#55) - `gitagent install` now resolves `extends` field — clones parent agent to .gitagent/parent/ - `--force` flag removes and re-installs existing deps/parent - `gitagent export -f claude-code` merges parent content: - SOUL.md: child replaces parent - RULES.md: parent + child appended (union) - skills/: parent skills copied where child doesn't shadow - Git source detection supports GitHub, Bitbucket, and GitLab - Security: uses execFileSync (not execSync) and cpSync (not cp -r shell)
|
Reviewed and merged with fixes. What was good:
Fixes applied before merge:
Note for future work:
Thanks @tianhaocui! |
|
Apologies for the slow review — this PR predates a busy stretch on my side and I should have engaged sooner. The good news: extends-resolution, the Closing this as superseded. Thank you for putting the original design forward; the version that landed is materially yours, with security adjustments. Real appreciation for the patience. |
|
Superseded by main (see comment above). |
What
Implement
extendsresolution ininstall, add--forceflag for updates, and merge parent agent content inexport --format claude-code.Why
The spec (Section 15: Inheritance) defines
extendswith clear merge rules, but the implementation was completely missing:extendsfield is parsed but never acted on —installonly handlesdependenciesinstallskips if target exists — no way to update without manualrm -rfexportonly reads current directory — ignores installed parent agentgithub.com— Bitbucket/GitLab repos failThis means the core cross-project sharing workflow described in the README doesn't work.
Closes #53
How Tested
npm run buildpassesgitagent validatepasses on example agentsTested with:
git@bitbucket.org:org/shared-agent.git)extendsin childagent.yaml→gitagent installclones to.gitagent/parent/gitagent install --forceremoves and re-clonesgitagent export --format claude-code -o CLAUDE.mdmerges parent SOUL.md, RULES.md, and skills/Checklist