contextcraft-ai 0.2.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.
- contextcraft_ai-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +38 -0
- contextcraft_ai-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +20 -0
- contextcraft_ai-0.2.0/.github/PULL_REQUEST_TEMPLATE.md +11 -0
- contextcraft_ai-0.2.0/.github/dependabot.yml +20 -0
- contextcraft_ai-0.2.0/.github/workflows/ci.yml +44 -0
- contextcraft_ai-0.2.0/.github/workflows/deploy-docs.yml +46 -0
- contextcraft_ai-0.2.0/.github/workflows/publish-pypi.yml +51 -0
- contextcraft_ai-0.2.0/.github/workflows/release-please.yml +27 -0
- contextcraft_ai-0.2.0/.gitignore +66 -0
- contextcraft_ai-0.2.0/.ideas/runConfigurations/Run_CLI_Demo.xml +0 -0
- contextcraft_ai-0.2.0/.ideas/runConfigurations/Run_Pytest_Coverage.xml +0 -0
- contextcraft_ai-0.2.0/.ideas/runConfigurations/Run_Web_Playground.xml +0 -0
- contextcraft_ai-0.2.0/.pre-commit-config.yaml +27 -0
- contextcraft_ai-0.2.0/.release-please-manifest.json +3 -0
- contextcraft_ai-0.2.0/CHANGELOG.md +24 -0
- contextcraft_ai-0.2.0/CODE_OF_CONDUCT.md +65 -0
- contextcraft_ai-0.2.0/CONTRIBUTING.md +93 -0
- contextcraft_ai-0.2.0/LICENSE +21 -0
- contextcraft_ai-0.2.0/PKG-INFO +199 -0
- contextcraft_ai-0.2.0/README.md +140 -0
- contextcraft_ai-0.2.0/SECURITY.md +28 -0
- contextcraft_ai-0.2.0/benchmarks/run_benchmark.py +256 -0
- contextcraft_ai-0.2.0/docs/api-reference.md +36 -0
- contextcraft_ai-0.2.0/docs/architecture.md +22 -0
- contextcraft_ai-0.2.0/docs/conf.py +17 -0
- contextcraft_ai-0.2.0/docs/index.md +40 -0
- contextcraft_ai-0.2.0/pyproject.toml +142 -0
- contextcraft_ai-0.2.0/release-please-config.json +19 -0
- contextcraft_ai-0.2.0/src/contextcraft/__init__.py +44 -0
- contextcraft_ai-0.2.0/src/contextcraft/__main__.py +8 -0
- contextcraft_ai-0.2.0/src/contextcraft/ast_parser.py +147 -0
- contextcraft_ai-0.2.0/src/contextcraft/cli.py +336 -0
- contextcraft_ai-0.2.0/src/contextcraft/core.py +235 -0
- contextcraft_ai-0.2.0/src/contextcraft/elider.py +232 -0
- contextcraft_ai-0.2.0/src/contextcraft/formatter.py +419 -0
- contextcraft_ai-0.2.0/src/contextcraft/graph.py +495 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/__init__.py +48 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/base.py +158 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/c.py +54 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/cpp.py +35 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/csharp.py +44 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/css.py +79 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/data.py +33 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/generic.py +119 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/go.py +90 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/html.py +119 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/java.py +43 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/json.py +71 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/python.py +93 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/rust.py +83 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/toml.py +64 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/typescript.py +110 -0
- contextcraft_ai-0.2.0/src/contextcraft/languages/yaml.py +73 -0
- contextcraft_ai-0.2.0/src/contextcraft/models.py +410 -0
- contextcraft_ai-0.2.0/src/contextcraft/optimizer.py +335 -0
- contextcraft_ai-0.2.0/src/contextcraft/sanitizer.py +313 -0
- contextcraft_ai-0.2.0/src/contextcraft/scanner.py +454 -0
- contextcraft_ai-0.2.0/tests/conftest.py +234 -0
- contextcraft_ai-0.2.0/tests/test_ast_and_elider.py +107 -0
- contextcraft_ai-0.2.0/tests/test_end_to_end.py +73 -0
- contextcraft_ai-0.2.0/tests/test_graph_and_optimizer.py +90 -0
- contextcraft_ai-0.2.0/tests/test_scanner_sanitizer.py +105 -0
- contextcraft_ai-0.2.0/tests/test_web_playground.py +57 -0
- contextcraft_ai-0.2.0/uv.lock +2810 -0
- contextcraft_ai-0.2.0/web/__init__.py +3 -0
- contextcraft_ai-0.2.0/web/app.py +234 -0
- contextcraft_ai-0.2.0/web/templates/index.html +347 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a bug, AST parsing edge case, or token budget discrepancy
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: ["bug", "triage"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thank you for taking the time to report an issue in **ContextCraft**!
|
|
10
|
+
|
|
11
|
+
- type: input
|
|
12
|
+
id: version
|
|
13
|
+
attributes:
|
|
14
|
+
label: ContextCraft & Python Version
|
|
15
|
+
description: Output of `contextcraft --version` and `python --version`
|
|
16
|
+
placeholder: "contextcraft 0.1.0, Python 3.11.11 on macOS"
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: reproduction
|
|
22
|
+
attributes:
|
|
23
|
+
label: Minimal Reproduction Steps
|
|
24
|
+
description: Command or Python SDK snippet that triggers the issue
|
|
25
|
+
placeholder: |
|
|
26
|
+
```bash
|
|
27
|
+
uv run contextcraft . --budget 4k --focus "auth"
|
|
28
|
+
```
|
|
29
|
+
validations:
|
|
30
|
+
required: true
|
|
31
|
+
|
|
32
|
+
- type: textarea
|
|
33
|
+
id: expected
|
|
34
|
+
attributes:
|
|
35
|
+
label: Expected vs. Actual Behavior
|
|
36
|
+
description: What did you expect to happen, and what actually occurred?
|
|
37
|
+
validations:
|
|
38
|
+
required: true
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Propose a new language grammar, optimization heuristic, or output adapter
|
|
3
|
+
title: "[Feature]: "
|
|
4
|
+
labels: ["enhancement"]
|
|
5
|
+
body:
|
|
6
|
+
- type: textarea
|
|
7
|
+
id: problem
|
|
8
|
+
attributes:
|
|
9
|
+
label: Problem Statement or Motivation
|
|
10
|
+
description: What workflow or LLM context challenge would this feature solve?
|
|
11
|
+
validations:
|
|
12
|
+
required: true
|
|
13
|
+
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: proposal
|
|
16
|
+
attributes:
|
|
17
|
+
label: Proposed Design or CLI/SDK Interface
|
|
18
|
+
description: Describe how you envision this feature working.
|
|
19
|
+
validations:
|
|
20
|
+
required: true
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## Summary of Changes
|
|
2
|
+
|
|
3
|
+
- **What does this PR do?**
|
|
4
|
+
- **Related Issue(s):** Fixes #
|
|
5
|
+
|
|
6
|
+
## Engineering Quality Checklist
|
|
7
|
+
|
|
8
|
+
- [ ] `uv run ruff check src tests web benchmarks` passes with zero warnings.
|
|
9
|
+
- [ ] `uv run mypy src/contextcraft` passes under `--strict` mode.
|
|
10
|
+
- [ ] `uv run pytest --cov=contextcraft` passes all unit and integration tests.
|
|
11
|
+
- [ ] Documentation (`README.md` or `docs/`) has been updated if CLI flags or SDK APIs changed.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# Maintain dependencies for Python (uv / pyproject.toml)
|
|
4
|
+
- package-ecosystem: "pip"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "weekly"
|
|
8
|
+
open-pull-requests-limit: 5
|
|
9
|
+
labels:
|
|
10
|
+
- "dependencies"
|
|
11
|
+
|
|
12
|
+
# Maintain dependencies for GitHub Actions workflows
|
|
13
|
+
- package-ecosystem: "github-actions"
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: "weekly"
|
|
17
|
+
open-pull-requests-limit: 5
|
|
18
|
+
labels:
|
|
19
|
+
- "ci"
|
|
20
|
+
- "dependencies"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
quality-and-tests:
|
|
14
|
+
name: Quality & Pytest (${{ matrix.os }}, Python ${{ matrix.python-version }})
|
|
15
|
+
runs-on: ${{ matrix.os }}
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
20
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v4
|
|
28
|
+
with:
|
|
29
|
+
enable-cache: true
|
|
30
|
+
|
|
31
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
32
|
+
run: uv python install ${{ matrix.python-version }}
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: uv sync --locked --all-extras --dev
|
|
36
|
+
|
|
37
|
+
- name: Run Ruff linter
|
|
38
|
+
run: uv run ruff check src tests web benchmarks
|
|
39
|
+
|
|
40
|
+
- name: Run Mypy strict type checker
|
|
41
|
+
run: uv run mypy src/contextcraft
|
|
42
|
+
|
|
43
|
+
- name: Run Pytest suite with coverage
|
|
44
|
+
run: uv run pytest --cov=contextcraft --cov-report=term-missing
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: "pages"
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
deploy-docs:
|
|
19
|
+
environment:
|
|
20
|
+
name: github-pages
|
|
21
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout repository
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- name: Install uv
|
|
28
|
+
uses: astral-sh/setup-uv@v4
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: uv sync --locked --all-extras --dev
|
|
32
|
+
|
|
33
|
+
- name: Configure GitHub Pages
|
|
34
|
+
uses: actions/configure-pages@v5
|
|
35
|
+
|
|
36
|
+
- name: Build Sphinx documentation
|
|
37
|
+
run: uv run --locked sphinx-build -W --keep-going -b dirhtml docs docs/_build/html
|
|
38
|
+
|
|
39
|
+
- name: Upload Pages artifact
|
|
40
|
+
uses: actions/upload-pages-artifact@v3
|
|
41
|
+
with:
|
|
42
|
+
path: docs/_build/html
|
|
43
|
+
|
|
44
|
+
- name: Deploy to GitHub Pages
|
|
45
|
+
id: deployment
|
|
46
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
release:
|
|
8
|
+
types: [published]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
name: Build distribution artifacts
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
uses: astral-sh/setup-uv@v4
|
|
23
|
+
|
|
24
|
+
- name: Build sdist and wheel
|
|
25
|
+
run: uv build
|
|
26
|
+
|
|
27
|
+
- name: Upload build artifacts
|
|
28
|
+
uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: python-package-distributions
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
publish-pypi:
|
|
34
|
+
name: Publish package to PyPI via Trusted Publishing (OIDC)
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
environment:
|
|
38
|
+
name: pypi
|
|
39
|
+
url: https://pypi.org/p/contextcraft-ai
|
|
40
|
+
permissions:
|
|
41
|
+
id-token: write
|
|
42
|
+
contents: read
|
|
43
|
+
steps:
|
|
44
|
+
- name: Download built artifacts
|
|
45
|
+
uses: actions/download-artifact@v4
|
|
46
|
+
with:
|
|
47
|
+
name: python-package-distributions
|
|
48
|
+
path: dist/
|
|
49
|
+
|
|
50
|
+
- name: Publish to PyPI
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Release Please
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
issues: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: release-please-main
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
release-please:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: Create or update release PR and GitHub release
|
|
22
|
+
uses: googleapis/release-please-action@v4
|
|
23
|
+
with:
|
|
24
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
25
|
+
target-branch: main
|
|
26
|
+
config-file: release-please-config.json
|
|
27
|
+
manifest-file: .release-please-manifest.json
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions & distribution packaging
|
|
7
|
+
*.so
|
|
8
|
+
build/
|
|
9
|
+
develop-eggs/
|
|
10
|
+
dist/
|
|
11
|
+
downloads/
|
|
12
|
+
eggs/
|
|
13
|
+
.eggs/
|
|
14
|
+
lib/
|
|
15
|
+
lib64/
|
|
16
|
+
parts/
|
|
17
|
+
sdist/
|
|
18
|
+
var/
|
|
19
|
+
wheels/
|
|
20
|
+
share/python-wheels/
|
|
21
|
+
*.egg-info/
|
|
22
|
+
.installed.cfg
|
|
23
|
+
*.egg
|
|
24
|
+
MANIFEST
|
|
25
|
+
|
|
26
|
+
# Virtual environments & uv
|
|
27
|
+
.venv/
|
|
28
|
+
venv/
|
|
29
|
+
ENV/
|
|
30
|
+
env/
|
|
31
|
+
.python-version
|
|
32
|
+
|
|
33
|
+
# Testing & coverage artifacts
|
|
34
|
+
.coverage
|
|
35
|
+
.coverage.*
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.pytest_cache/
|
|
40
|
+
.mypy_cache/
|
|
41
|
+
.ruff_cache/
|
|
42
|
+
.hypothesis/
|
|
43
|
+
|
|
44
|
+
# ContextCraft runtime cache & outputs
|
|
45
|
+
.contextcraft_cache/
|
|
46
|
+
.aider.tags.cache*/
|
|
47
|
+
context_output.md
|
|
48
|
+
context_output.xml
|
|
49
|
+
context_output.json
|
|
50
|
+
|
|
51
|
+
# Documentation build
|
|
52
|
+
site/
|
|
53
|
+
docs/_build/
|
|
54
|
+
|
|
55
|
+
# JetBrains PyCharm (Ignore workspace state, keep shared runConfigurations)
|
|
56
|
+
.idea/*
|
|
57
|
+
!.idea/runConfigurations/
|
|
58
|
+
!.idea/runConfigurations/*.xml
|
|
59
|
+
|
|
60
|
+
# OS & Editor files
|
|
61
|
+
.DS_Store
|
|
62
|
+
Thumbsumbs.db
|
|
63
|
+
*.swp
|
|
64
|
+
*~
|
|
65
|
+
.env
|
|
66
|
+
.env.*
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v6.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-toml
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
args: ["--maxkb=1000"]
|
|
11
|
+
- id: detect-private-key
|
|
12
|
+
|
|
13
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
14
|
+
rev: v0.17.1
|
|
15
|
+
hooks:
|
|
16
|
+
- id: ruff-check
|
|
17
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
18
|
+
- id: ruff-format
|
|
19
|
+
|
|
20
|
+
- repo: local
|
|
21
|
+
hooks:
|
|
22
|
+
- id: mypy
|
|
23
|
+
name: mypy
|
|
24
|
+
entry: uv run --locked --extra dev mypy src/contextcraft
|
|
25
|
+
language: system
|
|
26
|
+
types_or: [python, pyi]
|
|
27
|
+
pass_filenames: false
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.0](https://github.com/khanhtq29vn/contextcraft/compare/v0.1.0...v0.2.0) (2026-10-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **ast:** remove SymbolKind; symbol kinds are now strings.
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **metadata:** correct project repository and documentation URLs ([224d77d](https://github.com/khanhtq29vn/contextcraft/commit/224d77da95f7899f85218392c10384189a7c6ee6))
|
|
13
|
+
* **types:** remove mypy suppressions and type dependency graphs ([658cd54](https://github.com/khanhtq29vn/contextcraft/commit/658cd543826cec63c3bdc4e455b35dc550a77ee3))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
|
|
18
|
+
* correct GitHub source repository URL ([f99889e](https://github.com/khanhtq29vn/contextcraft/commit/f99889ea9bea33639f3a3a14505ab7e989174e20))
|
|
19
|
+
* migrate to Sphinx with Furo and KaTeX ([e6d7482](https://github.com/khanhtq29vn/contextcraft/commit/e6d748265db10e8481ed1eef72107e3c7c4e575d))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Code Refactoring
|
|
23
|
+
|
|
24
|
+
* **ast:** introduce language-specific extractors ([bd188a1](https://github.com/khanhtq29vn/contextcraft/commit/bd188a1f713e17a593fb3ffbed7c32765f36e21a))
|
|
@@ -0,0 +1,65 @@
|
|
|
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 overall
|
|
26
|
+
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 address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Project maintainers 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
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
49
|
+
an individual is officially representing the community in public spaces.
|
|
50
|
+
|
|
51
|
+
## Enforcement
|
|
52
|
+
|
|
53
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
54
|
+
reported to the project maintainers via GitHub Discussions or by opening a
|
|
55
|
+
confidential report with the repository owner (`@khanhtq29vn`). All complaints
|
|
56
|
+
will be reviewed and investigated promptly and fairly.
|
|
57
|
+
|
|
58
|
+
## Attribution
|
|
59
|
+
|
|
60
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
61
|
+
version 2.1, available at
|
|
62
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
63
|
+
|
|
64
|
+
[homepage]: https://www.contributor-covenant.org
|
|
65
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Contributing to ContextCraft
|
|
2
|
+
|
|
3
|
+
First off, thank you for considering contributing to **ContextCraft**! Whether you are adding support for a new programming language grammar, refining the Personalized PageRank graph heuristics, or improving documentation, your contributions are deeply appreciated.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Quick Development Setup (Under 60 Seconds)
|
|
8
|
+
|
|
9
|
+
We use [Astral's `uv`](https://docs.astral.sh/uv/) for lightning-fast dependency management and virtual environments.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# 1. Fork and clone the repository
|
|
13
|
+
git clone https://github.com/<your-username>/contextcraft.git
|
|
14
|
+
cd contextcraft
|
|
15
|
+
|
|
16
|
+
# 2. Create the virtual environment and install all dependencies (core + web + dev)
|
|
17
|
+
uv sync --locked --all-extras --dev
|
|
18
|
+
|
|
19
|
+
# 3. Install pre-commit hooks
|
|
20
|
+
uv run pre-commit install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. Running the Quality & Verification Suite
|
|
26
|
+
|
|
27
|
+
Before submitting a Pull Request, please ensure all three verification checks pass locally:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 1. Lint & import sorting check
|
|
31
|
+
uv run ruff check src tests web benchmarks
|
|
32
|
+
|
|
33
|
+
# 2. Strict static type checking
|
|
34
|
+
uv run mypy src/contextcraft
|
|
35
|
+
|
|
36
|
+
# 3. Full test suite with branch coverage
|
|
37
|
+
uv run pytest --cov=contextcraft --cov-report=term-missing
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Documentation
|
|
43
|
+
|
|
44
|
+
The documentation uses Sphinx, Furo, and MyST Markdown. After installing the development dependencies, preview it with live reload:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv run --locked sphinx-autobuild -b dirhtml docs docs/_build/html
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Open <http://127.0.0.1:8000>. To build with warnings treated as errors:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uv run --locked sphinx-build -W --keep-going -b dirhtml docs docs/_build/html
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 3. High-Impact Ways to Contribute
|
|
59
|
+
|
|
60
|
+
1. **Adding or Enhancing Language Support (`src/contextcraft/scanner.py` & `ast_parser.py`):**
|
|
61
|
+
- Map additional file extensions in `RepositoryScanner.EXTENSION_LANGUAGE_MAP`.
|
|
62
|
+
- Add node types or docstring conventions in `UniversalASTParser`.
|
|
63
|
+
2. **Improving Cross-File Import Resolution (`src/contextcraft/graph.py`):**
|
|
64
|
+
- Enhance `_resolve_imported_files` for Rust (`use crate::...`), Go, C/C++ `#include`, or Java package imports.
|
|
65
|
+
3. **Expanding Secret Detection Rules (`src/contextcraft/sanitizer.py`):**
|
|
66
|
+
- Add zero-false-positive token regexes to `SecretSanitizer._TOKEN_PATTERNS`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 4. Pull Request Process
|
|
71
|
+
|
|
72
|
+
1. Create a descriptive feature branch (`git checkout -b feat/rust-use-resolver`).
|
|
73
|
+
2. Add unit tests in `tests/` covering your new functionality.
|
|
74
|
+
3. Commit using [Conventional Commits](https://www.conventionalcommits.org/) (e.g., `feat(ast): add Rust trait signature extraction`).
|
|
75
|
+
4. Push to your fork and open a Pull Request against `main`.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Releases
|
|
80
|
+
|
|
81
|
+
[Release Please](https://github.com/googleapis/release-please) opens or updates a release PR after pushes to `main`. It determines the next version from Conventional Commits:
|
|
82
|
+
|
|
83
|
+
- `fix:` and `perf:` produce patch releases.
|
|
84
|
+
- `feat:` produces minor releases.
|
|
85
|
+
- `BREAKING CHANGE:` footers or `!` produce minor releases while the version is `0.x`, and major releases after `1.0`.
|
|
86
|
+
|
|
87
|
+
The release PR updates `pyproject.toml`, `src/contextcraft/__init__.py`, `uv.lock`, `CHANGELOG.md`, and `.release-please-manifest.json`. Review it, wait for CI to pass, then merge it. The next workflow run creates a `v`-prefixed tag and a GitHub release. Use a conventional squash-merge title for normal PRs, and preserve the generated title and body when merging release PRs.
|
|
88
|
+
|
|
89
|
+
The manifest starts at the existing `v0.1.0` release. The configuration's `bootstrap-sha` limits the first release's commit history to changes after that tag; Release Please ignores it after the first release PR is merged.
|
|
90
|
+
|
|
91
|
+
### PyPI publishing
|
|
92
|
+
|
|
93
|
+
GitHub releases do not publish to PyPI automatically. To publish an existing release, manually run **Actions → Publish to PyPI → Run workflow** from `main` and enter its tag, such as `v0.2.0`. The workflow builds that tag and uses the existing `pypi` environment and Trusted Publishing setup.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ContextCraft Contributors
|
|
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.
|