Skip to content

feat: implement extends resolution, --force update, and parent merge in export#55

Open
tianhaocui wants to merge 2 commits intoopen-gitagent:mainfrom
tianhaocui:feat/extends-and-dependency-merge
Open

feat: implement extends resolution, --force update, and parent merge in export#55
tianhaocui wants to merge 2 commits intoopen-gitagent:mainfrom
tianhaocui:feat/extends-and-dependency-merge

Conversation

@tianhaocui
Copy link
Copy Markdown

@tianhaocui tianhaocui commented Mar 30, 2026

What

Implement extends resolution in install, add --force flag for updates, and merge parent agent content in export --format claude-code.

Why

The spec (Section 15: Inheritance) defines extends with clear merge rules, but the implementation was completely missing:

  • extends field is parsed but never acted on — install only handles dependencies
  • install skips if target exists — no way to update without manual rm -rf
  • export only reads current directory — ignores installed parent agent
  • Git source detection hardcoded to github.com — Bitbucket/GitLab repos fail

This means the core cross-project sharing workflow described in the README doesn't work.

Closes #53

How Tested

  • npm run build passes
  • gitagent validate passes on example agents
  • Manual testing (describe below)

Tested with:

  • Bitbucket private repo via SSH (git@bitbucket.org:org/shared-agent.git)
  • extends in child agent.yamlgitagent install clones to .gitagent/parent/
  • gitagent install --force removes and re-clones
  • gitagent export --format claude-code -o CLAUDE.md merges parent SOUL.md, RULES.md, and skills/
  • Child SOUL.md replaces parent, child RULES.md appends to parent, child skills shadow parent

Checklist

  • My code follows the existing style of this project
  • I have added/updated tests (if applicable)
  • I have updated documentation (if applicable)
  • I have read the CONTRIBUTING.md

tianhaocui and others added 2 commits March 30, 2026 17:19
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CLI crashes on startup: duplicate option registration in export.js and import.js

1 participant