diff --git a/.gitignore b/.gitignore index cc7bf6bcd..fd2c8c696 100644 --- a/.gitignore +++ b/.gitignore @@ -163,5 +163,13 @@ cython_debug/ #.idea/ .aider* /js/common/node_modules/ +/node_modules/ *.xml *.pem + +# Ruff cache +.ruff_cache/ + +# IDE settings +.idea/ +.vscode/ diff --git a/README.md b/README.md index 65b94bd22..7f81fe7db 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,14 @@ Here's the projects that are part of the CodeFlash MonoRepo: - CodeFlash NodeJS CF API - /js/cf-api - CodeFlash Webapp - /js/cf-webapp +# Project Setup + +## Prerequisites + +- **Node.js and npm**: Ensure Node.js is installed and npm is set up for installation of pre-commit hook(Lefthook). +- **Python and Mamba**: Ensure Python is installed and Mamba is set up. + +post clone run `npm install` to install all the dependencies at root level. ## Glossary ### Optimization diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 000000000..54ec471cd --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,14 @@ +pre-commit: + parallel: true + commands: + secret-scan: + runner: "node" + glob: "*" + exclude: "node_modules/**|venv/**|.venv/**|__pycache__/**|dist/**|build/**" + command: "./node_modules/.bin/secretlint {staged_files} --maskSecrets --config ./secretlint.config.js" + + js-lint: + runner: "node" + glob: "*.js" + exclude: "node_modules/**|build/**|dist/**" + command: "./node_modules/.bin/eslint {staged_files} --ignore-path .gitignore" diff --git a/package.json b/package.json new file mode 100644 index 000000000..14724c867 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "codeflashai", + "version": "1.0.0", + "description": "Here's the projects that are part of the CodeFlash MonoRepo:", + "main": "index.js", + "directories": { + "doc": "docs" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "prepare": "lefthook install", + "secretlint": "secretlint \"**/*\" --maskSecrets --config ./secretlint.config.js --ignore \"**/node_modules/**\" \"**/venv/**\" \"**/.venv/**\" \"**/__pycache__/**\"" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@evilmartians/lefthook": "^1.8.2", + "@secretlint/secretlint-rule-preset-recommend": "^9.0.0", + "eslint": "^9.14.0", + "secretlint": "^9.0.0" + } +} diff --git a/secretlint.config.js b/secretlint.config.js new file mode 100644 index 000000000..3ebbe4fbe --- /dev/null +++ b/secretlint.config.js @@ -0,0 +1,7 @@ +module.exports = { + rules: [ + { + id: "@secretlint/secretlint-rule-preset-recommend", + }, + ], +};