Skip to content

grainme/muraqib-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

muraqib-js

AI-powered CRM JavaScript code review assistant using LLMs and RAG.

Automatically detects CRM-specific antipatterns in JavaScript customizations by retrieving relevant documentation and generating reviews, replacing manual expert reviews.

Architecture

                         INDEXING (offline, once)
                         ========================

knowledge_base/*.md → DirectoryLoader → RecursiveCharacterTextSplitter
                                                  │
                                                  ▼
                                          HuggingFaceEmbeddings
                                          (all-MiniLM-L6-v2)
                                                  │
                                                  ▼
                                              ChromaDB


                         QUERY (online, per review)
                         ===========================

Developer submits code ──→ Embed ──→ similarity_search (ChromaDB)
                                              │
                                              │  top-K relevant antipattern chunks
                                              ▼
                                    ChatPromptTemplate
                                    (system + context + code)
                                              │
                                              ▼
                                    ChatGroq (LLaMA 3.1, temp=0)
                                              │
                                              ▼
                                       Code review output

Stack

Component Tool Role
Framework LangChain Wires the pipeline — loaders, splitters, prompts, LLM
Embedding Model HuggingFace all-MiniLM-L6-v2 Converts text → vectors (runs locally)
Vector Store ChromaDB Stores and searches document vectors
Chat Model Groq (LLaMA 3.1 8B) Generates code reviews
Knowledge Base Markdown files CRM antipattern documentation

How It Works

  1. Document Loaders — Load antipattern documentation from markdown files using LangChain's DirectoryLoader
  2. Text Splitters — Chunk documents into ~500 char pieces with overlap using RecursiveCharacterTextSplitter, so each chunk is small enough for precise retrieval
  3. Embeddings — Each chunk is converted into a 384-dimensional vector using a local HuggingFace model. Semantically similar text produces similar vectors
  4. Vector Store — Chunks and vectors are stored in ChromaDB. At query time, the developer's code is embedded and the closest document chunks are retrieved via similarity search
  5. Prompt Template — Retrieved chunks are injected into a structured prompt alongside the code. The system prompt constrains the LLM to only flag issues found in the provided documentation
  6. LLM — Groq serves LLaMA 3.1 at temperature=0 for deterministic, consistent reviews

Setup

uv pip install -r requirements.txt

Create .env:

GROQ_API_KEY=gsk_your_key_here

Run:

python3 main.py

Example

Input (bad code):

var el = document.getElementById('account-name');
el.style.display = 'none';

Output:

Antipattern: Direct DOM Manipulation

Line: document.getElementById('account-name')

CRM UI may re-render at any time, breaking direct DOM references. Bypasses the CRM SDK event system. Use formContext.getControl('account-name').setVisible(false) instead.

Input (clean code):

function hideField(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.getControl('account-name').setVisible(false);
}

Output:

No antipatterns detected.

About

AI-powered CRM JavaScript code review assistant.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages