devscontext 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- devscontext-0.1.0/.claude/settings.local.json +12 -0
- devscontext-0.1.0/.devscontext.yaml.example +29 -0
- devscontext-0.1.0/.github/workflows/ci.yml +38 -0
- devscontext-0.1.0/.github/workflows/publish.yml +45 -0
- devscontext-0.1.0/.gitignore +211 -0
- devscontext-0.1.0/CLAUDE.md +129 -0
- devscontext-0.1.0/CONTRIBUTING.md +112 -0
- devscontext-0.1.0/LICENSE +21 -0
- devscontext-0.1.0/PKG-INFO +253 -0
- devscontext-0.1.0/README.md +200 -0
- devscontext-0.1.0/docs/CNAME +1 -0
- devscontext-0.1.0/docs/configuration.md +283 -0
- devscontext-0.1.0/docs/example/adrs/001-webhook-retry-strategy.md +128 -0
- devscontext-0.1.0/docs/example/architecture/payments-service.md +133 -0
- devscontext-0.1.0/docs/example/standards/testing.md +237 -0
- devscontext-0.1.0/docs/example/standards/typescript.md +210 -0
- devscontext-0.1.0/docs/index.html +552 -0
- devscontext-0.1.0/docs/plugins.md +386 -0
- devscontext-0.1.0/docs/pre-processing.md +330 -0
- devscontext-0.1.0/pyproject.toml +148 -0
- devscontext-0.1.0/src/devscontext/__init__.py +3 -0
- devscontext-0.1.0/src/devscontext/adapters/__init__.py +23 -0
- devscontext-0.1.0/src/devscontext/adapters/base.py +105 -0
- devscontext-0.1.0/src/devscontext/adapters/fireflies.py +585 -0
- devscontext-0.1.0/src/devscontext/adapters/gmail.py +580 -0
- devscontext-0.1.0/src/devscontext/adapters/jira.py +639 -0
- devscontext-0.1.0/src/devscontext/adapters/local_docs.py +984 -0
- devscontext-0.1.0/src/devscontext/adapters/slack.py +804 -0
- devscontext-0.1.0/src/devscontext/agents/__init__.py +28 -0
- devscontext-0.1.0/src/devscontext/agents/preprocessor.py +775 -0
- devscontext-0.1.0/src/devscontext/agents/watcher.py +265 -0
- devscontext-0.1.0/src/devscontext/cache.py +151 -0
- devscontext-0.1.0/src/devscontext/cli.py +727 -0
- devscontext-0.1.0/src/devscontext/config.py +264 -0
- devscontext-0.1.0/src/devscontext/constants.py +107 -0
- devscontext-0.1.0/src/devscontext/core.py +582 -0
- devscontext-0.1.0/src/devscontext/exceptions.py +148 -0
- devscontext-0.1.0/src/devscontext/logging.py +181 -0
- devscontext-0.1.0/src/devscontext/models.py +504 -0
- devscontext-0.1.0/src/devscontext/plugins/__init__.py +49 -0
- devscontext-0.1.0/src/devscontext/plugins/base.py +321 -0
- devscontext-0.1.0/src/devscontext/plugins/registry.py +544 -0
- devscontext-0.1.0/src/devscontext/py.typed +0 -0
- devscontext-0.1.0/src/devscontext/rag/__init__.py +113 -0
- devscontext-0.1.0/src/devscontext/rag/embeddings.py +296 -0
- devscontext-0.1.0/src/devscontext/rag/index.py +323 -0
- devscontext-0.1.0/src/devscontext/server.py +374 -0
- devscontext-0.1.0/src/devscontext/storage.py +321 -0
- devscontext-0.1.0/src/devscontext/synthesis.py +1057 -0
- devscontext-0.1.0/src/devscontext/utils.py +297 -0
- devscontext-0.1.0/tests/__init__.py +1 -0
- devscontext-0.1.0/tests/fixtures/docs/adrs/001-use-event-sourcing.md +52 -0
- devscontext-0.1.0/tests/fixtures/docs/architecture/payments-service.md +67 -0
- devscontext-0.1.0/tests/fixtures/docs/standards/testing.md +97 -0
- devscontext-0.1.0/tests/fixtures/docs/standards/typescript.md +82 -0
- devscontext-0.1.0/tests/fixtures/docs_context.json +16 -0
- devscontext-0.1.0/tests/fixtures/jira_ticket.json +53 -0
- devscontext-0.1.0/tests/fixtures/meeting_transcript.json +35 -0
- devscontext-0.1.0/tests/test_fireflies.py +352 -0
- devscontext-0.1.0/tests/test_gmail.py +284 -0
- devscontext-0.1.0/tests/test_integration.py +214 -0
- devscontext-0.1.0/tests/test_jira.py +329 -0
- devscontext-0.1.0/tests/test_local_docs.py +587 -0
- devscontext-0.1.0/tests/test_preprocessor.py +550 -0
- devscontext-0.1.0/tests/test_registry.py +277 -0
- devscontext-0.1.0/tests/test_server.py +107 -0
- devscontext-0.1.0/tests/test_slack.py +351 -0
- devscontext-0.1.0/tests/test_storage.py +252 -0
- devscontext-0.1.0/tests/test_synthesis.py +447 -0
- devscontext-0.1.0/tests/test_synthesis_quality.py +419 -0
- devscontext-0.1.0/tests/test_utils.py +227 -0
- devscontext-0.1.0/tests/test_watcher.py +217 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# DevsContext Configuration
|
|
2
|
+
# Copy this file to .devscontext.yaml and configure your adapters.
|
|
3
|
+
# API tokens should be set via environment variables for security.
|
|
4
|
+
|
|
5
|
+
adapters:
|
|
6
|
+
jira:
|
|
7
|
+
enabled: true
|
|
8
|
+
base_url: "https://your-company.atlassian.net"
|
|
9
|
+
email: "${JIRA_EMAIL}"
|
|
10
|
+
api_token: "${JIRA_API_TOKEN}"
|
|
11
|
+
|
|
12
|
+
fireflies:
|
|
13
|
+
enabled: false
|
|
14
|
+
api_key: "${FIREFLIES_API_KEY}"
|
|
15
|
+
|
|
16
|
+
local_docs:
|
|
17
|
+
enabled: true
|
|
18
|
+
paths:
|
|
19
|
+
- "./docs"
|
|
20
|
+
- "./CLAUDE.md"
|
|
21
|
+
|
|
22
|
+
synthesis:
|
|
23
|
+
provider: "anthropic" # anthropic, openai, or ollama
|
|
24
|
+
model: "claude-3-haiku-20240307"
|
|
25
|
+
# api_key: "${ANTHROPIC_API_KEY}" # Uses ANTHROPIC_API_KEY env var by default
|
|
26
|
+
|
|
27
|
+
cache:
|
|
28
|
+
ttl_seconds: 300
|
|
29
|
+
max_size: 100
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Lint with ruff
|
|
30
|
+
run: |
|
|
31
|
+
ruff check .
|
|
32
|
+
ruff format --check .
|
|
33
|
+
|
|
34
|
+
- name: Type check with mypy
|
|
35
|
+
run: mypy src/
|
|
36
|
+
|
|
37
|
+
- name: Run tests
|
|
38
|
+
run: pytest tests/ --ignore=tests/test_integration.py
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.12"
|
|
17
|
+
|
|
18
|
+
- name: Install build dependencies
|
|
19
|
+
run: pip install build
|
|
20
|
+
|
|
21
|
+
- name: Build package
|
|
22
|
+
run: python -m build
|
|
23
|
+
|
|
24
|
+
- name: Upload dist
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: dist
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish:
|
|
31
|
+
needs: build
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
environment: pypi
|
|
34
|
+
permissions:
|
|
35
|
+
id-token: write
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- name: Download dist
|
|
39
|
+
uses: actions/download-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: dist
|
|
42
|
+
path: dist/
|
|
43
|
+
|
|
44
|
+
- name: Publish to PyPI
|
|
45
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
208
|
+
|
|
209
|
+
# DevsContext specific
|
|
210
|
+
.devscontext.yaml
|
|
211
|
+
.devscontext/
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
**IMPORTANT: DevsContext is the product we are building. The payments-service, PROJ-1234, webhook examples, and other sample data in docs/example/ and tests/fixtures/ are SAMPLE DATA for testing — do NOT implement them. We are building the MCP server tool, not the example application.**
|
|
2
|
+
|
|
3
|
+
# DevsContext
|
|
4
|
+
|
|
5
|
+
## What is this?
|
|
6
|
+
DevsContext is an open-source MCP server (Python) that provides AI coding agents
|
|
7
|
+
with synthesized engineering context from SDLC tools (Jira, Fireflies, local docs).
|
|
8
|
+
|
|
9
|
+
When a developer asks their AI agent to work on a task, DevsContext fetches relevant
|
|
10
|
+
data on-demand from connected sources, synthesizes it via LLM into a structured
|
|
11
|
+
context block, and returns it through MCP.
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
- MCP server using the official Python MCP SDK (`mcp` package)
|
|
15
|
+
- On-demand fetching with optional pre-processing agent
|
|
16
|
+
- Sources: Jira REST API, Fireflies GraphQL API, Slack, Gmail, local markdown docs
|
|
17
|
+
- Synthesis: LLM (Claude Haiku / GPT-4o-mini / Ollama) combines raw data into structured block
|
|
18
|
+
- Cache: in-memory TTL cache + optional SQLite for pre-built context
|
|
19
|
+
|
|
20
|
+
### Plugin System
|
|
21
|
+
Source adapters and synthesis engines are plugins.
|
|
22
|
+
- Plugin interfaces defined in src/devscontext/plugins/base.py
|
|
23
|
+
- Built-in plugins: jira, fireflies, slack, gmail, local_docs
|
|
24
|
+
- External plugins: discovered via Python entry points (devscontext.plugins)
|
|
25
|
+
- Plugins are activated by being listed in .devscontext.yaml
|
|
26
|
+
|
|
27
|
+
### Pre-processing Agent
|
|
28
|
+
- Watches Jira for tickets entering a configurable status (default: "Ready for Development")
|
|
29
|
+
- Runs a multi-step pipeline: deep fetch → broad search → thorough matching → multi-pass synthesis
|
|
30
|
+
- Stores pre-built context in SQLite (.devscontext/cache.db)
|
|
31
|
+
- MCP server checks pre-built storage first, falls back to on-demand if not found
|
|
32
|
+
- Agent and MCP server are separate processes sharing the same SQLite file
|
|
33
|
+
|
|
34
|
+
### Fetch Strategy
|
|
35
|
+
Primary source (Jira) fetched first, then all secondary sources in parallel.
|
|
36
|
+
Each source plugin declares if it needs primary context via a needs_primary_context flag.
|
|
37
|
+
|
|
38
|
+
### Optional RAG
|
|
39
|
+
Disabled by default. When enabled via config, enhances local doc matching
|
|
40
|
+
with embedding-based semantic search. Requires: pip install devscontext[rag]
|
|
41
|
+
Index built manually: devscontext index-docs
|
|
42
|
+
|
|
43
|
+
### Tool Behaviors
|
|
44
|
+
- `get_task_context`: Full LLM synthesis, cached
|
|
45
|
+
- `search_context`: No LLM, no cache (fast freeform search)
|
|
46
|
+
- `get_standards`: No LLM, no cache (direct doc retrieval)
|
|
47
|
+
|
|
48
|
+
## Tech Stack
|
|
49
|
+
- Python 3.11+
|
|
50
|
+
- `mcp` - MCP Python SDK for server implementation
|
|
51
|
+
- `httpx` - async HTTP client for API calls
|
|
52
|
+
- `click` - CLI framework
|
|
53
|
+
- `pyyaml` - config parsing
|
|
54
|
+
- `pydantic` - data validation and models
|
|
55
|
+
- `aiosqlite` - async SQLite for pre-built context storage
|
|
56
|
+
|
|
57
|
+
### Optional Dependencies
|
|
58
|
+
All heavy deps are optional. Core install remains lightweight.
|
|
59
|
+
- `anthropic` / `openai` - LLM clients for synthesis
|
|
60
|
+
- `slack_sdk` - pip install devscontext[slack]
|
|
61
|
+
- `google-api-python-client` - pip install devscontext[gmail]
|
|
62
|
+
- `sentence-transformers` - pip install devscontext[rag]
|
|
63
|
+
|
|
64
|
+
## Code Style
|
|
65
|
+
- Use async/await for all I/O operations
|
|
66
|
+
- Type hints on all function signatures
|
|
67
|
+
- Pydantic models for data structures (adapters return typed models, not dicts)
|
|
68
|
+
- Follow standard Python conventions (PEP 8, snake_case)
|
|
69
|
+
- Keep functions small and focused
|
|
70
|
+
- Error handling: never crash the MCP server - catch exceptions in adapters,
|
|
71
|
+
return partial context if a source fails
|
|
72
|
+
- Logging: use `logging` module, structured log messages
|
|
73
|
+
|
|
74
|
+
## Project Structure
|
|
75
|
+
- `src/devscontext/server.py` - MCP server setup and tool registration
|
|
76
|
+
- `src/devscontext/core.py` - main orchestration (fetch -> extract -> synthesize -> return)
|
|
77
|
+
- `src/devscontext/adapters/` - one file per source (jira.py, fireflies.py, slack.py, gmail.py, local_docs.py)
|
|
78
|
+
- `src/devscontext/plugins/` - plugin system (base.py, registry.py, synthesis.py)
|
|
79
|
+
- `src/devscontext/rag/` - optional RAG support (embeddings.py, index.py)
|
|
80
|
+
- `src/devscontext/synthesis.py` - LLM synthesis prompt and client
|
|
81
|
+
- `src/devscontext/cache.py` - in-memory TTL cache
|
|
82
|
+
- `src/devscontext/storage.py` - SQLite storage for pre-built context
|
|
83
|
+
- `src/devscontext/preprocessor.py` - pre-processing agent
|
|
84
|
+
- `src/devscontext/watcher.py` - Jira status watcher for agent
|
|
85
|
+
- `src/devscontext/config.py` - YAML config loading and validation
|
|
86
|
+
- `src/devscontext/cli.py` - CLI commands (init, test, serve, agent)
|
|
87
|
+
- `src/devscontext/utils.py` - text utilities (keyword extraction, truncation)
|
|
88
|
+
|
|
89
|
+
## MCP Tools (3 total)
|
|
90
|
+
1. `get_task_context(task_id: str)` - full synthesized context for a Jira ticket
|
|
91
|
+
2. `search_context(query: str)` - search across all sources by keyword
|
|
92
|
+
3. `get_standards(area: str | None)` - coding standards, optionally filtered
|
|
93
|
+
|
|
94
|
+
## Key Design Decisions
|
|
95
|
+
- On-demand fetching with optional pre-processing for instant retrieval
|
|
96
|
+
- No external vector DB - use NumPy + cosine similarity for optional RAG
|
|
97
|
+
- LLM synthesis happens at retrieval time (or pre-built by agent)
|
|
98
|
+
- Config via `.devscontext.yaml` in project root
|
|
99
|
+
- Auth credentials via environment variables only (never in config file)
|
|
100
|
+
- Graceful degradation: if a source is not configured, skip it and return available context
|
|
101
|
+
- Plugin architecture: adapters and synthesis engines are extensible
|
|
102
|
+
|
|
103
|
+
### Local Docs Matching
|
|
104
|
+
Local docs are matched to tickets via:
|
|
105
|
+
1. Components → doc filenames and headings
|
|
106
|
+
2. Labels → doc filenames and headings
|
|
107
|
+
3. Keywords from ticket title → doc content
|
|
108
|
+
4. Standards docs (CLAUDE.md, .cursorrules, standards/) are always included
|
|
109
|
+
|
|
110
|
+
Docs are classified by path:
|
|
111
|
+
- `architecture/`, `arch/` → architecture docs
|
|
112
|
+
- `standards/`, `style/`, `coding/` → coding standards
|
|
113
|
+
- `adr/`, `adrs/` → architecture decision records
|
|
114
|
+
- `CLAUDE.md`, `.cursorrules` → standards (special files)
|
|
115
|
+
|
|
116
|
+
## Testing
|
|
117
|
+
- Use pytest with pytest-asyncio
|
|
118
|
+
- Mock external APIs in tests (httpx mock)
|
|
119
|
+
- Test the synthesis prompt with fixture data
|
|
120
|
+
|
|
121
|
+
## Commands
|
|
122
|
+
- `devscontext init` - create .devscontext.yaml interactively
|
|
123
|
+
- `devscontext test` - fetch a sample ticket and show synthesized output
|
|
124
|
+
- `devscontext serve` - start MCP server (stdio transport)
|
|
125
|
+
- `devscontext agent start` - start pre-processing agent (watches Jira)
|
|
126
|
+
- `devscontext agent run-once` - process all matching tickets once
|
|
127
|
+
- `devscontext agent status` - show agent and storage status
|
|
128
|
+
- `devscontext agent process TICKET-123` - process a specific ticket
|
|
129
|
+
- `devscontext index-docs` - build RAG index for local docs (requires [rag])
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Contributing to DevsContext
|
|
2
|
+
|
|
3
|
+
## Development Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/Pro0f/devscontext.git
|
|
7
|
+
cd devscontext
|
|
8
|
+
python -m venv venv
|
|
9
|
+
source venv/bin/activate
|
|
10
|
+
pip install -e ".[dev]"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Configure for local testing:
|
|
14
|
+
```bash
|
|
15
|
+
cp .devscontext.yaml.example .devscontext.yaml
|
|
16
|
+
# Edit .devscontext.yaml with your Jira URL
|
|
17
|
+
export JIRA_EMAIL="you@company.com"
|
|
18
|
+
export JIRA_API_TOKEN="your-token"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Running Tests
|
|
22
|
+
|
|
23
|
+
Unit tests (no API keys needed):
|
|
24
|
+
```bash
|
|
25
|
+
pytest tests/ --ignore=tests/test_integration.py
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Integration tests (requires real API keys):
|
|
29
|
+
```bash
|
|
30
|
+
pytest tests/test_integration.py
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Adding a New Adapter
|
|
34
|
+
|
|
35
|
+
1. **Create adapter file** `src/devscontext/adapters/your_source.py`:
|
|
36
|
+
- Extend the `Adapter` base class from `plugins/base.py`
|
|
37
|
+
- Set class attributes: `name`, `source_type`, `config_schema`
|
|
38
|
+
- Implement required methods:
|
|
39
|
+
- `fetch_task_context(task_id, ticket=None) -> SourceContext`
|
|
40
|
+
- `search(query, max_results) -> list[SearchResult]`
|
|
41
|
+
- `health_check() -> bool`
|
|
42
|
+
- Optionally implement `close()` and `format_for_synthesis()`
|
|
43
|
+
|
|
44
|
+
2. **Add config model** to `src/devscontext/models.py`:
|
|
45
|
+
- Create Pydantic model with `enabled`, `primary` fields
|
|
46
|
+
- Add to `SourcesConfig`
|
|
47
|
+
|
|
48
|
+
3. **Register in plugin registry** `src/devscontext/plugins/registry.py`:
|
|
49
|
+
- Add to `register_builtin_plugins()` method
|
|
50
|
+
- Add loading logic in `load_from_config()`
|
|
51
|
+
|
|
52
|
+
4. **Add tests** in `tests/test_your_source.py`
|
|
53
|
+
|
|
54
|
+
See `adapters/slack.py` as a complete reference for communication sources.
|
|
55
|
+
|
|
56
|
+
For full details, see [docs/plugins.md](docs/plugins.md).
|
|
57
|
+
|
|
58
|
+
## Plugin Development
|
|
59
|
+
|
|
60
|
+
DevsContext uses a plugin system for extensibility:
|
|
61
|
+
|
|
62
|
+
- **Adapters**: Fetch context from data sources
|
|
63
|
+
- **Synthesis Plugins**: Process and combine context
|
|
64
|
+
|
|
65
|
+
External plugins can be published as pip packages using entry points.
|
|
66
|
+
See [docs/plugins.md](docs/plugins.md) for the complete guide.
|
|
67
|
+
|
|
68
|
+
## Testing Adapters
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Unit tests (no API keys needed)
|
|
72
|
+
pytest tests/test_your_source.py
|
|
73
|
+
|
|
74
|
+
# Test with real API (integration)
|
|
75
|
+
devscontext test --task YOUR-123
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Testing Pre-processing Agent
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Process a single ticket
|
|
82
|
+
devscontext agent process TEST-123
|
|
83
|
+
|
|
84
|
+
# Check storage status
|
|
85
|
+
devscontext agent status
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Code Quality
|
|
89
|
+
|
|
90
|
+
Before submitting:
|
|
91
|
+
```bash
|
|
92
|
+
ruff check .
|
|
93
|
+
ruff format .
|
|
94
|
+
mypy src/
|
|
95
|
+
pytest tests/ --ignore=tests/test_integration.py
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Requirements:
|
|
99
|
+
- Type hints on all functions
|
|
100
|
+
- Pydantic models for data structures
|
|
101
|
+
- Tests for new functionality
|
|
102
|
+
|
|
103
|
+
## Pull Requests
|
|
104
|
+
|
|
105
|
+
1. Fork and create a branch from `main`
|
|
106
|
+
2. Make your changes with tests
|
|
107
|
+
3. Ensure all checks pass
|
|
108
|
+
4. Open a PR describing what and why
|
|
109
|
+
|
|
110
|
+
## Questions?
|
|
111
|
+
|
|
112
|
+
Open an issue.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Anthropic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|