nexus-cli 0.3.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.
Files changed (68) hide show
  1. nexus_cli-0.3.0/.STATUS +169 -0
  2. nexus_cli-0.3.0/.github/workflows/ci.yml +125 -0
  3. nexus_cli-0.3.0/.github/workflows/docs.yml +43 -0
  4. nexus_cli-0.3.0/.github/workflows/publish.yml +44 -0
  5. nexus_cli-0.3.0/.gitignore +27 -0
  6. nexus_cli-0.3.0/.python-version +1 -0
  7. nexus_cli-0.3.0/CLAUDE.md +199 -0
  8. nexus_cli-0.3.0/PKG-INFO +369 -0
  9. nexus_cli-0.3.0/README.md +329 -0
  10. nexus_cli-0.3.0/RELEASE_NOTES_v0.4.0.md +249 -0
  11. nexus_cli-0.3.0/config/nexus.example.yaml +46 -0
  12. nexus_cli-0.3.0/docs/changelog.md +107 -0
  13. nexus_cli-0.3.0/docs/getting-started/configuration.md +208 -0
  14. nexus_cli-0.3.0/docs/getting-started/installation.md +93 -0
  15. nexus_cli-0.3.0/docs/getting-started/quickstart.md +190 -0
  16. nexus_cli-0.3.0/docs/index.md +111 -0
  17. nexus_cli-0.3.0/install.sh +206 -0
  18. nexus_cli-0.3.0/main.py +6 -0
  19. nexus_cli-0.3.0/mkdocs.yml +131 -0
  20. nexus_cli-0.3.0/nexus/__init__.py +8 -0
  21. nexus_cli-0.3.0/nexus/cli.py +1914 -0
  22. nexus_cli-0.3.0/nexus/integrations/__init__.py +0 -0
  23. nexus_cli-0.3.0/nexus/knowledge/__init__.py +13 -0
  24. nexus_cli-0.3.0/nexus/knowledge/search.py +233 -0
  25. nexus_cli-0.3.0/nexus/knowledge/vault.py +662 -0
  26. nexus_cli-0.3.0/nexus/research/__init__.py +12 -0
  27. nexus_cli-0.3.0/nexus/research/pdf.py +497 -0
  28. nexus_cli-0.3.0/nexus/research/zotero.py +521 -0
  29. nexus_cli-0.3.0/nexus/teaching/__init__.py +14 -0
  30. nexus_cli-0.3.0/nexus/teaching/courses.py +388 -0
  31. nexus_cli-0.3.0/nexus/teaching/quarto.py +385 -0
  32. nexus_cli-0.3.0/nexus/utils/__init__.py +0 -0
  33. nexus_cli-0.3.0/nexus/utils/config.py +157 -0
  34. nexus_cli-0.3.0/nexus/writing/__init__.py +12 -0
  35. nexus_cli-0.3.0/nexus/writing/bibliography.py +339 -0
  36. nexus_cli-0.3.0/nexus/writing/manuscript.py +397 -0
  37. nexus_cli-0.3.0/plugin/.claude-plugin/plugin.json +9 -0
  38. nexus_cli-0.3.0/plugin/README.md +126 -0
  39. nexus_cli-0.3.0/plugin/commands/check.md +94 -0
  40. nexus_cli-0.3.0/plugin/commands/cite.md +98 -0
  41. nexus_cli-0.3.0/plugin/commands/dashboard.md +84 -0
  42. nexus_cli-0.3.0/plugin/commands/manuscripts.md +74 -0
  43. nexus_cli-0.3.0/plugin/commands/search.md +76 -0
  44. nexus_cli-0.3.0/plugin/skills/integration-patterns/skill.md +149 -0
  45. nexus_cli-0.3.0/plugin/skills/knowledge/vault-operations/skill.md +200 -0
  46. nexus_cli-0.3.0/plugin/skills/research/zotero-integration/skill.md +224 -0
  47. nexus_cli-0.3.0/plugin/skills/teaching/course-management/skill.md +275 -0
  48. nexus_cli-0.3.0/plugin/skills/writing/manuscript-management/skill.md +280 -0
  49. nexus_cli-0.3.0/pyproject.toml +95 -0
  50. nexus_cli-0.3.0/tests/__init__.py +1 -0
  51. nexus_cli-0.3.0/tests/conftest.py +222 -0
  52. nexus_cli-0.3.0/tests/test_bibliography.py +180 -0
  53. nexus_cli-0.3.0/tests/test_cli.py +117 -0
  54. nexus_cli-0.3.0/tests/test_cli_integration.py +206 -0
  55. nexus_cli-0.3.0/tests/test_config.py +51 -0
  56. nexus_cli-0.3.0/tests/test_courses.py +100 -0
  57. nexus_cli-0.3.0/tests/test_edge_cases.py +388 -0
  58. nexus_cli-0.3.0/tests/test_manuscript.py +109 -0
  59. nexus_cli-0.3.0/tests/test_pdf.py +60 -0
  60. nexus_cli-0.3.0/tests/test_pdf_extractor.py +338 -0
  61. nexus_cli-0.3.0/tests/test_quarto.py +58 -0
  62. nexus_cli-0.3.0/tests/test_quarto_manager.py +363 -0
  63. nexus_cli-0.3.0/tests/test_search.py +235 -0
  64. nexus_cli-0.3.0/tests/test_validation.py +341 -0
  65. nexus_cli-0.3.0/tests/test_vault.py +218 -0
  66. nexus_cli-0.3.0/tests/test_zotero.py +89 -0
  67. nexus_cli-0.3.0/tests/test_zotero_client.py +421 -0
  68. nexus_cli-0.3.0/uv.lock +1320 -0
@@ -0,0 +1,169 @@
1
+ status: complete
2
+ priority: 1
3
+ progress: 100
4
+ next: Ready for production use
5
+ type: dev
6
+ checkpoint: v0.4.0 - 256 tests passing (53% coverage), GitHub Actions CI/CD configured
7
+
8
+ # ═══════════════════════════════════════════════════════════════════
9
+ # Nexus CLI - Knowledge Workflow for Research, Teaching, Writing
10
+ # ═══════════════════════════════════════════════════════════════════
11
+
12
+ 🔧 Nexus CLI Development Status
13
+ ────────────────────────────────────────
14
+
15
+ 📍 LOCATION
16
+ ~/projects/dev-tools/nexus-cli/
17
+
18
+ ⏰ LAST UPDATED
19
+ 2025-12-25 - Test coverage expanded, CI/CD configured
20
+
21
+ ────────────────────────────────────────
22
+
23
+ 🎯 CURRENT STATUS
24
+ **ALL PHASES COMPLETE - v0.4.0 PRODUCTION READY**
25
+
26
+ Phase 9 test expansion completed:
27
+ - ✅ 256 pytest tests passing (53% coverage, +10%)
28
+ - ✅ GitHub Actions CI/CD configured (Python 3.11-3.13, Ubuntu/macOS)
29
+ - ✅ PyPI publish workflow on release
30
+ - ✅ QuartoManager tests (29 tests)
31
+ - ✅ PDFExtractor tests (25 tests)
32
+ - ✅ ZoteroClient tests (20+ tests)
33
+ - ✅ MCP server with 17 tools
34
+ - ✅ Validation, edge case, and integration tests
35
+ - ✅ Claude Code plugin installed
36
+
37
+ ────────────────────────────────────────
38
+
39
+ 📊 PROGRESS
40
+
41
+ Core Infrastructure:
42
+ CLI Skeleton ████████████████████ 100% ✅
43
+ Configuration System ████████████████████ 100% ✅
44
+ Doctor Command ████████████████████ 100% ✅
45
+ Project Setup ████████████████████ 100% ✅
46
+
47
+ Domains:
48
+ Phase 2: Knowledge ████████████████████ 100% ✅
49
+ Phase 3: Research ████████████████████ 100% ✅
50
+ Phase 4a: Teaching ████████████████████ 100% ✅
51
+ Phase 4b: Writing ████████████████████ 100% ✅
52
+ Phase 5: Claude Plugin ████████████████████ 100% ✅
53
+ Phase 6: Testing & Docs ████████████████████ 100% ✅
54
+
55
+ **Overall Progress**: 100% (v0.1.0 Release Ready)
56
+
57
+ ────────────────────────────────────────
58
+
59
+ 📋 ENHANCEMENTS COMPLETED (2025-12-25)
60
+
61
+ v0.4.0 improvements (current):
62
+ - [✅] Test coverage expanded (43% → 53%)
63
+ - [✅] 256 tests total (79 new tests)
64
+ - [✅] QuartoManager comprehensive tests
65
+ - [✅] PDFExtractor with mock subprocess
66
+ - [✅] ZoteroClient with mock SQLite database
67
+ - [✅] GitHub Actions CI/CD configured
68
+
69
+ v0.3.0 improvements:
70
+ - [✅] 177 tests covering all domains
71
+ - [✅] Validation tests for data models
72
+ - [✅] Edge case and error handling
73
+ - [✅] CLI integration tests
74
+
75
+ v0.2.0 improvements:
76
+ - [✅] MCP server for tool calling
77
+ - [✅] PDF text extraction improvements
78
+ - [✅] Vault graph visualization
79
+
80
+ Future improvements:
81
+ - [ ] Further test coverage improvements (target 80%)
82
+ - [ ] MkDocs documentation site
83
+
84
+ ────────────────────────────────────────
85
+
86
+ 📊 TEST SUMMARY
87
+
88
+ 256 tests total, all passing (53% coverage):
89
+
90
+ Core tests:
91
+ - tests/test_config.py - Config loading (3 tests)
92
+ - tests/test_vault.py - Vault operations (33 tests)
93
+ - tests/test_manuscript.py - Manuscript management (7 tests)
94
+ - tests/test_bibliography.py - Bibliography parsing (11 tests)
95
+ - tests/test_courses.py - Course management (10 tests)
96
+ - tests/test_cli.py - CLI commands (19 tests)
97
+ - tests/test_zotero.py - Zotero item (6 tests)
98
+ - tests/test_pdf.py - PDF document (4 tests)
99
+ - tests/test_quarto.py - Quarto project (4 tests)
100
+ - tests/test_search.py - Unified search (30 tests)
101
+
102
+ Comprehensive tests:
103
+ - tests/test_validation.py - Data model validation (70 tests)
104
+ - tests/test_cli_integration.py - CLI integration (37 tests)
105
+ - tests/test_edge_cases.py - Edge cases & errors (46 tests)
106
+
107
+ New in v0.4.0:
108
+ - tests/test_quarto_manager.py - QuartoManager (29 tests) ⭐ NEW
109
+ - tests/test_pdf_extractor.py - PDFExtractor (25 tests) ⭐ NEW
110
+ - tests/test_zotero_client.py - ZoteroClient (20+ tests) ⭐ NEW
111
+
112
+ Coverage by module:
113
+ - teaching/quarto.py: 91% | utils/config.py: 80%
114
+ - research/pdf.py: 77% | writing/manuscript.py: 74%
115
+ - research/zotero.py: 73% | writing/bibliography.py: 72%
116
+ - teaching/courses.py: 70% | knowledge/vault.py: 66%
117
+ - knowledge/search.py: 60%
118
+
119
+ Run: `uv run pytest --cov=nexus`
120
+
121
+ ────────────────────────────────────────
122
+
123
+ 🔗 RELATED PROJECTS
124
+
125
+ | Project | Location | Purpose |
126
+ |---------|----------|---------|
127
+ | Nexus MCP Server | ~/mcp-servers/nexus/ | MCP server with 17 tools ⭐ NEW |
128
+ | Nexus (docs) | ~/projects/dev-tools/nexus/ | Architecture & vault template |
129
+ | Scribe | ~/projects/dev-tools/scribe/ | Desktop capture app |
130
+ | Statistical Research | ~/.claude/plugins/statistical-research/ | Existing plugin |
131
+
132
+ ────────────────────────────────────────
133
+
134
+ 💡 ARCHITECTURE
135
+
136
+ **Claude Integration (No API Needed)**
137
+
138
+ Four patterns:
139
+ 1. **MCP Server**: 17 tools via Model Context Protocol ⭐ NEW
140
+ 2. **Claude calls Nexus**: Claude runs `nexus` via Bash
141
+ 3. **Piping**: `nexus search | claude -p "summarize"`
142
+ 4. **Plugin skills**: Teach Claude how to use nexus
143
+
144
+ **Four Domains**:
145
+ - 🔬 Research: Zotero, PDFs, literature
146
+ - 📚 Teaching: Courses, materials, Quarto
147
+ - ✍️ Writing: Manuscripts, bibliography, LaTeX
148
+ - 🧠 Knowledge: Vault, unified search
149
+
150
+ ────────────────────────────────────────
151
+
152
+ 📁 KEY FILES
153
+
154
+ - nexus/cli.py - Main CLI (Typer) - 1800+ lines
155
+ - nexus/utils/config.py - Configuration
156
+ - nexus/knowledge/vault.py - VaultManager (Phase 2)
157
+ - nexus/knowledge/search.py - UnifiedSearch (Phase 2+3)
158
+ - nexus/research/zotero.py - ZoteroClient (Phase 3)
159
+ - nexus/research/pdf.py - PDFExtractor (Phase 3)
160
+ - nexus/teaching/courses.py - CourseManager (Phase 4a)
161
+ - nexus/teaching/quarto.py - QuartoManager (Phase 4a)
162
+ - nexus/writing/manuscript.py - ManuscriptManager (Phase 4b)
163
+ - nexus/writing/bibliography.py - BibliographyManager (Phase 4b)
164
+ - tests/ - 58 pytest tests
165
+ - pyproject.toml - Project metadata
166
+ - install.sh - Installation script
167
+ - CLAUDE.md - Claude Code guidance
168
+ - README.md - User documentation
169
+
@@ -0,0 +1,125 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ test:
11
+ name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, macos-latest]
17
+ python-version: ["3.11", "3.12", "3.13"]
18
+
19
+ steps:
20
+ - name: Checkout code
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+ cache: 'pip'
28
+
29
+ - name: Install system dependencies (Ubuntu)
30
+ if: runner.os == 'Linux'
31
+ run: |
32
+ sudo apt-get update
33
+ sudo apt-get install -y poppler-utils
34
+
35
+ - name: Install system dependencies (macOS)
36
+ if: runner.os == 'macOS'
37
+ run: |
38
+ brew install poppler
39
+
40
+ - name: Install Python dependencies
41
+ run: |
42
+ python -m pip install --upgrade pip
43
+ pip install -e ".[dev]"
44
+
45
+ - name: Run tests with coverage
46
+ run: |
47
+ pytest -v --cov=nexus --cov-report=xml --cov-report=term-missing --cov-report=html
48
+
49
+ - name: Generate coverage badge
50
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
51
+ run: |
52
+ pip install coverage-badge
53
+ coverage-badge -o coverage.svg -f
54
+
55
+ - name: Upload coverage reports to Codecov
56
+ uses: codecov/codecov-action@v4
57
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
58
+ with:
59
+ file: ./coverage.xml
60
+ fail_ci_if_error: false
61
+ verbose: true
62
+ env:
63
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
64
+
65
+ - name: Archive code coverage results
66
+ uses: actions/upload-artifact@v4
67
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
68
+ with:
69
+ name: code-coverage-report
70
+ path: htmlcov/
71
+
72
+ - name: Check coverage threshold
73
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
74
+ run: |
75
+ coverage report --fail-under=40
76
+
77
+ lint:
78
+ name: Lint and Format Check
79
+ runs-on: ubuntu-latest
80
+ steps:
81
+ - name: Checkout code
82
+ uses: actions/checkout@v4
83
+
84
+ - name: Set up Python
85
+ uses: actions/setup-python@v5
86
+ with:
87
+ python-version: "3.12"
88
+ cache: 'pip'
89
+
90
+ - name: Install linting tools
91
+ run: |
92
+ pip install ruff mypy
93
+
94
+ - name: Run ruff check
95
+ run: ruff check nexus/ tests/
96
+
97
+ - name: Run ruff format check
98
+ run: ruff format --check nexus/ tests/
99
+
100
+ - name: Run type checking
101
+ run: mypy nexus/ --ignore-missing-imports || true
102
+
103
+ security:
104
+ name: Security Scan
105
+ runs-on: ubuntu-latest
106
+ steps:
107
+ - name: Checkout code
108
+ uses: actions/checkout@v4
109
+
110
+ - name: Set up Python
111
+ uses: actions/setup-python@v5
112
+ with:
113
+ python-version: "3.12"
114
+
115
+ - name: Install bandit
116
+ run: pip install bandit[toml]
117
+
118
+ - name: Run security scan
119
+ run: bandit -r nexus/ -f json -o bandit-report.json || true
120
+
121
+ - name: Upload security report
122
+ uses: actions/upload-artifact@v4
123
+ with:
124
+ name: security-report
125
+ path: bandit-report.json
@@ -0,0 +1,43 @@
1
+ name: Deploy Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'docs/**'
9
+ - 'mkdocs.yml'
10
+ - '.github/workflows/docs.yml'
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: write
15
+
16
+ jobs:
17
+ deploy:
18
+ name: Deploy MkDocs to GitHub Pages
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Set up Python
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: '3.12'
30
+ cache: 'pip'
31
+
32
+ - name: Install dependencies
33
+ run: |
34
+ pip install -e ".[docs]"
35
+
36
+ - name: Configure Git user
37
+ run: |
38
+ git config --global user.name "GitHub Actions"
39
+ git config --global user.email "actions@github.com"
40
+
41
+ - name: Deploy documentation
42
+ run: |
43
+ mkdocs gh-deploy --force --clean --verbose
@@ -0,0 +1,44 @@
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 artifacts
25
+ uses: actions/upload-artifact@v4
26
+ with:
27
+ name: dist
28
+ path: dist/
29
+
30
+ publish-pypi:
31
+ needs: build
32
+ runs-on: ubuntu-latest
33
+ environment: pypi
34
+ permissions:
35
+ id-token: write # Required for trusted publishing
36
+ steps:
37
+ - name: Download artifacts
38
+ uses: actions/download-artifact@v4
39
+ with:
40
+ name: dist
41
+ path: dist/
42
+
43
+ - name: Publish to PyPI
44
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,27 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Testing
13
+ .coverage
14
+ htmlcov/
15
+ coverage.xml
16
+ coverage.svg
17
+ .pytest_cache/
18
+ bandit-report.json
19
+
20
+ # IDEs
21
+ .vscode/
22
+ .idea/
23
+ *.swp
24
+ *~
25
+
26
+ # OS
27
+ .DS_Store
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,199 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code when working with the Nexus CLI.
4
+
5
+ ## What is Nexus?
6
+
7
+ Nexus is a **knowledge workflow CLI** for academic researchers. It provides data and operations - Claude provides the thinking.
8
+
9
+ **Key Principle**: Nexus does NOT do AI. It provides structured access to:
10
+ - Zotero library (2,728 papers)
11
+ - PDFs (~1,800 files)
12
+ - Obsidian vault (knowledge notes)
13
+ - Teaching materials
14
+ - Manuscripts
15
+
16
+ ## Repository Structure
17
+
18
+ ```
19
+ nexus-cli/
20
+ ├── nexus/ # Python package
21
+ │ ├── cli.py # Main CLI (Typer)
22
+ │ ├── research/ # 🔬 Zotero, PDFs, literature
23
+ │ ├── teaching/ # 📚 Courses, materials
24
+ │ ├── writing/ # ✍️ Manuscripts, LaTeX
25
+ │ ├── knowledge/ # 🧠 Vault, search
26
+ │ ├── integrations/ # 🔌 aiterm, R, Git
27
+ │ └── utils/ # Config, output
28
+ │ └── config.py # Configuration management
29
+
30
+ ├── plugin/ # Claude Code plugin
31
+ │ ├── skills/ # Domain skills
32
+ │ └── commands/ # Slash commands
33
+
34
+ ├── config/ # Default configs
35
+ ├── tests/ # pytest tests
36
+ ├── docs/ # MkDocs documentation
37
+ ├── pyproject.toml # Project metadata
38
+ └── README.md
39
+ ```
40
+
41
+ ## CLI Architecture
42
+
43
+ The CLI uses **Typer** with nested subcommands:
44
+
45
+ ```bash
46
+ nexus # Main app
47
+ ├── research # 🔬 Research domain
48
+ │ ├── zotero # Zotero operations
49
+ │ │ ├── search # Search papers
50
+ │ │ └── cite # Generate citations
51
+ │ ├── pdf # PDF operations
52
+ │ │ ├── extract # Extract text
53
+ │ │ └── search # Search PDFs
54
+ │ └── lit # Literature ops
55
+ ├── teach # 📚 Teaching domain
56
+ │ ├── course # Course management
57
+ │ └── material # Materials search
58
+ ├── write # ✍️ Writing domain
59
+ │ ├── manuscript # Manuscript tracking
60
+ │ ├── bib # Bibliography
61
+ │ └── latex # LaTeX helpers
62
+ ├── knowledge # 🧠 Knowledge domain
63
+ │ ├── vault # Obsidian operations
64
+ │ └── search # Unified search
65
+ ├── integrate # 🔌 Integrations
66
+ ├── doctor # Health check
67
+ └── config # Configuration
68
+ ```
69
+
70
+ ## Development Commands
71
+
72
+ ```bash
73
+ # Install dependencies
74
+ uv sync
75
+
76
+ # Run CLI
77
+ uv run nexus --help
78
+ uv run nexus doctor
79
+
80
+ # Run tests
81
+ uv run pytest
82
+
83
+ # Type check
84
+ uv run mypy nexus/
85
+
86
+ # Lint
87
+ uv run ruff check nexus/
88
+ ```
89
+
90
+ ## Configuration
91
+
92
+ Configuration is stored at `~/.config/nexus/config.yaml`:
93
+
94
+ ```yaml
95
+ zotero:
96
+ database: ~/Zotero/zotero.sqlite
97
+ storage: ~/Zotero/storage
98
+
99
+ vault:
100
+ path: ~/Obsidian/Nexus
101
+ templates: ~/Obsidian/Nexus/_SYSTEM/templates
102
+
103
+ pdf:
104
+ directories:
105
+ - ~/Documents/Research/PDFs
106
+ - ~/Documents/Teaching/PDFs
107
+ ```
108
+
109
+ ## Adding New Commands
110
+
111
+ 1. **Find the domain** in `nexus/cli.py`
112
+ 2. **Add a subcommand** using the `@<domain>_app.command()` decorator
113
+ 3. **Use Typer Annotations** for arguments and options
114
+ 4. **Output with Rich** for beautiful formatting
115
+
116
+ Example:
117
+ ```python
118
+ @research_app.command()
119
+ def new_command(
120
+ query: Annotated[str, typer.Argument(help="The query")],
121
+ limit: Annotated[int, typer.Option("--limit", "-n")] = 10,
122
+ ) -> None:
123
+ """Description of the command."""
124
+ console.print(f"Running with query: {query}")
125
+ ```
126
+
127
+ ## Adding Domain Logic
128
+
129
+ 1. Create a module in the domain folder (e.g., `nexus/research/zotero.py`)
130
+ 2. Create a class or functions for the operations
131
+ 3. Import and use in `cli.py`
132
+
133
+ Example:
134
+ ```python
135
+ # nexus/research/zotero.py
136
+ class ZoteroClient:
137
+ def __init__(self, db_path: Path):
138
+ self.db_path = db_path
139
+
140
+ def search(self, query: str) -> List[dict]:
141
+ # Implementation
142
+ ...
143
+
144
+ # nexus/cli.py
145
+ from nexus.research.zotero import ZoteroClient
146
+
147
+ @zotero_app.command("search")
148
+ def zotero_search(query: str) -> None:
149
+ client = ZoteroClient(config.zotero.database)
150
+ results = client.search(query)
151
+ # Display results
152
+ ```
153
+
154
+ ## Claude Integration Patterns
155
+
156
+ ### Pattern 1: Claude Calls Nexus (Primary)
157
+ ```bash
158
+ # In Claude Code, Claude runs:
159
+ nexus research zotero search "mediation" --json
160
+ ```
161
+
162
+ ### Pattern 2: Pipe to Claude
163
+ ```bash
164
+ nexus knowledge search "topic" --json | claude -p "Summarize"
165
+ ```
166
+
167
+ ### Pattern 3: Plugin Skills
168
+ Skills in `plugin/skills/` teach Claude how to use nexus effectively.
169
+
170
+ ## Testing
171
+
172
+ ```bash
173
+ # Run all tests
174
+ uv run pytest
175
+
176
+ # Run specific domain
177
+ uv run pytest tests/research/
178
+
179
+ # With coverage
180
+ uv run pytest --cov=nexus
181
+ ```
182
+
183
+ ## Code Style
184
+
185
+ - **Line length**: 100 characters
186
+ - **Formatting**: Ruff
187
+ - **Type hints**: Required (mypy strict)
188
+ - **Docstrings**: Google style
189
+
190
+ ## Implementation Phases
191
+
192
+ | Phase | Focus | Hours | Status |
193
+ |-------|-------|-------|--------|
194
+ | 1 | Core Infrastructure | 4h | ✅ Done |
195
+ | 2 | Knowledge Domain | 3h | Next |
196
+ | 3 | Research Domain | 4h | Pending |
197
+ | 4 | Teaching & Writing | 3h | Pending |
198
+ | 5 | Claude Plugin | 3h | Pending |
199
+ | 6 | Testing & Docs | 3h | Pending |