diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..07a1005 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,26 @@ +--- +name: Bug report +about: Submit a bug report to notify our team +title: '🐛 bug(component): brief description' +labels: 'bug, help wanted' + +--- + +### 🐛 What happened? + +**Expected:** [What should happen] +**Actual:** [What actually happened] + +### 🔄 Steps to Reproduce + +1. [First step to reproduce] +2. [Second step to reproduce] +3. [Third step where error occurs] + +Walkthrough recording: [Loom link or video] + +### 🌍 Environment + +- OS: [e.g. macOS 14.0] +- Browser: [e.g. Chrome 120] (if applicable) +- Version: [e.g. v1.0.0] diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..a91f360 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest a new feature or enhancement +title: '✨ feat(component): brief description' +labels: 'enhancement, help wanted' + +--- + +### 🎯 Problem + +[Description of the problem or limitation this addresses] + +### 💡 Proposed Solution + +[Description of the desired feature or enhancement] + +### 🤔 Alternatives Considered + +[Other approaches considered, if any] (optional) diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..3106041 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,28 @@ +--- +name: Pull Request +about: Submit a pull request for review +title: '🔄 type(scope): brief description' + +--- + +[Brief description of changes and purpose] + +Closes #[issue-number] + +> [!WARNING] +> +> [Any merge requirements or dependencies] + +### 🎯 Key Features + +- **[Feature name]:** [Description of functionality or change] + +### 💼 Business Impact + +- **[Impact area]:** [How this benefits users or business] + +### 🔧 Technical Highlights + +- **[Technical aspect]:** [Implementation details or improvements] + +--- diff --git a/.github/workflows/auto-update-docs.yml b/.github/workflows/auto-update-docs.yml new file mode 100644 index 0000000..f28da01 --- /dev/null +++ b/.github/workflows/auto-update-docs.yml @@ -0,0 +1,72 @@ +name: Update Documentation + +on: + workflow_call: {} + workflow_dispatch: {} # Manual trigger for testing + +concurrency: + group: update-docs + cancel-in-progress: true + +jobs: + update-docs: + name: Update ${{ matrix.manager }} docs + runs-on: ubuntu-latest + permissions: + contents: write + strategy: + max-parallel: 1 # Prevent commit conflicts + matrix: + include: + - manager: pip + repo: pypa/pip + docs_path: docs + target_dir: src/assets/pip + - manager: poetry + repo: python-poetry/poetry + docs_path: docs + target_dir: src/assets/poetry + - manager: uv + repo: astral-sh/uv + docs_path: docs + target_dir: src/assets/uv + - manager: conda + repo: conda/conda + docs_path: docs + target_dir: src/assets/conda + + steps: + - name: Checkout main repo + uses: actions/checkout@v4 + + - name: Checkout ${{ matrix.manager }} docs + uses: actions/checkout@v4 + with: + repository: ${{ matrix.repo }} + sparse-checkout: | + ${{ matrix.docs_path }} + path: temp-docs + + - name: Copy documentation files + run: | + # Create target directory if not exist + mkdir -p ${{ matrix.target_dir }} + + # Copy docs and preserve structure with metadata + cp -a temp-docs/${{ matrix.docs_path }}/* ${{ matrix.target_dir }}/ + + # Add metadata file with source info + echo "source_repo: ${{ matrix.repo }}" > ${{ matrix.target_dir }}/_metadata.yml + echo "docs_path: ${{ matrix.docs_path }}" >> ${{ matrix.target_dir }}/_metadata.yml + echo "updated_at: $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> ${{ matrix.target_dir }}/_metadata.yml + echo "commit_sha: $(cd temp-docs && git rev-parse HEAD)" >> ${{ matrix.target_dir }}/_metadata.yml + + - name: Auto commit changes to main + # Pin 3rd-party action to v6.0.1 commit hash released on 2025-06-11 to prevent supply chain attacks + uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 + with: + commit_message: 'docs(src/assets/): update ${{ matrix.manager }} official documentation' + commit_options: '--signoff' + file_pattern: 'src/assets/${{ matrix.manager }}/*' + disable_globbing: true + status_options: '--untracked-files=no' diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml new file mode 100644 index 0000000..e99f769 --- /dev/null +++ b/.github/workflows/auto-update.yml @@ -0,0 +1,23 @@ +name: Auto Update Orchestrator + +on: + schedule: + # Tuesday 6pm ET (22:00 UTC, accounting for EST/EDT) + - cron: '0 22 * * 2' + workflow_dispatch: {} # Manual trigger for testing + +jobs: + update-docs: + name: Update Documentation + uses: ./.github/workflows/auto-update-docs.yml + + # TODO: Add when implemented + # update-index: + # name: Update Search Index + # needs: update-docs + # uses: ./.github/workflows/auto-update-index.yml + + # build-deploy: + # name: Build and Deploy + # needs: update-index + # uses: ./.github/workflows/auto-build-and-deploy.yml diff --git a/.gitignore b/.gitignore index b7faf40..001dcd1 100644 --- a/.gitignore +++ b/.gitignore @@ -47,8 +47,10 @@ nosetests.xml coverage.xml *.cover *.py.cover +*.lcov .hypothesis/ .pytest_cache/ +.nyc_output cover/ # Translations @@ -137,6 +139,10 @@ celerybeat.pid # Environments .env .envrc +.env.development.local +.env.test.local +.env.production.local +.env.local .venv env/ venv/ @@ -173,7 +179,7 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ # Abstra # Abstra is an AI-powered process automation framework. @@ -186,7 +192,11 @@ cython_debug/ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore # and can be added to the global gitignore or merged into this file. However, if you prefer, # you could uncomment the following to ignore the entire vscode folder -# .vscode/ +.vscode/* +!.vscode/extensions.json + +# Sublime Text +*.sublime-workspace # Ruff stuff: .ruff_cache/ @@ -205,3 +215,44 @@ cython_debug/ marimo/_static/ marimo/_lsp/ __marimo__/ + +# OS and System Files +# macOS - System files that store metadata, icons, and settings +.DS_Store +.DS_Store? +._* +.AppleDouble +.LSOverride +Icon? +.Spotlight-V100 +.Trashes + +# Windows - System-generated files and folders +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db +[Dd]esktop.ini +$RECYCLE.BIN/ +*.lnk + +# Linux - System and folder-specific files +.directory +.Trash-* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Additional logs +logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Cache directories +.parcel-cache diff --git a/README.md b/README.md index 7a4ea59..e04ee2c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,90 @@ -# python-dep-manager-companion-mcp-server -A local Model Context Protocol (MCP) server that unifies the latest documentation for all Python dependency managers, making it instantly searchable from your agentic IDE. +# Python Dependency Manager MCP Server + +> Updated on 2025-07-15 by @KemingHe + +Local MCP server providing unified search across Python dependency manager documentation. + +## 📋 Overview + +Unified search for pip, poetry, uv, and conda docs via Docker with weekly auto-updates. Built with FastMCP and Tantivy. + +## 🚀 Getting Started + +### Step 1: Pull Docker Image + +```shell +docker pull keminghe/py-dep-man-companion:latest +``` + +### Step 2: Configure Your IDE + +Add to VSCode User Settings (JSON): + +```json +{ + "mcp": { + "servers": { + "python-deps": { + "command": "docker", + "args": ["run", "-i", "--rm", "keminghe/py-dep-man-companion:latest"] + } + } + } +} +``` + +### Step 3: Start Searching + +Query latest and unified documentation across all supported Python dependency managers directly from your AI assistant. + +## 📁 Project Structure + +```plaintext +python-dep-manager-companion-mcp-server/ +├── .github/workflows/ +│ ├── auto-update.yml # Orchestrator: Tuesday 6pm ET +│ └── auto-update-docs.yml # Modular: Doc fetching workflow +├── docs/ # Project documentation +├── src/ +│ ├── server.py # FastMCP server implementation +│ ├── index.py # Tantivy search engine +│ └── assets/ # Local documentation files +│ ├── pip/ # Pip documentation .md files +│ ├── poetry/ # Poetry documentation .md files +│ ├── uv/ # UV documentation .md files +│ └── conda/ # Conda documentation .md files +├── Dockerfile # Container build configuration +└── pyproject.toml # Project dependencies and metadata +``` + +## 🛠️ Development + +**Transport Support**: Stdio (default) and HTTP modes following MCP standards. + +**Environment Variables**: + +- `TRANSPORT_MODE`: `stdio` or `http` (default: `stdio`) +- `TRANSPORT_PORT`: HTTP server port (default: `8080`) +- `TRANSPORT_HOST`: Host binding (default: `127.0.0.1`) + +**Local Development**: + +```shell +# Clone and setup +git clone +cd python-dep-manager-companion-mcp-server +uv sync + +# Run server +uv run python src/server.py stdio +``` + +**Roadmap**: Adding support for pipenv, pdm, pixi, and additional Python package managers. + +## 📄 License + +This project is licensed under the [MIT License](./LICENSE) - a permissive license that allows free use, modification, and distribution with attribution. + +## 📞 Support + +Open GitHub issues for bug reports and feature requests. Weekly documentation updates run automatically every Tuesday at 6pm ET with signed commits by `github-actions[bot]`. diff --git a/prompts/prompt-commit-msg-gen.md b/prompts/prompt-commit-msg-gen.md new file mode 100644 index 0000000..88ada7f --- /dev/null +++ b/prompts/prompt-commit-msg-gen.md @@ -0,0 +1,84 @@ +# Prompt - Git Commit Message Generation + +## ROLE + +You are a senior software engineer creating conventional commit messages following conventional commit standards. + +## 4-STEP PROCESS + +### STEP 1: Repository Analysis (Machine) + +- **Local analysis:** Run `git status`, `git diff --staged`, `git log --oneline -10` +- **Remote analysis:** Check `git log origin/main..HEAD` and recent branch activity +- **MCP tools:** Use available MCP tools for codebase search, file reading, project analysis + +### STEP 2: Classification & Title Generation (Machine) + +- **Change type:** Determine commit type (feat, fix, docs, style, refactor, test, chore, perf, ci, build) +- **Scope:** Identify primary component (single word or hyphenated: api, auth, ui, workflow, user-auth) +- **Title:** Generate imperative mood description (max 50 chars) + +### STEP 3: User Consultation (Human) + +Present concise findings from Steps 1-2, then ask: + +- Specific areas to focus on or highlight? +- Issues this commit resolves or closes? +- Additional context or concerns? + +### STEP 4: Generate Commit Message (Machine) + +Write final commit message and return in plaintext code block. + +## OUTPUT FORMAT + +```plaintext +type(scope): brief description in imperative mood + +closes #[issue-number] (if applicable) + +CHANGES +- Key change 1 +- Key change 2 + +IMPACT +- How this affects users/system + +BREAKING CHANGES +- UserService.getData() now returns Promise + +TECHNICAL NOTES +- Implementation details +``` + +## CONSTRAINTS + +- **Title:** Max 50 characters, imperative mood ("add", "fix", "update") +- **Content:** Only include sections with meaningful content, use dash bullets with no redundancy between items +- **Issue linking:** Only include "closes #X" for actual issue resolution + +## EXAMPLES + +```plaintext +feat(auth): add JWT token refresh mechanism + +CHANGES +- Implement automatic token refresh on expiration +- Add refresh token storage to session management + +IMPACT +- Users stay logged in longer without interruption +``` + +```plaintext +fix(api): resolve race condition in user data fetching + +closes #245 + +CHANGES +- Add mutex lock to prevent concurrent requests +- Implement request deduplication + +BREAKING CHANGES +- UserService.getData() now returns Promise +``` diff --git a/prompts/prompt-issue-gen.md b/prompts/prompt-issue-gen.md new file mode 100644 index 0000000..27bfc3a --- /dev/null +++ b/prompts/prompt-issue-gen.md @@ -0,0 +1,43 @@ +# Prompt - GitHub Issue Generation + +## ROLE + +You are a technical documentation specialist creating GitHub issues that communicate problems, feature requests, and enhancements following templates. + +## 3-STEP PROCESS + +### STEP 1: Information Gathering (Machine) + +- **Template discovery:** Search for bug-report.md, feature-request.md or check user-attached files +- **Repository context:** Search codebase for related issues, recent changes, existing functionality +- **Issue classification:** Analyze user input to determine bug report, feature request, or other type +- **Content extraction:** Extract symptoms, desired functionality, technical requirements + +### STEP 2: User Consultation (Human + Machine) + +- **Template selection:** If type unclear, ask user to specify (Bug Report: problems/errors, Feature Request: new functionality) +- **Context clarification:** Ask for missing template requirements (Bug: reproduction steps, expected/actual behavior, environment; Feature: problem statement, solution, alternatives) +- **Priority assessment:** Confirm importance level and related issues/dependencies + +### STEP 3: Issue Generation (Machine) + +- **Template compliance:** Follow discovered template structure with proper markdown formatting +- **Information organization:** Structure content by template sections using dash bullets with clear, actionable details and no overlap between items +- **Output delivery:** Present final issue in markdown code block with all required fields populated + +## CONSTRAINTS + +- **Template priority:** Use bug-report.md and feature-request.md as primary templates, adapt to any discovered templates +- **Content accuracy:** Preserve technical details, error messages, requirements exactly as provided +- **Actionable content:** Each section contains specific information that helps maintainers address the issue +- **Label compliance:** Include appropriate labels and formatting per template frontmatter + +## OUTPUT FORMAT + +```markdown +--- +[template frontmatter] +--- + +[complete issue content following template structure] +``` diff --git a/prompts/prompt-pull-request-gen.md b/prompts/prompt-pull-request-gen.md new file mode 100644 index 0000000..b6361d5 --- /dev/null +++ b/prompts/prompt-pull-request-gen.md @@ -0,0 +1,48 @@ +# Prompt - Pull Request Generation + +## ROLE + +You are a senior software engineer creating pull request descriptions that communicate changes, impact, and value following project templates. + +## 3-STEP PROCESS + +### STEP 1: Branch Analysis (Machine) + +- **Template discovery:** Search for pull_request_template.md or check user-attached files +- **Git analysis:** Run `git log origin/main..HEAD --oneline`, `git diff origin/main...HEAD --stat`, `git show --name-only HEAD` +- **Change analysis:** Use `git diff origin/main...HEAD` for code modifications and GitHub MCP tools for related issues/PRs +- **Codebase context:** Search affected functionality, dependencies, and architectural patterns + +### STEP 2: User Consultation (Human + Machine) + +- **Change confirmation:** Present detected changes summary and confirm scope/key areas +- **Issue linkage:** Ask which issues this resolves and related dependencies +- **Context clarification:** Request business motivation, testing approach, breaking changes, review considerations + +### STEP 3: PR Generation (Machine) + +- **Template compliance:** Follow discovered template structure with proper markdown formatting +- **Content organization:** Structure by template sections using dash bullets with no overlap, emphasizing business value and technical highlights +- **Change categorization:** Group changes by: + - **Feature area:** Use when changes are specific to particular modules, functionality, or user-facing features + - **Impact level:** Apply when prioritizing by significance (critical fixes, performance improvements, minor updates) + - **Architectural component:** Choose for changes affecting core elements (database schemas, APIs, system integrations) + - These approaches can be combined for better clarity (e.g., feature area with impact level sub-grouping) +- **Output delivery:** Present final PR description in markdown code block + +## CONSTRAINTS + +- **Template priority:** Use pull_request_template.md as primary template, adapt to any discovered templates +- **Analysis depth:** Analyze feature branch against main using git commands and GitHub MCP tools +- **Content accuracy:** Preserve implementation details, performance impacts, architectural decisions +- **Business context:** Connect technical changes to business value and user impact + +## OUTPUT FORMAT + +```markdown +--- +[template frontmatter if applicable] +--- + +[complete PR description following template structure] +``` diff --git a/prompts/prompt-readme-gen.md b/prompts/prompt-readme-gen.md new file mode 100644 index 0000000..06e7c5f --- /dev/null +++ b/prompts/prompt-readme-gen.md @@ -0,0 +1,70 @@ +# Prompt - README Generation + +## ROLE + +You are a technical documentation specialist creating comprehensive README files that communicate project purpose, setup, and usage following modern documentation standards. + +## 3-STEP PROCESS + +### STEP 1: Project Analysis (Machine) + +- **Repository discovery:** Use readonly git commands (`git log --oneline -10`, `git branch -a`, `git ls-files`) to understand project history and structure +- **Codebase analysis:** Use IDE editor/agent tools for file reading, directory traversal, and dependency analysis +- **Structure mapping:** Run readonly bash commands (`find`, `ls -la`, `tree` if available) to map project architecture +- **Technology detection:** Identify frameworks, languages, build tools, configuration files through file analysis + +### STEP 2: User Consultation (Human + Machine) + +- **Project confirmation:** Present discovered project structure and technology stack for verification +- **Purpose clarification:** Ask about project goals, target audience, key features, and unique value proposition +- **Context gathering:** Request deployment details, environment requirements, known limitations, future roadmap + +### STEP 3: README Generation (Machine) + +- **Structure creation:** Generate file structure tree in plaintext code block with descriptive comments +- **Content organization:** Create sections using level 2 headings with unique professional emojis, balance bullets and paragraphs to prevent both excessive bullets and oversized paragraphs +- **Output delivery:** Present complete README in markdown code block ready for project root + +## CONSTRAINTS + +- **Technology agnostic:** Work with any programming language, framework, or project type +- **Analysis depth:** Use only readonly commands and tools to understand project without modifications +- **Section focus:** Include only essential sections applicable to both OSS and private projects +- **Emoji standards:** Use unique professional emojis for level 2 headings only, no decorative elements +- **Content simplicity:** Apply KISS (Keep It Simple, Stupid) and DRY (Don't Repeat Yourself) principles for concise and maintainable content +- **Content balance:** Balance bullets and paragraphs to avoid excessive bullets or oversized paragraphs +- **Content uniqueness:** Ensure no content overlap or repetition between sections +- **Overview brevity:** Keep overview section under 10 seconds read time with essential value proposition only + +## OUTPUT FORMAT + +```markdown +# [Project Name] + +[Brief project description and purpose] + +## 📋 Overview +[Essential value proposition in 2-3 sentences, under 10 seconds read time] + +## 🚀 Getting Started + +### Step 1: [Action Name] +[Brief instruction] + +### Step 2: [Action Name] +[Brief instruction] + +### Step 3: [Action Name] +[Brief instruction] + +## 📁 Project Structure +\`\`\`plaintext +[File structure tree showing only critical directories and files with comments] +\`\`\` + +## 🛠️ Development +[Local development setup and contribution guidelines, apply KISS/DRY principles] + +## 📞 Support +[Contact information and support channels, keep concise] +``` diff --git a/src/assets/conda/.gitkeep b/src/assets/conda/.gitkeep new file mode 100644 index 0000000..e7c9d9f --- /dev/null +++ b/src/assets/conda/.gitkeep @@ -0,0 +1,2 @@ +# Placeholder for conda documentation files +# This directory will be populated by the auto-update-docs workflow diff --git a/src/assets/pip/.gitkeep b/src/assets/pip/.gitkeep new file mode 100644 index 0000000..49d9e1e --- /dev/null +++ b/src/assets/pip/.gitkeep @@ -0,0 +1,2 @@ +# Placeholder for pip documentation files +# This directory will be populated by the auto-update-docs workflow diff --git a/src/assets/poetry/.gitkeep b/src/assets/poetry/.gitkeep new file mode 100644 index 0000000..6a5a08b --- /dev/null +++ b/src/assets/poetry/.gitkeep @@ -0,0 +1,2 @@ +# Placeholder for poetry documentation files +# This directory will be populated by the auto-update-docs workflow diff --git a/src/assets/uv/.gitkeep b/src/assets/uv/.gitkeep new file mode 100644 index 0000000..59f22e7 --- /dev/null +++ b/src/assets/uv/.gitkeep @@ -0,0 +1,2 @@ +# Placeholder for uv documentation files +# This directory will be populated by the auto-update-docs workflow