Skip to content

Commit af18f23

Browse files
Initial release v0.1.0
0 parents  commit af18f23

File tree

198 files changed

+143737
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+143737
-0
lines changed

.github/CONTRIBUTOR_AGREEMENT.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# ContextGem contributor agreement
2+
3+
This ContextGem Contributor Agreement (**"CCA"**) is based on the [Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf). The CCA applies to any contribution that you make to any product or project managed by us (the **"project"**), and sets out the intellectual property rights you grant to us in the contributed materials. The term **"us"** shall mean [Shcherbak AI AS](https://shcherbak.ai). The term **"you"** shall mean the person or entity identified below.
4+
5+
If you agree to be bound by these terms, fill in the information requested below and include the filled-in version with your first pull request, under the folder [`.github/contributors/`](/.github/contributors/). Name your file using your GitHub username followed by the `.md` extension. For instance, if your username is example_user, you would create a file named `.github/contributors/example_user.md`.
6+
7+
Read this agreement carefully before signing. These terms and conditions constitute a binding legal agreement.
8+
9+
## Contributor Agreement
10+
11+
1. The term "contribution" or "contributed materials" means any source code, object code, patch, tool, sample, graphic, specification, manual, documentation, or any other material posted or submitted by you to the project.
12+
13+
2. With respect to any worldwide copyrights, or copyright applications and registrations, in your contribution:
14+
15+
* you hereby assign to us joint ownership, and to the extent that such assignment is or becomes invalid, ineffective or unenforceable, you hereby grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free, unrestricted license to exercise all rights under those copyrights. This includes, at our option, the right to sublicense these same rights to third parties through multiple levels of sublicensees or other licensing arrangements;
16+
17+
* you agree that each of us can do all things in relation to your contribution as if each of us were the sole owners, and if one of us makes a derivative work of your contribution, the one who makes the derivative work (or has it made) will be the sole owner of that derivative work;
18+
19+
* you agree that you will not assert any moral rights in your contribution against us, our licensees or transferees;
20+
21+
* you agree that we may register a copyright in your contribution and exercise all ownership rights associated with it; and
22+
23+
* you agree that neither of us has any duty to consult with, obtain the consent of, pay or render an accounting to the other for any use or distribution of your contribution.
24+
25+
3. With respect to any patents you own, or that you can license without payment to any third party, you hereby grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free license to:
26+
27+
* make, have made, use, sell, offer to sell, import, and otherwise transfer your contribution in whole or in part, alone or in combination with or included in any product, work or materials arising out of the project to which your contribution was submitted, and
28+
29+
* at our option, to sublicense these same rights to third parties through multiple levels of sublicensees or other licensing arrangements.
30+
31+
4. Except as set out above, you keep all right, title, and interest in your contribution. The rights that you grant to us under these terms are effective on the date you first submitted a contribution to us, even if your submission took place before the date you sign these terms.
32+
33+
5. You covenant, represent, warrant and agree that:
34+
35+
* Each contribution that you submit is and shall be an original work of authorship and you can legally grant the rights set out in this CCA;
36+
37+
* to the best of your knowledge, each contribution will not violate any third party's copyrights, trademarks, patents, or other intellectual property rights; and
38+
39+
* each contribution shall be in compliance with applicable export control laws and other applicable export and import laws.
40+
41+
You agree to notify us if you become aware of any circumstance which would make any of the foregoing representations inaccurate in any respect. We may publicly disclose your participation in the project, including the fact that you have signed the CCA.
42+
43+
6. This CCA is governed by the laws of Norway and applicable international law. Any choice of law rules will not apply.
44+
45+
7. Please place an "x" on one of the applicable statement below. Please do NOT mark both statements:
46+
47+
* [ ] I am signing on behalf of myself as an individual and no other person or entity, including my employer, has or will have rights with respect to my contributions.
48+
49+
* [ ] I am signing on behalf of my employer or a legal entity and I have the actual authority to contractually bind that entity.
50+
51+
## Contributor Details
52+
53+
| Field | Entry |
54+
|------------------------------- | -------------------- |
55+
| Name | |
56+
| Company name (if applicable) | |
57+
| Title or role (if applicable) | |
58+
| Date | |
59+
| GitHub username | |
60+
| Website (optional) | |
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Description
10+
A clear and concise description of what the bug is.
11+
12+
## Steps to Reproduce
13+
Steps to reproduce the behavior.
14+
15+
## Expected Behavior
16+
A clear and concise description of what you expected to happen.
17+
18+
## Actual Behavior
19+
A clear and concise description of what actually happened.
20+
21+
## Environment
22+
- OS: [e.g. Windows 11, Ubuntu 24.04]
23+
- Python version: [e.g. 3.13.2]
24+
- contextgem version: [e.g. 0.1.0]
25+
- Any other relevant environment details
26+
27+
## Error Logs
28+
```
29+
Paste any error logs or traceback here
30+
```
31+
32+
## Additional Context
33+
Add any other context about the problem here.
34+
35+
## Possible Solution
36+
If you have suggestions on how to fix the issue, please describe them here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Have a question? Just ask :)
4+
url: https://github.com/shcherbak-ai/contextgem/discussions/new/
5+
about: For questions or discussions that aren't bugs or feature requests
6+
- name: Documentation
7+
url: https://contextgem.dev
8+
about: Check the documentation for usage information and guides
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Documentation Improvement
3+
about: Suggest improvements to our documentation
4+
title: '[DOCS] '
5+
labels: documentation
6+
assignees: ''
7+
---
8+
9+
## What Documentation Needs Improvement?
10+
Provide links or describe the current documentation that needs to be improved.
11+
12+
## What's Wrong or Missing?
13+
A clear and concise description of what's wrong with the current documentation or what information is missing.
14+
15+
## Suggested Improvement
16+
A clear and concise description of how you think the documentation should be improved.
17+
18+
## Additional Context
19+
Add any other context about the documentation request here.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem Statement
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
## Proposed Solution
13+
A clear and concise description of what you want to happen.
14+
15+
## Alternatives Considered
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
## Additional Context
19+
Add any other context, mockups, or examples about the feature request here.
20+
21+
## Implementation Ideas
22+
If you have ideas about how this could be implemented, please share them here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--- Provide a general summary of your changes in the title. -->
2+
3+
## Description
4+
<!--- Use this section to describe your changes. If your changes required
5+
testing, include information about the testing environment and the tests you
6+
ran. If your test fixes a bug reported in an issue, don't forget to include the
7+
issue number. If your PR is still a work in progress, that's totally fine – just
8+
include a note to let us know. -->
9+
10+
## Related Issues
11+
<!--- Link to any related issues here using the syntax: Fixes #issue_number or Relates to #issue_number -->
12+
13+
## Types of change
14+
<!-- What type of change does your PR cover? Is it a bug fix, an enhancement
15+
or new feature, or a change to the documentation? -->
16+
- [ ] Bug fix (non-breaking change which fixes an issue)
17+
- [ ] New feature (non-breaking change which adds functionality)
18+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
19+
- [ ] Documentation update
20+
- [ ] Performance improvement
21+
- [ ] Code cleanup or refactor
22+
23+
## How to Test
24+
<!--- Please describe how reviewers can test your changes -->
25+
26+
## Checklist
27+
<!--- Before you submit the PR, go over this checklist and make sure you can
28+
tick off all the boxes. [] -> [x] -->
29+
- [ ] I confirm that I have the right to submit this contribution and grant all the rights specified in the Contributor Agreement.
30+
- [ ] I have read, agreed to, filled in, and included my Contributor Agreement in `.github/contributors/[my-username].md`.
31+
- [ ] I ran the tests, and all new and existing tests passed.
32+
- [ ] My changes don't require a change to the documentation, or if they do, I've added all required information.

.github/contributors/.gitkeep

Whitespace-only changes.

.github/workflows/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# GitHub Workflows
2+
3+
This directory contains GitHub Actions workflow configurations for continuous integration (CI) of the ContextGem project.
4+
5+
## Available Workflows
6+
7+
### tests (`ci-tests.yml`)
8+
9+
**Features:**
10+
- Runs on multiple operating systems (Ubuntu, macOS, Windows)
11+
- Tests across Python versions 3.10, 3.11, 3.12, and 3.13
12+
- Checks formatting with Black
13+
- Runs test suite with VCR (recorded API responses)
14+
- Generates test coverage reports
15+
16+
**Trigger:**
17+
- Automatically runs on push and pull request events on the main branch
18+
- Can be triggered manually through the GitHub Actions UI
19+
20+
**Environment Variables:**
21+
- This workflow uses the following environment variables:
22+
- `CONTEXTGEM_OPENAI_API_KEY`: Secret OpenAI API key
23+
- `GIST_SECRET`: Secret token to upload coverage results to a gist for badge generation
24+
25+
### Check Contributor Agreement (`contributor-agreement-check.yml`)
26+
27+
This workflow ensures all contributors have signed the Contributor Agreement by checking for properly filled agreement files.
28+
29+
**Features:**
30+
- Verifies that each contributor has a signed agreement file
31+
- Ensures agreement files are not empty and contain the contributor's username
32+
- Prevents deletion of existing contributor agreement files
33+
- Posts helpful comments on PRs when agreement requirements aren't met
34+
35+
**Trigger:**
36+
- Automatically runs on all pull request events (opened, synchronized, reopened)
37+
38+
## Running Workflows
39+
40+
- **tests:** These run automatically on push/PR to the main branch
41+
- **Check Contributor Agreement:** Runs automatically on all PRs

.github/workflows/ci-tests.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
12+
tests-with-vcr:
13+
14+
strategy:
15+
matrix:
16+
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
runs-on: ${{ matrix.os }}
24+
25+
steps:
26+
27+
- name: Check out repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
id: setup-python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Install Poetry
37+
uses: snok/install-poetry@v1
38+
with:
39+
virtualenvs-create: true
40+
virtualenvs-in-project: true
41+
installer-parallel: true
42+
43+
- name: Load cached pip wheels
44+
id: cached-pip-wheels
45+
uses: actions/cache@v4
46+
with:
47+
path: |
48+
~/.cache/pip
49+
~/Library/Caches/pip
50+
~\AppData\Local\pip\Cache
51+
key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
52+
53+
- name: Install dependencies
54+
run: poetry install --no-interaction --with dev --no-root
55+
56+
- name: Code formatting checks
57+
run: |
58+
poetry run black --check contextgem dev tests
59+
poetry run isort --check contextgem dev tests
60+
poetry check --lock
61+
62+
- name: Run coverage (with VCR)
63+
run: |
64+
source $VENV
65+
coverage run --source contextgem -m pytest --maxfail=1 --disable-warnings -v
66+
coverage report -m
67+
coverage xml -o coverage_quick.xml
68+
69+
- name: Extract coverage
70+
id: get_coverage
71+
run: |
72+
COVERAGE=$(python -c "import xml.etree.ElementTree as ET; print(round(float(ET.parse('coverage_quick.xml').getroot().attrib['line-rate'])*100))")
73+
echo "percentage=$COVERAGE" >> $GITHUB_OUTPUT
74+
# Determine badge color based on coverage percentage
75+
if [ $COVERAGE -ge 80 ]; then
76+
echo "color=success" >> $GITHUB_OUTPUT
77+
elif [ $COVERAGE -ge 60 ]; then
78+
echo "color=yellow" >> $GITHUB_OUTPUT
79+
else
80+
echo "color=critical" >> $GITHUB_OUTPUT
81+
fi
82+
83+
- name: Upload coverage artifact
84+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: coverage-data
88+
path: |
89+
coverage_quick.xml
90+
retention-days: 1
91+
92+
update-badge:
93+
needs: tests-with-vcr
94+
runs-on: ubuntu-latest
95+
steps:
96+
- name: Download coverage artifact
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: coverage-data
100+
101+
- name: Extract coverage
102+
id: get_coverage
103+
run: |
104+
COVERAGE=$(python -c "import xml.etree.ElementTree as ET; print(round(float(ET.parse('coverage_quick.xml').getroot().attrib['line-rate'])*100))")
105+
echo "percentage=$COVERAGE" >> $GITHUB_OUTPUT
106+
# Determine badge color based on coverage percentage
107+
if [ $COVERAGE -ge 80 ]; then
108+
echo "color=success" >> $GITHUB_OUTPUT
109+
elif [ $COVERAGE -ge 60 ]; then
110+
echo "color=yellow" >> $GITHUB_OUTPUT
111+
else
112+
echo "color=critical" >> $GITHUB_OUTPUT
113+
fi
114+
115+
- name: Update coverage badge
116+
uses: schneegans/dynamic-badges-action@v1.7.0
117+
with:
118+
auth: ${{ secrets.GIST_SECRET }}
119+
gistID: daaee00e1dfff7a29ca10a922ec3becd
120+
filename: coverage.json
121+
label: coverage
122+
message: ${{ steps.get_coverage.outputs.percentage }}%
123+
color: ${{ steps.get_coverage.outputs.color }}
124+
125+
env:
126+
CONTEXTGEM_OPENAI_API_KEY: ${{ secrets.CONTEXTGEM_OPENAI_API_KEY }}

0 commit comments

Comments
 (0)