-
Notifications
You must be signed in to change notification settings - Fork 1
set up eslint and prettier #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "env": { | ||
| "node": true, | ||
| "es2022": true | ||
| }, | ||
| "extends": ["eslint:recommended"], | ||
| "parser": "@typescript-eslint/parser", | ||
| "parserOptions": { | ||
| "ecmaVersion": 2022, | ||
| "sourceType": "module" | ||
| }, | ||
| "plugins": ["@typescript-eslint", "prettier"], | ||
| "rules": { | ||
| "prettier/prettier": "warn", | ||
| "no-console": "off", | ||
| "no-debugger": "error", | ||
| "prefer-const": "error", | ||
| "no-var": "error", | ||
| "object-shorthand": "warn", | ||
| "prefer-arrow-callback": "warn", | ||
| "prefer-template": "warn", | ||
| "template-curly-spacing": "error", | ||
| "arrow-spacing": "error", | ||
| "comma-dangle": ["warn", "always-multiline"], | ||
| "quotes": ["error", "single", { "avoidEscape": true }], | ||
| "semi": ["error", "always"], | ||
| "no-unused-vars": "warn", | ||
| "no-empty": "warn", | ||
| "no-case-declarations": "warn" | ||
| }, | ||
| "ignorePatterns": ["dist/", "node_modules/", "*.js", "coverage/", ".nyc_output/"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
| package-lock.json | ||
|
|
||
| # Build outputs | ||
| dist/ | ||
| build/ | ||
| *.js | ||
| *.js.map | ||
|
|
||
| # Logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage/ | ||
| .nyc_output/ | ||
|
|
||
| # Dependency directories | ||
| jspm_packages/ | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # dotenv environment variables file | ||
| .env | ||
| .env.test | ||
|
|
||
| # Stores VSCode versions used for testing VSCode extensions | ||
| .vscode-test | ||
|
|
||
| # IDE files | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS generated files | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
|
|
||
| # Test corpus (large files) | ||
| test-corpus/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "semi": true, | ||
| "trailingComma": "es5", | ||
| "singleQuote": true, | ||
| "printWidth": 100, | ||
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "bracketSpacing": true, | ||
| "arrowParens": "avoid", | ||
| "endOfLine": "lf", | ||
| "quoteProps": "as-needed", | ||
| "jsxSingleQuote": true, | ||
| "bracketSameLine": false, | ||
| "overrides": [ | ||
| { | ||
| "files": "*.json", | ||
| "options": { | ||
| "printWidth": 200 | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,8 @@ | ||
|
|
||
| <div align="center"> | ||
| <h1>MCP Local Context Engine</h1> | ||
| <p><strong>Semantic Code Search and Analysis Platform</strong></p> | ||
| </div> | ||
|
|
||
|
|
||
| <div align="center" style="line-height:1"> | ||
| <a href="https://github.com/AssahBismarkabah/42context"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-Repository-blue?logo=github"/></a> | ||
| <a href="https://nodejs.org/"><img alt="Node.js" src="https://img.shields.io/badge/Node.js-18+-green?logo=node.js"/></a> | ||
|
|
@@ -25,6 +23,7 @@ | |
| MCP Local Context Engine is a comprehensive semantic code search and analysis platform that leverages the Model Context Protocol (MCP) for intelligent code understanding. Built with TypeScript and powered by vector databases, it provides advanced code search capabilities across multiple programming languages using AI-powered embeddings. | ||
|
|
||
| ### Key Features | ||
|
|
||
| - **Multi-Language Support**: Comprehensive parsing for JavaScript, TypeScript, Python, Java, C/C++, Rust, Go, Ruby, and PHP | ||
| - **Semantic Code Search**: Natural language queries with vector similarity matching | ||
| - **Real-time Indexing**: File system watching with automatic re-indexing | ||
|
|
@@ -33,29 +32,32 @@ MCP Local Context Engine is a comprehensive semantic code search and analysis pl | |
| - **Comprehensive CLI**: Full-featured command-line interface with shell completions | ||
|
|
||
| ### Architecture Overview | ||
|
|
||
| The engine combines multiple advanced technologies to provide a unified platform for code analysis and search. It uses Tree-sitter for multi-language parsing, Transformers.js for AI embeddings, and ChromaDB for efficient vector storage and retrieval. | ||
|
|
||
| ## 2. Technical Specifications | ||
|
|
||
| <div align="center"> | ||
|
|
||
| | | | | ||
| |:---:|:---:| | ||
| | **Core Language** | TypeScript | | ||
| | **Runtime** | Node.js 18+ | | ||
| | **Vector Database** | ChromaDB | | ||
| | **Embedding Model** | Xenova/all-MiniLM-L6-v2 | | ||
| | **Embedding Dimension** | 384 | | ||
| | **Parsing Engine** | Tree-sitter | | ||
| | **Supported Languages** | 10+ | | ||
| | **CLI Framework** | Commander.js | | ||
| | **Configuration** | JSON-based | | ||
| | **Logging** | Winston | | ||
| | | | | ||
| | :---------------------: | :---------------------: | | ||
| | **Core Language** | TypeScript | | ||
| | **Runtime** | Node.js 18+ | | ||
| | **Vector Database** | ChromaDB | | ||
| | **Embedding Model** | Xenova/all-MiniLM-L6-v2 | | ||
| | **Embedding Dimension** | 384 | | ||
| | **Parsing Engine** | Tree-sitter | | ||
| | **Supported Languages** | 10+ | | ||
| | **CLI Framework** | Commander.js | | ||
| | **Configuration** | JSON-based | | ||
| | **Logging** | Winston | | ||
|
|
||
| </div> | ||
|
|
||
| ## 3. Performance Metrics | ||
|
|
||
| ### Code Analysis Performance | ||
|
|
||
| <div align="center"> | ||
| <table> | ||
| <thead> | ||
|
|
@@ -96,6 +98,7 @@ The engine combines multiple advanced technologies to provide a unified platform | |
| </div> | ||
|
|
||
| ### Language Support Matrix | ||
|
|
||
| <div align="center"> | ||
| <table> | ||
| <thead> | ||
|
|
@@ -178,11 +181,13 @@ The engine combines multiple advanced technologies to provide a unified platform | |
| ## 4. Deployment | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js 18 or higher | ||
| - Docker and Docker Compose | ||
| - Git | ||
|
|
||
| ### Installation | ||
|
|
||
| ```bash | ||
| # Clone repository | ||
| git clone https://github.com/AssahBismarkabah/42context.git | ||
|
|
@@ -199,22 +204,26 @@ npm run build | |
| ``` | ||
|
|
||
| ### Configuration | ||
|
|
||
| The engine provides a **comprehensive three-tier configuration system** with automatic validation and flexible customization options. | ||
|
|
||
| #### Configuration Hierarchy (Priority Order) | ||
|
|
||
| 1. **Environment Variables** (highest priority) - `DEV_CONTEXT_*` prefix | ||
| 2. **JSON Configuration File** - Loaded via `--config` flag | ||
| 3. **Default Values** (lowest priority) - Optimized for immediate use | ||
|
|
||
| #### Configuration Methods | ||
|
|
||
| **1. JSON Configuration File** | ||
|
|
||
| ```bash | ||
| # Create custom configuration file | ||
| node dist/src/cli-main.js --config my-config.json search "authentication" | ||
| ``` | ||
|
|
||
| **Example custom configuration** (`test-config.json`): | ||
|
|
||
| ```json | ||
| { | ||
| "projectPath": "/path/to/project", | ||
|
|
@@ -252,6 +261,7 @@ node dist/src/cli-main.js --config my-config.json search "authentication" | |
| ``` | ||
|
|
||
| **2. Environment Variables** | ||
|
|
||
| ```bash | ||
| # Set embedding batch size | ||
| export DEV_CONTEXT_EMBEDDING_BATCH_SIZE=128 | ||
|
|
@@ -267,6 +277,7 @@ node dist/src/cli-main.js search "authentication" | |
| ``` | ||
|
|
||
| **3. CLI Configuration Commands** | ||
|
|
||
| ```bash | ||
| # View all settings | ||
| node dist/src/cli-main.js config list | ||
|
|
@@ -283,19 +294,16 @@ node dist/src/cli-main.js config get embedding.batchSize | |
|
|
||
| #### Key Configuration Sections | ||
|
|
||
| | Section | Purpose | Key Settings | | ||
| |---------|---------|--------------| | ||
| | **vectorStore** | ChromaDB connection and vector storage | host, port, collectionName, embeddingDimension | | ||
| | **embedding** | AI model settings for code embeddings | modelName, batchSize, maxRetries, retryDelay | | ||
| | **parser** | Code analysis and chunking | maxFileSize, chunkSize, chunkOverlap, supportedLanguages | | ||
| | **fileWatcher** | Real-time file monitoring | ignored patterns, maxFileSize, polling settings | | ||
| | **semanticSearch** | Search behavior tuning | maxResults, minSimilarity, enableCaching | | ||
| | **performance** | Resource usage limits | maxConcurrentOperations, memoryLimit, cpuLimit | | ||
| | **security** | File access and content filtering | allowedFileExtensions, enableSandbox, maxFileSize | | ||
| | **logging** | Debug and monitoring output | level, enableConsole, enableFile | | ||
|
|
||
|
|
||
|
|
||
| | Section | Purpose | Key Settings | | ||
| | ------------------ | -------------------------------------- | -------------------------------------------------------- | | ||
| | **vectorStore** | ChromaDB connection and vector storage | host, port, collectionName, embeddingDimension | | ||
| | **embedding** | AI model settings for code embeddings | modelName, batchSize, maxRetries, retryDelay | | ||
| | **parser** | Code analysis and chunking | maxFileSize, chunkSize, chunkOverlap, supportedLanguages | | ||
| | **fileWatcher** | Real-time file monitoring | ignored patterns, maxFileSize, polling settings | | ||
| | **semanticSearch** | Search behavior tuning | maxResults, minSimilarity, enableCaching | | ||
| | **performance** | Resource usage limits | maxConcurrentOperations, memoryLimit, cpuLimit | | ||
| | **security** | File access and content filtering | allowedFileExtensions, enableSandbox, maxFileSize | | ||
| | **logging** | Debug and monitoring output | level, enableConsole, enableFile | | ||
|
|
||
| ## 5. Usage | ||
|
|
||
|
|
@@ -356,12 +364,67 @@ node dist/src/cli-main.js stats --detailed | |
| node dist/src/cli-main.js debug test-connection | ||
| ``` | ||
|
|
||
| ## 6. Development & CI/CD | ||
|
|
||
| ### Continuous Integration | ||
|
|
||
| The project uses GitHub Actions for comprehensive CI/CD automation: | ||
|
|
||
| #### 🔄 CI Pipeline | ||
|
|
||
| - **Build & Test**: Automated testing with ChromaDB service | ||
| - **Code Quality**: ESLint, Prettier, TypeScript checks | ||
| - **Security**: npm audit, vulnerability scanning | ||
| - **Docker**: Container building and testing | ||
| - **Integration**: CLI functionality testing | ||
|
|
||
| #### 🔍 Code Quality Pipeline | ||
|
|
||
| - **Static Analysis**: CodeQL analysis | ||
| - **Security Scanning**: Dependency review, secret detection | ||
| - **Performance**: Build and CLI performance testing | ||
| - **License Compliance**: Dependency license checking | ||
|
|
||
| #### 🚀 Release Pipeline | ||
|
|
||
| - **Automated Releases**: Tag-based and manual releases | ||
| - **Multi-platform**: Cross-platform binary packages | ||
| - **Container Registry**: Docker images to GitHub Container Registry | ||
| - **NPM Publishing**: Automated package publishing | ||
|
|
||
| ### Quick Setup | ||
|
|
||
| ```bash | ||
| # Install dependencies | ||
| npm install | ||
|
|
||
| # Run quality checks | ||
| npm run lint | ||
| npm run format:check | ||
| npm run type-check | ||
|
|
||
| # Run tests | ||
| npm test | ||
|
|
||
| # Build project | ||
| npm run build | ||
|
|
||
| # Start development | ||
| npm run dev | ||
| ``` | ||
|
|
||
| ### CI/CD Documentation | ||
|
|
||
| For detailed CI/CD setup and usage instructions, see: | ||
|
|
||
| ## 6. License | ||
| - [CI/CD Setup Guide](CI_CD_SETUP.md) - Quick start and configuration | ||
| - [CI/CD Documentation](CI_CD_DOCUMENTATION.md) - Technical details | ||
|
|
||
|
Comment on lines
+420
to
+422
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify referenced CI/CD docs exist (and link paths). Ensure 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
fd -a 'CI*_*.md' -E 'node_modules' -E 'dist' || true
test -f CI_CD_SETUP.md && echo "OK: CI_CD_SETUP.md" || echo "Missing: CI_CD_SETUP.md"
test -f CI_CD_DOCUMENTATION.md && echo "OK: CI_CD_DOCUMENTATION.md" || echo "Missing: CI_CD_DOCUMENTATION.md"Length of output: 55 Fix README links: missing CI/CD docs README.md (lines 420–422) links to CI_CD_SETUP.md and CI_CD_DOCUMENTATION.md but both files are missing from the repo (verification: Missing: CI_CD_SETUP.md; Missing: CI_CD_DOCUMENTATION.md). Add the two files at the referenced paths or update the links to the correct locations. 🤖 Prompt for AI Agents |
||
| ## 7. License | ||
|
|
||
| This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. | ||
|
|
||
| ## 7. Citation | ||
| ## 8. Citation | ||
|
|
||
| If you use MCP Local Context Engine in your research, please cite: | ||
|
|
||
|
|
@@ -373,4 +436,4 @@ If you use MCP Local Context Engine in your research, please cite: | |
| url={https://github.com/your-org/mcp-local-context-engine}, | ||
| note={Open source semantic code search engine} | ||
| } | ||
| ``` | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not ignore all .js files.
This will prevent Prettier from formatting any JS sources (including config scripts). Narrow the pattern to build outputs only.
📝 Committable suggestion
🤖 Prompt for AI Agents