|
| 1 | +# Contributing to gitagent |
| 2 | + |
| 3 | +Thanks for your interest in contributing! gitagent is an early-stage project (v0.1.x), which means the spec, CLI, and adapters are still evolving. That also means your contributions can have an outsized impact on the direction of the project. |
| 4 | + |
| 5 | +Because things move fast, some contributions may need to be reworked as the design evolves — we'll always communicate why and work with you on it. |
| 6 | + |
| 7 | +## Where contributions matter most |
| 8 | + |
| 9 | +**High impact:** |
| 10 | +- **Adapter fidelity** — Most exports are lossy today. If you use CrewAI, OpenAI SDK, LangGraph, or any supported framework day-to-day, you're better positioned than anyone to improve that adapter. |
| 11 | +- **Bug reports with reproduction steps** — A good bug report includes: the command you ran, the full error output, your OS, Node version, and gitagent version. |
| 12 | +- **Compliance review** — The compliance schema was designed by engineers and would benefit greatly from review by folks who work in regulated industries (FINRA, SEC, Fed, CFPB). |
| 13 | + |
| 14 | +**Also welcome:** |
| 15 | +- New adapters (LangGraph, LangChain, Autogen, Semantic Kernel) |
| 16 | +- Better `import` fidelity from existing frameworks |
| 17 | +- Test coverage (we're light on tests — help is very welcome here) |
| 18 | + |
| 19 | +**A few guidelines to keep things smooth:** |
| 20 | +- For new features, please open an issue first so we can discuss the approach together. |
| 21 | +- We prefer focused PRs over large refactors — it makes review easier for everyone. |
| 22 | +- If the code is already working and clear, it probably doesn't need additional comments or formatting changes. |
| 23 | + |
| 24 | +## Setup |
| 25 | + |
| 26 | +```bash |
| 27 | +git clone https://github.com/open-gitagent/gitagent.git |
| 28 | +cd gitagent |
| 29 | +npm install |
| 30 | +npm run build |
| 31 | +``` |
| 32 | + |
| 33 | +This compiles TypeScript from `src/` into `dist/`. The entry point is `src/index.ts`. |
| 34 | + |
| 35 | +To test your local build: |
| 36 | + |
| 37 | +```bash |
| 38 | +node dist/index.js <command> |
| 39 | +# or link it globally: |
| 40 | +npm link |
| 41 | +gitagent <command> |
| 42 | +``` |
| 43 | + |
| 44 | +### Watch mode |
| 45 | + |
| 46 | +```bash |
| 47 | +npm run dev |
| 48 | +``` |
| 49 | + |
| 50 | +Recompiles on file changes. You still need to re-run the command manually. |
| 51 | + |
| 52 | +## Project structure |
| 53 | + |
| 54 | +``` |
| 55 | +src/ |
| 56 | +├── index.ts # CLI entry point (Commander.js) |
| 57 | +├── commands/ # One file per CLI command |
| 58 | +│ ├── run.ts # gitagent run |
| 59 | +│ ├── init.ts # gitagent init |
| 60 | +│ ├── validate.ts # gitagent validate |
| 61 | +│ ├── export.ts # gitagent export |
| 62 | +│ ├── import.ts # gitagent import |
| 63 | +│ ├── audit.ts # gitagent audit |
| 64 | +│ ├── skills.ts # gitagent skills |
| 65 | +│ ├── install.ts # gitagent install |
| 66 | +│ ├── info.ts # gitagent info |
| 67 | +│ └── lyzr.ts # gitagent lyzr |
| 68 | +├── runners/ # Runtime adapters (execute agents) |
| 69 | +│ ├── claude.ts # Claude Code runner |
| 70 | +│ ├── openai.ts # OpenAI Agents SDK runner |
| 71 | +│ ├── crewai.ts # CrewAI runner |
| 72 | +│ ├── lyzr.ts # Lyzr Studio runner |
| 73 | +│ ├── openclaw.ts # OpenClaw runner |
| 74 | +│ ├── nanobot.ts # Nanobot runner |
| 75 | +│ ├── github.ts # GitHub Models runner |
| 76 | +│ └── git.ts # Auto-detect meta-runner |
| 77 | +├── adapters/ # Export adapters (generate config) |
| 78 | +├── templates/ # Scaffolding templates for `init` |
| 79 | +└── utils/ |
| 80 | + ├── loader.ts # Loads agent.yaml + SOUL.md + skills |
| 81 | + ├── schemas.ts # JSON Schema definitions |
| 82 | + ├── git-cache.ts # Clone/cache logic |
| 83 | + ├── skill-discovery.ts |
| 84 | + ├── skill-loader.ts |
| 85 | + ├── auth-provision.ts |
| 86 | + ├── format.ts |
| 87 | + └── registry-provider.ts |
| 88 | +``` |
| 89 | + |
| 90 | +### How it fits together |
| 91 | + |
| 92 | +1. `commands/run.ts` parses flags, calls `git-cache.ts` to clone the repo, calls `loader.ts` to read the agent, then delegates to a runner in `runners/`. |
| 93 | +2. Each runner in `runners/` takes the loaded agent and translates it to framework-specific CLI args or code, then spawns the process. |
| 94 | +3. `commands/export.ts` does the same loading but writes output files instead of executing. |
| 95 | + |
| 96 | +## Writing a new adapter |
| 97 | + |
| 98 | +This is the most useful contribution you can make. Here's how: |
| 99 | + |
| 100 | +### 1. Create the runner |
| 101 | + |
| 102 | +Add `src/runners/yourframework.ts`: |
| 103 | + |
| 104 | +```typescript |
| 105 | +import { spawnSync } from 'child_process'; |
| 106 | + |
| 107 | +export async function runYourFramework(options: { |
| 108 | + dir: string; |
| 109 | + prompt?: string; |
| 110 | + agentConfig: any; |
| 111 | + systemPrompt: string; |
| 112 | +}) { |
| 113 | + const { dir, prompt, agentConfig, systemPrompt } = options; |
| 114 | + |
| 115 | + // Transform gitagent config into your framework's format. |
| 116 | + // Be honest about what you can and can't map. |
| 117 | + |
| 118 | + // Spawn your framework's CLI or generate code. |
| 119 | + const result = spawnSync('your-cli', args, { |
| 120 | + cwd: dir, |
| 121 | + stdio: 'inherit', |
| 122 | + }); |
| 123 | + |
| 124 | + return result; |
| 125 | +} |
| 126 | +``` |
| 127 | + |
| 128 | +### 2. Register it in `commands/run.ts` |
| 129 | + |
| 130 | +Add your adapter to the switch statement that dispatches on `-a <adapter>`. |
| 131 | + |
| 132 | +### 3. Add export support (optional) |
| 133 | + |
| 134 | +If your framework has a config file format, add an exporter in `commands/export.ts` or `src/adapters/`. |
| 135 | + |
| 136 | +### 4. Document what's lossy |
| 137 | + |
| 138 | +Every adapter loses something — that's expected. Please document it clearly: |
| 139 | +- What gitagent fields map to your framework? |
| 140 | +- What gets dropped? |
| 141 | +- What requires manual setup (API keys, extra dependencies)? |
| 142 | + |
| 143 | +This honesty helps users make informed decisions about which adapter to use. |
| 144 | + |
| 145 | +## Modifying the spec |
| 146 | + |
| 147 | +Changes to the agent standard (repository layout, `agent.yaml` schema, new file conventions) have a wider blast radius than code changes — they affect every adapter, every existing agent, and every user. |
| 148 | + |
| 149 | +**Process:** |
| 150 | +1. Open an issue describing the problem the change solves. |
| 151 | +2. Show a concrete example of an agent that hits the limitation. |
| 152 | +3. Propose the minimal change that fixes it. |
| 153 | +4. Let's discuss before jumping to code. |
| 154 | + |
| 155 | +This isn't gatekeeping — it's just making sure spec changes are well-considered since they're hard to undo. |
| 156 | + |
| 157 | +## Pull request process |
| 158 | + |
| 159 | +1. **Fork and branch.** Branch from `main`. Name branches descriptively: `fix/npx-binary-resolution`, `adapter/langgraph`, `spec/memory-schema`. |
| 160 | + |
| 161 | +2. **Keep it focused.** One logical change per PR. If your PR covers multiple things (e.g., new adapter + loader refactor + README update), we may ask you to split it — just to make review manageable. |
| 162 | + |
| 163 | +3. **Build must pass.** |
| 164 | + ```bash |
| 165 | + npm run build |
| 166 | + ``` |
| 167 | + If it doesn't compile, don't open the PR. |
| 168 | + |
| 169 | +4. **Test manually.** There's no test suite worth mentioning. Run your change against a real agent. Include the command you ran and the output in the PR description. |
| 170 | + |
| 171 | +5. **Write a clear PR description.** What does it do? Why? What did you test? What's lossy or incomplete? |
| 172 | + |
| 173 | +6. **Don't bump the version.** Maintainers handle versioning and npm publishing. |
| 174 | + |
| 175 | +## Commit messages |
| 176 | + |
| 177 | +Use conventional commits: |
| 178 | + |
| 179 | +``` |
| 180 | +fix: resolve npx binary shadowing for claude runner |
| 181 | +feat: add langgraph export adapter |
| 182 | +docs: update adapter table in README |
| 183 | +chore: bump dependencies |
| 184 | +``` |
| 185 | + |
| 186 | +First line under 72 characters. Body if needed. Don't overthink it. |
| 187 | + |
| 188 | +## Code style |
| 189 | + |
| 190 | +- TypeScript, strict mode. |
| 191 | +- Keep it simple — prefer straightforward code over clever abstractions. Three similar lines is often better than a premature helper function. |
| 192 | +- This is a CLI tool, so we keep the architecture flat. No ORMs, no DI frameworks, no deep class hierarchies. |
| 193 | +- If you need a new dependency, mention it in the PR — we try to keep the dependency tree small for supply chain safety. |
| 194 | +- Error messages should help the user fix the problem. "Failed to load agent.yaml: file not found at /path" is great. A bare "Error" isn't helpful. |
| 195 | + |
| 196 | +## What happens after you submit |
| 197 | + |
| 198 | +- **Small fixes** (typos, clear bugs): merged quickly. |
| 199 | +- **New adapters**: reviewed for correctness, merged after manual testing. |
| 200 | +- **Spec changes**: discussed thoroughly — may be deferred to a future version if the timing isn't right. |
| 201 | +- **Large refactors**: best to discuss in an issue first so we can align on approach. |
| 202 | + |
| 203 | +Response time varies — this is a small team. If your PR sits for a bit, feel free to ping. We appreciate your patience and want to give every contribution proper attention. |
| 204 | + |
| 205 | +## Reporting security issues |
| 206 | + |
| 207 | +Please don't open a public issue for security vulnerabilities. Email shreyas@lyzr.ai directly and we'll work with you to address it. |
| 208 | + |
| 209 | +## License |
| 210 | + |
| 211 | +By contributing, you agree your contributions are licensed under MIT, same as the project. |
| 212 | + |
| 213 | +## Thank you |
| 214 | + |
| 215 | +Every contribution — whether it's a bug report, a typo fix, or a new adapter — helps make gitagent better. We're grateful you're here. |
0 commit comments