nexus-dev 1.0.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.
- nexus_dev-1.0.0/.agent/workflows/index-code.md +46 -0
- nexus_dev-1.0.0/.agent/workflows/record-lesson.md +44 -0
- nexus_dev-1.0.0/.agent/workflows/search-first.md +49 -0
- nexus_dev-1.0.0/.agent/workflows/start-session.md +30 -0
- nexus_dev-1.0.0/.github/workflows/ci.yml +122 -0
- nexus_dev-1.0.0/.github/workflows/create-release.yml +114 -0
- nexus_dev-1.0.0/.github/workflows/release.yml +77 -0
- nexus_dev-1.0.0/.gitignore +84 -0
- nexus_dev-1.0.0/.python-version +1 -0
- nexus_dev-1.0.0/AGENTS.md +98 -0
- nexus_dev-1.0.0/CONTRIBUTING.md +140 -0
- nexus_dev-1.0.0/Dockerfile +36 -0
- nexus_dev-1.0.0/LICENSE +21 -0
- nexus_dev-1.0.0/Makefile +226 -0
- nexus_dev-1.0.0/PKG-INFO +436 -0
- nexus_dev-1.0.0/README.md +402 -0
- nexus_dev-1.0.0/docker-compose.yml +24 -0
- nexus_dev-1.0.0/docs/AGENTS_TEMPLATE.md +80 -0
- nexus_dev-1.0.0/docs/configuring-agents.md +82 -0
- nexus_dev-1.0.0/pyproject.toml +107 -0
- nexus_dev-1.0.0/src/nexus_dev/__init__.py +4 -0
- nexus_dev-1.0.0/src/nexus_dev/chunkers/__init__.py +168 -0
- nexus_dev-1.0.0/src/nexus_dev/chunkers/base.py +201 -0
- nexus_dev-1.0.0/src/nexus_dev/chunkers/docs_chunker.py +291 -0
- nexus_dev-1.0.0/src/nexus_dev/chunkers/java_chunker.py +343 -0
- nexus_dev-1.0.0/src/nexus_dev/chunkers/javascript_chunker.py +312 -0
- nexus_dev-1.0.0/src/nexus_dev/chunkers/python_chunker.py +308 -0
- nexus_dev-1.0.0/src/nexus_dev/cli.py +553 -0
- nexus_dev-1.0.0/src/nexus_dev/config.py +198 -0
- nexus_dev-1.0.0/src/nexus_dev/database.py +430 -0
- nexus_dev-1.0.0/src/nexus_dev/embeddings.py +301 -0
- nexus_dev-1.0.0/src/nexus_dev/server.py +669 -0
- nexus_dev-1.0.0/templates/pre-commit-hook +33 -0
- nexus_dev-1.0.0/tests/__init__.py +1 -0
- nexus_dev-1.0.0/tests/chunkers/__init__.py +1 -0
- nexus_dev-1.0.0/tests/chunkers/test_base.py +117 -0
- nexus_dev-1.0.0/tests/chunkers/test_docs_chunker.py +106 -0
- nexus_dev-1.0.0/tests/chunkers/test_java_chunker.py +99 -0
- nexus_dev-1.0.0/tests/chunkers/test_javascript_chunker.py +120 -0
- nexus_dev-1.0.0/tests/chunkers/test_python_chunker.py +129 -0
- nexus_dev-1.0.0/tests/chunkers/test_registry.py +91 -0
- nexus_dev-1.0.0/tests/conftest.py +261 -0
- nexus_dev-1.0.0/tests/unit/__init__.py +1 -0
- nexus_dev-1.0.0/tests/unit/test_cli.py +239 -0
- nexus_dev-1.0.0/tests/unit/test_config.py +146 -0
- nexus_dev-1.0.0/tests/unit/test_database.py +134 -0
- nexus_dev-1.0.0/tests/unit/test_database_operations.py +512 -0
- nexus_dev-1.0.0/tests/unit/test_embeddings.py +324 -0
- nexus_dev-1.0.0/tests/unit/test_security.py +203 -0
- nexus_dev-1.0.0/tests/unit/test_server.py +510 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Index new files after creating important modules
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Index New Code Workflow
|
|
6
|
+
|
|
7
|
+
Use this workflow after creating new important files to add them to the knowledge base.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. After creating a new file, index it:
|
|
12
|
+
```
|
|
13
|
+
index_file("<path/to/new/file.py>")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. Verify it was indexed:
|
|
17
|
+
```
|
|
18
|
+
search_code("<main function or class name from new file>")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## When to Index
|
|
22
|
+
|
|
23
|
+
**DO index:**
|
|
24
|
+
- New modules with reusable functions or classes
|
|
25
|
+
- New API endpoints or handlers
|
|
26
|
+
- Configuration files with important settings
|
|
27
|
+
- Important utility functions
|
|
28
|
+
|
|
29
|
+
**DON'T index (automatically handled by reindex):**
|
|
30
|
+
- Test files
|
|
31
|
+
- Generated files
|
|
32
|
+
- Temporary or scratch files
|
|
33
|
+
|
|
34
|
+
## Bulk Reindex
|
|
35
|
+
|
|
36
|
+
To reindex the entire project:
|
|
37
|
+
// turbo
|
|
38
|
+
```bash
|
|
39
|
+
cd /Users/mmornati/Projects/nexus-dev && nexus-reindex --yes
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## When to Use
|
|
43
|
+
|
|
44
|
+
- After creating a new important source file
|
|
45
|
+
- After major refactoring that changes file structure
|
|
46
|
+
- When you notice search results are stale
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Record a debugging lesson after solving a problem
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Record Lesson Workflow
|
|
6
|
+
|
|
7
|
+
Use this workflow after solving a non-trivial bug or problem to save it for future reference.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. Identify the problem you just solved
|
|
12
|
+
- What error or unexpected behavior occurred?
|
|
13
|
+
- What file(s) were affected?
|
|
14
|
+
|
|
15
|
+
2. Document the solution:
|
|
16
|
+
```
|
|
17
|
+
record_lesson(
|
|
18
|
+
problem="<clear description of the problem>",
|
|
19
|
+
solution="<how you fixed it>",
|
|
20
|
+
context="<file path or additional context>"
|
|
21
|
+
)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
3. Verify the lesson was recorded:
|
|
25
|
+
```
|
|
26
|
+
search_lessons("<keywords from your problem>")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
record_lesson(
|
|
33
|
+
problem="TypeError: Cannot read property 'id' of undefined when fetching user",
|
|
34
|
+
solution="Added null check before accessing user.id, return early if user is undefined",
|
|
35
|
+
context="src/services/user_service.py line 45"
|
|
36
|
+
)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## When to Use
|
|
40
|
+
|
|
41
|
+
- After fixing a bug that took more than a few minutes
|
|
42
|
+
- After solving a tricky edge case
|
|
43
|
+
- After debugging a configuration issue
|
|
44
|
+
- After resolving a dependency conflict
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Search the knowledge base before implementing a feature
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Search Before Implementing Workflow
|
|
6
|
+
|
|
7
|
+
Use this workflow before writing new code to find existing implementations and patterns.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. Search for similar existing code:
|
|
12
|
+
```
|
|
13
|
+
search_code("<feature or function description>")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. Check documentation for guidance:
|
|
17
|
+
```
|
|
18
|
+
search_docs("<topic or configuration>")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3. Look for relevant lessons:
|
|
22
|
+
```
|
|
23
|
+
search_lessons("<potential issues in this area>")
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
4. Review results and identify:
|
|
27
|
+
- Existing patterns to follow
|
|
28
|
+
- Potential pitfalls to avoid
|
|
29
|
+
- Related code that might need updates
|
|
30
|
+
|
|
31
|
+
## Example: Implementing User Authentication
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
# Find existing auth code
|
|
35
|
+
search_code("authentication login")
|
|
36
|
+
|
|
37
|
+
# Check for auth documentation
|
|
38
|
+
search_docs("authentication setup")
|
|
39
|
+
|
|
40
|
+
# Look for past auth issues
|
|
41
|
+
search_lessons("authentication error")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## When to Use
|
|
45
|
+
|
|
46
|
+
- Before implementing any new feature
|
|
47
|
+
- Before refactoring existing code
|
|
48
|
+
- When you're unsure how something is currently done
|
|
49
|
+
- When joining a new area of the codebase
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Start a coding session with Nexus-Dev knowledge base
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Start Session Workflow
|
|
6
|
+
|
|
7
|
+
Use this workflow at the beginning of any coding session to load context from the knowledge base.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. Get project context to understand what's indexed:
|
|
12
|
+
```
|
|
13
|
+
get_project_context()
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. If working on a specific area, search for relevant code:
|
|
17
|
+
```
|
|
18
|
+
search_code("<feature or component name>")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3. Check for any relevant lessons from past debugging:
|
|
22
|
+
```
|
|
23
|
+
search_lessons("<area you're working on>")
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## When to Use
|
|
27
|
+
|
|
28
|
+
- At the start of any new coding session
|
|
29
|
+
- When switching to a different part of the codebase
|
|
30
|
+
- Before implementing a new feature
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Nexus-Dev CI Pipeline
|
|
2
|
+
# =====================
|
|
3
|
+
# Validates code quality, runs tests, and publishes coverage
|
|
4
|
+
|
|
5
|
+
name: CI
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main, develop]
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [main]
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
lint:
|
|
19
|
+
name: Code Quality
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Set up Python 3.13
|
|
26
|
+
uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: '3.13'
|
|
29
|
+
|
|
30
|
+
- name: Cache pip dependencies
|
|
31
|
+
uses: actions/cache@v4
|
|
32
|
+
with:
|
|
33
|
+
path: ~/.cache/pip
|
|
34
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
|
|
35
|
+
restore-keys: |
|
|
36
|
+
${{ runner.os }}-pip-
|
|
37
|
+
|
|
38
|
+
- name: Install dependencies
|
|
39
|
+
run: |
|
|
40
|
+
python -m pip install --upgrade pip
|
|
41
|
+
pip install -e ".[dev]"
|
|
42
|
+
|
|
43
|
+
- name: Run linter (ruff)
|
|
44
|
+
run: ruff check src/ tests/
|
|
45
|
+
|
|
46
|
+
- name: Check formatting (ruff format)
|
|
47
|
+
run: ruff format --check src/ tests/
|
|
48
|
+
|
|
49
|
+
- name: Run type checker (mypy)
|
|
50
|
+
run: mypy src/
|
|
51
|
+
|
|
52
|
+
test:
|
|
53
|
+
name: Tests
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
needs: lint
|
|
56
|
+
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
|
|
60
|
+
- name: Set up Python 3.13
|
|
61
|
+
uses: actions/setup-python@v5
|
|
62
|
+
with:
|
|
63
|
+
python-version: '3.13'
|
|
64
|
+
|
|
65
|
+
- name: Cache pip dependencies
|
|
66
|
+
uses: actions/cache@v4
|
|
67
|
+
with:
|
|
68
|
+
path: ~/.cache/pip
|
|
69
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
|
|
70
|
+
restore-keys: |
|
|
71
|
+
${{ runner.os }}-pip-
|
|
72
|
+
|
|
73
|
+
- name: Install dependencies
|
|
74
|
+
run: |
|
|
75
|
+
python -m pip install --upgrade pip
|
|
76
|
+
pip install -e ".[dev]"
|
|
77
|
+
|
|
78
|
+
- name: Run tests with coverage
|
|
79
|
+
run: |
|
|
80
|
+
pytest tests/ -v \
|
|
81
|
+
--cov=nexus_dev \
|
|
82
|
+
--cov-report=xml \
|
|
83
|
+
--cov-report=term-missing \
|
|
84
|
+
--cov-fail-under=45
|
|
85
|
+
|
|
86
|
+
- name: Upload coverage to Codecov
|
|
87
|
+
uses: codecov/codecov-action@v5
|
|
88
|
+
with:
|
|
89
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
90
|
+
files: ./coverage.xml
|
|
91
|
+
flags: unittests
|
|
92
|
+
name: nexus-dev-coverage
|
|
93
|
+
fail_ci_if_error: false
|
|
94
|
+
verbose: true
|
|
95
|
+
|
|
96
|
+
build:
|
|
97
|
+
name: Build Package
|
|
98
|
+
runs-on: ubuntu-latest
|
|
99
|
+
needs: test
|
|
100
|
+
|
|
101
|
+
steps:
|
|
102
|
+
- uses: actions/checkout@v4
|
|
103
|
+
|
|
104
|
+
- name: Set up Python 3.13
|
|
105
|
+
uses: actions/setup-python@v5
|
|
106
|
+
with:
|
|
107
|
+
python-version: '3.13'
|
|
108
|
+
|
|
109
|
+
- name: Install build dependencies
|
|
110
|
+
run: |
|
|
111
|
+
python -m pip install --upgrade pip
|
|
112
|
+
pip install build
|
|
113
|
+
|
|
114
|
+
- name: Build package
|
|
115
|
+
run: python -m build
|
|
116
|
+
|
|
117
|
+
- name: Upload build artifacts
|
|
118
|
+
uses: actions/upload-artifact@v4
|
|
119
|
+
with:
|
|
120
|
+
name: dist
|
|
121
|
+
path: dist/
|
|
122
|
+
retention-days: 7
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
name: Create Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version:
|
|
7
|
+
description: 'Version number (e.g., v1.0.0)'
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
prepare_release:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
24
|
+
|
|
25
|
+
- name: Configure Git
|
|
26
|
+
run: |
|
|
27
|
+
git config user.name "github-actions[bot]"
|
|
28
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
29
|
+
|
|
30
|
+
- name: Check and Update Version
|
|
31
|
+
id: version_check
|
|
32
|
+
run: |
|
|
33
|
+
VERSION="${{ inputs.version }}"
|
|
34
|
+
# Remove 'v' prefix for pyproject.toml
|
|
35
|
+
VERSION_NO_V="${VERSION#v}"
|
|
36
|
+
|
|
37
|
+
# Get current version from pyproject.toml
|
|
38
|
+
# Assumes version = "x.y.z" format
|
|
39
|
+
CURRENT_VERSION=$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)
|
|
40
|
+
|
|
41
|
+
echo "Current version: ${CURRENT_VERSION}"
|
|
42
|
+
echo "Requested version: ${VERSION_NO_V}"
|
|
43
|
+
|
|
44
|
+
if [ "${CURRENT_VERSION}" = "${VERSION_NO_V}" ]; then
|
|
45
|
+
echo "Version is already correct in pyproject.toml"
|
|
46
|
+
echo "needs_update=false" >> "$GITHUB_OUTPUT"
|
|
47
|
+
else
|
|
48
|
+
echo "Updating pyproject.toml from ${CURRENT_VERSION} to ${VERSION_NO_V}"
|
|
49
|
+
sed -i "s/^version = \"${CURRENT_VERSION}\"/version = \"${VERSION_NO_V}\"/" pyproject.toml
|
|
50
|
+
echo "needs_update=true" >> "$GITHUB_OUTPUT"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
- name: Commit Version Update
|
|
54
|
+
if: steps.version_check.outputs.needs_update == 'true'
|
|
55
|
+
run: |
|
|
56
|
+
git add pyproject.toml
|
|
57
|
+
git commit -m "Bump version to ${{ inputs.version }}"
|
|
58
|
+
git push origin main
|
|
59
|
+
|
|
60
|
+
- name: Create and Push Tag
|
|
61
|
+
run: |
|
|
62
|
+
# Check if tag already exists locally
|
|
63
|
+
if git rev-parse "${{ inputs.version }}" >/dev/null 2>&1; then
|
|
64
|
+
echo "Tag ${{ inputs.version }} already exists locally, skipping creation"
|
|
65
|
+
else
|
|
66
|
+
git tag ${{ inputs.version }}
|
|
67
|
+
echo "Created tag ${{ inputs.version }}"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# Push tag
|
|
71
|
+
git push origin ${{ inputs.version }} || {
|
|
72
|
+
echo "Failed to push tag, it might already exist remotely"
|
|
73
|
+
exit 1
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
- name: Create Release
|
|
77
|
+
uses: actions/github-script@v7
|
|
78
|
+
with:
|
|
79
|
+
script: |
|
|
80
|
+
const tagName = '${{ inputs.version }}';
|
|
81
|
+
|
|
82
|
+
// Check if release already exists
|
|
83
|
+
try {
|
|
84
|
+
const { data: existingRelease } = await github.rest.repos.getReleaseByTag({
|
|
85
|
+
owner: context.repo.owner,
|
|
86
|
+
repo: context.repo.repo,
|
|
87
|
+
tag: tagName
|
|
88
|
+
});
|
|
89
|
+
console.log(`Release ${tagName} already exists: ${existingRelease.html_url}`);
|
|
90
|
+
return;
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (error.status !== 404) {
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Create the release
|
|
98
|
+
const { data: release } = await github.rest.repos.createRelease({
|
|
99
|
+
owner: context.repo.owner,
|
|
100
|
+
repo: context.repo.repo,
|
|
101
|
+
tag_name: tagName,
|
|
102
|
+
name: tagName,
|
|
103
|
+
draft: false,
|
|
104
|
+
prerelease: false,
|
|
105
|
+
generate_release_notes: true
|
|
106
|
+
});
|
|
107
|
+
console.log(`Created release ${release.html_url}`);
|
|
108
|
+
|
|
109
|
+
trigger_publish:
|
|
110
|
+
needs: prepare_release
|
|
111
|
+
uses: ./.github/workflows/release.yml
|
|
112
|
+
with:
|
|
113
|
+
tag_name: ${{ inputs.version }}
|
|
114
|
+
secrets: inherit
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
workflow_call:
|
|
8
|
+
inputs:
|
|
9
|
+
tag_name:
|
|
10
|
+
required: true
|
|
11
|
+
type: string
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
pypi-publish:
|
|
15
|
+
name: Publish to PyPI
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
ref: ${{ inputs.tag_name || github.ref }}
|
|
23
|
+
|
|
24
|
+
- name: Set up Python 3.13
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: '3.13'
|
|
28
|
+
|
|
29
|
+
- name: Install build dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install build
|
|
33
|
+
|
|
34
|
+
- name: Build package
|
|
35
|
+
run: python -m build
|
|
36
|
+
|
|
37
|
+
- name: Publish package distributions to PyPI
|
|
38
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
39
|
+
with:
|
|
40
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
41
|
+
|
|
42
|
+
docker-publish:
|
|
43
|
+
name: Publish to Docker Hub
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
with:
|
|
48
|
+
ref: ${{ inputs.tag_name || github.ref }}
|
|
49
|
+
|
|
50
|
+
- name: Set up Docker Buildx
|
|
51
|
+
uses: docker/setup-buildx-action@v3
|
|
52
|
+
|
|
53
|
+
- name: Login to Docker Hub
|
|
54
|
+
uses: docker/login-action@v3
|
|
55
|
+
with:
|
|
56
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
57
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
58
|
+
|
|
59
|
+
- name: Extract metadata (tags, labels) for Docker
|
|
60
|
+
id: meta
|
|
61
|
+
uses: docker/metadata-action@v5
|
|
62
|
+
with:
|
|
63
|
+
images: ${{ secrets.DOCKERHUB_USERNAME }}/nexus-dev
|
|
64
|
+
tags: |
|
|
65
|
+
type=raw,value=${{ inputs.tag_name }},enable=${{ inputs.tag_name != '' }}
|
|
66
|
+
type=raw,value=latest,enable=${{ inputs.tag_name != '' }}
|
|
67
|
+
type=semver,pattern={{version}},enable=${{ inputs.tag_name == '' }}
|
|
68
|
+
type=semver,pattern={{major}}.{{minor}},enable=${{ inputs.tag_name == '' }}
|
|
69
|
+
type=raw,value=latest,enable=${{ inputs.tag_name == '' && !contains(github.ref, '-') }}
|
|
70
|
+
|
|
71
|
+
- name: Build and push Docker image
|
|
72
|
+
uses: docker/build-push-action@v5
|
|
73
|
+
with:
|
|
74
|
+
context: .
|
|
75
|
+
push: true
|
|
76
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
77
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
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
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Environments
|
|
54
|
+
.env
|
|
55
|
+
.venv
|
|
56
|
+
env/
|
|
57
|
+
venv/
|
|
58
|
+
ENV/
|
|
59
|
+
env.bak/
|
|
60
|
+
venv.bak/
|
|
61
|
+
|
|
62
|
+
# IDE
|
|
63
|
+
.idea/
|
|
64
|
+
.vscode/
|
|
65
|
+
*.swp
|
|
66
|
+
*.swo
|
|
67
|
+
*~
|
|
68
|
+
|
|
69
|
+
# mypy
|
|
70
|
+
.mypy_cache/
|
|
71
|
+
.dmypy.json
|
|
72
|
+
dmypy.json
|
|
73
|
+
|
|
74
|
+
# ruff
|
|
75
|
+
.ruff_cache/
|
|
76
|
+
|
|
77
|
+
# Nexus-Dev specific
|
|
78
|
+
.nexus/
|
|
79
|
+
nexus_config.json
|
|
80
|
+
~/.nexus-dev/
|
|
81
|
+
|
|
82
|
+
# OS
|
|
83
|
+
.DS_Store
|
|
84
|
+
Thumbs.db
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# AGENTS.md - Nexus-Dev Project Guidelines
|
|
2
|
+
|
|
3
|
+
> Guidelines for AI coding assistants working on the Nexus-Dev codebase.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Nexus-Dev is a local RAG (Retrieval-Augmented Generation) MCP server that provides persistent memory for AI coding assistants. It indexes code, documentation, and lessons into a LanceDB vector database.
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
src/nexus_dev/
|
|
13
|
+
├── server.py # FastMCP server with tool handlers
|
|
14
|
+
├── cli.py # Click CLI commands (nexus-init, nexus-index, etc.)
|
|
15
|
+
├── database.py # LanceDB wrapper (NexusDatabase, Document, SearchResult)
|
|
16
|
+
├── embeddings.py # Embedding providers (OpenAI, Ollama)
|
|
17
|
+
├── config.py # NexusConfig dataclass
|
|
18
|
+
└── chunkers/ # Language-specific code chunkers
|
|
19
|
+
├── base.py # BaseChunker, ChunkerRegistry
|
|
20
|
+
├── python_chunker.py
|
|
21
|
+
├── java_chunker.py
|
|
22
|
+
├── javascript_chunker.py
|
|
23
|
+
└── docs_chunker.py
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Development Commands
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
make dev # Install in dev mode
|
|
30
|
+
make test # Run tests
|
|
31
|
+
make test-cov # Run tests with coverage
|
|
32
|
+
make lint # Run ruff linter
|
|
33
|
+
make format # Format code
|
|
34
|
+
make check # Run all checks (lint + format + type-check)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Before Pushing Code (CI Alignment)
|
|
38
|
+
|
|
39
|
+
**MANDATORY**: Always run these checks before committing/pushing to avoid CI failures:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
make check # Runs: lint + format-check + type-check (same as CI)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or run them individually:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ruff check src/ tests/ # Linting (same as CI)
|
|
49
|
+
ruff format --check src/ tests/ # Format check (same as CI)
|
|
50
|
+
mypy src/ # Type checking (same as CI)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Auto-fix Lint Issues
|
|
54
|
+
|
|
55
|
+
To automatically fix linting and formatting issues:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
make format # Formats code + auto-fixes lint issues
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> **Important**: The CI runs `ruff check src/ tests/`, `ruff format --check src/ tests/`, and `mypy src/`.
|
|
62
|
+
> Local checks MUST pass before pushing or the CI build will fail.
|
|
63
|
+
|
|
64
|
+
## Coding Standards
|
|
65
|
+
|
|
66
|
+
- **Python 3.13+** with type hints
|
|
67
|
+
- **Ruff** for linting and formatting
|
|
68
|
+
- **MyPy** for type checking
|
|
69
|
+
- **Pytest** with pytest-asyncio for async tests
|
|
70
|
+
- Follow PEP 8 naming conventions
|
|
71
|
+
- Use `async/await` for I/O operations
|
|
72
|
+
|
|
73
|
+
## Testing Guidelines
|
|
74
|
+
|
|
75
|
+
1. **Unit tests** go in `tests/unit/`
|
|
76
|
+
2. **Mock external dependencies** (LanceDB, HTTP clients) - don't make real API calls
|
|
77
|
+
3. Use `pytest.mark.asyncio` for async tests
|
|
78
|
+
4. Target 80%+ code coverage
|
|
79
|
+
|
|
80
|
+
## Key Patterns
|
|
81
|
+
|
|
82
|
+
### Adding a New MCP Tool
|
|
83
|
+
|
|
84
|
+
1. Add function in `server.py` with `@mcp.tool()` decorator
|
|
85
|
+
2. Add tests in `tests/unit/test_server.py`
|
|
86
|
+
3. Update `AGENTS.md` if user-facing
|
|
87
|
+
|
|
88
|
+
### Adding a New Chunker
|
|
89
|
+
|
|
90
|
+
1. Create `src/nexus_dev/chunkers/<language>_chunker.py`
|
|
91
|
+
2. Inherit from `BaseChunker`
|
|
92
|
+
3. Register in `ChunkerRegistry`
|
|
93
|
+
4. Add tests in `tests/chunkers/`
|
|
94
|
+
|
|
95
|
+
### Adding a CLI Command
|
|
96
|
+
|
|
97
|
+
1. Add function in `cli.py` with Click decorators
|
|
98
|
+
2. Add tests in `tests/unit/test_cli.py`
|