@devilsdev/rag-pipeline-utils 2.1.5 → 2.1.8
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/LICENSE +674 -674
- package/README.md +395 -179
- package/bin/cli.js +14 -62
- package/contracts/embedder-contract.json +52 -0
- package/contracts/llm-contract.json +36 -0
- package/contracts/loader-contract.json +43 -0
- package/contracts/retriever-contract.json +68 -0
- package/dist/index.cjs +67 -0
- package/dist/index.mjs +51 -0
- package/package.json +108 -22
- package/.codecov.yml +0 -21
- package/.dockerignore +0 -14
- package/.eslintignore +0 -5
- package/.eslintrc.json +0 -28
- package/.github/PROJECT_ROADMAP.md +0 -102
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -8
- package/.github/release-template.md +0 -20
- package/.github/workflows/changelog-auto-commit.yml +0 -37
- package/.github/workflows/ci.yml +0 -53
- package/.github/workflows/docs-ci.yml +0 -46
- package/.github/workflows/docs-deploy.yml +0 -55
- package/.github/workflows/enforce-release-review.yml +0 -47
- package/.github/workflows/publish-release-blog.yml +0 -47
- package/.github/workflows/release-sync.yml +0 -50
- package/.github/workflows/roadmap-label-sync.yml +0 -35
- package/.github/workflows/roadmap-labels.yml +0 -67
- package/.github/workflows/roadmap-sync.yml +0 -44
- package/.github/workflows/sync-roadmap.yml +0 -62
- package/.husky/pre-commit +0 -6
- package/CHANGELOG.md +0 -97
- package/Dockerfile +0 -22
- package/Use-Cases.md +0 -134
- package/__tests__/fixtures/.ragrc.json +0 -8
- package/__tests__/fixtures/invalid-ragrc.json +0 -4
- package/__tests__/fixtures/sample-eval-dataset.json +0 -15
- package/__tests__/fixtures/sample.pdf +0 -1
- package/__tests__/fixtures/src/mocks/openai-embedder.js +0 -16
- package/__tests__/fixtures/src/mocks/openai-llm.js +0 -9
- package/__tests__/fixtures/src/mocks/pdf-loader.js +0 -17
- package/__tests__/fixtures/src/mocks/pinecone-retriever.js +0 -26
- package/__tests__/fixtures/valid-ragrc.json +0 -16
- package/__tests__/integration/cli/config-flow.test.js +0 -98
- package/__tests__/integration/config/load-config.test.js +0 -67
- package/__tests__/scripts/ensure-roadmap-labels.test.js +0 -64
- package/__tests__/unit/config/validate-schema.test.js +0 -121
- package/__tests__/unit/core/plugin-registry.test.js +0 -55
- package/__tests__/unit/reranker/__snapshots__/reranker.snapshot.test.js.snap +0 -15
- package/__tests__/unit/reranker/llm-reranker.test.js +0 -18
- package/__tests__/unit/reranker/reranker.enriched.test.js +0 -19
- package/__tests__/unit/reranker/reranker.fallback.test.js +0 -15
- package/__tests__/unit/reranker/reranker.snapshot.test.js +0 -15
- package/__tests__/unit/reranker/reranker.structured-output.test.js +0 -17
- package/codecov +0 -0
- package/codecov.SHA256SUM +0 -1
- package/codecov.SHA256SUM.sig +0 -16
- package/docs-site/README.md +0 -41
- package/docs-site/blog/2025-04-18-architecture-overview.md +0 -16
- package/docs-site/blog/2025-04-18-release-v2.1.1.md +0 -13
- package/docs-site/blog/2025-04-19-prompt-engineering-best-practices.md +0 -16
- package/docs-site/blog/2025-04-20-image-showcase.md +0 -14
- package/docs-site/blog/2025-04-20-release-2.1.1.md +0 -21
- package/docs-site/blog/2025-04-21-release-v2.1.3.md +0 -13
- package/docs-site/blog/2025-04-21-release-v2.1.4.md +0 -13
- package/docs-site/blog/authors.yml +0 -5
- package/docs-site/blog/tags.yml +0 -60
- package/docs-site/docs/Architecture.md +0 -76
- package/docs-site/docs/CLI.md +0 -69
- package/docs-site/docs/Evaluation.md +0 -61
- package/docs-site/docs/FAQ.md +0 -50
- package/docs-site/docs/Introduction.md +0 -58
- package/docs-site/docs/Plugins.md +0 -61
- package/docs-site/docs/Tutorials.md +0 -106
- package/docs-site/docs/Usage.md +0 -72
- package/docs-site/docs/Use-Cases.md +0 -77
- package/docs-site/docs/intro.mdx +0 -6
- package/docs-site/docusaurus.config.js +0 -88
- package/docs-site/package-lock.json +0 -17914
- package/docs-site/package.json +0 -47
- package/docs-site/sidebars.js +0 -39
- package/docs-site/src/components/HomepageFeatures/index.js +0 -56
- package/docs-site/src/components/HomepageFeatures/index.module.css +0 -57
- package/docs-site/src/components/HomepageHeader/index.js +0 -46
- package/docs-site/src/components/HomepageHeader/index.module.css +0 -77
- package/docs-site/src/css/custom.css +0 -104
- package/docs-site/src/pages/index.js +0 -20
- package/docs-site/src/pages/index.module.css +0 -23
- package/docs-site/src/pages/markdown-page.md +0 -7
- package/docs-site/static/.nojekyll +0 -0
- package/docs-site/static/img/authors/ali.jpg +0 -0
- package/docs-site/static/img/hero.jpg +0 -0
- package/docs-site/static/img/logo.png +0 -0
- package/docs-site/static/img/logo.svg +0 -6
- package/docs-site/static/img/social-card.jpg +0 -0
- package/jest.config.js +0 -24
- package/plugin.config.json +0 -14
- package/public/index.html +0 -0
- package/public/results/sample-eval.json +0 -0
- package/public/src/App.jsx +0 -57
- package/release.config.js +0 -36
- package/scripts/banner-injector.js +0 -102
- package/scripts/ci-runner.js +0 -51
- package/scripts/close-done-roadmap-issues.js +0 -65
- package/scripts/create-roadmap-issues.js +0 -47
- package/scripts/ensure-roadmap-labels.js +0 -73
- package/scripts/fix-mdx-blog-imports.js +0 -50
- package/scripts/fix-mdx-image-imports.js +0 -27
- package/scripts/generate-release-note.js +0 -40
- package/scripts/label-roadmap-issues.js +0 -125
- package/scripts/manual-test-checklist.md +0 -90
- package/scripts/repair-fixtures.js +0 -30
- package/scripts/setup.js +0 -31
- package/scripts/sync-labels.js +0 -71
- package/scripts/sync-roadmap-labels.js +0 -21
- package/scripts/tag-release.js +0 -64
- package/scripts/test-global-setup.js +0 -18
- package/scripts/validate-changelog-version.js +0 -48
- package/scripts/verify-fixture-mocks.js +0 -45
- package/scripts/verify-fixtures.js +0 -36
- package/server.js +0 -31
- package/src/config/load-config.js +0 -33
- package/src/config/load-plugin-config.js +0 -56
- package/src/config/validate-plugin-schema.js +0 -28
- package/src/config/validate-schema.js +0 -107
- package/src/core/create-pipeline.js +0 -96
- package/src/core/plugin-contracts.js +0 -21
- package/src/core/plugin-registry.js +0 -48
- package/src/dag/dag-engine.js +0 -70
- package/src/evaluate/evaluator.js +0 -44
- package/src/evaluate/scoring.js +0 -74
- package/src/loader/csv-loader.js +0 -30
- package/src/loader/directory-loader.js +0 -38
- package/src/loader/html-loader.js +0 -57
- package/src/loader/markdown-loader.js +0 -58
- package/src/mocks/openai-embedder.js +0 -30
- package/src/mocks/openai-llm.js +0 -18
- package/src/mocks/pdf-loader.js +0 -17
- package/src/mocks/pinecone-retriever.js +0 -25
- package/src/reranker/llm-reranker.js +0 -34
- package/src/utils/ci/diagnostic-reporter.js +0 -36
- package/src/utils/logger.js +0 -29
- package/src/utils/retry.js +0 -42
- package/src/utils/validate-plugin-contract.js +0 -36
package/CHANGELOG.md
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [2.1.5](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.4...v2.1.5) (2025-04-22)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Bug Fixes
|
|
7
|
-
|
|
8
|
-
* **scripts:** prevent null status crash in roadmap issue closer ([89d5a0b](https://github.com/DevilsDev/rag-pipeline-utils/commit/89d5a0bc4cac554975974558b97974297816f169))
|
|
9
|
-
|
|
10
|
-
## [2.1.4](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.3...v2.1.4) (2025-04-21)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* update CI and deployment workflows for docs build and GitHub Pages deployment ([11739ba](https://github.com/DevilsDev/rag-pipeline-utils/commit/11739ba222669e359232807e461bc84d68d913cb))
|
|
16
|
-
* update CI and deployment workflows for docs build and GitHub Pages deployment ([8de276f](https://github.com/DevilsDev/rag-pipeline-utils/commit/8de276f8cb6c91a291322783dc944b0f4799974f))
|
|
17
|
-
|
|
18
|
-
## [2.1.3](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.2...v2.1.3) (2025-04-21)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Bug Fixes
|
|
22
|
-
|
|
23
|
-
* Refactor CI workflows for better separation of concerns ([ef2954b](https://github.com/DevilsDev/rag-pipeline-utils/commit/ef2954b9161a73367cafa04d29f2e56164e4b1c0))
|
|
24
|
-
|
|
25
|
-
## [2.1.2](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.1...v2.1.2) (2025-04-21)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Bug Fixes
|
|
29
|
-
|
|
30
|
-
* resolve build/test errors, update jest configuration, and ensure compatibility with ECMAScript modules ([e6259f9](https://github.com/DevilsDev/rag-pipeline-utils/commit/e6259f924f38da66f9fc9cb7c01a8d6665bf5cbd))
|
|
31
|
-
|
|
32
|
-
## [2.1.1](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.0...v2.1.1) (2025-04-18)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Bug Fixes
|
|
36
|
-
|
|
37
|
-
* **blog:** convert tags.yml to valid object format for Docusaurus v3 ([6a7a9bf](https://github.com/DevilsDev/rag-pipeline-utils/commit/6a7a9bfa3501d30529b21e36fa51ab47d151f7a3))
|
|
38
|
-
* **blog:** convert tags.yml to valid object format for Docusaurus v3 ([fa2fff9](https://github.com/DevilsDev/rag-pipeline-utils/commit/fa2fff969dc242e66d92a80b4aa2ff8e07f9fd0f))
|
|
39
|
-
|
|
40
|
-
## [2.1.0] - 2025-04-18 (2025-04-18)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Features
|
|
44
|
-
|
|
45
|
-
* **docs-site:** add Storybook integration with BlogCard + LQIP image automation ([80965b8](https://github.com/DevilsDev/rag-pipeline-utils/commit/80965b8ef1d26372852ee0f39b56a73f337e0cea))
|
|
46
|
-
|
|
47
|
-
## [2.0.1](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.0.0...v2.0.1) (2025-04-17)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Bug Fixes
|
|
51
|
-
|
|
52
|
-
* add @docusaurus/preset-classic to enable CI builds ([ed5e771](https://github.com/DevilsDev/rag-pipeline-utils/commit/ed5e771f919face4693a6a7abfed4cf0fe1325ca))
|
|
53
|
-
|
|
54
|
-
## [2.0.0] - 2025-04-17 (2025-04-17)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
### Bug Fixes
|
|
58
|
-
|
|
59
|
-
* **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))
|
|
60
|
-
* **ci:** resolve plugin path error in .ragrc.json for GitHub Actions compatibility ([affc739](https://github.com/DevilsDev/rag-pipeline-utils/commit/affc739d5c4ff2070b1a1ca0ccf3f9137d6cee5a))
|
|
61
|
-
* **ci:** resolve plugin path failures in .ragrc.json during CLI integration tests ([04b977b](https://github.com/DevilsDev/rag-pipeline-utils/commit/04b977b3b745fa3d3ab47c84b2aeee3285896068))
|
|
62
|
-
* **cli:** correct path to load-plugin-config.js after moving to /src/config ([f743498](https://github.com/DevilsDev/rag-pipeline-utils/commit/f743498ec32e03151eda9ba7fe5886bda8da792f))
|
|
63
|
-
* **config:** use default export when importing plugin registry ([ef8dce1](https://github.com/DevilsDev/rag-pipeline-utils/commit/ef8dce12bfab62bc9faec764198b98c0c356472e))
|
|
64
|
-
* **test:** ensure .ragrc.json copied to project root for CLI fallback in CI ([31bd2b8](https://github.com/DevilsDev/rag-pipeline-utils/commit/31bd2b844279fb0404056d9929e5f28f9127eb12))
|
|
65
|
-
* **tests:** define __dirname manually for ESM compatibility in CLI integration test ([18b8dad](https://github.com/DevilsDev/rag-pipeline-utils/commit/18b8dadabb852243dda2b78de048c71106a759fc))
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
### Features
|
|
69
|
-
|
|
70
|
-
* **ci:** integrate full fixture validation, schema contracts, and CLI test flow ([2b57fe9](https://github.com/DevilsDev/rag-pipeline-utils/commit/2b57fe90e64a806815c1f66f5e2a745780270ce6))
|
|
71
|
-
* **cli:** dynamic plugin registration with config fallback and middleware injection ([cc24b7e](https://github.com/DevilsDev/rag-pipeline-utils/commit/cc24b7e74d0a2630eb1c6d2def69b370329dcc2b))
|
|
72
|
-
* **plugins:** enable dynamic plugin registration from JSON config ([d81d6d7](https://github.com/DevilsDev/rag-pipeline-utils/commit/d81d6d7d5f2d21b5a46b379b530c162ba9c30398))
|
|
73
|
-
* **testing:** integrate full fixture and validation setup for CLI + reranker ([ab96037](https://github.com/DevilsDev/rag-pipeline-utils/commit/ab9603765594e7718e2688b80797e1f5e8afe86f))
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### BREAKING CHANGES
|
|
77
|
-
|
|
78
|
-
* **cli:** now requires named options for middleware injection; existing usage must be updated.
|
|
79
|
-
|
|
80
|
-
## [1.0.2] - 2025-04-15
|
|
81
|
-
### Fixed
|
|
82
|
-
- Corrected plugin path resolution in `.ragrc.json` fixture for CI compatibility.
|
|
83
|
-
- Resolved `ERR_MODULE_NOT_FOUND` during CLI integration tests in GitHub Actions.
|
|
84
|
-
- Ensured consistent module resolution across environments (Windows, Linux, CI).
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
## [1.0.1](https://github.com/DevilsDev/rag-pipeline-utils/compare/v1.0.0...v1.0.1) (2025-04-14)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
### Bug Fixes
|
|
91
|
-
|
|
92
|
-
* **ci:** initialize release pipeline and scaffold changelog ([179b486](https://github.com/DevilsDev/rag-pipeline-utils/commit/179b486effb0751b8735a9f849825eb63930ad01))
|
|
93
|
-
* **tests:** add missing sample PDF fixture and pre-test setup script ([de8e2b2](https://github.com/DevilsDev/rag-pipeline-utils/commit/de8e2b2c19034b521fc5ae1cdebbe3884a2fd15f))
|
|
94
|
-
|
|
95
|
-
All notable changes to this project will be documented in this file.
|
|
96
|
-
|
|
97
|
-
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
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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"]
|
package/Use-Cases.md
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# RAG Pipeline Utils — Developer-Focused Use Cases
|
|
2
|
-
|
|
3
|
-
> Modular, composable, and CI-verified RAG orchestration for modern AI applications.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Use Case 1: Pluggable Local RAG Stack for Prototyping
|
|
8
|
-
|
|
9
|
-
**Problem:** Traditional RAG tools force tight vendor dependencies.
|
|
10
|
-
|
|
11
|
-
**Solution:** Use mockable local plugin implementations to simulate loaders, embedders, retrievers, and LLMs.
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install @devilsdev/rag-pipeline-utils
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
// cli.js or app.js
|
|
19
|
-
import { PluginRegistry } from './src/core/plugin-registry.js';
|
|
20
|
-
import { loadRagConfig } from './src/config/load-config.js';
|
|
21
|
-
|
|
22
|
-
const config = loadRagConfig('.ragrc.json');
|
|
23
|
-
const loader = PluginRegistry.getPlugin('loader', 'pdf');
|
|
24
|
-
const docs = loader.load('./test.pdf');
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Benefits**
|
|
28
|
-
- Local plugin mocks with expected method contracts
|
|
29
|
-
- Reusable plugin templates (`pdf-loader.js`, `openai-embedder.js`)
|
|
30
|
-
- Dev-first DX: debug, snapshot, iterate without cloud costs
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Use Case 2: Declarative CLI RAG Pipelines (CI-Ready)
|
|
35
|
-
|
|
36
|
-
**Problem:** Hardcoded pipeline steps can't be validated or changed by non-engineers.
|
|
37
|
-
|
|
38
|
-
**Solution:** Define `.ragrc.json` once and reuse across environments.
|
|
39
|
-
|
|
40
|
-
```json
|
|
41
|
-
{
|
|
42
|
-
"loader": { "pdf": "./src/mocks/pdf-loader.js" },
|
|
43
|
-
"embedder": { "openai": "./src/mocks/openai-embedder.js" },
|
|
44
|
-
"retriever": { "pinecone": "./src/mocks/pinecone-retriever.js" },
|
|
45
|
-
"llm": { "openai": "./src/mocks/openai-llm.js" },
|
|
46
|
-
"namespace": "docs-poc",
|
|
47
|
-
"pipeline": ["loader", "embedder", "retriever"]
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
node ./bin/cli.js ingest ./docs/whitepaper.pdf
|
|
53
|
-
node ./bin/cli.js query "What’s the goal of this architecture?"
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Benefits**
|
|
57
|
-
- Teams can standardize pipelines in source control
|
|
58
|
-
- Tests fail fast if structure or mocks drift
|
|
59
|
-
- Non-devs can operate pipelines via CLI
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## Use Case 3: Mock-First TDD for Plugin Development
|
|
64
|
-
|
|
65
|
-
**Problem:** LLM, vector, and loader logic are often developed without tests.
|
|
66
|
-
|
|
67
|
-
**Solution:** Define contract-compliant mocks and CI-validate their structure before connecting to APIs.
|
|
68
|
-
|
|
69
|
-
```js
|
|
70
|
-
export default class CustomEmbedder {
|
|
71
|
-
embed(docs) { return docs.map(...); }
|
|
72
|
-
embedQuery(q) { return [...]; }
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Run full contract verification:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
npm run ci
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
**Benefits**
|
|
83
|
-
- Every plugin is CI-verified for method presence
|
|
84
|
-
- Shared contracts enforce required interfaces
|
|
85
|
-
- Onboarding new devs? Just follow `pluginContracts.js`
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Use Case 4: Vendor-Neutral AI Data Pipelines
|
|
90
|
-
|
|
91
|
-
**Problem:** Every RAG stack is locked to OpenAI + Pinecone + Langchain.
|
|
92
|
-
|
|
93
|
-
**Solution:** Use this project to mix, match, or mock vector/LLM pairs:
|
|
94
|
-
|
|
95
|
-
```js
|
|
96
|
-
"retriever": { "localstore": "./src/plugins/local-retriever.js" },
|
|
97
|
-
"llm": { "cohere": "./src/plugins/cohere-llm.js" }
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**Benefits**
|
|
101
|
-
- Run multiple RAG pipelines in parallel (A/B testing, evals)
|
|
102
|
-
- Lower infra cost with offline/local plugin support
|
|
103
|
-
- Integrate with tools outside Langchain ecosystem
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## 🛠 Use Case 5: Plugin Engineering with Guardrails
|
|
108
|
-
|
|
109
|
-
**Problem:** Complex plugin systems break silently.
|
|
110
|
-
|
|
111
|
-
**Solution:** This framework has:
|
|
112
|
-
- Plugin method contract enforcement
|
|
113
|
-
- CLI test runner (`scripts/ci-runner.js`)
|
|
114
|
-
- Auto repair tool (`scripts/repair-fixtures.js`)
|
|
115
|
-
|
|
116
|
-
**DX Boost**
|
|
117
|
-
- One-line plugin repairs
|
|
118
|
-
- Validated schema structure
|
|
119
|
-
- Aligned to real-world developer workflows
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## Cross References
|
|
124
|
-
|
|
125
|
-
- [README](./README.md) — Project overview, architecture, CLI and configuration details
|
|
126
|
-
- [pluginContracts.js](./src/core/plugin-contracts.js) — Interface contracts for loader, embedder, retriever, LLM
|
|
127
|
-
- [diagnostic-reporter.js](./src/utils/ci/diagnostic-reporter.js) — CI error helper
|
|
128
|
-
- [repair-fixtures.js](./scripts/repair-fixtures.js) — Auto-regeneration of mocks
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## License
|
|
133
|
-
|
|
134
|
-
Licensed under the **GPL-3.0 License** — see [LICENSE](./LICENSE) for full terms.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"loader": { "pdf": "./src/mocks/pdf-loader.js" },
|
|
3
|
-
"embedder": { "openai": "./src/mocks/openai-embedder.js" },
|
|
4
|
-
"retriever": { "pinecone": "./src/mocks/pinecone-retriever.js" },
|
|
5
|
-
"llm": { "openai": "./src/mocks/openai-llm.js" },
|
|
6
|
-
"namespace": "cli-config-test",
|
|
7
|
-
"pipeline": ["loader", "embedder", "retriever"]
|
|
8
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"prompt": "What is a vector database?",
|
|
4
|
-
"expected": "A vector database is a system optimized for storing and retrieving data represented as vectors, often used in similarity search."
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
"prompt": "Explain what chunking means in RAG.",
|
|
8
|
-
"expected": "Chunking is the process of splitting documents into smaller, manageable pieces for embedding and retrieval in a RAG pipeline."
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"prompt": "What is the role of embedding in a RAG pipeline?",
|
|
12
|
-
"expected": "Embeddings convert text into numerical vector form so they can be compared in a vector database during retrieval."
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
%PDF-1.4\n%âãÏÓ\n1 0 obj\n<<>>\nendobj\nxref\n0 2\n0000000000 65535 f\n0000000010 00000 n\ntrailer\n<<>>\nstartxref\n9\n%%EOF
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock OpenAI Embedder Plugin
|
|
3
|
-
* Implements: embedder.embed(docs), embedder.embedQuery(query)
|
|
4
|
-
*/
|
|
5
|
-
export default class OpenAIEmbedder {
|
|
6
|
-
embed(documents) {
|
|
7
|
-
return documents.map(doc => ({
|
|
8
|
-
id: doc.id,
|
|
9
|
-
values: [0.1, 0.2, 0.3],
|
|
10
|
-
}));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
embedQuery(query) {
|
|
14
|
-
return [0.1, 0.2, 0.3];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock PDF Loader Plugin
|
|
3
|
-
* Implements: loader.load(filePath)
|
|
4
|
-
*/
|
|
5
|
-
export default class PdfLoader {
|
|
6
|
-
/**
|
|
7
|
-
* Loads a file and returns mock document chunks.
|
|
8
|
-
* @param {string} filePath
|
|
9
|
-
* @returns {Array<{ id: string, content: string }>}
|
|
10
|
-
*/
|
|
11
|
-
load(filePath) {
|
|
12
|
-
return [
|
|
13
|
-
{ id: 'doc1', content: `Loaded content from ${filePath}` },
|
|
14
|
-
{ id: 'doc2', content: 'Second document content' },
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock Pinecone Retriever Plugin
|
|
3
|
-
* Implements: retriever.store(vectors), retriever.search(queryVector)
|
|
4
|
-
*/
|
|
5
|
-
export default class PineconeRetriever {
|
|
6
|
-
constructor() {
|
|
7
|
-
this._store = [];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Stores embedded vectors.
|
|
12
|
-
* @param {Array<{ id: string, values: number[] }>} vectors
|
|
13
|
-
*/
|
|
14
|
-
store(vectors) {
|
|
15
|
-
this._store = vectors;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Searches mock memory and returns matching docs.
|
|
20
|
-
* @param {number[]} queryVector
|
|
21
|
-
* @returns {Array<{ id: string, score: number }>}
|
|
22
|
-
*/
|
|
23
|
-
search(queryVector) {
|
|
24
|
-
return this._store.map(v => ({ id: v.id, score: 0.99 }));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"loader": {
|
|
3
|
-
"pdf": "./src/mocks/pdf-loader.js"
|
|
4
|
-
},
|
|
5
|
-
"embedder": {
|
|
6
|
-
"openai": "./src/mocks/openai-embedder.js"
|
|
7
|
-
},
|
|
8
|
-
"retriever": {
|
|
9
|
-
"pinecone": "./src/mocks/pinecone-retriever.js"
|
|
10
|
-
},
|
|
11
|
-
"llm": {
|
|
12
|
-
"openai": "./src/mocks/openai-llm.js"
|
|
13
|
-
},
|
|
14
|
-
"namespace": "cli-config-test",
|
|
15
|
-
"pipeline": ["loader", "embedder", "retriever"]
|
|
16
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.1.0
|
|
3
|
-
* Description: Final CLI config fallback integration test with fixture mock copying and validation
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { execSync } from 'child_process';
|
|
8
|
-
import {
|
|
9
|
-
mkdirSync,
|
|
10
|
-
rmSync,
|
|
11
|
-
writeFileSync,
|
|
12
|
-
copyFileSync,
|
|
13
|
-
existsSync,
|
|
14
|
-
readdirSync,
|
|
15
|
-
readFileSync
|
|
16
|
-
} from 'fs';
|
|
17
|
-
import { join, resolve } from 'path';
|
|
18
|
-
import { fileURLToPath } from 'url';
|
|
19
|
-
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = resolve(__filename, '..');
|
|
22
|
-
|
|
23
|
-
const CLI_PATH = resolve('bin/cli.js');
|
|
24
|
-
const TEMP_TEST_DIR = resolve('__tests__/__temp__/cli-config-fallback');
|
|
25
|
-
const FIXTURE_CONFIG = join(TEMP_TEST_DIR, '.ragrc.json');
|
|
26
|
-
const FIXTURE_PDF = resolve('__tests__/fixtures/sample.pdf');
|
|
27
|
-
|
|
28
|
-
// Fixture sources
|
|
29
|
-
const FIXTURE_SRC = resolve('__tests__/fixtures/src/mocks');
|
|
30
|
-
const PDF_LOADER_SRC = join(FIXTURE_SRC, 'pdf-loader.js');
|
|
31
|
-
const EMBEDDER_SRC = join(FIXTURE_SRC, 'openai-embedder.js');
|
|
32
|
-
const RETRIEVER_SRC = join(FIXTURE_SRC, 'pinecone-retriever.js');
|
|
33
|
-
const LLM_SRC = join(FIXTURE_SRC, 'openai-llm.js');
|
|
34
|
-
|
|
35
|
-
const FIXTURE_CONFIG_OBJECT = {
|
|
36
|
-
loader: { pdf: './src/mocks/pdf-loader.js' },
|
|
37
|
-
embedder: { openai: './src/mocks/openai-embedder.js' },
|
|
38
|
-
retriever: { pinecone: './src/mocks/pinecone-retriever.js' },
|
|
39
|
-
llm: { openai: './src/mocks/openai-llm.js' },
|
|
40
|
-
namespace: 'cli-config-test',
|
|
41
|
-
pipeline: ['loader', 'embedder', 'retriever']
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
describe('CLI integration with .ragrc.json config fallback', () => {
|
|
45
|
-
beforeAll(() => {
|
|
46
|
-
rmSync(TEMP_TEST_DIR, { recursive: true, force: true });
|
|
47
|
-
mkdirSync(join(TEMP_TEST_DIR, 'src/mocks'), { recursive: true });
|
|
48
|
-
|
|
49
|
-
// Assert existence
|
|
50
|
-
[FIXTURE_PDF, PDF_LOADER_SRC, EMBEDDER_SRC, RETRIEVER_SRC, LLM_SRC].forEach(file => {
|
|
51
|
-
if (!existsSync(file)) throw new Error(`[FATAL] Missing required fixture: ${file}`);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// Copy fixture PDF
|
|
55
|
-
copyFileSync(FIXTURE_PDF, join(TEMP_TEST_DIR, 'sample.pdf'));
|
|
56
|
-
|
|
57
|
-
// Copy mock plugins into temp dir
|
|
58
|
-
copyFileSync(PDF_LOADER_SRC, join(TEMP_TEST_DIR, 'src/mocks/pdf-loader.js'));
|
|
59
|
-
copyFileSync(EMBEDDER_SRC, join(TEMP_TEST_DIR, 'src/mocks/openai-embedder.js'));
|
|
60
|
-
copyFileSync(RETRIEVER_SRC, join(TEMP_TEST_DIR, 'src/mocks/pinecone-retriever.js'));
|
|
61
|
-
copyFileSync(LLM_SRC, join(TEMP_TEST_DIR, 'src/mocks/openai-llm.js'));
|
|
62
|
-
|
|
63
|
-
// Write valid .ragrc.json
|
|
64
|
-
writeFileSync(FIXTURE_CONFIG, JSON.stringify(FIXTURE_CONFIG_OBJECT, null, 2));
|
|
65
|
-
|
|
66
|
-
console.debug('[DEBUG] .ragrc.json contents:\n', JSON.stringify(FIXTURE_CONFIG_OBJECT, null, 2));
|
|
67
|
-
console.debug('[SETUP] Temp dir:', TEMP_TEST_DIR);
|
|
68
|
-
console.debug('[SETUP] Contents:', readdirSync(TEMP_TEST_DIR));
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
afterAll(() => {
|
|
72
|
-
rmSync(TEMP_TEST_DIR, { recursive: true, force: true });
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test('validates plugin sections contain resolvable names', () => {
|
|
76
|
-
const config = JSON.parse(readFileSync(FIXTURE_CONFIG, 'utf-8'));
|
|
77
|
-
['loader', 'embedder', 'retriever', 'llm'].forEach(type => {
|
|
78
|
-
expect(typeof config[type]).toBe('object');
|
|
79
|
-
expect(Object.keys(config[type]).length).toBeGreaterThan(0);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('executes CLI ingest using config fallback', () => {
|
|
84
|
-
const result = execSync(`node ${CLI_PATH} ingest sample.pdf`, {
|
|
85
|
-
cwd: TEMP_TEST_DIR,
|
|
86
|
-
encoding: 'utf-8'
|
|
87
|
-
});
|
|
88
|
-
expect(result).toMatch(/Ingestion complete/);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('executes CLI query using config fallback', () => {
|
|
92
|
-
const result = execSync(`node ${CLI_PATH} query "What is this test about?"`, {
|
|
93
|
-
cwd: TEMP_TEST_DIR,
|
|
94
|
-
encoding: 'utf-8'
|
|
95
|
-
});
|
|
96
|
-
expect(result).toMatch(/Answer:/);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.1.1
|
|
3
|
-
* Description: Integration tests for loading and validating .ragrc.json via loadRagConfig()
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
* File: __tests__/integration/config/load-config.test.js
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs';
|
|
9
|
-
import { copyFileSync, mkdirSync, rmSync, existsSync } from 'fs';
|
|
10
|
-
import { join, resolve } from 'path';
|
|
11
|
-
import { fileURLToPath } from 'url';
|
|
12
|
-
import { loadRagConfig } from '../../../src/config/load-config.js';
|
|
13
|
-
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const __dirname = resolve(__filename, '..');
|
|
16
|
-
|
|
17
|
-
// Fixture paths
|
|
18
|
-
const FIXTURE_DIR = resolve(__dirname, '../../fixtures');
|
|
19
|
-
const VALID_FIXTURE = join(FIXTURE_DIR, 'valid-ragrc.json');
|
|
20
|
-
const INVALID_FIXTURE = join(FIXTURE_DIR, 'invalid-ragrc.json');
|
|
21
|
-
|
|
22
|
-
// Temp directory used during tests
|
|
23
|
-
const TEMP_DIR = resolve('__tests__', '__temp__', 'load-config');
|
|
24
|
-
const TEMP_CONFIG = join(TEMP_DIR, '.ragrc.json');
|
|
25
|
-
|
|
26
|
-
// Ensure fixtures are available before copying
|
|
27
|
-
function assertFixturesExist() {
|
|
28
|
-
const required = [VALID_FIXTURE, INVALID_FIXTURE];
|
|
29
|
-
required.forEach(file => {
|
|
30
|
-
if (!existsSync(file)) {
|
|
31
|
-
throw new Error(`❌ Required test fixture missing: ${file}`);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
describe('loadRagConfig()', () => {
|
|
37
|
-
beforeAll(() => {
|
|
38
|
-
rmSync(TEMP_DIR, { recursive: true, force: true });
|
|
39
|
-
mkdirSync(TEMP_DIR, { recursive: true });
|
|
40
|
-
|
|
41
|
-
assertFixturesExist();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
afterAll(() => {
|
|
45
|
-
rmSync(TEMP_DIR, { recursive: true, force: true });
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('loads a valid .ragrc.json config file successfully', () => {
|
|
49
|
-
copyFileSync(VALID_FIXTURE, TEMP_CONFIG);
|
|
50
|
-
|
|
51
|
-
const config = loadRagConfig(TEMP_CONFIG);
|
|
52
|
-
expect(config).toBeDefined();
|
|
53
|
-
expect(config.namespace).toBe('cli-config-test');
|
|
54
|
-
expect(config.loader?.pdf).toBe('./src/mocks/pdf-loader.js');
|
|
55
|
-
expect(config.pipeline).toEqual(expect.arrayContaining(['loader', 'embedder', 'retriever']));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('throws validation error for invalid .ragrc.json config', () => {
|
|
59
|
-
copyFileSync(INVALID_FIXTURE, TEMP_CONFIG);
|
|
60
|
-
expect(() => loadRagConfig(TEMP_CONFIG)).toThrow(/Config validation failed/);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('throws error if config file does not exist', () => {
|
|
64
|
-
const NON_EXISTENT = join(TEMP_DIR, 'missing.json');
|
|
65
|
-
expect(() => loadRagConfig(NON_EXISTENT)).toThrow(/Config file not found/);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 2.1.2
|
|
3
|
-
* Path: __tests__/scripts/ensure-roadmap-labels.test.js
|
|
4
|
-
* Description: Unit tests for roadmap label creation using ESM-compatible Jest syntax.
|
|
5
|
-
* Author: Ali Kahwaji
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { jest } from '@jest/globals';
|
|
9
|
-
|
|
10
|
-
jest.unstable_mockModule('octokit', () => ({
|
|
11
|
-
Octokit: jest.fn().mockImplementation(() => ({
|
|
12
|
-
rest: {
|
|
13
|
-
issues: {
|
|
14
|
-
listLabelsForRepo: mockListLabelsForRepo,
|
|
15
|
-
createLabel: mockCreateLabel
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}))
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
// ✅ Shared mocks outside import context
|
|
22
|
-
const mockCreateLabel = jest.fn();
|
|
23
|
-
const mockListLabelsForRepo = jest.fn();
|
|
24
|
-
|
|
25
|
-
let ensureRoadmapLabels;
|
|
26
|
-
let roadmapLabels;
|
|
27
|
-
|
|
28
|
-
beforeAll(async () => {
|
|
29
|
-
const imported = await import('../../scripts/ensure-roadmap-labels.js');
|
|
30
|
-
ensureRoadmapLabels = imported.ensureRoadmapLabels;
|
|
31
|
-
roadmapLabels = imported.roadmapLabels;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
mockCreateLabel.mockReset();
|
|
36
|
-
mockListLabelsForRepo.mockReset();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('ensureRoadmapLabels', () => {
|
|
40
|
-
it('creates all labels if none exist', async () => {
|
|
41
|
-
mockListLabelsForRepo.mockResolvedValue({ data: [] });
|
|
42
|
-
|
|
43
|
-
await ensureRoadmapLabels({ token: 'test-token', owner: 'ali', repo: 'rag-pipeline-utils' });
|
|
44
|
-
|
|
45
|
-
expect(mockCreateLabel).toHaveBeenCalledTimes(roadmapLabels.length);
|
|
46
|
-
for (const label of roadmapLabels) {
|
|
47
|
-
expect(mockCreateLabel).toHaveBeenCalledWith({
|
|
48
|
-
owner: 'ali',
|
|
49
|
-
repo: 'rag-pipeline-utils',
|
|
50
|
-
...label
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('skips already existing labels', async () => {
|
|
56
|
-
const existing = [{ name: 'priority: high' }, { name: 'group: docs' }];
|
|
57
|
-
mockListLabelsForRepo.mockResolvedValue({ data: existing });
|
|
58
|
-
|
|
59
|
-
await ensureRoadmapLabels({ token: 'test-token', owner: 'ali', repo: 'rag-pipeline-utils' });
|
|
60
|
-
|
|
61
|
-
const expected = roadmapLabels.filter(l => !existing.some(e => e.name === l.name));
|
|
62
|
-
expect(mockCreateLabel).toHaveBeenCalledTimes(expected.length);
|
|
63
|
-
});
|
|
64
|
-
});
|