Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .eslintrc.json
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/"]
}
66 changes: 66 additions & 0 deletions .prettierignore
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
Comment on lines +8 to +9
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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.

-*.js
-*.js.map
+# Built JS maps (if any) in dist/build only
+dist/**/*.js
+dist/**/*.js.map
+build/**/*.js
+build/**/*.js.map
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
*.js
*.js.map
# Built JS maps (if any) in dist/build only
dist/**/*.js
dist/**/*.js.map
build/**/*.js
build/**/*.js.map
🤖 Prompt for AI Agents
In .prettierignore around lines 8-9, the entries "*.js" and "*.js.map" are too
broad and prevent Prettier from formatting all JavaScript sources; replace them
with patterns that only ignore build/artifact outputs (for example
/dist/**/*.js, /build/**/*.js, *.min.js or specific generated folders) so source
JS and config scripts remain formatted; remove the global "*.js" and "*.js.map"
lines and add one or more targeted paths that match only compiled output.


# 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/
22 changes: 22 additions & 0 deletions .prettierrc
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
}
}
]
}
123 changes: 93 additions & 30 deletions README.md
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>
Expand All @@ -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
Expand All @@ -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>
Expand Down Expand Up @@ -96,6 +98,7 @@ The engine combines multiple advanced technologies to provide a unified platform
</div>

### Language Support Matrix

<div align="center">
<table>
<thead>
Expand Down Expand Up @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

🧩 Analysis chain

Verify referenced CI/CD docs exist (and link paths).

Ensure CI_CD_SETUP.md and CI_CD_DOCUMENTATION.md are present or adjust links.


🏁 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
In README.md around lines 420 to 422 the links point to CI_CD_SETUP.md and
CI_CD_DOCUMENTATION.md which are missing from the repo; either add new files at
those exact paths containing the CI/CD quick start and technical docs, or update
the README links to point to the correct existing files or locations (e.g.,
docs/ci/CI_CD_SETUP.md and docs/ci/CI_CD_DOCUMENTATION.md) and verify relative
paths and filenames; after adding or updating, run a repo link check to ensure
no broken references remain.

## 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:

Expand All @@ -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}
}
```
```
10 changes: 5 additions & 5 deletions docs/todo-phase1.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
- [ ] Build request routing and handling compliance with MCP spec

### 4. PocketFlow Integration
- [ ] Integrate PocketFlow orchestration framework for multi-agent workflows
- [ ] Define task delegation mechanism to agents for code analysis, search, and completions
- [ ] Implement basic PocketFlow sample workflows (e.g., code search workflow)
- [ ] Ensure robust error handling and retry in task executions
- [ ] Set max agents and workflow timeout according to config
- [x] Integrate PocketFlow orchestration framework for multi-agent workflows
- [x] Define task delegation mechanism to agents for code analysis, search, and completions
- [x] Implement basic PocketFlow sample workflows (e.g., code search workflow)
- [x] Ensure robust error handling and retry in task executions
- [x] Set max agents and workflow timeout according to config

### 5. CLI Interface and Developer Tools
- [x] Build MVP CLI tool for administrative tasks and debug commands
Expand Down
Loading