@devilsdev/rag-pipeline-utils 2.1.7 → 2.1.9
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 -186
- 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 -23
- 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/auto-release-note.yml +0 -73
- package/.github/workflows/ci.yml +0 -55
- package/.github/workflows/docs-ci.yml +0 -46
- package/.github/workflows/docs-deploy.yml +0 -64
- package/.github/workflows/enforce-release-review.yml +0 -50
- package/.github/workflows/generate-blog-post.yml +0 -44
- package/.github/workflows/post-release-generate-blog.yml +0 -71
- 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/.github/workflows/verify-blog-badge.yml +0 -50
- package/.husky/pre-commit +0 -6
- package/CHANGELOG.md +0 -131
- 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/2025-04-22-release-v2.1.5.md +0 -13
- package/docs-site/blog/2025-04-24-v2.1.6.md +0 -21
- 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 -110
- package/scripts/get-previous-tag.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
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.0.0
|
|
3
|
-
* Description: Syncs roadmap items from a structured Markdown file into GitHub Issues with labels and assignees.
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import { Octokit } from 'octokit';
|
|
10
|
-
import dotenv from 'dotenv';
|
|
11
|
-
|
|
12
|
-
dotenv.config();
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* GitHub Personal Access Token required via .env or CI secrets
|
|
16
|
-
* Ensure the token has 'repo' scope for private issue creation.
|
|
17
|
-
*/
|
|
18
|
-
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
|
|
19
|
-
const GITHUB_REPO = process.env.GITHUB_REPO; // e.g. DevilsDev/rag-pipeline-utils
|
|
20
|
-
const ROADMAP_PATH = path.resolve('.github/PROJECT_ROADMAP.md');
|
|
21
|
-
|
|
22
|
-
if (!GITHUB_TOKEN || !GITHUB_REPO) {
|
|
23
|
-
console.error('❌ GITHUB_TOKEN and GITHUB_REPO must be defined in environment.');
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const octokit = new Octokit({ auth: GITHUB_TOKEN });
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Parse roadmap Markdown file into structured issue definitions
|
|
31
|
-
*/
|
|
32
|
-
function parseRoadmapMarkdown(markdown) {
|
|
33
|
-
const lines = markdown.split('\n');
|
|
34
|
-
const issues = [];
|
|
35
|
-
|
|
36
|
-
for (const line of lines) {
|
|
37
|
-
if (line.startsWith('|')) {
|
|
38
|
-
const cells = line.split('|').map(c => c.trim());
|
|
39
|
-
|
|
40
|
-
if (cells.length < 6 || cells[0] === 'Phase') continue;
|
|
41
|
-
|
|
42
|
-
const [, phase, priority, feature, group, tags] = cells;
|
|
43
|
-
|
|
44
|
-
issues.push({
|
|
45
|
-
title: `${phase.trim()}: ${feature.trim()}`,
|
|
46
|
-
body: `**Feature Group:** ${group}\n**Priority:** ${priority}`,
|
|
47
|
-
labels: [phase, priority, ...tags.split(',').map(tag => tag.trim())].filter(Boolean),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return issues;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Create an issue in GitHub if it doesn't already exist
|
|
57
|
-
*/
|
|
58
|
-
async function createOrUpdateIssues(issues) {
|
|
59
|
-
const [owner, repo] = GITHUB_REPO.split('/');
|
|
60
|
-
|
|
61
|
-
const { data: existingIssues } = await octokit.rest.issues.listForRepo({
|
|
62
|
-
owner,
|
|
63
|
-
repo,
|
|
64
|
-
state: 'all',
|
|
65
|
-
per_page: 100,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
for (const issue of issues) {
|
|
69
|
-
const exists = existingIssues.find(i => i.title === issue.title);
|
|
70
|
-
if (exists) {
|
|
71
|
-
console.log(`✅ Skipped (exists): ${issue.title}`);
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
await octokit.rest.issues.create({
|
|
76
|
-
owner,
|
|
77
|
-
repo,
|
|
78
|
-
title: issue.title,
|
|
79
|
-
body: issue.body,
|
|
80
|
-
labels: issue.labels,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
console.log(`➕ Created: ${issue.title}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Entrypoint
|
|
89
|
-
*/
|
|
90
|
-
async function main() {
|
|
91
|
-
try {
|
|
92
|
-
const roadmap = fs.readFileSync(ROADMAP_PATH, 'utf-8');
|
|
93
|
-
const issues = parseRoadmapMarkdown(roadmap);
|
|
94
|
-
await createOrUpdateIssues(issues);
|
|
95
|
-
console.log(`🎯 Synced ${issues.length} roadmap issues.`);
|
|
96
|
-
} catch (err) {
|
|
97
|
-
console.error('🚨 Roadmap sync failed:', err.message);
|
|
98
|
-
process.exit(1);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
main();
|
package/scripts/ci-runner.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.1.0
|
|
3
|
-
* Description: CI runner for linting, mock validation, testing and coverage
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
* File: scripts/ci-runner.js
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { execSync } from 'child_process';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { pathToFileURL } from 'url';
|
|
11
|
-
import fs from 'fs';
|
|
12
|
-
|
|
13
|
-
// Entry helpers
|
|
14
|
-
const ROOT = path.resolve();
|
|
15
|
-
const resolveScript = (relPath) => pathToFileURL(path.resolve(ROOT, relPath)).href;
|
|
16
|
-
|
|
17
|
-
const run = (label, command) => {
|
|
18
|
-
console.log(`\n🔧 Running: ${label}`);
|
|
19
|
-
try {
|
|
20
|
-
execSync(command, { stdio: 'inherit', cwd: ROOT });
|
|
21
|
-
console.log(`✅ ${label} passed`);
|
|
22
|
-
} catch (err) {
|
|
23
|
-
console.error(`❌ ${label} failed`);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const runDynamicModule = async (label, modulePath) => {
|
|
29
|
-
console.log(`\n🔍 Validating: ${label}`);
|
|
30
|
-
try {
|
|
31
|
-
const mod = await import(resolveScript(modulePath));
|
|
32
|
-
if (typeof mod.default === 'function') await mod.default();
|
|
33
|
-
console.log(`✅ ${label} passed`);
|
|
34
|
-
} catch (err) {
|
|
35
|
-
console.error(`❌ ${label} failed:\n${err.message}`);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
(async () => {
|
|
41
|
-
// Step 1: Lint
|
|
42
|
-
run('Lint', 'npx eslint . --ext .js,.ts');
|
|
43
|
-
|
|
44
|
-
// Step 2: Verify mocks for required interface methods
|
|
45
|
-
await runDynamicModule('Fixture Mock Interface Validation', 'scripts/verify-fixture-mocks.js');
|
|
46
|
-
|
|
47
|
-
// Step 3: Test and coverage
|
|
48
|
-
run('Unit + Integration Tests w/ Coverage', 'cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage');
|
|
49
|
-
|
|
50
|
-
console.log('\n🎉 CI runner completed successfully.\n');
|
|
51
|
-
})();
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.1.0
|
|
3
|
-
* Description: Closes GitHub issues marked as ✅ Done in the PROJECT_ROADMAP.md
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import { Octokit } from 'octokit';
|
|
9
|
-
|
|
10
|
-
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
|
|
11
|
-
const OWNER = 'DevilsDev';
|
|
12
|
-
const REPO = 'rag-pipeline-utils';
|
|
13
|
-
const ROADMAP_PATH = '.github/PROJECT_ROADMAP.md';
|
|
14
|
-
|
|
15
|
-
const octokit = new Octokit({ auth: GITHUB_TOKEN });
|
|
16
|
-
|
|
17
|
-
async function closeDoneIssues() {
|
|
18
|
-
const content = fs.readFileSync(ROADMAP_PATH, 'utf-8');
|
|
19
|
-
const lines = content.split('\n').filter(line => line.startsWith('|'));
|
|
20
|
-
if (lines.length < 3) {
|
|
21
|
-
console.log('⚠️ No roadmap rows found to evaluate.');
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const rows = lines.slice(2); // Skip header and separator
|
|
26
|
-
|
|
27
|
-
const { data: issues } = await octokit.rest.issues.listForRepo({
|
|
28
|
-
owner: OWNER,
|
|
29
|
-
repo: REPO,
|
|
30
|
-
state: 'open',
|
|
31
|
-
per_page: 100
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
for (const row of rows) {
|
|
35
|
-
const cols = row.split('|').map(col => col.trim());
|
|
36
|
-
const [, , , title, , status] = cols;
|
|
37
|
-
|
|
38
|
-
const safeStatus = status?.toLowerCase?.();
|
|
39
|
-
if (!safeStatus || !safeStatus.includes('✅')) continue;
|
|
40
|
-
|
|
41
|
-
const match = issues.find(issue => issue.title.trim() === title.trim());
|
|
42
|
-
if (!match) continue;
|
|
43
|
-
|
|
44
|
-
await octokit.rest.issues.createComment({
|
|
45
|
-
owner: OWNER,
|
|
46
|
-
repo: REPO,
|
|
47
|
-
issue_number: match.number,
|
|
48
|
-
body: '✅ Automatically closed from roadmap sync.'
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
await octokit.rest.issues.update({
|
|
52
|
-
owner: OWNER,
|
|
53
|
-
repo: REPO,
|
|
54
|
-
issue_number: match.number,
|
|
55
|
-
state: 'closed'
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
console.log(`🔒 Closed: #${match.number} "${title}"`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
closeDoneIssues().catch(error => {
|
|
63
|
-
console.error('❌ Error closing roadmap issues:', error);
|
|
64
|
-
process.exit(1);
|
|
65
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// scripts/create-roadmap-issues.js
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Version: 2.0.0
|
|
5
|
-
* Description: Parses PROJECT_ROADMAP.md and syncs GitHub issues
|
|
6
|
-
* Author: Ali Kahwaji
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import fs from 'fs/promises';
|
|
10
|
-
import path from 'path';
|
|
11
|
-
import { Octokit } from 'octokit';
|
|
12
|
-
import yaml from 'js-yaml';
|
|
13
|
-
|
|
14
|
-
const roadmapPath = new URL('../.github/PROJECT_ROADMAP.md', import.meta.url);
|
|
15
|
-
|
|
16
|
-
export async function createRoadmapIssues({ token, owner, repo }) {
|
|
17
|
-
const octokit = new Octokit({ auth: token });
|
|
18
|
-
const content = await fs.readFile(roadmapPath, 'utf-8');
|
|
19
|
-
|
|
20
|
-
const blocks = content.split(/^##\s+/gm).slice(1);
|
|
21
|
-
|
|
22
|
-
for (const block of blocks) {
|
|
23
|
-
const [header, ...bodyLines] = block.trim().split('\n');
|
|
24
|
-
const title = header.trim();
|
|
25
|
-
const metadata = {};
|
|
26
|
-
const description = [];
|
|
27
|
-
|
|
28
|
-
for (const line of bodyLines) {
|
|
29
|
-
if (line.includes(':') && line.includes('**')) {
|
|
30
|
-
const [key, val] = line.split(':');
|
|
31
|
-
metadata[key.trim()] = val.replace(/\*\*/g, '').trim();
|
|
32
|
-
} else {
|
|
33
|
-
description.push(line);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const issue = await octokit.rest.issues.create({
|
|
38
|
-
owner,
|
|
39
|
-
repo,
|
|
40
|
-
title,
|
|
41
|
-
body: description.join('\n'),
|
|
42
|
-
labels: [metadata.Priority, metadata.Group].filter(Boolean),
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
console.log(`✅ Created: ${issue.data.title}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 2.0.1
|
|
3
|
-
* Path: scripts/ensure-roadmap-labels.js
|
|
4
|
-
* Description: Ensures consistent GitHub labels for roadmap tracking and automation.
|
|
5
|
-
* Author: Ali Kahwaji
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { Octokit } from 'octokit';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Label definitions for roadmap tracking.
|
|
13
|
-
* Modify this array to add or update roadmap labels.
|
|
14
|
-
* Each object must include: name, color (hex), description.
|
|
15
|
-
*/
|
|
16
|
-
const roadmapLabels = [
|
|
17
|
-
{ name: 'priority: high', color: 'e11d48', description: 'High priority roadmap item' },
|
|
18
|
-
{ name: 'priority: medium', color: 'f59e0b', description: 'Medium priority roadmap item' },
|
|
19
|
-
{ name: 'priority: low', color: '10b981', description: 'Low priority roadmap item' },
|
|
20
|
-
{ name: 'group: docs', color: '6366f1', description: 'Documentation features' },
|
|
21
|
-
{ name: 'group: devx', color: '06b6d4', description: 'Developer experience improvements' },
|
|
22
|
-
{ name: 'group: community', color: 'ec4899', description: 'Community tools & engagement' },
|
|
23
|
-
{ name: 'group: blog', color: 'f97316', description: 'Blog & SEO enhancements' },
|
|
24
|
-
{ name: 'group: infra', color: '64748b', description: 'Infrastructure & deployment features' },
|
|
25
|
-
{ name: 'group: hydra', color: '9333ea', description: 'Hydra runtime & configuration' },
|
|
26
|
-
{ name: 'status: done', color: '10b981', description: 'Issue has been completed' }
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Ensures all roadmap labels are present in the target GitHub repository.
|
|
31
|
-
* Skips label creation if already present.
|
|
32
|
-
*
|
|
33
|
-
* @param {Object} params
|
|
34
|
-
* @param {string} params.token - GitHub access token
|
|
35
|
-
* @param {string} params.owner - Repository owner
|
|
36
|
-
* @param {string} params.repo - Repository name
|
|
37
|
-
*/
|
|
38
|
-
async function ensureRoadmapLabels({ token, owner, repo }) {
|
|
39
|
-
const octokit = new Octokit({ auth: token });
|
|
40
|
-
|
|
41
|
-
const { data: existingLabels } = await octokit.rest.issues.listLabelsForRepo({
|
|
42
|
-
owner,
|
|
43
|
-
repo
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const existingNames = new Set(existingLabels.map((label) => label.name));
|
|
47
|
-
|
|
48
|
-
for (const label of roadmapLabels) {
|
|
49
|
-
if (!existingNames.has(label.name)) {
|
|
50
|
-
await octokit.rest.issues.createLabel({ owner, repo, ...label });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// CLI support
|
|
56
|
-
if (process.argv[1] === new URL(import.meta.url).pathname) {
|
|
57
|
-
const [owner, repo] = process.env.GITHUB_REPOSITORY?.split('/') || [];
|
|
58
|
-
const token = process.env.GITHUB_TOKEN;
|
|
59
|
-
|
|
60
|
-
if (!token || !owner || !repo) {
|
|
61
|
-
console.error('Missing required GITHUB_TOKEN or GITHUB_REPOSITORY');
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
ensureRoadmapLabels({ token, owner, repo })
|
|
66
|
-
.then(() => console.log('✅ Roadmap labels ensured'))
|
|
67
|
-
.catch((err) => {
|
|
68
|
-
console.error('Label sync failed:', err);
|
|
69
|
-
process.exit(1);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { ensureRoadmapLabels, roadmapLabels };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.0.0
|
|
3
|
-
* Description: Rewrites blog .mdx files to use SSR-safe BlogImage.jsx import
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
|
|
10
|
-
const BLOG_DIR = path.resolve('docs-site', 'blog');
|
|
11
|
-
const TARGET_IMPORT = 'import BlogImage from \'../src/components/BlogImage\'';
|
|
12
|
-
const OLD_IMPORT_REGEX = /import\s+BlogImage\s+from\s+['"].+BlogImage[^'"]*['"];/g;
|
|
13
|
-
|
|
14
|
-
function fixImportInFile(filePath) {
|
|
15
|
-
let content = fs.readFileSync(filePath, 'utf-8');
|
|
16
|
-
|
|
17
|
-
// If already correct, skip
|
|
18
|
-
if (content.includes(TARGET_IMPORT)) {
|
|
19
|
-
console.log(`✔️ ${path.basename(filePath)} already uses safe import.`);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const replaced = content.replace(OLD_IMPORT_REGEX, TARGET_IMPORT);
|
|
24
|
-
|
|
25
|
-
if (replaced !== content) {
|
|
26
|
-
fs.writeFileSync(filePath, replaced);
|
|
27
|
-
console.log(`✅ Updated: ${path.basename(filePath)}`);
|
|
28
|
-
} else {
|
|
29
|
-
// No previous import, insert at top
|
|
30
|
-
fs.writeFileSync(filePath, `${TARGET_IMPORT}\n\n${content}`);
|
|
31
|
-
console.log(`➕ Injected import: ${path.basename(filePath)}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function walkDir(dir) {
|
|
36
|
-
const files = fs.readdirSync(dir);
|
|
37
|
-
for (const f of files) {
|
|
38
|
-
const fullPath = path.join(dir, f);
|
|
39
|
-
const stat = fs.statSync(fullPath);
|
|
40
|
-
if (stat.isDirectory()) {
|
|
41
|
-
walkDir(fullPath);
|
|
42
|
-
} else if (f.endsWith('.mdx')) {
|
|
43
|
-
fixImportInFile(fullPath);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
console.log('🔍 Scanning MDX blog files...');
|
|
49
|
-
walkDir(BLOG_DIR);
|
|
50
|
-
console.log('🎉 Import rewrite complete.');
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// fix-mdx-image-imports.js
|
|
2
|
-
// Version: 1.0.0
|
|
3
|
-
// Description: Auto-wrap all BlogImage imports with SafeImageWrapper to avoid SSR issues.
|
|
4
|
-
|
|
5
|
-
import fs from 'fs';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import glob from 'glob';
|
|
8
|
-
|
|
9
|
-
const blogDir = path.resolve('docs-site', 'blog');
|
|
10
|
-
|
|
11
|
-
glob(`${blogDir}/**/*.mdx`, (err, files) => {
|
|
12
|
-
if (err) throw err;
|
|
13
|
-
|
|
14
|
-
files.forEach((file) => {
|
|
15
|
-
let content = fs.readFileSync(file, 'utf8');
|
|
16
|
-
|
|
17
|
-
if (content.includes('from \'@site/src/components/BlogImage\'')) {
|
|
18
|
-
content = content
|
|
19
|
-
.replace(/from '@site\/src\/components\/BlogImage'/g, 'from \'@site/src/components/SafeImageWrapper\'')
|
|
20
|
-
.replace(/<BlogImage/g, '<SafeImageWrapper')
|
|
21
|
-
.replace(/<\/BlogImage>/g, '</SafeImageWrapper>');
|
|
22
|
-
|
|
23
|
-
fs.writeFileSync(file, content, 'utf8');
|
|
24
|
-
console.log(`✔️ Updated: ${file}`);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// scripts/generate-release-note.js
|
|
2
|
-
/**
|
|
3
|
-
* Version: 2.3.0
|
|
4
|
-
* Description: Generate release blog + changelog section, auto-push to Git, fallback to safe defaults
|
|
5
|
-
* Author: Ali Kahwaji
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { execSync } from 'child_process';
|
|
11
|
-
import { fileURLToPath } from 'url';
|
|
12
|
-
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = path.dirname(__filename);
|
|
15
|
-
|
|
16
|
-
const [, , newVersionArg, previousVersionArg] = process.argv;
|
|
17
|
-
|
|
18
|
-
if (!newVersionArg) {
|
|
19
|
-
console.error('❌ Usage: node scripts/generate-release-note.js <new-tag> <previous-tag?>');
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const newVersion = newVersionArg.startsWith('v') ? newVersionArg : `v${newVersionArg}`;
|
|
24
|
-
|
|
25
|
-
// 🔁 Fallback to previous git tag
|
|
26
|
-
function resolvePreviousTag() {
|
|
27
|
-
try {
|
|
28
|
-
const tags = execSync('git tag --sort=-creatordate', { encoding: 'utf-8' })
|
|
29
|
-
.split('\n')
|
|
30
|
-
.filter(Boolean);
|
|
31
|
-
const idx = tags.indexOf(newVersion);
|
|
32
|
-
return tags[idx + 1] || tags[1] || null;
|
|
33
|
-
} catch {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const prevVersion = previousVersionArg || resolvePreviousTag();
|
|
39
|
-
if (!prevVersion) {
|
|
40
|
-
console.error('❌ Could not resolve previous tag.');
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 📦 Get commits between versions
|
|
45
|
-
function getCommits(from, to) {
|
|
46
|
-
try {
|
|
47
|
-
return execSync(`git log ${from}..${to} --pretty=format:"- %s"`, { encoding: 'utf-8' });
|
|
48
|
-
} catch (err) {
|
|
49
|
-
console.error('❌ Failed to fetch commits:', err.message);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function generateChangelogSection(commits) {
|
|
55
|
-
return `## ${newVersion}\n\n${commits}\n\n---\n`;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function generateBlogMarkdown(version, commits) {
|
|
59
|
-
const date = new Date().toISOString().slice(0, 10);
|
|
60
|
-
const slug = `release-${version}`;
|
|
61
|
-
return `---
|
|
62
|
-
slug: ${slug}
|
|
63
|
-
title: "🚀 Version ${version} Released"
|
|
64
|
-
authors: [ali]
|
|
65
|
-
tags: [release, changelog]
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
RAG Pipeline Utils **${version}** is now available on NPM!
|
|
69
|
-
|
|
70
|
-
## 🔧 Changes
|
|
71
|
-
|
|
72
|
-
${commits}
|
|
73
|
-
|
|
74
|
-
## 🔗 Resources
|
|
75
|
-
|
|
76
|
-
- GitHub Compare: [${prevVersion}...${version}](https://github.com/DevilsDev/rag-pipeline-utils/compare/${prevVersion}...${version})
|
|
77
|
-
- View full [CHANGELOG on GitHub](https://github.com/DevilsDev/rag-pipeline-utils/blob/main/CHANGELOG.md)
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const commits = getCommits(prevVersion, newVersion);
|
|
82
|
-
const blogContent = generateBlogMarkdown(newVersion, commits);
|
|
83
|
-
const changelogSection = generateChangelogSection(commits);
|
|
84
|
-
|
|
85
|
-
// 📍 Paths
|
|
86
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
87
|
-
const blogPath = path.join(__dirname, `../docs-site/blog/${today}-${newVersion}.md`);
|
|
88
|
-
const changelogPath = path.join(__dirname, '../CHANGELOG.md');
|
|
89
|
-
|
|
90
|
-
// 📝 Write blog + changelog
|
|
91
|
-
fs.writeFileSync(blogPath, blogContent, 'utf-8');
|
|
92
|
-
fs.appendFileSync(changelogPath, `\n${changelogSection}`, 'utf-8');
|
|
93
|
-
|
|
94
|
-
// 🔐 Commit and push
|
|
95
|
-
try {
|
|
96
|
-
execSync('git config user.name "github-actions[bot]"');
|
|
97
|
-
execSync('git config user.email "41898282+github-actions[bot]@users.noreply.github.com"');
|
|
98
|
-
execSync('git add CHANGELOG.md docs-site/blog/*.md');
|
|
99
|
-
execSync(`git commit -m "docs(release): publish changelog and blog for ${newVersion}"`);
|
|
100
|
-
execSync('git push origin main');
|
|
101
|
-
console.log(`✅ Blog + changelog committed for ${newVersion}`);
|
|
102
|
-
} catch (err) {
|
|
103
|
-
console.warn('⚠️ Git commit skipped (already committed or no changes).');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// 📦 Local preview
|
|
107
|
-
console.log('\n📘 Blog Preview:\n');
|
|
108
|
-
console.log(blogContent);
|
|
109
|
-
console.log('\n📘 Changelog Section:\n');
|
|
110
|
-
console.log(changelogSection);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 1.0.0
|
|
3
|
-
* Description: Helper to find the previous Git semver tag before a given tag
|
|
4
|
-
* Usage: node scripts/get-previous-tag.js v2.1.5
|
|
5
|
-
* Output: v2.1.4
|
|
6
|
-
* Author: Ali Kahwaji
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { execSync } from 'child_process';
|
|
10
|
-
|
|
11
|
-
const currentTag = process.argv[2];
|
|
12
|
-
|
|
13
|
-
if (!currentTag) {
|
|
14
|
-
console.error('❌ Usage: node get-previous-tag.js <current-tag>');
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
// Ensure full tag history
|
|
20
|
-
execSync('git fetch --tags --unshallow 2>/dev/null || git fetch --tags', { stdio: 'inherit' });
|
|
21
|
-
|
|
22
|
-
// List all tags sorted by version (most recent last), remove current tag
|
|
23
|
-
const tags = execSync('git tag --sort=version:refname', { encoding: 'utf-8' })
|
|
24
|
-
.split('\n')
|
|
25
|
-
.map(tag => tag.trim())
|
|
26
|
-
.filter(Boolean);
|
|
27
|
-
|
|
28
|
-
const idx = tags.indexOf(currentTag);
|
|
29
|
-
|
|
30
|
-
if (idx <= 0) {
|
|
31
|
-
console.error('⚠️ Could not find previous tag before', currentTag);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const previousTag = tags[idx - 1];
|
|
36
|
-
console.log(previousTag);
|
|
37
|
-
} catch (err) {
|
|
38
|
-
console.error('❌ Failed to resolve previous tag:', err.message);
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version: 2.0.0
|
|
3
|
-
* Description: Auto-label roadmap issues and clean up outdated items
|
|
4
|
-
* Author: Ali Kahwaji
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { Octokit } from 'octokit';
|
|
8
|
-
import fs from 'fs/promises';
|
|
9
|
-
import 'dotenv/config';
|
|
10
|
-
|
|
11
|
-
const repo = process.env.GITHUB_REPO;
|
|
12
|
-
const token = process.env.GITHUB_TOKEN;
|
|
13
|
-
const ROADMAP_FILE = '.github/PROJECT_ROADMAP.md';
|
|
14
|
-
const CLOSE_STALE = true;
|
|
15
|
-
|
|
16
|
-
if (!repo || !token) {
|
|
17
|
-
console.error('Missing GITHUB_REPO or GITHUB_TOKEN env vars');
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const [owner, repoName] = repo.split('/');
|
|
22
|
-
const octokit = new Octokit({ auth: token });
|
|
23
|
-
|
|
24
|
-
const PRIORITY_LABELS = {
|
|
25
|
-
High: 'priority: high',
|
|
26
|
-
Medium: 'priority: medium',
|
|
27
|
-
Low: 'priority: low',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const GROUP_LABELS = {
|
|
31
|
-
'Documentation': 'group: docs',
|
|
32
|
-
'Developer Experience': 'group: devx',
|
|
33
|
-
'Community': 'group: community',
|
|
34
|
-
'Blog & SEO': 'group: blog',
|
|
35
|
-
'Infrastructure': 'group: infra',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
function parseRoadmapMarkdown(content) {
|
|
39
|
-
const lines = content.split('\n').filter(l => l.includes('|'));
|
|
40
|
-
const titles = new Set();
|
|
41
|
-
|
|
42
|
-
for (const line of lines) {
|
|
43
|
-
const parts = line.split('|').map(p => p.trim());
|
|
44
|
-
if (parts.length < 4 || parts[0] === 'Phase') continue;
|
|
45
|
-
const title = parts[3];
|
|
46
|
-
titles.add(title);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return titles;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function run() {
|
|
53
|
-
const roadmapRaw = await fs.readFile(ROADMAP_FILE, 'utf8');
|
|
54
|
-
const roadmapTitles = parseRoadmapMarkdown(roadmapRaw);
|
|
55
|
-
|
|
56
|
-
const issues = await octokit.paginate(octokit.rest.issues.listForRepo, {
|
|
57
|
-
owner,
|
|
58
|
-
repo: repoName,
|
|
59
|
-
state: 'open',
|
|
60
|
-
per_page: 100,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
for (const issue of issues) {
|
|
64
|
-
if (issue.pull_request) continue;
|
|
65
|
-
|
|
66
|
-
const title = issue.title.trim();
|
|
67
|
-
const body = issue.body || '';
|
|
68
|
-
const labels = new Set(issue.labels.map(l => typeof l === 'string' ? l : l.name));
|
|
69
|
-
|
|
70
|
-
const priority = Object.keys(PRIORITY_LABELS).find(p => body.includes(`Priority: ${p}`));
|
|
71
|
-
const group = Object.keys(GROUP_LABELS).find(g => body.includes(`Group: ${g}`));
|
|
72
|
-
|
|
73
|
-
const expectedLabels = [
|
|
74
|
-
...(priority ? [PRIORITY_LABELS[priority]] : []),
|
|
75
|
-
...(group ? [GROUP_LABELS[group]] : [])
|
|
76
|
-
];
|
|
77
|
-
|
|
78
|
-
const currentRoadmap = roadmapTitles.has(title);
|
|
79
|
-
|
|
80
|
-
// Update Labels
|
|
81
|
-
const labelsToAdd = expectedLabels.filter(label => !labels.has(label));
|
|
82
|
-
const labelsToRemove = [...labels].filter(label =>
|
|
83
|
-
Object.values(PRIORITY_LABELS).includes(label) ||
|
|
84
|
-
Object.values(GROUP_LABELS).includes(label)
|
|
85
|
-
).filter(label => !expectedLabels.includes(label));
|
|
86
|
-
|
|
87
|
-
if (labelsToAdd.length > 0 || labelsToRemove.length > 0) {
|
|
88
|
-
console.log(`🔁 Updating labels for issue #${issue.number}: ${title}`);
|
|
89
|
-
if (labelsToAdd.length) {
|
|
90
|
-
await octokit.rest.issues.addLabels({
|
|
91
|
-
owner,
|
|
92
|
-
repo: repoName,
|
|
93
|
-
issue_number: issue.number,
|
|
94
|
-
labels: labelsToAdd,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (labelsToRemove.length) {
|
|
98
|
-
for (const label of labelsToRemove) {
|
|
99
|
-
await octokit.rest.issues.removeLabel({
|
|
100
|
-
owner,
|
|
101
|
-
repo: repoName,
|
|
102
|
-
issue_number: issue.number,
|
|
103
|
-
name: label,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Optionally Close stale issues
|
|
110
|
-
if (CLOSE_STALE && !currentRoadmap) {
|
|
111
|
-
console.log(`🧹 Closing stale issue #${issue.number} (${title}) – not in roadmap`);
|
|
112
|
-
await octokit.rest.issues.update({
|
|
113
|
-
owner,
|
|
114
|
-
repo: repoName,
|
|
115
|
-
issue_number: issue.number,
|
|
116
|
-
state: 'closed',
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
run().catch(err => {
|
|
123
|
-
console.error('❌ Label script failed:', err);
|
|
124
|
-
process.exit(1);
|
|
125
|
-
});
|