@devilsdev/rag-pipeline-utils 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codecov.yml +21 -0
- package/.dockerignore +14 -14
- package/.eslintignore +5 -0
- package/.eslintrc.json +21 -0
- package/.github/workflows/ci.yml +64 -42
- package/.husky/pre-commit +5 -0
- package/CHANGELOG.md +46 -0
- package/Dockerfile +22 -22
- package/LICENSE +674 -674
- package/README.md +117 -116
- package/__tests__/fixtures/.ragrc.json +8 -0
- package/__tests__/fixtures/invalid-ragrc.json +4 -0
- package/__tests__/fixtures/sample-eval-dataset.json +14 -14
- package/__tests__/fixtures/sample.pdf +1 -0
- package/__tests__/fixtures/src/mocks/openai-embedder.js +16 -0
- package/__tests__/fixtures/src/mocks/openai-llm.js +9 -0
- package/__tests__/fixtures/src/mocks/pdf-loader.js +17 -0
- package/__tests__/fixtures/src/mocks/pinecone-retriever.js +26 -0
- package/__tests__/fixtures/valid-ragrc.json +16 -0
- package/__tests__/integration/cli/config-flow.test.js +98 -44
- package/__tests__/integration/config/load-config.test.js +67 -52
- package/__tests__/unit/config/validate-schema.test.js +121 -0
- package/__tests__/unit/core/plugin-registry.test.js +55 -55
- package/__tests__/unit/reranker/llm-reranker.test.js +18 -42
- package/__tests__/unit/reranker/reranker.enriched.test.js +19 -0
- package/__tests__/unit/reranker/reranker.fallback.test.js +15 -0
- package/__tests__/unit/reranker/reranker.snapshot.test.js +15 -17
- package/__tests__/unit/reranker/reranker.structured-output.test.js +17 -0
- package/bin/cli.js +62 -168
- package/docs-site/docs/Architecture.md +76 -76
- package/docs-site/docs/CLI.md +69 -69
- package/docs-site/docs/Evaluation.md +61 -61
- package/docs-site/docs/FAQ.md +50 -50
- package/docs-site/docs/Plugins.md +61 -61
- package/docs-site/docs/Usage.md +72 -72
- package/jest.config.js +20 -13
- package/package.json +20 -3
- package/plugin.config.json +14 -0
- package/public/src/App.jsx +57 -57
- package/release.config.js +36 -23
- package/scripts/banner-injector.js +89 -0
- package/scripts/ci-runner.js +51 -0
- package/scripts/repair-fixtures.js +30 -0
- package/scripts/setup.js +31 -0
- package/scripts/test-global-setup.js +18 -0
- package/scripts/verify-fixture-mocks.js +45 -0
- package/scripts/verify-fixtures.js +36 -0
- package/server.js +31 -31
- package/src/config/load-config.js +33 -35
- package/src/config/load-plugin-config.js +56 -0
- package/src/config/validate-plugin-schema.js +28 -0
- package/src/config/validate-schema.js +107 -49
- package/src/core/create-pipeline.js +96 -82
- package/src/core/plugin-contracts.js +21 -0
- package/src/core/plugin-registry.js +48 -61
- package/src/dag/dag-engine.js +69 -69
- package/src/evaluate/evaluator.js +44 -44
- package/src/evaluate/scoring.js +73 -73
- package/src/loader/csv-loader.js +30 -30
- package/src/loader/directory-loader.js +37 -37
- package/src/loader/html-loader.js +57 -57
- package/src/loader/markdown-loader.js +58 -58
- package/src/mocks/openai-embedder.js +30 -0
- package/src/mocks/openai-llm.js +18 -0
- package/src/mocks/pdf-loader.js +17 -0
- package/src/mocks/pinecone-retriever.js +25 -0
- package/src/reranker/llm-reranker.js +34 -49
- package/src/utils/ci/diagnostic-reporter.js +36 -0
- package/src/utils/logger.js +29 -29
- package/src/utils/retry.js +42 -42
- package/src/utils/validate-plugin-contract.js +36 -0
- package/.github/workflows/release.yml +0 -21
package/.codecov.yml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# .codecov.yml
|
|
2
|
+
|
|
3
|
+
codecov:
|
|
4
|
+
notify:
|
|
5
|
+
after_n_builds: 1
|
|
6
|
+
|
|
7
|
+
coverage:
|
|
8
|
+
status:
|
|
9
|
+
project:
|
|
10
|
+
default:
|
|
11
|
+
target: 90%
|
|
12
|
+
threshold: 5%
|
|
13
|
+
patch:
|
|
14
|
+
default:
|
|
15
|
+
target: 90%
|
|
16
|
+
threshold: 5%
|
|
17
|
+
|
|
18
|
+
comment:
|
|
19
|
+
layout: "reach, diff, flags, files"
|
|
20
|
+
behavior: default
|
|
21
|
+
require_changes: false
|
package/.dockerignore
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# Ignore test files, fixtures, and local config
|
|
2
|
-
__tests__/
|
|
3
|
-
coverage/
|
|
4
|
-
.env
|
|
5
|
-
.env.*
|
|
6
|
-
node_modules/
|
|
7
|
-
.dockerignore
|
|
8
|
-
.git
|
|
9
|
-
.gitignore
|
|
10
|
-
.vscode
|
|
11
|
-
*.log
|
|
12
|
-
*.md
|
|
13
|
-
/public/
|
|
14
|
-
/docs-site/
|
|
1
|
+
# Ignore test files, fixtures, and local config
|
|
2
|
+
__tests__/
|
|
3
|
+
coverage/
|
|
4
|
+
.env
|
|
5
|
+
.env.*
|
|
6
|
+
node_modules/
|
|
7
|
+
.dockerignore
|
|
8
|
+
.git
|
|
9
|
+
.gitignore
|
|
10
|
+
.vscode
|
|
11
|
+
*.log
|
|
12
|
+
*.md
|
|
13
|
+
/public/
|
|
14
|
+
/docs-site/
|
package/.eslintignore
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es2022": true,
|
|
4
|
+
"node": true,
|
|
5
|
+
"jest": true
|
|
6
|
+
},
|
|
7
|
+
"extends": [
|
|
8
|
+
"eslint:recommended"
|
|
9
|
+
],
|
|
10
|
+
"parserOptions": {
|
|
11
|
+
"ecmaVersion": "latest",
|
|
12
|
+
"sourceType": "module"
|
|
13
|
+
},
|
|
14
|
+
"rules": {
|
|
15
|
+
"no-unused-vars": "warn",
|
|
16
|
+
"no-console": "off",
|
|
17
|
+
"semi": ["error", "always"],
|
|
18
|
+
"quotes": ["error", "single"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -1,42 +1,64 @@
|
|
|
1
|
-
# .github/workflows/ci.yml
|
|
2
|
-
# Version: 0.1.0
|
|
3
|
-
# Description: GitHub Actions CI pipeline for lint, test, and coverage
|
|
4
|
-
# Author: Ali Kahwaji
|
|
5
|
-
|
|
6
|
-
name: CI
|
|
7
|
-
|
|
8
|
-
on:
|
|
9
|
-
push:
|
|
10
|
-
branches:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- name:
|
|
23
|
-
uses: actions/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
# .github/workflows/ci.yml
|
|
2
|
+
# Version: 0.1.0
|
|
3
|
+
# Description: GitHub Actions CI pipeline for lint, test, and coverage
|
|
4
|
+
# Author: Ali Kahwaji
|
|
5
|
+
|
|
6
|
+
name: CI & Release
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
pull_request:
|
|
13
|
+
branches:
|
|
14
|
+
- main
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build-test-release:
|
|
18
|
+
name: Lint, Test, and Release
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: ⬇️ Checkout code
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: 🟢 Setup Node.js
|
|
26
|
+
uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: 20
|
|
29
|
+
cache: 'npm'
|
|
30
|
+
registry-url: 'https://registry.npmjs.org/'
|
|
31
|
+
|
|
32
|
+
- name: 📦 Install dependencies
|
|
33
|
+
run: npm ci
|
|
34
|
+
|
|
35
|
+
- name: 🧹 Lint
|
|
36
|
+
run: npm run lint
|
|
37
|
+
|
|
38
|
+
- name: ✅ Run tests with coverage
|
|
39
|
+
run: npm test
|
|
40
|
+
|
|
41
|
+
- name: 🚀 Semantic Release
|
|
42
|
+
env:
|
|
43
|
+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
44
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
45
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 👈 critical for npm publi
|
|
46
|
+
run: npx semantic-release
|
|
47
|
+
|
|
48
|
+
- name: 🧪 Run Tests with Coverage
|
|
49
|
+
run: npm test
|
|
50
|
+
|
|
51
|
+
- name: Validate Fixtures
|
|
52
|
+
run: npm run validate-fixtures
|
|
53
|
+
|
|
54
|
+
- name: Lint code
|
|
55
|
+
run: npm run lint
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
- name: 📊 Upload coverage to Codecov
|
|
59
|
+
uses: codecov/codecov-action@v5
|
|
60
|
+
with:
|
|
61
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
62
|
+
slug: DevilsDev/rag-pipeline-utils
|
|
63
|
+
|
|
64
|
+
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
# [2.0.0](https://github.com/DevilsDev/rag-pipeline-utils/compare/v1.0.1...v2.0.0) (2025-04-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **ci:** correct .ragrc.json plugin paths and CLI test cwd to resolve plugin loading in CI ([911c23b](https://github.com/DevilsDev/rag-pipeline-utils/commit/911c23b1d3ddb9e2d938b37f4422a5d81995e97f))
|
|
9
|
+
* **ci:** resolve plugin path error in .ragrc.json for GitHub Actions compatibility ([affc739](https://github.com/DevilsDev/rag-pipeline-utils/commit/affc739d5c4ff2070b1a1ca0ccf3f9137d6cee5a))
|
|
10
|
+
* **ci:** resolve plugin path failures in .ragrc.json during CLI integration tests ([04b977b](https://github.com/DevilsDev/rag-pipeline-utils/commit/04b977b3b745fa3d3ab47c84b2aeee3285896068))
|
|
11
|
+
* **cli:** correct path to load-plugin-config.js after moving to /src/config ([f743498](https://github.com/DevilsDev/rag-pipeline-utils/commit/f743498ec32e03151eda9ba7fe5886bda8da792f))
|
|
12
|
+
* **config:** use default export when importing plugin registry ([ef8dce1](https://github.com/DevilsDev/rag-pipeline-utils/commit/ef8dce12bfab62bc9faec764198b98c0c356472e))
|
|
13
|
+
* **test:** ensure .ragrc.json copied to project root for CLI fallback in CI ([31bd2b8](https://github.com/DevilsDev/rag-pipeline-utils/commit/31bd2b844279fb0404056d9929e5f28f9127eb12))
|
|
14
|
+
* **tests:** define __dirname manually for ESM compatibility in CLI integration test ([18b8dad](https://github.com/DevilsDev/rag-pipeline-utils/commit/18b8dadabb852243dda2b78de048c71106a759fc))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **ci:** integrate full fixture validation, schema contracts, and CLI test flow ([2b57fe9](https://github.com/DevilsDev/rag-pipeline-utils/commit/2b57fe90e64a806815c1f66f5e2a745780270ce6))
|
|
20
|
+
* **cli:** dynamic plugin registration with config fallback and middleware injection ([cc24b7e](https://github.com/DevilsDev/rag-pipeline-utils/commit/cc24b7e74d0a2630eb1c6d2def69b370329dcc2b))
|
|
21
|
+
* **plugins:** enable dynamic plugin registration from JSON config ([d81d6d7](https://github.com/DevilsDev/rag-pipeline-utils/commit/d81d6d7d5f2d21b5a46b379b530c162ba9c30398))
|
|
22
|
+
* **testing:** integrate full fixture and validation setup for CLI + reranker ([ab96037](https://github.com/DevilsDev/rag-pipeline-utils/commit/ab9603765594e7718e2688b80797e1f5e8afe86f))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### BREAKING CHANGES
|
|
26
|
+
|
|
27
|
+
* **cli:** now requires named options for middleware injection; existing usage must be updated.
|
|
28
|
+
|
|
29
|
+
## [1.0.2] - 2025-04-15
|
|
30
|
+
### Fixed
|
|
31
|
+
- Corrected plugin path resolution in `.ragrc.json` fixture for CI compatibility.
|
|
32
|
+
- Resolved `ERR_MODULE_NOT_FOUND` during CLI integration tests in GitHub Actions.
|
|
33
|
+
- Ensured consistent module resolution across environments (Windows, Linux, CI).
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [1.0.1](https://github.com/DevilsDev/rag-pipeline-utils/compare/v1.0.0...v1.0.1) (2025-04-14)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **ci:** initialize release pipeline and scaffold changelog ([179b486](https://github.com/DevilsDev/rag-pipeline-utils/commit/179b486effb0751b8735a9f849825eb63930ad01))
|
|
42
|
+
* **tests:** add missing sample PDF fixture and pre-test setup script ([de8e2b2](https://github.com/DevilsDev/rag-pipeline-utils/commit/de8e2b2c19034b521fc5ae1cdebbe3884a2fd15f))
|
|
43
|
+
|
|
44
|
+
All notable changes to this project will be documented in this file.
|
|
45
|
+
|
|
46
|
+
The format is based on [Semantic Versioning](https://semver.org/), and this project uses [semantic-release](https://github.com/semantic-release/semantic-release) for automated versioning and changelog generation.
|
package/Dockerfile
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# Version: 0.1.0
|
|
2
|
-
# Path: /Dockerfile
|
|
3
|
-
# Description: Minimal Docker image for rag-pipeline CLI
|
|
4
|
-
# Author: Ali Kahwaji
|
|
5
|
-
|
|
6
|
-
FROM node:18-slim
|
|
7
|
-
|
|
8
|
-
# Create app directory
|
|
9
|
-
WORKDIR /app
|
|
10
|
-
|
|
11
|
-
# Copy package files and install deps
|
|
12
|
-
COPY package*.json ./
|
|
13
|
-
RUN npm ci --omit=dev
|
|
14
|
-
|
|
15
|
-
# Copy application source
|
|
16
|
-
COPY . .
|
|
17
|
-
|
|
18
|
-
# Set default entrypoint
|
|
19
|
-
ENTRYPOINT ["node", "./bin/cli.js"]
|
|
20
|
-
|
|
21
|
-
# Default help
|
|
22
|
-
CMD ["--help"]
|
|
1
|
+
# Version: 0.1.0
|
|
2
|
+
# Path: /Dockerfile
|
|
3
|
+
# Description: Minimal Docker image for rag-pipeline CLI
|
|
4
|
+
# Author: Ali Kahwaji
|
|
5
|
+
|
|
6
|
+
FROM node:18-slim
|
|
7
|
+
|
|
8
|
+
# Create app directory
|
|
9
|
+
WORKDIR /app
|
|
10
|
+
|
|
11
|
+
# Copy package files and install deps
|
|
12
|
+
COPY package*.json ./
|
|
13
|
+
RUN npm ci --omit=dev
|
|
14
|
+
|
|
15
|
+
# Copy application source
|
|
16
|
+
COPY . .
|
|
17
|
+
|
|
18
|
+
# Set default entrypoint
|
|
19
|
+
ENTRYPOINT ["node", "./bin/cli.js"]
|
|
20
|
+
|
|
21
|
+
# Default help
|
|
22
|
+
CMD ["--help"]
|