# Contributing to Catenary
Thank you for your interest in contributing to Catenary! This project aims to bridge the gap between AI agents and professional development tools.
## How to Contribute
1. **Fork** the repository on GitHub.
2. **Clone** your fork locally.
3. **Create a branch** for your feature or bug fix.
4. **Implement** your changes.
5. **Test** your changes using `cargo test`.
6. **Lint** your code using `cargo clippy` and `cargo fmt`.
7. **Submit a Pull Request** to the `main` branch.
## Code Style
- We follow standard Rust idioms and conventions.
- Ensure all code is formatted with `rustfmt`.
- Ensure no warnings are generated by `clippy`.
- Add documentation comments for public APIs.
## Testing
Catenary uses a mix of unit tests and integration tests.
- **Unit Tests:** Located in the same file as the code (e.g., `src/lib.rs`).
- **Integration Tests:** Located in `tests/`. These spawn real LSP servers (like `rust-analyzer` or `bash-language-server`). Ensure you have the necessary tools installed if you are modifying relevant tests.
## Local Development & Testing
To test your changes end-to-end with Claude Code or Gemini CLI without publishing to a marketplace:
### 1. Build Catenary
Build the release binary:
```bash
cargo build --release
```
The binary will be located at `target/release/catenary`.
### 2. Install Plugin/Extension
Catenary ships plugin/extension manifests for both Claude Code and Gemini CLI.
These bundle the MCP server configuration along with hooks that feed LSP
diagnostics back to the model after file edits and sync `/add-dir` roots
mid-session.
#### Claude Code
```bash
# Install as a local marketplace plugin
/plugin marketplace add /path/to/Catenary
/plugin install catenary@catenary
```
The plugin includes:
- MCP server configuration
- `PreToolUse` hook — syncs `/add-dir` roots to the running session
- `PostToolUse` hook — returns LSP diagnostics after file edits
#### Gemini CLI
```bash
# Link the local extension for development
gemini extensions link /path/to/Catenary
```
The extension includes:
- MCP server configuration
- `AfterTool` hook — returns LSP diagnostics after file edits
### 3. Iterate
After making changes, rebuild and reinstall:
```bash
cargo install --path .
```
This places the updated binary at `~/.cargo/bin/catenary`. Restart your
Claude Code or Gemini CLI session to pick up the new binary.
If you change hook definitions in `plugins/catenary/hooks/hooks.json` or
`hooks/hooks.json`, run `catenary doctor` to check whether the installed
hooks match the new definitions:
```
Hooks:
Claude Code 1.3.6 (directory) ✗ stale hooks (reinstall: claude plugin uninstall catenary@catenary && claude plugin install catenary@catenary)
Gemini CLI 1.3.6 (linked) ✓ hooks match
```
Reinstall the plugin/extension as indicated to pick up the new hooks.
## Licensing and Copyright
**Catenary is dual-licensed.**
By contributing to Catenary, you agree that your contributions will be licensed under its **GNU Affero General Public License v3.0 (or later)**.
Additionally, by submitting a Pull Request, you grant **Mark Wells Dev** a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute your contributions and such derivative works under the project's licenses (including the Commercial License).
This ensures the project can remain sustainable and legally sound while staying open source.