bleujs
v1.0.20
Published
A production-ready AI and decision tree service
Downloads
179
Maintainers
Readme
.js/core
- Bleu.js is a Rule-based AI framework designed to provide pinpoint solutions to various problems. It's is a JavaScript framework built to tackle the various coding challenges developers face.
Features
- Advanced debugging
- Automates dependency management
- Ensure Code Quality: Tools to ensure the highest code quality
- Generate Eggs: Automatically generate code snippets
- Provides tools to maintain code quality without adding extra complexity
- Real-time optimization suggestions
- Streamlines collaboration
- Support for multiple programming languages
- Manage Dependencies: Handle project dependencies efficiently
Installation
Install the package using pnpm.
pnpm install bleujs
Running the Application
ROOT:
pnpm run start:backend
In another terminal: ROOT:
pnpm run start:frontend
cd core-engine
pnpm run start
cd dependency-management
pnpm start
cd eggs-generator
pnpm run start
Building the Application
pnpm run build
Testing
pnpm run test:all
Directory Structure
core-engine: Contains the main logic for code generation, optimization, and debugging.
language-plugins: Modules for different programming languages.
- javascript: JavaScript-specific tools.
- python: Python-specific tools.
collaboration-tools: Tools for code review, issue tracking, and project management.
dependency-management: Tools for monitoring and managing dependencies.
code-quality-assurance: Tools for continuous code quality checks and analysis.
eggs-generator: Tools for generating code snippets and optimization suggestions by HenFarm.js, the framework built by Helloblue.
docker: Docker configuration files.
Bleu.js, uses the HenFarm.js framework for generating code snippets, referred to as "eggs." It's an integral part of Bleu.js, providing the functionality to automatically generate new code snippets to help improve efficiency and solve coding problems.
Generating Code
To generate code using Bleu.js, you can send a POST request to the /generate endpoint with the template you want to use:
curl -X POST http://localhost:3000/generate -H "Content-Type: application/json" -d '{"template": "basic function"}'
Optimizing Code
To optimize code using Bleu.js, you can send a POST request to the /optimize endpoint with the code you want to optimize:
curl -X POST http://localhost:3000/optimize -H "Content-Type: application/json" -d '{"code": "console.log(\"Hello, world!\");"}'
Debugging Code
To debug code using Bleu.js, you can send a POST request to the /debug endpoint with the code you want to debug:
curl -X POST http://localhost:3000/debug -H "Content-Type: application/json" -d '{"code": "console.log(\"Hello, world!\");"}'
cd frontend
╰─ pnpm run serve
> [email protected] serve /Users/path/path/Bleu.js
> cd ui && pnpm run serve
> [email protected] serve /Users/path/path/Bleu.js/ui
> vue-cli-service serve
INFO Starting development server...
98% after emitting
DONE Compiled successfully in 93660ms
App running at:
- Local: http://localhost:8080/
- Network: http://10.0.0.0:8080/
The bleujs package aims to provide a robust and powerful solution for developers working on AI and backend services. Here's how this package can help developers around the world:
Comprehensive AI Tools
With built-in AI services like natural language processing (NLP) and decision trees, developers can quickly integrate advanced AI capabilities into their applications without starting from scratch.
Backend Efficiency
The package includes a well-structured backend setup using Express.js, MongoDB, and essential middleware like helmet for security, compression for performance, and cors for handling cross-origin requests. This allows developers to set up a scalable and secure backend efficiently.
Testing and Quality Assurance
bleujs integrates comprehensive testing frameworks, including Jest for unit and integration tests, and Cypress for end-to-end tests. This ensures that applications built with this package are reliable and maintain high quality standards.
Code Linting and Formatting
By including ESLint and Prettier configurations, bleujs helps developers maintain consistent coding standards and formatting, reducing errors and improving code readability.
TypeScript Support
The package supports TypeScript, allowing developers to write safer and more maintainable code with type checking.
Frontend Integration
With Vue.js as the frontend framework, developers can create modern, reactive user interfaces. The package includes scripts for building and serving Vue applications, making it easy to integrate the frontend with the backend.
Swagger Documentation
The package includes tools for generating Swagger API documentation, making it easier for developers to document and share their API specifications.
Continuous Integration/Continuous Deployment (CI/CD)
The package comes with a CI/CD pipeline configuration for automated testing, linting, building, and deployment. This helps teams to integrate changes continuously and deploy applications reliably.
Docker Support
With Docker integration, developers can containerize their applications for consistent deployment across different environments. This ensures that the application runs seamlessly regardless of where it is deployed.
Real-time Features
With WebSocket support (ws), developers can add real-time features like live notifications and updates to their applications.
Usage
Create an instance of the BleuJS class and use its methods to manage your code:
import BleuJS from 'bleu.js';
const bleu = new BleuJS();
const newEgg = bleu.generateEgg('This is a description of the new egg.');
console.log(newEgg);
const code = 'const x = 1; console.log(x);';
const optimizedCode = bleu.optimizeCode(code);
const dependencies = ['express', 'body-parser'];
bleu.manageDependencies(dependencies);
const isQualityCode = bleu.ensureCodeQuality(code);
console.log(`Is the code quality acceptable? ${isQualityCode}`);
Bleu
✓ should generate a new egg (3 ms)
✓ should optimize code
✓ should manage dependencies (15 ms)
✓ should ensure code quality
✓ should generate multiple eggs
✓ should handle large number of eggs (1 ms)
✓ should handle complex optimization
✓ should ensure quality of complex code
Test Suites: 1 passed, 1 total
Tests: 8 passed, 8 total
Snapshots: 0 total
Time: 0.359 s, estimated 1 s
Ran all test suites.
test backend
cd bleu.js
pnpm run test:backend
Class Documentation
'BleuJS'
The BleuJS class provides several methods to help you manage and optimize your code.
class Bleu {
constructor() {
this.eggs = [];
}
/**
* Generates a new code egg.
* @param {string} description - Description of the egg.
* @param {string} type - Type of the egg (e.g., 'model', 'utility').
* @param {object} options - Options for generating the egg.
* @returns {object} The generated egg.
*/
generateEgg(description, type, options) {
const code = this.generateCode(type, options);
const newEgg = {
id: this.eggs.length + 1,
description: this.generateDescription(type, options),
type,
code,
};
this.eggs.push(newEgg);
return newEgg;
}
/**
* Generates code based on type.
* @param {string} type - Type of the code (e.g., 'model', 'utility').
* @param {object} options - Options for generating the code.
* @returns {string} The generated code.
*/
generateCode(type, options) {
switch (type) {
case 'model':
return this.generateModel(options.modelName, options.fields);
case 'utility':
return this.generateUtility(options.utilityName, options.methods);
default:
throw new Error(`Unknown code type: ${type}`);
}
}
/**
* Generates model code.
* @param {string} modelName - Name of the model.
* @param {Array} fields - Fields of the model.
* @returns {string} The generated model code.
*/
generateModel(modelName, fields) {
let code = `class ${modelName} {\n`;
fields.forEach((field) => {
code += ` ${field.name}: ${field.type};\n`;
});
code += '}';
return code;
}
/**
* Generates utility code.
* @param {string} utilityName - Name of the utility.
* @param {Array} methods - Methods of the utility.
* @returns {string} The generated utility code.
*/
generateUtility(utilityName, methods) {
let code = `class ${utilityName} {\n`;
methods.forEach((method) => {
code += ` ${method}() {\n`;
code += ` // TODO: Implement ${method}\n`;
code += ' }\n';
});
code += '}';
return code;
}
/**
* Generates description based on type.
* @param {string} type - Type of the egg.
* @param {object} options - Options for generating the description.
* @returns {string} The generated description.
*/
generateDescription(type, options) {
switch (type) {
case 'model':
return `Model ${options.modelName} with fields ${options.fields.map((f) => f.name).join(', ')}`;
case 'utility':
return `Utility ${options.utilityName} with methods ${options.methods.join(', ')}`;
default:
throw new Error(`Unknown code type: ${type}`);
}
}
/**
* Optimizes the provided code.
* @param {string} code - The code to optimize.
* @returns {string} The optimized code.
*/
optimizeCode(code) {
return code.replace(/\s+/g, ' ').trim();
}
/**
* Manages dependencies.
* @param {Array} dependencies - List of dependencies.
*/
manageDependencies(dependencies) {
dependencies.forEach((dep) => {
console.log(`Managing dependency: ${dep}`);
});
}
/**
* Ensures code quality.
* @param {string} code - The code to check.
* @returns {boolean} Whether the code is of high quality.
*/
ensureCodeQuality(code) {
return !code.includes('var');
}
}
module.exports = Bleu;
Bleu
✓ should generate a new egg (1 ms)
✓ should optimize code
✓ should manage dependencies (10 ms)
✓ should ensure code quality
✓ should generate multiple eggs
✓ should handle large number of eggs (3 ms)
✓ should handle complex optimization
✓ should ensure quality of complex code
Test Suites: 1 passed, 1 total
Tests: 8 passed, 8 total
Snapshots: 0 total
Time: 0.359 s, estimated 1 s
Ran all test suites.
Constructor
constructor();
Structure
class Bleu {
constructor() {
this.eggs = [];
}
generateEgg(description, type, options = {}) {
const newEgg = {
id: this.eggs.length + 1,
description,
type,
code: this.generateCode(type, options),
};
this.eggs.push(newEgg);
return newEgg;
}
generateCode(type, options) {
switch (type) {
case 'model':
return this.generateModel(options.modelName, options.fields);
case 'controller':
return this.generateController(options.controllerName, options.actions);
case 'utility':
return this.generateUtility(options.utilityName, options.methods);
default:
throw new Error(`Unknown code type: ${type}`);
}
}
generateModel(modelName, fields) {
const classFields = fields
.map((field) => ` ${field.name}: ${field.type};`)
.join('\n');
const classMethods = fields
.map(
(field) =>
` get${field.name.charAt(0).toUpperCase() + field.name.slice(1)}() { return this.${field.name}; }`,
)
.join('\n\n');
return `
class ${modelName} {
${classFields}
constructor(${fields.map((field) => field.name).join(', ')}) {
${fields.map((field) => `this.${field.name} = ${field.name};`).join('\n ')}
}
${classMethods}
}
module.exports = ${modelName};
`;
}
generateController(controllerName, actions) {
const actionMethods = actions
.map(
(action) => `
${action}() {
// ${action} logic here
}`,
)
.join('\n');
return `
class ${controllerName} {
${actionMethods}
}
module.exports = ${controllerName};
`;
}
generateUtility(utilityName, methods) {
const utilityMethods = methods
.map(
(method) => `
${method.name}(${method.params.join(', ')}) {
${method.body}
}`,
)
.join('\n');
return `
class ${utilityName} {
${utilityMethods}
}
module.exports = ${utilityName};
`;
}
optimizeCode(code) {
const optimizedCode = code;
return optimizedCode;
}
manageDependencies(dependencies) {
dependencies.forEach((dep) => {
console.log(`Managing dependency: ${dep}`);
});
}
ensureCodeQuality(code) {
const isQualityCode = true;
return isQualityCode;
}
}
module.exports = Bleu;
const Bleu = require('./Bleu');
const bleu = new Bleu();
console.log('This is an index file');
// Test generateEgg method
const newEgg = bleu.generateEgg('This is a test egg', 'model', {
modelName: 'TestModel',
fields: [
{ name: 'field1', type: 'string' },
{ name: 'field2', type: 'number' },
],
});
console.log('Generated Egg:', newEgg);
// Test optimizeCode method
const code = 'const x = 1; console.log(x);';
const optimizedCode = bleu.optimizeCode(code);
console.log('Optimized Code:', optimizedCode);
// Test ensureCodeQuality method
const isQualityCode = bleu.ensureCodeQuality(code);
console.log('Is the code quality acceptable?', isQualityCode);
// Test manageDependencies method
const dependencies = ['express', 'body-parser'];
bleu.manageDependencies(dependencies);
`pnpm run test:all`;
PASS tests/bleu.test.js
API Tests
✓ should return Hello, World! on GET / (49 ms)
✓ should create data on POST /data (113 ms)
✓ should create multiple data entries on POST /data (114 ms)
✓ should handle /data with body {} (10 ms)
✓ should handle /nonexistent with body null (6 ms)
✓ should handle /data with body Invalid JSON (5 ms)
✓ should handle asynchronous errors gracefully (12 ms)
✓ should handle edge cases (4 ms)
✓ should ensure performance meets expectations (4 ms)
✓ should return 400 for missing data field in POST /data (5 ms)
✓ should return 500 for simulated server error in POST /data (7 ms)
✓ should handle invalid JSON gracefully (3 ms)
✓ should handle very large data payloads (106 ms)
✓ should measure response time for POST /data (110 ms)
✓ should handle simultaneous requests (148 ms)
✓ should validate response schema (6 ms)
✓ should stress test the server (263 ms)
✓ should test with invalid routes (5 ms)
✓ should test JSON parsing error (3 ms)
✓ should test different HTTP methods on /data (5 ms)
✓ should handle very large number of simultaneous requests (1235 ms)
✓ should handle concurrent GET and POST requests (108 ms)
✓ should handle slow network conditions gracefully (110 ms)
✓ should handle invalid request headers (10 ms)
✓ should verify CORS headers (7 ms)
✓ should handle session cookies (116 ms)
✓ should verify content-type for POST /data (9 ms)
✓ should test for memory leaks (274 ms)
✓ should handle different user roles (111 ms)
✓ should handle database connectivity issues (5 ms)
✓ should handle multipart/form-data (110 ms)
✓ should handle application/x-www-form-urlencoded (113 ms)
✓ should handle JSON arrays (11 ms)
✓ should handle deeply nested JSON objects (114 ms)
Test Suites: 1 passed, 1 total
Tests: 34 passed, 34 total
Snapshots: 0 total
Time: 3.707 s, estimated 4 s
Ran all test suites.
Test
cd backend
╰─ curl -X POST http://localhost:3003/ai/nlp -H "Content-Type: application/json" -d '{"text": "This is a test for NLP processing."}'
Expected response:
{"tokens":["This","is","a","test","for","NLP","processing"]}%
Initializes a new instance of the BleuJS class.
Methods
Class Constructor:
The class constructor initializes the Bleu object with an empty array eggs to store the generated code 'eggs'. This array acts as a container for all the code snippets, models, utilities, and other structures created using the generateEgg method.
- Initializes an empty array eggs to store the generated code 'eggs'.
constructor() {
this.eggs = [];
this.henFarm = new HenFarm(); // Initialize HenFarm.js
}
generateEgg Method:
The generateEgg method is responsible for generating a new code 'egg'. This method leverages the HenFarm.js framework to produce code snippets based on the specified type and options. Each generated egg is assigned a unique ID, a description, and the generated code. The egg is then added to the eggs array and returned.
- Utilize HenFarm.js to generate code based on the provided type and options.
- Create a new egg object with a unique ID, description, type, generated code, and creation timestamp.
- Append the new egg to the eggs array.
- Return the newly created egg.
generateEgg(description, type, options) {
const code = this.henFarm.generateCode(type, options);
const newEgg = {
id: this.eggs.length + 1,
description: this.generateDescription(type, options),
type,
code,
createdAt: new Date()
};
this.eggs.push(newEgg);
return newEgg;
}
generateEgg(description, type, options) {
const code = this.henFarm.generateCode(type, options);
const newEgg = {
id: this.eggs.length + 1,
description: this.generateDescription(type, options),
type,
code,
createdAt: new Date()
};
this.eggs.push(newEgg);
return newEgg;
}
cd eggs-generator
pnpm run test
PASS tests/bleu.test.js
API Tests
✓ should return Hello, World! on GET / (49 ms)
✓ should create data on POST /data (113 ms)
✓ should create multiple data entries on POST /data (114 ms)
✓ should handle /data with body {} (10 ms)
✓ should handle /nonexistent with body null (6 ms)
✓ should handle /data with body Invalid JSON (5 ms)
✓ should handle asynchronous errors gracefully (12 ms)
✓ should handle edge cases (4 ms)
✓ should ensure performance meets expectations (4 ms)
✓ should return 400 for missing data field in POST /data (5 ms)
✓ should return 500 for simulated server error in POST /data (7 ms)
✓ should handle invalid JSON gracefully (3 ms)
✓ should handle very large data payloads (106 ms)
✓ should measure response time for POST /data (110 ms)
✓ should handle simultaneous requests (148 ms)
✓ should validate response schema (6 ms)
✓ should stress test the server (263 ms)
✓ should test with invalid routes (5 ms)
✓ should test JSON parsing error (3 ms)
✓ should test different HTTP methods on /data (5 ms)
✓ should handle very large number of simultaneous requests (1235 ms)
✓ should handle concurrent GET and POST requests (108 ms)
✓ should handle slow network conditions gracefully (110 ms)
✓ should handle invalid request headers (10 ms)
✓ should verify CORS headers (7 ms)
✓ should handle session cookies (116 ms)
✓ should verify content-type for POST /data (9 ms)
✓ should test for memory leaks (274 ms)
✓ should handle different user roles (111 ms)
✓ should handle database connectivity issues (5 ms)
✓ should handle multipart/form-data (110 ms)
✓ should handle application/x-www-form-urlencoded (113 ms)
✓ should handle JSON arrays (11 ms)
✓ should handle deeply nested JSON objects (114 ms)
Test Suites: 1 passed, 1 total
Tests: 34 passed, 34 total
Snapshots: 0 total
Time: 3.707 s, estimated 4 s
Ran all test suites.
optimizeCode Method:
The optimizeCode method is designed to optimize the provided code. While currently a placeholder, this method will implement advanced code optimization techniques to enhance performance and efficiency.
- Placeholder for code optimization logic.
- Returns the optimized code.
optimizeCode(code) {
// Optimization logic here
const optimizedCode = code.replace(/\s+/g, ' ').trim();
return optimizedCode;
}
manageDependencies Method:
The manageDependencies method will handle the project's dependencies. This placeholder will eventually include logic to automate dependency resolution, installation, and updates.
- Placeholder logic for dependency management.
- Potential logging of managed dependencies.
manageDependencies(dependencies) {
dependencies.forEach(dep => {
console.log(`Managing dependency: ${dep.name}@${dep.version}`);
});
}
ensureCodeQuality Method:
The ensureCodeQuality method will ensure that the provided code meets predefined quality standards. This placeholder will incorporate code analysis tools and techniques to validate the code's quality.
- Placeholder for code quality assurance logic.
- Returns a boolean indicating whether the code meets quality standards.
ensureCodeQuality(code) {
const isQualityCode = true;
return isQualityCode;
}
Bleu.js API Documentation
Introduction
This document provides detailed information about the API endpoints available in the Bleu.js application, including the recent updates and improvements made to the API.
ROOT
pnpm run start:backend
PASS backend/tests/bleu.test.js
API Tests
✓ should handle invalid request headers (28 ms)
✓ should handle /data with body {} (2 ms)
✓ should handle /nonexistent with body null (2 ms)
✓ should handle /data with body Invalid JSON (2 ms)
✓ should handle asynchronous errors gracefully (2 ms)
✓ should handle edge cases (1 ms)
✓ should ensure performance meets expectations (10 ms)
✓ should return 400 for missing data field in POST /data (1 ms)
✓ should return 500 for simulated server error in POST /data (2 ms)
✓ should handle invalid JSON gracefully (1 ms)
✓ should handle very large data payloads (1 ms)
✓ should measure response time for POST /data (2 ms)
✓ should handle simultaneous requests (9 ms)
✓ should validate response schema (1 ms)
✓ should stress test the server (39 ms)
✓ should test with invalid routes (1 ms)
✓ should test JSON parsing error (1 ms)
✓ should test different HTTP methods on /data (2 ms)
✓ should handle very large number of simultaneous requests (294 ms)
✓ should handle concurrent GET and POST requests (1 ms)
✓ should handle slow network conditions gracefully
✓ should verify CORS headers
✓ should handle session cookies (8 ms)
✓ should verify content-type for POST /data
✓ should test for memory leaks (31 ms)
✓ should handle different user roles (2 ms)
✓ should handle database connectivity issues (1 ms)
✓ should handle application/x-www-form-urlencoded (1 ms)
✓ should handle JSON arrays (1 ms)
✓ should handle deeply nested JSON objects (1 ms)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
Test Suites: 1 passed, 1 total
Tests: 30 passed, 30 total
Snapshots: 0 total
Time: 1.597 s
Ran all test suites matching /backend\/tests/i.
PASS lint reports/jest-html-reporters-attach/report/index.js
PASS lint backend/coverage/lcov-report/prettify.js
PASS lint eggs-generator/coverage/prettify.js
PASS lint eggs-generator/coverage/lcov-report/prettify.js
PASS lint coverage/lcov-report/prettify.js
PASS lint coverage/prettify.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/turkish-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/turkish-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/themes/bizstyle/static/css3-mediaqueries.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/italian-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/themes/bizstyle/static/css3-mediaqueries_src.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/themes/basic/static/searchtools.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/dutch-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/docutils/writers/s5_html/themes/default/slides.js
PASS lint backend/coverage/lcov-report/sorter.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/french-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/french-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/portuguese-stemmer.js
PASS lint scripts/preinstall.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/spanish-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/spanish-stemmer.js
PASS lint coverage/lcov-report/sorter.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/finnish-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/en_DE/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/portuguese-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/italian-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/finnish-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/russian-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/porter-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/romanian-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/porter-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/pt/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/hungarian-stemmer.js
PASS lint coverage/sorter.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/romanian-stemmer.js
PASS lint eggs-generator/coverage/sorter.js
PASS lint eggs-generator/coverage/lcov-report/sorter.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/hungarian-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/russian-stemmer.js
PASS lint reports/jest-html-reporters-attach/report/result.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/dutch-stemmer.js
PASS lint backend/server.js
PASS lint core-engine/src/index.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/german-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/danish-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/base-stemmer.js
PASS lint backend/src/routes.js
PASS lint backend/ai/decisionTree.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/base-stemmer.js
PASS lint backend/index.js
PASS lint frontend/src/index.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/german-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/themes/basic/static/doctools.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/swedish-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/el/LC_MESSAGES/sphinx.js
PASS lint dependency-management/src/index.js
PASS lint backend/tests/CustomSequencer.js
PASS lint frontend/public/app.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/danish-stemmer.js
PASS lint backend/controllers/apiController.js
PASS lint core-engine/src/BleuX.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/urllib3/contrib/emscripten/emscripten_fetch_worker.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/themes/basic/static/sphinx_highlight.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/non-minified-js/norwegian-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/swedish-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/search/minified-js/norwegian-stemmer.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ta/LC_MESSAGES/sphinx.js
PASS lint eggs-generator/coverage/block-navigation.js
PASS lint language-plugins/javascript/src/index.js
PASS lint backend/controllers/dataController.js
PASS lint backend/ai/nlpProcessor.js
PASS lint backend/tests/decisionTree.test.js
PASS lint eggs-generator/src/index.js
PASS lint eggs-generator/tests/example.test.js
PASS lint ./jest.setup.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/et/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/fr/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/gl/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/es_CO/LC_MESSAGES/sphinx.js
PASS lint coverage/lcov-report/block-navigation.js
PASS lint coverage/block-navigation.js
PASS lint dependency-management/test.js
PASS lint ./babel.config.js
PASS lint backend/coverage/lcov-report/block-navigation.js
PASS lint backend/routes/apiRoutes.js
PASS lint backend/ml/modelManager.js
PASS lint backend/tests/testSequencer.test.js
PASS lint backend/html-report/jest-html-reporters-attach/report/result.js
PASS lint core-engine/src/Bleu.js
PASS lint eggs-generator/tests/index.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/fa/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/mk/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/yue/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/cak/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/is/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/sr_RS/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ca/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/da/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/sv/LC_MESSAGES/sphinx.js
PASS lint ./generateRuleId.js
PASS lint backend/src/swagger.js
PASS lint backend/services/aiService.js
PASS lint backend/services/rulesEngine.js
PASS lint backend/models/ruleModel.js
PASS lint backend/tests/globalSetup.js
PASS lint backend/tests/seedDatabase.test.js
PASS lint eggs-generator/src/HenFarm.js
PASS lint eggs-generator/src/Bleu.js
PASS lint eggs-generator/coverage/lcov-report/block-navigation.js
PASS lint language-plugins/javascript/tests/index.test.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/eu/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/cy/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ko/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/si/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ro/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ru/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/cs/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/nb_NO/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/he/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/zh_HK/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/vi/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ur/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/sl/LC_MESSAGES/sphinx.js
PASS lint ./simpleServer.js
PASS lint backend/src/utils/lib/Bleu.js
PASS lint backend/src/utils/testSequencer.js
PASS lint backend/services/decisionTreeService.js
PASS lint backend/routes/dataRoutes.js
PASS lint backend/tests/aiService.test.js
PASS lint ./preinstall.js
PASS lint language-plugins/src/index.js
PASS lint language-plugins/javascript/src/JSProcessor.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/themes/scrolls/static/theme_extras.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/de_DE/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/en_FR/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/tr/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/fr_FR/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/lt/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/es/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/eo/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/id/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/fi/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/de/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/hi/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ka/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ne/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/nl/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/bn/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/bg/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/hu/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/hr/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ar/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/en_GB/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/sr@latin/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/sr/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/hi_IN/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/it/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/lv/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/ja/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/sq/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/en_HK/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/pl/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/sk/LC_MESSAGES/sphinx.js
PASS lint dependency-management/src/dependencyManager.js
PASS lint ./manualConnectionTest.js
PASS lint collaboration-tools/src/index.js
PASS lint backend/src/utils/logger.js
PASS lint backend/services/seedDatabase.js
PASS lint backend/routes/index.js
PASS lint backend/tests/apiRoutes.test.js
PASS lint backend/tests/bleu.test.js
PASS lint backend/tests/setupTests.js
PASS lint backend/tests/aiTests.test.js
PASS lint backend/tests/globalTeardown.js
PASS lint backend/html-report/jest-html-reporters-attach/report/index.js
PASS lint backend/mocks/databse.js
PASS lint eggs-generator/src/generateEgg.js
PASS lint code-quality-assurance/src/index.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.js
PASS lint language-plugins/python/venv/lib/python3.12/site-packages/sphinx/locale/te/LC_MESSAGES/sphinx.js
PASS lint backend/services/mockEngine.js
PASS lint backend/routes/simpleRoute.js
PASS lint backend/models/userModel.js
PASS lint ./index.js
PASS lint ./jest.config.js
PASS lint eggs-generator/__mocks__/HenFarm.js
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
Test Suites: 191 passed, 191 total
Tests: 191 passed, 191 total
Snapshots: 0 total
Time: 10.591 s
Getting Started
To set up the project and start the server, follow these steps:
Navigate to the backend directory:
pnpm install express body-parser swagger-jsdoc swagger-ui-express
Create server.js
const express = require('express');
const bodyParser = require('body-parser');
const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');
const app = express();
app.use(bodyParser.json());
const swaggerDefinition = {
openapi: '3.0.0',
info: {
title: 'Bleu.js API',
version: '1.0.0',
description: 'Documentation for the Bleu.js API',
},
servers: [
{
url: 'http://localhost:3003',
},
],
};
const options = {
swaggerDefinition,
apis: ['./server.js'], // Path to the API docs
};
const swaggerSpec = swaggerJsdoc(options);
app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
app.get('/', (req, res) => {
res.status(200).json({ message: 'Hello, World!' });
});
app.listen(3003, () => {
console.log('Server is running on http://localhost:3003');
});
Install the required packages:
pnpm install
Start the server:
node server.js
To set up the project and start the server, follow these steps:
- Navigate to the backend directory:
cd backend
- Install the required packages:
pnpm add express body-parser swagger-jsdoc swagger-ui-express
- Start the server:
node server.js
- Access the Swagger UI:
Open your browser and navigate to
http://localhost:3003/docs
to view the API documentation.
API Endpoint test:
cd backend
pnpm run start:dev
- Access the raw Swagger JSON:
Open your browser and navigate to
http://localhost:3003/swagger.json
to view the raw Swagger JSON. Or in a new Terminal use curl test:
Debug endpoint
curl -X POST http://localhost:3003/debug -d '{}'
Optimize endpoint
curl -X POST http://localhost:3003/optimize -d '{}'
Generate endpoint
curl -X POST http://localhost:3003/generate -d '{}'
Access the Swagger UI:
Open your browser and navigate to http://localhost:3003/docs
to view the API documentation.
Access the raw Swagger JSON:
Open your browser and navigate to http://localhost:3003/swagger
json to view the raw Swagger JSON.
Recent API Updates
GET /
Returns a greeting message.
- URL: /
- Method: GET
- Response:
{
"message": "Hello, World!"
}
Swagger Documentation:
/**
* @swagger
* /:
* get:
* summary: Returns a greeting message
* responses:
* 200:
* description: A JSON object containing a greeting message
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* example: Hello, World!
*/
app.get('/', (req, res) => {
res.status(200).json({ message: 'Hello, World!' });
});
POST /debug
Handles debug logic
URL: /debug Method: POST
Response:
'Debugging';
Swagger Documentation:
* @swagger
* /debug:
* post:
* summary: Debug logic
* tags: [Debug]
* responses:
* 200:
* description: Debugging
* content:
* application/json:
* schema:
* type: string
* example: Debugging
*/
router.post('/debug', (req, res) => {
res.send('Debugging');
});
POST /optimize
Handles optimization logic.
- URL: /optimize
- Method: POST
- Response:
`"Optimizing"`;
Swagger Documentation:
/**
* @swagger
* /optimize:
* post:
* summary: Optimize logic
* tags: [Optimization]
* responses:
* 200:
* description: Optimizing
* content:
* application/json:
* schema:
* type: string
* example: Optimizing
*/
router.post('/optimize', (req, res) => {
res.send('Optimizing');
});
POST /generate
Handles generation logic.
- URL: /generate
- Method: POST
- Response:
`"Generating"`;
Swagger Documentation:
/**
* @swagger
* /generate:
* post:
* summary: Generate logic
* tags: [Generation]
* responses:
* 200:
* description: Generating
* content:
* application/json:
* schema:
* type: string
* example: Generating
*/
router.post('/generate', (req, res) => {
res.send('Generating');
});
API Documentation
The API documentation is available at http://localhost:3003/docs
and provides detailed information about all available endpoints, request parameters, and response structures.
Example of Swagger Documentation
Here is an example of how Swagger documentation is added for an endpoint in the backend/server.js file:
/**
* @swagger
* /:
* get:
* summary: Returns a greeting message
* responses:
* 200:
* description: A JSON object containing a greeting message
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* example: Hello, World!
*/
app.get('/', (req, res) => {
res.status(200).json({ message: 'Hello, World!' });
});
Security
The API supports bearer token authentication for secure endpoints. The security schema is defined as follows:
const swaggerDefinition = {
openapi: '3.0.0',
info: {
title: 'Bleu.js API',
version: '1.0.0',
description: 'Documentation for the Bleu.js API',
},
servers: [
{
url: 'http://localhost:3003',
},
],
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
},
},
},
security: [
{
bearerAuth: [],
},
],
};
Running Tests
cd eggs-generator
pnpm run start
bleujs-utils Package (Version 1.0.1)
The bleujs-util
package provides essential utility functions that are part of the Bleu.js framework. It simplifies the process of handling various coding challenges such as dependency management, code quality checks, and optimization.
Features
- Lightweight utility functions for common tasks.
- Dependency management utilities.
- Code optimization tools.
Installation
You can install the bleujs-utils package via pip
or pnpm
or npm
:
Using pip:
pip install bleujs-utils
Using pnpm:
pnpm install bleujs-utils
Using npm:
npm install bleujs-utils
Usage
Example 1: General Utility Function
from bleujs_utils import some_utility_function
result = some_utility_function(input_data)
print(result)
Example 2: Helper Functions for AI Integration
from bleujs_utils import ai_query
response = ai_query('What is the weather today?')
print(response)
Use Cases
- AI Query Tools: Provides helper functions for querying AI models, managing requests, and handling responses.
- Company Search: Utilities for fuzzy searching company names, perfect for customer service applications like HelloBlue.
- Error Handling: Custom logging and debugging utilities designed to streamline development and troubleshooting.
Example 3: CLI Tool
bleujs-utils-cli --help
Here’s how you can use the bleujs-utils
package in your project:
const { optimizeCode, manageDependencies } = require('bleujs-utils');
// Optimize code
const code = "const x = 1; console.log( x);";
const optimizedCode = optimizeCode(code);
console.log('Optimized Code:', optimizedCode);
// Manage dependencies
const dependencies = ['express', 'body-parser'];
manageDependencies(dependencies);
Optimizing Code
The optimizeCode
function cleans up and formats code for better readability and performance.
const { optimizeCode } = require('bleujs-utils');
const code = "const x = 1; console.log( x);";
const optimizedCode = optimizeCode(code);
console.log(optimizedCode);
Managing Dependencies
The manageDependencies
function helps you keep track of and manage your project dependencies efficiently.
const { manageDependencies } = require('bleujs-utils');
const dependencies = ['express', 'mongoose'];
manageDependencies(dependencies);
Package Information
- Package Name:
bleujs-utils
- Version: 1.0.1
- License: MIT
You can view the package on PyPI: bleujs-utils on PyPI
License
Bleu.js is licensed under the MIT License
Author
Pejman Haghighatnia