mdgraph-ai 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.
- mdgraph_ai-0.1.0/.github/workflows/publish.yml +39 -0
- mdgraph_ai-0.1.0/.gitignore +224 -0
- mdgraph_ai-0.1.0/CHANGELOG.md +25 -0
- mdgraph_ai-0.1.0/CODE_OF_CONDUCT.md +73 -0
- mdgraph_ai-0.1.0/CONTRIBUTING.md +102 -0
- mdgraph_ai-0.1.0/LICENSE +122 -0
- mdgraph_ai-0.1.0/PKG-INFO +304 -0
- mdgraph_ai-0.1.0/README.md +253 -0
- mdgraph_ai-0.1.0/SECURITY.md +27 -0
- mdgraph_ai-0.1.0/config.example.yaml +32 -0
- mdgraph_ai-0.1.0/examples/.cache.db +0 -0
- mdgraph_ai-0.1.0/examples/agent_example.py +71 -0
- mdgraph_ai-0.1.0/examples/quickstart.py +74 -0
- mdgraph_ai-0.1.0/examples/sample_knowledge/concepts/it_department.md +15 -0
- mdgraph_ai-0.1.0/examples/sample_knowledge/concepts/remote_work_policy.md +18 -0
- mdgraph_ai-0.1.0/examples/sample_knowledge/concepts/security_guidelines.md +14 -0
- mdgraph_ai-0.1.0/examples/sample_knowledge/concepts/vendor_portal.md +15 -0
- mdgraph_ai-0.1.0/examples/sample_knowledge/index.md +17 -0
- mdgraph_ai-0.1.0/pyproject.toml +110 -0
- mdgraph_ai-0.1.0/src/mdgraph/__init__.py +35 -0
- mdgraph_ai-0.1.0/src/mdgraph/cli.py +411 -0
- mdgraph_ai-0.1.0/src/mdgraph/compiler/__init__.py +11 -0
- mdgraph_ai-0.1.0/src/mdgraph/compiler/base.py +17 -0
- mdgraph_ai-0.1.0/src/mdgraph/compiler/llm_compiler.py +122 -0
- mdgraph_ai-0.1.0/src/mdgraph/compiler/mock_compiler.py +99 -0
- mdgraph_ai-0.1.0/src/mdgraph/compiler/prompt.py +39 -0
- mdgraph_ai-0.1.0/src/mdgraph/config.py +102 -0
- mdgraph_ai-0.1.0/src/mdgraph/indexer/__init__.py +12 -0
- mdgraph_ai-0.1.0/src/mdgraph/indexer/base.py +83 -0
- mdgraph_ai-0.1.0/src/mdgraph/indexer/postgres_cache.py +311 -0
- mdgraph_ai-0.1.0/src/mdgraph/indexer/sqlite_cache.py +523 -0
- mdgraph_ai-0.1.0/src/mdgraph/indexer/sync.py +88 -0
- mdgraph_ai-0.1.0/src/mdgraph/ingestion/__init__.py +16 -0
- mdgraph_ai-0.1.0/src/mdgraph/ingestion/base.py +30 -0
- mdgraph_ai-0.1.0/src/mdgraph/ingestion/html.py +168 -0
- mdgraph_ai-0.1.0/src/mdgraph/ingestion/ingestor.py +70 -0
- mdgraph_ai-0.1.0/src/mdgraph/ingestion/markdown.py +39 -0
- mdgraph_ai-0.1.0/src/mdgraph/ingestion/pdf.py +60 -0
- mdgraph_ai-0.1.0/src/mdgraph/models.py +279 -0
- mdgraph_ai-0.1.0/src/mdgraph/server/__init__.py +5 -0
- mdgraph_ai-0.1.0/src/mdgraph/server/mcp_server.py +172 -0
- mdgraph_ai-0.1.0/src/mdgraph/storage/__init__.py +6 -0
- mdgraph_ai-0.1.0/src/mdgraph/storage/git_repo.py +211 -0
- mdgraph_ai-0.1.0/src/mdgraph/storage/okf_file.py +125 -0
- mdgraph_ai-0.1.0/tests/conftest.py +59 -0
- mdgraph_ai-0.1.0/tests/test_cli.py +97 -0
- mdgraph_ai-0.1.0/tests/test_compiler.py +45 -0
- mdgraph_ai-0.1.0/tests/test_git_repo.py +69 -0
- mdgraph_ai-0.1.0/tests/test_ingestion.py +69 -0
- mdgraph_ai-0.1.0/tests/test_mcp_server.py +73 -0
- mdgraph_ai-0.1.0/tests/test_models.py +76 -0
- mdgraph_ai-0.1.0/tests/test_sqlite_cache.py +94 -0
- mdgraph_ai-0.1.0/tests/test_sync.py +47 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Trigger the workflow only when a new GitHub Release is published
|
|
4
|
+
on:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
name: Build and Publish Python Package
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
# Define the environment name (required for PyPI Trusted Publishing)
|
|
14
|
+
environment:
|
|
15
|
+
name: pypi
|
|
16
|
+
url: https://pypi.org/p/mdgraph-ai
|
|
17
|
+
|
|
18
|
+
# Required permissions for PyPI OIDC authentication
|
|
19
|
+
permissions:
|
|
20
|
+
id-token: write
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout Source Code
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- name: Set up Python
|
|
28
|
+
uses: actions/setup-python@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: "3.12"
|
|
31
|
+
|
|
32
|
+
- name: Install build tools
|
|
33
|
+
run: python -m pip install --upgrade pip build
|
|
34
|
+
|
|
35
|
+
- name: Build Source Distribution and Wheel
|
|
36
|
+
run: python -m build
|
|
37
|
+
|
|
38
|
+
- name: Publish Package to PyPI
|
|
39
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,224 @@
|
|
|
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
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
devops.md
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
.pypirc
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-10-17
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Google Open Knowledge Format (OKF v0.2)** implementation with Pydantic validation and serialization.
|
|
14
|
+
- **Universal Ingestion Pipeline** supporting PDF (`pypdf`, `docling`), HTML with structural table extraction, Markdown, and plain text.
|
|
15
|
+
- **Pluggable LLM Compiler** powered by `LiteLLM` supporting OpenAI, Anthropic, Gemini, and local Ollama models.
|
|
16
|
+
- **Deterministic Rule-Based Offline Compiler** for offline test and production setups without API keys.
|
|
17
|
+
- **Git-Backed Truth Storage Layer** ensuring Markdown files in Git serve as the single source of truth.
|
|
18
|
+
- **SQLite FTS5 Vectorless Relational Cache** with BM25 full-text keyword ranking.
|
|
19
|
+
- **Multi-Hop Graph Traversal** using native SQL Recursive Common Table Expressions (`WITH RECURSIVE`).
|
|
20
|
+
- **Shortest Path Topological Search** via SQL Recursive CTEs.
|
|
21
|
+
- **Optional Enterprise PostgreSQL Backend** with `JSONB`, `tsvector`, and recursive CTE support.
|
|
22
|
+
- **Incremental & Full Index Synchronization Worker** (`IndexSyncWorker`).
|
|
23
|
+
- **Native FastMCP Server** exposing `get_concept()`, `read_concept_body()`, `search_knowledge()`, `traverse_graph()`, `find_path()`, `list_concepts()`, `get_graph_stats()`, and `reindex()` over SSE and stdio transports.
|
|
24
|
+
- **Rich Interactive CLI (`mdgraph`)** with commands: `init`, `ingest`, `compile`, `index`, `query`, `traverse`, `show`, `stats`, `serve`.
|
|
25
|
+
- Comprehensive test suite with 23 passing tests across all modules.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
**conduct@mdgraph.dev**. All complaints will be reviewed and investigated promptly
|
|
64
|
+
and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Attribution
|
|
70
|
+
|
|
71
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
|
|
72
|
+
version 2.1, available at
|
|
73
|
+
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Contributing to MdGraph
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to **MdGraph**!
|
|
4
|
+
|
|
5
|
+
MdGraph is an open-source storage engine implementing Google's Open Knowledge Format (OKF) to build deterministic, traversable, and version-controlled context for autonomous AI agents.
|
|
6
|
+
|
|
7
|
+
Whether you're fixing a bug, adding a parser for new file formats, improving graph traversal algorithms, or extending MCP tools, we welcome your contributions.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Code of Conduct
|
|
12
|
+
|
|
13
|
+
This project adheres to the [Contributor Covenant](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Development Setup
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
- **Python**: 3.10, 3.11, 3.12, 3.13, or 3.14
|
|
22
|
+
- **Git**: Installed and configured on your system
|
|
23
|
+
|
|
24
|
+
### 1. Clone the Repository
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
git clone https://github.com/firecodex/mdgraph.git
|
|
28
|
+
cd mdgraph
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Create and Activate a Virtual Environment
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
python3 -m venv .venv
|
|
35
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 3. Install in Editable Mode with Dev Dependencies
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install -e ".[dev]"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Development Workflow
|
|
47
|
+
|
|
48
|
+
### Running Tests
|
|
49
|
+
|
|
50
|
+
We maintain strict test coverage. Run the test suite using `pytest`:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pytest
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Run tests with verbose output:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pytest -v
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Code Formatting and Linting
|
|
63
|
+
|
|
64
|
+
We adhere to standard Python PEP 8 styling, formatted with `ruff`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Check linting
|
|
68
|
+
ruff check .
|
|
69
|
+
|
|
70
|
+
# Fix auto-fixable lint issues
|
|
71
|
+
ruff check --fix .
|
|
72
|
+
|
|
73
|
+
# Check formatting
|
|
74
|
+
ruff format --check .
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Submitting Pull Requests
|
|
80
|
+
|
|
81
|
+
1. **Fork the Repository**: Create your own fork and create a feature branch:
|
|
82
|
+
```bash
|
|
83
|
+
git checkout -b feature/my-new-feature
|
|
84
|
+
```
|
|
85
|
+
2. **Make Your Changes**: Write clean, readable code with descriptive comments and type annotations where appropriate.
|
|
86
|
+
3. **Add Tests**: Every bug fix or new feature must include corresponding unit or integration tests in `tests/`.
|
|
87
|
+
4. **Run the Full Test Suite**: Ensure all existing and new tests pass before submitting.
|
|
88
|
+
5. **Commit Your Changes**: Follow conventional commits:
|
|
89
|
+
- `feat: add support for docx document ingestion`
|
|
90
|
+
- `fix: resolve cycle prevention edge case in recursive CTE`
|
|
91
|
+
- `docs: update FastMCP tool signatures in README`
|
|
92
|
+
6. **Open a Pull Request**: Open a PR targeting the `main` branch with a clear description of the problem solved and changes made.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Architecture Guidelines
|
|
97
|
+
|
|
98
|
+
- **Compiler vs. Cache Separation**: Keep the Compiler Layer (heavy, LLM-driven, state-mutating) strictly decoupled from the Query Cache (lightweight, read-optimized, vectorless index).
|
|
99
|
+
- **Strict OKF Conformance**: Ensure all generated Markdown files adhere strictly to Google's Open Knowledge Format (non-empty `type`, YAML frontmatter, explicit links `[Title](./target.md)`).
|
|
100
|
+
- **Git-Backed Truth**: The Markdown filesystem in Git is always the single source of truth. The database cache must be disposable and completely rebuildable from Git at any time.
|
|
101
|
+
|
|
102
|
+
Thank you for helping make context engines better for autonomous AI!
|
mdgraph_ai-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean any work of authorship, including
|
|
48
|
+
the original version of the Work and any modifications or additions
|
|
49
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
50
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
51
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
52
|
+
the copyright owner.
|
|
53
|
+
|
|
54
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
55
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
56
|
+
subsequently incorporated within the Work.
|
|
57
|
+
|
|
58
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
59
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
60
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
61
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
62
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
63
|
+
Work and such Derivative Works in Source or Object form.
|
|
64
|
+
|
|
65
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
(except as stated in this section) patent license to make, have made,
|
|
69
|
+
use, offer to sell, sell, import, and otherwise transfer the Work.
|
|
70
|
+
|
|
71
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
72
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
73
|
+
modifications, and in Source or Object form, provided that You
|
|
74
|
+
meet the following conditions:
|
|
75
|
+
|
|
76
|
+
(a) You must give any other recipients of the Work or
|
|
77
|
+
Derivative Works a copy of this License; and
|
|
78
|
+
|
|
79
|
+
(b) You must cause any modified files to carry prominent notices
|
|
80
|
+
stating that You changed the files; and
|
|
81
|
+
|
|
82
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
83
|
+
that You distribute, all copyright, patent, trademark, and
|
|
84
|
+
attribution notices from the Source form of the Work; and
|
|
85
|
+
|
|
86
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
87
|
+
distribution, then any Derivative Works that You distribute must
|
|
88
|
+
include a readable copy of the attribution notices contained
|
|
89
|
+
within such NOTICE file.
|
|
90
|
+
|
|
91
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
92
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
93
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
94
|
+
this License, without any additional terms or conditions.
|
|
95
|
+
|
|
96
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
97
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
98
|
+
except as required for reasonable and customary use in describing the
|
|
99
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
100
|
+
|
|
101
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
102
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
103
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
104
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
105
|
+
implied, including, without limitation, any warranties or conditions
|
|
106
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
107
|
+
PARTICULAR PURPOSE.
|
|
108
|
+
|
|
109
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
110
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
111
|
+
unless required by applicable law (such as deliberate and grossly
|
|
112
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
113
|
+
liable to You for damages, including any direct, indirect, special,
|
|
114
|
+
incidental, or consequential damages of any character arising as a
|
|
115
|
+
result of this License or out of the use or inability to use the
|
|
116
|
+
Work.
|
|
117
|
+
|
|
118
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
119
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
120
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
121
|
+
or other liability obligations and/or rights consistent with this
|
|
122
|
+
License.
|