Skip to content

Commit d79fc2e

Browse files
-- adding CONTRIBUTING guide
1 parent 27b2d80 commit d79fc2e

2 files changed

Lines changed: 145 additions & 2 deletions

File tree

CONTRIBUTING.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Contributing to ruby-crewai
2+
3+
Thank you for taking the time to contribute. This document covers everything you need to get set up, make changes, and open a pull request.
4+
5+
---
6+
7+
## Table of Contents
8+
9+
- [Code of Conduct](#code-of-conduct)
10+
- [Getting Started](#getting-started)
11+
- [Running the Tests](#running-the-tests)
12+
- [Commit Discipline](#commit-discipline)
13+
- [Pull Request Guidelines](#pull-request-guidelines)
14+
- [Reporting Bugs](#reporting-bugs)
15+
- [Feature Requests](#feature-requests)
16+
17+
---
18+
19+
## Code of Conduct
20+
21+
Everyone interacting with this project is expected to follow the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). Please report unacceptable behaviour to [ranaibtisam1@gmail.com](mailto:ranaibtisam1@gmail.com).
22+
23+
---
24+
25+
## Getting Started
26+
27+
**Requirements:**
28+
- Ruby 3.1+
29+
- Bundler 2+
30+
31+
**Setup:**
32+
33+
```bash
34+
git clone https://github.com/MuhammadIbtisam/ruby-crewai.git
35+
cd ruby-crewai
36+
bundle install
37+
```
38+
39+
Verify everything works:
40+
41+
```bash
42+
bundle exec rspec
43+
```
44+
45+
You should see all examples passing with zero failures.
46+
47+
---
48+
49+
## Running the Tests
50+
51+
The test suite uses **RSpec** and **WebMock** — no live credentials or network access needed.
52+
53+
```bash
54+
# Run the full suite
55+
bundle exec rspec
56+
57+
# Run a single file
58+
bundle exec rspec spec/crewai/client/kickoff_spec.rb
59+
60+
# Run a single example by line number
61+
bundle exec rspec spec/crewai/client/kickoff_spec.rb:10
62+
```
63+
64+
**Coverage expectations:**
65+
66+
Every public method must have:
67+
- A success case
68+
- At least one error case (e.g. 401, 422, 404, 500)
69+
- Edge cases for optional parameters (omitted vs provided)
70+
71+
The suite must be green before opening a pull request.
72+
73+
---
74+
75+
## Commit Discipline
76+
77+
This project follows a **one commit = one intention** rule. Each commit should be reviewable in ~2 minutes.
78+
79+
**Format:**
80+
81+
```
82+
type(scope): short description
83+
```
84+
85+
| Type | When to use |
86+
|------|-------------|
87+
| `feat` | New feature or endpoint |
88+
| `feat(api)` | New API method on `Client` |
89+
| `fix` | Bug fix |
90+
| `refactor` | Internal restructure, no behaviour change |
91+
| `test` | Adding or updating specs only |
92+
| `docs` | README, CHANGELOG, or doc comments |
93+
| `chore` | Gemspec, CI, dependencies, tooling |
94+
| `ci` | GitHub Actions changes |
95+
96+
**Rules:**
97+
- Do not bundle multiple intentions into one commit
98+
- Do not commit a failing test suite
99+
- Update `CHANGELOG.md` in the same commit as the feature or fix it describes
100+
101+
---
102+
103+
## Pull Request Guidelines
104+
105+
1. **One PR = one intention** — same rule as commits
106+
2. **Branch from `main`**`git checkout -b feat/my-feature`
107+
3. **Write tests first** — or alongside the implementation, never after
108+
4. **Green suite required**`bundle exec rspec` must pass
109+
5. **Update the CHANGELOG** — add an entry under `[Unreleased]`
110+
6. **Small diffs** — a PR reviewable in ~10 minutes is a good PR
111+
112+
**Adding a new API endpoint:**
113+
114+
Follow the established pattern:
115+
1. Add the method to `lib/crewai/client.rb`
116+
2. Create `spec/crewai/client/<endpoint>_spec.rb`
117+
3. Add a section to `README.md`
118+
4. Update `CHANGELOG.md`
119+
5. One commit: `feat(api): add Client#<method>`
120+
121+
---
122+
123+
## Reporting Bugs
124+
125+
Open an issue on [GitHub](https://github.com/MuhammadIbtisam/ruby-crewai/issues) with:
126+
127+
- Ruby version (`ruby --version`)
128+
- Gem version (`bundle exec gem list ruby-crewai`)
129+
- A minimal reproduction (the smallest code that triggers the bug)
130+
- The full error message and backtrace
131+
132+
---
133+
134+
## Feature Requests
135+
136+
Open an issue describing:
137+
138+
- What you want to do that you currently cannot
139+
- Why it belongs in the gem rather than in your application
140+
141+
We follow the CrewAI AMP API — new endpoints are added as they become available in the API.

spec/crewai/client/resume_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
end
5656

5757
it "sends is_approve: false in the request body" do
58-
expect(client.resume(**resume_params.merge(is_approve: false))).to eq({ "status" => "resumed" })
58+
expect(client.resume(**resume_params, is_approve: false)).to eq({ "status" => "resumed" })
5959
end
6060
end
6161

@@ -123,7 +123,9 @@
123123
end
124124

125125
it "raises CrewAI::InvalidRequestError with the server message" do
126-
expect { client.resume(**resume_params) }.to raise_error(CrewAI::InvalidRequestError, /execution_id is required/)
126+
expect do
127+
client.resume(**resume_params)
128+
end.to raise_error(CrewAI::InvalidRequestError, /execution_id is required/)
127129
end
128130
end
129131

0 commit comments

Comments
 (0)